diff --git a/.backportrc.json b/.backportrc.json index 384e221329a4f..59a101195bef7 100644 --- a/.backportrc.json +++ b/.backportrc.json @@ -3,6 +3,7 @@ "targetBranchChoices": [ { "name": "master", "checked": true }, { "name": "7.x", "checked": true }, + "7.13", "7.12", "7.11", "7.10", @@ -30,7 +31,7 @@ "targetPRLabels": ["backport"], "branchLabelMapping": { "^v8.0.0$": "master", - "^v7.13.0$": "7.x", + "^v7.14.0$": "7.x", "^v(\\d+).(\\d+).\\d+$": "$1.$2" }, "autoMerge": true, diff --git a/.eslintignore b/.eslintignore index 4058d971b7642..ce21d5bb31264 100644 --- a/.eslintignore +++ b/.eslintignore @@ -1,5 +1,4 @@ **/*.js.snap -**/graphql/types.ts /.es /.chromium /build diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 0692e94e8b028..cae64a24ec2cd 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -272,7 +272,7 @@ /x-pack/test/functional_with_es_ssl/apps/triggers_actions_ui/ @elastic/kibana-alerting-services /x-pack/test/functional_with_es_ssl/fixtures/plugins/alerts/ @elastic/kibana-alerting-services /docs/user/alerting/ @elastic/kibana-alerting-services -/docs/management/alerting/ @elastic/kibana-alerting-services +/docs/management/connectors/ @elastic/kibana-alerting-services #CC# /x-pack/plugins/stack_alerts @elastic/kibana-alerting-services # Enterprise Search diff --git a/.telemetryrc.json b/.telemetryrc.json index a408a5e2842f9..3b404f98af5cc 100644 --- a/.telemetryrc.json +++ b/.telemetryrc.json @@ -2,6 +2,8 @@ { "output": "src/plugins/telemetry/schema/oss_plugins.json", "root": "src/plugins/", - "exclude": [] + "exclude": [ + "src/plugins/kibana_usage_collection/server/collectors/config_usage/register_config_usage_collector.ts" + ] } ] diff --git a/docs/apm/agent-configuration.asciidoc b/docs/apm/agent-configuration.asciidoc index aaaca867a5a01..2574d254ac14c 100644 --- a/docs/apm/agent-configuration.asciidoc +++ b/docs/apm/agent-configuration.asciidoc @@ -46,7 +46,7 @@ Go Agent:: {apm-go-ref}/configuration.html[Configuration reference] Java Agent:: {apm-java-ref}/configuration.html[Configuration reference] .NET Agent:: {apm-dotnet-ref}/configuration.html[Configuration reference] Node.js Agent:: {apm-node-ref}/configuration.html[Configuration reference] -PHP Agent:: _Not yet supported_ +PHP Agent:: {apm-php-ref}/configuration.html[Configuration reference] Python Agent:: {apm-py-ref}/configuration.html[Configuration reference] Ruby Agent:: {apm-ruby-ref}/configuration.html[Configuration reference] Real User Monitoring (RUM) Agent:: {apm-rum-ref}/configuration.html[Configuration reference] diff --git a/docs/concepts/images/add-filter-popup.png b/docs/concepts/images/add-filter-popup.png index f1b5b1ff3f6ca..f96c8746ef17a 100644 Binary files a/docs/concepts/images/add-filter-popup.png and b/docs/concepts/images/add-filter-popup.png differ diff --git a/docs/concepts/images/refresh-every.png b/docs/concepts/images/refresh-every.png index a0930a6c56a65..ea3b24d80b8c3 100644 Binary files a/docs/concepts/images/refresh-every.png and b/docs/concepts/images/refresh-every.png differ diff --git a/docs/concepts/images/save-icon.png b/docs/concepts/images/save-icon.png index 959c7ef8e1bb9..7841cd58c9d6d 100644 Binary files a/docs/concepts/images/save-icon.png and b/docs/concepts/images/save-icon.png differ diff --git a/docs/concepts/images/saved-query-popup.png b/docs/concepts/images/saved-query-popup.png new file mode 100644 index 0000000000000..93973b8de0a54 Binary files /dev/null and b/docs/concepts/images/saved-query-popup.png differ diff --git a/docs/concepts/images/saved-query.png b/docs/concepts/images/saved-query.png new file mode 100644 index 0000000000000..5db819ce648e8 Binary files /dev/null and b/docs/concepts/images/saved-query.png differ diff --git a/docs/concepts/images/time-filter-icon.png b/docs/concepts/images/time-filter-icon.png new file mode 100644 index 0000000000000..f920453879d4d Binary files /dev/null and b/docs/concepts/images/time-filter-icon.png differ diff --git a/docs/concepts/images/time-filter.png b/docs/concepts/images/time-filter.png new file mode 100644 index 0000000000000..e3a1ce2216c1c Binary files /dev/null and b/docs/concepts/images/time-filter.png differ diff --git a/docs/concepts/images/time-relative.png b/docs/concepts/images/time-relative.png new file mode 100644 index 0000000000000..b77d55df2d9ea Binary files /dev/null and b/docs/concepts/images/time-relative.png differ diff --git a/docs/management/index-patterns.asciidoc b/docs/concepts/index-patterns.asciidoc similarity index 98% rename from docs/management/index-patterns.asciidoc rename to docs/concepts/index-patterns.asciidoc index 3d9253025d3cc..158fa6282e6fa 100644 --- a/docs/management/index-patterns.asciidoc +++ b/docs/concepts/index-patterns.asciidoc @@ -1,5 +1,5 @@ [[index-patterns]] -== Create an index pattern +=== Create an index pattern {kib} requires an index pattern to access the {es} data that you want to explore. An index pattern selects the data to use and allows you to define properties of the fields. @@ -126,7 +126,7 @@ pattern: ``` You can use exclusions to exclude indices that might contain mapping errors. -To match indices starting with `logstash-`, and exclude those starting with `logstash-old` from +To match indices starting with `logstash-`, and exclude those starting with `logstash-old` from all clusters having a name starting with `cluster_`, you can use `cluster_*:logstash-*,cluster*:logstash-old*`. To exclude a cluster, use `cluster_*:logstash-*,cluster_one:-*`. @@ -152,7 +152,7 @@ move between {kib} apps. image:management/index-patterns/images/new-index-pattern.png["Create index pattern"] [float] -==== Format the display of common field types +=== Format the display of common field types Whenever possible, {kib} uses the same field type for display as {es}. However, some field types that {es} supports are not available diff --git a/docs/concepts/index.asciidoc b/docs/concepts/index.asciidoc index 70b8a5265ce8a..983ab671cbd53 100644 --- a/docs/concepts/index.asciidoc +++ b/docs/concepts/index.asciidoc @@ -1,5 +1,5 @@ [[kibana-concepts-analysts]] -== {kib} concepts for analysts +== {kib} concepts **_Learn the shared concepts for analyzing and visualizing your data_** As an analyst, you will use a combination of {kib} apps to analyze and @@ -65,7 +65,7 @@ Each app in {kib} provides a time filter, and most apps also include semi-struct image:concepts/images/top-bar.png["Time filter, semi-structured search, and filters in a {kib} app"] If you frequently use any of the search options, you can click the -save icon +save query icon image:concepts/images/save-icon.png["save icon"] next to the semi-structured search to save or load a previously saved query. The saved query will always contain the semi-structured search query, @@ -127,6 +127,7 @@ filters is combined with AND logic on the rest of the query. [role="screenshot"] image:concepts/images/add-filter-popup.png["Add filter popup"] + [float] === Saving objects {kib} lets you save objects for your own future use or for sharing with others. @@ -147,3 +148,14 @@ Use the global search to quickly open a saved object. * Try the {kib} <>, which shows you how to put these concepts into action. * Go to <> for instructions on searching your data. + + +include::index-patterns.asciidoc[] + +include::set-time-filter.asciidoc[] + +include::kuery.asciidoc[] + +include::lucene.asciidoc[] + +include::save-query.asciidoc[] diff --git a/docs/discover/kuery.asciidoc b/docs/concepts/kuery.asciidoc similarity index 100% rename from docs/discover/kuery.asciidoc rename to docs/concepts/kuery.asciidoc diff --git a/docs/concepts/lucene.asciidoc b/docs/concepts/lucene.asciidoc new file mode 100644 index 0000000000000..589a03cef1318 --- /dev/null +++ b/docs/concepts/lucene.asciidoc @@ -0,0 +1,51 @@ +[[lucene-query]] +=== Lucene query syntax +Lucene query syntax is available to {kib} users who opt out of the <>. +Full documentation for this syntax is available as part of {es} +{ref}/query-dsl-query-string-query.html#query-string-syntax[query string syntax]. + +The main reason to use the Lucene query syntax in {kib} is for advanced +Lucene features, such as regular expressions or fuzzy term matching. However, +Lucene syntax is not able to search nested objects or scripted fields. + +To perform a free text search, simply enter a text string. For example, if +you're searching web server logs, you could enter `safari` to search all +fields: + +[source,yaml] +------------------- +safari +------------------- + +To search for a value in a specific field, prefix the value with the name +of the field: + +[source,yaml] +------------------- +status:200 +------------------- + +To search for a range of values, use the bracketed range syntax, +`[START_VALUE TO END_VALUE]`. For example, to find entries that have 4xx +status codes, you could enter `status:[400 TO 499]`. + +[source,yaml] +------------------- +status:[400 TO 499] +------------------- + +For an open range, use a wildcard: + +[source,yaml] +------------------- +status:[400 TO *] +------------------- + +To specify more complex search criteria, use the boolean operators +`AND`, `OR`, and `NOT`. For example, to find entries that have 4xx status +codes and have an extension of `php` or `html`: + +[source,yaml] +------------------- +status:[400 TO 499] AND (extension:php OR extension:html) +------------------- diff --git a/docs/concepts/save-query.asciidoc b/docs/concepts/save-query.asciidoc index 4f049d121bbef..fa626f6eaa913 100644 --- a/docs/concepts/save-query.asciidoc +++ b/docs/concepts/save-query.asciidoc @@ -1,39 +1,45 @@ [[save-load-delete-query]] -== Save a query -A saved query is a collection of query text and filters that you can -reuse in any app with a query bar, like <> and <>. Save a query when you want to: +=== Save a query -* Retrieve results from the same query at a later time without having to reenter the query text, add the filters or set the time filter -* View the results of the same query in multiple apps -* Share your query +Have you ever built a query that you wanted to reuse? +With saved queries, you can save your query text, filters, and time range for +reuse anywhere a query bar is present. -Saved queries don't include information specific to *Discover*, -such as the currently selected columns in the document table, the sort order, and the index pattern. -To save your current view of *Discover* for later retrieval and reuse, -create a <> instead. +For example, suppose you're in *Discover*, and you've put time into building +a query that includes query input text, multiple filters, and a specific time range. +Save this query, and you can embed the search results in dashboards, +use them as a foundation for building a visualization, +and share them in a link or CVS form. + +[role="screenshot"] +image:concepts/images/saved-query.png["Example of the saved query management popover with a list of saved queries"] -NOTE:: -If you have insufficient privileges to save queries, the *Save current query* -button isn't visible in the saved query management popover. +Saved queries are different than <>, +which include the *Discover* configuration—selected columns in the document table, sort order, and +index pattern—in addition to the query. +Saved searches are primarily used for adding search results to a dashboard. + +[role="xpack"] +==== Read-only access +If you have insufficient privileges to save queries, +the *Save* button isn't visible in the saved query management popover. For more information, see <> -. Click *#* in the query bar. +==== Save a query + +. Once you’ve built a query worth saving, click the save query icon image:concepts/images/save-icon.png["save query icon"]. . In the popover, click *Save current query*. -+ -[role="screenshot"] -image::discover/images/saved-query-management-component-all-privileges.png["Example of the saved query management popover with a list of saved queries with write access",width="80%"] -+ -. Enter a name, a description, and then select the filter options. +. Enter a unique name to identify the query and an optional description that will appear in a tooltip in the saved query popover. +. Choose whether to include or exclude filters and a time range. By default, filters are automatically included, but the time filter is not. + [role="screenshot"] -image::discover/images/saved-query-save-form-default-filters.png["Example of the saved query management save form with the filters option included and the time filter option excluded",width="80%"] +image:concepts/images/saved-query-popup.png["Example of the saved query management popover with a list of saved queries"] + . Click *Save*. -. To load a saved query into *Discover* or *Dashboard*, open the *Saved search* popover, and select the query. -. To manage your saved queries, use these actions in the popover: +. To load a saved query, select it in the *Saved query* popover. + -* Save as new: Save changes to the current query. -* Clear. Clear a query that is currently loaded in an app. -* Delete. You can’t recover a deleted query. -. To import and export saved queries, go to <>. +The query text, filters, and time range are updated and your data refreshed. +If you’re loading a saved query that did not include the filters or time range, those components remain as-is. +. To clear, modify, and delete saved queries, use the *Saved query* popover. diff --git a/docs/concepts/set-time-filter.asciidoc b/docs/concepts/set-time-filter.asciidoc new file mode 100644 index 0000000000000..7ab3c934e5770 --- /dev/null +++ b/docs/concepts/set-time-filter.asciidoc @@ -0,0 +1,31 @@ +[[set-time-filter]] +=== Set the time range +Display data within a +specified time range when your index contains time-based events, and a time-field is configured for the +selected <>. +The default time range is 15 minutes, but you can customize +it in <>. + +. Click image:concepts/images/time-filter-icon.png[clock icon]. + +. Choose one of the following: + +* *Quick select* to use a recent time range, then use the back and forward + arrows to move through the time ranges. + +* *Commonly used* to use a time range from options such as *Last 15 minutes*, + *Today*, and *Week to date*. + +* *Recently used date ranges* to use a previously selected data range. + +* *Refresh every* to specify an automatic refresh rate. ++ +[role="screenshot"] +image::concepts/images/time-filter.png[Time filter menu] + +. To set start and end times, click the bar next to the time filter. +In the popup, select *Absolute*, *Relative* or *Now*, then specify the required +options. ++ +[role="screenshot"] +image::concepts/images/time-relative.png[Time filter showing relative time] diff --git a/docs/developer/getting-started/index.asciidoc b/docs/developer/getting-started/index.asciidoc index d5fe7ebf47038..5ab0581201959 100644 --- a/docs/developer/getting-started/index.asciidoc +++ b/docs/developer/getting-started/index.asciidoc @@ -3,6 +3,21 @@ Get started building your own plugins, or contributing directly to the {kib} repo. +[discrete] +[[developing-on-windows]] +=== Developing on Windows + +In order to support Windows development we currently require you to use one of the following: + +- https://git-scm.com/download/win[Git bash] (other bash emulators like https://cmder.net/[Cmder] could work but we did not test them) +- https://docs.microsoft.com/en-us/windows/wsl/about[WSL] + +As well as installing https://www.microsoft.com/en-us/download/details.aspx?id=48145[Visual C++ Redistributable for Visual Studio 2015]. + +Before running the steps listed below, please make sure you have installed everything +that we require and listed above and that you are running the mentioned commands +through Git bash or WSL. + [discrete] [[get-kibana-code]] === Get the code diff --git a/docs/developer/getting-started/monorepo-packages.asciidoc b/docs/developer/getting-started/monorepo-packages.asciidoc index 9564087dabefe..610d78bacccd4 100644 --- a/docs/developer/getting-started/monorepo-packages.asciidoc +++ b/docs/developer/getting-started/monorepo-packages.asciidoc @@ -65,6 +65,7 @@ yarn kbn watch-bazel - @kbn/apm-utils - @kbn/babel-preset - @kbn/config-schema +- @kbn/std - @kbn/tinymath - @kbn/utility-types diff --git a/docs/developer/plugin-list.asciidoc b/docs/developer/plugin-list.asciidoc index c7fffb09248e9..ac84fe65895a7 100644 --- a/docs/developer/plugin-list.asciidoc +++ b/docs/developer/plugin-list.asciidoc @@ -362,7 +362,7 @@ Failure to have auth enabled in Kibana will make for a broken UI. UI-based error |{kib-repo}blob/{branch}/x-pack/plugins/data_enhanced/README.md[dataEnhanced] -|The data_enhanced plugin is the x-pack counterpart to the OSS data plugin. +|The data_enhanced plugin is the x-pack counterpart to the src/plguins/data plugin. |{kib-repo}blob/{branch}/x-pack/plugins/discover_enhanced/README.md[discoverEnhanced] @@ -392,6 +392,10 @@ actitivies. |The features plugin enhance Kibana with a per-feature privilege system. +|{kib-repo}blob/{branch}/x-pack/plugins/file_data_visualizer[fileDataVisualizer] +|WARNING: Missing README. + + |{kib-repo}blob/{branch}/x-pack/plugins/file_upload[fileUpload] |WARNING: Missing README. diff --git a/docs/development/core/public/kibana-plugin-core-public.doclinksstart.links.md b/docs/development/core/public/kibana-plugin-core-public.doclinksstart.links.md index 535bd8f11236d..3a383ee72b86a 100644 --- a/docs/development/core/public/kibana-plugin-core-public.doclinksstart.links.md +++ b/docs/development/core/public/kibana-plugin-core-public.doclinksstart.links.md @@ -8,6 +8,9 @@ ```typescript readonly links: { + readonly canvas: { + readonly guide: string; + }; readonly dashboard: { readonly guide: string; readonly drilldowns: string; diff --git a/docs/development/core/public/kibana-plugin-core-public.doclinksstart.md b/docs/development/core/public/kibana-plugin-core-public.doclinksstart.md index b8d0d2288993e..c5bf4babd9da9 100644 --- a/docs/development/core/public/kibana-plugin-core-public.doclinksstart.md +++ b/docs/development/core/public/kibana-plugin-core-public.doclinksstart.md @@ -17,5 +17,5 @@ export interface DocLinksStart | --- | --- | --- | | [DOC\_LINK\_VERSION](./kibana-plugin-core-public.doclinksstart.doc_link_version.md) | string | | | [ELASTIC\_WEBSITE\_URL](./kibana-plugin-core-public.doclinksstart.elastic_website_url.md) | string | | -| [links](./kibana-plugin-core-public.doclinksstart.links.md) | {
readonly dashboard: {
readonly guide: string;
readonly drilldowns: string;
readonly drilldownsTriggerPicker: string;
readonly urlDrilldownTemplateSyntax: string;
readonly urlDrilldownVariables: string;
};
readonly discover: Record<string, string>;
readonly filebeat: {
readonly base: string;
readonly installation: string;
readonly configuration: string;
readonly elasticsearchOutput: string;
readonly elasticsearchModule: string;
readonly startup: string;
readonly exportedFields: string;
};
readonly auditbeat: {
readonly base: string;
};
readonly metricbeat: {
readonly base: string;
readonly configure: string;
readonly httpEndpoint: string;
readonly install: string;
readonly start: string;
};
readonly enterpriseSearch: {
readonly base: string;
readonly appSearchBase: string;
readonly workplaceSearchBase: string;
};
readonly heartbeat: {
readonly base: string;
};
readonly logstash: {
readonly base: string;
};
readonly functionbeat: {
readonly base: string;
};
readonly winlogbeat: {
readonly base: string;
};
readonly aggs: {
readonly composite: string;
readonly composite_missing_bucket: string;
readonly date_histogram: string;
readonly date_range: string;
readonly date_format_pattern: string;
readonly filter: string;
readonly filters: string;
readonly geohash_grid: string;
readonly histogram: string;
readonly ip_range: string;
readonly range: string;
readonly significant_terms: string;
readonly terms: string;
readonly avg: string;
readonly avg_bucket: string;
readonly max_bucket: string;
readonly min_bucket: string;
readonly sum_bucket: string;
readonly cardinality: string;
readonly count: string;
readonly cumulative_sum: string;
readonly derivative: string;
readonly geo_bounds: string;
readonly geo_centroid: string;
readonly max: string;
readonly median: string;
readonly min: string;
readonly moving_avg: string;
readonly percentile_ranks: string;
readonly serial_diff: string;
readonly std_dev: string;
readonly sum: string;
readonly top_hits: string;
};
readonly runtimeFields: {
readonly overview: string;
readonly mapping: string;
};
readonly scriptedFields: {
readonly scriptFields: string;
readonly scriptAggs: string;
readonly painless: string;
readonly painlessApi: string;
readonly painlessLangSpec: string;
readonly painlessSyntax: string;
readonly painlessWalkthrough: string;
readonly luceneExpressions: string;
};
readonly indexPatterns: {
readonly introduction: string;
readonly fieldFormattersNumber: string;
readonly fieldFormattersString: string;
};
readonly addData: string;
readonly kibana: string;
readonly upgradeAssistant: string;
readonly elasticsearch: Record<string, string>;
readonly siem: {
readonly guide: string;
readonly gettingStarted: string;
};
readonly query: {
readonly eql: string;
readonly kueryQuerySyntax: string;
readonly luceneQuerySyntax: string;
readonly percolate: string;
readonly queryDsl: string;
};
readonly date: {
readonly dateMath: string;
readonly dateMathIndexNames: string;
};
readonly management: Record<string, string>;
readonly ml: Record<string, string>;
readonly transforms: Record<string, string>;
readonly visualize: Record<string, string>;
readonly apis: Readonly<{
bulkIndexAlias: string;
createIndex: string;
createSnapshotLifecyclePolicy: string;
createRoleMapping: string;
createRoleMappingTemplates: string;
createApiKey: string;
createPipeline: string;
createTransformRequest: string;
cronExpressions: string;
executeWatchActionModes: string;
indexExists: string;
openIndex: string;
putComponentTemplate: string;
painlessExecute: string;
painlessExecuteAPIContexts: string;
putComponentTemplateMetadata: string;
putSnapshotLifecyclePolicy: string;
putIndexTemplateV1: string;
putWatch: string;
simulatePipeline: string;
updateTransform: string;
}>;
readonly observability: Record<string, string>;
readonly alerting: Record<string, string>;
readonly maps: Record<string, string>;
readonly monitoring: Record<string, string>;
readonly security: Readonly<{
apiKeyServiceSettings: string;
clusterPrivileges: string;
elasticsearchSettings: string;
elasticsearchEnableSecurity: string;
indicesPrivileges: string;
kibanaTLS: string;
kibanaPrivileges: string;
mappingRoles: string;
mappingRolesFieldRules: string;
runAsPrivilege: string;
}>;
readonly watcher: Record<string, string>;
readonly ccs: Record<string, string>;
readonly plugins: Record<string, string>;
readonly snapshotRestore: Record<string, string>;
readonly ingest: Record<string, string>;
} | | +| [links](./kibana-plugin-core-public.doclinksstart.links.md) | {
readonly canvas: {
readonly guide: string;
};
readonly dashboard: {
readonly guide: string;
readonly drilldowns: string;
readonly drilldownsTriggerPicker: string;
readonly urlDrilldownTemplateSyntax: string;
readonly urlDrilldownVariables: string;
};
readonly discover: Record<string, string>;
readonly filebeat: {
readonly base: string;
readonly installation: string;
readonly configuration: string;
readonly elasticsearchOutput: string;
readonly elasticsearchModule: string;
readonly startup: string;
readonly exportedFields: string;
};
readonly auditbeat: {
readonly base: string;
};
readonly metricbeat: {
readonly base: string;
readonly configure: string;
readonly httpEndpoint: string;
readonly install: string;
readonly start: string;
};
readonly enterpriseSearch: {
readonly base: string;
readonly appSearchBase: string;
readonly workplaceSearchBase: string;
};
readonly heartbeat: {
readonly base: string;
};
readonly logstash: {
readonly base: string;
};
readonly functionbeat: {
readonly base: string;
};
readonly winlogbeat: {
readonly base: string;
};
readonly aggs: {
readonly composite: string;
readonly composite_missing_bucket: string;
readonly date_histogram: string;
readonly date_range: string;
readonly date_format_pattern: string;
readonly filter: string;
readonly filters: string;
readonly geohash_grid: string;
readonly histogram: string;
readonly ip_range: string;
readonly range: string;
readonly significant_terms: string;
readonly terms: string;
readonly avg: string;
readonly avg_bucket: string;
readonly max_bucket: string;
readonly min_bucket: string;
readonly sum_bucket: string;
readonly cardinality: string;
readonly count: string;
readonly cumulative_sum: string;
readonly derivative: string;
readonly geo_bounds: string;
readonly geo_centroid: string;
readonly max: string;
readonly median: string;
readonly min: string;
readonly moving_avg: string;
readonly percentile_ranks: string;
readonly serial_diff: string;
readonly std_dev: string;
readonly sum: string;
readonly top_hits: string;
};
readonly runtimeFields: {
readonly overview: string;
readonly mapping: string;
};
readonly scriptedFields: {
readonly scriptFields: string;
readonly scriptAggs: string;
readonly painless: string;
readonly painlessApi: string;
readonly painlessLangSpec: string;
readonly painlessSyntax: string;
readonly painlessWalkthrough: string;
readonly luceneExpressions: string;
};
readonly indexPatterns: {
readonly introduction: string;
readonly fieldFormattersNumber: string;
readonly fieldFormattersString: string;
};
readonly addData: string;
readonly kibana: string;
readonly upgradeAssistant: string;
readonly elasticsearch: Record<string, string>;
readonly siem: {
readonly guide: string;
readonly gettingStarted: string;
};
readonly query: {
readonly eql: string;
readonly kueryQuerySyntax: string;
readonly luceneQuerySyntax: string;
readonly percolate: string;
readonly queryDsl: string;
};
readonly date: {
readonly dateMath: string;
readonly dateMathIndexNames: string;
};
readonly management: Record<string, string>;
readonly ml: Record<string, string>;
readonly transforms: Record<string, string>;
readonly visualize: Record<string, string>;
readonly apis: Readonly<{
bulkIndexAlias: string;
createIndex: string;
createSnapshotLifecyclePolicy: string;
createRoleMapping: string;
createRoleMappingTemplates: string;
createApiKey: string;
createPipeline: string;
createTransformRequest: string;
cronExpressions: string;
executeWatchActionModes: string;
indexExists: string;
openIndex: string;
putComponentTemplate: string;
painlessExecute: string;
painlessExecuteAPIContexts: string;
putComponentTemplateMetadata: string;
putSnapshotLifecyclePolicy: string;
putIndexTemplateV1: string;
putWatch: string;
simulatePipeline: string;
updateTransform: string;
}>;
readonly observability: Record<string, string>;
readonly alerting: Record<string, string>;
readonly maps: Record<string, string>;
readonly monitoring: Record<string, string>;
readonly security: Readonly<{
apiKeyServiceSettings: string;
clusterPrivileges: string;
elasticsearchSettings: string;
elasticsearchEnableSecurity: string;
indicesPrivileges: string;
kibanaTLS: string;
kibanaPrivileges: string;
mappingRoles: string;
mappingRolesFieldRules: string;
runAsPrivilege: string;
}>;
readonly watcher: Record<string, string>;
readonly ccs: Record<string, string>;
readonly plugins: Record<string, string>;
readonly snapshotRestore: Record<string, string>;
readonly ingest: Record<string, string>;
} | | diff --git a/docs/development/core/public/kibana-plugin-core-public.navigatetoappoptions.openinnewtab.md b/docs/development/core/public/kibana-plugin-core-public.navigatetoappoptions.openinnewtab.md new file mode 100644 index 0000000000000..4609fa68b3824 --- /dev/null +++ b/docs/development/core/public/kibana-plugin-core-public.navigatetoappoptions.openinnewtab.md @@ -0,0 +1,13 @@ + + +[Home](./index.md) > [kibana-plugin-core-public](./kibana-plugin-core-public.md) > [NavigateToAppOptions](./kibana-plugin-core-public.navigatetoappoptions.md) > [openInNewTab](./kibana-plugin-core-public.navigatetoappoptions.openinnewtab.md) + +## NavigateToAppOptions.openInNewTab property + +if true, will open the app in new tab, will share session information via window.open if base + +Signature: + +```typescript +openInNewTab?: boolean; +``` diff --git a/docs/development/core/server/kibana-plugin-core-server.makeusagefromschema.md b/docs/development/core/server/kibana-plugin-core-server.makeusagefromschema.md new file mode 100644 index 0000000000000..f47d01a2d09e8 --- /dev/null +++ b/docs/development/core/server/kibana-plugin-core-server.makeusagefromschema.md @@ -0,0 +1,15 @@ + + +[Home](./index.md) > [kibana-plugin-core-server](./kibana-plugin-core-server.md) > [MakeUsageFromSchema](./kibana-plugin-core-server.makeusagefromschema.md) + +## MakeUsageFromSchema type + +List of configuration values that will be exposed to usage collection. If parent node or actual config path is set to `true` then the actual value of these configs will be reoprted. If parent node or actual config path is set to `false` then the config will be reported as \[redacted\]. + +Signature: + +```typescript +export declare type MakeUsageFromSchema = { + [Key in keyof T]?: T[Key] extends Maybe ? false : T[Key] extends Maybe ? boolean : T[Key] extends Maybe ? MakeUsageFromSchema | boolean : boolean; +}; +``` diff --git a/docs/development/core/server/kibana-plugin-core-server.md b/docs/development/core/server/kibana-plugin-core-server.md index 3bbdf8c703ab1..e33e9472d42a9 100644 --- a/docs/development/core/server/kibana-plugin-core-server.md +++ b/docs/development/core/server/kibana-plugin-core-server.md @@ -272,6 +272,7 @@ The plugin integrates with the core system via lifecycle events: `setup` | [LegacyElasticsearchClientConfig](./kibana-plugin-core-server.legacyelasticsearchclientconfig.md) | | | [LifecycleResponseFactory](./kibana-plugin-core-server.lifecycleresponsefactory.md) | Creates an object containing redirection or error response with error details, HTTP headers, and other data transmitted to the client. | | [LoggerConfigType](./kibana-plugin-core-server.loggerconfigtype.md) | | +| [MakeUsageFromSchema](./kibana-plugin-core-server.makeusagefromschema.md) | List of configuration values that will be exposed to usage collection. If parent node or actual config path is set to true then the actual value of these configs will be reoprted. If parent node or actual config path is set to false then the config will be reported as \[redacted\]. | | [MetricsServiceStart](./kibana-plugin-core-server.metricsservicestart.md) | APIs to retrieves metrics gathered and exposed by the core platform. | | [MIGRATION\_ASSISTANCE\_INDEX\_ACTION](./kibana-plugin-core-server.migration_assistance_index_action.md) | | | [MIGRATION\_DEPRECATION\_LEVEL](./kibana-plugin-core-server.migration_deprecation_level.md) | | diff --git a/docs/development/core/server/kibana-plugin-core-server.pluginconfigdescriptor.exposetousage.md b/docs/development/core/server/kibana-plugin-core-server.pluginconfigdescriptor.exposetousage.md new file mode 100644 index 0000000000000..8c50c2e339426 --- /dev/null +++ b/docs/development/core/server/kibana-plugin-core-server.pluginconfigdescriptor.exposetousage.md @@ -0,0 +1,17 @@ + + +[Home](./index.md) > [kibana-plugin-core-server](./kibana-plugin-core-server.md) > [PluginConfigDescriptor](./kibana-plugin-core-server.pluginconfigdescriptor.md) > [exposeToUsage](./kibana-plugin-core-server.pluginconfigdescriptor.exposetousage.md) + +## PluginConfigDescriptor.exposeToUsage property + +Expose non-default configs to usage collection to be sent via telemetry. set a config to `true` to report the actual changed config value. set a config to `false` to report the changed config value as \[redacted\]. + +All changed configs except booleans and numbers will be reported as \[redacted\] unless otherwise specified. + +[MakeUsageFromSchema](./kibana-plugin-core-server.makeusagefromschema.md) + +Signature: + +```typescript +exposeToUsage?: MakeUsageFromSchema; +``` diff --git a/docs/development/core/server/kibana-plugin-core-server.pluginconfigdescriptor.md b/docs/development/core/server/kibana-plugin-core-server.pluginconfigdescriptor.md index 5708c4f9a3f88..80e807a1361fd 100644 --- a/docs/development/core/server/kibana-plugin-core-server.pluginconfigdescriptor.md +++ b/docs/development/core/server/kibana-plugin-core-server.pluginconfigdescriptor.md @@ -46,5 +46,6 @@ export const config: PluginConfigDescriptor = { | --- | --- | --- | | [deprecations](./kibana-plugin-core-server.pluginconfigdescriptor.deprecations.md) | ConfigDeprecationProvider | Provider for the to apply to the plugin configuration. | | [exposeToBrowser](./kibana-plugin-core-server.pluginconfigdescriptor.exposetobrowser.md) | {
[P in keyof T]?: boolean;
} | List of configuration properties that will be available on the client-side plugin. | +| [exposeToUsage](./kibana-plugin-core-server.pluginconfigdescriptor.exposetousage.md) | MakeUsageFromSchema<T> | Expose non-default configs to usage collection to be sent via telemetry. set a config to true to report the actual changed config value. set a config to false to report the changed config value as \[redacted\].All changed configs except booleans and numbers will be reported as \[redacted\] unless otherwise specified.[MakeUsageFromSchema](./kibana-plugin-core-server.makeusagefromschema.md) | | [schema](./kibana-plugin-core-server.pluginconfigdescriptor.schema.md) | PluginConfigSchema<T> | Schema to use to validate the plugin configuration.[PluginConfigSchema](./kibana-plugin-core-server.pluginconfigschema.md) | diff --git a/docs/development/core/server/kibana-plugin-core-server.savedobjectsmigrationlogger.error.md b/docs/development/core/server/kibana-plugin-core-server.savedobjectsmigrationlogger.error.md index 7536cd2b07ae6..16fbc8f4eaea3 100644 --- a/docs/development/core/server/kibana-plugin-core-server.savedobjectsmigrationlogger.error.md +++ b/docs/development/core/server/kibana-plugin-core-server.savedobjectsmigrationlogger.error.md @@ -7,5 +7,5 @@ Signature: ```typescript -error: (msg: string, meta: LogMeta) => void; +error: (msg: string, meta: Meta) => void; ``` diff --git a/docs/development/core/server/kibana-plugin-core-server.savedobjectsmigrationlogger.md b/docs/development/core/server/kibana-plugin-core-server.savedobjectsmigrationlogger.md index 1b691ee8cb16d..697f8823c4966 100644 --- a/docs/development/core/server/kibana-plugin-core-server.savedobjectsmigrationlogger.md +++ b/docs/development/core/server/kibana-plugin-core-server.savedobjectsmigrationlogger.md @@ -16,7 +16,7 @@ export interface SavedObjectsMigrationLogger | Property | Type | Description | | --- | --- | --- | | [debug](./kibana-plugin-core-server.savedobjectsmigrationlogger.debug.md) | (msg: string) => void | | -| [error](./kibana-plugin-core-server.savedobjectsmigrationlogger.error.md) | (msg: string, meta: LogMeta) => void | | +| [error](./kibana-plugin-core-server.savedobjectsmigrationlogger.error.md) | <Meta extends LogMeta = LogMeta>(msg: string, meta: Meta) => void | | | [info](./kibana-plugin-core-server.savedobjectsmigrationlogger.info.md) | (msg: string) => void | | | [warn](./kibana-plugin-core-server.savedobjectsmigrationlogger.warn.md) | (msg: string) => void | | | [warning](./kibana-plugin-core-server.savedobjectsmigrationlogger.warning.md) | (msg: string) => void | | diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.ieserror.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.ieserror.md new file mode 100644 index 0000000000000..df571e4ed4961 --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.ieserror.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [IEsError](./kibana-plugin-plugins-data-public.ieserror.md) + +## IEsError type + +Signature: + +```typescript +export declare type IEsError = KibanaServerError; +``` diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.iseserror.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.iseserror.md new file mode 100644 index 0000000000000..379877c9b5c0a --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.iseserror.md @@ -0,0 +1,24 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [isEsError](./kibana-plugin-plugins-data-public.iseserror.md) + +## isEsError() function + +Checks if a given errors originated from Elasticsearch. Those params are assigned to the attributes property of an error. + +Signature: + +```typescript +export declare function isEsError(e: any): e is IEsError; +``` + +## Parameters + +| Parameter | Type | Description | +| --- | --- | --- | +| e | any | | + +Returns: + +`e is IEsError` + diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.md index 4429f45f55645..58a225a3a4bc3 100644 --- a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.md +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.md @@ -46,6 +46,7 @@ | [getEsPreference(uiSettings, sessionId)](./kibana-plugin-plugins-data-public.getespreference.md) | | | [getSearchParamsFromRequest(searchRequest, dependencies)](./kibana-plugin-plugins-data-public.getsearchparamsfromrequest.md) | | | [getTime(indexPattern, timeRange, options)](./kibana-plugin-plugins-data-public.gettime.md) | | +| [isEsError(e)](./kibana-plugin-plugins-data-public.iseserror.md) | Checks if a given errors originated from Elasticsearch. Those params are assigned to the attributes property of an error. | | [plugin(initializerContext)](./kibana-plugin-plugins-data-public.plugin.md) | | | [waitUntilNextSessionCompletes$(sessionService, { waitForIdle })](./kibana-plugin-plugins-data-public.waituntilnextsessioncompletes_.md) | Creates an observable that emits when next search session completes. This utility is helpful to use in the application to delay some tasks until next session completes. | @@ -86,6 +87,7 @@ | [QuerySuggestionField](./kibana-plugin-plugins-data-public.querysuggestionfield.md) | \* | | [QuerySuggestionGetFnArgs](./kibana-plugin-plugins-data-public.querysuggestiongetfnargs.md) | \* | | [RangeFilterParams](./kibana-plugin-plugins-data-public.rangefilterparams.md) | | +| [Reason](./kibana-plugin-plugins-data-public.reason.md) | | | [RefreshInterval](./kibana-plugin-plugins-data-public.refreshinterval.md) | | | [SavedQuery](./kibana-plugin-plugins-data-public.savedquery.md) | | | [SavedQueryService](./kibana-plugin-plugins-data-public.savedqueryservice.md) | | @@ -161,6 +163,7 @@ | [Filter](./kibana-plugin-plugins-data-public.filter.md) | | | [IAggConfig](./kibana-plugin-plugins-data-public.iaggconfig.md) | AggConfig This class represents an aggregation, which is displayed in the left-hand nav of the Visualize app. | | [IAggType](./kibana-plugin-plugins-data-public.iaggtype.md) | | +| [IEsError](./kibana-plugin-plugins-data-public.ieserror.md) | | | [IEsSearchResponse](./kibana-plugin-plugins-data-public.iessearchresponse.md) | | | [IFieldFormat](./kibana-plugin-plugins-data-public.ifieldformat.md) | | | [IFieldFormatsRegistry](./kibana-plugin-plugins-data-public.ifieldformatsregistry.md) | | diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.reason.caused_by.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.reason.caused_by.md new file mode 100644 index 0000000000000..f1df7f98aad4c --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.reason.caused_by.md @@ -0,0 +1,14 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [Reason](./kibana-plugin-plugins-data-public.reason.md) > [caused\_by](./kibana-plugin-plugins-data-public.reason.caused_by.md) + +## Reason.caused\_by property + +Signature: + +```typescript +caused_by?: { + type: string; + reason: string; + }; +``` diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.reason.lang.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.reason.lang.md new file mode 100644 index 0000000000000..095142cf0f05b --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.reason.lang.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [Reason](./kibana-plugin-plugins-data-public.reason.md) > [lang](./kibana-plugin-plugins-data-public.reason.lang.md) + +## Reason.lang property + +Signature: + +```typescript +lang?: string; +``` diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.reason.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.reason.md new file mode 100644 index 0000000000000..a1a76f2d2a295 --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.reason.md @@ -0,0 +1,24 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [Reason](./kibana-plugin-plugins-data-public.reason.md) + +## Reason interface + +Signature: + +```typescript +export interface Reason +``` + +## Properties + +| Property | Type | Description | +| --- | --- | --- | +| [caused\_by](./kibana-plugin-plugins-data-public.reason.caused_by.md) | {
type: string;
reason: string;
} | | +| [lang](./kibana-plugin-plugins-data-public.reason.lang.md) | string | | +| [position](./kibana-plugin-plugins-data-public.reason.position.md) | {
offset: number;
start: number;
end: number;
} | | +| [reason](./kibana-plugin-plugins-data-public.reason.reason.md) | string | | +| [script\_stack](./kibana-plugin-plugins-data-public.reason.script_stack.md) | string[] | | +| [script](./kibana-plugin-plugins-data-public.reason.script.md) | string | | +| [type](./kibana-plugin-plugins-data-public.reason.type.md) | string | | + diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.reason.position.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.reason.position.md new file mode 100644 index 0000000000000..fc727f0aaf59e --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.reason.position.md @@ -0,0 +1,15 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [Reason](./kibana-plugin-plugins-data-public.reason.md) > [position](./kibana-plugin-plugins-data-public.reason.position.md) + +## Reason.position property + +Signature: + +```typescript +position?: { + offset: number; + start: number; + end: number; + }; +``` diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.reason.reason.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.reason.reason.md new file mode 100644 index 0000000000000..0e435cc7c5b85 --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.reason.reason.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [Reason](./kibana-plugin-plugins-data-public.reason.md) > [reason](./kibana-plugin-plugins-data-public.reason.reason.md) + +## Reason.reason property + +Signature: + +```typescript +reason: string; +``` diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.reason.script.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.reason.script.md new file mode 100644 index 0000000000000..09451d51f087a --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.reason.script.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [Reason](./kibana-plugin-plugins-data-public.reason.md) > [script](./kibana-plugin-plugins-data-public.reason.script.md) + +## Reason.script property + +Signature: + +```typescript +script?: string; +``` diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.reason.script_stack.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.reason.script_stack.md new file mode 100644 index 0000000000000..e322481147ae9 --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.reason.script_stack.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [Reason](./kibana-plugin-plugins-data-public.reason.md) > [script\_stack](./kibana-plugin-plugins-data-public.reason.script_stack.md) + +## Reason.script\_stack property + +Signature: + +```typescript +script_stack?: string[]; +``` diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.reason.type.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.reason.type.md new file mode 100644 index 0000000000000..482f191ae4aab --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.reason.type.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [Reason](./kibana-plugin-plugins-data-public.reason.md) > [type](./kibana-plugin-plugins-data-public.reason.type.md) + +## Reason.type property + +Signature: + +```typescript +type: string; +``` diff --git a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.asyncsearchresponse.expiration_time_in_millis.md b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.asyncsearchresponse.expiration_time_in_millis.md new file mode 100644 index 0000000000000..eab2fbc6431c6 --- /dev/null +++ b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.asyncsearchresponse.expiration_time_in_millis.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-server](./kibana-plugin-plugins-data-server.md) > [AsyncSearchResponse](./kibana-plugin-plugins-data-server.asyncsearchresponse.md) > [expiration\_time\_in\_millis](./kibana-plugin-plugins-data-server.asyncsearchresponse.expiration_time_in_millis.md) + +## AsyncSearchResponse.expiration\_time\_in\_millis property + +Signature: + +```typescript +expiration_time_in_millis: number; +``` diff --git a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.asyncsearchresponse.id.md b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.asyncsearchresponse.id.md new file mode 100644 index 0000000000000..d3b61be9b08b3 --- /dev/null +++ b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.asyncsearchresponse.id.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-server](./kibana-plugin-plugins-data-server.md) > [AsyncSearchResponse](./kibana-plugin-plugins-data-server.asyncsearchresponse.md) > [id](./kibana-plugin-plugins-data-server.asyncsearchresponse.id.md) + +## AsyncSearchResponse.id property + +Signature: + +```typescript +id?: string; +``` diff --git a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.asyncsearchresponse.is_partial.md b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.asyncsearchresponse.is_partial.md new file mode 100644 index 0000000000000..1d1a5ccd1ac69 --- /dev/null +++ b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.asyncsearchresponse.is_partial.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-server](./kibana-plugin-plugins-data-server.md) > [AsyncSearchResponse](./kibana-plugin-plugins-data-server.asyncsearchresponse.md) > [is\_partial](./kibana-plugin-plugins-data-server.asyncsearchresponse.is_partial.md) + +## AsyncSearchResponse.is\_partial property + +Signature: + +```typescript +is_partial: boolean; +``` diff --git a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.asyncsearchresponse.is_running.md b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.asyncsearchresponse.is_running.md new file mode 100644 index 0000000000000..17af7a39acfe7 --- /dev/null +++ b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.asyncsearchresponse.is_running.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-server](./kibana-plugin-plugins-data-server.md) > [AsyncSearchResponse](./kibana-plugin-plugins-data-server.asyncsearchresponse.md) > [is\_running](./kibana-plugin-plugins-data-server.asyncsearchresponse.is_running.md) + +## AsyncSearchResponse.is\_running property + +Signature: + +```typescript +is_running: boolean; +``` diff --git a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.asyncsearchresponse.md b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.asyncsearchresponse.md new file mode 100644 index 0000000000000..2f11e03f82b5f --- /dev/null +++ b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.asyncsearchresponse.md @@ -0,0 +1,23 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-server](./kibana-plugin-plugins-data-server.md) > [AsyncSearchResponse](./kibana-plugin-plugins-data-server.asyncsearchresponse.md) + +## AsyncSearchResponse interface + +Signature: + +```typescript +export interface AsyncSearchResponse +``` + +## Properties + +| Property | Type | Description | +| --- | --- | --- | +| [expiration\_time\_in\_millis](./kibana-plugin-plugins-data-server.asyncsearchresponse.expiration_time_in_millis.md) | number | | +| [id](./kibana-plugin-plugins-data-server.asyncsearchresponse.id.md) | string | | +| [is\_partial](./kibana-plugin-plugins-data-server.asyncsearchresponse.is_partial.md) | boolean | | +| [is\_running](./kibana-plugin-plugins-data-server.asyncsearchresponse.is_running.md) | boolean | | +| [response](./kibana-plugin-plugins-data-server.asyncsearchresponse.response.md) | estypes.SearchResponse<T> | | +| [start\_time\_in\_millis](./kibana-plugin-plugins-data-server.asyncsearchresponse.start_time_in_millis.md) | number | | + diff --git a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.asyncsearchresponse.response.md b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.asyncsearchresponse.response.md new file mode 100644 index 0000000000000..9370e21542e37 --- /dev/null +++ b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.asyncsearchresponse.response.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-server](./kibana-plugin-plugins-data-server.md) > [AsyncSearchResponse](./kibana-plugin-plugins-data-server.asyncsearchresponse.md) > [response](./kibana-plugin-plugins-data-server.asyncsearchresponse.response.md) + +## AsyncSearchResponse.response property + +Signature: + +```typescript +response: estypes.SearchResponse; +``` diff --git a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.asyncsearchresponse.start_time_in_millis.md b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.asyncsearchresponse.start_time_in_millis.md new file mode 100644 index 0000000000000..91db5f06d9b2f --- /dev/null +++ b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.asyncsearchresponse.start_time_in_millis.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-server](./kibana-plugin-plugins-data-server.md) > [AsyncSearchResponse](./kibana-plugin-plugins-data-server.asyncsearchresponse.md) > [start\_time\_in\_millis](./kibana-plugin-plugins-data-server.asyncsearchresponse.start_time_in_millis.md) + +## AsyncSearchResponse.start\_time\_in\_millis property + +Signature: + +```typescript +start_time_in_millis: number; +``` diff --git a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.asyncsearchstatusresponse._shards.md b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.asyncsearchstatusresponse._shards.md new file mode 100644 index 0000000000000..5cb7e7135aecf --- /dev/null +++ b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.asyncsearchstatusresponse._shards.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-server](./kibana-plugin-plugins-data-server.md) > [AsyncSearchStatusResponse](./kibana-plugin-plugins-data-server.asyncsearchstatusresponse.md) > [\_shards](./kibana-plugin-plugins-data-server.asyncsearchstatusresponse._shards.md) + +## AsyncSearchStatusResponse.\_shards property + +Signature: + +```typescript +_shards: ShardsResponse; +``` diff --git a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.asyncsearchstatusresponse.completion_status.md b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.asyncsearchstatusresponse.completion_status.md new file mode 100644 index 0000000000000..16cd3af3f8d49 --- /dev/null +++ b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.asyncsearchstatusresponse.completion_status.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-server](./kibana-plugin-plugins-data-server.md) > [AsyncSearchStatusResponse](./kibana-plugin-plugins-data-server.asyncsearchstatusresponse.md) > [completion\_status](./kibana-plugin-plugins-data-server.asyncsearchstatusresponse.completion_status.md) + +## AsyncSearchStatusResponse.completion\_status property + +Signature: + +```typescript +completion_status: number; +``` diff --git a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.asyncsearchstatusresponse.md b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.asyncsearchstatusresponse.md new file mode 100644 index 0000000000000..5d7ea57939269 --- /dev/null +++ b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.asyncsearchstatusresponse.md @@ -0,0 +1,19 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-server](./kibana-plugin-plugins-data-server.md) > [AsyncSearchStatusResponse](./kibana-plugin-plugins-data-server.asyncsearchstatusresponse.md) + +## AsyncSearchStatusResponse interface + +Signature: + +```typescript +export interface AsyncSearchStatusResponse extends Omit +``` + +## Properties + +| Property | Type | Description | +| --- | --- | --- | +| [\_shards](./kibana-plugin-plugins-data-server.asyncsearchstatusresponse._shards.md) | ShardsResponse | | +| [completion\_status](./kibana-plugin-plugins-data-server.asyncsearchstatusresponse.completion_status.md) | number | | + diff --git a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.md b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.md index e0734bc017f4f..b1745b298e27e 100644 --- a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.md +++ b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.md @@ -45,6 +45,8 @@ | --- | --- | | [AggFunctionsMapping](./kibana-plugin-plugins-data-server.aggfunctionsmapping.md) | A global list of the expression function definitions for each agg type function. | | [AggParamOption](./kibana-plugin-plugins-data-server.aggparamoption.md) | | +| [AsyncSearchResponse](./kibana-plugin-plugins-data-server.asyncsearchresponse.md) | | +| [AsyncSearchStatusResponse](./kibana-plugin-plugins-data-server.asyncsearchstatusresponse.md) | | | [EsQueryConfig](./kibana-plugin-plugins-data-server.esqueryconfig.md) | | | [FieldDescriptor](./kibana-plugin-plugins-data-server.fielddescriptor.md) | | | [FieldFormatConfig](./kibana-plugin-plugins-data-server.fieldformatconfig.md) | | diff --git a/docs/discover/save-search.asciidoc b/docs/discover/save-search.asciidoc new file mode 100644 index 0000000000000..b2baf8ee64672 --- /dev/null +++ b/docs/discover/save-search.asciidoc @@ -0,0 +1,38 @@ +[[save-open-search]] +== Save a search +A saved search persists your current view of Discover for +later retrieval and reuse. You can reload a saved search into Discover, +add it to a dashboard, and use it as the basis for a visualization. + +A saved search includes the query text, filters, and optionally, the time filter. A saved search also includes the selected columns in the document table, the sort order, and the current index pattern. + +[role="xpack"] +[[discover-read-only-access]] +[float] +=== Read-only access +When you have insufficient privileges to save searches, the following indicator in Kibana will be +displayed and the *Save* button won't be visible. For more information on granting access to +Kibana see <>. + +[role="screenshot"] +image::discover/images/read-only-badge.png[Example of Discover's read only access indicator in Kibana's header] +[float] +=== Save a search +To save the current search: + +. Click *Save* in the toolbar. +. Enter a name for the search and click *Save*. + +To import, export, and delete saved searches, open the main menu, +then click *Stack Management > Saved Objects*. + +[float] +=== Open a saved search +To load a saved search into Discover: + +. Click *Open* in the toolbar. +. Select the search you want to open. + +If the saved search is associated with a different index pattern than is currently +selected, opening the saved search changes the selected index pattern. The query language +used for the saved search will also be automatically selected. diff --git a/docs/discover/search-sessions.asciidoc b/docs/discover/search-sessions.asciidoc index 0673b9b8f6562..f7091d16f9cd3 100644 --- a/docs/discover/search-sessions.asciidoc +++ b/docs/discover/search-sessions.asciidoc @@ -1,5 +1,5 @@ [[search-sessions]] -=== Run a search session in the background +== Run a search session in the background Sometimes you might need to search through large amounts of data no matter how long the search takes. While this might not happen often, diff --git a/docs/discover/set-time-filter.asciidoc b/docs/discover/set-time-filter.asciidoc deleted file mode 100644 index dcdc8ee791e83..0000000000000 --- a/docs/discover/set-time-filter.asciidoc +++ /dev/null @@ -1,56 +0,0 @@ -[[set-time-filter]] -== Set the time filter -If your index contains time-based events, and a time-field is configured for the -selected <>, set a time filter that displays only the data within the -specified time range. - -You can use the time filter to change the time range, or select a specific time -range in the histogram. - -[float] -[[use-time-filter]] -=== Use the time filter - -Use the time filter to change the time range. By default, the time filter is set -to the last 15 minutes. - -. Click image:images/time-filter-calendar.png[Calendar icon]. - -. Choose one of the following: - -* *Quick select* to use a recent time range, then use the back and forward - arrows to move through the time ranges. - -* *Commonly used* to use a time range from options such as *Last 15 minutes*, - *Today*, and *Week to date*. - -* *Recently used date ranges* to use a previously selected data range that - you recently used. - -* *Refresh every* to specify an automatic refresh rate. -+ -[role="screenshot"] -image::images/time-filter.png[Time filter menu] - -. To set the start and end times, click the bar next to the time filter. -In the popup, select *Absolute*, *Relative* or *Now*, then specify the required -options. -+ -[role="screenshot"] -image::images/time-filter-bar.png[Time filter bar] - -[float] -=== Select a time range from the histogram - -To select a specific time range in the histogram, choose one of the following: - -* Click the bar that represents the time range you want to zoom in on. - -* Click and drag to view a specific time range. You must start the selection with -the cursor over the background of the chart--the cursor changes to a plus sign -when you hover over a valid start point. - -* Click the dropdown, then select an interval. - -[role="screenshot"] -image::images/Histogram-Time.png[Time range selector in Histogram dropdown] diff --git a/docs/management/action-types.asciidoc b/docs/management/action-types.asciidoc new file mode 100644 index 0000000000000..4d6dcb631792e --- /dev/null +++ b/docs/management/action-types.asciidoc @@ -0,0 +1,117 @@ +[role="xpack"] +[[action-types]] +== Connectors + +Connectors provide a central place to store connection information for services and integrations with third party systems. Actions are instantiations of a connector that are linked to rules and run as background tasks on the {kib} server when rule conditions are met. {kib} provides the following types of connectors: + +[cols="2"] +|=== + +a| <> + +| Send email from your server. + +a| <> + +| Create an incident in IBM Resilient. + +a| <> + +| Index data into Elasticsearch. + +a| <> + +| Create an incident in Jira. + +a| <> + +| Send a message to a Microsoft Teams channel. + +a| <> + +| Send an event in PagerDuty. + +a| <> + +| Add a message to a Kibana log. + +a| <> + +| Create an incident in ServiceNow. + +a| <> + +| Send a message to a Slack channel or user. + +a| <> + +| Send a request to a web service. +|=== + +[NOTE] +============================================== +Some connector types are paid commercial features, while others are free. +For a comparison of the Elastic subscription levels, +see https://www.elastic.co/subscriptions[the subscription page]. +============================================== + +[float] +[[connector-management]] +=== Managing Connectors + +Rules use *Connectors* to route actions to different destinations like log files, ticketing systems, and messaging tools. While each {kib} app can offer their own types of rules, they typically share connectors. The *Connectors* tab offers a central place to view and manage all the connectors in the current space. + +For more information on connectors and the types of actions available see <>. + +[role="screenshot"] +image::images/connector-listing.png[Example connector listing in the Rules and Connectors UI] + +[float] +=== Required permissions + +Access to connectors is granted based on your privileges to alerting-enabled features. See <> for more information. + +[float] +[[connectors-list]] +=== Connector list + +The *Connectors* tab lists all connectors in the current space. The *search bar* can be used to find specific connectors by name and/or type. + +[role="screenshot"] +image::images/connector-filter-by-search.png[Filtering the connector list using the search bar] + + +The *type* dropdown also lets you filter to a subset of connector types. + +[role="screenshot"] +image::images/connector-filter-by-type.png[Filtering the connector list by types of connectors] + +You can delete individual connectors using the trash icon. Connectors can also be deleted in bulk by multi-selecting them and clicking the *Delete* button to the left of the search box. + +[role="screenshot"] +image::images/connector-delete.png[Deleting connectors individually or in bulk] + +[NOTE] +============================================================================ +You can delete a connector even if there are still actions referencing it. +When this happens the action will fail to execute, and appear as errors in the {kib} logs. +============================================================================ + +[float] +[[creating-new-connector]] +=== Creating a new connector + +New connectors can be created by clicking the *Create connector* button, which will guide you to select the type of connector and configure its properties. Refer to <> for the types of connectors available and how to configure them. Once you create a connector it will be made available to you anytime you set up an action in the current space. + +[role="screenshot"] +image::images/connector-select-type.png[Connector select type] + +[float] +[[create-connectors]] +=== Preconfigured connectors + +For out-of-the-box and standardized connectors, you can <> +before {kib} starts. + + +include::connectors/index.asciidoc[] diff --git a/docs/management/advanced-options.asciidoc b/docs/management/advanced-options.asciidoc index 02cb25078cc92..853180ec816e9 100644 --- a/docs/management/advanced-options.asciidoc +++ b/docs/management/advanced-options.asciidoc @@ -321,20 +321,19 @@ https://help.github.com/en/articles/basic-writing-and-formatting-syntax[Markdown [[notifications-lifetime-banner]]`notifications:lifetime:banner`:: The duration, in milliseconds, for banner notification displays. The default -value is 3000000. Set this field to `Infinity` to disable banner notifications. +value is 3000000. [[notificatios-lifetime-error]]`notifications:lifetime:error`:: The duration, in milliseconds, for error notification displays. The default -value is 300000. Set this field to `Infinity` to disable error notifications. +value is 300000. [[notifications-lifetime-info]]`notifications:lifetime:info`:: The duration, in milliseconds, for information notification displays. The -default value is 5000. Set this field to `Infinity` to disable information -notifications. +default value is 5000. [[notifications-lifetime-warning]]`notifications:lifetime:warning`:: The duration, in milliseconds, for warning notification displays. The default -value is 10000. Set this field to `Infinity` to disable warning notifications. +value is 10000. [float] diff --git a/docs/management/alerting/connector-management.asciidoc b/docs/management/alerting/connector-management.asciidoc deleted file mode 100644 index dd3b5209ed4a0..0000000000000 --- a/docs/management/alerting/connector-management.asciidoc +++ /dev/null @@ -1,40 +0,0 @@ -[role="xpack"] -[[connector-management]] -=== Managing Connectors - -Rules use *Connectors* to route actions to different destinations like log files, ticketing systems, and messaging tools. While each {kib} app can offer their own types of rules, they typically share connectors. The *Connectors* tab offers a central place to view and manage all the connectors in the current space. - -For more information on connectors and the types of actions available see <>. - -[role="screenshot"] -image::images/connector-listing.png[Example connector listing in the Rules and Connectors UI] - - -[float] -==== Connector list - -The *Connectors* tab lists all connectors in the current space. The *search bar* can be used to find specific connectors by name and/or type. - -[role="screenshot"] -image::images/connector-filter-by-search.png[Filtering the connector list using the search bar] - - -The *type* dropdown also lets you filter to a subset of connector types. - -[role="screenshot"] -image::images/connector-filter-by-type.png[Filtering the connector list by types of connectors] - -You can delete individual connectors using the trash icon. Connectors can also be deleted in bulk by multi-selecting them and clicking the *Delete* button to the left of the search box. - -[role="screenshot"] -image::images/connector-delete.png[Deleting connectors individually or in bulk] - -[NOTE] -============================================================================ -You can delete a connector even if there are still actions referencing it. -When this happens the action will fail to execute, and appear as errors in the {kib} logs. -============================================================================ - -==== Creating a new connector - -New connectors can be created by clicking the *Create connector* button, which will guide you to select the type of connector and configure its properties. Refer to <> for the types of connectors available and how to configure them. Once you create a connector it will be made available to you anytime you set up an action in the current space. diff --git a/docs/management/alerting/rules-and-connectors-intro.asciidoc b/docs/management/alerting/rules-and-connectors-intro.asciidoc deleted file mode 100644 index 6e23ca95e2266..0000000000000 --- a/docs/management/alerting/rules-and-connectors-intro.asciidoc +++ /dev/null @@ -1,29 +0,0 @@ -[role="xpack"] -[[managing-alerts-and-actions]] -== Rules and Connectors - - -The *Rules and Connectors* UI lets you <> in a space, and provides tools to <> so that rules can trigger actions like notification, indexing, and ticketing. - -To manage rules and connectors, open the main menu, then click *Stack Management > Alerts and Insights > Rules and Connectors*. - -[role="screenshot"] -image:management/alerting/images/rules-and-connectors-ui.png[Example rule listing in the Rules and Connectors UI] - -[NOTE] -============================================================================ -Similar to dashboards, rules and connectors reside in a <>. -The *Rules and Connectors* UI only shows rules and connectors for the current space. -============================================================================ - -[NOTE] -============================================================================ -{es} also offers alerting capabilities through Watcher, which -can be managed through the <>. See -<> for more information. -============================================================================ - -[float] -=== Required permissions - -Access to rules and connectors is granted based on your privileges to alerting-enabled features. See <> for more information. diff --git a/docs/user/alerting/action-types/email.asciidoc b/docs/management/connectors/action-types/email.asciidoc similarity index 93% rename from docs/user/alerting/action-types/email.asciidoc rename to docs/management/connectors/action-types/email.asciidoc index 58f1300d0c287..1c2f9212b4887 100644 --- a/docs/user/alerting/action-types/email.asciidoc +++ b/docs/management/connectors/action-types/email.asciidoc @@ -25,7 +25,7 @@ Username:: Username for login type authentication. Password:: Password for login type authentication. [float] -[[Preconfigured-email-configuration]] +[[preconfigured-email-configuration]] ==== Preconfigured connector type [source,text] @@ -57,6 +57,19 @@ Secrets defines sensitive information for the connector type. `user`:: A string that corresponds to *Username*. Required if `hasAuth` is set to `true`. `password`:: A string that corresponds to *Password*. Should be stored in the <>. Required if `hasAuth` is set to `true`. +[float] +[[define-email-ui]] +==== Define connector in Stack Management + +Define email connector properties. + +[role="screenshot"] +image::management/connectors/images/email-connector.png[Email connector] + +Test email action parameters. + +[role="screenshot"] +image::management/connectors/images/email-params-test.png[Email params test] [float] [[email-action-configuration]] @@ -68,6 +81,7 @@ To, CC, BCC:: Each item is a list of addresses. Addresses can be specified in Subject:: The subject line of the email. Message:: The message text of the email. Markdown format is supported. +[float] [[configuring-email]] ==== Configuring email accounts for well-known services @@ -84,7 +98,7 @@ For other email servers, you can check the list of well-known services that Node [float] [[gmail]] -===== Sending email from Gmail +==== Sending email from Gmail Use the following email connector configuration to send email from the https://mail.google.com[Gmail] SMTP service: @@ -112,7 +126,7 @@ for more information. [float] [[outlook]] -===== Sending email from Outlook.com +==== Sending email from Outlook.com Use the following email connector configuration to send email from the https://www.outlook.com/[Outlook.com] SMTP service: @@ -137,7 +151,7 @@ NOTE: You must use a unique App Password if two-step verification is enabled. [float] [[amazon-ses]] -===== Sending email from Amazon SES (Simple Email Service) +==== Sending email from Amazon SES (Simple Email Service) Use the following email connector configuration to send email from the http://aws.amazon.com/ses[Amazon Simple Email Service] (SES) SMTP service: @@ -164,7 +178,7 @@ NOTE: You must use your Amazon SES SMTP credentials to send email through [float] [[exchange]] -===== Sending email from Microsoft Exchange +==== Sending email from Microsoft Exchange Use the following email connector configuration to send email from Microsoft Exchange: diff --git a/docs/user/alerting/action-types/index.asciidoc b/docs/management/connectors/action-types/index.asciidoc similarity index 92% rename from docs/user/alerting/action-types/index.asciidoc rename to docs/management/connectors/action-types/index.asciidoc index e23dcbf298fd5..d3bd3d431748c 100644 --- a/docs/user/alerting/action-types/index.asciidoc +++ b/docs/management/connectors/action-types/index.asciidoc @@ -39,6 +39,20 @@ Config defines information for the connector type. `refresh`:: A boolean that corresponds to *Refresh*. Defaults to `false`. `executionTimeField`:: A string that corresponds to *Execution time field*. +[float] +[[define-index-ui]] +==== Define connector in Stack Management + +Define Index connector properties. + +[role="screenshot"] +image::management/connectors/images/index-connector.png[Index connector] + +Test Index action parameters. + +[role="screenshot"] +image::management/connectors/images/index-params-test.png[Index params test] + [float] [[index-action-configuration]] ==== Action configuration diff --git a/docs/user/alerting/action-types/jira.asciidoc b/docs/management/connectors/action-types/jira.asciidoc similarity index 86% rename from docs/user/alerting/action-types/jira.asciidoc rename to docs/management/connectors/action-types/jira.asciidoc index 7b4dc69bb639a..a5e629887d5c6 100644 --- a/docs/user/alerting/action-types/jira.asciidoc +++ b/docs/management/connectors/action-types/jira.asciidoc @@ -46,6 +46,20 @@ Secrets defines sensitive information for the connector type. `email`:: A string that corresponds to *Email*. `apiToken`:: A string that corresponds to *API Token*. Should be stored in the <>. +[float] +[[define-jira-ui]] +==== Define connector in Stack Management + +Define Jira connector properties. + +[role="screenshot"] +image::management/connectors/images/jira-connector.png[Jira connector] + +Test Jira action parameters. + +[role="screenshot"] +image::management/connectors/images/jira-params-test.png[Jira params test] + [float] [[jira-action-configuration]] ==== Action configuration @@ -60,6 +74,7 @@ Description:: The details about the incident. Parent:: The ID or key of the parent issue. Only for `Subtask` issue types. Additional comments:: Additional information for the client, such as how to troubleshoot the issue. +[float] [[configuring-jira]] ==== Configure Jira diff --git a/docs/user/alerting/action-types/pagerduty.asciidoc b/docs/management/connectors/action-types/pagerduty.asciidoc similarity index 93% rename from docs/user/alerting/action-types/pagerduty.asciidoc rename to docs/management/connectors/action-types/pagerduty.asciidoc index c32e6c8a6635f..25cba05010548 100644 --- a/docs/user/alerting/action-types/pagerduty.asciidoc +++ b/docs/management/connectors/action-types/pagerduty.asciidoc @@ -40,6 +40,20 @@ Secrets defines sensitive information for the connector type. `routingKey`:: A string that corresponds to *Integration Key*. +[float] +[[define-pagerduty-ui]] +==== Define connector in Stack Management + +Define PagerDuty connector properties. + +[role="screenshot"] +image::management/connectors/images/pagerduty-connector.png[PagerDuty connector] + +Test PagerDuty action parameters. + +[role="screenshot"] +image::management/connectors/images/pagerduty-params-test.png[PagerDuty params test] + [float] [[pagerduty-action-configuration]] ==== Action configuration @@ -70,14 +84,14 @@ By integrating PagerDuty with rules, you can: [float] [[pagerduty-support]] -===== Support +==== Support If you need help with this integration, get in touch with the {kib} team by visiting https://support.elastic.co[support.elastic.co] or by using the *Ask Elastic* option in the {kib} Help menu. You can also select the {kib} category at https://discuss.elastic.co/[discuss.elastic.co]. [float] [[pagerduty-integration-walkthrough]] -===== Integration with PagerDuty walkthrough +==== Integration with PagerDuty walkthrough [[pagerduty-in-pagerduty]] *In PagerDuty* @@ -101,7 +115,7 @@ and select *Elastic Alerts* from the *Integration Type* menu. You will be redirected to the *Integrations* tab for your service. An Integration Key is generated on this screen. + [role="screenshot"] -image::user/alerting/images/pagerduty-integration.png[PagerDuty Integrations tab] +image::images/pagerduty-integration.png[PagerDuty Integrations tab] . Save this key, as you will use it when you configure the integration with Elastic in the next section. diff --git a/docs/user/alerting/action-types/resilient.asciidoc b/docs/management/connectors/action-types/resilient.asciidoc similarity index 85% rename from docs/user/alerting/action-types/resilient.asciidoc rename to docs/management/connectors/action-types/resilient.asciidoc index 862af0e526337..454ae145bbc57 100644 --- a/docs/user/alerting/action-types/resilient.asciidoc +++ b/docs/management/connectors/action-types/resilient.asciidoc @@ -46,6 +46,20 @@ Secrets defines sensitive information for the connector type. `apiKeyId`:: A string that corresponds to *API key ID*. `apiKeySecret`:: A string that corresponds to *API Key secret*. Should be stored in the <>. +[float] +[[define-resilient-ui]] +==== Define connector in Stack Management + +Define IBM Resilient connector properties. + +[role="screenshot"] +image::management/connectors/images/resilient-connector.png[IBM Resilient connector] + +Test IBM Resilient action parameters. + +[role="screenshot"] +image::management/connectors/images/resilient-params-test.png[IBM Resilient params test] + [float] [[resilient-action-configuration]] ==== Action configuration @@ -58,6 +72,7 @@ Name:: A name for the issue, used for searching the contents of the knowledge ba Description:: The details about the incident. Additional comments:: Additional information for the client, such as how to troubleshoot the issue. +[float] [[configuring-resilient]] ==== Configure IBM Resilient diff --git a/docs/user/alerting/action-types/server-log.asciidoc b/docs/management/connectors/action-types/server-log.asciidoc similarity index 72% rename from docs/user/alerting/action-types/server-log.asciidoc rename to docs/management/connectors/action-types/server-log.asciidoc index e497ed3a4467a..0810724d39ead 100644 --- a/docs/user/alerting/action-types/server-log.asciidoc +++ b/docs/management/connectors/action-types/server-log.asciidoc @@ -26,6 +26,20 @@ Name:: The name of the connector. The name is used to identify a connector actionTypeId: .server-log -- +[float] +[[define-serverlog-ui]] +==== Define connector in Stack Management + +Define Server log connector properties. + +[role="screenshot"] +image::management/connectors/images/serverlog-connector.png[Server log connector] + +Test Server log action parameters. + +[role="screenshot"] +image::management/connectors/images/serverlog-params-test.png[Server log params test] + [float] [[server-log-action-configuration]] ==== Action configuration diff --git a/docs/user/alerting/action-types/servicenow.asciidoc b/docs/management/connectors/action-types/servicenow.asciidoc similarity index 86% rename from docs/user/alerting/action-types/servicenow.asciidoc rename to docs/management/connectors/action-types/servicenow.asciidoc index 35d50f1bfeb72..24892c62e804b 100644 --- a/docs/user/alerting/action-types/servicenow.asciidoc +++ b/docs/management/connectors/action-types/servicenow.asciidoc @@ -43,6 +43,20 @@ Secrets defines sensitive information for the connector type. `username`:: A string that corresponds to *Username*. `password`:: A string that corresponds to *Password*. Should be stored in the <>. +[float] +[[define-servicenow-ui]] +==== Define connector in Stack Management + +Define ServiceNow connector properties. + +[role="screenshot"] +image::management/connectors/images/servicenow-connector.png[ServiceNow connector] + +Test ServiceNow action parameters. + +[role="screenshot"] +image::management/connectors/images/servicenow-params-test.png[ServiceNow params test] + [float] [[servicenow-action-configuration]] ==== Action configuration @@ -56,6 +70,7 @@ Short description:: A short description for the incident, used for searching Description:: The details about the incident. Additional comments:: Additional information for the client, such as how to troubleshoot the issue. +[float] [[configuring-servicenow]] ==== Configure ServiceNow diff --git a/docs/user/alerting/action-types/slack.asciidoc b/docs/management/connectors/action-types/slack.asciidoc similarity index 86% rename from docs/user/alerting/action-types/slack.asciidoc rename to docs/management/connectors/action-types/slack.asciidoc index 3ef369e2a4e4a..da0bf321f9ade 100644 --- a/docs/user/alerting/action-types/slack.asciidoc +++ b/docs/management/connectors/action-types/slack.asciidoc @@ -33,6 +33,20 @@ Secrets defines sensitive information for the connector type. `webhookUrl`:: A string that corresponds to *Webhook URL*. +[float] +[[define-slack-ui]] +==== Define connector in Stack Management + +Define Slack connector properties. + +[role="screenshot"] +image::management/connectors/images/slack-connector.png[Slack connector] + +Test Slack action parameters. + +[role="screenshot"] +image::management/connectors/images/slack-params-test.png[Slack params test] + [float] [[slack-action-configuration]] ==== Action configuration @@ -41,6 +55,7 @@ Slack actions have the following properties. Message:: The message text, converted to the `text` field in the Webhook JSON payload. Currently only the text field is supported. Markdown, images, and other advanced formatting are not yet supported. +[float] [[configuring-slack]] ==== Configure a Slack account diff --git a/docs/user/alerting/action-types/teams.asciidoc b/docs/management/connectors/action-types/teams.asciidoc similarity index 88% rename from docs/user/alerting/action-types/teams.asciidoc rename to docs/management/connectors/action-types/teams.asciidoc index 1a0e52141ee9c..ba723a6f33c86 100644 --- a/docs/user/alerting/action-types/teams.asciidoc +++ b/docs/management/connectors/action-types/teams.asciidoc @@ -33,6 +33,20 @@ Secrets defines sensitive information for the connector type. `webhookUrl`:: A string that corresponds to *Webhook URL*. +[float] +[[define-teams-ui]] +==== Define connector in Stack Management + +Define Teams connector properties. + +[role="screenshot"] +image::management/connectors/images/teams-connector.png[Teams connector] + +Test Teams action parameters. + +[role="screenshot"] +image::management/connectors/images/teams-params-test.png[Teams params test] + [float] [[teams-action-configuration]] ==== Action configuration @@ -41,6 +55,7 @@ Microsoft Teams actions have the following properties. Message:: The message text, converted to the `text` field in the Webhook JSON payload. Currently only the text field is supported. Markdown, images, and other advanced formatting are not yet supported. +[float] [[configuring-teams]] ==== Configure a Microsoft Teams account diff --git a/docs/user/alerting/action-types/webhook.asciidoc b/docs/management/connectors/action-types/webhook.asciidoc similarity index 88% rename from docs/user/alerting/action-types/webhook.asciidoc rename to docs/management/connectors/action-types/webhook.asciidoc index 01ddfee288fc8..a2024b9457a1c 100644 --- a/docs/user/alerting/action-types/webhook.asciidoc +++ b/docs/management/connectors/action-types/webhook.asciidoc @@ -52,6 +52,20 @@ Secrets defines sensitive information for the connector type. `user`:: A string that corresponds to *User*. Required if `hasAuth` is set to `true`. `password`:: A string that corresponds to *Password*. Should be stored in the <>. Required if `hasAuth` is set to `true`. +[float] +[[define-webhook-ui]] +==== Define connector in Stack Management + +Define Webhook connector properties. + +[role="screenshot"] +image::management/connectors/images/webhook-connector.png[Webhook connector] + +Test Webhook action parameters. + +[role="screenshot"] +image::management/connectors/images/webhook-params-test.png[Webhook params test] + [float] [[webhook-action-configuration]] ==== Action configuration diff --git a/docs/management/alerting/images/connector-action-count.png b/docs/management/connectors/images/connector-action-count.png similarity index 100% rename from docs/management/alerting/images/connector-action-count.png rename to docs/management/connectors/images/connector-action-count.png diff --git a/docs/management/alerting/images/connector-delete.png b/docs/management/connectors/images/connector-delete.png similarity index 100% rename from docs/management/alerting/images/connector-delete.png rename to docs/management/connectors/images/connector-delete.png diff --git a/docs/management/alerting/images/connector-filter-by-search.png b/docs/management/connectors/images/connector-filter-by-search.png similarity index 100% rename from docs/management/alerting/images/connector-filter-by-search.png rename to docs/management/connectors/images/connector-filter-by-search.png diff --git a/docs/management/alerting/images/connector-filter-by-type.png b/docs/management/connectors/images/connector-filter-by-type.png similarity index 100% rename from docs/management/alerting/images/connector-filter-by-type.png rename to docs/management/connectors/images/connector-filter-by-type.png diff --git a/docs/management/alerting/images/connector-listing.png b/docs/management/connectors/images/connector-listing.png similarity index 100% rename from docs/management/alerting/images/connector-listing.png rename to docs/management/connectors/images/connector-listing.png diff --git a/docs/management/connectors/images/connector-select-type.png b/docs/management/connectors/images/connector-select-type.png new file mode 100644 index 0000000000000..ef5825b149311 Binary files /dev/null and b/docs/management/connectors/images/connector-select-type.png differ diff --git a/docs/management/connectors/images/email-connector.png b/docs/management/connectors/images/email-connector.png new file mode 100644 index 0000000000000..b837fa545a4d1 Binary files /dev/null and b/docs/management/connectors/images/email-connector.png differ diff --git a/docs/management/connectors/images/email-params-test.png b/docs/management/connectors/images/email-params-test.png new file mode 100644 index 0000000000000..3745bcd3235e9 Binary files /dev/null and b/docs/management/connectors/images/email-params-test.png differ diff --git a/docs/management/connectors/images/index-connector.png b/docs/management/connectors/images/index-connector.png new file mode 100644 index 0000000000000..b3a81a7c0e761 Binary files /dev/null and b/docs/management/connectors/images/index-connector.png differ diff --git a/docs/management/connectors/images/index-params-test.png b/docs/management/connectors/images/index-params-test.png new file mode 100644 index 0000000000000..6f4f83bd4297c Binary files /dev/null and b/docs/management/connectors/images/index-params-test.png differ diff --git a/docs/management/connectors/images/jira-connector.png b/docs/management/connectors/images/jira-connector.png new file mode 100644 index 0000000000000..5ff5ebf83afc7 Binary files /dev/null and b/docs/management/connectors/images/jira-connector.png differ diff --git a/docs/management/connectors/images/jira-params-test.png b/docs/management/connectors/images/jira-params-test.png new file mode 100644 index 0000000000000..78d51e823fb61 Binary files /dev/null and b/docs/management/connectors/images/jira-params-test.png differ diff --git a/docs/management/connectors/images/pagerduty-connector.png b/docs/management/connectors/images/pagerduty-connector.png new file mode 100644 index 0000000000000..2e5d240f42c11 Binary files /dev/null and b/docs/management/connectors/images/pagerduty-connector.png differ diff --git a/docs/user/alerting/images/pagerduty-integration.png b/docs/management/connectors/images/pagerduty-integration.png similarity index 100% rename from docs/user/alerting/images/pagerduty-integration.png rename to docs/management/connectors/images/pagerduty-integration.png diff --git a/docs/management/connectors/images/pagerduty-params-test.png b/docs/management/connectors/images/pagerduty-params-test.png new file mode 100644 index 0000000000000..3fb4a9bb5dc82 Binary files /dev/null and b/docs/management/connectors/images/pagerduty-params-test.png differ diff --git a/docs/user/alerting/images/pre-configured-connectors-managing.png b/docs/management/connectors/images/pre-configured-connectors-managing.png similarity index 100% rename from docs/user/alerting/images/pre-configured-connectors-managing.png rename to docs/management/connectors/images/pre-configured-connectors-managing.png diff --git a/docs/user/alerting/images/pre-configured-connectors-view-screen.png b/docs/management/connectors/images/pre-configured-connectors-view-screen.png similarity index 100% rename from docs/user/alerting/images/pre-configured-connectors-view-screen.png rename to docs/management/connectors/images/pre-configured-connectors-view-screen.png diff --git a/docs/management/connectors/images/resilient-connector.png b/docs/management/connectors/images/resilient-connector.png new file mode 100644 index 0000000000000..b7d216d150f8c Binary files /dev/null and b/docs/management/connectors/images/resilient-connector.png differ diff --git a/docs/management/connectors/images/resilient-params-test.png b/docs/management/connectors/images/resilient-params-test.png new file mode 100644 index 0000000000000..865d5b517aea2 Binary files /dev/null and b/docs/management/connectors/images/resilient-params-test.png differ diff --git a/docs/management/connectors/images/serverlog-connector.png b/docs/management/connectors/images/serverlog-connector.png new file mode 100644 index 0000000000000..983bb6afadd65 Binary files /dev/null and b/docs/management/connectors/images/serverlog-connector.png differ diff --git a/docs/management/connectors/images/serverlog-params-test.png b/docs/management/connectors/images/serverlog-params-test.png new file mode 100644 index 0000000000000..762721c7ead45 Binary files /dev/null and b/docs/management/connectors/images/serverlog-params-test.png differ diff --git a/docs/management/connectors/images/servicenow-connector.png b/docs/management/connectors/images/servicenow-connector.png new file mode 100644 index 0000000000000..9891a80ee758f Binary files /dev/null and b/docs/management/connectors/images/servicenow-connector.png differ diff --git a/docs/management/connectors/images/servicenow-params-test.png b/docs/management/connectors/images/servicenow-params-test.png new file mode 100644 index 0000000000000..79f1580c873d2 Binary files /dev/null and b/docs/management/connectors/images/servicenow-params-test.png differ diff --git a/docs/management/connectors/images/servicenow-sir-connector.png b/docs/management/connectors/images/servicenow-sir-connector.png new file mode 100644 index 0000000000000..fbb137bd4f7d9 Binary files /dev/null and b/docs/management/connectors/images/servicenow-sir-connector.png differ diff --git a/docs/management/connectors/images/servicenow-sir-params-test.png b/docs/management/connectors/images/servicenow-sir-params-test.png new file mode 100644 index 0000000000000..16ea83c60b3c3 Binary files /dev/null and b/docs/management/connectors/images/servicenow-sir-params-test.png differ diff --git a/docs/user/alerting/images/slack-add-webhook-integration.png b/docs/management/connectors/images/slack-add-webhook-integration.png similarity index 100% rename from docs/user/alerting/images/slack-add-webhook-integration.png rename to docs/management/connectors/images/slack-add-webhook-integration.png diff --git a/docs/management/connectors/images/slack-connector.png b/docs/management/connectors/images/slack-connector.png new file mode 100644 index 0000000000000..7342d962d2a2b Binary files /dev/null and b/docs/management/connectors/images/slack-connector.png differ diff --git a/docs/user/alerting/images/slack-copy-webhook-url.png b/docs/management/connectors/images/slack-copy-webhook-url.png similarity index 100% rename from docs/user/alerting/images/slack-copy-webhook-url.png rename to docs/management/connectors/images/slack-copy-webhook-url.png diff --git a/docs/management/connectors/images/slack-params-test.png b/docs/management/connectors/images/slack-params-test.png new file mode 100644 index 0000000000000..603f66301af12 Binary files /dev/null and b/docs/management/connectors/images/slack-params-test.png differ diff --git a/docs/user/alerting/images/teams-add-webhook-integration.png b/docs/management/connectors/images/teams-add-webhook-integration.png similarity index 100% rename from docs/user/alerting/images/teams-add-webhook-integration.png rename to docs/management/connectors/images/teams-add-webhook-integration.png diff --git a/docs/management/connectors/images/teams-connector.png b/docs/management/connectors/images/teams-connector.png new file mode 100644 index 0000000000000..4b9112db28474 Binary files /dev/null and b/docs/management/connectors/images/teams-connector.png differ diff --git a/docs/user/alerting/images/teams-copy-webhook-url.png b/docs/management/connectors/images/teams-copy-webhook-url.png similarity index 100% rename from docs/user/alerting/images/teams-copy-webhook-url.png rename to docs/management/connectors/images/teams-copy-webhook-url.png diff --git a/docs/management/connectors/images/teams-params-test.png b/docs/management/connectors/images/teams-params-test.png new file mode 100644 index 0000000000000..01efb84ae60d4 Binary files /dev/null and b/docs/management/connectors/images/teams-params-test.png differ diff --git a/docs/management/connectors/images/webhook-connector.png b/docs/management/connectors/images/webhook-connector.png new file mode 100644 index 0000000000000..6046572734afd Binary files /dev/null and b/docs/management/connectors/images/webhook-connector.png differ diff --git a/docs/management/connectors/images/webhook-params-test.png b/docs/management/connectors/images/webhook-params-test.png new file mode 100644 index 0000000000000..7b7007a72a0b6 Binary files /dev/null and b/docs/management/connectors/images/webhook-params-test.png differ diff --git a/docs/management/connectors/index.asciidoc b/docs/management/connectors/index.asciidoc new file mode 100644 index 0000000000000..ea4fa46d3e808 --- /dev/null +++ b/docs/management/connectors/index.asciidoc @@ -0,0 +1,11 @@ +include::action-types/email.asciidoc[] +include::action-types/resilient.asciidoc[] +include::action-types/index.asciidoc[] +include::action-types/jira.asciidoc[] +include::action-types/teams.asciidoc[] +include::action-types/pagerduty.asciidoc[] +include::action-types/server-log.asciidoc[] +include::action-types/servicenow.asciidoc[] +include::action-types/slack.asciidoc[] +include::action-types/webhook.asciidoc[] +include::pre-configured-connectors.asciidoc[] diff --git a/docs/user/alerting/action-types/pre-configured-connectors.asciidoc b/docs/management/connectors/pre-configured-connectors.asciidoc similarity index 99% rename from docs/user/alerting/action-types/pre-configured-connectors.asciidoc rename to docs/management/connectors/pre-configured-connectors.asciidoc index 557404f24288a..4d304cdd6c5a2 100644 --- a/docs/user/alerting/action-types/pre-configured-connectors.asciidoc +++ b/docs/management/connectors/pre-configured-connectors.asciidoc @@ -1,6 +1,5 @@ [role="xpack"] [[pre-configured-connectors]] - === Preconfigured connectors You can preconfigure a connector to have all the information it needs prior to startup by adding it to the `kibana.yml` file. diff --git a/docs/management/alerting/images/rules-and-connectors-ui.png b/docs/management/images/rules-and-connectors-ui.png similarity index 100% rename from docs/management/alerting/images/rules-and-connectors-ui.png rename to docs/management/images/rules-and-connectors-ui.png diff --git a/docs/redirects.asciidoc b/docs/redirects.asciidoc index 5d0242ae31950..15b353223452a 100644 --- a/docs/redirects.asciidoc +++ b/docs/redirects.asciidoc @@ -292,3 +292,8 @@ This content has moved. refer to <>. == Tutorial: Use role-based access control to customize Kibana spaces This content has moved. refer to <>. + +[role="exclude",id="search"] +== Search your data + +This content has moved. refer to <>. diff --git a/docs/settings/fleet-settings.asciidoc b/docs/settings/fleet-settings.asciidoc index 2d330445d9ced..9c054fbc00222 100644 --- a/docs/settings/fleet-settings.asciidoc +++ b/docs/settings/fleet-settings.asciidoc @@ -37,12 +37,10 @@ See the {fleet-guide}/index.html[{fleet}] docs for more information. [cols="2*<"] |=== -| `xpack.fleet.agents.kibana.host` - | The hostname used by {agent} for accessing {kib}. +| `xpack.fleet.agents.fleet_server.hosts` + | Hostnames used by {agent} for accessing {fleet-server}. | `xpack.fleet.agents.elasticsearch.host` | The hostname used by {agent} for accessing {es}. -| `xpack.fleet.agents.tlsCheckDisabled` - | Set to `true` to allow {fleet} to run on a {kib} instance without TLS enabled. |=== [NOTE] diff --git a/docs/settings/reporting-settings.asciidoc b/docs/settings/reporting-settings.asciidoc index 9bb11f3f99a15..084ac633e9bca 100644 --- a/docs/settings/reporting-settings.asciidoc +++ b/docs/settings/reporting-settings.asciidoc @@ -275,9 +275,20 @@ For information about {kib} memory limits, see <> setting. Defaults to `.reporting`. +| [[xpack-reporting-roles-enabled]] `xpack.reporting.roles.enabled` + | deprecated:[7.13.0,This setting must be set to `false` in 8.0.] When `true`, grants users + access to the {report-features} by assigning reporting roles, specified by `xpack.reporting.roles.allow`. + Granting access to users this way is deprecated. Set to `false` and use + {kibana-ref}/kibana-privileges.html[{kib} privileges] instead. + Defaults to `true`. + | `xpack.reporting.roles.allow` - | Specifies the roles in addition to superusers that can use reporting. - Defaults to `[ "reporting_user" ]`. + + | deprecated:[7.13.0,This setting will be removed in 8.0.] Specifies the roles, + in addition to superusers, that can generate reports, using the {ref}/security-api.html#security-role-apis[{es} role management APIs]. + Requires `xpack.reporting.roles.enabled` to be `true`. + Granting access to users this way is deprecated. Use + {kibana-ref}/kibana-privileges.html[{kib} privileges] instead. + Defaults to `[ "reporting_user" ]`. |=== diff --git a/docs/setup/settings.asciidoc b/docs/setup/settings.asciidoc index a7af590136355..1b027739169ad 100644 --- a/docs/setup/settings.asciidoc +++ b/docs/setup/settings.asciidoc @@ -8,9 +8,10 @@ default it is in `$KIBANA_HOME/config`. By default, with package distributions (Debian or RPM), it is in `/etc/kibana`. The config directory can be changed via the `KBN_PATH_CONF` environment variable: -``` +[source,text] +-- KBN_PATH_CONF=/home/kibana/config ./bin/kibana -``` +-- The default host and port settings configure {kib} to run on `localhost:5601`. To change this behavior and allow remote users to connect, you'll need to update your `kibana.yml` file. You can also enable SSL and set a variety of other options. Finally, environment variables can be injected into @@ -281,7 +282,7 @@ To reload the logging settings, send a SIGHUP signal to {kib}. |=== |[[logging-root]] `logging.root:` -| The {kibana-ref}/logging-service.html#logging-service[`root` logger] has a dedicated configuration node since this context name is special and is pre-configured for logging by default. +| The {kibana-ref}/logging-service.html#logging-service[`root` logger] has a dedicated configuration node since this context name is special and is pre-configured for logging by default. // TODO: add link to the advanced logging documentation. |[[logging-root-appenders]] `logging.root.appenders:` @@ -313,7 +314,7 @@ To reload the logging settings, send a SIGHUP signal to {kib}. | Allows you to specify a fileName to send log records to on disk. To send <>, add the file appender to `root.appenders`. | `logging.appenders.rolling-file:` -| Similar to Log4j's `RollingFileAppender`, this appender will log into a file and rotate if following a rolling strategy when the configured policy triggers. There are currently two policies supported: `size-limit` and `time-interval`. +| Similar to Log4j's `RollingFileAppender`, this appender will log into a file and rotate if following a rolling strategy when the configured policy triggers. There are currently two policies supported: `size-limit` and `time-interval`. The size limit policy will perform a rollover when the log file reaches a maximum `size`. *Default 100mb* @@ -504,49 +505,39 @@ deprecation warning at startup. This setting cannot end in a slash (`/`). proxy sitting in front of it. This determines whether HTTP compression may be used for responses, based on the request `Referer` header. This setting may not be used when <> is set to `false`. *Default: `none`* - -a| [[server-securityResponseHeaders-strictTransportSecurity]] ----- -server.securityResponseHeaders: - strictTransportSecurity: ----- +[[server-securityResponseHeaders-strictTransportSecurity]] +a| +`server.securityResponseHeaders:` +`strictTransportSecurity:` | Controls whether the https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Strict-Transport-Security[`Strict-Transport-Security`] header is used in all responses to the client from the {kib} server, and specifies what value is used. Allowed values are any text value or `null`. To disable, set to `null`. *Default:* `null` -a| [[server-securityResponseHeaders-xContentTypeOptions]] ----- -server.securityResponseHeaders: - xContentTypeOptions: ----- +[[server-securityResponseHeaders-xContentTypeOptions]] +a| `server.securityResponseHeaders:` +`xContentTypeOptions:` | Controls whether the https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/X-Content-Type-Options[`X-Content-Type-Options`] header is used in all responses to the client from the {kib} server, and specifies what value is used. Allowed values are `nosniff` or `null`. To disable, set to `null`. *Default:* `"nosniff"` -a| [[server-securityResponseHeaders-referrerPolicy]] ----- -server.securityResponseHeaders: - referrerPolicy: ----- +[[server-securityResponseHeaders-referrerPolicy]] +a|`server.securityResponseHeaders:` +`referrerPolicy:` | Controls whether the https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Referrer-Policy[`Referrer-Policy`] header is used in all responses to the client from the {kib} server, and specifies what value is used. Allowed values are `no-referrer`, `no-referrer-when-downgrade`, `origin`, `origin-when-cross-origin`, `same-origin`, `strict-origin`, `strict-origin-when-cross-origin`, `unsafe-url`, or `null`. To disable, set to `null`. *Default:* `"no-referrer-when-downgrade"` -a| [[server-securityResponseHeaders-permissionsPolicy]] ----- -server.securityResponseHeaders: - permissionsPolicy: ----- +[[server-securityResponseHeaders-permissionsPolicy]] +a|`server.securityResponseHeaders:` +`permissionsPolicy:` | experimental[] Controls whether the https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Feature-Policy[`Permissions-Policy`] header is used in all responses to the client from the {kib} server, and specifies what value is used. Allowed values are any text value or `null`. To disable, set to `null`. *Default:* `null` -a| [[server-securityResponseHeaders-disableEmbedding]] ----- -server.securityResponseHeaders: - disableEmbedding: ----- +[[server-securityResponseHeaders-disableEmbedding]] +a|`server.securityResponseHeaders:` +`disableEmbedding:` | Controls whether the https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy[`Content-Security-Policy`] and https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/X-Frame-Options[`X-Frame-Options`] headers are configured to disable embedding {kib} in other webpages using iframes. When set to `true`, secure headers are used to disable embedding, which adds the `frame-ancestors: @@ -557,6 +548,9 @@ SAMEORIGIN` response header. *Default:* `false` | Header names and values to send on all responses to the client from the {kib} server. *Default: `{}`* +|[[server-shutdownTimeout]] `server.shutdownTimeout:` +| Sets the grace period for {kib} to attempt to resolve any ongoing HTTP requests after receiving a `SIGTERM`/`SIGINT` signal, and before shutting down. Any new HTTP requests received during this period are rejected with a `503` response. *Default: `30s`* + |[[server-host]] `server.host:` | This setting specifies the host of the back end server. To allow remote users to connect, set the value to the IP address or DNS name of the {kib} server. *Default: `"localhost"`* diff --git a/docs/user/alerting/action-types.asciidoc b/docs/user/alerting/action-types.asciidoc deleted file mode 100644 index b648f5a9ccde5..0000000000000 --- a/docs/user/alerting/action-types.asciidoc +++ /dev/null @@ -1,75 +0,0 @@ -[role="xpack"] -[[action-types]] -== Connectors and actions - -Connectors provide a central place to store connection information for services and integrations with third party systems. Actions are instantiations of a connector that are linked to rules and run as background tasks on the {kib} server when rule conditions are met. {kib} provides the following types of connectors: - -[cols="2"] -|=== - -a| <> - -| Send email from your server. - -a| <> - -| Create an incident in IBM Resilient. - -a| <> - -| Index data into Elasticsearch. - -a| <> - -| Create an incident in Jira. - -a| <> - -| Send a message to a Microsoft Teams channel. - -a| <> - -| Send an event in PagerDuty. - -a| <> - -| Add a message to a Kibana log. - -a| <> - -| Create an incident in ServiceNow. - -a| <> - -| Send a message to a Slack channel or user. - -a| <> - -| Send a request to a web service. -|=== - -[NOTE] -============================================== -Some connector types are paid commercial features, while others are free. -For a comparison of the Elastic subscription levels, -see https://www.elastic.co/subscriptions[the subscription page]. -============================================== - -[float] -[[create-connectors]] -=== Preconfigured connectors - -For out-of-the-box and standardized connectors, you can <> -before {kib} starts. - -include::action-types/email.asciidoc[] -include::action-types/resilient.asciidoc[] -include::action-types/index.asciidoc[] -include::action-types/jira.asciidoc[] -include::action-types/teams.asciidoc[] -include::action-types/pagerduty.asciidoc[] -include::action-types/server-log.asciidoc[] -include::action-types/servicenow.asciidoc[] -include::action-types/slack.asciidoc[] -include::action-types/webhook.asciidoc[] -include::action-types/pre-configured-connectors.asciidoc[] diff --git a/docs/user/alerting/alerting-getting-started.asciidoc b/docs/user/alerting/alerting-getting-started.asciidoc index 2c8985075398e..bb11d2a0be423 100644 --- a/docs/user/alerting/alerting-getting-started.asciidoc +++ b/docs/user/alerting/alerting-getting-started.asciidoc @@ -5,7 +5,7 @@ -- -Alerting allows you to define *rules* to detect complex conditions within different {kib} apps and trigger actions when those conditions are met. Alerting is integrated with {observability-guide}/create-alerts.html[*Observability*], {security-guide}/prebuilt-rules.html[*Security*], <> and {ml-docs}/ml-configuring-alerts.html[*{ml-app}*], can be centrally managed from the <> UI, and provides a set of built-in <> and <> (known as stack rules) for you to use. +Alerting allows you to define *rules* to detect complex conditions within different {kib} apps and trigger actions when those conditions are met. Alerting is integrated with {observability-guide}/create-alerts.html[*Observability*], {security-guide}/prebuilt-rules.html[*Security*], <> and {ml-docs}/ml-configuring-alerts.html[*{ml-app}*], can be centrally managed from the <> UI, and provides a set of built-in <> and <> (known as stack rules) for you to use. image::images/alerting-overview.png[Rules and Connectors UI] @@ -47,7 +47,7 @@ to control the details of the conditions to detect. For example, an <> lets you specify the index to query, an aggregation field, and a time window, but the details of the underlying {es} query are hidden. -See <> for the types of rules provided by {kib} and how they express their conditions. +See <> and <> for the types of rules provided by {kib} and how they express their conditions. [float] [[alerting-concepts-scheduling]] diff --git a/docs/user/alerting/domain-specific-rules.asciidoc b/docs/user/alerting/domain-specific-rules.asciidoc new file mode 100644 index 0000000000000..f509f9e528823 --- /dev/null +++ b/docs/user/alerting/domain-specific-rules.asciidoc @@ -0,0 +1,20 @@ +[role="xpack"] +[[domain-specific-rules]] +== Domain-specific rules + +For domain-specific rules, refer to the documentation for that app. +{kib} supports these rules: + +* {observability-guide}/create-alerts.html[Observability rules] +* {security-guide}/prebuilt-rules.html[Security rules] +* <> +* {ml-docs}/ml-configuring-alerts.html[{ml-cap} rules] beta:[] + +[NOTE] +============================================== +Some rule types are subscription features, while others are free features. +For a comparison of the Elastic subscription levels, +see {subscriptions}[the subscription page]. +============================================== + +include::map-rules/geo-rule-types.asciidoc[] diff --git a/docs/management/alerting/images/bulk-mute-disable.png b/docs/user/alerting/images/bulk-mute-disable.png similarity index 100% rename from docs/management/alerting/images/bulk-mute-disable.png rename to docs/user/alerting/images/bulk-mute-disable.png diff --git a/docs/management/alerting/images/follower_indices.png b/docs/user/alerting/images/follower_indices.png similarity index 100% rename from docs/management/alerting/images/follower_indices.png rename to docs/user/alerting/images/follower_indices.png diff --git a/docs/management/alerting/images/individual-mute-disable.png b/docs/user/alerting/images/individual-mute-disable.png similarity index 100% rename from docs/management/alerting/images/individual-mute-disable.png rename to docs/user/alerting/images/individual-mute-disable.png diff --git a/docs/management/alerting/images/rule-details-alert-muting.png b/docs/user/alerting/images/rule-details-alert-muting.png similarity index 100% rename from docs/management/alerting/images/rule-details-alert-muting.png rename to docs/user/alerting/images/rule-details-alert-muting.png diff --git a/docs/management/alerting/images/rule-details-alerts-active.png b/docs/user/alerting/images/rule-details-alerts-active.png similarity index 100% rename from docs/management/alerting/images/rule-details-alerts-active.png rename to docs/user/alerting/images/rule-details-alerts-active.png diff --git a/docs/management/alerting/images/rule-details-alerts-inactive.png b/docs/user/alerting/images/rule-details-alerts-inactive.png similarity index 100% rename from docs/management/alerting/images/rule-details-alerts-inactive.png rename to docs/user/alerting/images/rule-details-alerts-inactive.png diff --git a/docs/management/alerting/images/rule-details-disabling.png b/docs/user/alerting/images/rule-details-disabling.png similarity index 100% rename from docs/management/alerting/images/rule-details-disabling.png rename to docs/user/alerting/images/rule-details-disabling.png diff --git a/docs/management/alerting/images/rule-details-muting.png b/docs/user/alerting/images/rule-details-muting.png similarity index 100% rename from docs/management/alerting/images/rule-details-muting.png rename to docs/user/alerting/images/rule-details-muting.png diff --git a/docs/user/alerting/images/rules-and-connectors-ui.png b/docs/user/alerting/images/rules-and-connectors-ui.png new file mode 100644 index 0000000000000..3a464fa7cf375 Binary files /dev/null and b/docs/user/alerting/images/rules-and-connectors-ui.png differ diff --git a/docs/management/alerting/images/rules-filter-by-action-type.png b/docs/user/alerting/images/rules-filter-by-action-type.png similarity index 100% rename from docs/management/alerting/images/rules-filter-by-action-type.png rename to docs/user/alerting/images/rules-filter-by-action-type.png diff --git a/docs/management/alerting/images/rules-filter-by-search.png b/docs/user/alerting/images/rules-filter-by-search.png similarity index 100% rename from docs/management/alerting/images/rules-filter-by-search.png rename to docs/user/alerting/images/rules-filter-by-search.png diff --git a/docs/management/alerting/images/rules-filter-by-type.png b/docs/user/alerting/images/rules-filter-by-type.png similarity index 100% rename from docs/management/alerting/images/rules-filter-by-type.png rename to docs/user/alerting/images/rules-filter-by-type.png diff --git a/docs/user/alerting/index.asciidoc b/docs/user/alerting/index.asciidoc index a29ca1c4ca012..f8a5aacce8f0e 100644 --- a/docs/user/alerting/index.asciidoc +++ b/docs/user/alerting/index.asciidoc @@ -1,5 +1,7 @@ include::alerting-getting-started.asciidoc[] include::defining-rules.asciidoc[] -include::action-types.asciidoc[] -include::rule-types.asciidoc[] +include::rule-management.asciidoc[] +include::rule-details.asciidoc[] +include::stack-rules.asciidoc[] +include::domain-specific-rules.asciidoc[] include::alerting-troubleshooting.asciidoc[] diff --git a/docs/management/alerting/rule-details.asciidoc b/docs/user/alerting/rule-details.asciidoc similarity index 99% rename from docs/management/alerting/rule-details.asciidoc rename to docs/user/alerting/rule-details.asciidoc index a893db280c7f7..6e743595e5c33 100644 --- a/docs/management/alerting/rule-details.asciidoc +++ b/docs/user/alerting/rule-details.asciidoc @@ -1,6 +1,6 @@ [role="xpack"] [[rule-details]] -=== Rule details +== Rule details The *Rule details* page tells you about the state of the rule and provides granular control over the actions it is taking. diff --git a/docs/management/alerting/rule-management.asciidoc b/docs/user/alerting/rule-management.asciidoc similarity index 74% rename from docs/management/alerting/rule-management.asciidoc rename to docs/user/alerting/rule-management.asciidoc index b43dc9eb635e9..b908bd03b0992 100644 --- a/docs/management/alerting/rule-management.asciidoc +++ b/docs/user/alerting/rule-management.asciidoc @@ -1,6 +1,6 @@ [role="xpack"] [[alert-management]] -=== Managing Rules +== Managing rules The *Rules* tab provides a cross-app view of alerting. Different {kib} apps like {observability-guide}/create-alerts.html[*Observability*], {security-guide}/prebuilt-rules.html[*Security*], <> and <> can offer their own rules. The *Rules* tab provides a central place to: @@ -10,12 +10,12 @@ The *Rules* tab provides a cross-app view of alerting. Different {kib} apps like * Drill-down to <> [role="screenshot"] -image:management/alerting/images/rules-and-connectors-ui.png[Example rule listing in the Rules and Connectors UI] +image:images/rules-and-connectors-ui.png[Example rule listing in the Rules and Connectors UI] For more information on alerting concepts and the types of rules and connectors available, see <>. [float] -==== Finding rules +=== Finding rules The *Rules* tab lists all rules in the current space, including summary information about their execution frequency, tags, and type. @@ -36,23 +36,28 @@ image::images/rules-filter-by-action-type.png[Filtering the rule list by type of [float] [[create-edit-rules]] -==== Creating and editing rules +=== Creating and editing rules -Many rules must be created within the context of a {kib} app like <>, <>, or <>, but others are generic. Generic rule types can be created in the *Rules* management UI by clicking the *Create* button. This will launch a flyout that guides you through selecting a rule type and configuring its properties. Refer to <> for details on what types of rules are available and how to configure them. +Many rules must be created within the context of a {kib} app like <>, <>, or <>, but others are generic. Generic rule types can be created in the *Rules* management UI by clicking the *Create* button. This will launch a flyout that guides you through selecting a rule type and configuring its properties. Refer to <> for details on what types of rules are available and how to configure them. After a rule is created, you can re-open the flyout and change a rule's properties by clicking the *Edit* button shown on each row of the rule listing. [float] [[controlling-rules]] -==== Controlling rules +=== Controlling rules The rule listing allows you to quickly mute/unmute, disable/enable, and delete individual rules by clicking the action button. [role="screenshot"] -image:management/alerting/images/individual-mute-disable.png[The actions button allows an individual rule to be muted, disabled, or deleted] +image:images/individual-mute-disable.png[The actions button allows an individual rule to be muted, disabled, or deleted] These operations can also be performed in bulk by multi-selecting rules and clicking the *Manage rules* button: [role="screenshot"] -image:management/alerting/images/bulk-mute-disable.png[The Manage rules button lets you mute/unmute, enable/disable, and delete in bulk] +image:images/bulk-mute-disable.png[The Manage rules button lets you mute/unmute, enable/disable, and delete in bulk] + +[float] +=== Required permissions + +Access to rules is granted based on your privileges to alerting-enabled features. See <> for more information. diff --git a/docs/user/alerting/rule-types.asciidoc b/docs/user/alerting/stack-rules.asciidoc similarity index 58% rename from docs/user/alerting/rule-types.asciidoc rename to docs/user/alerting/stack-rules.asciidoc index 44a22c548757c..483834c78806e 100644 --- a/docs/user/alerting/rule-types.asciidoc +++ b/docs/user/alerting/stack-rules.asciidoc @@ -1,14 +1,11 @@ [role="xpack"] -[[rule-types]] -== Rules +[[stack-rules]] +== Stack rule types Kibana provides two types of rules: * Stack rules, which are built into {kib} -* Domain-specific rules, which are registered by {kib} apps. - -[float] -==== Standard stack rules +* <>, which are registered by {kib} apps. {kib} provides two stack rules: @@ -18,17 +15,6 @@ Kibana provides two types of rules: Users require the `all` privilege to access the *Stack Rules* feature and create and edit rules. See <> for more information. -[float] -==== Domain-specific rules - -For domain-specific rules, refer to the documentation for that app. -{kib} supports these rules: - -* {observability-guide}/create-alerts.html[Observability rules] -* {security-guide}/prebuilt-rules.html[Security rules] -* <> -* {ml-docs}/ml-configuring-alerts.html[{ml-cap} rules] beta:[] - [NOTE] ============================================== Some rule types are subscription features, while others are free features. @@ -39,4 +25,3 @@ see {subscriptions}[the subscription page]. include::stack-rules/index-threshold.asciidoc[] include::stack-rules/es-query.asciidoc[] -include::map-rules/geo-rule-types.asciidoc[] diff --git a/docs/user/discover.asciidoc b/docs/user/discover.asciidoc index 39e3a8e41ea6a..4565f7c9616c3 100644 --- a/docs/user/discover.asciidoc +++ b/docs/user/discover.asciidoc @@ -189,7 +189,7 @@ Saving a search saves the query and the filters. . In the toolbar, click **Save**. . Give your search a title, and then click **Save**. -+ ++ [role="screenshot"] image:images/discover-save-saved-search.png[Save saved search in Discover, width=50%] @@ -215,7 +215,7 @@ image:images/visualize-from-discover.png[Visualization that opens from Discover If your documents contain geo point fields (image:images/geoip-icon.png[Geo point field icon, width=20px]), you can visualize them in **Maps**. -. Make sure the index pattern is set to **kibana_sample_data_ecommerce** and the configured time range +. Make sure the index pattern is set to **kibana_sample_data_ecommerce** and the configured time range contains data. . From the **Available fields** list, click `geoip.location`, and then click **Visualize**. @@ -243,12 +243,10 @@ the table columns that display by default, and more. -- -include::{kib-repo-dir}/management/index-patterns.asciidoc[] - -include::{kib-repo-dir}/discover/set-time-filter.asciidoc[] - -include::{kib-repo-dir}/discover/search.asciidoc[] - include::{kib-repo-dir}/discover/context.asciidoc[] include::{kib-repo-dir}/discover/search-for-relevance.asciidoc[] + +include::{kib-repo-dir}/discover/save-search.asciidoc[] + +include::{kib-repo-dir}/discover/search-sessions.asciidoc[] diff --git a/docs/user/index.asciidoc b/docs/user/index.asciidoc index 81ded1e54d8fd..47d86004fdc66 100644 --- a/docs/user/index.asciidoc +++ b/docs/user/index.asciidoc @@ -29,6 +29,8 @@ include::ml/index.asciidoc[] include::graph/index.asciidoc[] +include::alerting/index.asciidoc[] + include::{kib-repo-dir}/observability/index.asciidoc[] include::{kib-repo-dir}/apm/index.asciidoc[] @@ -45,8 +47,6 @@ include::{kib-repo-dir}/fleet/fleet.asciidoc[] include::reporting/index.asciidoc[] -include::alerting/index.asciidoc[] - include::api.asciidoc[] include::plugins.asciidoc[] diff --git a/docs/user/management.asciidoc b/docs/user/management.asciidoc index 7c73a80362eb6..83e18734f65d4 100644 --- a/docs/user/management.asciidoc +++ b/docs/user/management.asciidoc @@ -78,9 +78,9 @@ You can add and remove remote clusters, and check their connectivity. [cols="50, 50"] |=== -| <> -| Centrally manage your rules across {kib}. Create and manage reusable -connectors for triggering actions. +| <> +| Centrally <> across {kib}. Create and <> for triggering actions. | <> | Monitor the generation of reports—PDF, PNG, and CSV—and download reports that you previously generated. @@ -182,16 +182,10 @@ next major version of {es}, and then reindex, if needed. include::{kib-repo-dir}/management/advanced-options.asciidoc[] -include::{kib-repo-dir}/management/alerting/rules-and-connectors-intro.asciidoc[] - -include::{kib-repo-dir}/management/alerting/rule-management.asciidoc[] - -include::{kib-repo-dir}/management/alerting/rule-details.asciidoc[] - -include::{kib-repo-dir}/management/alerting/connector-management.asciidoc[] - include::{kib-repo-dir}/management/managing-beats.asciidoc[] +include::{kib-repo-dir}/management/action-types.asciidoc[] + include::{kib-repo-dir}/management/managing-fields.asciidoc[] include::{kib-repo-dir}/management/managing-licenses.asciidoc[] @@ -202,14 +196,14 @@ include::{kib-repo-dir}/management/rollups/create_and_manage_rollups.asciidoc[] include::{kib-repo-dir}/management/managing-saved-objects.asciidoc[] -include::{kib-repo-dir}/management/managing-tags.asciidoc[] - include::security/index.asciidoc[] include::{kib-repo-dir}/management/snapshot-restore/index.asciidoc[] include::{kib-repo-dir}/spaces/index.asciidoc[] +include::{kib-repo-dir}/management/managing-tags.asciidoc[] + include::{kib-repo-dir}/management/upgrade-assistant/index.asciidoc[] include::{kib-repo-dir}/management/watcher-ui/index.asciidoc[] diff --git a/docs/user/monitoring/kibana-alerts.asciidoc b/docs/user/monitoring/kibana-alerts.asciidoc index 2944921edd2ee..58bf419d8d54a 100644 --- a/docs/user/monitoring/kibana-alerts.asciidoc +++ b/docs/user/monitoring/kibana-alerts.asciidoc @@ -20,7 +20,7 @@ analyze past performance. You can also modify active alerts. image::user/monitoring/images/monitoring-kibana-alerts.png["Kibana alerts in the Stack Monitoring app"] To review and modify all the available alerts, use -<> in *{stack-manage-app}*. +<> in *{stack-manage-app}*. [discrete] [[kibana-alerts-cpu-threshold]] diff --git a/docs/user/reporting/index.asciidoc b/docs/user/reporting/index.asciidoc index dbe433466c961..144ed1ea28c93 100644 --- a/docs/user/reporting/index.asciidoc +++ b/docs/user/reporting/index.asciidoc @@ -31,10 +31,15 @@ for different operating systems. [[reporting-required-privileges]] == Roles and privileges -To generate a report, you must have the `reporting_user` role. You also need -the appropriate {kib} privileges to access the objects that you -want to report on and the {es} indices. See <> -for an example. +When security is enabled, access to the {report-features} is controlled by security privileges. In versions 7.12 and earlier, you can grant access to the {report-features} +by assigning users the `reporting_user` role in {es}. In 7.13 and later, you can configure *Reporting* to use +<>. It is recommended that *Reporting* is configured to +use {kib} privileges by setting <> to `false`. By using {kib} privileges, you can define +custom roles that grant *Reporting* privileges as sub-features of {kib} applications in *Role Management*. + +Users must also have the {kib} privileges to access the saved objects and associated {es} indices included in the generated reports. +For an example, refer to <>. [float] [[manually-generate-reports]] diff --git a/docs/user/security/images/reporting-custom-role.png b/docs/user/security/images/reporting-custom-role.png new file mode 100644 index 0000000000000..4034ca3665806 Binary files /dev/null and b/docs/user/security/images/reporting-custom-role.png differ diff --git a/docs/user/security/reporting.asciidoc b/docs/user/security/reporting.asciidoc index e69643ef9712a..2f331e252c492 100644 --- a/docs/user/security/reporting.asciidoc +++ b/docs/user/security/reporting.asciidoc @@ -16,17 +16,30 @@ For more information, see //// [[reporting-app-users]] -To enable users to generate reports, you must assign them the built-in `reporting_user` -role. Users will also need the appropriate <> to access the objects -to report on and the {es} indices. +Access to reporting features is limited to privileged users. In older versions of Kibana, you could only grant +users the privilege by assigning them the `reporting_user` role in Elasticsearch. In 7.13 and above, you have +the option to create your own roles that grant access to reporting features using <>. + +It is recommended that you set `xpack.reporting.roles.enabled: false` in your kibana.yml to begin using Kibana +privileges. This will allow users to only see Reporting widgets in applications when they have privilege to use +them. + +[NOTE] +============================================================================ +The default value of `xpack.reporting.roles.enabled` is `true` for 7.x versions of Kibana. To migrate users to the +new method of securing access to *Reporting*, you must explicitly set `xpack.reporting.roles.enabled: false` in +`kibana.yml`. In the next major version of Kibana, having this set to `false` will be the only valid configuration. +============================================================================ + +This document discusses how to create a role that grants access to reporting features using the new method of +Kibana application privileges. [float] [[reporting-roles-management-ui]] -=== If you are using the `native` realm +=== Create the role in the `native` realm -To assign roles, use the *Roles* UI or <>. -This example shows how to use *Roles* page to create a user who has a custom role and the -`reporting_user` role. +To create roles, use the *Roles* UI or <>. This example shows how to +create a role that grants reporting feature privileges in {kib} applications. . Open the main menu, then click *Stack Management > Roles*. @@ -42,60 +55,69 @@ For more information, see {ref}/security-privileges.html[Security privileges]. [role="screenshot"] image::user/security/images/reporting-privileges-example.png["Reporting privileges"] -. Add space privileges. +. Add space privileges for the {kib} applications that allow access to the reporting options. ++ +To allow users to create CSV reports in *Discover*, or PDF reports in *Canvas*, +*Visualize Library*, and *Dashboard*, click *Add Kibana privilege* for each application, +then select the privileges to generate +reports. For example, select *All* privileges for all features, or *Customize* to grant +the privilege to generate reports for only specific applications. ++ +[role="screenshot"] +image::user/security/images/reporting-custom-role.png["Reporting custom role"] ++ +[NOTE] +============================================================================ +Granting users access to reporting features in any application also grants them access to manage their reports in *Stack Management > Reporting*. +============================================================================ + -Reporting users typically save searches, create -visualizations, and build dashboards. They require a space -that provides read and write privileges in -*Discover* and *Dashboard*. - . Save your new role. -. Open the main menu, then click *Stack Management > Users*, add a new user, and assign the user the built-in -`reporting_user` role and your new custom role, `custom_reporting_user`. - -[float] -==== With a custom index - -If you are using Reporting with a custom index, -the `xpack.reporting.index` setting should begin -with `.reporting-*`. The default {kib} system user has -`all` privileges against the `.reporting-*` pattern of indices. - -[source,js] -xpack.reporting.index: '.reporting-custom-index' - -If you use a different pattern for the `xpack.reporting.index` setting, -you must create a custom role with appropriate access to the index, similar -to the following: - -. Open the main menu, then click *Stack Management > Roles*. -. Click *Create role*, then name the role `custom-reporting-user`. -. Specify the custom index and assign it the `all` index privilege. -. Open the main menu, then click *Stack Management > Users* and create a new user with -the `kibana_system` role and the `custom-reporting-user` role. -. Configure {kib} to use the new account: -[source,js] -elasticsearch.username: 'custom_kibana_system' +. Open the main menu, then click *Stack Management > Users*, add a new user, and assign the user +your new `custom_reporting_user` role. [float] [[reporting-roles-user-api]] ==== With the user API -This example uses the {ref}/security-api-put-user.html[user API] to create a user who has the -`reporting_user` role and the `kibana_admin` role: +This example uses the {ref}/security-api-put-role.html[role API] to create a role that +grants the privilege to generate reports in *Canvas*, *Discover*, *Visualize Library*, and *Dashboard*. +This role is meant to be granted to users in combination with other roles that grant read access +to the data in {es}, and at least read access in the applications +where they'll generate reports. [source, sh] --------------------------------------------------------------- -POST /_security/user/reporter +POST /_security/role/custom_reporting_user { - "password" : "x-pack-test-password", - "roles" : ["kibana_admin", "reporting_user"], - "full_name" : "Reporting User" + metadata: {}, + elasticsearch: { cluster: [], indices: [], run_as: [] }, + kibana: [ + { + base: [], + feature: { + dashboard: [ + 'generate_report', <1> + 'download_csv_report' <2> + ], + discover: ['generate_report'], <3> + canvas: ['generate_report'], <4> + visualize: ['generate_report'], <5> + }, + spaces: ['*'], + } + ] } --------------------------------------------------------------- +// CONSOLE + +<1> Grants access to generate PNG and PDF reports in *Dashboard*. +<2> Grants access to download CSV files from saved search panels in *Dashboard*. +<3> Grants access to generate CSV reports from saved searches in *Discover*. +<4> Grants access to generate PDF reports in *Canvas*. +<5> Grants access to generate PNG and PDF reports in *Visualize Library*. [float] -=== If you are using an external identity provider +=== When using an external provider If you are using an external identity provider, such as LDAP or Active Directory, you can either assign @@ -113,6 +135,35 @@ reporting_user: - "cn=Bill Murray,dc=example,dc=com" -------------------------------------------------------------------------------- +[float] +=== With a custom index + +If you are using a custom index, +the `xpack.reporting.index` setting should begin +with `.reporting-*`. The default {kib} system user has +`all` privileges against the `.reporting-*` pattern of indices. + +[source,js] +xpack.reporting.index: '.reporting-custom-index' + +If you use a different pattern for the `xpack.reporting.index` setting, +you must create a custom `kibana_system` user with appropriate access to the index, similar +to the following: + +. Open the main menu, then click *Stack Management > Roles*. +. Click *Create role*, then name the role `custom-reporting-user`. +. Specify the custom index and assign it the `all` index privilege. +. Open the main menu, then click *Stack Management > Users* and create a new user with +the `kibana_system` role and the `custom-reporting-user` role. +. Configure {kib} to use the new account: +[source,js] +elasticsearch.username: 'custom_kibana_system' + +[NOTE] +============================================================================ +Setting a custom index for *Reporting* is not supported in the next major version of Kibana. +============================================================================ + [role="xpack"] [[securing-reporting]] === Secure the reporting endpoints diff --git a/package.json b/package.json index 38eaec444ac5d..992433e17e6c1 100644 --- a/package.json +++ b/package.json @@ -77,7 +77,6 @@ "**/deepmerge": "^4.2.2", "**/fast-deep-equal": "^3.1.1", "globby/fast-glob": "3.2.5", - "**/graphql-toolkit/lodash": "^4.17.21", "**/hoist-non-react-statics": "^3.3.2", "**/isomorphic-fetch/node-fetch": "^2.6.1", "**/istanbul-instrumenter-loader/schema-utils": "1.0.0", @@ -101,8 +100,8 @@ "@elastic/charts": "28.2.0", "@elastic/datemath": "link:bazel-bin/packages/elastic-datemath/npm_module", "@elastic/elasticsearch": "npm:@elastic/elasticsearch-canary@^8.0.0-canary.4", - "@elastic/ems-client": "7.12.0", - "@elastic/eui": "32.0.4", + "@elastic/ems-client": "7.13.0", + "@elastic/eui": "32.1.0", "@elastic/filesaver": "1.1.2", "@elastic/good": "^9.0.1-kibana3", "@elastic/maki": "6.3.0", @@ -137,7 +136,7 @@ "@kbn/monaco": "link:packages/kbn-monaco", "@kbn/server-http-tools": "link:packages/kbn-server-http-tools", "@kbn/server-route-repository": "link:packages/kbn-server-route-repository", - "@kbn/std": "link:packages/kbn-std", + "@kbn/std": "link:bazel-bin/packages/kbn-std/npm_module", "@kbn/tinymath": "link:bazel-bin/packages/kbn-tinymath/npm_module", "@kbn/ui-framework": "link:packages/kbn-ui-framework", "@kbn/ui-shared-deps": "link:packages/kbn-ui-shared-deps", @@ -176,17 +175,6 @@ "angular-sortable-view": "^0.0.17", "angular-ui-ace": "0.2.3", "antlr4ts": "^0.5.0-alpha.3", - "apollo-cache-inmemory": "1.6.2", - "apollo-client": "^2.3.8", - "apollo-link": "^1.2.3", - "apollo-link-error": "^1.1.7", - "apollo-link-http": "^1.5.16", - "apollo-link-http-common": "^0.2.15", - "apollo-link-schema": "^1.1.0", - "apollo-link-state": "^0.4.1", - "apollo-server-core": "^1.3.6", - "apollo-server-errors": "^2.0.2", - "apollo-server-hapi": "^1.3.6", "archiver": "^5.2.0", "axios": "^0.21.1", "base64-js": "^1.3.1", @@ -204,10 +192,10 @@ "compare-versions": "3.5.1", "concat-stream": "1.6.2", "constate": "^1.3.2", - "cronstrue": "^1.51.0", "content-disposition": "0.5.3", "copy-to-clipboard": "^3.0.8", "core-js": "^3.6.5", + "cronstrue": "^1.51.0", "cytoscape": "^3.10.0", "cytoscape-dagre": "^2.2.2", "d3": "3.5.17", @@ -242,10 +230,6 @@ "glob": "^7.1.2", "glob-all": "^3.2.1", "globby": "^11.0.3", - "graphql": "^0.13.2", - "graphql-fields": "^1.0.2", - "graphql-tag": "^2.10.3", - "graphql-tools": "^3.0.2", "handlebars": "4.7.7", "he": "^1.2.0", "history": "^4.9.0", @@ -287,9 +271,9 @@ "lodash": "^4.17.21", "lru-cache": "^4.1.5", "lz-string": "^1.4.4", - "markdown-it": "^10.0.0", "mapbox-gl": "1.13.1", "mapbox-gl-draw-rectangle-mode": "^1.0.4", + "markdown-it": "^10.0.0", "md5": "^2.1.0", "memoize-one": "^5.0.0", "mime": "^2.4.4", @@ -311,12 +295,12 @@ "object-path-immutable": "^3.1.1", "opn": "^5.5.0", "oppsy": "^2.0.0", + "p-limit": "^3.0.1", "p-map": "^4.0.0", "p-retry": "^4.2.0", "papaparse": "^5.2.0", "pdfmake": "^0.1.65", "pegjs": "0.10.0", - "p-limit": "^3.0.1", "pluralize": "3.1.0", "pngjs": "^3.4.0", "polished": "^1.9.2", @@ -333,7 +317,6 @@ "re2": "^1.15.4", "react": "^16.12.0", "react-ace": "^5.9.0", - "react-apollo": "^2.1.4", "react-beautiful-dnd": "^13.0.0", "react-color": "^2.13.8", "react-datetime": "^2.14.0", @@ -348,20 +331,20 @@ "react-moment-proptypes": "^1.7.0", "react-monaco-editor": "^0.41.2", "react-popper-tooltip": "^2.10.1", - "react-query": "^3.12.0", + "react-query": "^3.13.10", + "react-redux": "^7.2.0", + "react-resizable": "^1.7.5", "react-resize-detector": "^4.2.0", "react-reverse-portal": "^1.0.4", + "react-router": "^5.2.0", + "react-router-dom": "^5.2.0", "react-router-redux": "^4.0.8", "react-shortcuts": "^2.0.0", "react-sizeme": "^2.3.6", "react-syntax-highlighter": "^15.3.1", - "react-redux": "^7.2.0", - "react-resizable": "^1.7.5", - "react-router": "^5.2.0", - "react-router-dom": "^5.2.0", "react-tiny-virtual-list": "^2.2.0", - "react-virtualized": "^9.21.2", "react-use": "^15.3.8", + "react-virtualized": "^9.21.2", "react-vis": "^1.8.1", "react-visibility-sensor": "^5.1.1", "reactcss": "1.2.3", @@ -390,8 +373,8 @@ "strip-ansi": "^6.0.0", "style-it": "^2.1.3", "styled-components": "^5.1.0", - "symbol-observable": "^1.2.0", "suricata-sid-db": "^1.0.2", + "symbol-observable": "^1.2.0", "tabbable": "1.1.3", "tar": "4.4.13", "tinycolor2": "1.4.1", @@ -441,7 +424,7 @@ "@babel/runtime": "^7.12.5", "@babel/traverse": "^7.12.12", "@babel/types": "^7.12.12", - "@bazel/ibazel": "^0.14.0", + "@bazel/ibazel": "^0.15.10", "@bazel/typescript": "^3.2.3", "@cypress/snapshot": "^2.1.7", "@cypress/webpack-preprocessor": "^5.6.0", @@ -452,7 +435,7 @@ "@elastic/github-checks-reporter": "0.0.20b3", "@elastic/makelogs": "^6.0.0", "@istanbuljs/schema": "^0.1.2", - "@jest/reporters": "^26.5.2", + "@jest/reporters": "^26.6.2", "@kbn/babel-code-parser": "link:packages/kbn-babel-code-parser", "@kbn/babel-preset": "link:bazel-bin/packages/kbn-babel-preset/npm_module", "@kbn/cli-dev-mode": "link:packages/kbn-cli-dev-mode", @@ -489,11 +472,11 @@ "@storybook/node-logger": "^6.1.20", "@storybook/react": "^6.1.20", "@storybook/theming": "^6.1.20", - "@testing-library/dom": "^7.24.2", - "@testing-library/jest-dom": "^5.11.4", - "@testing-library/react": "^11.0.4", - "@testing-library/react-hooks": "^3.4.1", - "@testing-library/user-event": "^12.1.6", + "@testing-library/dom": "^7.30.3", + "@testing-library/jest-dom": "^5.11.10", + "@testing-library/react": "^11.2.6", + "@testing-library/react-hooks": "^5.1.1", + "@testing-library/user-event": "^13.1.1", "@types/accept": "3.1.1", "@types/angular": "^1.6.56", "@types/angular-mocks": "^1.7.0", @@ -502,7 +485,7 @@ "@types/base64-js": "^1.2.5", "@types/bluebird": "^3.1.1", "@types/chance": "^1.0.0", - "@types/cheerio": "^0.22.10", + "@types/cheerio": "^0.22.28", "@types/chroma-js": "^1.4.2", "@types/chromedriver": "^81.0.0", "@types/classnames": "^2.2.9", @@ -522,7 +505,7 @@ "@types/delete-empty": "^2.0.0", "@types/ejs": "^3.0.6", "@types/elasticsearch": "^5.0.33", - "@types/enzyme": "^3.10.5", + "@types/enzyme": "^3.10.8", "@types/eslint": "^6.1.3", "@types/extract-zip": "^1.6.2", "@types/faker": "^5.1.5", @@ -535,7 +518,6 @@ "@types/getos": "^3.0.0", "@types/git-url-parse": "^9.0.0", "@types/glob": "^7.1.2", - "@types/graphql": "^0.13.2", "@types/gulp": "^4.0.6", "@types/gulp-zip": "^4.0.1", "@types/hapi__cookie": "^10.1.1", @@ -551,9 +533,9 @@ "@types/http-proxy-agent": "^2.0.2", "@types/inquirer": "^7.3.1", "@types/intl-relativeformat": "^2.1.0", - "@types/jest": "^26.0.14", - "@types/jest-specific-snapshot": "^0.5.4", - "@types/jest-when": "^2.7.1", + "@types/jest": "^26.0.22", + "@types/jest-specific-snapshot": "^0.5.5", + "@types/jest-when": "^2.7.2", "@types/joi": "^13.4.2", "@types/jquery": "^3.3.31", "@types/js-search": "^1.4.0", @@ -632,8 +614,8 @@ "@types/tar": "^4.0.3", "@types/tar-fs": "^1.16.1", "@types/tempy": "^0.2.0", - "@types/testing-library__jest-dom": "^5.9.3", - "@types/testing-library__react-hooks": "^3.4.0", + "@types/testing-library__jest-dom": "^5.9.5", + "@types/testing-library__react-hooks": "^4.0.0", "@types/tinycolor2": "^1.4.1", "@types/type-detect": "^4.0.1", "@types/use-resize-observer": "^6.0.0", @@ -696,9 +678,9 @@ "dpdm": "3.5.0", "ejs": "^3.1.6", "enzyme": "^3.11.0", - "enzyme-adapter-react-16": "^1.15.2", - "enzyme-adapter-utils": "^1.13.0", - "enzyme-to-json": "^3.4.4", + "enzyme-adapter-react-16": "^1.15.6", + "enzyme-adapter-utils": "^1.14.0", + "enzyme-to-json": "^3.6.1", "eslint": "^6.8.0", "eslint-config-prettier": "^6.15.0", "eslint-import-resolver-node": "0.3.2", @@ -709,7 +691,7 @@ "eslint-plugin-cypress": "^2.11.2", "eslint-plugin-eslint-comments": "^3.2.0", "eslint-plugin-import": "^2.22.1", - "eslint-plugin-jest": "^24.0.2", + "eslint-plugin-jest": "^24.3.4", "eslint-plugin-jsx-a11y": "^6.2.3", "eslint-plugin-mocha": "^6.2.2", "eslint-plugin-no-unsanitized": "^3.0.2", @@ -728,13 +710,6 @@ "form-data": "^4.0.0", "geckodriver": "^1.22.2", "glob-watcher": "5.0.3", - "graphql-code-generator": "^0.18.2", - "graphql-codegen-add": "^0.18.2", - "graphql-codegen-introspection": "^0.18.2", - "graphql-codegen-typescript-client": "^0.18.2", - "graphql-codegen-typescript-common": "^0.18.2", - "graphql-codegen-typescript-resolvers": "^0.18.2", - "graphql-codegen-typescript-server": "^0.18.2", "grunt": "1.3.0", "grunt-available-tasks": "^0.6.3", "grunt-peg": "^2.0.1", @@ -752,18 +727,17 @@ "is-path-inside": "^3.0.2", "istanbul-instrumenter-loader": "^3.0.1", "jest": "^26.6.3", - "jest-canvas-mock": "^2.2.0", + "jest-canvas-mock": "^2.3.1", "jest-circus": "^26.6.3", "jest-cli": "^26.6.3", "jest-diff": "^26.6.2", - "jest-environment-jsdom-thirteen": "^1.0.1", "jest-environment-jsdom": "^26.6.2", "jest-raw-loader": "^1.0.1", - "jest-silent-reporter": "^0.2.1", + "jest-silent-reporter": "^0.5.0", "jest-snapshot": "^26.6.2", "jest-specific-snapshot": "2.0.0", - "jest-styled-components": "^7.0.2", - "jest-when": "^2.7.2", + "jest-styled-components": "^7.0.3", + "jest-when": "^3.2.1", "jimp": "^0.14.0", "jsdom": "13.1.0", "json5": "^1.0.1", diff --git a/packages/BUILD.bazel b/packages/BUILD.bazel index e1a85e926f049..552eed64d418c 100644 --- a/packages/BUILD.bazel +++ b/packages/BUILD.bazel @@ -7,6 +7,7 @@ filegroup( "//packages/kbn-apm-utils:build", "//packages/kbn-babel-preset:build", "//packages/kbn-config-schema:build", + "//packages/kbn-std:build", "//packages/kbn-tinymath:build", "//packages/kbn-utility-types:build", ], diff --git a/packages/kbn-cli-dev-mode/package.json b/packages/kbn-cli-dev-mode/package.json index 1ea319ef3601c..2ffa09d7e1604 100644 --- a/packages/kbn-cli-dev-mode/package.json +++ b/packages/kbn-cli-dev-mode/package.json @@ -18,7 +18,6 @@ "@kbn/logging": "link:../kbn-logging", "@kbn/server-http-tools": "link:../kbn-server-http-tools", "@kbn/optimizer": "link:../kbn-optimizer", - "@kbn/std": "link:../kbn-std", "@kbn/dev-utils": "link:../kbn-dev-utils", "@kbn/utils": "link:../kbn-utils" } diff --git a/packages/kbn-cli-dev-mode/src/base_path_proxy_server.test.ts b/packages/kbn-cli-dev-mode/src/base_path_proxy_server.test.ts index c99485c273364..a0afbe3a9b8c9 100644 --- a/packages/kbn-cli-dev-mode/src/base_path_proxy_server.test.ts +++ b/packages/kbn-cli-dev-mode/src/base_path_proxy_server.test.ts @@ -8,6 +8,7 @@ import { Server } from '@hapi/hapi'; import { EMPTY } from 'rxjs'; +import moment from 'moment'; import supertest from 'supertest'; import { getServerOptions, @@ -35,6 +36,7 @@ describe('BasePathProxyServer', () => { config = { host: '127.0.0.1', port: 10012, + shutdownTimeout: moment.duration(30, 'seconds'), keepaliveTimeout: 1000, socketTimeout: 1000, cors: { diff --git a/packages/kbn-cli-dev-mode/src/cli_dev_mode.test.ts b/packages/kbn-cli-dev-mode/src/cli_dev_mode.test.ts index 7b45a2639c668..3471e69846226 100644 --- a/packages/kbn-cli-dev-mode/src/cli_dev_mode.test.ts +++ b/packages/kbn-cli-dev-mode/src/cli_dev_mode.test.ts @@ -108,7 +108,7 @@ it('passes correct args to sub-classes', () => { "bar", "baz", ], - "gracefulTimeout": 5000, + "gracefulTimeout": 30000, "log": , "mapLogLine": [Function], "script": /scripts/kibana, diff --git a/packages/kbn-cli-dev-mode/src/cli_dev_mode.ts b/packages/kbn-cli-dev-mode/src/cli_dev_mode.ts index e867a7276989c..4b1bbb43ba888 100644 --- a/packages/kbn-cli-dev-mode/src/cli_dev_mode.ts +++ b/packages/kbn-cli-dev-mode/src/cli_dev_mode.ts @@ -44,7 +44,7 @@ Rx.merge( .subscribe(exitSignal$); // timeout where the server is allowed to exit gracefully -const GRACEFUL_TIMEOUT = 5000; +const GRACEFUL_TIMEOUT = 30000; export type SomeCliArgs = Pick< CliArgs, diff --git a/packages/kbn-cli-dev-mode/src/config/http_config.ts b/packages/kbn-cli-dev-mode/src/config/http_config.ts index 34f208c28df68..f39bf673f597e 100644 --- a/packages/kbn-cli-dev-mode/src/config/http_config.ts +++ b/packages/kbn-cli-dev-mode/src/config/http_config.ts @@ -8,6 +8,7 @@ import { ByteSizeValue, schema, TypeOf } from '@kbn/config-schema'; import { ICorsConfig, IHttpConfig, ISslConfig, SslConfig, sslSchema } from '@kbn/server-http-tools'; +import { Duration } from 'moment'; export const httpConfigSchema = schema.object( { @@ -22,6 +23,7 @@ export const httpConfigSchema = schema.object( maxPayload: schema.byteSize({ defaultValue: '1048576b', }), + shutdownTimeout: schema.duration({ defaultValue: '30s' }), keepaliveTimeout: schema.number({ defaultValue: 120000, }), @@ -47,6 +49,7 @@ export class HttpConfig implements IHttpConfig { host: string; port: number; maxPayload: ByteSizeValue; + shutdownTimeout: Duration; keepaliveTimeout: number; socketTimeout: number; cors: ICorsConfig; @@ -57,6 +60,7 @@ export class HttpConfig implements IHttpConfig { this.host = rawConfig.host; this.port = rawConfig.port; this.maxPayload = rawConfig.maxPayload; + this.shutdownTimeout = rawConfig.shutdownTimeout; this.keepaliveTimeout = rawConfig.keepaliveTimeout; this.socketTimeout = rawConfig.socketTimeout; this.cors = rawConfig.cors; diff --git a/packages/kbn-cli-dev-mode/src/dev_server.ts b/packages/kbn-cli-dev-mode/src/dev_server.ts index 60a279e456e3d..ca213b117ef34 100644 --- a/packages/kbn-cli-dev-mode/src/dev_server.ts +++ b/packages/kbn-cli-dev-mode/src/dev_server.ts @@ -103,7 +103,7 @@ export class DevServer { /** * Run the Kibana server * - * The observable will error if the child process failes to spawn for some reason, but if + * The observable will error if the child process fails to spawn for some reason, but if * the child process is successfully spawned then the server will be run until it completes * and restart when the watcher indicates it should. In order to restart the server as * quickly as possible we kill it with SIGKILL and spawn the process again. @@ -146,6 +146,7 @@ export class DevServer { const runServer = () => usingServerProcess(this.script, this.argv, (proc) => { this.phase$.next('starting'); + this.ready$.next(false); // observable which emits devServer states containing lines // logged to stdout/stderr, completes when stdio streams complete diff --git a/packages/kbn-config/package.json b/packages/kbn-config/package.json index 8093b6ac0d211..9bf491e300871 100644 --- a/packages/kbn-config/package.json +++ b/packages/kbn-config/package.json @@ -11,8 +11,7 @@ }, "dependencies": { "@elastic/safer-lodash-set": "link:../elastic-safer-lodash-set", - "@kbn/logging": "link:../kbn-logging", - "@kbn/std": "link:../kbn-std" + "@kbn/logging": "link:../kbn-logging" }, "devDependencies": { "@kbn/dev-utils": "link:../kbn-dev-utils", diff --git a/packages/kbn-docs-utils/src/index.ts b/packages/kbn-docs-utils/src/index.ts index 24aef1bf891f6..5accd1fa2984f 100644 --- a/packages/kbn-docs-utils/src/index.ts +++ b/packages/kbn-docs-utils/src/index.ts @@ -6,5 +6,4 @@ * Side Public License, v 1. */ -export * from './release_notes'; export * from './api_docs'; diff --git a/packages/kbn-docs-utils/src/release_notes/cli.ts b/packages/kbn-docs-utils/src/release_notes/cli.ts deleted file mode 100644 index e6d1c717459b1..0000000000000 --- a/packages/kbn-docs-utils/src/release_notes/cli.ts +++ /dev/null @@ -1,152 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0 and the Server Side Public License, v 1; you may not use this file except - * in compliance with, at your election, the Elastic License 2.0 or the Server - * Side Public License, v 1. - */ - -import Fs from 'fs'; -import Path from 'path'; -import { inspect } from 'util'; - -import { REPO_ROOT } from '@kbn/utils'; -import { run, createFlagError, createFailError } from '@kbn/dev-utils'; - -import { FORMATS, SomeFormat } from './formats'; -import { - PrApi, - Version, - ClassifiedPr, - streamFromIterable, - asyncPipeline, - IrrelevantPrSummary, - isPrRelevant, - classifyPr, -} from './lib'; - -const rootPackageJson = JSON.parse( - Fs.readFileSync(Path.resolve(REPO_ROOT, 'package.json'), 'utf8') -); -const extensions = FORMATS.map((f) => f.extension); - -export function runReleaseNotesCli() { - run( - async ({ flags, log }) => { - const token = flags.token; - if (!token || typeof token !== 'string') { - throw createFlagError('--token must be defined'); - } - const prApi = new PrApi(log, token); - - const version = Version.fromFlag(flags.version); - if (!version) { - throw createFlagError('unable to parse --version, use format "v{major}.{minor}.{patch}"'); - } - - const includeVersions = Version.fromFlags(flags.include || []); - if (!includeVersions) { - throw createFlagError('unable to parse --include, use format "v{major}.{minor}.{patch}"'); - } - - const Formats: SomeFormat[] = []; - for (const flag of Array.isArray(flags.format) ? flags.format : [flags.format]) { - const Format = FORMATS.find((F) => F.extension === flag); - if (!Format) { - throw createFlagError(`--format must be one of "${extensions.join('", "')}"`); - } - Formats.push(Format); - } - - const filename = flags.filename; - if (!filename || typeof filename !== 'string') { - throw createFlagError('--filename must be a string'); - } - - if (flags['debug-pr']) { - const number = parseInt(String(flags['debug-pr']), 10); - if (Number.isNaN(number)) { - throw createFlagError('--debug-pr must be a pr number when specified'); - } - - const summary = new IrrelevantPrSummary(log); - const pr = await prApi.getPr(number); - log.success( - inspect( - { - version: version.label, - includeVersions: includeVersions.map((v) => v.label), - isPrRelevant: isPrRelevant(pr, version, includeVersions, summary), - ...classifyPr(pr, log), - pr, - }, - { depth: 100 } - ) - ); - summary.logStats(); - return; - } - - log.info(`Loading all PRs with label [${version.label}] to build release notes...`); - - const summary = new IrrelevantPrSummary(log); - const prsToReport: ClassifiedPr[] = []; - const prIterable = prApi.iterRelevantPullRequests(version); - for await (const pr of prIterable) { - if (!isPrRelevant(pr, version, includeVersions, summary)) { - continue; - } - prsToReport.push(classifyPr(pr, log)); - } - summary.logStats(); - - if (!prsToReport.length) { - throw createFailError( - `All PRs with label [${version.label}] were filtered out by the config. Run again with --debug for more info.` - ); - } - - log.info(`Found ${prsToReport.length} prs to report on`); - - for (const Format of Formats) { - const format = new Format(version, prsToReport, log); - const outputPath = Path.resolve(`${filename}.${Format.extension}`); - await asyncPipeline(streamFromIterable(format.print()), Fs.createWriteStream(outputPath)); - log.success(`[${Format.extension}] report written to ${outputPath}`); - } - }, - { - usage: `node scripts/release_notes --token {token} --version {version}`, - flags: { - alias: { - version: 'v', - include: 'i', - }, - string: ['token', 'version', 'format', 'filename', 'include', 'debug-pr'], - default: { - filename: 'report', - version: rootPackageJson.version, - format: extensions, - }, - help: ` - --token (required) The Github access token to use for requests - --version, -v The version to fetch PRs by, PRs with version labels prior to - this one will be ignored (see --include-version) (default ${ - rootPackageJson.version - }) - --include, -i A version that is before --version but shouldn't be considered - "released" and cause PRs with a matching label to be excluded from - release notes. Use this when PRs are labeled with a version that - is less that --version and is expected to be released after - --version, can be specified multiple times. - --format Only produce a certain format, options: "${extensions.join('", "')}" - --filename Output filename, defaults to "report" - --debug-pr Fetch and print the details for a single PR, disabling reporting - `, - }, - description: ` - Fetch details from Github PRs for generating release notes - `, - } - ); -} diff --git a/packages/kbn-docs-utils/src/release_notes/formats/asciidoc.ts b/packages/kbn-docs-utils/src/release_notes/formats/asciidoc.ts deleted file mode 100644 index df86f6c7a40e1..0000000000000 --- a/packages/kbn-docs-utils/src/release_notes/formats/asciidoc.ts +++ /dev/null @@ -1,73 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0 and the Server Side Public License, v 1; you may not use this file except - * in compliance with, at your election, the Elastic License 2.0 or the Server - * Side Public License, v 1. - */ - -import dedent from 'dedent'; - -import { Format } from './format'; -import { - ASCIIDOC_SECTIONS, - UNKNOWN_ASCIIDOC_SECTION, - AREAS, - UNKNOWN_AREA, -} from '../release_notes_config'; - -function* lines(body: string) { - for (const line of dedent(body).split('\n')) { - yield `${line}\n`; - } -} - -export class AsciidocFormat extends Format { - static extension = 'asciidoc'; - - *print() { - const sortedAreas = [ - ...AREAS.slice().sort((a, b) => a.title.localeCompare(b.title)), - UNKNOWN_AREA, - ]; - - yield* lines(` - [[release-notes-${this.version.label}]] - == ${this.version.label} Release Notes - - Also see <>. - `); - - for (const section of [...ASCIIDOC_SECTIONS, UNKNOWN_ASCIIDOC_SECTION]) { - const prsInSection = this.prs.filter((pr) => pr.asciidocSection === section); - if (!prsInSection.length) { - continue; - } - - yield '\n'; - yield* lines(` - [float] - [[${section.id}-${this.version.label}]] - === ${section.title} - `); - - for (const area of sortedAreas) { - const prsInArea = prsInSection.filter((pr) => pr.area === area); - - if (!prsInArea.length) { - continue; - } - - yield `${area.title}::\n`; - for (const pr of prsInArea) { - const fixes = pr.fixes.length ? `[Fixes ${pr.fixes.join(', ')}] ` : ''; - const strippedTitle = pr.title.replace(/^\s*\[[^\]]+\]\s*/, ''); - yield `* ${fixes}${strippedTitle} {kibana-pull}${pr.number}[#${pr.number}]\n`; - if (pr.note) { - yield ` - ${pr.note}\n`; - } - } - } - } - } -} diff --git a/packages/kbn-docs-utils/src/release_notes/formats/csv.ts b/packages/kbn-docs-utils/src/release_notes/formats/csv.ts deleted file mode 100644 index ad03ebaff8049..0000000000000 --- a/packages/kbn-docs-utils/src/release_notes/formats/csv.ts +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0 and the Server Side Public License, v 1; you may not use this file except - * in compliance with, at your election, the Elastic License 2.0 or the Server - * Side Public License, v 1. - */ - -import { Format } from './format'; - -/** - * Escape a value to conform to field and header encoding defined at https://tools.ietf.org/html/rfc4180 - */ -function esc(value: string | number) { - if (typeof value === 'number') { - return String(value); - } - - if (!value.includes(',') && !value.includes('\n') && !value.includes('"')) { - return value; - } - - return `"${value.split('"').join('""')}"`; -} - -function row(...fields: Array) { - return fields.map(esc).join(',') + '\r\n'; -} - -export class CsvFormat extends Format { - static extension = 'csv'; - - *print() { - // columns - yield row( - 'areas', - 'versions', - 'user', - 'title', - 'number', - 'url', - 'date', - 'fixes', - 'labels', - 'state' - ); - - for (const pr of this.prs) { - yield row( - pr.area.title, - pr.versions.map((v) => v.label).join(', '), - pr.user.name || pr.user.login, - pr.title, - pr.number, - pr.url, - pr.mergedAt, - pr.fixes.join(', '), - pr.labels.join(', '), - pr.state - ); - } - } -} diff --git a/packages/kbn-docs-utils/src/release_notes/formats/format.ts b/packages/kbn-docs-utils/src/release_notes/formats/format.ts deleted file mode 100644 index 937beb2f3fd67..0000000000000 --- a/packages/kbn-docs-utils/src/release_notes/formats/format.ts +++ /dev/null @@ -1,23 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0 and the Server Side Public License, v 1; you may not use this file except - * in compliance with, at your election, the Elastic License 2.0 or the Server - * Side Public License, v 1. - */ - -import { ToolingLog } from '@kbn/dev-utils'; - -import { Version, ClassifiedPr } from '../lib'; - -export abstract class Format { - static extension: string; - - constructor( - protected readonly version: Version, - protected readonly prs: ClassifiedPr[], - protected readonly log: ToolingLog - ) {} - - abstract print(): Iterator; -} diff --git a/packages/kbn-docs-utils/src/release_notes/lib/classify_pr.ts b/packages/kbn-docs-utils/src/release_notes/lib/classify_pr.ts deleted file mode 100644 index ca24367fa7288..0000000000000 --- a/packages/kbn-docs-utils/src/release_notes/lib/classify_pr.ts +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0 and the Server Side Public License, v 1; you may not use this file except - * in compliance with, at your election, the Elastic License 2.0 or the Server - * Side Public License, v 1. - */ - -import { ToolingLog } from '@kbn/dev-utils'; - -import { - Area, - AREAS, - UNKNOWN_AREA, - AsciidocSection, - ASCIIDOC_SECTIONS, - UNKNOWN_ASCIIDOC_SECTION, -} from '../release_notes_config'; -import { PullRequest } from './pr_api'; - -export interface ClassifiedPr extends PullRequest { - area: Area; - asciidocSection: AsciidocSection; -} - -export function classifyPr(pr: PullRequest, log: ToolingLog): ClassifiedPr { - const filter = (a: Area | AsciidocSection) => - a.labels.some((test) => - typeof test === 'string' ? pr.labels.includes(test) : pr.labels.some((l) => l.match(test)) - ); - - const areas = AREAS.filter(filter); - const asciidocSections = ASCIIDOC_SECTIONS.filter(filter); - - const pickOne = (name: string, options: T[]) => { - if (options.length > 1) { - const matches = options.map((o) => o.title).join(', '); - log.warning(`[${pr.terminalLink}] ambiguous ${name}, mulitple match [${matches}]`); - return options[0]; - } - - if (options.length === 0) { - log.error(`[${pr.terminalLink}] unable to determine ${name} because none match`); - return; - } - - return options[0]; - }; - - return { - ...pr, - area: pickOne('area', areas) || UNKNOWN_AREA, - asciidocSection: pickOne('asciidoc section', asciidocSections) || UNKNOWN_ASCIIDOC_SECTION, - }; -} diff --git a/packages/kbn-docs-utils/src/release_notes/lib/get_fix_references.test.ts b/packages/kbn-docs-utils/src/release_notes/lib/get_fix_references.test.ts deleted file mode 100644 index 8cc8aec19f94e..0000000000000 --- a/packages/kbn-docs-utils/src/release_notes/lib/get_fix_references.test.ts +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0 and the Server Side Public License, v 1; you may not use this file except - * in compliance with, at your election, the Elastic License 2.0 or the Server - * Side Public License, v 1. - */ - -import { getFixReferences } from './get_fix_references'; - -it('returns all fixed issue mentions in the PR text', () => { - expect( - getFixReferences(` - clOses #1 - closes: #2 - clOse #3 - close: #4 - clOsed #5 - closed: #6 - fiX #7 - fix: #8 - fiXes #9 - fixes: #10 - fiXed #11 - fixed: #12 - reSolve #13 - resolve: #14 - reSolves #15 - resolves: #16 - reSolved #17 - resolved: #18 - fixed - #19 - `) - ).toMatchInlineSnapshot(` - Array [ - "#1", - "#2", - "#3", - "#4", - "#5", - "#6", - "#7", - "#8", - "#9", - "#10", - "#11", - "#12", - "#13", - "#14", - "#15", - "#16", - "#17", - "#18", - ] - `); -}); diff --git a/packages/kbn-docs-utils/src/release_notes/lib/get_note_from_description.test.ts b/packages/kbn-docs-utils/src/release_notes/lib/get_note_from_description.test.ts deleted file mode 100644 index 59945a835a3c9..0000000000000 --- a/packages/kbn-docs-utils/src/release_notes/lib/get_note_from_description.test.ts +++ /dev/null @@ -1,72 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0 and the Server Side Public License, v 1; you may not use this file except - * in compliance with, at your election, the Elastic License 2.0 or the Server - * Side Public License, v 1. - */ - -import MarkdownIt from 'markdown-it'; -import dedent from 'dedent'; - -import { getNoteFromDescription } from './get_note_from_description'; - -it('extracts expected components from html', () => { - const mk = new MarkdownIt(); - - expect( - getNoteFromDescription( - mk.render(dedent` - My PR description - - Fixes: #1234 - - ## Release Note: - - Checkout this feature - `), - 'release note' - ) - ).toMatchInlineSnapshot(`"Checkout this feature"`); - - expect( - getNoteFromDescription( - mk.render(dedent` - My PR description - - Fixes: #1234 - - #### Dev docs: - - We fixed an issue - `), - 'dev docs' - ) - ).toMatchInlineSnapshot(`"We fixed an issue"`); - - expect( - getNoteFromDescription( - mk.render(dedent` - My PR description - - Fixes: #1234 - - OTHER TITLE: Checkout feature foo - `), - 'other title' - ) - ).toMatchInlineSnapshot(`"Checkout feature foo"`); - - expect( - getNoteFromDescription( - mk.render(dedent` - # Summary - - My PR description - - release note : bar - `), - 'release note' - ) - ).toMatchInlineSnapshot(`"bar"`); -}); diff --git a/packages/kbn-docs-utils/src/release_notes/lib/get_note_from_description.ts b/packages/kbn-docs-utils/src/release_notes/lib/get_note_from_description.ts deleted file mode 100644 index db80c29454cf4..0000000000000 --- a/packages/kbn-docs-utils/src/release_notes/lib/get_note_from_description.ts +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0 and the Server Side Public License, v 1; you may not use this file except - * in compliance with, at your election, the Elastic License 2.0 or the Server - * Side Public License, v 1. - */ - -import cheerio from 'cheerio'; - -export function getNoteFromDescription(descriptionHtml: string, header: string) { - const re = new RegExp(`^(\\s*${header.toLowerCase()}(?:s)?\\s*:?\\s*)`, 'i'); - const $ = cheerio.load(descriptionHtml); - for (const el of $('p,h1,h2,h3,h4,h5').toArray()) { - const text = $(el).text(); - const match = text.match(re); - - if (!match) { - continue; - } - - const note = text.replace(match[1], '').trim(); - return note || $(el).next().text().trim(); - } -} diff --git a/packages/kbn-docs-utils/src/release_notes/lib/irrelevant_pr_summary.ts b/packages/kbn-docs-utils/src/release_notes/lib/irrelevant_pr_summary.ts deleted file mode 100644 index 3bc9ebfced60f..0000000000000 --- a/packages/kbn-docs-utils/src/release_notes/lib/irrelevant_pr_summary.ts +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0 and the Server Side Public License, v 1; you may not use this file except - * in compliance with, at your election, the Elastic License 2.0 or the Server - * Side Public License, v 1. - */ - -import { ToolingLog } from '@kbn/dev-utils'; - -import { PullRequest } from './pr_api'; -import { Version } from './version'; - -export class IrrelevantPrSummary { - private readonly stats = { - 'skipped by label': new Map(), - 'skipped by label regexp': new Map(), - 'skipped by version': new Map(), - }; - - constructor(private readonly log: ToolingLog) {} - - skippedByLabel(pr: PullRequest, label: string) { - this.log.debug(`${pr.terminalLink} skipped, label [${label}] is ignored`); - this.increment('skipped by label', label); - } - - skippedByLabelRegExp(pr: PullRequest, regexp: RegExp, label: string) { - this.log.debug(`${pr.terminalLink} skipped, label [${label}] matches regexp [${regexp}]`); - this.increment('skipped by label regexp', `${regexp}`); - } - - skippedByVersion(pr: PullRequest, earliestVersion: Version) { - this.log.debug(`${pr.terminalLink} skipped, earliest version is [${earliestVersion.label}]`); - this.increment('skipped by version', earliestVersion.label); - } - - private increment(stat: keyof IrrelevantPrSummary['stats'], key: string) { - const n = this.stats[stat].get(key) || 0; - this.stats[stat].set(key, n + 1); - } - - logStats() { - for (const [description, stats] of Object.entries(this.stats)) { - for (const [key, count] of stats) { - this.log.warning(`${count} ${count === 1 ? 'pr was' : 'prs were'} ${description} [${key}]`); - } - } - } -} diff --git a/packages/kbn-docs-utils/src/release_notes/lib/is_pr_relevant.ts b/packages/kbn-docs-utils/src/release_notes/lib/is_pr_relevant.ts deleted file mode 100644 index 1de75373c0954..0000000000000 --- a/packages/kbn-docs-utils/src/release_notes/lib/is_pr_relevant.ts +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0 and the Server Side Public License, v 1; you may not use this file except - * in compliance with, at your election, the Elastic License 2.0 or the Server - * Side Public License, v 1. - */ - -import { Version } from './version'; -import { PullRequest } from './pr_api'; -import { IGNORE_LABELS } from '../release_notes_config'; -import { IrrelevantPrSummary } from './irrelevant_pr_summary'; - -export function isPrRelevant( - pr: PullRequest, - version: Version, - includeVersions: Version[], - summary: IrrelevantPrSummary -) { - for (const label of IGNORE_LABELS) { - if (typeof label === 'string') { - if (pr.labels.includes(label)) { - summary.skippedByLabel(pr, label); - return false; - } - } - - if (label instanceof RegExp) { - const matching = pr.labels.find((l) => label.test(l)); - if (matching) { - summary.skippedByLabelRegExp(pr, label, matching); - return false; - } - } - } - - const [earliestVersion] = Version.sort( - // filter out `includeVersions` so that they won't be considered the "earliest version", only - // versions which are actually before the current `version` or the `version` itself are eligible - pr.versions.filter((v) => !includeVersions.includes(v)), - 'asc' - ); - - if (version !== earliestVersion) { - summary.skippedByVersion(pr, earliestVersion); - return false; - } - - return true; -} diff --git a/packages/kbn-docs-utils/src/release_notes/lib/pr_api.ts b/packages/kbn-docs-utils/src/release_notes/lib/pr_api.ts deleted file mode 100644 index 0f4f8abc7fd9c..0000000000000 --- a/packages/kbn-docs-utils/src/release_notes/lib/pr_api.ts +++ /dev/null @@ -1,222 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0 and the Server Side Public License, v 1; you may not use this file except - * in compliance with, at your election, the Elastic License 2.0 or the Server - * Side Public License, v 1. - */ - -import { inspect } from 'util'; - -import Axios from 'axios'; -import gql from 'graphql-tag'; -import * as GraphqlPrinter from 'graphql/language/printer'; -import { DocumentNode } from 'graphql/language/ast'; -import makeTerminalLink from 'terminal-link'; -import { ToolingLog, isAxiosResponseError } from '@kbn/dev-utils'; - -import { Version } from './version'; -import { getFixReferences } from './get_fix_references'; -import { getNoteFromDescription } from './get_note_from_description'; - -const PrNodeFragment = gql` - fragment PrNode on PullRequest { - number - url - title - bodyText - bodyHTML - mergedAt - baseRefName - state - author { - login - ... on User { - name - } - } - labels(first: 100) { - nodes { - name - } - } - } -`; - -export interface PullRequest { - number: number; - url: string; - title: string; - targetBranch: string; - mergedAt: string; - state: string; - labels: string[]; - fixes: string[]; - user: { - name: string; - login: string; - }; - versions: Version[]; - terminalLink: string; - note?: string; -} - -export class PrApi { - constructor(private readonly log: ToolingLog, private readonly token: string) {} - - async getPr(number: number) { - const resp = await this.gqlRequest( - gql` - query($number: Int!) { - repository(owner: "elastic", name: "kibana") { - pullRequest(number: $number) { - ...PrNode - } - } - } - ${PrNodeFragment} - `, - { - number, - } - ); - - const node = resp.data?.repository?.pullRequest; - if (!node) { - throw new Error(`unexpected github response, unable to fetch PR: ${inspect(resp)}`); - } - - return this.parsePullRequestNode(node); - } - - /** - * Iterate all of the PRs which have the `version` label - */ - async *iterRelevantPullRequests(version: Version) { - let nextCursor: string | undefined; - let hasNextPage = true; - - while (hasNextPage) { - const resp = await this.gqlRequest( - gql` - query($cursor: String, $labels: [String!]) { - repository(owner: "elastic", name: "kibana") { - pullRequests(first: 100, after: $cursor, labels: $labels, states: MERGED) { - pageInfo { - hasNextPage - endCursor - } - nodes { - ...PrNode - } - } - } - } - ${PrNodeFragment} - `, - { - cursor: nextCursor, - labels: [version.label], - } - ); - - const pullRequests = resp.data?.repository?.pullRequests; - if (!pullRequests) { - throw new Error(`unexpected github response, unable to fetch PRs: ${inspect(resp)}`); - } - - hasNextPage = pullRequests.pageInfo?.hasNextPage; - nextCursor = pullRequests.pageInfo?.endCursor; - - if (hasNextPage === undefined || (hasNextPage && !nextCursor)) { - throw new Error( - `github response does not include valid pagination information: ${inspect(resp)}` - ); - } - - for (const node of pullRequests.nodes) { - yield this.parsePullRequestNode(node); - } - } - } - - /** - * Convert the Github API response into the structure used by this tool - * - * @param node A GraphQL response from Github using the PrNode fragment - */ - private parsePullRequestNode(node: any): PullRequest { - const terminalLink = makeTerminalLink(`#${node.number}`, node.url); - - const labels: string[] = node.labels.nodes.map((l: { name: string }) => l.name); - - return { - number: node.number, - url: node.url, - terminalLink, - title: node.title, - targetBranch: node.baseRefName, - state: node.state, - mergedAt: node.mergedAt, - labels, - fixes: getFixReferences(node.bodyText), - user: { - login: node.author?.login || 'deleted user', - name: node.author?.name, - }, - versions: labels - .map((l) => Version.fromLabel(l)) - .filter((v): v is Version => v instanceof Version), - note: - getNoteFromDescription(node.bodyHTML, 'release note') || - getNoteFromDescription(node.bodyHTML, 'dev docs'), - }; - } - - /** - * Send a single request to the Github v4 GraphQL API - */ - private async gqlRequest(query: DocumentNode, variables: Record = {}) { - let attempt = 0; - - while (true) { - attempt += 1; - - try { - const resp = await Axios.request({ - url: 'https://api.github.com/graphql', - method: 'POST', - headers: { - 'user-agent': '@kbn/release-notes', - authorization: `bearer ${this.token}`, - }, - data: { - query: GraphqlPrinter.print(query), - variables, - }, - }); - - return resp.data; - } catch (error) { - if (!isAxiosResponseError(error) || error.response.status < 500) { - // rethrow error unless it is a 500+ response from github - throw error; - } - - const { status, data } = error.response; - const resp = inspect(data); - - if (attempt === 5) { - throw new Error( - `${status} response from Github, attempted request ${attempt} times: [${resp}]` - ); - } - - const delay = attempt * 2000; - this.log.debug(`Github responded with ${status}, retrying in ${delay} ms: [${resp}]`); - await new Promise((resolve) => setTimeout(resolve, delay)); - continue; - } - } - } -} diff --git a/packages/kbn-docs-utils/src/release_notes/lib/streams.ts b/packages/kbn-docs-utils/src/release_notes/lib/streams.ts deleted file mode 100644 index 6893bfd7f4f44..0000000000000 --- a/packages/kbn-docs-utils/src/release_notes/lib/streams.ts +++ /dev/null @@ -1,23 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0 and the Server Side Public License, v 1; you may not use this file except - * in compliance with, at your election, the Elastic License 2.0 or the Server - * Side Public License, v 1. - */ - -import { promisify } from 'util'; -import { Readable, pipeline } from 'stream'; - -/** - * @types/node still doesn't have this method that was added - * in 10.17.0 https://nodejs.org/api/stream.html#stream_stream_readable_from_iterable_options - */ -export function streamFromIterable( - iter: Iterable | AsyncIterable -): Readable { - // @ts-ignore - return Readable.from(iter); -} - -export const asyncPipeline = promisify(pipeline); diff --git a/packages/kbn-docs-utils/src/release_notes/lib/version.test.ts b/packages/kbn-docs-utils/src/release_notes/lib/version.test.ts deleted file mode 100644 index b23feb0929a2d..0000000000000 --- a/packages/kbn-docs-utils/src/release_notes/lib/version.test.ts +++ /dev/null @@ -1,135 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0 and the Server Side Public License, v 1; you may not use this file except - * in compliance with, at your election, the Elastic License 2.0 or the Server - * Side Public License, v 1. - */ - -import { Version } from './version'; - -it('parses version labels, returns null on failure', () => { - expect(Version.fromLabel('v1.0.2')).toMatchInlineSnapshot(` - Version { - "label": "v1.0.2", - "major": 1, - "minor": 0, - "patch": 2, - "tag": undefined, - "tagNum": undefined, - "tagOrder": Infinity, - } - `); - expect(Version.fromLabel('v1.0.0')).toMatchInlineSnapshot(` - Version { - "label": "v1.0.0", - "major": 1, - "minor": 0, - "patch": 0, - "tag": undefined, - "tagNum": undefined, - "tagOrder": Infinity, - } - `); - expect(Version.fromLabel('v9.0.2')).toMatchInlineSnapshot(` - Version { - "label": "v9.0.2", - "major": 9, - "minor": 0, - "patch": 2, - "tag": undefined, - "tagNum": undefined, - "tagOrder": Infinity, - } - `); - expect(Version.fromLabel('v9.0.2-alpha0')).toMatchInlineSnapshot(` - Version { - "label": "v9.0.2-alpha0", - "major": 9, - "minor": 0, - "patch": 2, - "tag": "alpha", - "tagNum": 0, - "tagOrder": 1, - } - `); - expect(Version.fromLabel('v9.0.2-beta1')).toMatchInlineSnapshot(` - Version { - "label": "v9.0.2-beta1", - "major": 9, - "minor": 0, - "patch": 2, - "tag": "beta", - "tagNum": 1, - "tagOrder": 2, - } - `); - expect(Version.fromLabel('v9.0')).toMatchInlineSnapshot(`undefined`); - expect(Version.fromLabel('some:area')).toMatchInlineSnapshot(`undefined`); -}); - -it('sorts versions in ascending order', () => { - const versions = [ - 'v1.7.3', - 'v1.7.0', - 'v1.5.0', - 'v2.7.0', - 'v7.0.0-beta2', - 'v7.0.0-alpha1', - 'v2.0.0', - 'v0.0.0', - 'v7.0.0-beta1', - 'v7.0.0', - ].map((l) => Version.fromLabel(l)!); - - const sorted = Version.sort(versions); - - expect(sorted.map((v) => v.label)).toMatchInlineSnapshot(` - Array [ - "v0.0.0", - "v1.5.0", - "v1.7.0", - "v1.7.3", - "v2.0.0", - "v2.7.0", - "v7.0.0-alpha1", - "v7.0.0-beta1", - "v7.0.0-beta2", - "v7.0.0", - ] - `); - - // ensure versions was not mutated - expect(sorted).not.toEqual(versions); -}); - -it('sorts versions in decending order', () => { - const versions = [ - 'v1.7.3', - 'v1.7.0', - 'v1.5.0', - 'v7.0.0-beta1', - 'v2.7.0', - 'v2.0.0', - 'v0.0.0', - 'v7.0.0', - ].map((l) => Version.fromLabel(l)!); - - const sorted = Version.sort(versions, 'desc'); - - expect(sorted.map((v) => v.label)).toMatchInlineSnapshot(` - Array [ - "v7.0.0", - "v7.0.0-beta1", - "v2.7.0", - "v2.0.0", - "v1.7.3", - "v1.7.0", - "v1.5.0", - "v0.0.0", - ] - `); - - // ensure versions was not mutated - expect(sorted).not.toEqual(versions); -}); diff --git a/packages/kbn-docs-utils/src/release_notes/lib/version.ts b/packages/kbn-docs-utils/src/release_notes/lib/version.ts deleted file mode 100644 index c59060c990220..0000000000000 --- a/packages/kbn-docs-utils/src/release_notes/lib/version.ts +++ /dev/null @@ -1,112 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0 and the Server Side Public License, v 1; you may not use this file except - * in compliance with, at your election, the Elastic License 2.0 or the Server - * Side Public License, v 1. - */ - -const LABEL_RE = /^v(\d+)\.(\d+)\.(\d+)(?:-(alpha|beta)(\d+))?$/; - -const versionCache = new Map(); - -const multiCompare = (...diffs: number[]) => { - for (const diff of diffs) { - if (diff !== 0) { - return diff; - } - } - return 0; -}; - -export class Version { - static fromFlag(flag: string | string[] | boolean | undefined) { - if (typeof flag !== 'string') { - return; - } - - return Version.fromLabel(flag) || Version.fromLabel(`v${flag}`); - } - - static fromFlags(flag: string | string[] | boolean | undefined) { - const flags = Array.isArray(flag) ? flag : [flag]; - const versions: Version[] = []; - - for (const f of flags) { - const version = Version.fromFlag(f); - if (!version) { - return; - } - versions.push(version); - } - - return versions; - } - - static fromLabel(label: string) { - const match = label.match(LABEL_RE); - if (!match) { - return; - } - - const cached = versionCache.get(label); - if (cached) { - return cached; - } - - const [, major, minor, patch, tag, tagNum] = match; - const version = new Version( - parseInt(major, 10), - parseInt(minor, 10), - parseInt(patch, 10), - tag as 'alpha' | 'beta' | undefined, - tagNum ? parseInt(tagNum, 10) : undefined - ); - - versionCache.set(label, version); - return version; - } - - static sort(versions: Version[], dir: 'asc' | 'desc' = 'asc') { - const order = dir === 'asc' ? 1 : -1; - - return versions.slice().sort((a, b) => a.compare(b) * order); - } - - public readonly label = `v${this.major}.${this.minor}.${this.patch}${ - this.tag ? `-${this.tag}${this.tagNum}` : '' - }`; - private readonly tagOrder: number; - - constructor( - public readonly major: number, - public readonly minor: number, - public readonly patch: number, - public readonly tag: 'alpha' | 'beta' | undefined, - public readonly tagNum: number | undefined - ) { - switch (tag) { - case undefined: - this.tagOrder = Infinity; - break; - case 'alpha': - this.tagOrder = 1; - break; - case 'beta': - this.tagOrder = 2; - break; - default: - throw new Error('unexpected tag'); - } - } - - compare(other: Version) { - return multiCompare( - this.major - other.major, - this.minor - other.minor, - this.patch - other.patch, - this.tagOrder - other.tagOrder, - (this.tagNum ?? 0) - (other.tagNum ?? 0) - ); - } -} diff --git a/packages/kbn-docs-utils/src/release_notes/release_notes_config.ts b/packages/kbn-docs-utils/src/release_notes/release_notes_config.ts deleted file mode 100644 index a94dcd8766cbd..0000000000000 --- a/packages/kbn-docs-utils/src/release_notes/release_notes_config.ts +++ /dev/null @@ -1,283 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0 and the Server Side Public License, v 1; you may not use this file except - * in compliance with, at your election, the Elastic License 2.0 or the Server - * Side Public License, v 1. - */ - -/** - * Exclude any PR from release notes that has a matching label. String - * labels must match exactly, for more complicated use a RegExp - */ -export const IGNORE_LABELS: Array = [ - 'Team:Docs', - ':KibanaApp/fix-it-week', - 'reverted', - /^test/, - 'non-issue', - 'jenkins', - 'build', - 'chore', - 'backport', - 'release_note:skip', - 'release_note:dev_docs', -]; - -/** - * Define areas that are used to categorize changes in the release notes - * based on the labels a PR has. the `labels` array can contain strings, which - * are matched exactly, or regular expressions. The first area, in definition - * order, which has a `label` which matches and label on a PR is the area - * assigned to that PR. - */ - -export interface Area { - title: string; - labels: Array; -} - -export const AREAS: Area[] = [ - { - title: 'Design', - labels: ['Team:Design', 'Project:Accessibility'], - }, - { - title: 'Logstash', - labels: ['App:Logstash', 'Feature:Logstash Pipelines'], - }, - { - title: 'Management', - labels: [ - 'Feature:license', - 'Feature:Console', - 'Feature:Search Profiler', - 'Feature:watcher', - 'Feature:Index Patterns', - 'Feature:Kibana Management', - 'Feature:Dev Tools', - 'Feature:Inspector', - 'Feature:Index Management', - 'Feature:Snapshot and Restore', - 'Team:Elasticsearch UI', - 'Feature:FieldFormatters', - 'Feature:CCR', - 'Feature:ILM', - 'Feature:Transforms', - ], - }, - { - title: 'Monitoring', - labels: ['Team:Monitoring', 'Feature:Telemetry', 'Feature:Stack Monitoring'], - }, - { - title: 'Operations', - labels: ['Team:Operations', 'Feature:License'], - }, - { - title: 'Kibana UI', - labels: ['Kibana UI', 'Team:Core UI', 'Feature:Header'], - }, - { - title: 'Platform', - labels: [ - 'Team:Platform', - 'Feature:Plugins', - 'Feature:New Platform', - 'Project:i18n', - 'Feature:ExpressionLanguage', - 'Feature:Saved Objects', - 'Team:Stack Services', - 'Feature:NP Migration', - 'Feature:Task Manager', - 'Team:Pulse', - ], - }, - { - title: 'Machine Learning', - labels: [ - ':ml', - 'Feature:Anomaly Detection', - 'Feature:Data Frames', - 'Feature:File Data Viz', - 'Feature:ml-results', - 'Feature:Data Frame Analytics', - ], - }, - { - title: 'Maps', - labels: ['Team:Geo'], - }, - { - title: 'QA', - labels: ['Team:QA'], - }, - { - title: 'Security', - labels: [ - 'Team:Security', - 'Feature:Security/Spaces', - 'Feature:users and roles', - 'Feature:Security/Authentication', - 'Feature:Security/Authorization', - 'Feature:Security/Feature Controls', - ], - }, - { - title: 'Canvas', - labels: ['Feature:Canvas'], - }, - { - title: 'Dashboard', - labels: ['Feature:Dashboard', 'Feature:Drilldowns'], - }, - { - title: 'Discover', - labels: ['Feature:Discover'], - }, - { - title: 'Kibana Home & Add Data', - labels: ['Feature:Add Data', 'Feature:Home'], - }, - { - title: 'Querying & Filtering', - labels: [ - 'Feature:Query Bar', - 'Feature:Courier', - 'Feature:Filters', - 'Feature:Timepicker', - 'Feature:Highlight', - 'Feature:KQL', - 'Feature:Rollups', - ], - }, - { - title: 'Reporting', - labels: ['Feature:Reporting', 'Team:Reporting Services'], - }, - { - title: 'Sharing', - labels: ['Feature:Embedding', 'Feature:SharingURLs'], - }, - { - title: 'Visualizations', - labels: [ - 'Feature:Timelion', - 'Feature:TSVB', - 'Feature:Coordinate Map', - 'Feature:Region Map', - 'Feature:Vega', - 'Feature:Gauge Vis', - 'Feature:Tagcloud', - 'Feature:Vis Loader', - 'Feature:Vislib', - 'Feature:Vis Editor', - 'Feature:Aggregations', - 'Feature:Input Control', - 'Feature:Visualizations', - 'Feature:Markdown', - 'Feature:Data Table', - 'Feature:Heatmap', - 'Feature:Pie Chart', - 'Feature:XYAxis', - 'Feature:Graph', - 'Feature:New Feature', - 'Feature:MetricVis', - ], - }, - { - title: 'SIEM', - labels: ['Team:SIEM'], - }, - { - title: 'Code', - labels: ['Team:Code'], - }, - { - title: 'Infrastructure', - labels: ['App:Infrastructure', 'Feature:Infra UI', 'Feature:Service Maps'], - }, - { - title: 'Logs', - labels: ['App:Logs', 'Feature:Logs UI'], - }, - { - title: 'Uptime', - labels: ['App:Uptime', 'Feature:Uptime', 'Team:uptime'], - }, - { - title: 'Beats Management', - labels: ['App:Beats', 'Feature:beats-cm', 'Team:Beats'], - }, - { - title: 'APM', - labels: ['Team:apm', /^apm[:\-]/], - }, - { - title: 'Lens', - labels: ['App:Lens', 'Feature:Lens'], - }, - { - title: 'Alerting', - labels: ['App:Alerting', 'Feature:Alerting', 'Team:Alerting Services', 'Feature:Actions'], - }, - { - title: 'Metrics', - labels: ['App:Metrics', 'Feature:Metrics UI', 'Team:logs-metrics-ui'], - }, - { - title: 'Data ingest', - labels: ['Ingest', 'Feature:Ingest Node Pipelines'], - }, -]; - -export const UNKNOWN_AREA: Area = { - title: 'Unknown', - labels: [], -}; - -/** - * Define the sections that will be assigned to PRs when generating the - * asciidoc formatted report. The order of the sections determines the - * order they will be rendered in the report - */ - -export interface AsciidocSection { - title: string; - labels: Array; - id: string; -} - -export const ASCIIDOC_SECTIONS: AsciidocSection[] = [ - { - id: 'enhancement', - title: 'Enhancements', - labels: ['release_note:enhancement'], - }, - { - id: 'bug', - title: 'Bug fixes', - labels: ['release_note:fix'], - }, - { - id: 'roadmap', - title: 'Roadmap', - labels: ['release_note:roadmap'], - }, - { - id: 'deprecation', - title: 'Deprecations', - labels: ['release_note:deprecation'], - }, - { - id: 'breaking', - title: 'Breaking Changes', - labels: ['release_note:breaking'], - }, -]; - -export const UNKNOWN_ASCIIDOC_SECTION: AsciidocSection = { - id: 'unknown', - title: 'Unknown', - labels: [], -}; diff --git a/packages/kbn-logging/package.json b/packages/kbn-logging/package.json index c7db148c75a2a..596eda1fe625a 100644 --- a/packages/kbn-logging/package.json +++ b/packages/kbn-logging/package.json @@ -9,8 +9,5 @@ "build": "../../node_modules/.bin/tsc", "kbn:bootstrap": "yarn build", "kbn:watch": "yarn build --watch" - }, - "dependencies": { - "@kbn/std": "link:../kbn-std" } } \ No newline at end of file diff --git a/packages/kbn-logging/src/ecs/agent.ts b/packages/kbn-logging/src/ecs/agent.ts new file mode 100644 index 0000000000000..0c2e7f7bbe44f --- /dev/null +++ b/packages/kbn-logging/src/ecs/agent.ts @@ -0,0 +1,21 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. + */ + +/** + * https://www.elastic.co/guide/en/ecs/1.9/ecs-agent.html + * + * @internal + */ +export interface EcsAgent { + build?: { original: string }; + ephemeral_id?: string; + id?: string; + name?: string; + type?: string; + version?: string; +} diff --git a/packages/kbn-logging/src/ecs/autonomous_system.ts b/packages/kbn-logging/src/ecs/autonomous_system.ts new file mode 100644 index 0000000000000..85569b7dbabe1 --- /dev/null +++ b/packages/kbn-logging/src/ecs/autonomous_system.ts @@ -0,0 +1,17 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. + */ + +/** + * https://www.elastic.co/guide/en/ecs/1.9/ecs-as.html + * + * @internal + */ +export interface EcsAutonomousSystem { + number?: number; + organization?: { name: string }; +} diff --git a/packages/kbn-logging/src/ecs/base.ts b/packages/kbn-logging/src/ecs/base.ts new file mode 100644 index 0000000000000..cf12cf0ea6e53 --- /dev/null +++ b/packages/kbn-logging/src/ecs/base.ts @@ -0,0 +1,19 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. + */ + +/** + * https://www.elastic.co/guide/en/ecs/1.9/ecs-base.html + * + * @internal + */ +export interface EcsBase { + ['@timestamp']: string; + labels?: Record; + message?: string; + tags?: string[]; +} diff --git a/packages/kbn-logging/src/ecs/client.ts b/packages/kbn-logging/src/ecs/client.ts new file mode 100644 index 0000000000000..ebee7826104a5 --- /dev/null +++ b/packages/kbn-logging/src/ecs/client.ts @@ -0,0 +1,36 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. + */ + +import { EcsAutonomousSystem } from './autonomous_system'; +import { EcsGeo } from './geo'; +import { EcsNestedUser } from './user'; + +interface NestedFields { + as?: EcsAutonomousSystem; + geo?: EcsGeo; + user?: EcsNestedUser; +} + +/** + * https://www.elastic.co/guide/en/ecs/1.9/ecs-client.html + * + * @internal + */ +export interface EcsClient extends NestedFields { + address?: string; + bytes?: number; + domain?: string; + ip?: string; + mac?: string; + nat?: { ip?: string; port?: number }; + packets?: number; + port?: number; + registered_domain?: string; + subdomain?: string; + top_level_domain?: string; +} diff --git a/packages/kbn-logging/src/ecs/cloud.ts b/packages/kbn-logging/src/ecs/cloud.ts new file mode 100644 index 0000000000000..8ef15d40f5529 --- /dev/null +++ b/packages/kbn-logging/src/ecs/cloud.ts @@ -0,0 +1,23 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. + */ + +/** + * https://www.elastic.co/guide/en/ecs/1.9/ecs-cloud.html + * + * @internal + */ +export interface EcsCloud { + account?: { id?: string; name?: string }; + availability_zone?: string; + instance?: { id?: string; name?: string }; + machine?: { type: string }; + project?: { id?: string; name?: string }; + provider?: string; + region?: string; + service?: { name: string }; +} diff --git a/packages/kbn-logging/src/ecs/code_signature.ts b/packages/kbn-logging/src/ecs/code_signature.ts new file mode 100644 index 0000000000000..277c3901a4f8b --- /dev/null +++ b/packages/kbn-logging/src/ecs/code_signature.ts @@ -0,0 +1,22 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. + */ + +/** + * https://www.elastic.co/guide/en/ecs/1.9/ecs-code_signature.html + * + * @internal + */ +export interface EcsCodeSignature { + exists?: boolean; + signing_id?: string; + status?: string; + subject_name?: string; + team_id?: string; + trusted?: boolean; + valid?: boolean; +} diff --git a/packages/kbn-logging/src/ecs/container.ts b/packages/kbn-logging/src/ecs/container.ts new file mode 100644 index 0000000000000..6c5c85e7107e3 --- /dev/null +++ b/packages/kbn-logging/src/ecs/container.ts @@ -0,0 +1,20 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. + */ + +/** + * https://www.elastic.co/guide/en/ecs/1.9/ecs-container.html + * + * @internal + */ +export interface EcsContainer { + id?: string; + image?: { name?: string; tag?: string[] }; + labels?: Record; + name?: string; + runtime?: string; +} diff --git a/packages/kbn-logging/src/ecs/destination.ts b/packages/kbn-logging/src/ecs/destination.ts new file mode 100644 index 0000000000000..6d2dbc8f431c9 --- /dev/null +++ b/packages/kbn-logging/src/ecs/destination.ts @@ -0,0 +1,36 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. + */ + +import { EcsAutonomousSystem } from './autonomous_system'; +import { EcsGeo } from './geo'; +import { EcsNestedUser } from './user'; + +interface NestedFields { + as?: EcsAutonomousSystem; + geo?: EcsGeo; + user?: EcsNestedUser; +} + +/** + * https://www.elastic.co/guide/en/ecs/1.9/ecs-destination.html + * + * @internal + */ +export interface EcsDestination extends NestedFields { + address?: string; + bytes?: number; + domain?: string; + ip?: string; + mac?: string; + nat?: { ip?: string; port?: number }; + packets?: number; + port?: number; + registered_domain?: string; + subdomain?: string; + top_level_domain?: string; +} diff --git a/packages/kbn-logging/src/ecs/dll.ts b/packages/kbn-logging/src/ecs/dll.ts new file mode 100644 index 0000000000000..d9ffa68b3f1a5 --- /dev/null +++ b/packages/kbn-logging/src/ecs/dll.ts @@ -0,0 +1,27 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. + */ + +import { EcsCodeSignature } from './code_signature'; +import { EcsHash } from './hash'; +import { EcsPe } from './pe'; + +interface NestedFields { + code_signature?: EcsCodeSignature; + hash?: EcsHash; + pe?: EcsPe; +} + +/** + * https://www.elastic.co/guide/en/ecs/1.9/ecs-dll.html + * + * @internal + */ +export interface EcsDll extends NestedFields { + name?: string; + path?: string; +} diff --git a/packages/kbn-logging/src/ecs/dns.ts b/packages/kbn-logging/src/ecs/dns.ts new file mode 100644 index 0000000000000..c7a0e7983376c --- /dev/null +++ b/packages/kbn-logging/src/ecs/dns.ts @@ -0,0 +1,40 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. + */ + +/** + * https://www.elastic.co/guide/en/ecs/1.9/ecs-dns.html + * + * @internal + */ +export interface EcsDns { + answers?: Answer[]; + header_flags?: string[]; + id?: number; + op_code?: string; + question?: Question; + resolved_ip?: string[]; + response_code?: string; + type?: string; +} + +interface Answer { + data: string; + class?: string; + name?: string; + ttl?: number; + type?: string; +} + +interface Question { + class?: string; + name?: string; + registered_domain?: string; + subdomain?: string; + top_level_domain?: string; + type?: string; +} diff --git a/packages/kbn-logging/src/ecs/error.ts b/packages/kbn-logging/src/ecs/error.ts new file mode 100644 index 0000000000000..aee010748ddf2 --- /dev/null +++ b/packages/kbn-logging/src/ecs/error.ts @@ -0,0 +1,20 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. + */ + +/** + * https://www.elastic.co/guide/en/ecs/1.9/ecs-error.html + * + * @internal + */ +export interface EcsError { + code?: string; + id?: string; + message?: string; + stack_trace?: string; + type?: string; +} diff --git a/packages/kbn-logging/src/ecs/event.ts b/packages/kbn-logging/src/ecs/event.ts new file mode 100644 index 0000000000000..bf711410a9dd7 --- /dev/null +++ b/packages/kbn-logging/src/ecs/event.ts @@ -0,0 +1,91 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. + */ + +/** + * https://www.elastic.co/guide/en/ecs/1.9/ecs-event.html + * + * @internal + */ +export interface EcsEvent { + action?: string; + category?: EcsEventCategory[]; + code?: string; + created?: string; + dataset?: string; + duration?: number; + end?: string; + hash?: string; + id?: string; + ingested?: string; + kind?: EcsEventKind; + module?: string; + original?: string; + outcome?: EcsEventOutcome; + provider?: string; + reason?: string; + reference?: string; + risk_score?: number; + risk_score_norm?: number; + sequence?: number; + severity?: number; + start?: string; + timezone?: string; + type?: EcsEventType[]; + url?: string; +} + +/** + * @public + */ +export type EcsEventCategory = + | 'authentication' + | 'configuration' + | 'database' + | 'driver' + | 'file' + | 'host' + | 'iam' + | 'intrusion_detection' + | 'malware' + | 'network' + | 'package' + | 'process' + | 'registry' + | 'session' + | 'web'; + +/** + * @public + */ +export type EcsEventKind = 'alert' | 'event' | 'metric' | 'state' | 'pipeline_error' | 'signal'; + +/** + * @public + */ +export type EcsEventOutcome = 'failure' | 'success' | 'unknown'; + +/** + * @public + */ +export type EcsEventType = + | 'access' + | 'admin' + | 'allowed' + | 'change' + | 'connection' + | 'creation' + | 'deletion' + | 'denied' + | 'end' + | 'error' + | 'group' + | 'info' + | 'installation' + | 'protocol' + | 'start' + | 'user'; diff --git a/packages/kbn-logging/src/ecs/file.ts b/packages/kbn-logging/src/ecs/file.ts new file mode 100644 index 0000000000000..c09121607e0a4 --- /dev/null +++ b/packages/kbn-logging/src/ecs/file.ts @@ -0,0 +1,52 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. + */ + +import { EcsCodeSignature } from './code_signature'; +import { EcsHash } from './hash'; +import { EcsPe } from './pe'; +import { EcsX509 } from './x509'; + +interface NestedFields { + code_signature?: EcsCodeSignature; + hash?: EcsHash; + pe?: EcsPe; + x509?: EcsX509; +} + +/** + * https://www.elastic.co/guide/en/ecs/1.9/ecs-file.html + * + * @internal + */ +export interface EcsFile extends NestedFields { + accessed?: string; + attributes?: string[]; + created?: string; + ctime?: string; + device?: string; + directory?: string; + drive_letter?: string; + extension?: string; + gid?: string; + group?: string; + inode?: string; + // Technically this is a known list, but it's massive, so we'll just accept a string for now :) + // https://www.iana.org/assignments/media-types/media-types.xhtml + mime_type?: string; + mode?: string; + mtime?: string; + name?: string; + owner?: string; + path?: string; + 'path.text'?: string; + size?: number; + target_path?: string; + 'target_path.text'?: string; + type?: string; + uid?: string; +} diff --git a/packages/kbn-logging/src/ecs/geo.ts b/packages/kbn-logging/src/ecs/geo.ts new file mode 100644 index 0000000000000..85d45ca803aee --- /dev/null +++ b/packages/kbn-logging/src/ecs/geo.ts @@ -0,0 +1,31 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. + */ + +/** + * https://www.elastic.co/guide/en/ecs/1.9/ecs-geo.html + * + * @internal + */ +export interface EcsGeo { + city_name?: string; + continent_code?: string; + continent_name?: string; + country_iso_code?: string; + country_name?: string; + location?: GeoPoint; + name?: string; + postal_code?: string; + region_iso_code?: string; + region_name?: string; + timezone?: string; +} + +interface GeoPoint { + lat: number; + lon: number; +} diff --git a/packages/kbn-logging/src/ecs/group.ts b/packages/kbn-logging/src/ecs/group.ts new file mode 100644 index 0000000000000..e1bc339964fc0 --- /dev/null +++ b/packages/kbn-logging/src/ecs/group.ts @@ -0,0 +1,18 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. + */ + +/** + * https://www.elastic.co/guide/en/ecs/1.9/ecs-group.html + * + * @internal + */ +export interface EcsGroup { + domain?: string; + id?: string; + name?: string; +} diff --git a/packages/kbn-logging/src/ecs/hash.ts b/packages/kbn-logging/src/ecs/hash.ts new file mode 100644 index 0000000000000..2ecd49f1ca092 --- /dev/null +++ b/packages/kbn-logging/src/ecs/hash.ts @@ -0,0 +1,20 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. + */ + +/** + * https://www.elastic.co/guide/en/ecs/1.9/ecs-hash.html + * + * @internal + */ +export interface EcsHash { + md5?: string; + sha1?: string; + sha256?: string; + sha512?: string; + ssdeep?: string; +} diff --git a/packages/kbn-logging/src/ecs/host.ts b/packages/kbn-logging/src/ecs/host.ts new file mode 100644 index 0000000000000..085db30e13e7e --- /dev/null +++ b/packages/kbn-logging/src/ecs/host.ts @@ -0,0 +1,48 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. + */ + +import { EcsGeo } from './geo'; +import { EcsOs } from './os'; +import { EcsNestedUser } from './user'; + +interface NestedFields { + geo?: EcsGeo; + os?: EcsOs; + /** @deprecated */ + user?: EcsNestedUser; +} + +/** + * https://www.elastic.co/guide/en/ecs/1.9/ecs-host.html + * + * @internal + */ +export interface EcsHost extends NestedFields { + architecture?: string; + cpu?: { usage: number }; + disk?: Disk; + domain?: string; + hostname?: string; + id?: string; + ip?: string[]; + mac?: string[]; + name?: string; + network?: Network; + type?: string; + uptime?: number; +} + +interface Disk { + read?: { bytes: number }; + write?: { bytes: number }; +} + +interface Network { + egress?: { bytes?: number; packets?: number }; + ingress?: { bytes?: number; packets?: number }; +} diff --git a/packages/kbn-logging/src/ecs/http.ts b/packages/kbn-logging/src/ecs/http.ts new file mode 100644 index 0000000000000..c734c93318f5c --- /dev/null +++ b/packages/kbn-logging/src/ecs/http.ts @@ -0,0 +1,36 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. + */ + +/** + * https://www.elastic.co/guide/en/ecs/1.9/ecs-http.html + * + * @internal + */ +export interface EcsHttp { + request?: Request; + response?: Response; + version?: string; +} + +interface Request { + body?: { bytes?: number; content?: string }; + bytes?: number; + id?: string; + // We can't provide predefined values here because ECS requires preserving the + // original casing for anomaly detection use cases. + method?: string; + mime_type?: string; + referrer?: string; +} + +interface Response { + body?: { bytes?: number; content?: string }; + bytes?: number; + mime_type?: string; + status_code?: number; +} diff --git a/packages/kbn-logging/src/ecs/index.ts b/packages/kbn-logging/src/ecs/index.ts new file mode 100644 index 0000000000000..30da3baa43b72 --- /dev/null +++ b/packages/kbn-logging/src/ecs/index.ts @@ -0,0 +1,97 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. + */ + +import { EcsBase } from './base'; + +import { EcsAgent } from './agent'; +import { EcsAutonomousSystem } from './autonomous_system'; +import { EcsClient } from './client'; +import { EcsCloud } from './cloud'; +import { EcsContainer } from './container'; +import { EcsDestination } from './destination'; +import { EcsDns } from './dns'; +import { EcsError } from './error'; +import { EcsEvent } from './event'; +import { EcsFile } from './file'; +import { EcsGroup } from './group'; +import { EcsHost } from './host'; +import { EcsHttp } from './http'; +import { EcsLog } from './log'; +import { EcsNetwork } from './network'; +import { EcsObserver } from './observer'; +import { EcsOrganization } from './organization'; +import { EcsPackage } from './package'; +import { EcsProcess } from './process'; +import { EcsRegistry } from './registry'; +import { EcsRelated } from './related'; +import { EcsRule } from './rule'; +import { EcsServer } from './server'; +import { EcsService } from './service'; +import { EcsSource } from './source'; +import { EcsThreat } from './threat'; +import { EcsTls } from './tls'; +import { EcsTracing } from './tracing'; +import { EcsUrl } from './url'; +import { EcsUser } from './user'; +import { EcsUserAgent } from './user_agent'; +import { EcsVulnerability } from './vulnerability'; + +export { EcsEventCategory, EcsEventKind, EcsEventOutcome, EcsEventType } from './event'; + +interface EcsField { + /** + * These typings were written as of ECS 1.9.0. + * Don't change this value without checking the rest + * of the types to conform to that ECS version. + * + * https://www.elastic.co/guide/en/ecs/1.9/index.html + */ + version: '1.9.0'; +} + +/** + * Represents the full ECS schema. + * + * @public + */ +export type Ecs = EcsBase & + EcsTracing & { + ecs: EcsField; + + agent?: EcsAgent; + as?: EcsAutonomousSystem; + client?: EcsClient; + cloud?: EcsCloud; + container?: EcsContainer; + destination?: EcsDestination; + dns?: EcsDns; + error?: EcsError; + event?: EcsEvent; + file?: EcsFile; + group?: EcsGroup; + host?: EcsHost; + http?: EcsHttp; + log?: EcsLog; + network?: EcsNetwork; + observer?: EcsObserver; + organization?: EcsOrganization; + package?: EcsPackage; + process?: EcsProcess; + registry?: EcsRegistry; + related?: EcsRelated; + rule?: EcsRule; + server?: EcsServer; + service?: EcsService; + source?: EcsSource; + threat?: EcsThreat; + tls?: EcsTls; + url?: EcsUrl; + user?: EcsUser; + user_agent?: EcsUserAgent; + vulnerability?: EcsVulnerability; + }; diff --git a/packages/kbn-logging/src/ecs/interface.ts b/packages/kbn-logging/src/ecs/interface.ts new file mode 100644 index 0000000000000..49b33e8338184 --- /dev/null +++ b/packages/kbn-logging/src/ecs/interface.ts @@ -0,0 +1,18 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. + */ + +/** + * https://www.elastic.co/guide/en/ecs/1.9/ecs-interface.html + * + * @internal + */ +export interface EcsInterface { + alias?: string; + id?: string; + name?: string; +} diff --git a/packages/kbn-logging/src/ecs/log.ts b/packages/kbn-logging/src/ecs/log.ts new file mode 100644 index 0000000000000..8bc2e4982e96c --- /dev/null +++ b/packages/kbn-logging/src/ecs/log.ts @@ -0,0 +1,32 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. + */ + +/** + * https://www.elastic.co/guide/en/ecs/1.9/ecs-log.html + * + * @internal + */ +export interface EcsLog { + file?: { path: string }; + level?: string; + logger?: string; + origin?: Origin; + original?: string; + syslog?: Syslog; +} + +interface Origin { + file?: { line?: number; name?: string }; + function?: string; +} + +interface Syslog { + facility?: { code?: number; name?: string }; + priority?: number; + severity?: { code?: number; name?: string }; +} diff --git a/packages/kbn-logging/src/ecs/network.ts b/packages/kbn-logging/src/ecs/network.ts new file mode 100644 index 0000000000000..912427b6cdb7e --- /dev/null +++ b/packages/kbn-logging/src/ecs/network.ts @@ -0,0 +1,33 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. + */ + +import { EcsVlan } from './vlan'; + +interface NestedFields { + inner?: { vlan?: EcsVlan }; + vlan?: EcsVlan; +} + +/** + * https://www.elastic.co/guide/en/ecs/1.9/ecs-network.html + * + * @internal + */ +export interface EcsNetwork extends NestedFields { + application?: string; + bytes?: number; + community_id?: string; + direction?: string; + forwarded_ip?: string; + iana_number?: string; + name?: string; + packets?: number; + protocol?: string; + transport?: string; + type?: string; +} diff --git a/packages/kbn-logging/src/ecs/observer.ts b/packages/kbn-logging/src/ecs/observer.ts new file mode 100644 index 0000000000000..be2636d15dcdf --- /dev/null +++ b/packages/kbn-logging/src/ecs/observer.ts @@ -0,0 +1,56 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. + */ + +import { EcsGeo } from './geo'; +import { EcsInterface } from './interface'; +import { EcsOs } from './os'; +import { EcsVlan } from './vlan'; + +interface NestedFields { + egress?: NestedEgressFields; + geo?: EcsGeo; + ingress?: NestedIngressFields; + os?: EcsOs; +} + +interface NestedEgressFields { + interface?: EcsInterface; + vlan?: EcsVlan; +} + +interface NestedIngressFields { + interface?: EcsInterface; + vlan?: EcsVlan; +} + +/** + * https://www.elastic.co/guide/en/ecs/1.9/ecs-observer.html + * + * @internal + */ +export interface EcsObserver extends NestedFields { + egress?: Egress; + hostname?: string; + ingress?: Ingress; + ip?: string[]; + mac?: string[]; + name?: string; + product?: string; + serial_number?: string; + type?: string; + vendor?: string; + version?: string; +} + +interface Egress extends NestedEgressFields { + zone?: string; +} + +interface Ingress extends NestedIngressFields { + zone?: string; +} diff --git a/packages/kbn-logging/src/ecs/organization.ts b/packages/kbn-logging/src/ecs/organization.ts new file mode 100644 index 0000000000000..370e6b2646a2f --- /dev/null +++ b/packages/kbn-logging/src/ecs/organization.ts @@ -0,0 +1,17 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. + */ + +/** + * https://www.elastic.co/guide/en/ecs/1.9/ecs-organization.html + * + * @internal + */ +export interface EcsOrganization { + id?: string; + name?: string; +} diff --git a/packages/kbn-docs-utils/src/release_notes/formats/index.ts b/packages/kbn-logging/src/ecs/os.ts similarity index 60% rename from packages/kbn-docs-utils/src/release_notes/formats/index.ts rename to packages/kbn-logging/src/ecs/os.ts index 2019dce53f537..342eb14264fd3 100644 --- a/packages/kbn-docs-utils/src/release_notes/formats/index.ts +++ b/packages/kbn-logging/src/ecs/os.ts @@ -6,9 +6,17 @@ * Side Public License, v 1. */ -import { ArrayItem } from '../lib'; -import { AsciidocFormat } from './asciidoc'; -import { CsvFormat } from './csv'; - -export const FORMATS = [CsvFormat, AsciidocFormat] as const; -export type SomeFormat = ArrayItem; +/** + * https://www.elastic.co/guide/en/ecs/1.9/ecs-os.html + * + * @internal + */ +export interface EcsOs { + family?: string; + full?: string; + kernel?: string; + name?: string; + platform?: string; + type?: string; + version?: string; +} diff --git a/packages/kbn-logging/src/ecs/package.ts b/packages/kbn-logging/src/ecs/package.ts new file mode 100644 index 0000000000000..10528066f3f29 --- /dev/null +++ b/packages/kbn-logging/src/ecs/package.ts @@ -0,0 +1,28 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. + */ + +/** + * https://www.elastic.co/guide/en/ecs/1.9/ecs-package.html + * + * @internal + */ +export interface EcsPackage { + architecture?: string; + build_version?: string; + checksum?: string; + description?: string; + install_scope?: string; + installed?: string; + license?: string; + name?: string; + path?: string; + reference?: string; + size?: number; + type?: string; + version?: string; +} diff --git a/packages/kbn-logging/src/ecs/pe.ts b/packages/kbn-logging/src/ecs/pe.ts new file mode 100644 index 0000000000000..bd53b7048a50d --- /dev/null +++ b/packages/kbn-logging/src/ecs/pe.ts @@ -0,0 +1,22 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. + */ + +/** + * https://www.elastic.co/guide/en/ecs/1.9/ecs-pe.html + * + * @internal + */ +export interface EcsPe { + architecture?: string; + company?: string; + description?: string; + file_version?: string; + imphash?: string; + original_file_name?: string; + product?: string; +} diff --git a/packages/kbn-logging/src/ecs/process.ts b/packages/kbn-logging/src/ecs/process.ts new file mode 100644 index 0000000000000..9a034c30fd531 --- /dev/null +++ b/packages/kbn-logging/src/ecs/process.ts @@ -0,0 +1,41 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. + */ + +import { EcsCodeSignature } from './code_signature'; +import { EcsHash } from './hash'; +import { EcsPe } from './pe'; + +interface NestedFields { + code_signature?: EcsCodeSignature; + hash?: EcsHash; + parent?: EcsProcess; + pe?: EcsPe; +} + +/** + * https://www.elastic.co/guide/en/ecs/1.9/ecs-process.html + * + * @internal + */ +export interface EcsProcess extends NestedFields { + args?: string[]; + args_count?: number; + command_line?: string; + entity_id?: string; + executable?: string; + exit_code?: number; + name?: string; + pgid?: number; + pid?: number; + ppid?: number; + start?: string; + thread?: { id?: number; name?: string }; + title?: string; + uptime?: number; + working_directory?: string; +} diff --git a/packages/kbn-logging/src/ecs/registry.ts b/packages/kbn-logging/src/ecs/registry.ts new file mode 100644 index 0000000000000..ba7ef699e2cdb --- /dev/null +++ b/packages/kbn-logging/src/ecs/registry.ts @@ -0,0 +1,26 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. + */ + +/** + * https://www.elastic.co/guide/en/ecs/1.9/ecs-registry.html + * + * @internal + */ +export interface EcsRegistry { + data?: Data; + hive?: string; + key?: string; + path?: string; + value?: string; +} + +interface Data { + bytes?: string; + strings?: string[]; + type?: string; +} diff --git a/packages/kbn-logging/src/ecs/related.ts b/packages/kbn-logging/src/ecs/related.ts new file mode 100644 index 0000000000000..33c3ff50540ce --- /dev/null +++ b/packages/kbn-logging/src/ecs/related.ts @@ -0,0 +1,19 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. + */ + +/** + * https://www.elastic.co/guide/en/ecs/1.9/ecs-related.html + * + * @internal + */ +export interface EcsRelated { + hash?: string[]; + hosts?: string[]; + ip?: string[]; + user?: string[]; +} diff --git a/packages/kbn-logging/src/ecs/rule.ts b/packages/kbn-logging/src/ecs/rule.ts new file mode 100644 index 0000000000000..c6bf1ce96552a --- /dev/null +++ b/packages/kbn-logging/src/ecs/rule.ts @@ -0,0 +1,25 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. + */ + +/** + * https://www.elastic.co/guide/en/ecs/1.9/ecs-rule.html + * + * @internal + */ +export interface EcsRule { + author?: string[]; + category?: string; + description?: string; + id?: string; + license?: string; + name?: string; + reference?: string; + ruleset?: string; + uuid?: string; + version?: string; +} diff --git a/packages/kbn-logging/src/ecs/server.ts b/packages/kbn-logging/src/ecs/server.ts new file mode 100644 index 0000000000000..9b2a9b1a11b42 --- /dev/null +++ b/packages/kbn-logging/src/ecs/server.ts @@ -0,0 +1,36 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. + */ + +import { EcsAutonomousSystem } from './autonomous_system'; +import { EcsGeo } from './geo'; +import { EcsNestedUser } from './user'; + +interface NestedFields { + as?: EcsAutonomousSystem; + geo?: EcsGeo; + user?: EcsNestedUser; +} + +/** + * https://www.elastic.co/guide/en/ecs/1.9/ecs-server.html + * + * @internal + */ +export interface EcsServer extends NestedFields { + address?: string; + bytes?: number; + domain?: string; + ip?: string; + mac?: string; + nat?: { ip?: string; port?: number }; + packets?: number; + port?: number; + registered_domain?: string; + subdomain?: string; + top_level_domain?: string; +} diff --git a/packages/kbn-logging/src/ecs/service.ts b/packages/kbn-logging/src/ecs/service.ts new file mode 100644 index 0000000000000..4cd79e928c076 --- /dev/null +++ b/packages/kbn-logging/src/ecs/service.ts @@ -0,0 +1,22 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. + */ + +/** + * https://www.elastic.co/guide/en/ecs/1.9/ecs-service.html + * + * @internal + */ +export interface EcsService { + ephemeral_id?: string; + id?: string; + name?: string; + node?: { name: string }; + state?: string; + type?: string; + version?: string; +} diff --git a/packages/kbn-logging/src/ecs/source.ts b/packages/kbn-logging/src/ecs/source.ts new file mode 100644 index 0000000000000..9ec7e2521d0b9 --- /dev/null +++ b/packages/kbn-logging/src/ecs/source.ts @@ -0,0 +1,36 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. + */ + +import { EcsAutonomousSystem } from './autonomous_system'; +import { EcsGeo } from './geo'; +import { EcsNestedUser } from './user'; + +interface NestedFields { + as?: EcsAutonomousSystem; + geo?: EcsGeo; + user?: EcsNestedUser; +} + +/** + * https://www.elastic.co/guide/en/ecs/1.9/ecs-source.html + * + * @internal + */ +export interface EcsSource extends NestedFields { + address?: string; + bytes?: number; + domain?: string; + ip?: string; + mac?: string; + nat?: { ip?: string; port?: number }; + packets?: number; + port?: number; + registered_domain?: string; + subdomain?: string; + top_level_domain?: string; +} diff --git a/packages/kbn-logging/src/ecs/threat.ts b/packages/kbn-logging/src/ecs/threat.ts new file mode 100644 index 0000000000000..ac6033949fccd --- /dev/null +++ b/packages/kbn-logging/src/ecs/threat.ts @@ -0,0 +1,31 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. + */ + +/** + * https://www.elastic.co/guide/en/ecs/1.9/ecs-threat.html + * + * @internal + */ +export interface EcsThreat { + framework?: string; + tactic?: Tactic; + technique?: Technique; +} + +interface Tactic { + id?: string[]; + name?: string[]; + reference?: string[]; +} + +interface Technique { + id?: string[]; + name?: string[]; + reference?: string[]; + subtechnique?: Technique; +} diff --git a/packages/kbn-logging/src/ecs/tls.ts b/packages/kbn-logging/src/ecs/tls.ts new file mode 100644 index 0000000000000..b04d03d650908 --- /dev/null +++ b/packages/kbn-logging/src/ecs/tls.ts @@ -0,0 +1,64 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. + */ + +import { EcsX509 } from './x509'; + +interface NestedClientFields { + x509?: EcsX509; +} + +interface NestedServerFields { + x509?: EcsX509; +} + +/** + * https://www.elastic.co/guide/en/ecs/1.9/ecs-tls.html + * + * @internal + */ +export interface EcsTls { + cipher?: string; + client?: Client; + curve?: string; + established?: boolean; + next_protocol?: string; + resumed?: boolean; + server?: Server; + version?: string; + version_protocol?: string; +} + +interface Client extends NestedClientFields { + certificate?: string; + certificate_chain?: string[]; + hash?: Hash; + issuer?: string; + ja3?: string; + not_after?: string; + not_before?: string; + server_name?: string; + subject?: string; + supported_ciphers?: string[]; +} + +interface Server extends NestedServerFields { + certificate?: string; + certificate_chain?: string[]; + hash?: Hash; + issuer?: string; + ja3s?: string; + not_after?: string; + not_before?: string; + subject?: string; +} + +interface Hash { + md5?: string; + sha1?: string; + sha256?: string; +} diff --git a/packages/kbn-logging/src/ecs/tracing.ts b/packages/kbn-logging/src/ecs/tracing.ts new file mode 100644 index 0000000000000..1abbbd4b4c8a2 --- /dev/null +++ b/packages/kbn-logging/src/ecs/tracing.ts @@ -0,0 +1,23 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. + */ + +/** + * Unlike other ECS field sets, tracing fields are not nested under the field + * set name (i.e. `trace.id` is valid, `tracing.trace.id` is not). So, like + * the base fields, we will need to do an intersection with these types at + * the root level. + * + * https://www.elastic.co/guide/en/ecs/1.9/ecs-tracing.html + * + * @internal + */ +export interface EcsTracing { + span?: { id?: string }; + trace?: { id?: string }; + transaction?: { id?: string }; +} diff --git a/packages/kbn-logging/src/ecs/url.ts b/packages/kbn-logging/src/ecs/url.ts new file mode 100644 index 0000000000000..5985b28a4f6c3 --- /dev/null +++ b/packages/kbn-logging/src/ecs/url.ts @@ -0,0 +1,29 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. + */ + +/** + * https://www.elastic.co/guide/en/ecs/1.9/ecs-url.html + * + * @internal + */ +export interface EcsUrl { + domain?: string; + extension?: string; + fragment?: string; + full?: string; + original?: string; + password?: string; + path?: string; + port?: number; + query?: string; + registered_domain?: string; + scheme?: string; + subdomain?: string; + top_level_domain?: string; + username?: string; +} diff --git a/packages/kbn-logging/src/ecs/user.ts b/packages/kbn-logging/src/ecs/user.ts new file mode 100644 index 0000000000000..3ab0c946b49b7 --- /dev/null +++ b/packages/kbn-logging/src/ecs/user.ts @@ -0,0 +1,48 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. + */ + +import { EcsGroup } from './group'; + +interface NestedFields { + group?: EcsGroup; +} + +/** + * `User` is unlike most other fields which can be reused in multiple places + * in that ECS places restrictions on which individual properties can be reused; + * + * Specifically, `changes`, `effective`, and `target` may be used if `user` is + * placed at the root level, but not if it is nested inside another field like + * `destination`. A more detailed explanation of these nuances can be found at: + * + * https://www.elastic.co/guide/en/ecs/1.9/ecs-user-usage.html + * + * As a result, we need to export a separate `NestedUser` type to import into + * other interfaces internally. This contains the reusable subset of properties + * from `User`. + * + * @internal + */ +export interface EcsNestedUser extends NestedFields { + domain?: string; + email?: string; + full_name?: string; + hash?: string; + id?: string; + name?: string; + roles?: string[]; +} + +/** + * @internal + */ +export interface EcsUser extends EcsNestedUser { + changes?: EcsNestedUser; + effective?: EcsNestedUser; + target?: EcsNestedUser; +} diff --git a/packages/kbn-logging/src/ecs/user_agent.ts b/packages/kbn-logging/src/ecs/user_agent.ts new file mode 100644 index 0000000000000..f77b3ba9e1f0f --- /dev/null +++ b/packages/kbn-logging/src/ecs/user_agent.ts @@ -0,0 +1,25 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. + */ + +import { EcsOs } from './os'; + +interface NestedFields { + os?: EcsOs; +} + +/** + * https://www.elastic.co/guide/en/ecs/1.9/ecs-user_agent.html + * + * @internal + */ +export interface EcsUserAgent extends NestedFields { + device?: { name: string }; + name?: string; + original?: string; + version?: string; +} diff --git a/packages/kbn-logging/src/ecs/vlan.ts b/packages/kbn-logging/src/ecs/vlan.ts new file mode 100644 index 0000000000000..646f8ee17fd03 --- /dev/null +++ b/packages/kbn-logging/src/ecs/vlan.ts @@ -0,0 +1,17 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. + */ + +/** + * https://www.elastic.co/guide/en/ecs/1.9/ecs-vlan.html + * + * @internal + */ +export interface EcsVlan { + id?: string; + name?: string; +} diff --git a/packages/kbn-logging/src/ecs/vulnerability.ts b/packages/kbn-logging/src/ecs/vulnerability.ts new file mode 100644 index 0000000000000..2c26d557d2ba9 --- /dev/null +++ b/packages/kbn-logging/src/ecs/vulnerability.ts @@ -0,0 +1,32 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. + */ + +/** + * https://www.elastic.co/guide/en/ecs/1.9/ecs-vulnerability.html + * + * @internal + */ +export interface EcsVulnerability { + category?: string[]; + classification?: string; + description?: string; + enumeration?: string; + id?: string; + reference?: string; + report_id?: string; + scanner?: { vendor: string }; + score?: Score; + severity?: string; +} + +interface Score { + base?: number; + environmental?: number; + temporal?: number; + version?: string; +} diff --git a/packages/kbn-logging/src/ecs/x509.ts b/packages/kbn-logging/src/ecs/x509.ts new file mode 100644 index 0000000000000..35bc1b458579a --- /dev/null +++ b/packages/kbn-logging/src/ecs/x509.ts @@ -0,0 +1,47 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. + */ + +/** + * https://www.elastic.co/guide/en/ecs/1.9/ecs-x509.html + * + * @internal + */ +export interface EcsX509 { + alternative_names?: string[]; + issuer?: Issuer; + not_after?: string; + not_before?: string; + public_key_algorithm?: string; + public_key_curve?: string; + public_key_exponent?: number; + public_key_size?: number; + serial_number?: string; + signature_algorithm?: string; + subject?: Subject; + version_number?: string; +} + +interface Issuer { + common_name?: string[]; + country?: string[]; + distinguished_name?: string; + locality?: string[]; + organization?: string[]; + organizational_unit?: string[]; + state_or_province?: string[]; +} + +interface Subject { + common_name?: string[]; + country?: string[]; + distinguished_name?: string; + locality?: string[]; + organization?: string[]; + organizational_unit?: string[]; + state_or_province?: string[]; +} diff --git a/packages/kbn-logging/src/index.ts b/packages/kbn-logging/src/index.ts index 048a95395e5c6..075e18f99afe3 100644 --- a/packages/kbn-logging/src/index.ts +++ b/packages/kbn-logging/src/index.ts @@ -8,7 +8,9 @@ export { LogLevel, LogLevelId } from './log_level'; export { LogRecord } from './log_record'; -export { Logger, LogMeta } from './logger'; +export { Logger } from './logger'; +export { LogMeta } from './log_meta'; export { LoggerFactory } from './logger_factory'; export { Layout } from './layout'; export { Appender, DisposableAppender } from './appenders'; +export { Ecs, EcsEventCategory, EcsEventKind, EcsEventOutcome, EcsEventType } from './ecs'; diff --git a/packages/kbn-logging/src/log_meta.ts b/packages/kbn-logging/src/log_meta.ts new file mode 100644 index 0000000000000..7822792c7fbeb --- /dev/null +++ b/packages/kbn-logging/src/log_meta.ts @@ -0,0 +1,87 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. + */ + +import { EcsBase } from './ecs/base'; + +import { EcsAgent } from './ecs/agent'; +import { EcsAutonomousSystem } from './ecs/autonomous_system'; +import { EcsClient } from './ecs/client'; +import { EcsCloud } from './ecs/cloud'; +import { EcsContainer } from './ecs/container'; +import { EcsDestination } from './ecs/destination'; +import { EcsDns } from './ecs/dns'; +import { EcsError } from './ecs/error'; +import { EcsEvent } from './ecs/event'; +import { EcsFile } from './ecs/file'; +import { EcsGroup } from './ecs/group'; +import { EcsHost } from './ecs/host'; +import { EcsHttp } from './ecs/http'; +import { EcsLog } from './ecs/log'; +import { EcsNetwork } from './ecs/network'; +import { EcsObserver } from './ecs/observer'; +import { EcsOrganization } from './ecs/organization'; +import { EcsPackage } from './ecs/package'; +import { EcsProcess } from './ecs/process'; +import { EcsRegistry } from './ecs/registry'; +import { EcsRelated } from './ecs/related'; +import { EcsRule } from './ecs/rule'; +import { EcsServer } from './ecs/server'; +import { EcsService } from './ecs/service'; +import { EcsSource } from './ecs/source'; +import { EcsThreat } from './ecs/threat'; +import { EcsTls } from './ecs/tls'; +import { EcsTracing } from './ecs/tracing'; +import { EcsUrl } from './ecs/url'; +import { EcsUser } from './ecs/user'; +import { EcsUserAgent } from './ecs/user_agent'; +import { EcsVulnerability } from './ecs/vulnerability'; + +/** + * Represents the ECS schema with the following reserved keys excluded: + * - `ecs` + * - `@timestamp` + * - `message` + * - `log.level` + * - `log.logger` + * + * @public + */ +export type LogMeta = Omit & + EcsTracing & { + agent?: EcsAgent; + as?: EcsAutonomousSystem; + client?: EcsClient; + cloud?: EcsCloud; + container?: EcsContainer; + destination?: EcsDestination; + dns?: EcsDns; + error?: EcsError; + event?: EcsEvent; + file?: EcsFile; + group?: EcsGroup; + host?: EcsHost; + http?: EcsHttp; + log?: Omit; + network?: EcsNetwork; + observer?: EcsObserver; + organization?: EcsOrganization; + package?: EcsPackage; + process?: EcsProcess; + registry?: EcsRegistry; + related?: EcsRelated; + rule?: EcsRule; + server?: EcsServer; + service?: EcsService; + source?: EcsSource; + threat?: EcsThreat; + tls?: EcsTls; + url?: EcsUrl; + user?: EcsUser; + user_agent?: EcsUserAgent; + vulnerability?: EcsVulnerability; + }; diff --git a/packages/kbn-logging/src/logger.ts b/packages/kbn-logging/src/logger.ts index dad4fb07c6cfa..fda3cf45b9d79 100644 --- a/packages/kbn-logging/src/logger.ts +++ b/packages/kbn-logging/src/logger.ts @@ -6,17 +6,9 @@ * Side Public License, v 1. */ +import { LogMeta } from './log_meta'; import { LogRecord } from './log_record'; -/** - * Contextual metadata - * - * @public - */ -export interface LogMeta { - [key: string]: any; -} - /** * Logger exposes all the necessary methods to log any type of information and * this is the interface used by the logging consumers including plugins. @@ -30,28 +22,28 @@ export interface Logger { * @param message - The log message * @param meta - */ - trace(message: string, meta?: LogMeta): void; + trace(message: string, meta?: Meta): void; /** * Log messages useful for debugging and interactive investigation * @param message - The log message * @param meta - */ - debug(message: string, meta?: LogMeta): void; + debug(message: string, meta?: Meta): void; /** * Logs messages related to general application flow * @param message - The log message * @param meta - */ - info(message: string, meta?: LogMeta): void; + info(message: string, meta?: Meta): void; /** * Logs abnormal or unexpected errors or messages * @param errorOrMessage - An Error object or message string to log * @param meta - */ - warn(errorOrMessage: string | Error, meta?: LogMeta): void; + warn(errorOrMessage: string | Error, meta?: Meta): void; /** * Logs abnormal or unexpected errors or messages that caused a failure in the application flow @@ -59,7 +51,7 @@ export interface Logger { * @param errorOrMessage - An Error object or message string to log * @param meta - */ - error(errorOrMessage: string | Error, meta?: LogMeta): void; + error(errorOrMessage: string | Error, meta?: Meta): void; /** * Logs abnormal or unexpected errors or messages that caused an unrecoverable failure @@ -67,7 +59,7 @@ export interface Logger { * @param errorOrMessage - An Error object or message string to log * @param meta - */ - fatal(errorOrMessage: string | Error, meta?: LogMeta): void; + fatal(errorOrMessage: string | Error, meta?: Meta): void; /** @internal */ log(record: LogRecord): void; diff --git a/packages/kbn-optimizer/limits.yml b/packages/kbn-optimizer/limits.yml index f42ca7451601b..1d19387494136 100644 --- a/packages/kbn-optimizer/limits.yml +++ b/packages/kbn-optimizer/limits.yml @@ -9,7 +9,7 @@ pageLoadAssetSize: charts: 195358 cloud: 21076 console: 46091 - core: 397521 + core: 413500 crossClusterReplication: 65408 dashboard: 374194 dashboardEnhanced: 65646 @@ -106,6 +106,7 @@ pageLoadAssetSize: indexPatternFieldEditor: 90489 osquery: 107090 fileUpload: 25664 + fileDataVisualizer: 27530 banners: 17946 mapsEms: 26072 timelines: 28613 diff --git a/packages/kbn-optimizer/package.json b/packages/kbn-optimizer/package.json index 3c14d98755a32..423bba0fd8c7a 100644 --- a/packages/kbn-optimizer/package.json +++ b/packages/kbn-optimizer/package.json @@ -13,7 +13,6 @@ "dependencies": { "@kbn/config": "link:../kbn-config", "@kbn/dev-utils": "link:../kbn-dev-utils", - "@kbn/std": "link:../kbn-std", "@kbn/ui-shared-deps": "link:../kbn-ui-shared-deps" } } \ No newline at end of file diff --git a/packages/kbn-pm/dist/index.js b/packages/kbn-pm/dist/index.js index e6cdd52686656..c0afb92b859cd 100644 --- a/packages/kbn-pm/dist/index.js +++ b/packages/kbn-pm/dist/index.js @@ -48512,7 +48512,13 @@ async function runBazel(bazelArgs, offline = false, runOpts = {}) { await runBazelCommandWithRunner('bazel', bazelArgs, offline, runOpts); } async function runIBazel(bazelArgs, offline = false, runOpts = {}) { - await runBazelCommandWithRunner('ibazel', bazelArgs, offline, runOpts); + const extendedEnv = _objectSpread({ + IBAZEL_USE_LEGACY_WATCHER: '0' + }, runOpts === null || runOpts === void 0 ? void 0 : runOpts.env); + + await runBazelCommandWithRunner('ibazel', bazelArgs, offline, _objectSpread(_objectSpread({}, runOpts), {}, { + env: extendedEnv + })); } /***/ }), @@ -59743,7 +59749,7 @@ const WatchBazelCommand = { // Note: --run_output=false arg will disable the iBazel notifications about gazelle and buildozer when running it // Can also be solved by adding a root `.bazel_fix_commands.json` but its not needed at the moment - await Object(_utils_bazel__WEBPACK_IMPORTED_MODULE_0__["runIBazel"])(['--run_output=false', 'build', '//packages:build'], runOffline); + await Object(_utils_bazel__WEBPACK_IMPORTED_MODULE_0__["runIBazel"])(['--run_output=false', 'build', '//packages:build', '--show_result=1'], runOffline); } }; diff --git a/packages/kbn-pm/src/commands/watch_bazel.ts b/packages/kbn-pm/src/commands/watch_bazel.ts index 1273562dd2511..6d57ce66854fd 100644 --- a/packages/kbn-pm/src/commands/watch_bazel.ts +++ b/packages/kbn-pm/src/commands/watch_bazel.ts @@ -20,6 +20,9 @@ export const WatchBazelCommand: ICommand = { // // Note: --run_output=false arg will disable the iBazel notifications about gazelle and buildozer when running it // Can also be solved by adding a root `.bazel_fix_commands.json` but its not needed at the moment - await runIBazel(['--run_output=false', 'build', '//packages:build'], runOffline); + await runIBazel( + ['--run_output=false', 'build', '//packages:build', '--show_result=1'], + runOffline + ); }, }; diff --git a/packages/kbn-pm/src/utils/bazel/run.ts b/packages/kbn-pm/src/utils/bazel/run.ts index 34718606db98e..7b20ea43982e6 100644 --- a/packages/kbn-pm/src/utils/bazel/run.ts +++ b/packages/kbn-pm/src/utils/bazel/run.ts @@ -71,5 +71,6 @@ export async function runIBazel( offline: boolean = false, runOpts: execa.Options = {} ) { - await runBazelCommandWithRunner('ibazel', bazelArgs, offline, runOpts); + const extendedEnv = { IBAZEL_USE_LEGACY_WATCHER: '0', ...runOpts?.env }; + await runBazelCommandWithRunner('ibazel', bazelArgs, offline, { ...runOpts, env: extendedEnv }); } diff --git a/packages/kbn-server-http-tools/package.json b/packages/kbn-server-http-tools/package.json index 24f8f8d67dfd7..5a1bb0d5b536a 100644 --- a/packages/kbn-server-http-tools/package.json +++ b/packages/kbn-server-http-tools/package.json @@ -11,8 +11,7 @@ "kbn:watch": "yarn build --watch" }, "dependencies": { - "@kbn/crypto": "link:../kbn-crypto", - "@kbn/std": "link:../kbn-std" + "@kbn/crypto": "link:../kbn-crypto" }, "devDependencies": { "@kbn/utility-types": "link:../kbn-utility-types" diff --git a/packages/kbn-server-http-tools/src/get_server_options.test.ts b/packages/kbn-server-http-tools/src/get_server_options.test.ts index fdcc749f4ae9a..4af9b34dfc5f9 100644 --- a/packages/kbn-server-http-tools/src/get_server_options.test.ts +++ b/packages/kbn-server-http-tools/src/get_server_options.test.ts @@ -6,6 +6,7 @@ * Side Public License, v 1. */ +import moment from 'moment'; import { ByteSizeValue } from '@kbn/config-schema'; import { getServerOptions } from './get_server_options'; import { IHttpConfig } from './types'; @@ -24,6 +25,7 @@ const createConfig = (parts: Partial): IHttpConfig => ({ port: 5601, socketTimeout: 120000, keepaliveTimeout: 120000, + shutdownTimeout: moment.duration(30, 'seconds'), maxPayload: ByteSizeValue.parse('1048576b'), ...parts, cors: { diff --git a/packages/kbn-server-http-tools/src/types.ts b/packages/kbn-server-http-tools/src/types.ts index 3cc117d542eee..9aec520fb3a31 100644 --- a/packages/kbn-server-http-tools/src/types.ts +++ b/packages/kbn-server-http-tools/src/types.ts @@ -7,6 +7,7 @@ */ import { ByteSizeValue } from '@kbn/config-schema'; +import type { Duration } from 'moment'; export interface IHttpConfig { host: string; @@ -16,6 +17,7 @@ export interface IHttpConfig { socketTimeout: number; cors: ICorsConfig; ssl: ISslConfig; + shutdownTimeout: Duration; } export interface ICorsConfig { diff --git a/packages/kbn-std/BUILD.bazel b/packages/kbn-std/BUILD.bazel new file mode 100644 index 0000000000000..82520be97df1f --- /dev/null +++ b/packages/kbn-std/BUILD.bazel @@ -0,0 +1,85 @@ +load("@npm//@bazel/typescript:index.bzl", "ts_config", "ts_project") +load("@build_bazel_rules_nodejs//:index.bzl", "js_library", "pkg_npm") + +PKG_BASE_NAME = "kbn-std" +PKG_REQUIRE_NAME = "@kbn/std" + +SOURCE_FILES = glob( + [ + "src/**/*.ts", + ], + exclude = ["**/*.test.*"], +) + +SRCS = SOURCE_FILES + +filegroup( + name = "srcs", + srcs = SRCS, +) + +NPM_MODULE_EXTRA_FILES = [ + "package.json", + "README.md" +] + +SRC_DEPS = [ + "//packages/kbn-utility-types", + "@npm//lodash", + "@npm//query-string", + "@npm//rxjs", + "@npm//tslib", +] + +TYPES_DEPS = [ + "@npm//@types/jest", + "@npm//@types/lodash", + "@npm//@types/node", +] + +DEPS = SRC_DEPS + TYPES_DEPS + +ts_config( + name = "tsconfig", + src = "tsconfig.json", + deps = [ + "//:tsconfig.base.json", + ], +) + +ts_project( + name = "tsc", + args = ['--pretty'], + srcs = SRCS, + deps = DEPS, + declaration = True, + declaration_map = True, + incremental = True, + out_dir = "target", + source_map = True, + root_dir = "src", + tsconfig = ":tsconfig", +) + +js_library( + name = PKG_BASE_NAME, + srcs = NPM_MODULE_EXTRA_FILES, + deps = [":tsc"] + DEPS, + package_name = PKG_REQUIRE_NAME, + visibility = ["//visibility:public"], +) + +pkg_npm( + name = "npm_module", + deps = [ + ":%s" % PKG_BASE_NAME, + ] +) + +filegroup( + name = "build", + srcs = [ + ":npm_module", + ], + visibility = ["//visibility:public"], +) diff --git a/packages/kbn-std/package.json b/packages/kbn-std/package.json index b914356d99249..d88422ec1aa81 100644 --- a/packages/kbn-std/package.json +++ b/packages/kbn-std/package.json @@ -4,12 +4,5 @@ "types": "./target/index.d.ts", "version": "1.0.0", "license": "SSPL-1.0 OR Elastic License 2.0", - "private": true, - "scripts": { - "build": "../../node_modules/.bin/tsc", - "kbn:bootstrap": "yarn build" - }, - "devDependencies": { - "@kbn/utility-types": "link:../kbn-utility-types" - } + "private": true } \ No newline at end of file diff --git a/packages/kbn-std/tsconfig.json b/packages/kbn-std/tsconfig.json index d2ed46dcad6f8..dec2d2df64086 100644 --- a/packages/kbn-std/tsconfig.json +++ b/packages/kbn-std/tsconfig.json @@ -1,12 +1,12 @@ { "extends": "../../tsconfig.base.json", "compilerOptions": { - "incremental": false, - "declarationDir": "./target", + "incremental": true, "outDir": "./target", "stripInternal": true, "declaration": true, "declarationMap": true, + "rootDir": "src", "sourceMap": true, "sourceRoot": "../../../../packages/kbn-std/src", "types": [ @@ -16,8 +16,5 @@ }, "include": [ "./src/**/*.ts" - ], - "exclude": [ - "**/__fixture__/**/*" ] } diff --git a/packages/kbn-test/src/kbn_client/kbn_client_import_export.ts b/packages/kbn-test/src/kbn_client/kbn_client_import_export.ts index 7f4d0160923bf..fe67fbb70fa3c 100644 --- a/packages/kbn-test/src/kbn_client/kbn_client_import_export.ts +++ b/packages/kbn-test/src/kbn_client/kbn_client_import_export.ts @@ -80,7 +80,14 @@ export class KbnClientImportExport { if (resp.data.success) { this.log.success('import success'); } else { - throw createFailError(`failed to import all saved objects: ${inspect(resp.data)}`); + throw createFailError( + `failed to import all saved objects: ${inspect(resp.data, { + compact: false, + depth: 99, + breakLength: 80, + sorted: true, + })}` + ); } } diff --git a/packages/kbn-utility-types/BUILD.bazel b/packages/kbn-utility-types/BUILD.bazel index e22ba38b24a48..1a02f94a88f4a 100644 --- a/packages/kbn-utility-types/BUILD.bazel +++ b/packages/kbn-utility-types/BUILD.bazel @@ -57,15 +57,14 @@ ts_project( js_library( name = PKG_BASE_NAME, - srcs = [], + srcs = NPM_MODULE_EXTRA_FILES, deps = [":tsc"] + DEPS, - package_name = PKG_REQUIRE_NAME, + package_name = "@kbn/utility-types", visibility = ["//visibility:public"], ) pkg_npm( name = "npm_module", - srcs = NPM_MODULE_EXTRA_FILES, deps = [ ":%s" % PKG_BASE_NAME, ] diff --git a/src/core/public/doc_links/doc_links_service.ts b/src/core/public/doc_links/doc_links_service.ts index 4220d3e490f63..0ecfc152197d3 100644 --- a/src/core/public/doc_links/doc_links_service.ts +++ b/src/core/public/doc_links/doc_links_service.ts @@ -21,12 +21,16 @@ export class DocLinksService { const DOC_LINK_VERSION = injectedMetadata.getKibanaBranch(); const ELASTIC_WEBSITE_URL = 'https://www.elastic.co/'; const ELASTICSEARCH_DOCS = `${ELASTIC_WEBSITE_URL}guide/en/elasticsearch/reference/${DOC_LINK_VERSION}/`; + const KIBANA_DOCS = `${ELASTIC_WEBSITE_URL}guide/en/kibana/${DOC_LINK_VERSION}/`; const PLUGIN_DOCS = `${ELASTIC_WEBSITE_URL}guide/en/elasticsearch/plugins/${DOC_LINK_VERSION}/`; return deepFreeze({ DOC_LINK_VERSION, ELASTIC_WEBSITE_URL, links: { + canvas: { + guide: `${KIBANA_DOCS}canvas.html`, + }, dashboard: { guide: `${ELASTIC_WEBSITE_URL}guide/en/kibana/${DOC_LINK_VERSION}/dashboard.html`, drilldowns: `${ELASTIC_WEBSITE_URL}guide/en/kibana/${DOC_LINK_VERSION}/drilldowns.html`, @@ -245,10 +249,10 @@ export class DocLinksService { guide: `${ELASTIC_WEBSITE_URL}guide/en/observability/${DOC_LINK_VERSION}/index.html`, }, alerting: { - guide: `${ELASTIC_WEBSITE_URL}guide/en/kibana/${DOC_LINK_VERSION}/managing-alerts-and-actions.html`, + guide: `${ELASTIC_WEBSITE_URL}guide/en/kibana/${DOC_LINK_VERSION}/alert-management.html`, actionTypes: `${ELASTIC_WEBSITE_URL}guide/en/kibana/${DOC_LINK_VERSION}/action-types.html`, emailAction: `${ELASTIC_WEBSITE_URL}guide/en/kibana/${DOC_LINK_VERSION}/email-action-type.html`, - emailActionConfig: `${ELASTIC_WEBSITE_URL}guide/en/kibana/${DOC_LINK_VERSION}/email-action-type.html#configuring-email`, + emailActionConfig: `${ELASTIC_WEBSITE_URL}guide/en/kibana/${DOC_LINK_VERSION}/email-action-type.html`, generalSettings: `${ELASTIC_WEBSITE_URL}guide/en/kibana/${DOC_LINK_VERSION}/alert-action-settings-kb.html#general-alert-action-settings`, indexAction: `${ELASTIC_WEBSITE_URL}guide/en/kibana/${DOC_LINK_VERSION}/index-action-type.html`, esQuery: `${ELASTIC_WEBSITE_URL}guide/en/kibana/${DOC_LINK_VERSION}/rule-type-es-query.html`, @@ -397,6 +401,9 @@ export interface DocLinksStart { readonly DOC_LINK_VERSION: string; readonly ELASTIC_WEBSITE_URL: string; readonly links: { + readonly canvas: { + readonly guide: string; + }; readonly dashboard: { readonly guide: string; readonly drilldowns: string; diff --git a/src/core/public/i18n/__snapshots__/i18n_service.test.tsx.snap b/src/core/public/i18n/__snapshots__/i18n_service.test.tsx.snap index d0374511515d1..801fa452e8332 100644 --- a/src/core/public/i18n/__snapshots__/i18n_service.test.tsx.snap +++ b/src/core/public/i18n/__snapshots__/i18n_service.test.tsx.snap @@ -6,27 +6,57 @@ exports[`#start() returns \`Context\` component 1`] = ` i18n={ Object { "mapping": Object { + "euiAccordion.isLoading": "Loading", "euiBasicTable.selectAllRows": "Select all rows", "euiBasicTable.selectThisRow": "Select this row", - "euiBasicTable.tableDescription": [Function], - "euiBottomBar.screenReaderAnnouncement": "There is a new menu opening with page level controls at the end of the document.", - "euiBreadcrumbs.collapsedBadge.ariaLabel": "Show all breadcrumbs", + "euiBasicTable.tableAutoCaptionWithPagination": [Function], + "euiBasicTable.tableAutoCaptionWithoutPagination": [Function], + "euiBasicTable.tableCaptionWithPagination": [Function], + "euiBasicTable.tablePagination": [Function], + "euiBasicTable.tableSimpleAutoCaptionWithPagination": [Function], + "euiBottomBar.customScreenReaderAnnouncement": [Function], + "euiBottomBar.screenReaderAnnouncement": "There is a new region landmark with page level controls at the end of the document.", + "euiBottomBar.screenReaderHeading": "Page level controls", + "euiBreadcrumbs.collapsedBadge.ariaLabel": "Show collapsed breadcrumbs", "euiCardSelect.select": "Select", "euiCardSelect.selected": "Selected", "euiCardSelect.unavailable": "Unavailable", "euiCodeBlock.copyButton": "Copy", + "euiCodeBlock.fullscreenCollapse": "Collapse", + "euiCodeBlock.fullscreenExpand": "Expand", "euiCodeEditor.startEditing": "Press Enter to start editing.", "euiCodeEditor.startInteracting": "Press Enter to start interacting with the code.", "euiCodeEditor.stopEditing": "When you're done, press Escape to stop editing.", "euiCodeEditor.stopInteracting": "When you're done, press Escape to stop interacting with the code.", "euiCollapsedItemActions.allActions": "All actions", + "euiCollapsibleNav.closeButtonLabel": "close", + "euiColorPicker.alphaLabel": "Alpha channel (opacity) value", + "euiColorPicker.closeLabel": "Press the down key to open a popover containing color options", + "euiColorPicker.colorErrorMessage": "Invalid color value", + "euiColorPicker.colorLabel": "Color value", + "euiColorPicker.openLabel": "Press the escape key to close the popover", "euiColorPicker.screenReaderAnnouncement": "A popup with a range of selectable colors opened. Tab forward to cycle through colors choices or press escape to close this popup.", "euiColorPicker.swatchAriaLabel": [Function], + "euiColorPicker.transparent": "Transparent", + "euiColorStopThumb.buttonAriaLabel": "Press the Enter key to modify this stop. Press Escape to focus the group", + "euiColorStopThumb.buttonTitle": "Click to edit, drag to reposition", "euiColorStopThumb.removeLabel": "Remove this stop", "euiColorStopThumb.screenReaderAnnouncement": "A popup with a color stop edit form opened. Tab forward to cycle through form controls or press escape to close this popup.", + "euiColorStopThumb.stopErrorMessage": "Value is out of range", + "euiColorStopThumb.stopLabel": "Stop value", "euiColorStops.screenReaderAnnouncement": [Function], + "euiColumnActions.moveLeft": "Move left", + "euiColumnActions.moveRight": "Move right", + "euiColumnActions.sort": [Function], + "euiColumnSelector.button": "Columns", + "euiColumnSelector.buttonActivePlural": [Function], + "euiColumnSelector.buttonActiveSingular": [Function], "euiColumnSelector.hideAll": "Hide all", + "euiColumnSelector.search": "Search", + "euiColumnSelector.searchcolumns": "Search columns", "euiColumnSelector.selectAll": "Show all", + "euiColumnSorting.button": "Sort fields", + "euiColumnSorting.buttonActive": "fields sorted", "euiColumnSorting.clearAll": "Clear sorting", "euiColumnSorting.emptySorting": "Currently no fields are sorted", "euiColumnSorting.pickFields": "Pick fields to sort by", @@ -39,15 +69,25 @@ exports[`#start() returns \`Context\` component 1`] = ` "euiComboBoxOptionsList.allOptionsSelected": "You've selected all available options", "euiComboBoxOptionsList.alreadyAdded": [Function], "euiComboBoxOptionsList.createCustomOption": [Function], + "euiComboBoxOptionsList.delimiterMessage": [Function], "euiComboBoxOptionsList.loadingOptions": "Loading options", "euiComboBoxOptionsList.noAvailableOptions": "There aren't any options available", "euiComboBoxOptionsList.noMatchingOptions": [Function], "euiComboBoxPill.removeSelection": [Function], "euiCommonlyUsedTimeRanges.legend": "Commonly used", + "euiDataGrid.ariaLabel": [Function], + "euiDataGrid.ariaLabelGridPagination": [Function], + "euiDataGrid.ariaLabelledBy": [Function], + "euiDataGrid.ariaLabelledByGridPagination": "Pagination for preceding grid", + "euiDataGrid.fullScreenButton": "Full screen", + "euiDataGrid.fullScreenButtonActive": "Exit full screen", "euiDataGrid.screenReaderNotice": "Cell contains interactive content.", - "euiDataGridCell.expandButtonTitle": "Click or hit enter to interact with cell content", - "euiDataGridSchema.booleanSortTextAsc": "True-False", - "euiDataGridSchema.booleanSortTextDesc": "False-True", + "euiDataGridCell.column": "Column", + "euiDataGridCell.row": "Row", + "euiDataGridCellButtons.expandButtonTitle": "Click or hit enter to interact with cell content", + "euiDataGridHeaderCell.headerActions": "Header actions", + "euiDataGridSchema.booleanSortTextAsc": "False-True", + "euiDataGridSchema.booleanSortTextDesc": "True-False", "euiDataGridSchema.currencySortTextAsc": "Low-High", "euiDataGridSchema.currencySortTextDesc": "High-Low", "euiDataGridSchema.dateSortTextAsc": "New-Old", @@ -56,22 +96,56 @@ exports[`#start() returns \`Context\` component 1`] = ` "euiDataGridSchema.jsonSortTextDesc": "Large-Small", "euiDataGridSchema.numberSortTextAsc": "Low-High", "euiDataGridSchema.numberSortTextDesc": "High-Low", + "euiFieldPassword.maskPassword": "Mask password", + "euiFieldPassword.showPassword": "Show password as plain text. Note: this will visually expose your password on the screen.", + "euiFilePicker.clearSelectedFiles": "Clear selected files", + "euiFilePicker.filesSelected": "files selected", "euiFilterButton.filterBadge": [Function], - "euiForm.addressFormErrors": "Please address the errors in your form.", + "euiFlyout.closeAriaLabel": "Close this dialog", + "euiForm.addressFormErrors": "Please address the highlighted errors.", "euiFormControlLayoutClearButton.label": "Clear input", "euiHeaderAlert.dismiss": "Dismiss", - "euiHeaderLinks.appNavigation": "App navigation", - "euiHeaderLinks.openNavigationMenu": "Open navigation menu", + "euiHeaderLinks.appNavigation": "App menu", + "euiHeaderLinks.openNavigationMenu": "Open menu", "euiHue.label": "Select the HSV color mode \\"hue\\" value", "euiImage.closeImage": [Function], "euiImage.openImage": [Function], "euiLink.external.ariaLabel": "External link", + "euiLink.newTarget.screenReaderOnlyText": "(opens in a new tab or window)", + "euiMarkdownEditorFooter.closeButton": "Close", + "euiMarkdownEditorFooter.descriptionPrefix": "This editor uses", + "euiMarkdownEditorFooter.descriptionSuffix": "You can also utilize these additional syntax plugins to add rich content to your text.", + "euiMarkdownEditorFooter.errorsTitle": "Errors", + "euiMarkdownEditorFooter.openUploadModal": "Open upload files modal", + "euiMarkdownEditorFooter.showMarkdownHelp": "Show markdown help", + "euiMarkdownEditorFooter.showSyntaxErrors": "Show errors", + "euiMarkdownEditorFooter.supportedFileTypes": [Function], + "euiMarkdownEditorFooter.syntaxTitle": "Syntax help", + "euiMarkdownEditorFooter.unsupportedFileType": "File type not supported", + "euiMarkdownEditorFooter.uploadingFiles": "Click to upload files", + "euiMarkdownEditorToolbar.editor": "Editor", + "euiMarkdownEditorToolbar.previewMarkdown": "Preview", "euiModal.closeModal": "Closes this modal window", - "euiPagination.jumpToLastPage": [Function], - "euiPagination.nextPage": "Next page", - "euiPagination.pageOfTotal": [Function], - "euiPagination.previousPage": "Previous page", + "euiNotificationEventMessages.accordionAriaLabelButtonText": [Function], + "euiNotificationEventMessages.accordionButtonText": [Function], + "euiNotificationEventMessages.accordionHideText": "hide", + "euiNotificationEventMeta.contextMenuButton": [Function], + "euiNotificationEventReadButton.markAsRead": "Mark as read", + "euiNotificationEventReadButton.markAsReadAria": [Function], + "euiNotificationEventReadButton.markAsUnread": "Mark as unread", + "euiNotificationEventReadButton.markAsUnreadAria": [Function], + "euiPagination.disabledNextPage": "Next page", + "euiPagination.disabledPreviousPage": "Previous page", + "euiPagination.firstRangeAriaLabel": [Function], + "euiPagination.lastRangeAriaLabel": [Function], + "euiPagination.nextPage": [Function], + "euiPagination.previousPage": [Function], + "euiPaginationButton.longPageString": [Function], + "euiPaginationButton.shortPageString": [Function], + "euiPinnableListGroup.pinExtraActionLabel": "Pin item", + "euiPinnableListGroup.pinnedExtraActionLabel": "Unpin item", "euiPopover.screenReaderAnnouncement": "You are in a dialog. To close this dialog, hit escape.", + "euiProgress.valueText": [Function], "euiQuickSelect.applyButton": "Apply", "euiQuickSelect.fullDescription": [Function], "euiQuickSelect.legendText": "Quick select a time range", @@ -81,27 +155,54 @@ exports[`#start() returns \`Context\` component 1`] = ` "euiQuickSelect.tenseLabel": "Time tense", "euiQuickSelect.unitLabel": "Time unit", "euiQuickSelect.valueLabel": "Time value", + "euiRecentlyUsed.legend": "Recently used date ranges", "euiRefreshInterval.fullDescription": [Function], "euiRefreshInterval.legend": "Refresh every", "euiRefreshInterval.start": "Start", "euiRefreshInterval.stop": "Stop", "euiRelativeTab.fullDescription": [Function], + "euiRelativeTab.numberInputError": "Must be >= 0", + "euiRelativeTab.numberInputLabel": "Time span amount", "euiRelativeTab.relativeDate": [Function], "euiRelativeTab.roundingLabel": [Function], "euiRelativeTab.unitInputLabel": "Relative time span", + "euiResizableButton.horizontalResizerAriaLabel": "Press left or right to adjust panels size", + "euiResizableButton.verticalResizerAriaLabel": "Press up or down to adjust panels size", + "euiResizablePanel.toggleButtonAriaLabel": "Press to toggle this panel", "euiSaturation.roleDescription": "HSV color mode saturation and value selection", "euiSaturation.screenReaderAnnouncement": "Use the arrow keys to navigate the square color gradient. The coordinates resulting from each key press will be used to calculate HSV color mode \\"saturation\\" and \\"value\\" numbers, in the range of 0 to 1. Left and right decrease and increase (respectively) the \\"saturation\\" value. Up and down decrease and increase (respectively) the \\"value\\" value.", "euiSelectable.loadingOptions": "Loading options", "euiSelectable.noAvailableOptions": "There aren't any options available", "euiSelectable.noMatchingOptions": [Function], + "euiSelectable.placeholderName": "Filter options", + "euiSelectableListItem.excludedOption": "Excluded option.", + "euiSelectableListItem.excludedOptionInstructions": "To deselect this option, press enter", + "euiSelectableListItem.includedOption": "Included option.", + "euiSelectableListItem.includedOptionInstructions": "To exclude this option, press enter.", + "euiSelectableTemplateSitewide.loadingResults": "Loading results", + "euiSelectableTemplateSitewide.noResults": "No results available", + "euiSelectableTemplateSitewide.onFocusBadgeGoTo": "Go to", + "euiSelectableTemplateSitewide.searchPlaceholder": "Search for anything...", "euiStat.loadingText": "Statistic is loading", - "euiStep.ariaLabel": [Function], - "euiStepHorizontal.buttonTitle": [Function], - "euiStepHorizontal.step": "Step", - "euiStepNumber.hasErrors": "has errors", - "euiStepNumber.hasWarnings": "has warnings", - "euiStepNumber.isComplete": "complete", + "euiStepStrings.complete": [Function], + "euiStepStrings.disabled": [Function], + "euiStepStrings.errors": [Function], + "euiStepStrings.incomplete": [Function], + "euiStepStrings.loading": [Function], + "euiStepStrings.simpleComplete": [Function], + "euiStepStrings.simpleDisabled": [Function], + "euiStepStrings.simpleErrors": [Function], + "euiStepStrings.simpleIncomplete": [Function], + "euiStepStrings.simpleLoading": [Function], + "euiStepStrings.simpleStep": [Function], + "euiStepStrings.simpleWarning": [Function], + "euiStepStrings.step": [Function], + "euiStepStrings.warning": [Function], + "euiStyleSelector.buttonLegend": "Select the display density for the data grid", "euiStyleSelector.buttonText": "Density", + "euiStyleSelector.labelCompact": "Compact density", + "euiStyleSelector.labelExpanded": "Expanded density", + "euiStyleSelector.labelNormal": "Normal density", "euiSuperDatePicker.showDatesButtonLabel": "Show dates", "euiSuperSelect.screenReaderAnnouncement": [Function], "euiSuperSelectControl.selectAnOption": [Function], @@ -110,12 +211,23 @@ exports[`#start() returns \`Context\` component 1`] = ` "euiSuperUpdateButton.refreshButtonLabel": "Refresh", "euiSuperUpdateButton.updateButtonLabel": "Update", "euiSuperUpdateButton.updatingButtonLabel": "Updating", + "euiTableHeaderCell.clickForAscending": "Click to sort in ascending order", + "euiTableHeaderCell.clickForDescending": "Click to sort in descending order", + "euiTableHeaderCell.clickForUnsort": "Click to unsort", + "euiTableHeaderCell.titleTextWithSort": [Function], "euiTablePagination.rowsPerPage": "Rows per page", "euiTablePagination.rowsPerPageOption": [Function], "euiTableSortMobile.sorting": "Sorting", "euiToast.dismissToast": "Dismiss toast", "euiToast.newNotification": "A new notification appears", "euiToast.notification": "Notification", + "euiTour.closeTour": "Close tour", + "euiTour.endTour": "End tour", + "euiTour.skipTour": "Skip tour", + "euiTourStepIndicator.ariaLabel": [Function], + "euiTourStepIndicator.isActive": "active", + "euiTourStepIndicator.isComplete": "complete", + "euiTourStepIndicator.isIncomplete": "incomplete", "euiTreeView.ariaLabel": [Function], "euiTreeView.listNavigationInstructions": "You can quickly navigate this list using arrow keys.", }, diff --git a/src/core/public/i18n/i18n_eui_mapping.tsx b/src/core/public/i18n/i18n_eui_mapping.tsx index 1ef033289e542..1cccc4d94a78d 100644 --- a/src/core/public/i18n/i18n_eui_mapping.tsx +++ b/src/core/public/i18n/i18n_eui_mapping.tsx @@ -16,6 +16,9 @@ interface EuiValues { export const getEuiContextMapping = () => { const euiContextMapping = { + 'euiAccordion.isLoading': i18n.translate('core.euiAccordion.isLoading', { + defaultMessage: 'Loading', + }), 'euiBasicTable.selectAllRows': i18n.translate('core.euiBasicTable.selectAllRows', { defaultMessage: 'Select all rows', description: 'ARIA and displayed label on a checkbox to select all table rows', @@ -24,25 +27,71 @@ export const getEuiContextMapping = () => { defaultMessage: 'Select this row', description: 'ARIA and displayed label on a checkbox to select a single table row', }), - 'euiBasicTable.tableDescription': ({ itemCount }: EuiValues) => - i18n.translate('core.euiBasicTable.tableDescription', { - defaultMessage: 'Below is a table of {itemCount} items.', + 'euiBasicTable.tableCaptionWithPagination': ({ tableCaption, page, pageCount }: EuiValues) => + i18n.translate('core.euiBasicTable.tableCaptionWithPagination', { + defaultMessage: '{tableCaption}; Page {page} of {pageCount}.', + values: { tableCaption, page, pageCount }, + description: 'Screen reader text to describe the size of a paginated table', + }), + 'euiBasicTable.tableAutoCaptionWithPagination': ({ + itemCount, + totalItemCount, + page, + pageCount, + }: EuiValues) => + i18n.translate('core.euiBasicTable.tableDescriptionWithoutPagination', { + defaultMessage: + 'This table contains {itemCount} rows out of {totalItemCount} rows; Page {page} of {pageCount}.', + values: { itemCount, totalItemCount, page, pageCount }, + description: 'Screen reader text to describe the size of a paginated table', + }), + 'euiBasicTable.tableSimpleAutoCaptionWithPagination': ({ + itemCount, + page, + pageCount, + }: EuiValues) => + i18n.translate('core.euiBasicTable.tableSimpleAutoCaptionWithPagination', { + defaultMessage: 'This table contains {itemCount} rows; Page {page} of {pageCount}.', + values: { itemCount, page, pageCount }, + description: 'Screen reader text to describe the size of a paginated table', + }), + 'euiBasicTable.tableAutoCaptionWithoutPagination': ({ itemCount }: EuiValues) => + i18n.translate('core.euiBasicTable.tableAutoCaptionWithoutPagination', { + defaultMessage: 'This table contains {itemCount} rows.', values: { itemCount }, description: 'Screen reader text to describe the size of a table', }), + 'euiBasicTable.tablePagination': ({ tableCaption }: EuiValues) => + i18n.translate('core.euiBasicTable.tablePagination', { + defaultMessage: 'Pagination for preceding table: {tableCaption}', + values: { tableCaption }, + description: 'Screen reader text to describe the pagination controls', + }), + 'euiBottomBar.customScreenReaderAnnouncement': ({ landmarkHeading }: EuiValues) => + i18n.translate('core.euiBottomBar.customScreenReaderAnnouncement', { + defaultMessage: + 'There is a new region landmark called {landmarkHeading} with page level controls at the end of the document.', + values: { landmarkHeading }, + description: + 'Screen reader announcement that functionality is available in the page document', + }), 'euiBottomBar.screenReaderAnnouncement': i18n.translate( 'core.euiBottomBar.screenReaderAnnouncement', { defaultMessage: - 'There is a new menu opening with page level controls at the end of the document.', + 'There is a new region landmark with page level controls at the end of the document.', description: 'Screen reader announcement that functionality is available in the page document', } ), + 'euiBottomBar.screenReaderHeading': i18n.translate('core.euiBottomBar.screenReaderHeading', { + defaultMessage: 'Page level controls', + description: 'Screen reader announcement about heading controls', + }), 'euiBreadcrumbs.collapsedBadge.ariaLabel': i18n.translate( 'core.euiBreadcrumbs.collapsedBadge.ariaLabel', { - defaultMessage: 'Show all breadcrumbs', + defaultMessage: 'Show collapsed breadcrumbs', description: 'Displayed when one or more breadcrumbs are hidden.', } ), @@ -62,17 +111,29 @@ export const getEuiContextMapping = () => { defaultMessage: 'Copy', description: 'ARIA label for a button that copies source code text to the clipboard', }), + 'euiCodeBlock.fullscreenCollapse': i18n.translate('core.euiCodeBlock.fullscreenCollapse', { + defaultMessage: 'Collapse', + description: 'ARIA label for a button that exits fullscreen view', + }), + 'euiCodeBlock.fullscreenExpand': i18n.translate('core.euiCodeBlock.fullscreenExpand', { + defaultMessage: 'Expand', + description: 'ARIA label for a button that enters fullscreen view', + }), 'euiCodeEditor.startEditing': i18n.translate('core.euiCodeEditor.startEditing', { defaultMessage: 'Press Enter to start editing.', + description: 'Screen reader text to prompt editing', }), 'euiCodeEditor.startInteracting': i18n.translate('core.euiCodeEditor.startInteracting', { defaultMessage: 'Press Enter to start interacting with the code.', + description: 'Screen reader text to prompt interaction', }), 'euiCodeEditor.stopEditing': i18n.translate('core.euiCodeEditor.stopEditing', { defaultMessage: "When you're done, press Escape to stop editing.", + description: 'Screen reader text to describe ending editing', }), 'euiCodeEditor.stopInteracting': i18n.translate('core.euiCodeEditor.stopInteracting', { defaultMessage: "When you're done, press Escape to stop interacting with the code.", + description: 'Screen reader text to describe ending interactions', }), 'euiCollapsedItemActions.allActions': i18n.translate( 'core.euiCollapsedItemActions.allActions', @@ -82,6 +143,12 @@ export const getEuiContextMapping = () => { 'ARIA label and tooltip content describing a button that expands an actions menu', } ), + 'euiCollapsibleNav.closeButtonLabel': i18n.translate( + 'core.euiCollapsibleNav.closeButtonLabel', + { + defaultMessage: 'close', + } + ), 'euiColorPicker.screenReaderAnnouncement': i18n.translate( 'core.euiColorPicker.screenReaderAnnouncement', { @@ -98,6 +165,27 @@ export const getEuiContextMapping = () => { description: 'Screen reader text to describe the action and hex value of the selectable option', }), + 'euiColorPicker.alphaLabel': i18n.translate('core.euiColorPicker.alphaLabel', { + defaultMessage: 'Alpha channel (opacity) value', + description: 'Label describing color alpha channel', + }), + 'euiColorPicker.colorLabel': i18n.translate('core.euiColorPicker.colorLabel', { + defaultMessage: 'Color value', + }), + 'euiColorPicker.colorErrorMessage': i18n.translate('core.euiColorPicker.colorErrorMessage', { + defaultMessage: 'Invalid color value', + }), + 'euiColorPicker.transparent': i18n.translate('core.euiColorPicker.transparent', { + defaultMessage: 'Transparent', + }), + 'euiColorPicker.openLabel': i18n.translate('core.euiColorPicker.openLabel', { + defaultMessage: 'Press the escape key to close the popover', + description: 'Screen reader text to describe how to close the picker', + }), + 'euiColorPicker.closeLabel': i18n.translate('core.euiColorPicker.closeLabel', { + defaultMessage: 'Press the down key to open a popover containing color options', + description: 'Screen reader text to describe how to open the picker', + }), 'euiColorStopThumb.removeLabel': i18n.translate('core.euiColorStopThumb.removeLabel', { defaultMessage: 'Remove this stop', description: 'Label accompanying a button whose action will remove the color stop', @@ -111,6 +199,23 @@ export const getEuiContextMapping = () => { 'Message when the color picker popover has opened for an individual color stop thumb.', } ), + 'euiColorStopThumb.buttonAriaLabel': i18n.translate('core.euiColorStopThumb.buttonAriaLabel', { + defaultMessage: 'Press the Enter key to modify this stop. Press Escape to focus the group', + description: 'Screen reader text to describe picker interaction', + }), + 'euiColorStopThumb.buttonTitle': i18n.translate('core.euiColorStopThumb.buttonTitle', { + defaultMessage: 'Click to edit, drag to reposition', + description: 'Screen reader text to describe button interaction', + }), + 'euiColorStopThumb.stopLabel': i18n.translate('core.euiColorStopThumb.stopLabel', { + defaultMessage: 'Stop value', + }), + 'euiColorStopThumb.stopErrorMessage': i18n.translate( + 'core.euiColorStopThumb.stopErrorMessage', + { + defaultMessage: 'Value is out of range', + } + ), 'euiColorStops.screenReaderAnnouncement': ({ label, readOnly, disabled }: EuiValues) => i18n.translate('core.euiColorStops.screenReaderAnnouncement', { defaultMessage: @@ -119,12 +224,42 @@ export const getEuiContextMapping = () => { description: 'Screen reader text to describe the composite behavior of the color stops component.', }), + 'euiColumnActions.sort': ({ schemaLabel }: EuiValues) => + i18n.translate('core.euiColumnActions.sort', { + defaultMessage: 'Sort {schemaLabel}', + values: { schemaLabel }, + }), + 'euiColumnActions.moveLeft': i18n.translate('core.euiColumnActions.moveLeft', { + defaultMessage: 'Move left', + }), + 'euiColumnActions.moveRight': i18n.translate('core.euiColumnActions.moveRight', { + defaultMessage: 'Move right', + }), 'euiColumnSelector.hideAll': i18n.translate('core.euiColumnSelector.hideAll', { defaultMessage: 'Hide all', }), 'euiColumnSelector.selectAll': i18n.translate('core.euiColumnSelector.selectAll', { defaultMessage: 'Show all', }), + 'euiColumnSelector.button': i18n.translate('core.euiColumnSelector.button', { + defaultMessage: 'Columns', + }), + 'euiColumnSelector.search': i18n.translate('core.euiColumnSelector.search', { + defaultMessage: 'Search', + }), + 'euiColumnSelector.searchcolumns': i18n.translate('core.euiColumnSelector.searchcolumns', { + defaultMessage: 'Search columns', + }), + 'euiColumnSelector.buttonActiveSingular': ({ numberOfHiddenFields }: EuiValues) => + i18n.translate('core.euiColumnSelector.buttonActiveSingular', { + defaultMessage: '{numberOfHiddenFields} column hidden', + values: { numberOfHiddenFields }, + }), + 'euiColumnSelector.buttonActivePlural': ({ numberOfHiddenFields }: EuiValues) => + i18n.translate('core.euiColumnSelector.buttonActivePlural', { + defaultMessage: '{numberOfHiddenFields} columns hidden', + values: { numberOfHiddenFields }, + }), 'euiColumnSorting.clearAll': i18n.translate('core.euiColumnSorting.clearAll', { defaultMessage: 'Clear sorting', }), @@ -140,6 +275,12 @@ export const getEuiContextMapping = () => { defaultMessage: 'Sort by:', } ), + 'euiColumnSorting.button': i18n.translate('core.euiColumnSorting.button', { + defaultMessage: 'Sort fields', + }), + 'euiColumnSorting.buttonActive': i18n.translate('core.euiColumnSorting.buttonActive', { + defaultMessage: 'fields sorted', + }), 'euiColumnSortingDraggable.activeSortLabel': i18n.translate( 'core.euiColumnSortingDraggable.activeSortLabel', { @@ -185,11 +326,11 @@ export const getEuiContextMapping = () => { values={{ label }} /> ), - 'euiComboBoxOptionsList.createCustomOption': ({ key, searchValue }: EuiValues) => ( + 'euiComboBoxOptionsList.createCustomOption': ({ searchValue }: EuiValues) => ( ), 'euiComboBoxOptionsList.loadingOptions': i18n.translate( @@ -212,6 +353,12 @@ export const getEuiContextMapping = () => { values={{ searchValue }} /> ), + 'euiComboBoxOptionsList.delimiterMessage': ({ delimiter }: EuiValues) => + i18n.translate('core.euiComboBoxOptionsList.delimiterMessage', { + defaultMessage: 'Add each item separated by {delimiter}', + values: { delimiter }, + description: 'Screen reader text describing adding delimited options', + }), 'euiComboBoxPill.removeSelection': ({ children }: EuiValues) => i18n.translate('core.euiComboBoxPill.removeSelection', { defaultMessage: 'Remove {children} from selection in this group', @@ -224,20 +371,69 @@ export const getEuiContextMapping = () => { 'euiDataGrid.screenReaderNotice': i18n.translate('core.euiDataGrid.screenReaderNotice', { defaultMessage: 'Cell contains interactive content.', }), - 'euiDataGridCell.expandButtonTitle': i18n.translate('core.euiDataGridCell.expandButtonTitle', { - defaultMessage: 'Click or hit enter to interact with cell content', + 'euiDataGrid.ariaLabelGridPagination': ({ label }: EuiValues) => + i18n.translate('core.euiDataGrid.ariaLabelGridPagination', { + defaultMessage: 'Pagination for preceding grid: {label}', + values: { label }, + description: 'Screen reader text to describe the pagination controls', + }), + 'euiDataGrid.ariaLabelledByGridPagination': i18n.translate( + 'core.euiDataGrid.ariaLabelledByGridPagination', + { + defaultMessage: 'Pagination for preceding grid', + description: 'Screen reader text to describe the pagination controls', + } + ), + 'euiDataGrid.ariaLabel': ({ label, page, pageCount }: EuiValues) => + i18n.translate('core.euiDataGrid.ariaLabel', { + defaultMessage: '{label}; Page {page} of {pageCount}.', + values: { label, page, pageCount }, + description: 'Screen reader text to describe the size of the data grid', + }), + 'euiDataGrid.ariaLabelledBy': ({ page, pageCount }: EuiValues) => + i18n.translate('core.euiDataGrid.ariaLabelledBy', { + defaultMessage: 'Page {page} of {pageCount}.', + values: { page, pageCount }, + description: 'Screen reader text to describe the size of the data grid', + }), + 'euiDataGrid.fullScreenButton': i18n.translate('core.euiDataGrid.fullScreenButton', { + defaultMessage: 'Full screen', }), + 'euiDataGrid.fullScreenButtonActive': i18n.translate( + 'core.euiDataGrid.fullScreenButtonActive', + { + defaultMessage: 'Exit full screen', + } + ), + 'euiDataGridCell.row': i18n.translate('core.euiDataGridCell.row', { + defaultMessage: 'Row', + }), + 'euiDataGridCell.column': i18n.translate('core.euiDataGridCell.column', { + defaultMessage: 'Column', + }), + 'euiDataGridCellButtons.expandButtonTitle': i18n.translate( + 'core.euiDataGridCellButtons.expandButtonTitle', + { + defaultMessage: 'Click or hit enter to interact with cell content', + } + ), + 'euiDataGridHeaderCell.headerActions': i18n.translate( + 'core.euiDataGridHeaderCell.headerActions', + { + defaultMessage: 'Header actions', + } + ), 'euiDataGridSchema.booleanSortTextAsc': i18n.translate( 'core.euiDataGridSchema.booleanSortTextAsc', { - defaultMessage: 'True-False', + defaultMessage: 'False-True', description: 'Ascending boolean label', } ), 'euiDataGridSchema.booleanSortTextDesc': i18n.translate( 'core.euiDataGridSchema.booleanSortTextDesc', { - defaultMessage: 'False-True', + defaultMessage: 'True-False', description: 'Descending boolean label', } ), @@ -291,13 +487,29 @@ export const getEuiContextMapping = () => { description: 'Descending size label', } ), + 'euiFieldPassword.showPassword': i18n.translate('core.euiFieldPassword.showPassword', { + defaultMessage: + 'Show password as plain text. Note: this will visually expose your password on the screen.', + }), + 'euiFieldPassword.maskPassword': i18n.translate('core.euiFieldPassword.maskPassword', { + defaultMessage: 'Mask password', + }), + 'euiFilePicker.clearSelectedFiles': i18n.translate('core.euiFilePicker.clearSelectedFiles', { + defaultMessage: 'Clear selected files', + }), + 'euiFilePicker.filesSelected': i18n.translate('core.euiFilePicker.filesSelected', { + defaultMessage: 'files selected', + }), 'euiFilterButton.filterBadge': ({ count, hasActiveFilters }: EuiValues) => i18n.translate('core.euiFilterButton.filterBadge', { defaultMessage: '${count} ${filterCountLabel} filters', values: { count, filterCountLabel: hasActiveFilters ? 'active' : 'available' }, }), + 'euiFlyout.closeAriaLabel': i18n.translate('core.euiFlyout.closeAriaLabel', { + defaultMessage: 'Close this dialog', + }), 'euiForm.addressFormErrors': i18n.translate('core.euiForm.addressFormErrors', { - defaultMessage: 'Please address the errors in your form.', + defaultMessage: 'Please address the highlighted errors.', }), 'euiFormControlLayoutClearButton.label': i18n.translate( 'core.euiFormControlLayoutClearButton.label', @@ -311,11 +523,11 @@ export const getEuiContextMapping = () => { description: 'ARIA label on a button that dismisses/removes a notification', }), 'euiHeaderLinks.appNavigation': i18n.translate('core.euiHeaderLinks.appNavigation', { - defaultMessage: 'App navigation', + defaultMessage: 'App menu', description: 'ARIA label on a `nav` element', }), 'euiHeaderLinks.openNavigationMenu': i18n.translate('core.euiHeaderLinks.openNavigationMenu', { - defaultMessage: 'Open navigation menu', + defaultMessage: 'Open menu', }), 'euiHue.label': i18n.translate('core.euiHue.label', { defaultMessage: 'Select the HSV color mode "hue" value', @@ -333,31 +545,200 @@ export const getEuiContextMapping = () => { 'euiLink.external.ariaLabel': i18n.translate('core.euiLink.external.ariaLabel', { defaultMessage: 'External link', }), + 'euiLink.newTarget.screenReaderOnlyText': i18n.translate( + 'core.euiLink.newTarget.screenReaderOnlyText', + { + defaultMessage: '(opens in a new tab or window)', + } + ), + 'euiMarkdownEditorFooter.closeButton': i18n.translate( + 'core.euiMarkdownEditorFooter.closeButton', + { + defaultMessage: 'Close', + } + ), + 'euiMarkdownEditorFooter.uploadingFiles': i18n.translate( + 'core.euiMarkdownEditorFooter.uploadingFiles', + { + defaultMessage: 'Click to upload files', + } + ), + 'euiMarkdownEditorFooter.openUploadModal': i18n.translate( + 'core.euiMarkdownEditorFooter.openUploadModal', + { + defaultMessage: 'Open upload files modal', + } + ), + 'euiMarkdownEditorFooter.unsupportedFileType': i18n.translate( + 'core.euiMarkdownEditorFooter.unsupportedFileType', + { + defaultMessage: 'File type not supported', + } + ), + 'euiMarkdownEditorFooter.supportedFileTypes': ({ supportedFileTypes }: EuiValues) => + i18n.translate('core.euiMarkdownEditorFooter.supportedFileTypes', { + defaultMessage: 'Supported files: {supportedFileTypes}', + values: { supportedFileTypes }, + }), + 'euiMarkdownEditorFooter.showSyntaxErrors': i18n.translate( + 'core.euiMarkdownEditorFooter.showSyntaxErrors', + { + defaultMessage: 'Show errors', + } + ), + 'euiMarkdownEditorFooter.showMarkdownHelp': i18n.translate( + 'core.euiMarkdownEditorFooter.showMarkdownHelp', + { + defaultMessage: 'Show markdown help', + } + ), + 'euiMarkdownEditorFooter.errorsTitle': i18n.translate( + 'core.euiMarkdownEditorFooter.errorsTitle', + { + defaultMessage: 'Errors', + } + ), + 'euiMarkdownEditorFooter.syntaxTitle': i18n.translate( + 'core.euiMarkdownEditorFooter.syntaxTitle', + { + defaultMessage: 'Syntax help', + } + ), + 'euiMarkdownEditorFooter.descriptionPrefix': i18n.translate( + 'core.euiMarkdownEditorFooter.descriptionPrefix', + { + defaultMessage: 'This editor uses', + } + ), + 'euiMarkdownEditorFooter.descriptionSuffix': i18n.translate( + 'core.euiMarkdownEditorFooter.descriptionSuffix', + { + defaultMessage: + 'You can also utilize these additional syntax plugins to add rich content to your text.', + } + ), + 'euiMarkdownEditorToolbar.editor': i18n.translate('core.euiMarkdownEditorToolbar.editor', { + defaultMessage: 'Editor', + }), + 'euiMarkdownEditorToolbar.previewMarkdown': i18n.translate( + 'core.euiMarkdownEditorToolbar.previewMarkdown', + { + defaultMessage: 'Preview', + } + ), 'euiModal.closeModal': i18n.translate('core.euiModal.closeModal', { defaultMessage: 'Closes this modal window', }), - 'euiPagination.jumpToLastPage': ({ pageCount }: EuiValues) => - i18n.translate('core.euiPagination.jumpToLastPage', { - defaultMessage: 'Jump to the last page, number {pageCount}', - values: { pageCount }, + 'euiNotificationEventMessages.accordionButtonText': ({ + messagesLength, + eventName, + }: EuiValues) => + i18n.translate('core.euiNotificationEventMessages.accordionButtonText', { + defaultMessage: '+ {messagesLength} messages for {eventName}', + values: { messagesLength, eventName }, + }), + 'euiNotificationEventMessages.accordionAriaLabelButtonText': ({ messagesLength }: EuiValues) => + i18n.translate('core.euiNotificationEventMessages.accordionAriaLabelButtonText', { + defaultMessage: '+ {messagesLength} more', + values: { messagesLength }, + }), + 'euiNotificationEventMeta.contextMenuButton': ({ eventName }: EuiValues) => + i18n.translate('core.euiNotificationEventMeta.contextMenuButton', { + defaultMessage: 'Menu for {eventName}', + values: { eventName }, + }), + 'euiNotificationEventReadButton.markAsReadAria': ({ eventName }: EuiValues) => + i18n.translate('core.euiNotificationEventReadButton.markAsReadAria', { + defaultMessage: 'Mark {eventName} as read', + values: { eventName }, + }), + 'euiNotificationEventReadButton.markAsUnreadAria': ({ eventName }: EuiValues) => + i18n.translate('core.euiNotificationEventReadButton.markAsUnreadAria', { + defaultMessage: 'Mark {eventName} as unread', + values: { eventName }, + }), + 'euiNotificationEventReadButton.markAsRead': i18n.translate( + 'core.euiNotificationEventReadButton.markAsRead', + { + defaultMessage: 'Mark as read', + } + ), + 'euiNotificationEventReadButton.markAsUnread': i18n.translate( + 'core.euiNotificationEventReadButton.markAsUnread', + { + defaultMessage: 'Mark as unread', + } + ), + 'euiNotificationEventMessages.accordionHideText': i18n.translate( + 'core.euiNotificationEventMessages.accordionHideText', + { + defaultMessage: 'hide', + } + ), + 'euiPagination.nextPage': ({ page }: EuiValues) => + i18n.translate('core.euiPagination.nextPage', { + defaultMessage: 'Next page, {page}', + values: { page }, }), - 'euiPagination.nextPage': i18n.translate('core.euiPagination.nextPage', { + 'euiPagination.previousPage': ({ page }: EuiValues) => + i18n.translate('core.euiPagination.previousPage', { + defaultMessage: 'Previous page, {page}', + values: { page }, + }), + 'euiPagination.disabledPreviousPage': i18n.translate( + 'core.euiPagination.disabledPreviousPage', + { + defaultMessage: 'Previous page', + } + ), + 'euiPagination.disabledNextPage': i18n.translate('core.euiPagination.disabledNextPage', { defaultMessage: 'Next page', }), - 'euiPagination.pageOfTotal': ({ page, total }: EuiValues) => - i18n.translate('core.euiPagination.pageOfTotal', { - defaultMessage: 'Page {page} of {total}', - values: { page, total }, + 'euiPagination.firstRangeAriaLabel': ({ lastPage }: EuiValues) => + i18n.translate('core.euiPagination.firstRangeAriaLabel', { + defaultMessage: 'Skipping pages 2 to {lastPage}', + values: { lastPage }, }), - 'euiPagination.previousPage': i18n.translate('core.euiPagination.previousPage', { - defaultMessage: 'Previous page', - }), + 'euiPagination.lastRangeAriaLabel': ({ firstPage, lastPage }: EuiValues) => + i18n.translate('core.euiPagination.lastRangeAriaLabel', { + defaultMessage: 'Skipping pages {firstPage} to {lastPage}', + values: { firstPage, lastPage }, + }), + 'euiPaginationButton.longPageString': ({ page, totalPages }: EuiValues) => + i18n.translate('core.euiPaginationButton.longPageString', { + defaultMessage: 'Page {page} of {totalPages}', + values: { page, totalPages }, + description: 'Text to describe the size of a paginated section', + }), + 'euiPaginationButton.shortPageString': ({ page }: EuiValues) => + i18n.translate('core.euiPaginationButton.shortPageString', { + defaultMessage: 'Page {page}', + values: { page }, + description: 'Text to describe the current page of a paginated section', + }), + 'euiPinnableListGroup.pinExtraActionLabel': i18n.translate( + 'core.euiPinnableListGroup.pinExtraActionLabel', + { + defaultMessage: 'Pin item', + } + ), + 'euiPinnableListGroup.pinnedExtraActionLabel': i18n.translate( + 'core.euiPinnableListGroup.pinnedExtraActionLabel', + { + defaultMessage: 'Unpin item', + } + ), 'euiPopover.screenReaderAnnouncement': i18n.translate( 'core.euiPopover.screenReaderAnnouncement', { defaultMessage: 'You are in a dialog. To close this dialog, hit escape.', } ), + 'euiProgress.valueText': ({ value }: EuiValues) => + i18n.translate('core.euiProgress.valueText', { + defaultMessage: '{value}%', + values: { value }, + }), 'euiQuickSelect.applyButton': i18n.translate('core.euiQuickSelect.applyButton', { defaultMessage: 'Apply', }), @@ -387,9 +768,12 @@ export const getEuiContextMapping = () => { 'euiQuickSelect.valueLabel': i18n.translate('core.euiQuickSelect.valueLabel', { defaultMessage: 'Time value', }), + 'euiRecentlyUsed.legend': i18n.translate('core.euiRecentlyUsed.legend', { + defaultMessage: 'Recently used date ranges', + }), 'euiRefreshInterval.fullDescription': ({ optionValue, optionText }: EuiValues) => i18n.translate('core.euiRefreshInterval.fullDescription', { - defaultMessage: 'Currently set to {optionValue} {optionText}.', + defaultMessage: 'Refresh interval currently set to {optionValue} {optionText}.', values: { optionValue, optionText }, }), 'euiRefreshInterval.legend': i18n.translate('core.euiRefreshInterval.legend', { @@ -419,6 +803,30 @@ export const getEuiContextMapping = () => { 'euiRelativeTab.unitInputLabel': i18n.translate('core.euiRelativeTab.unitInputLabel', { defaultMessage: 'Relative time span', }), + 'euiRelativeTab.numberInputError': i18n.translate('core.euiRelativeTab.numberInputError', { + defaultMessage: 'Must be >= 0', + }), + 'euiRelativeTab.numberInputLabel': i18n.translate('core.euiRelativeTab.numberInputLabel', { + defaultMessage: 'Time span amount', + }), + 'euiResizableButton.horizontalResizerAriaLabel': i18n.translate( + 'core.euiResizableButton.horizontalResizerAriaLabel', + { + defaultMessage: 'Press left or right to adjust panels size', + } + ), + 'euiResizableButton.verticalResizerAriaLabel': i18n.translate( + 'core.euiResizableButton.verticalResizerAriaLabel', + { + defaultMessage: 'Press up or down to adjust panels size', + } + ), + 'euiResizablePanel.toggleButtonAriaLabel': i18n.translate( + 'core.euiResizablePanel.toggleButtonAriaLabel', + { + defaultMessage: 'Press to toggle this panel', + } + ), 'euiSaturation.roleDescription': i18n.translate('core.euiSaturation.roleDescription', { defaultMessage: 'HSV color mode saturation and value selection', }), @@ -443,46 +851,145 @@ export const getEuiContextMapping = () => { values={{ searchValue }} /> ), + 'euiSelectable.placeholderName': i18n.translate('core.euiSelectable.placeholderName', { + defaultMessage: 'Filter options', + }), + 'euiSelectableListItem.includedOption': i18n.translate( + 'core.euiSelectableListItem.includedOption', + { + defaultMessage: 'Included option.', + } + ), + 'euiSelectableListItem.includedOptionInstructions': i18n.translate( + 'core.euiSelectableListItem.includedOptionInstructions', + { + defaultMessage: 'To exclude this option, press enter.', + } + ), + 'euiSelectableListItem.excludedOption': i18n.translate( + 'core.euiSelectableListItem.excludedOption', + { + defaultMessage: 'Excluded option.', + } + ), + 'euiSelectableListItem.excludedOptionInstructions': i18n.translate( + 'core.euiSelectableListItem.excludedOptionInstructions', + { + defaultMessage: 'To deselect this option, press enter', + } + ), + 'euiSelectableTemplateSitewide.loadingResults': i18n.translate( + 'core.euiSelectableTemplateSitewide.loadingResults', + { + defaultMessage: 'Loading results', + } + ), + 'euiSelectableTemplateSitewide.noResults': i18n.translate( + 'core.euiSelectableTemplateSitewide.noResults', + { + defaultMessage: 'No results available', + } + ), + 'euiSelectableTemplateSitewide.onFocusBadgeGoTo': i18n.translate( + 'core.euiSelectableTemplateSitewide.onFocusBadgeGoTo', + { + defaultMessage: 'Go to', + } + ), + 'euiSelectableTemplateSitewide.searchPlaceholder': i18n.translate( + 'core.euiSelectableTemplateSitewide.searchPlaceholder', + { + defaultMessage: 'Search for anything...', + } + ), 'euiStat.loadingText': i18n.translate('core.euiStat.loadingText', { defaultMessage: 'Statistic is loading', }), - 'euiStep.ariaLabel': ({ status }: EuiValues) => - i18n.translate('core.euiStep.ariaLabel', { - defaultMessage: '{stepStatus}', - values: { stepStatus: status === 'incomplete' ? 'Incomplete Step' : 'Step' }, - }), - 'euiStepHorizontal.buttonTitle': ({ step, title, disabled, isComplete }: EuiValues) => { - return i18n.translate('core.euiStepHorizontal.buttonTitle', { - defaultMessage: 'Step {step}: {title}{titleAppendix}', - values: { - step, - title, - titleAppendix: disabled ? ' is disabled' : isComplete ? ' is complete' : '', - }, - }); - }, - 'euiStepHorizontal.step': i18n.translate('core.euiStepHorizontal.step', { - defaultMessage: 'Step', - description: 'Screen reader text announcing information about a step in some process', - }), - 'euiStepNumber.hasErrors': i18n.translate('core.euiStepNumber.hasErrors', { - defaultMessage: 'has errors', - description: - 'Used as the title attribute on an image or svg icon to indicate a given process step has errors', - }), - 'euiStepNumber.hasWarnings': i18n.translate('core.euiStepNumber.hasWarnings', { - defaultMessage: 'has warnings', - description: - 'Used as the title attribute on an image or svg icon to indicate a given process step has warnings', - }), - 'euiStepNumber.isComplete': i18n.translate('core.euiStepNumber.isComplete', { - defaultMessage: 'complete', - description: - 'Used as the title attribute on an image or svg icon to indicate a given process step is complete', - }), + 'euiStepStrings.step': ({ number, title }: EuiValues) => + i18n.translate('core.euiStepStrings.step', { + defaultMessage: 'Step {number}: {title}', + values: { number, title }, + }), + 'euiStepStrings.simpleStep': ({ number }: EuiValues) => + i18n.translate('core.euiStepStrings.simpleStep', { + defaultMessage: 'Step {number}', + values: { number }, + }), + 'euiStepStrings.complete': ({ number, title }: EuiValues) => + i18n.translate('core.euiStepStrings.complete', { + defaultMessage: 'Step {number}: {title} is complete', + values: { number, title }, + }), + 'euiStepStrings.simpleComplete': ({ number }: EuiValues) => + i18n.translate('core.euiStepStrings.simpleComplete', { + defaultMessage: 'Step {number} is complete', + values: { number }, + }), + 'euiStepStrings.warning': ({ number, title }: EuiValues) => + i18n.translate('core.euiStepStrings.warning', { + defaultMessage: 'Step {number}: {title} has warnings', + values: { number, title }, + }), + 'euiStepStrings.simpleWarning': ({ number }: EuiValues) => + i18n.translate('core.euiStepStrings.simpleWarning', { + defaultMessage: 'Step {number} has warnings', + values: { number }, + }), + 'euiStepStrings.errors': ({ number, title }: EuiValues) => + i18n.translate('core.euiStepStrings.errors', { + defaultMessage: 'Step {number}: {title} has errors', + values: { number, title }, + }), + 'euiStepStrings.simpleErrors': ({ number }: EuiValues) => + i18n.translate('core.euiStepStrings.simpleErrors', { + defaultMessage: 'Step {number} has errors', + values: { number }, + }), + 'euiStepStrings.incomplete': ({ number, title }: EuiValues) => + i18n.translate('core.euiStepStrings.incomplete', { + defaultMessage: 'Step {number}: {title} is incomplete', + values: { number, title }, + }), + 'euiStepStrings.simpleIncomplete': ({ number }: EuiValues) => + i18n.translate('core.euiStepStrings.simpleIncomplete', { + defaultMessage: 'Step {number} is incomplete', + values: { number }, + }), + 'euiStepStrings.disabled': ({ number, title }: EuiValues) => + i18n.translate('core.euiStepStrings.disabled', { + defaultMessage: 'Step {number}: {title} is disabled', + values: { number, title }, + }), + 'euiStepStrings.simpleDisabled': ({ number }: EuiValues) => + i18n.translate('core.euiStepStrings.simpleDisabled', { + defaultMessage: 'Step {number} is disabled', + values: { number }, + }), + 'euiStepStrings.loading': ({ number, title }: EuiValues) => + i18n.translate('core.euiStepStrings.loading', { + defaultMessage: 'Step {number}: {title} is loading', + values: { number, title }, + }), + 'euiStepStrings.simpleLoading': ({ number }: EuiValues) => + i18n.translate('core.euiStepStrings.simpleLoading', { + defaultMessage: 'Step {number} is loading', + values: { number }, + }), 'euiStyleSelector.buttonText': i18n.translate('core.euiStyleSelector.buttonText', { defaultMessage: 'Density', }), + 'euiStyleSelector.buttonLegend': i18n.translate('core.euiStyleSelector.buttonLegend', { + defaultMessage: 'Select the display density for the data grid', + }), + 'euiStyleSelector.labelExpanded': i18n.translate('core.euiStyleSelector.labelExpanded', { + defaultMessage: 'Expanded density', + }), + 'euiStyleSelector.labelNormal': i18n.translate('core.euiStyleSelector.labelNormal', { + defaultMessage: 'Normal density', + }), + 'euiStyleSelector.labelCompact': i18n.translate('core.euiStyleSelector.labelCompact', { + defaultMessage: 'Compact density', + }), 'euiSuperDatePicker.showDatesButtonLabel': i18n.translate( 'core.euiSuperDatePicker.showDatesButtonLabel', { @@ -536,6 +1043,30 @@ export const getEuiContextMapping = () => { description: 'Displayed in a button that updates based on date picked', } ), + 'euiTableHeaderCell.clickForAscending': i18n.translate( + 'core.euiTableHeaderCell.clickForAscending', + { + defaultMessage: 'Click to sort in ascending order', + description: 'Displayed in a button that toggles a table sorting', + } + ), + 'euiTableHeaderCell.clickForDescending': i18n.translate( + 'core.euiTableHeaderCell.clickForDescending', + { + defaultMessage: 'Click to sort in descending order', + description: 'Displayed in a button that toggles a table sorting', + } + ), + 'euiTableHeaderCell.clickForUnsort': i18n.translate('core.euiTableHeaderCell.clickForUnsort', { + defaultMessage: 'Click to unsort', + description: 'Displayed in a button that toggles a table sorting', + }), + 'euiTableHeaderCell.titleTextWithSort': ({ innerText, ariaSortValue }: EuiValues) => + i18n.translate('core.euiTableHeaderCell.titleTextWithSort', { + defaultMessage: '{innerText}; Sorted in {ariaSortValue} order', + values: { innerText, ariaSortValue }, + description: 'Text describing the table sort order', + }), 'euiTablePagination.rowsPerPage': i18n.translate('core.euiTablePagination.rowsPerPage', { defaultMessage: 'Rows per page', description: 'Displayed in a button that toggles a table pagination menu', @@ -560,6 +1091,33 @@ export const getEuiContextMapping = () => { defaultMessage: 'Notification', description: 'ARIA label on an element containing a notification', }), + 'euiTour.endTour': i18n.translate('core.euiTour.endTour', { + defaultMessage: 'End tour', + }), + 'euiTour.skipTour': i18n.translate('core.euiTour.skipTour', { + defaultMessage: 'Skip tour', + }), + 'euiTour.closeTour': i18n.translate('core.euiTour.closeTour', { + defaultMessage: 'Close tour', + }), + 'euiTourStepIndicator.isActive': i18n.translate('core.euiTourStepIndicator.isActive', { + defaultMessage: 'active', + description: 'Text for an active tour step', + }), + 'euiTourStepIndicator.isComplete': i18n.translate('core.euiTourStepIndicator.isComplete', { + defaultMessage: 'complete', + description: 'Text for a completed tour step', + }), + 'euiTourStepIndicator.isIncomplete': i18n.translate('core.euiTourStepIndicator.isIncomplete', { + defaultMessage: 'incomplete', + description: 'Text for an incomplete tour step', + }), + 'euiTourStepIndicator.ariaLabel': ({ status, number }: EuiValues) => + i18n.translate('core.euiTourStepIndicator.ariaLabel', { + defaultMessage: 'Step {number} {status}', + values: { status, number }, + description: 'Screen reader text describing the state of a tour step', + }), 'euiTreeView.ariaLabel': ({ nodeLabel, ariaLabel }: EuiValues) => i18n.translate('core.euiTreeView.ariaLabel', { defaultMessage: '{nodeLabel} child of {ariaLabel}', diff --git a/src/core/public/public.api.md b/src/core/public/public.api.md index 18133ebec3353..b3ded52a98171 100644 --- a/src/core/public/public.api.md +++ b/src/core/public/public.api.md @@ -490,6 +490,9 @@ export interface DocLinksStart { readonly ELASTIC_WEBSITE_URL: string; // (undocumented) readonly links: { + readonly canvas: { + readonly guide: string; + }; readonly dashboard: { readonly guide: string; readonly drilldowns: string; diff --git a/src/core/server/core_app/core_app.ts b/src/core/server/core_app/core_app.ts index bc1098832bac5..e728cb0b82475 100644 --- a/src/core/server/core_app/core_app.ts +++ b/src/core/server/core_app/core_app.ts @@ -65,7 +65,7 @@ export class CoreApp { async (context, req, res) => { const { query, params } = req; const { path } = params; - if (!path || !path.endsWith('/')) { + if (!path || !path.endsWith('/') || path.startsWith('/')) { return res.notFound(); } diff --git a/src/core/server/core_app/integration_tests/core_app_routes.test.ts b/src/core/server/core_app/integration_tests/core_app_routes.test.ts index 6b0643f7d1bc7..faa1c905afa9d 100644 --- a/src/core/server/core_app/integration_tests/core_app_routes.test.ts +++ b/src/core/server/core_app/integration_tests/core_app_routes.test.ts @@ -39,6 +39,10 @@ describe('Core app routes', () => { expect(response.get('location')).toEqual('/base-path/some-path?foo=bar'); }); + it('does not redirect if the path starts with `//`', async () => { + await kbnTestServer.request.get(root, '//some-path/').expect(404); + }); + it('does not redirect if the path does not end with `/`', async () => { await kbnTestServer.request.get(root, '/some-path').expect(404); }); diff --git a/src/core/server/core_usage_data/core_usage_data_service.mock.ts b/src/core/server/core_usage_data/core_usage_data_service.mock.ts index 7fb15a921a413..e09f595747c30 100644 --- a/src/core/server/core_usage_data/core_usage_data_service.mock.ts +++ b/src/core/server/core_usage_data/core_usage_data_service.mock.ts @@ -139,6 +139,7 @@ const createStartContractMock = () => { }, }) ), + getConfigsUsageData: jest.fn(), }; return startContract; diff --git a/src/core/server/core_usage_data/core_usage_data_service.test.ts b/src/core/server/core_usage_data/core_usage_data_service.test.ts index d1f047c129efe..dc74b65c8dcfc 100644 --- a/src/core/server/core_usage_data/core_usage_data_service.test.ts +++ b/src/core/server/core_usage_data/core_usage_data_service.test.ts @@ -35,7 +35,35 @@ describe('CoreUsageDataService', () => { }); let service: CoreUsageDataService; - const configService = configServiceMock.create(); + const mockConfig = { + unused_config: {}, + elasticsearch: { username: 'kibana_system', password: 'changeme' }, + plugins: { paths: ['pluginA', 'pluginAB', 'pluginB'] }, + server: { port: 5603, basePath: '/zvt', rewriteBasePath: true }, + logging: { json: false }, + pluginA: { + enabled: true, + objectConfig: { + debug: true, + username: 'some_user', + }, + arrayOfNumbers: [1, 2, 3], + }, + pluginAB: { + enabled: false, + }, + pluginB: { + arrayOfObjects: [ + { propA: 'a', propB: 'b' }, + { propA: 'a2', propB: 'b2' }, + ], + }, + }; + + const configService = configServiceMock.create({ + getConfig$: mockConfig, + }); + configService.atPath.mockImplementation((path) => { if (path === 'elasticsearch') { return new BehaviorSubject(RawElasticsearchConfig.schema.validate({})); @@ -146,6 +174,7 @@ describe('CoreUsageDataService', () => { const { getCoreUsageData } = service.start({ savedObjects: savedObjectsServiceMock.createInternalStartContract(typeRegistry), + exposedConfigsToUsage: new Map(), elasticsearch, }); expect(getCoreUsageData()).resolves.toMatchInlineSnapshot(` @@ -281,6 +310,453 @@ describe('CoreUsageDataService', () => { `); }); }); + + describe('getConfigsUsageData', () => { + const elasticsearch = elasticsearchServiceMock.createStart(); + const typeRegistry = savedObjectsServiceMock.createTypeRegistryMock(); + let exposedConfigsToUsage: Map>; + beforeEach(() => { + exposedConfigsToUsage = new Map(); + }); + + it('loops over all used configs once each', async () => { + configService.getUsedPaths.mockResolvedValue([ + 'pluginA.objectConfig.debug', + 'logging.json', + ]); + + exposedConfigsToUsage.set('pluginA', { + objectConfig: true, + }); + + const { getConfigsUsageData } = service.start({ + savedObjects: savedObjectsServiceMock.createInternalStartContract(typeRegistry), + exposedConfigsToUsage, + elasticsearch, + }); + + const mockGetMarkedAsSafe = jest.fn().mockReturnValue({}); + // @ts-expect-error + service.getMarkedAsSafe = mockGetMarkedAsSafe; + await getConfigsUsageData(); + + expect(mockGetMarkedAsSafe).toBeCalledTimes(2); + expect(mockGetMarkedAsSafe.mock.calls).toMatchInlineSnapshot(` + Array [ + Array [ + Map { + "pluginA" => Object { + "objectConfig": true, + }, + }, + "pluginA.objectConfig.debug", + "pluginA", + ], + Array [ + Map { + "pluginA" => Object { + "objectConfig": true, + }, + }, + "logging.json", + undefined, + ], + ] + `); + }); + + it('plucks pluginId from config path correctly', async () => { + exposedConfigsToUsage.set('pluginA', { + enabled: false, + }); + exposedConfigsToUsage.set('pluginAB', { + enabled: false, + }); + + configService.getUsedPaths.mockResolvedValue(['pluginA.enabled', 'pluginAB.enabled']); + + const { getConfigsUsageData } = service.start({ + savedObjects: savedObjectsServiceMock.createInternalStartContract(typeRegistry), + exposedConfigsToUsage, + elasticsearch, + }); + + await expect(getConfigsUsageData()).resolves.toMatchInlineSnapshot(` + Object { + "pluginA.enabled": "[redacted]", + "pluginAB.enabled": "[redacted]", + } + `); + }); + + it('returns an object of plugin config usage', async () => { + exposedConfigsToUsage.set('unused_config', { never_reported: true }); + exposedConfigsToUsage.set('server', { basePath: true }); + exposedConfigsToUsage.set('pluginA', { elasticsearch: false }); + exposedConfigsToUsage.set('plugins', { paths: false }); + exposedConfigsToUsage.set('pluginA', { arrayOfNumbers: false }); + + configService.getUsedPaths.mockResolvedValue([ + 'elasticsearch.username', + 'elasticsearch.password', + 'plugins.paths', + 'server.port', + 'server.basePath', + 'server.rewriteBasePath', + 'logging.json', + 'pluginA.enabled', + 'pluginA.objectConfig.debug', + 'pluginA.objectConfig.username', + 'pluginA.arrayOfNumbers', + 'pluginAB.enabled', + 'pluginB.arrayOfObjects', + ]); + + const { getConfigsUsageData } = service.start({ + savedObjects: savedObjectsServiceMock.createInternalStartContract(typeRegistry), + exposedConfigsToUsage, + elasticsearch, + }); + + await expect(getConfigsUsageData()).resolves.toMatchInlineSnapshot(` + Object { + "elasticsearch.password": "[redacted]", + "elasticsearch.username": "[redacted]", + "logging.json": false, + "pluginA.arrayOfNumbers": "[redacted]", + "pluginA.enabled": true, + "pluginA.objectConfig.debug": true, + "pluginA.objectConfig.username": "[redacted]", + "pluginAB.enabled": false, + "pluginB.arrayOfObjects": "[redacted]", + "plugins.paths": "[redacted]", + "server.basePath": "/zvt", + "server.port": 5603, + "server.rewriteBasePath": true, + } + `); + }); + + describe('config explicitly exposed to usage', () => { + it('returns [redacted] on unsafe complete match', async () => { + exposedConfigsToUsage.set('pluginA', { + 'objectConfig.debug': false, + }); + exposedConfigsToUsage.set('server', { + basePath: false, + }); + + configService.getUsedPaths.mockResolvedValue([ + 'pluginA.objectConfig.debug', + 'server.basePath', + ]); + + const { getConfigsUsageData } = service.start({ + savedObjects: savedObjectsServiceMock.createInternalStartContract(typeRegistry), + exposedConfigsToUsage, + elasticsearch, + }); + + await expect(getConfigsUsageData()).resolves.toMatchInlineSnapshot(` + Object { + "pluginA.objectConfig.debug": "[redacted]", + "server.basePath": "[redacted]", + } + `); + }); + + it('returns config value on safe complete match', async () => { + exposedConfigsToUsage.set('server', { + basePath: true, + }); + + configService.getUsedPaths.mockResolvedValue(['server.basePath']); + + const { getConfigsUsageData } = service.start({ + savedObjects: savedObjectsServiceMock.createInternalStartContract(typeRegistry), + exposedConfigsToUsage, + elasticsearch, + }); + + await expect(getConfigsUsageData()).resolves.toMatchInlineSnapshot(` + Object { + "server.basePath": "/zvt", + } + `); + }); + + it('returns [redacted] on unsafe parent match', async () => { + exposedConfigsToUsage.set('pluginA', { + objectConfig: false, + }); + + configService.getUsedPaths.mockResolvedValue([ + 'pluginA.objectConfig.debug', + 'pluginA.objectConfig.username', + ]); + + const { getConfigsUsageData } = service.start({ + savedObjects: savedObjectsServiceMock.createInternalStartContract(typeRegistry), + exposedConfigsToUsage, + elasticsearch, + }); + + await expect(getConfigsUsageData()).resolves.toMatchInlineSnapshot(` + Object { + "pluginA.objectConfig.debug": "[redacted]", + "pluginA.objectConfig.username": "[redacted]", + } + `); + }); + + it('returns config value on safe parent match', async () => { + exposedConfigsToUsage.set('pluginA', { + objectConfig: true, + }); + + configService.getUsedPaths.mockResolvedValue([ + 'pluginA.objectConfig.debug', + 'pluginA.objectConfig.username', + ]); + + const { getConfigsUsageData } = service.start({ + savedObjects: savedObjectsServiceMock.createInternalStartContract(typeRegistry), + exposedConfigsToUsage, + elasticsearch, + }); + + await expect(getConfigsUsageData()).resolves.toMatchInlineSnapshot(` + Object { + "pluginA.objectConfig.debug": true, + "pluginA.objectConfig.username": "some_user", + } + `); + }); + + it('returns [redacted] on explicitly marked as safe array of objects', async () => { + exposedConfigsToUsage.set('pluginB', { + arrayOfObjects: true, + }); + + configService.getUsedPaths.mockResolvedValue(['pluginB.arrayOfObjects']); + + const { getConfigsUsageData } = service.start({ + savedObjects: savedObjectsServiceMock.createInternalStartContract(typeRegistry), + exposedConfigsToUsage, + elasticsearch, + }); + + await expect(getConfigsUsageData()).resolves.toMatchInlineSnapshot(` + Object { + "pluginB.arrayOfObjects": "[redacted]", + } + `); + }); + + it('returns values on explicitly marked as safe array of numbers', async () => { + exposedConfigsToUsage.set('pluginA', { + arrayOfNumbers: true, + }); + + configService.getUsedPaths.mockResolvedValue(['pluginA.arrayOfNumbers']); + + const { getConfigsUsageData } = service.start({ + savedObjects: savedObjectsServiceMock.createInternalStartContract(typeRegistry), + exposedConfigsToUsage, + elasticsearch, + }); + + await expect(getConfigsUsageData()).resolves.toMatchInlineSnapshot(` + Object { + "pluginA.arrayOfNumbers": Array [ + 1, + 2, + 3, + ], + } + `); + }); + + it('returns values on explicitly marked as safe array of strings', async () => { + exposedConfigsToUsage.set('plugins', { + paths: true, + }); + + configService.getUsedPaths.mockResolvedValue(['plugins.paths']); + + const { getConfigsUsageData } = service.start({ + savedObjects: savedObjectsServiceMock.createInternalStartContract(typeRegistry), + exposedConfigsToUsage, + elasticsearch, + }); + + await expect(getConfigsUsageData()).resolves.toMatchInlineSnapshot(` + Object { + "plugins.paths": Array [ + "pluginA", + "pluginAB", + "pluginB", + ], + } + `); + }); + }); + + describe('config not explicitly exposed to usage', () => { + it('returns [redacted] for string configs', async () => { + exposedConfigsToUsage.set('pluginA', { + objectConfig: false, + }); + + configService.getUsedPaths.mockResolvedValue([ + 'pluginA.objectConfig.debug', + 'pluginA.objectConfig.username', + ]); + + const { getConfigsUsageData } = service.start({ + savedObjects: savedObjectsServiceMock.createInternalStartContract(typeRegistry), + exposedConfigsToUsage, + elasticsearch, + }); + + await expect(getConfigsUsageData()).resolves.toMatchInlineSnapshot(` + Object { + "pluginA.objectConfig.debug": "[redacted]", + "pluginA.objectConfig.username": "[redacted]", + } + `); + }); + + it('returns config value on safe parent match', async () => { + configService.getUsedPaths.mockResolvedValue([ + 'elasticsearch.password', + 'elasticsearch.username', + 'pluginA.objectConfig.username', + ]); + + const { getConfigsUsageData } = service.start({ + savedObjects: savedObjectsServiceMock.createInternalStartContract(typeRegistry), + exposedConfigsToUsage, + elasticsearch, + }); + + await expect(getConfigsUsageData()).resolves.toMatchInlineSnapshot(` + Object { + "elasticsearch.password": "[redacted]", + "elasticsearch.username": "[redacted]", + "pluginA.objectConfig.username": "[redacted]", + } + `); + }); + + it('returns [redacted] on implicit array of objects', async () => { + configService.getUsedPaths.mockResolvedValue(['pluginB.arrayOfObjects']); + + const { getConfigsUsageData } = service.start({ + savedObjects: savedObjectsServiceMock.createInternalStartContract(typeRegistry), + exposedConfigsToUsage, + elasticsearch, + }); + + await expect(getConfigsUsageData()).resolves.toMatchInlineSnapshot(` + Object { + "pluginB.arrayOfObjects": "[redacted]", + } + `); + }); + + it('returns values on implicit array of numbers', async () => { + configService.getUsedPaths.mockResolvedValue(['pluginA.arrayOfNumbers']); + + const { getConfigsUsageData } = service.start({ + savedObjects: savedObjectsServiceMock.createInternalStartContract(typeRegistry), + exposedConfigsToUsage, + elasticsearch, + }); + + await expect(getConfigsUsageData()).resolves.toMatchInlineSnapshot(` + Object { + "pluginA.arrayOfNumbers": Array [ + 1, + 2, + 3, + ], + } + `); + }); + it('returns [redacted] on implicit array of strings', async () => { + configService.getUsedPaths.mockResolvedValue(['plugins.paths']); + + const { getConfigsUsageData } = service.start({ + savedObjects: savedObjectsServiceMock.createInternalStartContract(typeRegistry), + exposedConfigsToUsage, + elasticsearch, + }); + + await expect(getConfigsUsageData()).resolves.toMatchInlineSnapshot(` + Object { + "plugins.paths": "[redacted]", + } + `); + }); + + it('returns config value for numbers', async () => { + configService.getUsedPaths.mockResolvedValue(['server.port']); + + const { getConfigsUsageData } = service.start({ + savedObjects: savedObjectsServiceMock.createInternalStartContract(typeRegistry), + exposedConfigsToUsage, + elasticsearch, + }); + + await expect(getConfigsUsageData()).resolves.toMatchInlineSnapshot(` + Object { + "server.port": 5603, + } + `); + }); + + it('returns config value for booleans', async () => { + configService.getUsedPaths.mockResolvedValue([ + 'pluginA.objectConfig.debug', + 'logging.json', + ]); + + const { getConfigsUsageData } = service.start({ + savedObjects: savedObjectsServiceMock.createInternalStartContract(typeRegistry), + exposedConfigsToUsage, + elasticsearch, + }); + + await expect(getConfigsUsageData()).resolves.toMatchInlineSnapshot(` + Object { + "logging.json": false, + "pluginA.objectConfig.debug": true, + } + `); + }); + + it('ignores exposed to usage configs but not used', async () => { + exposedConfigsToUsage.set('pluginA', { + objectConfig: true, + }); + + configService.getUsedPaths.mockResolvedValue(['logging.json']); + + const { getConfigsUsageData } = service.start({ + savedObjects: savedObjectsServiceMock.createInternalStartContract(typeRegistry), + exposedConfigsToUsage, + elasticsearch, + }); + + await expect(getConfigsUsageData()).resolves.toMatchInlineSnapshot(` + Object { + "logging.json": false, + } + `); + }); + }); + }); }); describe('setup and stop', () => { diff --git a/src/core/server/core_usage_data/core_usage_data_service.ts b/src/core/server/core_usage_data/core_usage_data_service.ts index 78ac977c31a7d..85abdca9ea5dc 100644 --- a/src/core/server/core_usage_data/core_usage_data_service.ts +++ b/src/core/server/core_usage_data/core_usage_data_service.ts @@ -7,7 +7,9 @@ */ import { Subject } from 'rxjs'; -import { takeUntil } from 'rxjs/operators'; +import { takeUntil, first } from 'rxjs/operators'; +import { get } from 'lodash'; +import { hasConfigPathIntersection } from '@kbn/config'; import { CoreService } from 'src/core/types'; import { Logger, SavedObjectsServiceStart, SavedObjectTypeRegistry } from 'src/core/server'; @@ -16,11 +18,12 @@ import { ElasticsearchConfigType } from '../elasticsearch/elasticsearch_config'; import { HttpConfigType, InternalHttpServiceSetup } from '../http'; import { LoggingConfigType } from '../logging'; import { SavedObjectsConfigType } from '../saved_objects/saved_objects_config'; -import { +import type { CoreServicesUsageData, CoreUsageData, CoreUsageDataStart, CoreUsageDataSetup, + ConfigUsageData, } from './types'; import { isConfigured } from './is_configured'; import { ElasticsearchServiceStart } from '../elasticsearch'; @@ -30,6 +33,8 @@ import { CORE_USAGE_STATS_TYPE } from './constants'; import { CoreUsageStatsClient } from './core_usage_stats_client'; import { MetricsServiceSetup, OpsMetrics } from '..'; +export type ExposedConfigsToUsage = Map>; + export interface SetupDeps { http: InternalHttpServiceSetup; metrics: MetricsServiceSetup; @@ -39,6 +44,7 @@ export interface SetupDeps { export interface StartDeps { savedObjects: SavedObjectsServiceStart; elasticsearch: ElasticsearchServiceStart; + exposedConfigsToUsage: ExposedConfigsToUsage; } /** @@ -266,6 +272,110 @@ export class CoreUsageDataService implements CoreService { + const fullPath = `${pluginId}.${exposeKey}`; + return hasConfigPathIntersection(usedPath, fullPath); + }); + + if (exposeKeyDetails) { + const explicitlyMarkedAsSafe = exposeDetails[exposeKeyDetails]; + + if (typeof explicitlyMarkedAsSafe === 'boolean') { + return { + explicitlyMarked: true, + isSafe: explicitlyMarkedAsSafe, + }; + } + } + } + + return { explicitlyMarked: false, isSafe: false }; + } + + private async getNonDefaultKibanaConfigs( + exposedConfigsToUsage: ExposedConfigsToUsage + ): Promise { + const config = await this.configService.getConfig$().pipe(first()).toPromise(); + const nonDefaultConfigs = config.toRaw(); + const usedPaths = await this.configService.getUsedPaths(); + const exposedConfigsKeys = [...exposedConfigsToUsage.keys()]; + + return usedPaths.reduce((acc, usedPath) => { + const rawConfigValue = get(nonDefaultConfigs, usedPath); + const pluginId = exposedConfigsKeys.find( + (exposedConfigsKey) => + usedPath === exposedConfigsKey || usedPath.startsWith(`${exposedConfigsKey}.`) + ); + + const { explicitlyMarked, isSafe } = this.getMarkedAsSafe( + exposedConfigsToUsage, + usedPath, + pluginId + ); + + // explicitly marked as safe + if (explicitlyMarked && isSafe) { + // report array of objects as redacted even if explicitly marked as safe. + // TS typings prevent explicitly marking arrays of objects as safe + // this makes sure to report redacted even if TS was bypassed. + if ( + Array.isArray(rawConfigValue) && + rawConfigValue.some((item) => typeof item === 'object') + ) { + acc[usedPath] = '[redacted]'; + } else { + acc[usedPath] = rawConfigValue; + } + } + + // explicitly marked as unsafe + if (explicitlyMarked && !isSafe) { + acc[usedPath] = '[redacted]'; + } + + /** + * not all types of values may contain sensitive values. + * Report boolean and number configs if not explicitly marked as unsafe. + */ + if (!explicitlyMarked) { + switch (typeof rawConfigValue) { + case 'number': + case 'boolean': + acc[usedPath] = rawConfigValue; + break; + case 'undefined': + acc[usedPath] = 'undefined'; + break; + case 'object': { + // non-array object types are already handled + if (Array.isArray(rawConfigValue)) { + if ( + rawConfigValue.every( + (item) => typeof item === 'number' || typeof item === 'boolean' + ) + ) { + acc[usedPath] = rawConfigValue; + break; + } + } + } + default: { + acc[usedPath] = '[redacted]'; + } + } + } + + return acc; + }, {} as Record); + } + setup({ http, metrics, savedObjectsStartPromise }: SetupDeps) { metrics .getOpsMetrics$() @@ -326,10 +436,13 @@ export class CoreUsageDataService implements CoreService { - return this.getCoreUsageData(savedObjects, elasticsearch); + getCoreUsageData: async () => { + return await this.getCoreUsageData(savedObjects, elasticsearch); + }, + getConfigsUsageData: async () => { + return await this.getNonDefaultKibanaConfigs(exposedConfigsToUsage); }, }; } diff --git a/src/core/server/core_usage_data/index.ts b/src/core/server/core_usage_data/index.ts index 4e0200ed1e4ea..638fc65522433 100644 --- a/src/core/server/core_usage_data/index.ts +++ b/src/core/server/core_usage_data/index.ts @@ -6,7 +6,7 @@ * Side Public License, v 1. */ -export type { CoreUsageDataSetup, CoreUsageDataStart } from './types'; +export type { CoreUsageDataSetup, ConfigUsageData, CoreUsageDataStart } from './types'; export { CoreUsageDataService } from './core_usage_data_service'; export { CoreUsageStatsClient } from './core_usage_stats_client'; diff --git a/src/core/server/core_usage_data/types.ts b/src/core/server/core_usage_data/types.ts index b29cf41da6826..1d5ef6d893f53 100644 --- a/src/core/server/core_usage_data/types.ts +++ b/src/core/server/core_usage_data/types.ts @@ -122,6 +122,18 @@ export interface CoreUsageData extends CoreUsageStats { environment: CoreEnvironmentUsageData; } +/** + * Type describing Core's usage data payload + * @internal + */ +export type ConfigUsageData = Record; + +/** + * Type describing Core's usage data payload + * @internal + */ +export type ExposedConfigsToUsage = Map>; + /** * Usage data from Core services * @internal @@ -270,4 +282,5 @@ export interface CoreUsageDataStart { * @internal * */ getCoreUsageData(): Promise; + getConfigsUsageData(): Promise; } diff --git a/src/core/server/environment/write_pid_file.ts b/src/core/server/environment/write_pid_file.ts index b7d47111a4d53..46096ca347e8a 100644 --- a/src/core/server/environment/write_pid_file.ts +++ b/src/core/server/environment/write_pid_file.ts @@ -31,13 +31,23 @@ export const writePidFile = async ({ if (pidConfig.exclusive) { throw new Error(message); } else { - logger.warn(message, { path, pid }); + logger.warn(message, { + process: { + pid: process.pid, + path, + }, + }); } } await writeFile(path, pid); - logger.debug(`wrote pid file to ${path}`, { path, pid }); + logger.debug(`wrote pid file to ${path}`, { + process: { + pid: process.pid, + path, + }, + }); const clean = once(() => { unlink(path); diff --git a/src/core/server/http/__snapshots__/http_config.test.ts.snap b/src/core/server/http/__snapshots__/http_config.test.ts.snap index 589e4e118991a..42710aad40ac1 100644 --- a/src/core/server/http/__snapshots__/http_config.test.ts.snap +++ b/src/core/server/http/__snapshots__/http_config.test.ts.snap @@ -71,6 +71,7 @@ Object { "strictTransportSecurity": null, "xContentTypeOptions": "nosniff", }, + "shutdownTimeout": "PT30S", "socketTimeout": 120000, "ssl": Object { "cipherSuites": Array [ diff --git a/src/core/server/http/http_config.test.ts b/src/core/server/http/http_config.test.ts index 9868d89888110..2a140388cc184 100644 --- a/src/core/server/http/http_config.test.ts +++ b/src/core/server/http/http_config.test.ts @@ -108,6 +108,35 @@ test('can specify max payload as string', () => { expect(configValue.maxPayload.getValueInBytes()).toBe(2 * 1024 * 1024); }); +describe('shutdownTimeout', () => { + test('can specify a valid shutdownTimeout', () => { + const configValue = config.schema.validate({ shutdownTimeout: '5s' }); + expect(configValue.shutdownTimeout.asMilliseconds()).toBe(5000); + }); + + test('can specify a valid shutdownTimeout (lower-edge of 1 second)', () => { + const configValue = config.schema.validate({ shutdownTimeout: '1s' }); + expect(configValue.shutdownTimeout.asMilliseconds()).toBe(1000); + }); + + test('can specify a valid shutdownTimeout (upper-edge of 2 minutes)', () => { + const configValue = config.schema.validate({ shutdownTimeout: '2m' }); + expect(configValue.shutdownTimeout.asMilliseconds()).toBe(120000); + }); + + test('should error if below 1s', () => { + expect(() => config.schema.validate({ shutdownTimeout: '100ms' })).toThrow( + '[shutdownTimeout]: the value should be between 1 second and 2 minutes' + ); + }); + + test('should error if over 2 minutes', () => { + expect(() => config.schema.validate({ shutdownTimeout: '3m' })).toThrow( + '[shutdownTimeout]: the value should be between 1 second and 2 minutes' + ); + }); +}); + describe('basePath', () => { test('throws if missing prepended slash', () => { const httpSchema = config.schema; diff --git a/src/core/server/http/http_config.ts b/src/core/server/http/http_config.ts index c7e53bb600377..9d0008e1c4011 100644 --- a/src/core/server/http/http_config.ts +++ b/src/core/server/http/http_config.ts @@ -11,6 +11,7 @@ import { IHttpConfig, SslConfig, sslSchema } from '@kbn/server-http-tools'; import { hostname } from 'os'; import url from 'url'; +import type { Duration } from 'moment'; import { ServiceConfigDescriptor } from '../internal_types'; import { CspConfigType, CspConfig, ICspConfig } from '../csp'; import { ExternalUrlConfig, IExternalUrlConfig } from '../external_url'; @@ -35,6 +36,15 @@ const configSchema = schema.object( validate: match(validBasePathRegex, "must start with a slash, don't end with one"), }) ), + shutdownTimeout: schema.duration({ + defaultValue: '30s', + validate: (duration) => { + const durationMs = duration.asMilliseconds(); + if (durationMs < 1000 || durationMs > 2 * 60 * 1000) { + return 'the value should be between 1 second and 2 minutes'; + } + }, + }), cors: schema.object( { enabled: schema.boolean({ defaultValue: false }), @@ -188,6 +198,7 @@ export class HttpConfig implements IHttpConfig { public externalUrl: IExternalUrlConfig; public xsrf: { disableProtection: boolean; allowlist: string[] }; public requestId: { allowFromAnyIp: boolean; ipAllowlist: string[] }; + public shutdownTimeout: Duration; /** * @internal @@ -227,6 +238,7 @@ export class HttpConfig implements IHttpConfig { this.externalUrl = rawExternalUrlConfig; this.xsrf = rawHttpConfig.xsrf; this.requestId = rawHttpConfig.requestId; + this.shutdownTimeout = rawHttpConfig.shutdownTimeout; } } diff --git a/src/core/server/http/http_server.test.ts b/src/core/server/http/http_server.test.ts index ccd14d4b99e11..1a82907849cea 100644 --- a/src/core/server/http/http_server.test.ts +++ b/src/core/server/http/http_server.test.ts @@ -26,6 +26,8 @@ import { HttpServer } from './http_server'; import { Readable } from 'stream'; import { RequestHandlerContext } from 'kibana/server'; import { KBN_CERT_PATH, KBN_KEY_PATH } from '@kbn/dev-utils'; +import moment from 'moment'; +import { of } from 'rxjs'; const cookieOptions = { name: 'sid', @@ -65,6 +67,7 @@ beforeEach(() => { cors: { enabled: false, }, + shutdownTimeout: moment.duration(500, 'ms'), } as any; configWithSSL = { @@ -79,7 +82,7 @@ beforeEach(() => { }, } as HttpConfig; - server = new HttpServer(loggingService, 'tests'); + server = new HttpServer(loggingService, 'tests', of(config.shutdownTimeout)); }); afterEach(async () => { @@ -1431,3 +1434,79 @@ describe('setup contract', () => { }); }); }); + +describe('Graceful shutdown', () => { + let shutdownTimeout: number; + let innerServerListener: Server; + + beforeEach(async () => { + shutdownTimeout = config.shutdownTimeout.asMilliseconds(); + const { registerRouter, server: innerServer } = await server.setup(config); + innerServerListener = innerServer.listener; + + const router = new Router('', logger, enhanceWithContext); + router.post( + { + path: '/', + validate: false, + options: { body: { accepts: 'application/json' } }, + }, + async (context, req, res) => { + // It takes to resolve the same period of the shutdownTimeout. + // Since we'll trigger the stop a few ms after, it should have time to finish + await new Promise((resolve) => setTimeout(resolve, shutdownTimeout)); + return res.ok({ body: { ok: 1 } }); + } + ); + registerRouter(router); + + await server.start(); + }); + + test('any ongoing requests should be resolved with `connection: close`', async () => { + const [response] = await Promise.all([ + // Trigger a request that should hold the server from stopping until fulfilled + supertest(innerServerListener).post('/'), + // Stop the server while the request is in progress + (async () => { + await new Promise((resolve) => setTimeout(resolve, shutdownTimeout / 3)); + await server.stop(); + })(), + ]); + + expect(response.status).toBe(200); + expect(response.body).toStrictEqual({ ok: 1 }); + // The server is about to be closed, we need to ask connections to close on their end (stop their keep-alive policies) + expect(response.header.connection).toBe('close'); + }); + + test('any requests triggered while stopping should be rejected with 503', async () => { + const [, , response] = await Promise.all([ + // Trigger a request that should hold the server from stopping until fulfilled (otherwise the server will stop straight away) + supertest(innerServerListener).post('/'), + // Stop the server while the request is in progress + (async () => { + await new Promise((resolve) => setTimeout(resolve, shutdownTimeout / 3)); + await server.stop(); + })(), + // Trigger a new request while shutting down (should be rejected) + (async () => { + await new Promise((resolve) => setTimeout(resolve, (2 * shutdownTimeout) / 3)); + return supertest(innerServerListener).post('/'); + })(), + ]); + expect(response.status).toBe(503); + expect(response.body).toStrictEqual({ + statusCode: 503, + error: 'Service Unavailable', + message: 'Kibana is shutting down and not accepting new incoming requests', + }); + expect(response.header.connection).toBe('close'); + }); + + test('when no ongoing connections, the server should stop without waiting any longer', async () => { + const preStop = Date.now(); + await server.stop(); + expect(Date.now() - preStop).toBeLessThan(shutdownTimeout); + }); +}); diff --git a/src/core/server/http/http_server.ts b/src/core/server/http/http_server.ts index cd7d7ccc5aeff..d845ac1b639b6 100644 --- a/src/core/server/http/http_server.ts +++ b/src/core/server/http/http_server.ts @@ -17,6 +17,9 @@ import { getRequestId, } from '@kbn/server-http-tools'; +import type { Duration } from 'moment'; +import { Observable } from 'rxjs'; +import { take } from 'rxjs/operators'; import { Logger, LoggerFactory } from '../logging'; import { HttpConfig } from './http_config'; import { adoptToHapiAuthFormat, AuthenticationHandler } from './lifecycle/auth'; @@ -80,6 +83,7 @@ export class HttpServer { private authRegistered = false; private cookieSessionStorageCreated = false; private handleServerResponseEvent?: (req: Request) => void; + private stopping = false; private stopped = false; private readonly log: Logger; @@ -87,7 +91,11 @@ export class HttpServer { private readonly authRequestHeaders: AuthHeadersStorage; private readonly authResponseHeaders: AuthHeadersStorage; - constructor(private readonly logger: LoggerFactory, private readonly name: string) { + constructor( + private readonly logger: LoggerFactory, + private readonly name: string, + private readonly shutdownTimeout$: Observable + ) { this.authState = new AuthStateStorage(() => this.authRegistered); this.authRequestHeaders = new AuthHeadersStorage(); this.authResponseHeaders = new AuthHeadersStorage(); @@ -118,6 +126,7 @@ export class HttpServer { this.setupConditionalCompression(config); this.setupResponseLogging(); this.setupRequestStateAssignment(config); + this.setupGracefulShutdownHandlers(); return { registerRouter: this.registerRouter.bind(this), @@ -153,7 +162,7 @@ export class HttpServer { if (this.server === undefined) { throw new Error('Http server is not setup up yet'); } - if (this.stopped) { + if (this.stopping || this.stopped) { this.log.warn(`start called after stop`); return; } @@ -213,19 +222,29 @@ export class HttpServer { } public async stop() { - this.stopped = true; + this.stopping = true; if (this.server === undefined) { + this.stopping = false; + this.stopped = true; return; } const hasStarted = this.server.info.started > 0; if (hasStarted) { this.log.debug('stopping http server'); + + const shutdownTimeout = await this.shutdownTimeout$.pipe(take(1)).toPromise(); + await this.server.stop({ timeout: shutdownTimeout.asMilliseconds() }); + + this.log.debug(`http server stopped`); + + // Removing the listener after stopping so we don't leave any pending requests unhandled if (this.handleServerResponseEvent) { this.server.events.removeListener('response', this.handleServerResponseEvent); } - await this.server.stop(); } + this.stopping = false; + this.stopped = true; } private getAuthOption( @@ -246,6 +265,18 @@ export class HttpServer { } } + private setupGracefulShutdownHandlers() { + this.registerOnPreRouting((request, response, toolkit) => { + if (this.stopping || this.stopped) { + return response.customError({ + statusCode: 503, + body: { message: 'Kibana is shutting down and not accepting new incoming requests' }, + }); + } + return toolkit.next(); + }); + } + private setupBasePathRewrite(config: HttpConfig, basePathService: BasePath) { if (config.basePath === undefined || !config.rewriteBasePath) { return; @@ -266,7 +297,7 @@ export class HttpServer { if (this.server === undefined) { throw new Error('Server is not created yet'); } - if (this.stopped) { + if (this.stopping || this.stopped) { this.log.warn(`setupConditionalCompression called after stop`); } @@ -296,14 +327,14 @@ export class HttpServer { if (this.server === undefined) { throw new Error('Server is not created yet'); } - if (this.stopped) { + if (this.stopping || this.stopped) { this.log.warn(`setupResponseLogging called after stop`); } const log = this.logger.get('http', 'server', 'response'); this.handleServerResponseEvent = (request) => { - const { message, ...meta } = getEcsResponseLog(request, this.log); + const { message, meta } = getEcsResponseLog(request, this.log); log.debug(message!, meta); }; @@ -325,7 +356,7 @@ export class HttpServer { if (this.server === undefined) { throw new Error('Server is not created yet'); } - if (this.stopped) { + if (this.stopping || this.stopped) { this.log.warn(`registerOnPreAuth called after stop`); } @@ -336,7 +367,7 @@ export class HttpServer { if (this.server === undefined) { throw new Error('Server is not created yet'); } - if (this.stopped) { + if (this.stopping || this.stopped) { this.log.warn(`registerOnPostAuth called after stop`); } @@ -347,7 +378,7 @@ export class HttpServer { if (this.server === undefined) { throw new Error('Server is not created yet'); } - if (this.stopped) { + if (this.stopping || this.stopped) { this.log.warn(`registerOnPreRouting called after stop`); } @@ -358,7 +389,7 @@ export class HttpServer { if (this.server === undefined) { throw new Error('Server is not created yet'); } - if (this.stopped) { + if (this.stopping || this.stopped) { this.log.warn(`registerOnPreResponse called after stop`); } @@ -372,7 +403,7 @@ export class HttpServer { if (this.server === undefined) { throw new Error('Server is not created yet'); } - if (this.stopped) { + if (this.stopping || this.stopped) { this.log.warn(`createCookieSessionStorageFactory called after stop`); } if (this.cookieSessionStorageCreated) { @@ -392,7 +423,7 @@ export class HttpServer { if (this.server === undefined) { throw new Error('Server is not created yet'); } - if (this.stopped) { + if (this.stopping || this.stopped) { this.log.warn(`registerAuth called after stop`); } if (this.authRegistered) { @@ -438,7 +469,7 @@ export class HttpServer { if (this.server === undefined) { throw new Error('Http server is not setup up yet'); } - if (this.stopped) { + if (this.stopping || this.stopped) { this.log.warn(`registerStaticDir called after stop`); } diff --git a/src/core/server/http/http_service.ts b/src/core/server/http/http_service.ts index 5b90440f6ad70..fdf9b738a9833 100644 --- a/src/core/server/http/http_service.ts +++ b/src/core/server/http/http_service.ts @@ -6,7 +6,7 @@ * Side Public License, v 1. */ -import { Observable, Subscription, combineLatest } from 'rxjs'; +import { Observable, Subscription, combineLatest, of } from 'rxjs'; import { first, map } from 'rxjs/operators'; import { Server } from '@hapi/hapi'; import { pick } from '@kbn/std'; @@ -69,7 +69,8 @@ export class HttpService configService.atPath(cspConfig.path), configService.atPath(externalUrlConfig.path), ]).pipe(map(([http, csp, externalUrl]) => new HttpConfig(http, csp, externalUrl))); - this.httpServer = new HttpServer(logger, 'Kibana'); + const shutdownTimeout$ = this.config$.pipe(map(({ shutdownTimeout }) => shutdownTimeout)); + this.httpServer = new HttpServer(logger, 'Kibana', shutdownTimeout$); this.httpsRedirectServer = new HttpsRedirectServer(logger.get('http', 'redirect', 'server')); } @@ -167,7 +168,7 @@ export class HttpService return; } - this.configSubscription.unsubscribe(); + this.configSubscription?.unsubscribe(); this.configSubscription = undefined; if (this.notReadyServer) { @@ -179,7 +180,7 @@ export class HttpService private async runNotReadyServer(config: HttpConfig) { this.log.debug('starting NotReady server'); - const httpServer = new HttpServer(this.logger, 'NotReady'); + const httpServer = new HttpServer(this.logger, 'NotReady', of(config.shutdownTimeout)); const { server } = await httpServer.setup(config); this.notReadyServer = server; // use hapi server while KibanaResponseFactory doesn't allow specifying custom headers diff --git a/src/core/server/http/integration_tests/lifecycle_handlers.test.ts b/src/core/server/http/integration_tests/lifecycle_handlers.test.ts index 8d4cf31a5c705..cbd300fdc9c09 100644 --- a/src/core/server/http/integration_tests/lifecycle_handlers.test.ts +++ b/src/core/server/http/integration_tests/lifecycle_handlers.test.ts @@ -7,6 +7,7 @@ */ import supertest from 'supertest'; +import moment from 'moment'; import { BehaviorSubject } from 'rxjs'; import { ByteSizeValue } from '@kbn/config-schema'; @@ -44,6 +45,7 @@ describe('core lifecycle handlers', () => { return new BehaviorSubject({ hosts: ['localhost'], maxPayload: new ByteSizeValue(1024), + shutdownTimeout: moment.duration(30, 'seconds'), autoListen: true, ssl: { enabled: false, diff --git a/src/core/server/http/logging/get_response_log.test.ts b/src/core/server/http/logging/get_response_log.test.ts index 64241ff44fc6b..5f749220138d7 100644 --- a/src/core/server/http/logging/get_response_log.test.ts +++ b/src/core/server/http/logging/get_response_log.test.ts @@ -81,7 +81,8 @@ describe('getEcsResponseLog', () => { }, }); const result = getEcsResponseLog(req, logger); - expect(result.http.response.responseTime).toBe(1000); + // @ts-expect-error ECS custom field + expect(result.meta.http.response.responseTime).toBe(1000); }); test('with response.info.responded', () => { @@ -92,14 +93,16 @@ describe('getEcsResponseLog', () => { }, }); const result = getEcsResponseLog(req, logger); - expect(result.http.response.responseTime).toBe(500); + // @ts-expect-error ECS custom field + expect(result.meta.http.response.responseTime).toBe(500); }); test('excludes responseTime from message if none is provided', () => { const req = createMockHapiRequest(); const result = getEcsResponseLog(req, logger); expect(result.message).toMatchInlineSnapshot(`"GET /path 200 - 1.2KB"`); - expect(result.http.response.responseTime).toBeUndefined(); + // @ts-expect-error ECS custom field + expect(result.meta.http.response.responseTime).toBeUndefined(); }); }); @@ -112,7 +115,7 @@ describe('getEcsResponseLog', () => { }, }); const result = getEcsResponseLog(req, logger); - expect(result.url.query).toMatchInlineSnapshot(`"a=hello&b=world"`); + expect(result.meta.url!.query).toMatchInlineSnapshot(`"a=hello&b=world"`); expect(result.message).toMatchInlineSnapshot(`"GET /path?a=hello&b=world 200 - 1.2KB"`); }); @@ -121,7 +124,7 @@ describe('getEcsResponseLog', () => { query: { a: '¡hola!' }, }); const result = getEcsResponseLog(req, logger); - expect(result.url.query).toMatchInlineSnapshot(`"a=%C2%A1hola!"`); + expect(result.meta.url!.query).toMatchInlineSnapshot(`"a=%C2%A1hola!"`); expect(result.message).toMatchInlineSnapshot(`"GET /path?a=%C2%A1hola! 200 - 1.2KB"`); }); }); @@ -145,7 +148,7 @@ describe('getEcsResponseLog', () => { response: Boom.badRequest(), }); const result = getEcsResponseLog(req, logger); - expect(result.http.response.status_code).toBe(400); + expect(result.meta.http!.response!.status_code).toBe(400); }); describe('filters sensitive headers', () => { @@ -155,14 +158,16 @@ describe('getEcsResponseLog', () => { response: { headers: { 'content-length': 123, 'set-cookie': 'c' } }, }); const result = getEcsResponseLog(req, logger); - expect(result.http.request.headers).toMatchInlineSnapshot(` + // @ts-expect-error ECS custom field + expect(result.meta.http.request.headers).toMatchInlineSnapshot(` Object { "authorization": "[REDACTED]", "cookie": "[REDACTED]", "user-agent": "hi", } `); - expect(result.http.response.headers).toMatchInlineSnapshot(` + // @ts-expect-error ECS custom field + expect(result.meta.http.response.headers).toMatchInlineSnapshot(` Object { "content-length": 123, "set-cookie": "[REDACTED]", @@ -196,9 +201,12 @@ describe('getEcsResponseLog', () => { } `); - responseLog.http.request.headers.a = 'testA'; - responseLog.http.request.headers.b[1] = 'testB'; - responseLog.http.request.headers.c = 'testC'; + // @ts-expect-error ECS custom field + responseLog.meta.http.request.headers.a = 'testA'; + // @ts-expect-error ECS custom field + responseLog.meta.http.request.headers.b[1] = 'testB'; + // @ts-expect-error ECS custom field + responseLog.meta.http.request.headers.c = 'testC'; expect(reqHeaders).toMatchInlineSnapshot(` Object { "a": "foo", @@ -244,48 +252,41 @@ describe('getEcsResponseLog', () => { }); describe('ecs', () => { - test('specifies correct ECS version', () => { - const req = createMockHapiRequest(); - const result = getEcsResponseLog(req, logger); - expect(result.ecs.version).toBe('1.7.0'); - }); - test('provides an ECS-compatible response', () => { const req = createMockHapiRequest(); const result = getEcsResponseLog(req, logger); expect(result).toMatchInlineSnapshot(` Object { - "client": Object { - "ip": undefined, - }, - "ecs": Object { - "version": "1.7.0", - }, - "http": Object { - "request": Object { - "headers": Object { - "user-agent": "", - }, - "method": "GET", - "mime_type": "application/json", - "referrer": "localhost:5601/app/home", + "message": "GET /path 200 - 1.2KB", + "meta": Object { + "client": Object { + "ip": undefined, }, - "response": Object { - "body": Object { - "bytes": 1234, + "http": Object { + "request": Object { + "headers": Object { + "user-agent": "", + }, + "method": "GET", + "mime_type": "application/json", + "referrer": "localhost:5601/app/home", + }, + "response": Object { + "body": Object { + "bytes": 1234, + }, + "headers": Object {}, + "responseTime": undefined, + "status_code": 200, }, - "headers": Object {}, - "responseTime": undefined, - "status_code": 200, }, - }, - "message": "GET /path 200 - 1.2KB", - "url": Object { - "path": "/path", - "query": "", - }, - "user_agent": Object { - "original": "", + "url": Object { + "path": "/path", + "query": "", + }, + "user_agent": Object { + "original": "", + }, }, } `); diff --git a/src/core/server/http/logging/get_response_log.ts b/src/core/server/http/logging/get_response_log.ts index 57c02e05bebff..37ee618e43395 100644 --- a/src/core/server/http/logging/get_response_log.ts +++ b/src/core/server/http/logging/get_response_log.ts @@ -11,10 +11,9 @@ import { isBoom } from '@hapi/boom'; import type { Request } from '@hapi/hapi'; import numeral from '@elastic/numeral'; import { LogMeta } from '@kbn/logging'; -import { EcsEvent, Logger } from '../../logging'; +import { Logger } from '../../logging'; import { getResponsePayloadBytes } from './get_payload_size'; -const ECS_VERSION = '1.7.0'; const FORBIDDEN_HEADERS = ['authorization', 'cookie', 'set-cookie']; const REDACTED_HEADER_TEXT = '[REDACTED]'; @@ -44,7 +43,7 @@ function cloneAndFilterHeaders(headers?: HapiHeaders) { * * @internal */ -export function getEcsResponseLog(request: Request, log: Logger): LogMeta { +export function getEcsResponseLog(request: Request, log: Logger) { const { path, response } = request; const method = request.method.toUpperCase(); @@ -66,9 +65,7 @@ export function getEcsResponseLog(request: Request, log: Logger): LogMeta { const bytes = getResponsePayloadBytes(response, log); const bytesMsg = bytes ? ` - ${numeral(bytes).format('0.0b')}` : ''; - const meta: EcsEvent = { - ecs: { version: ECS_VERSION }, - message: `${method} ${pathWithQuery} ${status_code}${responseTimeMsg}${bytesMsg}`, + const meta: LogMeta = { client: { ip: request.info.remoteAddress, }, @@ -77,7 +74,7 @@ export function getEcsResponseLog(request: Request, log: Logger): LogMeta { method, mime_type: request.mime, referrer: request.info.referrer, - // @ts-expect-error Headers are not yet part of ECS: https://github.com/elastic/ecs/issues/232. + // @ts-expect-error ECS custom field: https://github.com/elastic/ecs/issues/232. headers: requestHeaders, }, response: { @@ -85,7 +82,7 @@ export function getEcsResponseLog(request: Request, log: Logger): LogMeta { bytes, }, status_code, - // @ts-expect-error Headers are not yet part of ECS: https://github.com/elastic/ecs/issues/232. + // @ts-expect-error ECS custom field: https://github.com/elastic/ecs/issues/232. headers: responseHeaders, // responseTime is a custom non-ECS field responseTime: !isNaN(responseTime) ? responseTime : undefined, @@ -100,5 +97,8 @@ export function getEcsResponseLog(request: Request, log: Logger): LogMeta { }, }; - return meta; + return { + message: `${method} ${pathWithQuery} ${status_code}${responseTimeMsg}${bytesMsg}`, + meta, + }; } diff --git a/src/core/server/http/test_utils.ts b/src/core/server/http/test_utils.ts index c6368a7166bc3..b3180b43d0026 100644 --- a/src/core/server/http/test_utils.ts +++ b/src/core/server/http/test_utils.ts @@ -7,6 +7,7 @@ */ import { BehaviorSubject } from 'rxjs'; +import moment from 'moment'; import { REPO_ROOT } from '@kbn/dev-utils'; import { ByteSizeValue } from '@kbn/config-schema'; import { Env } from '../config'; @@ -44,6 +45,7 @@ configService.atPath.mockImplementation((path) => { allowFromAnyIp: true, ipAllowlist: [], }, + shutdownTimeout: moment.duration(30, 'seconds'), keepaliveTimeout: 120_000, socketTimeout: 120_000, } as any); diff --git a/src/core/server/index.ts b/src/core/server/index.ts index 2c6fa74cb54a0..9fccc4b8bc1f0 100644 --- a/src/core/server/index.ts +++ b/src/core/server/index.ts @@ -64,6 +64,7 @@ import { CoreUsageStats, CoreUsageData, CoreConfigUsageData, + ConfigUsageData, CoreEnvironmentUsageData, CoreServicesUsageData, } from './core_usage_data'; @@ -74,6 +75,7 @@ export type { CoreConfigUsageData, CoreEnvironmentUsageData, CoreServicesUsageData, + ConfigUsageData, }; export { bootstrap } from './bootstrap'; @@ -236,6 +238,11 @@ export type { IRenderOptions } from './rendering'; export type { Logger, LoggerFactory, + Ecs, + EcsEventCategory, + EcsEventKind, + EcsEventOutcome, + EcsEventType, LogMeta, LogRecord, LogLevel, @@ -256,6 +263,7 @@ export type { PluginManifest, PluginName, SharedGlobalConfig, + MakeUsageFromSchema, } from './plugins'; export { diff --git a/src/core/server/kibana_config.ts b/src/core/server/kibana_config.ts index 97783a7657db5..848c51dcb69f3 100644 --- a/src/core/server/kibana_config.ts +++ b/src/core/server/kibana_config.ts @@ -33,4 +33,8 @@ export const config = { autocompleteTimeout: schema.duration({ defaultValue: 1000 }), }), deprecations, + exposeToUsage: { + autocompleteTerminateAfter: true, + autocompleteTimeout: true, + }, }; diff --git a/src/core/server/logging/__snapshots__/logging_system.test.ts.snap b/src/core/server/logging/__snapshots__/logging_system.test.ts.snap index 81321a3b1fe44..d74317203d78e 100644 --- a/src/core/server/logging/__snapshots__/logging_system.test.ts.snap +++ b/src/core/server/logging/__snapshots__/logging_system.test.ts.snap @@ -15,6 +15,9 @@ exports[`appends records via multiple appenders.: file logs 2`] = ` exports[`asLoggerFactory() only allows to create new loggers. 1`] = ` Object { "@timestamp": "2012-01-30T22:33:22.011-05:00", + "ecs": Object { + "version": "1.9.0", + }, "log": Object { "level": "TRACE", "logger": "test.context", @@ -29,6 +32,9 @@ Object { exports[`asLoggerFactory() only allows to create new loggers. 2`] = ` Object { "@timestamp": "2012-01-30T17:33:22.011-05:00", + "ecs": Object { + "version": "1.9.0", + }, "log": Object { "level": "INFO", "logger": "test.context", @@ -44,6 +50,9 @@ Object { exports[`asLoggerFactory() only allows to create new loggers. 3`] = ` Object { "@timestamp": "2012-01-30T12:33:22.011-05:00", + "ecs": Object { + "version": "1.9.0", + }, "log": Object { "level": "FATAL", "logger": "test.context", @@ -58,6 +67,9 @@ Object { exports[`flushes memory buffer logger and switches to real logger once config is provided: buffered messages 1`] = ` Object { "@timestamp": "2012-02-01T09:33:22.011-05:00", + "ecs": Object { + "version": "1.9.0", + }, "log": Object { "level": "INFO", "logger": "test.context", @@ -73,6 +85,9 @@ Object { exports[`flushes memory buffer logger and switches to real logger once config is provided: new messages 1`] = ` Object { "@timestamp": "2012-01-31T23:33:22.011-05:00", + "ecs": Object { + "version": "1.9.0", + }, "log": Object { "level": "INFO", "logger": "test.context", diff --git a/src/core/server/logging/appenders/rewrite/policies/meta/meta_policy.test.ts b/src/core/server/logging/appenders/rewrite/policies/meta/meta_policy.test.ts index 52b88331a75be..faa026363ed40 100644 --- a/src/core/server/logging/appenders/rewrite/policies/meta/meta_policy.test.ts +++ b/src/core/server/logging/appenders/rewrite/policies/meta/meta_policy.test.ts @@ -26,12 +26,14 @@ describe('MetaRewritePolicy', () => { describe('mode: update', () => { it('updates existing properties in LogMeta', () => { + // @ts-expect-error ECS custom meta const log = createLogRecord({ a: 'before' }); const policy = createPolicy('update', [{ path: 'a', value: 'after' }]); expect(policy.rewrite(log).meta!.a).toBe('after'); }); it('updates nested properties in LogMeta', () => { + // @ts-expect-error ECS custom meta const log = createLogRecord({ a: 'before a', b: { c: 'before b.c' }, d: [0, 1] }); const policy = createPolicy('update', [ { path: 'a', value: 'after a' }, @@ -60,6 +62,7 @@ describe('MetaRewritePolicy', () => { { path: 'd', value: 'hi' }, ]); const log = createLogRecord({ + // @ts-expect-error ECS custom meta a: 'a', b: 'b', c: 'c', @@ -80,6 +83,7 @@ describe('MetaRewritePolicy', () => { { path: 'a.b', value: 'foo' }, { path: 'a.c', value: 'bar' }, ]); + // @ts-expect-error ECS custom meta const log = createLogRecord({ a: { b: 'existing meta' } }); const { meta } = policy.rewrite(log); expect(meta!.a.b).toBe('foo'); @@ -106,12 +110,14 @@ describe('MetaRewritePolicy', () => { describe('mode: remove', () => { it('removes existing properties in LogMeta', () => { + // @ts-expect-error ECS custom meta const log = createLogRecord({ a: 'goodbye' }); const policy = createPolicy('remove', [{ path: 'a' }]); expect(policy.rewrite(log).meta!.a).toBeUndefined(); }); it('removes nested properties in LogMeta', () => { + // @ts-expect-error ECS custom meta const log = createLogRecord({ a: 'a', b: { c: 'b.c' }, d: [0, 1] }); const policy = createPolicy('remove', [{ path: 'b.c' }, { path: 'd[1]' }]); expect(policy.rewrite(log).meta).toMatchInlineSnapshot(` @@ -127,6 +133,7 @@ describe('MetaRewritePolicy', () => { }); it('has no effect if property does not exist', () => { + // @ts-expect-error ECS custom meta const log = createLogRecord({ a: 'a' }); const policy = createPolicy('remove', [{ path: 'b' }]); expect(policy.rewrite(log).meta).toMatchInlineSnapshot(` diff --git a/src/core/server/logging/appenders/rewrite/rewrite_appender.test.ts b/src/core/server/logging/appenders/rewrite/rewrite_appender.test.ts index 72a54b5012ce5..f4ce64ee65075 100644 --- a/src/core/server/logging/appenders/rewrite/rewrite_appender.test.ts +++ b/src/core/server/logging/appenders/rewrite/rewrite_appender.test.ts @@ -85,8 +85,8 @@ describe('RewriteAppender', () => { const appender = new RewriteAppender(config); appenderMocks.forEach((mock) => appender.addAppender(...mock)); - const log1 = createLogRecord({ a: 'b' }); - const log2 = createLogRecord({ c: 'd' }); + const log1 = createLogRecord({ user_agent: { name: 'a' } }); + const log2 = createLogRecord({ user_agent: { name: 'b' } }); appender.append(log1); @@ -109,8 +109,8 @@ describe('RewriteAppender', () => { const appender = new RewriteAppender(config); appender.addAppender(...createAppenderMock('mock1')); - const log1 = createLogRecord({ a: 'b' }); - const log2 = createLogRecord({ c: 'd' }); + const log1 = createLogRecord({ user_agent: { name: 'a' } }); + const log2 = createLogRecord({ user_agent: { name: 'b' } }); appender.append(log1); diff --git a/src/core/server/logging/ecs.ts b/src/core/server/logging/ecs.ts deleted file mode 100644 index f6db79819d819..0000000000000 --- a/src/core/server/logging/ecs.ts +++ /dev/null @@ -1,129 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0 and the Server Side Public License, v 1; you may not use this file except - * in compliance with, at your election, the Elastic License 2.0 or the Server - * Side Public License, v 1. - */ - -/** - * Typings for some ECS fields which core uses internally. - * These are not a complete set of ECS typings and should not - * be used externally; the only types included here are ones - * currently used in core. - * - * @internal - */ -export interface EcsEvent { - /** - * These typings were written as of ECS 1.7.0. - * Don't change this value without checking the rest - * of the types to conform to that ECS version. - * - * https://www.elastic.co/guide/en/ecs/1.7/index.html - */ - ecs: { version: '1.7.0' }; - - // base fields - ['@timestamp']?: string; - labels?: Record; - message?: string; - tags?: string[]; - - // other fields - client?: EcsClientField; - event?: EcsEventField; - http?: EcsHttpField; - process?: EcsProcessField; - url?: EcsUrlField; - user_agent?: EcsUserAgentField; -} - -/** @internal */ -export enum EcsEventKind { - ALERT = 'alert', - EVENT = 'event', - METRIC = 'metric', - STATE = 'state', - PIPELINE_ERROR = 'pipeline_error', - SIGNAL = 'signal', -} - -/** @internal */ -export enum EcsEventCategory { - AUTHENTICATION = 'authentication', - CONFIGURATION = 'configuration', - DATABASE = 'database', - DRIVER = 'driver', - FILE = 'file', - HOST = 'host', - IAM = 'iam', - INTRUSION_DETECTION = 'intrusion_detection', - MALWARE = 'malware', - NETWORK = 'network', - PACKAGE = 'package', - PROCESS = 'process', - WEB = 'web', -} - -/** @internal */ -export enum EcsEventType { - ACCESS = 'access', - ADMIN = 'admin', - ALLOWED = 'allowed', - CHANGE = 'change', - CONNECTION = 'connection', - CREATION = 'creation', - DELETION = 'deletion', - DENIED = 'denied', - END = 'end', - ERROR = 'error', - GROUP = 'group', - INFO = 'info', - INSTALLATION = 'installation', - PROTOCOL = 'protocol', - START = 'start', - USER = 'user', -} - -interface EcsEventField { - kind?: EcsEventKind; - category?: EcsEventCategory[]; - type?: EcsEventType; -} - -interface EcsProcessField { - uptime?: number; -} - -interface EcsClientField { - ip?: string; -} - -interface EcsHttpFieldRequest { - body?: { bytes?: number; content?: string }; - method?: string; - mime_type?: string; - referrer?: string; -} - -interface EcsHttpFieldResponse { - body?: { bytes?: number; content?: string }; - bytes?: number; - status_code?: number; -} - -interface EcsHttpField { - version?: string; - request?: EcsHttpFieldRequest; - response?: EcsHttpFieldResponse; -} - -interface EcsUrlField { - path?: string; - query?: string; -} - -interface EcsUserAgentField { - original?: string; -} diff --git a/src/core/server/logging/index.ts b/src/core/server/logging/index.ts index cef96be54870e..9d17b289bfa4c 100644 --- a/src/core/server/logging/index.ts +++ b/src/core/server/logging/index.ts @@ -9,6 +9,11 @@ export { LogLevel } from '@kbn/logging'; export type { DisposableAppender, Appender, + Ecs, + EcsEventCategory, + EcsEventKind, + EcsEventOutcome, + EcsEventType, LogRecord, Layout, LoggerFactory, @@ -16,8 +21,6 @@ export type { Logger, LogLevelId, } from '@kbn/logging'; -export { EcsEventType, EcsEventCategory, EcsEventKind } from './ecs'; -export type { EcsEvent } from './ecs'; export { config } from './logging_config'; export type { LoggingConfigType, diff --git a/src/core/server/logging/layouts/__snapshots__/json_layout.test.ts.snap b/src/core/server/logging/layouts/__snapshots__/json_layout.test.ts.snap index 0e7ce8d0b2f3c..a131d5c8a9248 100644 --- a/src/core/server/logging/layouts/__snapshots__/json_layout.test.ts.snap +++ b/src/core/server/logging/layouts/__snapshots__/json_layout.test.ts.snap @@ -1,13 +1,13 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`\`format()\` correctly formats record. 1`] = `"{\\"@timestamp\\":\\"2012-02-01T09:30:22.011-05:00\\",\\"message\\":\\"message-1\\",\\"error\\":{\\"message\\":\\"Some error message\\",\\"type\\":\\"Some error name\\",\\"stack_trace\\":\\"Some error stack\\"},\\"log\\":{\\"level\\":\\"FATAL\\",\\"logger\\":\\"context-1\\"},\\"process\\":{\\"pid\\":5355}}"`; +exports[`\`format()\` correctly formats record. 1`] = `"{\\"ecs\\":{\\"version\\":\\"1.9.0\\"},\\"@timestamp\\":\\"2012-02-01T09:30:22.011-05:00\\",\\"message\\":\\"message-1\\",\\"error\\":{\\"message\\":\\"Some error message\\",\\"type\\":\\"Some error name\\",\\"stack_trace\\":\\"Some error stack\\"},\\"log\\":{\\"level\\":\\"FATAL\\",\\"logger\\":\\"context-1\\"},\\"process\\":{\\"pid\\":5355}}"`; -exports[`\`format()\` correctly formats record. 2`] = `"{\\"@timestamp\\":\\"2012-02-01T09:30:22.011-05:00\\",\\"message\\":\\"message-2\\",\\"log\\":{\\"level\\":\\"ERROR\\",\\"logger\\":\\"context-2\\"},\\"process\\":{\\"pid\\":5355}}"`; +exports[`\`format()\` correctly formats record. 2`] = `"{\\"ecs\\":{\\"version\\":\\"1.9.0\\"},\\"@timestamp\\":\\"2012-02-01T09:30:22.011-05:00\\",\\"message\\":\\"message-2\\",\\"log\\":{\\"level\\":\\"ERROR\\",\\"logger\\":\\"context-2\\"},\\"process\\":{\\"pid\\":5355}}"`; -exports[`\`format()\` correctly formats record. 3`] = `"{\\"@timestamp\\":\\"2012-02-01T09:30:22.011-05:00\\",\\"message\\":\\"message-3\\",\\"log\\":{\\"level\\":\\"WARN\\",\\"logger\\":\\"context-3\\"},\\"process\\":{\\"pid\\":5355}}"`; +exports[`\`format()\` correctly formats record. 3`] = `"{\\"ecs\\":{\\"version\\":\\"1.9.0\\"},\\"@timestamp\\":\\"2012-02-01T09:30:22.011-05:00\\",\\"message\\":\\"message-3\\",\\"log\\":{\\"level\\":\\"WARN\\",\\"logger\\":\\"context-3\\"},\\"process\\":{\\"pid\\":5355}}"`; -exports[`\`format()\` correctly formats record. 4`] = `"{\\"@timestamp\\":\\"2012-02-01T09:30:22.011-05:00\\",\\"message\\":\\"message-4\\",\\"log\\":{\\"level\\":\\"DEBUG\\",\\"logger\\":\\"context-4\\"},\\"process\\":{\\"pid\\":5355}}"`; +exports[`\`format()\` correctly formats record. 4`] = `"{\\"ecs\\":{\\"version\\":\\"1.9.0\\"},\\"@timestamp\\":\\"2012-02-01T09:30:22.011-05:00\\",\\"message\\":\\"message-4\\",\\"log\\":{\\"level\\":\\"DEBUG\\",\\"logger\\":\\"context-4\\"},\\"process\\":{\\"pid\\":5355}}"`; -exports[`\`format()\` correctly formats record. 5`] = `"{\\"@timestamp\\":\\"2012-02-01T09:30:22.011-05:00\\",\\"message\\":\\"message-5\\",\\"log\\":{\\"level\\":\\"INFO\\",\\"logger\\":\\"context-5\\"},\\"process\\":{\\"pid\\":5355}}"`; +exports[`\`format()\` correctly formats record. 5`] = `"{\\"ecs\\":{\\"version\\":\\"1.9.0\\"},\\"@timestamp\\":\\"2012-02-01T09:30:22.011-05:00\\",\\"message\\":\\"message-5\\",\\"log\\":{\\"level\\":\\"INFO\\",\\"logger\\":\\"context-5\\"},\\"process\\":{\\"pid\\":5355}}"`; -exports[`\`format()\` correctly formats record. 6`] = `"{\\"@timestamp\\":\\"2012-02-01T09:30:22.011-05:00\\",\\"message\\":\\"message-6\\",\\"log\\":{\\"level\\":\\"TRACE\\",\\"logger\\":\\"context-6\\"},\\"process\\":{\\"pid\\":5355}}"`; +exports[`\`format()\` correctly formats record. 6`] = `"{\\"ecs\\":{\\"version\\":\\"1.9.0\\"},\\"@timestamp\\":\\"2012-02-01T09:30:22.011-05:00\\",\\"message\\":\\"message-6\\",\\"log\\":{\\"level\\":\\"TRACE\\",\\"logger\\":\\"context-6\\"},\\"process\\":{\\"pid\\":5355}}"`; diff --git a/src/core/server/logging/layouts/json_layout.test.ts b/src/core/server/logging/layouts/json_layout.test.ts index e55f69daab110..e76e3fb4402bb 100644 --- a/src/core/server/logging/layouts/json_layout.test.ts +++ b/src/core/server/logging/layouts/json_layout.test.ts @@ -94,6 +94,7 @@ test('`format()` correctly formats record with meta-data', () => { }) ) ).toStrictEqual({ + ecs: { version: '1.9.0' }, '@timestamp': '2012-02-01T09:30:22.011-05:00', log: { level: 'DEBUG', @@ -135,6 +136,7 @@ test('`format()` correctly formats error record with meta-data', () => { }) ) ).toStrictEqual({ + ecs: { version: '1.9.0' }, '@timestamp': '2012-02-01T09:30:22.011-05:00', log: { level: 'DEBUG', @@ -156,7 +158,39 @@ test('`format()` correctly formats error record with meta-data', () => { }); }); -test('format() meta can override @timestamp', () => { +test('format() meta can merge override logs', () => { + const layout = new JsonLayout(); + expect( + JSON.parse( + layout.format({ + timestamp, + message: 'foo', + level: LogLevel.Error, + context: 'bar', + pid: 3, + meta: { + log: { + kbn_custom_field: 'hello', + }, + }, + }) + ) + ).toStrictEqual({ + ecs: { version: '1.9.0' }, + '@timestamp': '2012-02-01T09:30:22.011-05:00', + message: 'foo', + log: { + level: 'ERROR', + logger: 'bar', + kbn_custom_field: 'hello', + }, + process: { + pid: 3, + }, + }); +}); + +test('format() meta can not override message', () => { const layout = new JsonLayout(); expect( JSON.parse( @@ -167,12 +201,13 @@ test('format() meta can override @timestamp', () => { context: 'bar', pid: 3, meta: { - '@timestamp': '2099-05-01T09:30:22.011-05:00', + message: 'baz', }, }) ) ).toStrictEqual({ - '@timestamp': '2099-05-01T09:30:22.011-05:00', + ecs: { version: '1.9.0' }, + '@timestamp': '2012-02-01T09:30:22.011-05:00', message: 'foo', log: { level: 'DEBUG', @@ -184,30 +219,60 @@ test('format() meta can override @timestamp', () => { }); }); -test('format() meta can merge override logs', () => { +test('format() meta can not override ecs version', () => { const layout = new JsonLayout(); expect( JSON.parse( layout.format({ + message: 'foo', timestamp, + level: LogLevel.Debug, + context: 'bar', + pid: 3, + meta: { + message: 'baz', + }, + }) + ) + ).toStrictEqual({ + ecs: { version: '1.9.0' }, + '@timestamp': '2012-02-01T09:30:22.011-05:00', + message: 'foo', + log: { + level: 'DEBUG', + logger: 'bar', + }, + process: { + pid: 3, + }, + }); +}); + +test('format() meta can not override logger or level', () => { + const layout = new JsonLayout(); + expect( + JSON.parse( + layout.format({ message: 'foo', - level: LogLevel.Error, + timestamp, + level: LogLevel.Debug, context: 'bar', pid: 3, meta: { log: { - kbn_custom_field: 'hello', + level: 'IGNORE', + logger: 'me', }, }, }) ) ).toStrictEqual({ + ecs: { version: '1.9.0' }, '@timestamp': '2012-02-01T09:30:22.011-05:00', message: 'foo', log: { - level: 'ERROR', + level: 'DEBUG', logger: 'bar', - kbn_custom_field: 'hello', }, process: { pid: 3, @@ -215,29 +280,28 @@ test('format() meta can merge override logs', () => { }); }); -test('format() meta can override log level objects', () => { +test('format() meta can not override timestamp', () => { const layout = new JsonLayout(); expect( JSON.parse( layout.format({ - timestamp, - context: '123', message: 'foo', - level: LogLevel.Error, + timestamp, + level: LogLevel.Debug, + context: 'bar', pid: 3, meta: { - log: { - level: 'FATAL', - }, + '@timestamp': '2099-02-01T09:30:22.011-05:00', }, }) ) ).toStrictEqual({ + ecs: { version: '1.9.0' }, '@timestamp': '2012-02-01T09:30:22.011-05:00', message: 'foo', log: { - level: 'FATAL', - logger: '123', + level: 'DEBUG', + logger: 'bar', }, process: { pid: 3, diff --git a/src/core/server/logging/layouts/json_layout.ts b/src/core/server/logging/layouts/json_layout.ts index bb8423f8240af..add88cc01b6d2 100644 --- a/src/core/server/logging/layouts/json_layout.ts +++ b/src/core/server/logging/layouts/json_layout.ts @@ -9,7 +9,7 @@ import moment from 'moment-timezone'; import { merge } from '@kbn/std'; import { schema } from '@kbn/config-schema'; -import { LogRecord, Layout } from '@kbn/logging'; +import { Ecs, LogRecord, Layout } from '@kbn/logging'; const { literal, object } = schema; @@ -42,7 +42,8 @@ export class JsonLayout implements Layout { } public format(record: LogRecord): string { - const log = { + const log: Ecs = { + ecs: { version: '1.9.0' }, '@timestamp': moment(record.timestamp).format('YYYY-MM-DDTHH:mm:ss.SSSZ'), message: record.message, error: JsonLayout.errorToSerializableObject(record.error), @@ -54,7 +55,8 @@ export class JsonLayout implements Layout { pid: record.pid, }, }; - const output = record.meta ? merge(log, record.meta) : log; + const output = record.meta ? merge({ ...record.meta }, log) : log; + return JSON.stringify(output); } } diff --git a/src/core/server/logging/logger.test.ts b/src/core/server/logging/logger.test.ts index b7f224e73cb8b..c57ce2563ca3d 100644 --- a/src/core/server/logging/logger.test.ts +++ b/src/core/server/logging/logger.test.ts @@ -45,6 +45,7 @@ test('`trace()` correctly forms `LogRecord` and passes it to all appenders.', () }); } + // @ts-expect-error ECS custom meta logger.trace('message-2', { trace: true }); for (const appenderMock of appenderMocks) { expect(appenderMock.append).toHaveBeenCalledTimes(2); @@ -75,6 +76,7 @@ test('`debug()` correctly forms `LogRecord` and passes it to all appenders.', () }); } + // @ts-expect-error ECS custom meta logger.debug('message-2', { debug: true }); for (const appenderMock of appenderMocks) { expect(appenderMock.append).toHaveBeenCalledTimes(2); @@ -105,6 +107,7 @@ test('`info()` correctly forms `LogRecord` and passes it to all appenders.', () }); } + // @ts-expect-error ECS custom meta logger.info('message-2', { info: true }); for (const appenderMock of appenderMocks) { expect(appenderMock.append).toHaveBeenCalledTimes(2); @@ -150,6 +153,7 @@ test('`warn()` correctly forms `LogRecord` and passes it to all appenders.', () }); } + // @ts-expect-error ECS custom meta logger.warn('message-3', { warn: true }); for (const appenderMock of appenderMocks) { expect(appenderMock.append).toHaveBeenCalledTimes(3); @@ -195,6 +199,7 @@ test('`error()` correctly forms `LogRecord` and passes it to all appenders.', () }); } + // @ts-expect-error ECS custom meta logger.error('message-3', { error: true }); for (const appenderMock of appenderMocks) { expect(appenderMock.append).toHaveBeenCalledTimes(3); @@ -240,6 +245,7 @@ test('`fatal()` correctly forms `LogRecord` and passes it to all appenders.', () }); } + // @ts-expect-error ECS custom meta logger.fatal('message-3', { fatal: true }); for (const appenderMock of appenderMocks) { expect(appenderMock.append).toHaveBeenCalledTimes(3); diff --git a/src/core/server/logging/logger.ts b/src/core/server/logging/logger.ts index 4ba334cec2fb9..e025c28a88f0e 100644 --- a/src/core/server/logging/logger.ts +++ b/src/core/server/logging/logger.ts @@ -21,28 +21,28 @@ export class BaseLogger implements Logger { private readonly factory: LoggerFactory ) {} - public trace(message: string, meta?: LogMeta): void { - this.log(this.createLogRecord(LogLevel.Trace, message, meta)); + public trace(message: string, meta?: Meta): void { + this.log(this.createLogRecord(LogLevel.Trace, message, meta)); } - public debug(message: string, meta?: LogMeta): void { - this.log(this.createLogRecord(LogLevel.Debug, message, meta)); + public debug(message: string, meta?: Meta): void { + this.log(this.createLogRecord(LogLevel.Debug, message, meta)); } - public info(message: string, meta?: LogMeta): void { - this.log(this.createLogRecord(LogLevel.Info, message, meta)); + public info(message: string, meta?: Meta): void { + this.log(this.createLogRecord(LogLevel.Info, message, meta)); } - public warn(errorOrMessage: string | Error, meta?: LogMeta): void { - this.log(this.createLogRecord(LogLevel.Warn, errorOrMessage, meta)); + public warn(errorOrMessage: string | Error, meta?: Meta): void { + this.log(this.createLogRecord(LogLevel.Warn, errorOrMessage, meta)); } - public error(errorOrMessage: string | Error, meta?: LogMeta): void { - this.log(this.createLogRecord(LogLevel.Error, errorOrMessage, meta)); + public error(errorOrMessage: string | Error, meta?: Meta): void { + this.log(this.createLogRecord(LogLevel.Error, errorOrMessage, meta)); } - public fatal(errorOrMessage: string | Error, meta?: LogMeta): void { - this.log(this.createLogRecord(LogLevel.Fatal, errorOrMessage, meta)); + public fatal(errorOrMessage: string | Error, meta?: Meta): void { + this.log(this.createLogRecord(LogLevel.Fatal, errorOrMessage, meta)); } public log(record: LogRecord) { @@ -59,10 +59,10 @@ export class BaseLogger implements Logger { return this.factory.get(...[this.context, ...childContextPaths]); } - private createLogRecord( + private createLogRecord( level: LogLevel, errorOrMessage: string | Error, - meta?: LogMeta + meta?: Meta ): LogRecord { if (isError(errorOrMessage)) { return { diff --git a/src/core/server/logging/logging_system.test.ts b/src/core/server/logging/logging_system.test.ts index b67be384732cb..9c4313bc0c49d 100644 --- a/src/core/server/logging/logging_system.test.ts +++ b/src/core/server/logging/logging_system.test.ts @@ -49,6 +49,7 @@ test('uses default memory buffer logger until config is provided', () => { // We shouldn't create new buffer appender for another context name. const anotherLogger = system.get('test', 'context2'); + // @ts-expect-error ECS custom meta anotherLogger.fatal('fatal message', { some: 'value' }); expect(bufferAppendSpy).toHaveBeenCalledTimes(2); @@ -62,6 +63,7 @@ test('flushes memory buffer logger and switches to real logger once config is pr const logger = system.get('test', 'context'); logger.trace('buffered trace message'); + // @ts-expect-error ECS custom meta logger.info('buffered info message', { some: 'value' }); logger.fatal('buffered fatal message'); @@ -159,6 +161,7 @@ test('attaches appenders to appenders that declare refs', async () => { ); const testLogger = system.get('tests'); + // @ts-expect-error ECS custom meta testLogger.warn('This message goes to a test context.', { a: 'hi', b: 'remove me' }); expect(mockConsoleLog).toHaveBeenCalledTimes(1); @@ -233,6 +236,7 @@ test('asLoggerFactory() only allows to create new loggers.', async () => { ); logger.trace('buffered trace message'); + // @ts-expect-error ECS custom meta logger.info('buffered info message', { some: 'value' }); logger.fatal('buffered fatal message'); diff --git a/src/core/server/metrics/logging/get_ops_metrics_log.test.ts b/src/core/server/metrics/logging/get_ops_metrics_log.test.ts index 014d3ae258823..e535b9babf92b 100644 --- a/src/core/server/metrics/logging/get_ops_metrics_log.test.ts +++ b/src/core/server/metrics/logging/get_ops_metrics_log.test.ts @@ -66,7 +66,7 @@ describe('getEcsOpsMetricsLog', () => { it('correctly formats process uptime', () => { const logMeta = getEcsOpsMetricsLog(createMockOpsMetrics(testMetrics)); - expect(logMeta.process!.uptime).toEqual(1); + expect(logMeta.meta.process!.uptime).toEqual(1); }); it('excludes values from the message if unavailable', () => { @@ -80,44 +80,40 @@ describe('getEcsOpsMetricsLog', () => { expect(logMeta.message).toMatchInlineSnapshot(`""`); }); - it('specifies correct ECS version', () => { - const logMeta = getEcsOpsMetricsLog(createBaseOpsMetrics()); - expect(logMeta.ecs.version).toBe('1.7.0'); - }); - it('provides an ECS-compatible response', () => { const logMeta = getEcsOpsMetricsLog(createBaseOpsMetrics()); expect(logMeta).toMatchInlineSnapshot(` Object { - "ecs": Object { - "version": "1.7.0", - }, - "event": Object { - "category": Array [ - "process", - "host", - ], - "kind": "metric", - "type": "info", - }, - "host": Object { - "os": Object { - "load": Object { - "15m": 1, - "1m": 1, - "5m": 1, + "message": "memory: 1.0B load: [1.00,1.00,1.00] delay: 1.000", + "meta": Object { + "event": Object { + "category": Array [ + "process", + "host", + ], + "kind": "metric", + "type": Array [ + "info", + ], + }, + "host": Object { + "os": Object { + "load": Object { + "15m": 1, + "1m": 1, + "5m": 1, + }, }, }, - }, - "message": "memory: 1.0B load: [1.00,1.00,1.00] delay: 1.000", - "process": Object { - "eventLoopDelay": 1, - "memory": Object { - "heap": Object { - "usedInBytes": 1, + "process": Object { + "eventLoopDelay": 1, + "memory": Object { + "heap": Object { + "usedInBytes": 1, + }, }, + "uptime": 0, }, - "uptime": 0, }, } `); @@ -125,8 +121,8 @@ describe('getEcsOpsMetricsLog', () => { it('logs ECS fields in the log meta', () => { const logMeta = getEcsOpsMetricsLog(createBaseOpsMetrics()); - expect(logMeta.event!.kind).toBe('metric'); - expect(logMeta.event!.category).toEqual(expect.arrayContaining(['process', 'host'])); - expect(logMeta.event!.type).toBe('info'); + expect(logMeta.meta.event!.kind).toBe('metric'); + expect(logMeta.meta.event!.category).toEqual(expect.arrayContaining(['process', 'host'])); + expect(logMeta.meta.event!.type).toEqual(expect.arrayContaining(['info'])); }); }); diff --git a/src/core/server/metrics/logging/get_ops_metrics_log.ts b/src/core/server/metrics/logging/get_ops_metrics_log.ts index 02c3ad312c7dd..7e13f35889ec7 100644 --- a/src/core/server/metrics/logging/get_ops_metrics_log.ts +++ b/src/core/server/metrics/logging/get_ops_metrics_log.ts @@ -7,16 +7,15 @@ */ import numeral from '@elastic/numeral'; -import { EcsEvent, EcsEventKind, EcsEventCategory, EcsEventType } from '../../logging'; +import { LogMeta } from '@kbn/logging'; import { OpsMetrics } from '..'; -const ECS_VERSION = '1.7.0'; /** * Converts ops metrics into ECS-compliant `LogMeta` for logging * * @internal */ -export function getEcsOpsMetricsLog(metrics: OpsMetrics): EcsEvent { +export function getEcsOpsMetricsLog(metrics: OpsMetrics) { const { process, os } = metrics; const processMemoryUsedInBytes = process?.memory?.heap?.used_in_bytes; const processMemoryUsedInBytesMsg = processMemoryUsedInBytes @@ -51,13 +50,11 @@ export function getEcsOpsMetricsLog(metrics: OpsMetrics): EcsEvent { })}] ` : ''; - return { - ecs: { version: ECS_VERSION }, - message: `${processMemoryUsedInBytesMsg}${uptimeValMsg}${loadValsMsg}${eventLoopDelayValMsg}`, + const meta: LogMeta = { event: { - kind: EcsEventKind.METRIC, - category: [EcsEventCategory.PROCESS, EcsEventCategory.HOST], - type: EcsEventType.INFO, + kind: 'metric', + category: ['process', 'host'], + type: ['info'], }, process: { uptime: uptimeVal, @@ -71,8 +68,14 @@ export function getEcsOpsMetricsLog(metrics: OpsMetrics): EcsEvent { }, host: { os: { + // @ts-expect-error custom fields not yet part of ECS load: loadEntries, }, }, }; + + return { + message: `${processMemoryUsedInBytesMsg}${uptimeValMsg}${loadValsMsg}${eventLoopDelayValMsg}`, + meta, + }; } diff --git a/src/core/server/metrics/metrics_service.test.ts b/src/core/server/metrics/metrics_service.test.ts index 4fbca5addda11..d7de41fd7ccf7 100644 --- a/src/core/server/metrics/metrics_service.test.ts +++ b/src/core/server/metrics/metrics_service.test.ts @@ -182,16 +182,15 @@ describe('MetricsService', () => { Array [ "", Object { - "ecs": Object { - "version": "1.7.0", - }, "event": Object { "category": Array [ "process", "host", ], "kind": "metric", - "type": "info", + "type": Array [ + "info", + ], }, "host": Object { "os": Object { diff --git a/src/core/server/metrics/metrics_service.ts b/src/core/server/metrics/metrics_service.ts index 382848e0a80c3..78e4dd98f93d6 100644 --- a/src/core/server/metrics/metrics_service.ts +++ b/src/core/server/metrics/metrics_service.ts @@ -73,7 +73,7 @@ export class MetricsService private async refreshMetrics() { const metrics = await this.metricsCollector!.collect(); - const { message, ...meta } = getEcsOpsMetricsLog(metrics); + const { message, meta } = getEcsOpsMetricsLog(metrics); this.opsMetricsLogger.debug(message!, meta); this.metricsCollector!.reset(); this.metrics$.next(metrics); diff --git a/src/core/server/plugins/plugins_service.mock.ts b/src/core/server/plugins/plugins_service.mock.ts index 1d0ed7cb09299..f4f2263a1bdb0 100644 --- a/src/core/server/plugins/plugins_service.mock.ts +++ b/src/core/server/plugins/plugins_service.mock.ts @@ -19,6 +19,7 @@ const createStartContractMock = () => ({ contracts: new Map() }); const createServiceMock = (): PluginsServiceMock => ({ discover: jest.fn(), + getExposedPluginConfigsToUsage: jest.fn(), setup: jest.fn().mockResolvedValue(createSetupContractMock()), start: jest.fn().mockResolvedValue(createStartContractMock()), stop: jest.fn(), diff --git a/src/core/server/plugins/plugins_service.test.ts b/src/core/server/plugins/plugins_service.test.ts index 6bf7a1fadb4d3..5c50df07dc697 100644 --- a/src/core/server/plugins/plugins_service.test.ts +++ b/src/core/server/plugins/plugins_service.test.ts @@ -78,7 +78,7 @@ const createPlugin = ( manifest: { id, version, - configPath: `${configPath}${disabled ? '-disabled' : ''}`, + configPath: disabled ? configPath.concat('-disabled') : configPath, kibanaVersion, requiredPlugins, requiredBundles, @@ -374,7 +374,6 @@ describe('PluginsService', () => { expect(mockPluginSystem.addPlugin).toHaveBeenCalledTimes(2); expect(mockPluginSystem.addPlugin).toHaveBeenCalledWith(firstPlugin); expect(mockPluginSystem.addPlugin).toHaveBeenCalledWith(secondPlugin); - expect(mockDiscover).toHaveBeenCalledTimes(1); expect(mockDiscover).toHaveBeenCalledWith( { @@ -472,6 +471,88 @@ describe('PluginsService', () => { expect(pluginPaths).toEqual(['/plugin-A-path', '/plugin-B-path']); }); + + it('ppopulates pluginConfigUsageDescriptors with plugins exposeToUsage property', async () => { + const pluginA = createPlugin('plugin-with-expose-usage', { + path: 'plugin-with-expose-usage', + configPath: 'pathA', + }); + + jest.doMock( + join('plugin-with-expose-usage', 'server'), + () => ({ + config: { + exposeToUsage: { + test: true, + nested: { + prop: true, + }, + }, + schema: schema.maybe(schema.any()), + }, + }), + { + virtual: true, + } + ); + + const pluginB = createPlugin('plugin-with-array-configPath', { + path: 'plugin-with-array-configPath', + configPath: ['plugin', 'pathB'], + }); + + jest.doMock( + join('plugin-with-array-configPath', 'server'), + () => ({ + config: { + exposeToUsage: { + test: true, + }, + schema: schema.maybe(schema.any()), + }, + }), + { + virtual: true, + } + ); + + jest.doMock( + join('plugin-without-expose', 'server'), + () => ({ + config: { + schema: schema.maybe(schema.any()), + }, + }), + { + virtual: true, + } + ); + + const pluginC = createPlugin('plugin-without-expose', { + path: 'plugin-without-expose', + configPath: 'pathC', + }); + + mockDiscover.mockReturnValue({ + error$: from([]), + plugin$: from([pluginA, pluginB, pluginC]), + }); + + await pluginsService.discover({ environment: environmentSetup }); + + // eslint-disable-next-line dot-notation + expect(pluginsService['pluginConfigUsageDescriptors']).toMatchInlineSnapshot(` + Map { + "pathA" => Object { + "nested.prop": true, + "test": true, + }, + "plugin.pathB" => Object { + "test": true, + }, + } + `); + }); }); describe('#generateUiPluginsConfigs()', () => { @@ -624,6 +705,20 @@ describe('PluginsService', () => { }); }); + describe('#getExposedPluginConfigsToUsage', () => { + it('returns pluginConfigUsageDescriptors', () => { + // eslint-disable-next-line dot-notation + pluginsService['pluginConfigUsageDescriptors'].set('test', { enabled: true }); + expect(pluginsService.getExposedPluginConfigsToUsage()).toMatchInlineSnapshot(` + Map { + "test" => Object { + "enabled": true, + }, + } + `); + }); + }); + describe('#stop()', () => { it('`stop` stops plugins system', async () => { await pluginsService.stop(); diff --git a/src/core/server/plugins/plugins_service.ts b/src/core/server/plugins/plugins_service.ts index 09be40ecaf2a2..547fe00fdb1cf 100644 --- a/src/core/server/plugins/plugins_service.ts +++ b/src/core/server/plugins/plugins_service.ts @@ -9,7 +9,7 @@ import Path from 'path'; import { Observable } from 'rxjs'; import { filter, first, map, mergeMap, tap, toArray } from 'rxjs/operators'; -import { pick } from '@kbn/std'; +import { pick, getFlattenedObject } from '@kbn/std'; import { CoreService } from '../../types'; import { CoreContext } from '../core_context'; @@ -75,6 +75,7 @@ export class PluginsService implements CoreService; private readonly pluginConfigDescriptors = new Map(); private readonly uiPluginInternalInfo = new Map(); + private readonly pluginConfigUsageDescriptors = new Map>(); constructor(private readonly coreContext: CoreContext) { this.log = coreContext.logger.get('plugins-service'); @@ -109,6 +110,10 @@ export class PluginsService implements CoreService = T | undefined; + /** * Dedicated type for plugin configuration schema. * @@ -70,8 +72,39 @@ export interface PluginConfigDescriptor { * {@link PluginConfigSchema} */ schema: PluginConfigSchema; + /** + * Expose non-default configs to usage collection to be sent via telemetry. + * set a config to `true` to report the actual changed config value. + * set a config to `false` to report the changed config value as [redacted]. + * + * All changed configs except booleans and numbers will be reported + * as [redacted] unless otherwise specified. + * + * {@link MakeUsageFromSchema} + */ + exposeToUsage?: MakeUsageFromSchema; } +/** + * List of configuration values that will be exposed to usage collection. + * If parent node or actual config path is set to `true` then the actual value + * of these configs will be reoprted. + * If parent node or actual config path is set to `false` then the config + * will be reported as [redacted]. + * + * @public + */ +export type MakeUsageFromSchema = { + [Key in keyof T]?: T[Key] extends Maybe + ? // arrays of objects are always redacted + false + : T[Key] extends Maybe + ? boolean + : T[Key] extends Maybe + ? MakeUsageFromSchema | boolean + : boolean; +}; + /** * Dedicated type for plugin name/id that is supposed to make Map/Set/Arrays * that use it as a key or value more obvious. diff --git a/src/core/server/rendering/rendering_service.test.ts b/src/core/server/rendering/rendering_service.test.ts index 65df5cd6aa312..bba0dc6fd8a67 100644 --- a/src/core/server/rendering/rendering_service.test.ts +++ b/src/core/server/rendering/rendering_service.test.ts @@ -80,7 +80,7 @@ describe('RenderingService', () => { it('renders "core" page', async () => { const content = await render(createKibanaRequest(), uiSettings); const dom = load(content); - const data = JSON.parse(dom('kbn-injected-metadata').attr('data')); + const data = JSON.parse(dom('kbn-injected-metadata').attr('data') ?? '""'); expect(data).toMatchSnapshot(INJECTED_METADATA); }); @@ -90,7 +90,7 @@ describe('RenderingService', () => { const content = await render(createKibanaRequest(), uiSettings); const dom = load(content); - const data = JSON.parse(dom('kbn-injected-metadata').attr('data')); + const data = JSON.parse(dom('kbn-injected-metadata').attr('data') ?? '""'); expect(data).toMatchSnapshot(INJECTED_METADATA); }); @@ -99,7 +99,7 @@ describe('RenderingService', () => { uiSettings.getUserProvided.mockResolvedValue({ 'theme:darkMode': { userValue: true } }); const content = await render(createKibanaRequest(), uiSettings); const dom = load(content); - const data = JSON.parse(dom('kbn-injected-metadata').attr('data')); + const data = JSON.parse(dom('kbn-injected-metadata').attr('data') ?? '""'); expect(data).toMatchSnapshot(INJECTED_METADATA); }); @@ -109,7 +109,7 @@ describe('RenderingService', () => { includeUserSettings: false, }); const dom = load(content); - const data = JSON.parse(dom('kbn-injected-metadata').attr('data')); + const data = JSON.parse(dom('kbn-injected-metadata').attr('data') ?? '""'); expect(data).toMatchSnapshot(INJECTED_METADATA); }); @@ -117,7 +117,7 @@ describe('RenderingService', () => { it('renders "core" from legacy request', async () => { const content = await render(createRawRequest(), uiSettings); const dom = load(content); - const data = JSON.parse(dom('kbn-injected-metadata').attr('data')); + const data = JSON.parse(dom('kbn-injected-metadata').attr('data') ?? '""'); expect(data).toMatchSnapshot(INJECTED_METADATA); }); diff --git a/src/core/server/saved_objects/migrations/core/migration_logger.ts b/src/core/server/saved_objects/migrations/core/migration_logger.ts index e8cb6352195de..6c935b915ce68 100644 --- a/src/core/server/saved_objects/migrations/core/migration_logger.ts +++ b/src/core/server/saved_objects/migrations/core/migration_logger.ts @@ -24,7 +24,7 @@ export interface SavedObjectsMigrationLogger { */ warning: (msg: string) => void; warn: (msg: string) => void; - error: (msg: string, meta: LogMeta) => void; + error: (msg: string, meta: Meta) => void; } export class MigrationLogger implements SavedObjectsMigrationLogger { diff --git a/src/core/server/saved_objects/migrationsv2/migrations_state_action_machine.test.ts b/src/core/server/saved_objects/migrationsv2/migrations_state_action_machine.test.ts index fa2e65f16bb2d..a6617fc2fb7f4 100644 --- a/src/core/server/saved_objects/migrationsv2/migrations_state_action_machine.test.ts +++ b/src/core/server/saved_objects/migrationsv2/migrations_state_action_machine.test.ts @@ -211,86 +211,90 @@ describe('migrationsStateActionMachine', () => { Array [ "[.my-so-index] INIT -> LEGACY_DELETE", Object { - "batchSize": 1000, - "controlState": "LEGACY_DELETE", - "currentAlias": ".my-so-index", - "indexPrefix": ".my-so-index", - "kibanaVersion": "7.11.0", - "legacyIndex": ".my-so-index", - "logs": Array [ - Object { - "level": "info", - "message": "Log from LEGACY_DELETE control state", - }, - ], - "outdatedDocuments": Array [ - "1234", - ], - "outdatedDocumentsQuery": Object { - "bool": Object { - "should": Array [], - }, - }, - "preMigrationScript": Object { - "_tag": "None", - }, - "reason": "the fatal reason", - "retryAttempts": 5, - "retryCount": 0, - "retryDelay": 0, - "targetIndexMappings": Object { - "properties": Object {}, - }, - "tempIndex": ".my-so-index_7.11.0_reindex_temp", - "tempIndexMappings": Object { - "dynamic": false, - "properties": Object { - "migrationVersion": Object { - "dynamic": "true", - "type": "object", + "kibana": Object { + "migrationState": Object { + "batchSize": 1000, + "controlState": "LEGACY_DELETE", + "currentAlias": ".my-so-index", + "indexPrefix": ".my-so-index", + "kibanaVersion": "7.11.0", + "legacyIndex": ".my-so-index", + "logs": Array [ + Object { + "level": "info", + "message": "Log from LEGACY_DELETE control state", + }, + ], + "outdatedDocuments": Array [ + "1234", + ], + "outdatedDocumentsQuery": Object { + "bool": Object { + "should": Array [], + }, }, - "type": Object { - "type": "keyword", + "preMigrationScript": Object { + "_tag": "None", }, - }, - }, - "unusedTypesQuery": Object { - "_tag": "Some", - "value": Object { - "bool": Object { - "must_not": Array [ - Object { - "term": Object { - "type": "fleet-agent-events", - }, + "reason": "the fatal reason", + "retryAttempts": 5, + "retryCount": 0, + "retryDelay": 0, + "targetIndexMappings": Object { + "properties": Object {}, + }, + "tempIndex": ".my-so-index_7.11.0_reindex_temp", + "tempIndexMappings": Object { + "dynamic": false, + "properties": Object { + "migrationVersion": Object { + "dynamic": "true", + "type": "object", }, - Object { - "term": Object { - "type": "tsvb-validation-telemetry", - }, + "type": Object { + "type": "keyword", }, - Object { - "bool": Object { - "must": Array [ - Object { - "match": Object { - "type": "search-session", - }, + }, + }, + "unusedTypesQuery": Object { + "_tag": "Some", + "value": Object { + "bool": Object { + "must_not": Array [ + Object { + "term": Object { + "type": "fleet-agent-events", }, - Object { - "match": Object { - "search-session.persisted": false, - }, + }, + Object { + "term": Object { + "type": "tsvb-validation-telemetry", }, - ], - }, + }, + Object { + "bool": Object { + "must": Array [ + Object { + "match": Object { + "type": "search-session", + }, + }, + Object { + "match": Object { + "search-session.persisted": false, + }, + }, + ], + }, + }, + ], }, - ], + }, }, + "versionAlias": ".my-so-index_7.11.0", + "versionIndex": ".my-so-index_7.11.0_001", }, }, - "versionAlias": ".my-so-index_7.11.0", - "versionIndex": ".my-so-index_7.11.0_001", }, ], Array [ @@ -303,90 +307,94 @@ describe('migrationsStateActionMachine', () => { Array [ "[.my-so-index] LEGACY_DELETE -> FATAL", Object { - "batchSize": 1000, - "controlState": "FATAL", - "currentAlias": ".my-so-index", - "indexPrefix": ".my-so-index", - "kibanaVersion": "7.11.0", - "legacyIndex": ".my-so-index", - "logs": Array [ - Object { - "level": "info", - "message": "Log from LEGACY_DELETE control state", - }, - Object { - "level": "info", - "message": "Log from FATAL control state", - }, - ], - "outdatedDocuments": Array [ - "1234", - ], - "outdatedDocumentsQuery": Object { - "bool": Object { - "should": Array [], - }, - }, - "preMigrationScript": Object { - "_tag": "None", - }, - "reason": "the fatal reason", - "retryAttempts": 5, - "retryCount": 0, - "retryDelay": 0, - "targetIndexMappings": Object { - "properties": Object {}, - }, - "tempIndex": ".my-so-index_7.11.0_reindex_temp", - "tempIndexMappings": Object { - "dynamic": false, - "properties": Object { - "migrationVersion": Object { - "dynamic": "true", - "type": "object", + "kibana": Object { + "migrationState": Object { + "batchSize": 1000, + "controlState": "FATAL", + "currentAlias": ".my-so-index", + "indexPrefix": ".my-so-index", + "kibanaVersion": "7.11.0", + "legacyIndex": ".my-so-index", + "logs": Array [ + Object { + "level": "info", + "message": "Log from LEGACY_DELETE control state", + }, + Object { + "level": "info", + "message": "Log from FATAL control state", + }, + ], + "outdatedDocuments": Array [ + "1234", + ], + "outdatedDocumentsQuery": Object { + "bool": Object { + "should": Array [], + }, }, - "type": Object { - "type": "keyword", + "preMigrationScript": Object { + "_tag": "None", }, - }, - }, - "unusedTypesQuery": Object { - "_tag": "Some", - "value": Object { - "bool": Object { - "must_not": Array [ - Object { - "term": Object { - "type": "fleet-agent-events", - }, + "reason": "the fatal reason", + "retryAttempts": 5, + "retryCount": 0, + "retryDelay": 0, + "targetIndexMappings": Object { + "properties": Object {}, + }, + "tempIndex": ".my-so-index_7.11.0_reindex_temp", + "tempIndexMappings": Object { + "dynamic": false, + "properties": Object { + "migrationVersion": Object { + "dynamic": "true", + "type": "object", }, - Object { - "term": Object { - "type": "tsvb-validation-telemetry", - }, + "type": Object { + "type": "keyword", }, - Object { - "bool": Object { - "must": Array [ - Object { - "match": Object { - "type": "search-session", - }, + }, + }, + "unusedTypesQuery": Object { + "_tag": "Some", + "value": Object { + "bool": Object { + "must_not": Array [ + Object { + "term": Object { + "type": "fleet-agent-events", + }, + }, + Object { + "term": Object { + "type": "tsvb-validation-telemetry", }, - Object { - "match": Object { - "search-session.persisted": false, - }, + }, + Object { + "bool": Object { + "must": Array [ + Object { + "match": Object { + "type": "search-session", + }, + }, + Object { + "match": Object { + "search-session.persisted": false, + }, + }, + ], }, - ], - }, + }, + ], }, - ], + }, }, + "versionAlias": ".my-so-index_7.11.0", + "versionIndex": ".my-so-index_7.11.0_001", }, }, - "versionAlias": ".my-so-index_7.11.0", - "versionIndex": ".my-so-index_7.11.0_001", }, ], ] @@ -490,84 +498,88 @@ describe('migrationsStateActionMachine', () => { Array [ "[.my-so-index] INIT -> LEGACY_REINDEX", Object { - "batchSize": 1000, - "controlState": "LEGACY_REINDEX", - "currentAlias": ".my-so-index", - "indexPrefix": ".my-so-index", - "kibanaVersion": "7.11.0", - "legacyIndex": ".my-so-index", - "logs": Array [ - Object { - "level": "info", - "message": "Log from LEGACY_REINDEX control state", - }, - ], - "outdatedDocuments": Array [], - "outdatedDocumentsQuery": Object { - "bool": Object { - "should": Array [], - }, - }, - "preMigrationScript": Object { - "_tag": "None", - }, - "reason": "the fatal reason", - "retryAttempts": 5, - "retryCount": 0, - "retryDelay": 0, - "targetIndexMappings": Object { - "properties": Object {}, - }, - "tempIndex": ".my-so-index_7.11.0_reindex_temp", - "tempIndexMappings": Object { - "dynamic": false, - "properties": Object { - "migrationVersion": Object { - "dynamic": "true", - "type": "object", + "kibana": Object { + "migrationState": Object { + "batchSize": 1000, + "controlState": "LEGACY_REINDEX", + "currentAlias": ".my-so-index", + "indexPrefix": ".my-so-index", + "kibanaVersion": "7.11.0", + "legacyIndex": ".my-so-index", + "logs": Array [ + Object { + "level": "info", + "message": "Log from LEGACY_REINDEX control state", + }, + ], + "outdatedDocuments": Array [], + "outdatedDocumentsQuery": Object { + "bool": Object { + "should": Array [], + }, }, - "type": Object { - "type": "keyword", + "preMigrationScript": Object { + "_tag": "None", }, - }, - }, - "unusedTypesQuery": Object { - "_tag": "Some", - "value": Object { - "bool": Object { - "must_not": Array [ - Object { - "term": Object { - "type": "fleet-agent-events", - }, + "reason": "the fatal reason", + "retryAttempts": 5, + "retryCount": 0, + "retryDelay": 0, + "targetIndexMappings": Object { + "properties": Object {}, + }, + "tempIndex": ".my-so-index_7.11.0_reindex_temp", + "tempIndexMappings": Object { + "dynamic": false, + "properties": Object { + "migrationVersion": Object { + "dynamic": "true", + "type": "object", }, - Object { - "term": Object { - "type": "tsvb-validation-telemetry", - }, + "type": Object { + "type": "keyword", }, - Object { - "bool": Object { - "must": Array [ - Object { - "match": Object { - "type": "search-session", - }, + }, + }, + "unusedTypesQuery": Object { + "_tag": "Some", + "value": Object { + "bool": Object { + "must_not": Array [ + Object { + "term": Object { + "type": "fleet-agent-events", }, - Object { - "match": Object { - "search-session.persisted": false, - }, + }, + Object { + "term": Object { + "type": "tsvb-validation-telemetry", }, - ], - }, + }, + Object { + "bool": Object { + "must": Array [ + Object { + "match": Object { + "type": "search-session", + }, + }, + Object { + "match": Object { + "search-session.persisted": false, + }, + }, + ], + }, + }, + ], }, - ], + }, }, + "versionAlias": ".my-so-index_7.11.0", + "versionIndex": ".my-so-index_7.11.0_001", }, }, - "versionAlias": ".my-so-index_7.11.0", - "versionIndex": ".my-so-index_7.11.0_001", }, ], Array [ @@ -577,88 +589,92 @@ describe('migrationsStateActionMachine', () => { Array [ "[.my-so-index] LEGACY_REINDEX -> LEGACY_DELETE", Object { - "batchSize": 1000, - "controlState": "LEGACY_DELETE", - "currentAlias": ".my-so-index", - "indexPrefix": ".my-so-index", - "kibanaVersion": "7.11.0", - "legacyIndex": ".my-so-index", - "logs": Array [ - Object { - "level": "info", - "message": "Log from LEGACY_REINDEX control state", - }, - Object { - "level": "info", - "message": "Log from LEGACY_DELETE control state", - }, - ], - "outdatedDocuments": Array [], - "outdatedDocumentsQuery": Object { - "bool": Object { - "should": Array [], - }, - }, - "preMigrationScript": Object { - "_tag": "None", - }, - "reason": "the fatal reason", - "retryAttempts": 5, - "retryCount": 0, - "retryDelay": 0, - "targetIndexMappings": Object { - "properties": Object {}, - }, - "tempIndex": ".my-so-index_7.11.0_reindex_temp", - "tempIndexMappings": Object { - "dynamic": false, - "properties": Object { - "migrationVersion": Object { - "dynamic": "true", - "type": "object", + "kibana": Object { + "migrationState": Object { + "batchSize": 1000, + "controlState": "LEGACY_DELETE", + "currentAlias": ".my-so-index", + "indexPrefix": ".my-so-index", + "kibanaVersion": "7.11.0", + "legacyIndex": ".my-so-index", + "logs": Array [ + Object { + "level": "info", + "message": "Log from LEGACY_REINDEX control state", + }, + Object { + "level": "info", + "message": "Log from LEGACY_DELETE control state", + }, + ], + "outdatedDocuments": Array [], + "outdatedDocumentsQuery": Object { + "bool": Object { + "should": Array [], + }, }, - "type": Object { - "type": "keyword", + "preMigrationScript": Object { + "_tag": "None", }, - }, - }, - "unusedTypesQuery": Object { - "_tag": "Some", - "value": Object { - "bool": Object { - "must_not": Array [ - Object { - "term": Object { - "type": "fleet-agent-events", - }, + "reason": "the fatal reason", + "retryAttempts": 5, + "retryCount": 0, + "retryDelay": 0, + "targetIndexMappings": Object { + "properties": Object {}, + }, + "tempIndex": ".my-so-index_7.11.0_reindex_temp", + "tempIndexMappings": Object { + "dynamic": false, + "properties": Object { + "migrationVersion": Object { + "dynamic": "true", + "type": "object", }, - Object { - "term": Object { - "type": "tsvb-validation-telemetry", - }, + "type": Object { + "type": "keyword", }, - Object { - "bool": Object { - "must": Array [ - Object { - "match": Object { - "type": "search-session", - }, + }, + }, + "unusedTypesQuery": Object { + "_tag": "Some", + "value": Object { + "bool": Object { + "must_not": Array [ + Object { + "term": Object { + "type": "fleet-agent-events", + }, + }, + Object { + "term": Object { + "type": "tsvb-validation-telemetry", }, - Object { - "match": Object { - "search-session.persisted": false, - }, + }, + Object { + "bool": Object { + "must": Array [ + Object { + "match": Object { + "type": "search-session", + }, + }, + Object { + "match": Object { + "search-session.persisted": false, + }, + }, + ], }, - ], - }, + }, + ], }, - ], + }, }, + "versionAlias": ".my-so-index_7.11.0", + "versionIndex": ".my-so-index_7.11.0_001", }, }, - "versionAlias": ".my-so-index_7.11.0", - "versionIndex": ".my-so-index_7.11.0_001", }, ], ] diff --git a/src/core/server/saved_objects/migrationsv2/migrations_state_action_machine.ts b/src/core/server/saved_objects/migrationsv2/migrations_state_action_machine.ts index e35e21421ac1f..20177dda63b3b 100644 --- a/src/core/server/saved_objects/migrationsv2/migrations_state_action_machine.ts +++ b/src/core/server/saved_objects/migrationsv2/migrations_state_action_machine.ts @@ -13,6 +13,12 @@ import { CorruptSavedObjectError } from '../migrations/core/migrate_raw_docs'; import { Model, Next, stateActionMachine } from './state_action_machine'; import { State } from './types'; +interface StateLogMeta extends LogMeta { + kibana: { + migrationState: State; + }; +} + type ExecutionLog = Array< | { type: 'transition'; @@ -35,9 +41,15 @@ const logStateTransition = ( tookMs: number ) => { if (newState.logs.length > oldState.logs.length) { - newState.logs - .slice(oldState.logs.length) - .forEach((log) => logger[log.level](logMessagePrefix + log.message)); + newState.logs.slice(oldState.logs.length).forEach((log) => { + const getLogger = (level: keyof Logger) => { + if (level === 'error') { + return logger[level] as Logger['error']; + } + return logger[level] as Logger['info']; + }; + getLogger(log.level)(logMessagePrefix + log.message); + }); } logger.info( @@ -58,7 +70,14 @@ const dumpExecutionLog = (logger: Logger, logMessagePrefix: string, executionLog logger.error(logMessagePrefix + 'migration failed, dumping execution log:'); executionLog.forEach((log) => { if (log.type === 'transition') { - logger.info(logMessagePrefix + `${log.prevControlState} -> ${log.controlState}`, log.state); + logger.info( + logMessagePrefix + `${log.prevControlState} -> ${log.controlState}`, + { + kibana: { + migrationState: log.state, + }, + } + ); } if (log.type === 'response') { logger.info(logMessagePrefix + `${log.controlState} RESPONSE`, log.res as LogMeta); diff --git a/src/core/server/server.api.md b/src/core/server/server.api.md index e5804b3c9fc58..b4c6ee323cbac 100644 --- a/src/core/server/server.api.md +++ b/src/core/server/server.api.md @@ -49,6 +49,11 @@ import { DeleteTemplateParams } from 'elasticsearch'; import { DetailedPeerCertificate } from 'tls'; import { Duration } from 'moment'; import { Duration as Duration_2 } from 'moment-timezone'; +import { Ecs } from '@kbn/logging'; +import { EcsEventCategory } from '@kbn/logging'; +import { EcsEventKind } from '@kbn/logging'; +import { EcsEventOutcome } from '@kbn/logging'; +import { EcsEventType } from '@kbn/logging'; import { EnvironmentMode } from '@kbn/config'; import { estypes } from '@elastic/elasticsearch'; import { ExistsParams } from 'elasticsearch'; @@ -381,6 +386,9 @@ export { ConfigPath } export { ConfigService } +// @internal +export type ConfigUsageData = Record; + // @public export interface ContextSetup { createContextContainer(): IContextContainer; @@ -558,6 +566,8 @@ export interface CoreUsageData extends CoreUsageStats { // @internal export interface CoreUsageDataStart { + // (undocumented) + getConfigsUsageData(): Promise; getCoreUsageData(): Promise; } @@ -886,6 +896,16 @@ export interface DiscoveredPlugin { readonly requiredPlugins: readonly PluginName[]; } +export { Ecs } + +export { EcsEventCategory } + +export { EcsEventKind } + +export { EcsEventOutcome } + +export { EcsEventType } + // @public export type ElasticsearchClient = Omit & { transport: { @@ -1662,6 +1682,13 @@ export { LogMeta } export { LogRecord } +// Warning: (ae-forgotten-export) The symbol "Maybe" needs to be exported by the entry point index.d.ts +// +// @public +export type MakeUsageFromSchema = { + [Key in keyof T]?: T[Key] extends Maybe ? false : T[Key] extends Maybe ? boolean : T[Key] extends Maybe ? MakeUsageFromSchema | boolean : boolean; +}; + // @public export interface MetricsServiceSetup { readonly collectionInterval: number; @@ -1848,6 +1875,7 @@ export interface PluginConfigDescriptor { exposeToBrowser?: { [P in keyof T]?: boolean; }; + exposeToUsage?: MakeUsageFromSchema; schema: PluginConfigSchema; } @@ -2779,7 +2807,7 @@ export interface SavedObjectsMigrationLogger { // (undocumented) debug: (msg: string) => void; // (undocumented) - error: (msg: string, meta: LogMeta) => void; + error: (msg: string, meta: Meta) => void; // (undocumented) info: (msg: string) => void; // (undocumented) @@ -3234,9 +3262,9 @@ export const validBodyOutput: readonly ["data", "stream"]; // // src/core/server/elasticsearch/client/types.ts:94:7 - (ae-forgotten-export) The symbol "Explanation" needs to be exported by the entry point index.d.ts // src/core/server/http/router/response.ts:297:3 - (ae-forgotten-export) The symbol "KibanaResponse" needs to be exported by the entry point index.d.ts -// src/core/server/plugins/types.ts:293:3 - (ae-forgotten-export) The symbol "KibanaConfigType" needs to be exported by the entry point index.d.ts -// src/core/server/plugins/types.ts:293:3 - (ae-forgotten-export) The symbol "SharedGlobalConfigKeys" needs to be exported by the entry point index.d.ts -// src/core/server/plugins/types.ts:296:3 - (ae-forgotten-export) The symbol "SavedObjectsConfigType" needs to be exported by the entry point index.d.ts -// src/core/server/plugins/types.ts:401:5 - (ae-unresolved-link) The @link reference could not be resolved: The package "kibana" does not have an export "create" +// src/core/server/plugins/types.ts:326:3 - (ae-forgotten-export) The symbol "KibanaConfigType" needs to be exported by the entry point index.d.ts +// src/core/server/plugins/types.ts:326:3 - (ae-forgotten-export) The symbol "SharedGlobalConfigKeys" needs to be exported by the entry point index.d.ts +// src/core/server/plugins/types.ts:329:3 - (ae-forgotten-export) The symbol "SavedObjectsConfigType" needs to be exported by the entry point index.d.ts +// src/core/server/plugins/types.ts:434:5 - (ae-unresolved-link) The @link reference could not be resolved: The package "kibana" does not have an export "create" ``` diff --git a/src/core/server/server.ts b/src/core/server/server.ts index 45d11f9013fed..fcfca3a5e0e2f 100644 --- a/src/core/server/server.ts +++ b/src/core/server/server.ts @@ -247,6 +247,7 @@ export class Server { const coreUsageDataStart = this.coreUsageData.start({ elasticsearch: elasticsearchStart, savedObjects: savedObjectsStart, + exposedConfigsToUsage: this.plugins.getExposedPluginConfigsToUsage(), }); this.coreStart = { @@ -271,10 +272,10 @@ export class Server { this.log.debug('stopping server'); await this.legacy.stop(); + await this.http.stop(); // HTTP server has to stop before savedObjects and ES clients are closed to be able to gracefully attempt to resolve any pending requests await this.plugins.stop(); await this.savedObjects.stop(); await this.elasticsearch.stop(); - await this.http.stop(); await this.uiSettings.stop(); await this.rendering.stop(); await this.metrics.stop(); diff --git a/src/core/server/status/status_service.ts b/src/core/server/status/status_service.ts index 09cf5b92b2b8a..7724e7a5e44b4 100644 --- a/src/core/server/status/status_service.ts +++ b/src/core/server/status/status_service.ts @@ -12,7 +12,7 @@ import { isDeepStrictEqual } from 'util'; import { CoreService } from '../../types'; import { CoreContext } from '../core_context'; -import { Logger } from '../logging'; +import { Logger, LogMeta } from '../logging'; import { InternalElasticsearchServiceSetup } from '../elasticsearch'; import { InternalHttpServiceSetup } from '../http'; import { InternalSavedObjectsServiceSetup } from '../saved_objects'; @@ -26,6 +26,10 @@ import { ServiceStatus, CoreStatus, InternalStatusServiceSetup } from './types'; import { getSummaryStatus } from './get_summary_status'; import { PluginsStatusService } from './plugins_status'; +interface StatusLogMeta extends LogMeta { + kibana: { status: ServiceStatus }; +} + interface SetupDeps { elasticsearch: Pick; environment: InternalEnvironmentServiceSetup; @@ -70,7 +74,11 @@ export class StatusService implements CoreService { ...Object.entries(coreStatus), ...Object.entries(pluginsStatus), ]); - this.logger.debug(`Recalculated overall status`, { status: summary }); + this.logger.debug(`Recalculated overall status`, { + kibana: { + status: summary, + }, + }); return summary; }), distinctUntilChanged(isDeepStrictEqual), diff --git a/src/core/server/ui_settings/create_or_upgrade_saved_config/create_or_upgrade_saved_config.test.ts b/src/core/server/ui_settings/create_or_upgrade_saved_config/create_or_upgrade_saved_config.test.ts index b169c715b9b95..669849dcd8d9b 100644 --- a/src/core/server/ui_settings/create_or_upgrade_saved_config/create_or_upgrade_saved_config.test.ts +++ b/src/core/server/ui_settings/create_or_upgrade_saved_config/create_or_upgrade_saved_config.test.ts @@ -131,8 +131,12 @@ describe('uiSettings/createOrUpgradeSavedConfig', function () { Array [ "Upgrade config from 4.0.0 to 4.0.1", Object { - "newVersion": "4.0.1", - "prevVersion": "4.0.0", + "kibana": Object { + "config": Object { + "newVersion": "4.0.1", + "prevVersion": "4.0.0", + }, + }, }, ], ] diff --git a/src/core/server/ui_settings/create_or_upgrade_saved_config/create_or_upgrade_saved_config.ts b/src/core/server/ui_settings/create_or_upgrade_saved_config/create_or_upgrade_saved_config.ts index a32556d1aef6f..d015f506df6e3 100644 --- a/src/core/server/ui_settings/create_or_upgrade_saved_config/create_or_upgrade_saved_config.ts +++ b/src/core/server/ui_settings/create_or_upgrade_saved_config/create_or_upgrade_saved_config.ts @@ -10,10 +10,16 @@ import { defaults } from 'lodash'; import { SavedObjectsClientContract } from '../../saved_objects/types'; import { SavedObjectsErrorHelpers } from '../../saved_objects/'; -import { Logger } from '../../logging'; +import { Logger, LogMeta } from '../../logging'; import { getUpgradeableConfig } from './get_upgradeable_config'; +interface ConfigLogMeta extends LogMeta { + kibana: { + config: { prevVersion: string; newVersion: string }; + }; +} + interface Options { savedObjectsClient: SavedObjectsClientContract; version: string; @@ -60,9 +66,13 @@ export async function createOrUpgradeSavedConfig( } if (upgradeableConfig) { - log.debug(`Upgrade config from ${upgradeableConfig.id} to ${version}`, { - prevVersion: upgradeableConfig.id, - newVersion: version, + log.debug(`Upgrade config from ${upgradeableConfig.id} to ${version}`, { + kibana: { + config: { + prevVersion: upgradeableConfig.id, + newVersion: version, + }, + }, }); } } diff --git a/src/core/server/ui_settings/settings/notifications.test.ts b/src/core/server/ui_settings/settings/notifications.test.ts index c06371b3d731e..01e2905b0cc2c 100644 --- a/src/core/server/ui_settings/settings/notifications.test.ts +++ b/src/core/server/ui_settings/settings/notifications.test.ts @@ -36,15 +36,15 @@ describe('notifications settings', () => { expect(() => validate(42)).not.toThrow(); expect(() => validate('Infinity')).not.toThrow(); expect(() => validate(-12)).toThrowErrorMatchingInlineSnapshot(` -"types that failed validation: -- [0]: Value must be equal to or greater than [0]. -- [1]: expected value to equal [Infinity]" -`); + "types that failed validation: + - [0]: Value must be equal to or greater than [0]. + - [1]: expected value to equal [Infinity]" + `); expect(() => validate('foo')).toThrowErrorMatchingInlineSnapshot(` -"types that failed validation: -- [0]: expected value of type [number] but got [string] -- [1]: expected value to equal [Infinity]" -`); + "types that failed validation: + - [0]: expected value of type [number] but got [string] + - [1]: expected value to equal [Infinity]" + `); }); }); @@ -55,15 +55,15 @@ describe('notifications settings', () => { expect(() => validate(42)).not.toThrow(); expect(() => validate('Infinity')).not.toThrow(); expect(() => validate(-12)).toThrowErrorMatchingInlineSnapshot(` -"types that failed validation: -- [0]: Value must be equal to or greater than [0]. -- [1]: expected value to equal [Infinity]" -`); + "types that failed validation: + - [0]: Value must be equal to or greater than [0]. + - [1]: expected value to equal [Infinity]" + `); expect(() => validate('foo')).toThrowErrorMatchingInlineSnapshot(` -"types that failed validation: -- [0]: expected value of type [number] but got [string] -- [1]: expected value to equal [Infinity]" -`); + "types that failed validation: + - [0]: expected value of type [number] but got [string] + - [1]: expected value to equal [Infinity]" + `); }); }); @@ -74,15 +74,15 @@ describe('notifications settings', () => { expect(() => validate(42)).not.toThrow(); expect(() => validate('Infinity')).not.toThrow(); expect(() => validate(-12)).toThrowErrorMatchingInlineSnapshot(` -"types that failed validation: -- [0]: Value must be equal to or greater than [0]. -- [1]: expected value to equal [Infinity]" -`); + "types that failed validation: + - [0]: Value must be equal to or greater than [0]. + - [1]: expected value to equal [Infinity]" + `); expect(() => validate('foo')).toThrowErrorMatchingInlineSnapshot(` -"types that failed validation: -- [0]: expected value of type [number] but got [string] -- [1]: expected value to equal [Infinity]" -`); + "types that failed validation: + - [0]: expected value of type [number] but got [string] + - [1]: expected value to equal [Infinity]" + `); }); }); @@ -93,15 +93,15 @@ describe('notifications settings', () => { expect(() => validate(42)).not.toThrow(); expect(() => validate('Infinity')).not.toThrow(); expect(() => validate(-12)).toThrowErrorMatchingInlineSnapshot(` -"types that failed validation: -- [0]: Value must be equal to or greater than [0]. -- [1]: expected value to equal [Infinity]" -`); + "types that failed validation: + - [0]: Value must be equal to or greater than [0]. + - [1]: expected value to equal [Infinity]" + `); expect(() => validate('foo')).toThrowErrorMatchingInlineSnapshot(` -"types that failed validation: -- [0]: expected value of type [number] but got [string] -- [1]: expected value to equal [Infinity]" -`); + "types that failed validation: + - [0]: expected value of type [number] but got [string] + - [1]: expected value to equal [Infinity]" + `); }); }); }); diff --git a/src/core/server/ui_settings/settings/notifications.ts b/src/core/server/ui_settings/settings/notifications.ts index 22bdf17681808..746f7851a748f 100644 --- a/src/core/server/ui_settings/settings/notifications.ts +++ b/src/core/server/ui_settings/settings/notifications.ts @@ -45,15 +45,11 @@ export const getNotificationsSettings = (): Record => value: 3000000, description: i18n.translate('core.ui_settings.params.notifications.bannerLifetimeText', { defaultMessage: - 'The time in milliseconds which a banner notification will be displayed on-screen for. ' + - 'Setting to {infinityValue} will disable the countdown.', - values: { - infinityValue: 'Infinity', - }, + 'The time in milliseconds which a banner notification will be displayed on-screen for. ', }), type: 'number', category: ['notifications'], - schema: schema.oneOf([schema.number({ min: 0 }), schema.literal('Infinity')]), + schema: schema.oneOf([schema.number({ min: 0 }), schema.literal('Infinity')]), // Setting to 'Infinity' will disable the countdown. }, 'notifications:lifetime:error': { name: i18n.translate('core.ui_settings.params.notifications.errorLifetimeTitle', { @@ -62,15 +58,11 @@ export const getNotificationsSettings = (): Record => value: 300000, description: i18n.translate('core.ui_settings.params.notifications.errorLifetimeText', { defaultMessage: - 'The time in milliseconds which an error notification will be displayed on-screen for. ' + - 'Setting to {infinityValue} will disable.', - values: { - infinityValue: 'Infinity', - }, + 'The time in milliseconds which an error notification will be displayed on-screen for. ', }), type: 'number', category: ['notifications'], - schema: schema.oneOf([schema.number({ min: 0 }), schema.literal('Infinity')]), + schema: schema.oneOf([schema.number({ min: 0 }), schema.literal('Infinity')]), // Setting to 'Infinity' will disable }, 'notifications:lifetime:warning': { name: i18n.translate('core.ui_settings.params.notifications.warningLifetimeTitle', { @@ -79,15 +71,11 @@ export const getNotificationsSettings = (): Record => value: 10000, description: i18n.translate('core.ui_settings.params.notifications.warningLifetimeText', { defaultMessage: - 'The time in milliseconds which a warning notification will be displayed on-screen for. ' + - 'Setting to {infinityValue} will disable.', - values: { - infinityValue: 'Infinity', - }, + 'The time in milliseconds which a warning notification will be displayed on-screen for. ', }), type: 'number', category: ['notifications'], - schema: schema.oneOf([schema.number({ min: 0 }), schema.literal('Infinity')]), + schema: schema.oneOf([schema.number({ min: 0 }), schema.literal('Infinity')]), // Setting to 'Infinity' will disable }, 'notifications:lifetime:info': { name: i18n.translate('core.ui_settings.params.notifications.infoLifetimeTitle', { @@ -96,15 +84,11 @@ export const getNotificationsSettings = (): Record => value: 5000, description: i18n.translate('core.ui_settings.params.notifications.infoLifetimeText', { defaultMessage: - 'The time in milliseconds which an information notification will be displayed on-screen for. ' + - 'Setting to {infinityValue} will disable.', - values: { - infinityValue: 'Infinity', - }, + 'The time in milliseconds which an information notification will be displayed on-screen for. ', }), type: 'number', category: ['notifications'], - schema: schema.oneOf([schema.number({ min: 0 }), schema.literal('Infinity')]), + schema: schema.oneOf([schema.number({ min: 0 }), schema.literal('Infinity')]), // Setting to 'Infinity' will disable }, }; }; diff --git a/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker b/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker index 93e9ba52dce28..220bd2c91057d 100755 --- a/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker +++ b/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker @@ -229,6 +229,7 @@ kibana_vars=( xpack.maps.enabled xpack.maps.showMapVisualizationTypes xpack.ml.enabled + xpack.observability.unsafe.alertingExperience.enabled xpack.reporting.capture.browser.autoDownload xpack.reporting.capture.browser.chromium.disableSandbox xpack.reporting.capture.browser.chromium.inspect @@ -272,7 +273,9 @@ kibana_vars=( xpack.reporting.queue.pollIntervalErrorMultiplier xpack.reporting.queue.timeout xpack.reporting.roles.allow + xpack.reporting.roles.enabled xpack.rollup.enabled + xpack.ruleRegistry.unsafe.write.enabled xpack.searchprofiler.enabled xpack.security.audit.enabled xpack.security.audit.appender.type diff --git a/src/plugins/console/server/lib/spec_definitions/js/search.ts b/src/plugins/console/server/lib/spec_definitions/js/search.ts index 686737b96ac83..5a3b37e2e4135 100644 --- a/src/plugins/console/server/lib/spec_definitions/js/search.ts +++ b/src/plugins/console/server/lib/spec_definitions/js/search.ts @@ -16,7 +16,7 @@ export const search = (specService: SpecDefinitionsService) => { // populated by a global rule }, profile: { - __one_of: ['true', 'false'], + __one_of: [true, false], }, aggs: { __template: { @@ -118,6 +118,26 @@ export const search = (specService: SpecDefinitionsService) => { }, }, docvalue_fields: ['{field}'], + fields: { + __one_of: [ + [ + { + __one_of: [ + '{field}', + '*', + { + field: '{field}', + include_unmapped: { + __one_of: ['true', 'false'], + }, + format: '', + }, + ], + }, + ], + '*', + ], + }, collapse: { __template: { field: 'FIELD', @@ -144,6 +164,19 @@ export const search = (specService: SpecDefinitionsService) => { __scope_link: 'GLOBAL.script', }, }, + runtime_mappings: { + __template: { + FIELD: { + type: '', + script: { + // populated by a global rule + }, + }, + }, + '*': { + __scope_link: 'GLOBAL.script', + }, + }, partial_fields: { __template: { NAME: { @@ -160,8 +193,11 @@ export const search = (specService: SpecDefinitionsService) => { }, _source: { __one_of: [ - '{field}', ['{field}'], + '*', + '{field}', + true, + false, { includes: { __one_of: ['{field}', ['{field}']], diff --git a/src/plugins/data/README.mdx b/src/plugins/data/README.mdx index 30006e2b497bd..fba5cbd6d48e1 100644 --- a/src/plugins/data/README.mdx +++ b/src/plugins/data/README.mdx @@ -623,8 +623,7 @@ The `SearchSource` API is a convenient way to construct and run an Elasticsearch #### Default Search Strategy -One benefit of using the low-level search API, is partial response support in X-Pack, allowing for a better and more responsive user experience. -In OSS only the final result is returned. +One benefit of using the low-level search API, is partial response support, allowing for a better and more responsive user experience. ```.ts import { isCompleteResponse } from '../plugins/data/public'; diff --git a/src/plugins/data/common/es_query/kuery/functions/is.test.ts b/src/plugins/data/common/es_query/kuery/functions/is.test.ts index 20de6fc3ae7b8..55aac8189c1d8 100644 --- a/src/plugins/data/common/es_query/kuery/functions/is.test.ts +++ b/src/plugins/data/common/es_query/kuery/functions/is.test.ts @@ -70,6 +70,29 @@ describe('kuery functions', () => { expect(result).toEqual(expected); }); + test('should return an ES match_all query for queries that match all fields and values', () => { + const expected = { + match_all: {}, + }; + const node = nodeTypes.function.buildNode('is', 'n*', '*'); + const result = is.toElasticsearchQuery(node, { + ...indexPattern, + fields: indexPattern.fields.filter((field) => field.name.startsWith('n')), + }); + + expect(result).toEqual(expected); + }); + + test('should return an ES match_all query for * queries without an index pattern', () => { + const expected = { + match_all: {}, + }; + const node = nodeTypes.function.buildNode('is', '*', '*'); + const result = is.toElasticsearchQuery(node); + + expect(result).toEqual(expected); + }); + test('should return an ES multi_match query using default_field when fieldName is null', () => { const expected = { multi_match: { diff --git a/src/plugins/data/common/es_query/kuery/functions/is.ts b/src/plugins/data/common/es_query/kuery/functions/is.ts index eb89f8a3c1d41..a18ad230c3cae 100644 --- a/src/plugins/data/common/es_query/kuery/functions/is.ts +++ b/src/plugins/data/common/es_query/kuery/functions/is.ts @@ -46,12 +46,21 @@ export function toElasticsearchQuery( const { arguments: [fieldNameArg, valueArg, isPhraseArg], } = node; + + const isExistsQuery = valueArg.type === 'wildcard' && valueArg.value === wildcard.wildcardSymbol; + const isAllFieldsQuery = + fieldNameArg.type === 'wildcard' && fieldNameArg.value === wildcard.wildcardSymbol; + const isMatchAllQuery = isExistsQuery && isAllFieldsQuery; + + if (isMatchAllQuery) { + return { match_all: {} }; + } + const fullFieldNameArg = getFullFieldNameNode( fieldNameArg, indexPattern, context?.nested ? context.nested.path : undefined ); - const fieldName = ast.toElasticsearchQuery(fullFieldNameArg); const value = !isUndefined(valueArg) ? ast.toElasticsearchQuery(valueArg) : valueArg; const type = isPhraseArg.value ? 'phrase' : 'best_fields'; if (fullFieldNameArg.value === null) { @@ -86,13 +95,8 @@ export function toElasticsearchQuery( }); } - const isExistsQuery = valueArg.type === 'wildcard' && (value as any) === '*'; - const isAllFieldsQuery = - (fullFieldNameArg.type === 'wildcard' && ((fieldName as unknown) as string) === '*') || - (fields && indexPattern && fields.length === indexPattern.fields.length); - const isMatchAllQuery = isExistsQuery && isAllFieldsQuery; - - if (isMatchAllQuery) { + // Special case for wildcards where there are no fields or all fields share the same prefix + if (isExistsQuery && (!fields?.length || fields?.length === indexPattern?.fields.length)) { return { match_all: {} }; } diff --git a/src/plugins/data/common/search/aggs/buckets/lib/time_buckets/time_buckets.test.ts b/src/plugins/data/common/search/aggs/buckets/lib/time_buckets/time_buckets.test.ts index e694591c7b33d..6fbaddb09b226 100644 --- a/src/plugins/data/common/search/aggs/buckets/lib/time_buckets/time_buckets.test.ts +++ b/src/plugins/data/common/search/aggs/buckets/lib/time_buckets/time_buckets.test.ts @@ -109,7 +109,7 @@ describe('TimeBuckets', () => { } }); - test('setInterval/getInterval - intreval is a "auto"', () => { + test('setInterval/getInterval - interval is a "auto"', () => { const timeBuckets = new TimeBuckets(timeBucketConfig); timeBuckets.setInterval(autoInterval); const interval = timeBuckets.getInterval(); @@ -120,6 +120,16 @@ describe('TimeBuckets', () => { expect(interval.expression).toEqual('0ms'); }); + test('setInterval/getInterval - interval is a "auto" (useNormalizedEsInterval is false)', () => { + const timeBuckets = new TimeBuckets(timeBucketConfig); + timeBuckets.setInterval(autoInterval); + const interval = timeBuckets.getInterval(false); + + expect(interval.esValue).toEqual(0); + expect(interval.esUnit).toEqual('ms'); + expect(interval.expression).toEqual('0ms'); + }); + test('getScaledDateFormat', () => { const timeBuckets = new TimeBuckets(timeBucketConfig); timeBuckets.setInterval('20m'); diff --git a/src/plugins/data/common/search/aggs/buckets/lib/time_buckets/time_buckets.ts b/src/plugins/data/common/search/aggs/buckets/lib/time_buckets/time_buckets.ts index ac58cea60a6ef..12c6d39ad905a 100644 --- a/src/plugins/data/common/search/aggs/buckets/lib/time_buckets/time_buckets.ts +++ b/src/plugins/data/common/search/aggs/buckets/lib/time_buckets/time_buckets.ts @@ -267,9 +267,10 @@ export class TimeBuckets { originalUnit = splitStringInterval(this._originalInterval!)?.unit; } - const esInterval = useNormalizedEsInterval - ? convertDurationToNormalizedEsInterval(interval, originalUnit) - : convertIntervalToEsInterval(String(this._originalInterval)); + const esInterval = + useNormalizedEsInterval || !this._originalInterval + ? convertDurationToNormalizedEsInterval(interval, originalUnit) + : convertIntervalToEsInterval(this._originalInterval); const prettyUnits = moment.normalizeUnits(esInterval.unit); diff --git a/src/plugins/data/common/search/index.ts b/src/plugins/data/common/search/index.ts index 1b74cec2fc847..badbb94e9752f 100644 --- a/src/plugins/data/common/search/index.ts +++ b/src/plugins/data/common/search/index.ts @@ -7,10 +7,13 @@ */ export * from './aggs'; -export * from './es_search'; export * from './expressions'; export * from './search_source'; export * from './tabify'; export * from './types'; export * from './utils'; export * from './session'; +export * from './poll_search'; +export * from './strategies/es_search'; +export * from './strategies/eql_search'; +export * from './strategies/ese_search'; diff --git a/x-pack/plugins/data_enhanced/common/search/poll_search.test.ts b/src/plugins/data/common/search/poll_search.test.ts similarity index 95% rename from x-pack/plugins/data_enhanced/common/search/poll_search.test.ts rename to src/plugins/data/common/search/poll_search.test.ts index 36fd326e39672..037fd0fc059d1 100644 --- a/x-pack/plugins/data_enhanced/common/search/poll_search.test.ts +++ b/src/plugins/data/common/search/poll_search.test.ts @@ -1,8 +1,9 @@ /* * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. */ import { pollSearch } from './poll_search'; diff --git a/x-pack/plugins/data_enhanced/common/search/poll_search.ts b/src/plugins/data/common/search/poll_search.ts similarity index 82% rename from x-pack/plugins/data_enhanced/common/search/poll_search.ts rename to src/plugins/data/common/search/poll_search.ts index a6946b4dfde7c..fa31f2cb208a6 100644 --- a/x-pack/plugins/data_enhanced/common/search/poll_search.ts +++ b/src/plugins/data/common/search/poll_search.ts @@ -1,16 +1,19 @@ /* * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. */ import { from, Observable, timer, defer, fromEvent, EMPTY } from 'rxjs'; import { expand, map, switchMap, takeUntil, takeWhile, tap } from 'rxjs/operators'; -import type { IKibanaSearchResponse } from '../../../../../src/plugins/data/common'; +import type { + IAsyncSearchOptions, + IKibanaSearchResponse, +} from '../../../../../src/plugins/data/common'; import { isErrorResponse, isPartialResponse } from '../../../../../src/plugins/data/common'; import { AbortError } from '../../../../../src/plugins/kibana_utils/common'; -import type { IAsyncSearchOptions } from './types'; export const pollSearch = ( search: () => Promise, diff --git a/src/plugins/data/common/search/search_source/search_source.test.ts b/src/plugins/data/common/search/search_source/search_source.test.ts index 7f8a4fceff05d..012fc5257397b 100644 --- a/src/plugins/data/common/search/search_source/search_source.test.ts +++ b/src/plugins/data/common/search/search_source/search_source.test.ts @@ -418,10 +418,16 @@ describe('SearchSource', () => { docvalueFields: [], }), } as unknown) as IndexPattern); - searchSource.setField('fields', ['hello', 'foo']); - + searchSource.setField('fields', [ + 'hello', + 'foo-bar', + 'foo--bar', + 'fooo', + 'somethingfoo', + 'xxfxxoxxo', + ]); const request = searchSource.getSearchRequestBody(); - expect(request.fields).toEqual(['hello']); + expect(request.fields).toEqual(['hello', 'fooo', 'somethingfoo', 'xxfxxoxxo']); }); test('request all fields from index pattern except the ones specified with source filters', async () => { diff --git a/src/plugins/data/common/search/search_source/search_source.ts b/src/plugins/data/common/search/search_source/search_source.ts index 1c1c32228703f..6f34d5ce1f29c 100644 --- a/src/plugins/data/common/search/search_source/search_source.ts +++ b/src/plugins/data/common/search/search_source/search_source.ts @@ -635,18 +635,15 @@ export class SearchSource { if (!sourceFilters || sourceFilters.excludes?.length === 0 || bodyFields.length === 0) { return bodyFields; } - const metaFields = this.dependencies.getConfig(UI_SETTINGS.META_FIELDS); const sourceFiltersValues = sourceFilters.excludes; const wildcardField = bodyFields.find( (el: SearchFieldValue) => el === '*' || (el as Record).field === '*' ); - const filterSourceFields = (fieldName: string) => { - return ( - fieldName && - !sourceFiltersValues.some((sourceFilter) => fieldName.match(sourceFilter)) && - !metaFields.includes(fieldName) - ); - }; + const filter = fieldWildcardFilter( + sourceFiltersValues, + this.dependencies.getConfig(UI_SETTINGS.META_FIELDS) + ); + const filterSourceFields = (fieldName: string) => fieldName && filter(fieldName); if (!wildcardField) { // we already have an explicit list of fields, so we just remove source filters from that list return bodyFields.filter((fld: SearchFieldValue) => diff --git a/src/plugins/data/common/search/es_search/index.ts b/src/plugins/data/common/search/strategies/eql_search/index.ts similarity index 100% rename from src/plugins/data/common/search/es_search/index.ts rename to src/plugins/data/common/search/strategies/eql_search/index.ts diff --git a/x-pack/plugins/data_enhanced/common/search/types.ts b/src/plugins/data/common/search/strategies/eql_search/types.ts similarity index 58% rename from x-pack/plugins/data_enhanced/common/search/types.ts rename to src/plugins/data/common/search/strategies/eql_search/types.ts index 0692371155ce3..a30adbaf47c60 100644 --- a/x-pack/plugins/data_enhanced/common/search/types.ts +++ b/src/plugins/data/common/search/strategies/eql_search/types.ts @@ -1,20 +1,15 @@ /* * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. */ import { EqlSearch } from '@elastic/elasticsearch/api/requestParams'; import { ApiResponse, TransportRequestOptions } from '@elastic/elasticsearch/lib/Transport'; -import { - ISearchOptions, - IKibanaSearchRequest, - IKibanaSearchResponse, -} from '../../../../../src/plugins/data/common'; - -export const ENHANCED_ES_SEARCH_STRATEGY = 'ese'; +import { IKibanaSearchRequest, IKibanaSearchResponse } from '../../types'; export const EQL_SEARCH_STRATEGY = 'eql'; @@ -25,10 +20,3 @@ export interface EqlSearchStrategyRequest extends IKibanaSearchRequest = IKibanaSearchResponse>; - -export interface IAsyncSearchOptions extends ISearchOptions { - /** - * The number of milliseconds to wait between receiving a response and sending another request - */ - pollInterval?: number; -} diff --git a/packages/kbn-docs-utils/src/release_notes/index.ts b/src/plugins/data/common/search/strategies/es_search/index.ts similarity index 93% rename from packages/kbn-docs-utils/src/release_notes/index.ts rename to src/plugins/data/common/search/strategies/es_search/index.ts index 7ee97ec9aa05d..12594660136d8 100644 --- a/packages/kbn-docs-utils/src/release_notes/index.ts +++ b/src/plugins/data/common/search/strategies/es_search/index.ts @@ -6,4 +6,4 @@ * Side Public License, v 1. */ -export * from './cli'; +export * from './types'; diff --git a/src/plugins/data/common/search/es_search/types.ts b/src/plugins/data/common/search/strategies/es_search/types.ts similarity index 98% rename from src/plugins/data/common/search/es_search/types.ts rename to src/plugins/data/common/search/strategies/es_search/types.ts index 12dc0c1b2599d..05df661d466c8 100644 --- a/src/plugins/data/common/search/es_search/types.ts +++ b/src/plugins/data/common/search/strategies/es_search/types.ts @@ -7,7 +7,7 @@ */ import type { estypes } from '@elastic/elasticsearch'; -import { IKibanaSearchRequest, IKibanaSearchResponse } from '../types'; +import { IKibanaSearchRequest, IKibanaSearchResponse } from '../../types'; export const ES_SEARCH_STRATEGY = 'es'; diff --git a/packages/kbn-docs-utils/src/release_notes/lib/type_helpers.ts b/src/plugins/data/common/search/strategies/ese_search/index.ts similarity index 78% rename from packages/kbn-docs-utils/src/release_notes/lib/type_helpers.ts rename to src/plugins/data/common/search/strategies/ese_search/index.ts index 81860160094de..12594660136d8 100644 --- a/packages/kbn-docs-utils/src/release_notes/lib/type_helpers.ts +++ b/src/plugins/data/common/search/strategies/ese_search/index.ts @@ -6,4 +6,4 @@ * Side Public License, v 1. */ -export type ArrayItem = T extends ReadonlyArray ? X : never; +export * from './types'; diff --git a/packages/kbn-docs-utils/src/release_notes/lib/get_fix_references.ts b/src/plugins/data/common/search/strategies/ese_search/types.ts similarity index 54% rename from packages/kbn-docs-utils/src/release_notes/lib/get_fix_references.ts rename to src/plugins/data/common/search/strategies/ese_search/types.ts index c4c8ed0f9a9ea..202455b52dc10 100644 --- a/packages/kbn-docs-utils/src/release_notes/lib/get_fix_references.ts +++ b/src/plugins/data/common/search/strategies/ese_search/types.ts @@ -6,13 +6,13 @@ * Side Public License, v 1. */ -const FIXES_RE = /(?:closes|close|closed|fix|fixes|fixed|resolve|resolves|resolved)[ :]*(#\d*)/gi; +import { ISearchOptions } from '../../types'; -export function getFixReferences(prText: string) { - const fixes: string[] = []; - let match; - while ((match = FIXES_RE.exec(prText))) { - fixes.push(match[1]); - } - return fixes; +export const ENHANCED_ES_SEARCH_STRATEGY = 'ese'; + +export interface IAsyncSearchOptions extends ISearchOptions { + /** + * The number of milliseconds to wait between receiving a response and sending another request + */ + pollInterval?: number; } diff --git a/src/plugins/data/common/search/types.ts b/src/plugins/data/common/search/types.ts index e3ec499a0020d..d1890ec97df4e 100644 --- a/src/plugins/data/common/search/types.ts +++ b/src/plugins/data/common/search/types.ts @@ -7,8 +7,7 @@ */ import { Observable } from 'rxjs'; -import { IEsSearchRequest, IEsSearchResponse } from './es_search'; -import { IndexPattern } from '..'; +import { IEsSearchRequest, IEsSearchResponse, IndexPattern } from '..'; import type { RequestAdapter } from '../../../inspector/common'; export type ISearchGeneric = < diff --git a/src/plugins/data/config.ts b/src/plugins/data/config.ts index 7a4e79efa2f0a..72fa547f44a77 100644 --- a/src/plugins/data/config.ts +++ b/src/plugins/data/config.ts @@ -30,3 +30,62 @@ export const configSchema = schema.object({ }); export type ConfigSchema = TypeOf; + +export const searchSessionsConfigSchema = schema.object({ + /** + * Turns the feature on \ off (incl. removing indicator and management screens) + */ + enabled: schema.boolean({ defaultValue: true }), + /** + * pageSize controls how many search session objects we load at once while monitoring + * session completion + */ + pageSize: schema.number({ defaultValue: 100 }), + /** + * trackingInterval controls how often we track search session objects progress + */ + trackingInterval: schema.duration({ defaultValue: '10s' }), + + /** + * monitoringTaskTimeout controls for how long task manager waits for search session monitoring task to complete before considering it timed out, + * If tasks timeouts it receives cancel signal and next task starts in "trackingInterval" time + */ + monitoringTaskTimeout: schema.duration({ defaultValue: '5m' }), + + /** + * notTouchedTimeout controls how long do we store unpersisted search session results, + * after the last search in the session has completed + */ + notTouchedTimeout: schema.duration({ defaultValue: '5m' }), + /** + * notTouchedInProgressTimeout controls how long do allow a search session to run after + * a user has navigated away without persisting + */ + notTouchedInProgressTimeout: schema.duration({ defaultValue: '1m' }), + /** + * maxUpdateRetries controls how many retries we perform while attempting to save a search session + */ + maxUpdateRetries: schema.number({ defaultValue: 3 }), + + /** + * defaultExpiration controls how long search sessions are valid for, until they are expired. + */ + defaultExpiration: schema.duration({ defaultValue: '7d' }), + management: schema.object({ + /** + * maxSessions controls how many saved search sessions we display per page on the management screen. + */ + maxSessions: schema.number({ defaultValue: 10000 }), + /** + * refreshInterval controls how often we refresh the management screen. + */ + refreshInterval: schema.duration({ defaultValue: '10s' }), + /** + * refreshTimeout controls how often we refresh the management screen. + */ + refreshTimeout: schema.duration({ defaultValue: '1m' }), + expiresSoonWarning: schema.duration({ defaultValue: '1d' }), + }), +}); + +export type SearchSessionsConfigSchema = TypeOf; diff --git a/src/plugins/data/public/index.ts b/src/plugins/data/public/index.ts index e86b64d135d59..f2a61e94a07d9 100644 --- a/src/plugins/data/public/index.ts +++ b/src/plugins/data/public/index.ts @@ -380,14 +380,17 @@ export { EsdslExpressionFunctionDefinition, EsRawResponseExpressionTypeDefinition, // errors + IEsError, SearchError, SearchTimeoutError, TimeoutErrorMode, PainlessError, + Reason, noSearchSessionStorageCapabilityMessage, SEARCH_SESSIONS_MANAGEMENT_ID, waitUntilNextSessionCompletes$, WaitUntilNextSessionCompletesOptions, + isEsError, } from './search'; export type { diff --git a/src/plugins/data/public/public.api.md b/src/plugins/data/public/public.api.md index dc138b7347d04..820619aa05ed8 100644 --- a/src/plugins/data/public/public.api.md +++ b/src/plugins/data/public/public.api.md @@ -1132,6 +1132,13 @@ export interface IDataPluginServices extends Partial { usageCollection?: UsageCollectionStart; } +// Warning: (ae-forgotten-export) The symbol "KibanaServerError" needs to be exported by the entry point index.d.ts +// Warning: (ae-forgotten-export) The symbol "IEsErrorAttributes" needs to be exported by the entry point index.d.ts +// Warning: (ae-missing-release-tag) "IEsError" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// +// @public (undocumented) +export type IEsError = KibanaServerError; + // Warning: (ae-missing-release-tag) "IEsSearchRequest" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) // // @public (undocumented) @@ -1730,6 +1737,11 @@ export interface ISearchStartSearchSource { // @public (undocumented) export const isErrorResponse: (response?: IKibanaSearchResponse | undefined) => boolean | undefined; +// Warning: (ae-missing-release-tag) "isEsError" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// +// @public +export function isEsError(e: any): e is IEsError; + // Warning: (ae-forgotten-export) The symbol "SessionsClient" needs to be exported by the entry point index.d.ts // Warning: (ae-missing-release-tag) "ISessionsClient" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) // @@ -1919,7 +1931,6 @@ export interface OptionedValueProp { // // @public (undocumented) export class PainlessError extends EsError { - // Warning: (ae-forgotten-export) The symbol "IEsError" needs to be exported by the entry point index.d.ts constructor(err: IEsError, indexPattern?: IndexPattern); // (undocumented) getErrorMessage(application: ApplicationStart): JSX.Element; @@ -2202,6 +2213,33 @@ export interface RangeFilterParams { to?: number | string; } +// Warning: (ae-missing-release-tag) "Reason" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// +// @public (undocumented) +export interface Reason { + // (undocumented) + caused_by?: { + type: string; + reason: string; + }; + // (undocumented) + lang?: string; + // (undocumented) + position?: { + offset: number; + start: number; + end: number; + }; + // (undocumented) + reason: string; + // (undocumented) + script?: string; + // (undocumented) + script_stack?: string[]; + // (undocumented) + type: string; +} + // Warning: (ae-missing-release-tag) "RefreshInterval" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) // // @public (undocumented) @@ -2316,8 +2354,8 @@ export const SEARCH_SESSIONS_MANAGEMENT_ID = "search_sessions"; // Warning: (ae-missing-release-tag) "SearchBar" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) // // @public (undocumented) -export const SearchBar: React.ComponentClass, "query" | "placeholder" | "isLoading" | "iconType" | "indexPatterns" | "filters" | "dataTestSubj" | "isClearable" | "refreshInterval" | "nonKqlMode" | "nonKqlModeHelpText" | "screenTitle" | "onRefresh" | "onRefreshChange" | "showQueryInput" | "showDatePicker" | "showAutoRefreshOnly" | "dateRangeFrom" | "dateRangeTo" | "isRefreshPaused" | "customSubmitButton" | "timeHistory" | "indicateNoData" | "onFiltersUpdated" | "savedQuery" | "showSaveQuery" | "onClearSavedQuery" | "showQueryBar" | "showFilterBar" | "onQueryChange" | "onQuerySubmit" | "onSaved" | "onSavedQueryUpdated">, any> & { - WrappedComponent: React.ComponentType & ReactIntl.InjectedIntlProps>; +export const SearchBar: React.ComponentClass, "query" | "placeholder" | "isLoading" | "iconType" | "indexPatterns" | "filters" | "dataTestSubj" | "refreshInterval" | "isClearable" | "nonKqlMode" | "nonKqlModeHelpText" | "screenTitle" | "onRefresh" | "onRefreshChange" | "showQueryInput" | "showDatePicker" | "showAutoRefreshOnly" | "dateRangeFrom" | "dateRangeTo" | "isRefreshPaused" | "customSubmitButton" | "timeHistory" | "indicateNoData" | "onFiltersUpdated" | "savedQuery" | "showSaveQuery" | "onClearSavedQuery" | "showQueryBar" | "showFilterBar" | "onQueryChange" | "onQuerySubmit" | "onSaved" | "onSavedQueryUpdated">, any> & { + WrappedComponent: React.ComponentType & ReactIntl.InjectedIntlProps>; }; // Warning: (ae-forgotten-export) The symbol "SearchBarOwnProps" needs to be exported by the entry point index.d.ts @@ -2358,7 +2396,6 @@ export class SearchInterceptor { protected getSerializableOptions(options?: ISearchOptions): Pick; // (undocumented) protected getTimeoutMode(): TimeoutErrorMode; - // Warning: (ae-forgotten-export) The symbol "KibanaServerError" needs to be exported by the entry point index.d.ts // Warning: (ae-forgotten-export) The symbol "AbortError" needs to be exported by the entry point index.d.ts // // (undocumented) @@ -2718,20 +2755,20 @@ export interface WaitUntilNextSessionCompletesOptions { // src/plugins/data/public/index.ts:238:27 - (ae-forgotten-export) The symbol "validateIndexPattern" needs to be exported by the entry point index.d.ts // src/plugins/data/public/index.ts:238:27 - (ae-forgotten-export) The symbol "flattenHitWrapper" needs to be exported by the entry point index.d.ts // src/plugins/data/public/index.ts:238:27 - (ae-forgotten-export) The symbol "formatHitProvider" needs to be exported by the entry point index.d.ts -// src/plugins/data/public/index.ts:404:20 - (ae-forgotten-export) The symbol "getResponseInspectorStats" needs to be exported by the entry point index.d.ts -// src/plugins/data/public/index.ts:404:20 - (ae-forgotten-export) The symbol "tabifyAggResponse" needs to be exported by the entry point index.d.ts -// src/plugins/data/public/index.ts:404:20 - (ae-forgotten-export) The symbol "tabifyGetColumns" needs to be exported by the entry point index.d.ts -// src/plugins/data/public/index.ts:406:1 - (ae-forgotten-export) The symbol "CidrMask" needs to be exported by the entry point index.d.ts -// src/plugins/data/public/index.ts:407:1 - (ae-forgotten-export) The symbol "dateHistogramInterval" needs to be exported by the entry point index.d.ts -// src/plugins/data/public/index.ts:416:1 - (ae-forgotten-export) The symbol "InvalidEsCalendarIntervalError" needs to be exported by the entry point index.d.ts -// src/plugins/data/public/index.ts:417:1 - (ae-forgotten-export) The symbol "InvalidEsIntervalFormatError" needs to be exported by the entry point index.d.ts -// src/plugins/data/public/index.ts:418:1 - (ae-forgotten-export) The symbol "Ipv4Address" needs to be exported by the entry point index.d.ts -// src/plugins/data/public/index.ts:419:1 - (ae-forgotten-export) The symbol "isDateHistogramBucketAggConfig" needs to be exported by the entry point index.d.ts -// src/plugins/data/public/index.ts:423:1 - (ae-forgotten-export) The symbol "isValidEsInterval" needs to be exported by the entry point index.d.ts -// src/plugins/data/public/index.ts:424:1 - (ae-forgotten-export) The symbol "isValidInterval" needs to be exported by the entry point index.d.ts -// src/plugins/data/public/index.ts:427:1 - (ae-forgotten-export) The symbol "parseInterval" needs to be exported by the entry point index.d.ts -// src/plugins/data/public/index.ts:428:1 - (ae-forgotten-export) The symbol "propFilter" needs to be exported by the entry point index.d.ts -// src/plugins/data/public/index.ts:431:1 - (ae-forgotten-export) The symbol "toAbsoluteDates" needs to be exported by the entry point index.d.ts +// src/plugins/data/public/index.ts:407:20 - (ae-forgotten-export) The symbol "getResponseInspectorStats" needs to be exported by the entry point index.d.ts +// src/plugins/data/public/index.ts:407:20 - (ae-forgotten-export) The symbol "tabifyAggResponse" needs to be exported by the entry point index.d.ts +// src/plugins/data/public/index.ts:407:20 - (ae-forgotten-export) The symbol "tabifyGetColumns" needs to be exported by the entry point index.d.ts +// src/plugins/data/public/index.ts:409:1 - (ae-forgotten-export) The symbol "CidrMask" needs to be exported by the entry point index.d.ts +// src/plugins/data/public/index.ts:410:1 - (ae-forgotten-export) The symbol "dateHistogramInterval" needs to be exported by the entry point index.d.ts +// src/plugins/data/public/index.ts:419:1 - (ae-forgotten-export) The symbol "InvalidEsCalendarIntervalError" needs to be exported by the entry point index.d.ts +// src/plugins/data/public/index.ts:420:1 - (ae-forgotten-export) The symbol "InvalidEsIntervalFormatError" needs to be exported by the entry point index.d.ts +// src/plugins/data/public/index.ts:421:1 - (ae-forgotten-export) The symbol "Ipv4Address" needs to be exported by the entry point index.d.ts +// src/plugins/data/public/index.ts:422:1 - (ae-forgotten-export) The symbol "isDateHistogramBucketAggConfig" needs to be exported by the entry point index.d.ts +// src/plugins/data/public/index.ts:426:1 - (ae-forgotten-export) The symbol "isValidEsInterval" needs to be exported by the entry point index.d.ts +// src/plugins/data/public/index.ts:427:1 - (ae-forgotten-export) The symbol "isValidInterval" needs to be exported by the entry point index.d.ts +// src/plugins/data/public/index.ts:430:1 - (ae-forgotten-export) The symbol "parseInterval" needs to be exported by the entry point index.d.ts +// src/plugins/data/public/index.ts:431:1 - (ae-forgotten-export) The symbol "propFilter" needs to be exported by the entry point index.d.ts +// src/plugins/data/public/index.ts:434:1 - (ae-forgotten-export) The symbol "toAbsoluteDates" needs to be exported by the entry point index.d.ts // src/plugins/data/public/query/state_sync/connect_to_query_state.ts:34:5 - (ae-forgotten-export) The symbol "FilterStateStore" needs to be exported by the entry point index.d.ts // src/plugins/data/public/search/session/session_service.ts:56:5 - (ae-forgotten-export) The symbol "UrlGeneratorStateMapping" needs to be exported by the entry point index.d.ts diff --git a/src/plugins/data/public/search/errors/types.ts b/src/plugins/data/public/search/errors/types.ts index e8760902be636..445293fe47ea3 100644 --- a/src/plugins/data/public/search/errors/types.ts +++ b/src/plugins/data/public/search/errors/types.ts @@ -37,6 +37,7 @@ export interface IEsErrorAttributes { reason: string; root_cause?: Reason[]; failed_shards?: FailedShard[]; + caused_by?: IEsErrorAttributes; } export type IEsError = KibanaServerError; diff --git a/src/plugins/data/public/search/search_interceptor.test.ts b/src/plugins/data/public/search/search_interceptor.test.ts index f890fdc3e30a3..e74581e9a6ffe 100644 --- a/src/plugins/data/public/search/search_interceptor.test.ts +++ b/src/plugins/data/public/search/search_interceptor.test.ts @@ -136,7 +136,7 @@ describe('SearchInterceptor', () => { await searchInterceptor.search(mockRequest, { sessionId }).toPromise(); expect(fetchMock.mock.calls[0][0]).toEqual( expect.objectContaining({ - options: { sessionId, isStored: true, isRestore: true }, + options: { sessionId, isStored: true, isRestore: true, strategy: 'es' }, }) ); diff --git a/src/plugins/data/public/search/search_interceptor.ts b/src/plugins/data/public/search/search_interceptor.ts index e3fb31c9179fd..f0df6f9216c0f 100644 --- a/src/plugins/data/public/search/search_interceptor.ts +++ b/src/plugins/data/public/search/search_interceptor.ts @@ -14,6 +14,7 @@ import { CoreStart, CoreSetup, ToastsSetup } from 'kibana/public'; import { i18n } from '@kbn/i18n'; import { BatchedFunc, BfetchPublicSetup } from 'src/plugins/bfetch/public'; import { + ES_SEARCH_STRATEGY, IKibanaSearchRequest, IKibanaSearchResponse, ISearchOptions, @@ -189,6 +190,11 @@ export class SearchInterceptor { request: IKibanaSearchRequest, options: ISearchOptions = {} ): Observable { + options = { + strategy: ES_SEARCH_STRATEGY, + ...options, + }; + // Defer the following logic until `subscribe` is actually called return defer(() => { if (options.abortSignal?.aborted) { diff --git a/src/plugins/data/public/utils/table_inspector_view/components/__snapshots__/data_view.test.tsx.snap b/src/plugins/data/public/utils/table_inspector_view/components/__snapshots__/data_view.test.tsx.snap index 4436efb1f3508..9896a6dbdc7b7 100644 --- a/src/plugins/data/public/utils/table_inspector_view/components/__snapshots__/data_view.test.tsx.snap +++ b/src/plugins/data/public/utils/table_inspector_view/components/__snapshots__/data_view.test.tsx.snap @@ -1112,19 +1112,19 @@ exports[`Inspector Data View component should render single table without select - - - - Click to sort in ascending order - - - + + + + Click to sort in ascending order + + + @@ -2666,19 +2666,19 @@ exports[`Inspector Data View component should support multiple datatables 1`] = - - - - Click to sort in ascending order - - - + + + + Click to sort in ascending order + + + diff --git a/src/plugins/data/server/index.ts b/src/plugins/data/server/index.ts index fa54f45d2feb2..c4e132e33fc3b 100644 --- a/src/plugins/data/server/index.ts +++ b/src/plugins/data/server/index.ts @@ -235,6 +235,8 @@ export { ISearchSessionService, SearchRequestHandlerContext, DataRequestHandlerContext, + AsyncSearchResponse, + AsyncSearchStatusResponse, } from './search'; // Search namespace diff --git a/src/plugins/data/server/search/README.md b/src/plugins/data/server/search/README.md index 33e6d9ab0bd1a..b564c34a7f8b3 100644 --- a/src/plugins/data/server/search/README.md +++ b/src/plugins/data/server/search/README.md @@ -5,9 +5,8 @@ object, and return a response object, of a given shape. Both client side search strategies can be registered, as well as server side search strategies. -The `search` plugin includes two one concrete client side implementations - - `SYNC_SEARCH_STRATEGY` and `ES_SEARCH_STRATEGY` which uses `SYNC_SEARCH_STRATEGY`. There is also one - default server side search strategy, `ES_SEARCH_STRATEGY`. +The `search` plugin includes: - Includes the `esSearch` plugin in order to search for data from Elasticsearch using Elasticsearch -DSL. +- ES_SEARCH_STRATEGY - hitting regular es `_search` endpoint using query DSL +- (default) ESE_SEARCH_STRATEGY (Enhanced ES) - hitting `_async_search` endpoint and works with search sessions +- EQL_SEARCH_STRATEGY diff --git a/src/plugins/data/server/search/index.ts b/src/plugins/data/server/search/index.ts index 0e09595f76a86..812f3171aef99 100644 --- a/src/plugins/data/server/search/index.ts +++ b/src/plugins/data/server/search/index.ts @@ -7,7 +7,9 @@ */ export * from './types'; -export * from './es_search'; +export * from './strategies/es_search'; +export * from './strategies/ese_search'; +export * from './strategies/eql_search'; export { usageProvider, SearchUsage, searchUsageObserver } from './collectors'; export * from './aggs'; export * from './session'; diff --git a/src/plugins/data/server/search/search_service.test.ts b/src/plugins/data/server/search/search_service.test.ts index d5a83efcc215f..52ee8e60a5b26 100644 --- a/src/plugins/data/server/search/search_service.test.ts +++ b/src/plugins/data/server/search/search_service.test.ts @@ -29,6 +29,7 @@ import { // eslint-disable-next-line @kbn/eslint/no-restricted-paths import { expressionsPluginMock } from '../../../expressions/public/mocks'; import { createSearchSessionsClientMock } from './mocks'; +import { ENHANCED_ES_SEARCH_STRATEGY } from '../../common'; describe('Search service', () => { let plugin: SearchService; @@ -85,7 +86,7 @@ describe('Search service', () => { describe('asScopedProvider', () => { let mockScopedClient: IScopedSearchClient; - let searcPluginStart: ISearchStart>; + let searchPluginStart: ISearchStart>; let mockStrategy: any; let mockStrategyNoCancel: jest.Mocked; let mockSessionService: ISearchSessionService; @@ -112,21 +113,20 @@ describe('Search service', () => { bfetch: bfetchPluginMock.createSetupContract(), expressions: expressionsPluginMock.createSetupContract(), }); - pluginSetup.registerSearchStrategy('es', mockStrategy); + pluginSetup.registerSearchStrategy(ENHANCED_ES_SEARCH_STRATEGY, mockStrategy); pluginSetup.registerSearchStrategy('nocancel', mockStrategyNoCancel); pluginSetup.__enhance({ - defaultStrategy: 'es', sessionService: mockSessionService, }); - searcPluginStart = plugin.start(mockCoreStart, { + searchPluginStart = plugin.start(mockCoreStart, { fieldFormats: createFieldFormatsStartMock(), indexPatterns: createIndexPatternsStartMock(), }); const r: any = {}; - mockScopedClient = searcPluginStart.asScoped(r); + mockScopedClient = searchPluginStart.asScoped(r); }); describe('search', () => { @@ -269,7 +269,7 @@ describe('Search service', () => { it('cancels a saved object and search ids', async () => { const mockMap = new Map(); - mockMap.set('abc', 'es'); + mockMap.set('abc', ENHANCED_ES_SEARCH_STRATEGY); mockSessionClient.getSearchIdMapping = jest.fn().mockResolvedValue(mockMap); mockStrategy.cancel = jest.fn(); mockSessionClient.cancel = jest.fn().mockResolvedValue(mockSavedObject); @@ -281,13 +281,13 @@ describe('Search service', () => { const [searchId, options] = mockStrategy.cancel.mock.calls[0]; expect(mockStrategy.cancel).toHaveBeenCalledTimes(1); expect(searchId).toBe('abc'); - expect(options).toHaveProperty('strategy', 'es'); + expect(options).toHaveProperty('strategy', ENHANCED_ES_SEARCH_STRATEGY); }); it('cancels a saved object with some strategies that dont support cancellation, dont throw an error', async () => { const mockMap = new Map(); mockMap.set('abc', 'nocancel'); - mockMap.set('def', 'es'); + mockMap.set('def', ENHANCED_ES_SEARCH_STRATEGY); mockSessionClient.getSearchIdMapping = jest.fn().mockResolvedValue(mockMap); mockStrategy.cancel = jest.fn(); mockSessionClient.cancel = jest.fn().mockResolvedValue(mockSavedObject); @@ -299,13 +299,13 @@ describe('Search service', () => { const [searchId, options] = mockStrategy.cancel.mock.calls[0]; expect(mockStrategy.cancel).toHaveBeenCalledTimes(1); expect(searchId).toBe('def'); - expect(options).toHaveProperty('strategy', 'es'); + expect(options).toHaveProperty('strategy', ENHANCED_ES_SEARCH_STRATEGY); }); it('cancels a saved object with some strategies that dont exist, dont throw an error', async () => { const mockMap = new Map(); mockMap.set('abc', 'notsupported'); - mockMap.set('def', 'es'); + mockMap.set('def', ENHANCED_ES_SEARCH_STRATEGY); mockSessionClient.getSearchIdMapping = jest.fn().mockResolvedValue(mockMap); mockStrategy.cancel = jest.fn(); mockSessionClient.cancel = jest.fn().mockResolvedValue(mockSavedObject); @@ -317,7 +317,7 @@ describe('Search service', () => { const [searchId, options] = mockStrategy.cancel.mock.calls[0]; expect(mockStrategy.cancel).toHaveBeenCalledTimes(1); expect(searchId).toBe('def'); - expect(options).toHaveProperty('strategy', 'es'); + expect(options).toHaveProperty('strategy', ENHANCED_ES_SEARCH_STRATEGY); }); }); @@ -349,7 +349,7 @@ describe('Search service', () => { it('deletes a saved object and search ids', async () => { const mockMap = new Map(); - mockMap.set('abc', 'es'); + mockMap.set('abc', ENHANCED_ES_SEARCH_STRATEGY); mockSessionClient.getSearchIdMapping = jest.fn().mockResolvedValue(mockMap); mockSessionClient.delete = jest.fn().mockResolvedValue(mockSavedObject); mockStrategy.cancel = jest.fn(); @@ -361,13 +361,13 @@ describe('Search service', () => { const [searchId, options] = mockStrategy.cancel.mock.calls[0]; expect(mockStrategy.cancel).toHaveBeenCalledTimes(1); expect(searchId).toBe('abc'); - expect(options).toHaveProperty('strategy', 'es'); + expect(options).toHaveProperty('strategy', ENHANCED_ES_SEARCH_STRATEGY); }); it('deletes a saved object with some strategies that dont support cancellation, dont throw an error', async () => { const mockMap = new Map(); mockMap.set('abc', 'nocancel'); - mockMap.set('def', 'es'); + mockMap.set('def', ENHANCED_ES_SEARCH_STRATEGY); mockSessionClient.getSearchIdMapping = jest.fn().mockResolvedValue(mockMap); mockSessionClient.delete = jest.fn().mockResolvedValue(mockSavedObject); mockStrategy.cancel = jest.fn(); @@ -379,13 +379,13 @@ describe('Search service', () => { const [searchId, options] = mockStrategy.cancel.mock.calls[0]; expect(mockStrategy.cancel).toHaveBeenCalledTimes(1); expect(searchId).toBe('def'); - expect(options).toHaveProperty('strategy', 'es'); + expect(options).toHaveProperty('strategy', ENHANCED_ES_SEARCH_STRATEGY); }); it('deletes a saved object with some strategies that dont exist, dont throw an error', async () => { const mockMap = new Map(); mockMap.set('abc', 'notsupported'); - mockMap.set('def', 'es'); + mockMap.set('def', ENHANCED_ES_SEARCH_STRATEGY); mockSessionClient.getSearchIdMapping = jest.fn().mockResolvedValue(mockMap); mockStrategy.cancel = jest.fn(); mockSessionClient.delete = jest.fn().mockResolvedValue(mockSavedObject); @@ -397,7 +397,7 @@ describe('Search service', () => { const [searchId, options] = mockStrategy.cancel.mock.calls[0]; expect(mockStrategy.cancel).toHaveBeenCalledTimes(1); expect(searchId).toBe('def'); - expect(options).toHaveProperty('strategy', 'es'); + expect(options).toHaveProperty('strategy', ENHANCED_ES_SEARCH_STRATEGY); }); }); @@ -429,7 +429,7 @@ describe('Search service', () => { it('extends a saved object and search ids', async () => { const mockMap = new Map(); - mockMap.set('abc', 'es'); + mockMap.set('abc', ENHANCED_ES_SEARCH_STRATEGY); mockSessionClient.getSearchIdMapping = jest.fn().mockResolvedValue(mockMap); mockSessionClient.extend = jest.fn().mockResolvedValue(mockSavedObject); mockStrategy.extend = jest.fn(); @@ -441,13 +441,13 @@ describe('Search service', () => { const [searchId, keepAlive, options] = mockStrategy.extend.mock.calls[0]; expect(searchId).toBe('abc'); expect(keepAlive).toContain('ms'); - expect(options).toHaveProperty('strategy', 'es'); + expect(options).toHaveProperty('strategy', ENHANCED_ES_SEARCH_STRATEGY); }); it('doesnt extend the saved object with some strategies that dont support cancellation, throws an error', async () => { const mockMap = new Map(); mockMap.set('abc', 'nocancel'); - mockMap.set('def', 'es'); + mockMap.set('def', ENHANCED_ES_SEARCH_STRATEGY); mockSessionClient.getSearchIdMapping = jest.fn().mockResolvedValue(mockMap); mockSessionClient.extend = jest.fn().mockResolvedValue(mockSavedObject); mockStrategy.extend = jest.fn().mockResolvedValue({}); @@ -462,13 +462,13 @@ describe('Search service', () => { const [searchId, keepAlive, options] = mockStrategy.extend.mock.calls[0]; expect(searchId).toBe('def'); expect(keepAlive).toContain('ms'); - expect(options).toHaveProperty('strategy', 'es'); + expect(options).toHaveProperty('strategy', ENHANCED_ES_SEARCH_STRATEGY); }); it('doesnt extend the saved object with some strategies that dont exist, throws an error', async () => { const mockMap = new Map(); mockMap.set('abc', 'notsupported'); - mockMap.set('def', 'es'); + mockMap.set('def', ENHANCED_ES_SEARCH_STRATEGY); mockSessionClient.getSearchIdMapping = jest.fn().mockResolvedValue(mockMap); mockSessionClient.extend = jest.fn().mockResolvedValue(mockSavedObject); mockStrategy.extend = jest.fn().mockResolvedValue({}); @@ -483,7 +483,7 @@ describe('Search service', () => { const [searchId, keepAlive, options] = mockStrategy.extend.mock.calls[0]; expect(searchId).toBe('def'); expect(keepAlive).toContain('ms'); - expect(options).toHaveProperty('strategy', 'es'); + expect(options).toHaveProperty('strategy', ENHANCED_ES_SEARCH_STRATEGY); }); }); }); diff --git a/src/plugins/data/server/search/search_service.ts b/src/plugins/data/server/search/search_service.ts index e53244fa7ff26..0201f3226fd38 100644 --- a/src/plugins/data/server/search/search_service.ts +++ b/src/plugins/data/server/search/search_service.ts @@ -37,7 +37,7 @@ import { AggsService } from './aggs'; import { FieldFormatsStart } from '../field_formats'; import { IndexPatternsServiceStart } from '../index_patterns'; import { getCallMsearch, registerMsearchRoute, registerSearchRoute } from './routes'; -import { ES_SEARCH_STRATEGY, esSearchStrategyProvider } from './es_search'; +import { ES_SEARCH_STRATEGY, esSearchStrategyProvider } from './strategies/es_search'; import { DataPluginStart, DataPluginStartDependencies } from '../plugin'; import { UsageCollectionSetup } from '../../../usage_collection/server'; import { registerUsageCollector } from './collectors/register'; @@ -64,6 +64,8 @@ import { SearchSourceService, phraseFilterFunction, esRawResponse, + ENHANCED_ES_SEARCH_STRATEGY, + EQL_SEARCH_STRATEGY, } from '../../common/search'; import { getEsaggs, getEsdsl } from './expressions'; import { @@ -76,6 +78,8 @@ import { ISearchSessionService, SearchSessionService } from './session'; import { KbnServerError } from '../../../kibana_utils/server'; import { registerBsearchRoute } from './routes/bsearch'; import { getKibanaContext } from './expressions/kibana_context'; +import { enhancedEsSearchStrategyProvider } from './strategies/ese_search'; +import { eqlSearchStrategyProvider } from './strategies/eql_search'; type StrategyMap = Record>; @@ -101,7 +105,6 @@ export interface SearchRouteDependencies { export class SearchService implements Plugin { private readonly aggsService = new AggsService(); private readonly searchSourceService = new SearchSourceService(); - private defaultSearchStrategyName: string = ES_SEARCH_STRATEGY; private searchStrategies: StrategyMap = {}; private sessionService: ISearchSessionService; private asScoped!: ISearchStart['asScoped']; @@ -143,6 +146,17 @@ export class SearchService implements Plugin { ) ); + this.registerSearchStrategy( + ENHANCED_ES_SEARCH_STRATEGY, + enhancedEsSearchStrategyProvider( + this.initializerContext.config.legacy.globalConfig$, + this.logger, + usage + ) + ); + + this.registerSearchStrategy(EQL_SEARCH_STRATEGY, eqlSearchStrategyProvider(this.logger)); + registerBsearchRoute(bfetch, (request: KibanaRequest) => this.asScoped(request)); core.savedObjects.registerType(searchTelemetry); @@ -181,9 +195,6 @@ export class SearchService implements Plugin { return { __enhance: (enhancements: SearchEnhancements) => { - if (this.searchStrategies.hasOwnProperty(enhancements.defaultStrategy)) { - this.defaultSearchStrategyName = enhancements.defaultStrategy; - } this.sessionService = enhancements.sessionService; }, aggs, @@ -261,7 +272,7 @@ export class SearchService implements Plugin { SearchStrategyRequest extends IKibanaSearchRequest = IEsSearchRequest, SearchStrategyResponse extends IKibanaSearchResponse = IEsSearchResponse >( - name: string = this.defaultSearchStrategyName + name: string = ENHANCED_ES_SEARCH_STRATEGY ): ISearchStrategy => { this.logger.debug(`Get strategy ${name}`); const strategy = this.searchStrategies[name]; @@ -344,6 +355,7 @@ export class SearchService implements Plugin { strategy: strategyName, isStored: true, }; + return this.cancel(deps, searchId, searchOptions); }) ); diff --git a/src/plugins/data/server/search/session/mocks.ts b/src/plugins/data/server/search/session/mocks.ts index c173e1a1290ea..4deaecbf8056d 100644 --- a/src/plugins/data/server/search/session/mocks.ts +++ b/src/plugins/data/server/search/session/mocks.ts @@ -6,7 +6,9 @@ * Side Public License, v 1. */ +import moment from 'moment'; import { IScopedSearchSessionsClient } from './types'; +import { SearchSessionsConfigSchema } from '../../../config'; export function createSearchSessionsClientMock(): jest.Mocked< IScopedSearchSessionsClient @@ -22,5 +24,11 @@ export function createSearchSessionsClientMock(): jest.Mocked< cancel: jest.fn(), extend: jest.fn(), delete: jest.fn(), + getConfig: jest.fn( + () => + (({ + defaultExpiration: moment.duration('1', 'm'), + } as unknown) as SearchSessionsConfigSchema) + ), }; } diff --git a/src/plugins/data/server/search/session/session_service.ts b/src/plugins/data/server/search/session/session_service.ts index 2ed44b4e57d94..a23b315e47211 100644 --- a/src/plugins/data/server/search/session/session_service.ts +++ b/src/plugins/data/server/search/session/session_service.ts @@ -44,6 +44,9 @@ export class SearchSessionService implements ISearchSessionService { delete: async () => { throw new Error('delete not implemented in OSS search session service'); }, + getConfig: () => { + return null; + }, }); } } diff --git a/src/plugins/data/server/search/session/types.ts b/src/plugins/data/server/search/session/types.ts index 816716360415d..3083cc7d335e8 100644 --- a/src/plugins/data/server/search/session/types.ts +++ b/src/plugins/data/server/search/session/types.ts @@ -15,6 +15,7 @@ import { SavedObjectsUpdateResponse, } from 'kibana/server'; import { IKibanaSearchRequest, ISearchOptions } from '../../../common/search'; +import { SearchSessionsConfigSchema } from '../../../config'; export interface IScopedSearchSessionsClient { getId: (request: IKibanaSearchRequest, options: ISearchOptions) => Promise; @@ -31,6 +32,7 @@ export interface IScopedSearchSessionsClient { cancel: (sessionId: string) => Promise<{}>; delete: (sessionId: string) => Promise<{}>; extend: (sessionId: string, expires: Date) => Promise>; + getConfig: () => SearchSessionsConfigSchema | null; } export interface ISearchSessionService { diff --git a/x-pack/plugins/data_enhanced/server/search/eql_search_strategy.test.ts b/src/plugins/data/server/search/strategies/eql_search/eql_search_strategy.test.ts similarity index 95% rename from x-pack/plugins/data_enhanced/server/search/eql_search_strategy.test.ts rename to src/plugins/data/server/search/strategies/eql_search/eql_search_strategy.test.ts index b7f10f0a5388c..85ac5d8d17992 100644 --- a/x-pack/plugins/data_enhanced/server/search/eql_search_strategy.test.ts +++ b/src/plugins/data/server/search/strategies/eql_search/eql_search_strategy.test.ts @@ -1,14 +1,15 @@ /* * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. */ import type { Logger } from 'kibana/server'; -import { EqlSearchStrategyRequest } from '../../common/search/types'; import { eqlSearchStrategyProvider } from './eql_search_strategy'; -import { SearchStrategyDependencies } from '../../../../../src/plugins/data/server'; +import { SearchStrategyDependencies } from '../../types'; +import { EqlSearchStrategyRequest } from '../../../../common'; const getMockEqlResponse = () => ({ body: { diff --git a/x-pack/plugins/data_enhanced/server/search/eql_search_strategy.ts b/src/plugins/data/server/search/strategies/eql_search/eql_search_strategy.ts similarity index 84% rename from x-pack/plugins/data_enhanced/server/search/eql_search_strategy.ts rename to src/plugins/data/server/search/strategies/eql_search/eql_search_strategy.ts index 9c1bedc4d5f1c..0e3acedfe12f6 100644 --- a/x-pack/plugins/data_enhanced/server/search/eql_search_strategy.ts +++ b/src/plugins/data/server/search/strategies/eql_search/eql_search_strategy.ts @@ -1,23 +1,25 @@ /* * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. */ + import type { ApiResponse } from '@elastic/elasticsearch'; import { tap } from 'rxjs/operators'; import type { IScopedClusterClient, Logger } from 'kibana/server'; -import type { ISearchStrategy } from '../../../../../src/plugins/data/server'; -import type { +import { EqlSearchStrategyRequest, EqlSearchStrategyResponse, IAsyncSearchOptions, -} from '../../common'; -import { getDefaultSearchParams, shimAbortSignal } from '../../../../../src/plugins/data/server'; -import { pollSearch } from '../../common'; -import { getDefaultAsyncGetParams, getIgnoreThrottled } from './request_utils'; + pollSearch, +} from '../../../../common'; import { toEqlKibanaSearchResponse } from './response_utils'; import { EqlSearchResponse } from './types'; +import { ISearchStrategy } from '../../types'; +import { getDefaultSearchParams, shimAbortSignal } from '../es_search'; +import { getDefaultAsyncGetParams, getIgnoreThrottled } from '../ese_search/request_utils'; export const eqlSearchStrategyProvider = ( logger: Logger diff --git a/scripts/release_notes.js b/src/plugins/data/server/search/strategies/eql_search/index.ts similarity index 78% rename from scripts/release_notes.js rename to src/plugins/data/server/search/strategies/eql_search/index.ts index 7408ce322677c..ee7b8cb7eaeb4 100644 --- a/scripts/release_notes.js +++ b/src/plugins/data/server/search/strategies/eql_search/index.ts @@ -6,5 +6,4 @@ * Side Public License, v 1. */ -require('../src/setup_node_env/no_transpilation'); -require('@kbn/docs-utils').runReleaseNotesCli(); +export { eqlSearchStrategyProvider } from './eql_search_strategy'; diff --git a/x-pack/plugins/data_enhanced/server/search/response_utils.ts b/src/plugins/data/server/search/strategies/eql_search/response_utils.ts similarity index 50% rename from x-pack/plugins/data_enhanced/server/search/response_utils.ts rename to src/plugins/data/server/search/strategies/eql_search/response_utils.ts index c601109b3da27..11b5a286e709d 100644 --- a/x-pack/plugins/data_enhanced/server/search/response_utils.ts +++ b/src/plugins/data/server/search/strategies/eql_search/response_utils.ts @@ -1,27 +1,14 @@ /* * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. */ import { ApiResponse } from '@elastic/elasticsearch'; -import { getTotalLoaded } from '../../../../../src/plugins/data/server'; -import { AsyncSearchResponse, EqlSearchResponse } from './types'; -import { EqlSearchStrategyResponse } from '../../common/search'; - -/** - * Get the Kibana representation of an async search response (see `IKibanaSearchResponse`). - */ -export function toAsyncKibanaSearchResponse(response: AsyncSearchResponse) { - return { - id: response.id, - rawResponse: response.response, - isPartial: response.is_partial, - isRunning: response.is_running, - ...getTotalLoaded(response.response), - }; -} +import { EqlSearchResponse } from './types'; +import { EqlSearchStrategyResponse } from '../../../../common'; /** * Get the Kibana representation of an EQL search response (see `IKibanaSearchResponse`). diff --git a/src/plugins/data/server/search/strategies/eql_search/types.ts b/src/plugins/data/server/search/strategies/eql_search/types.ts new file mode 100644 index 0000000000000..4b3c19fda78ea --- /dev/null +++ b/src/plugins/data/server/search/strategies/eql_search/types.ts @@ -0,0 +1,15 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. + */ + +import type { estypes } from '@elastic/elasticsearch'; + +export interface EqlSearchResponse extends estypes.SearchResponse { + id?: string; + is_partial: boolean; + is_running: boolean; +} diff --git a/src/plugins/data/server/search/es_search/elasticsearch.ts b/src/plugins/data/server/search/strategies/es_search/elasticsearch.ts similarity index 100% rename from src/plugins/data/server/search/es_search/elasticsearch.ts rename to src/plugins/data/server/search/strategies/es_search/elasticsearch.ts diff --git a/src/plugins/data/server/search/es_search/es_search_strategy.test.ts b/src/plugins/data/server/search/strategies/es_search/es_search_strategy.test.ts similarity index 95% rename from src/plugins/data/server/search/es_search/es_search_strategy.test.ts rename to src/plugins/data/server/search/strategies/es_search/es_search_strategy.test.ts index db21d67a33737..c2280737d2496 100644 --- a/src/plugins/data/server/search/es_search/es_search_strategy.test.ts +++ b/src/plugins/data/server/search/strategies/es_search/es_search_strategy.test.ts @@ -10,14 +10,14 @@ import { elasticsearchClientMock, MockedTransportRequestPromise, // eslint-disable-next-line @kbn/eslint/no-restricted-paths -} from '../../../../../core/server/elasticsearch/client/mocks'; -import { pluginInitializerContextConfigMock } from '../../../../../core/server/mocks'; +} from '../../../../../../core/server/elasticsearch/client/mocks'; +import { pluginInitializerContextConfigMock } from '../../../../../../core/server/mocks'; import { esSearchStrategyProvider } from './es_search_strategy'; -import { SearchStrategyDependencies } from '../types'; +import { SearchStrategyDependencies } from '../../types'; -import * as indexNotFoundException from '../../../common/search/test_data/index_not_found_exception.json'; +import * as indexNotFoundException from '../../../../common/search/test_data/index_not_found_exception.json'; import { ElasticsearchClientError, ResponseError } from '@elastic/elasticsearch/lib/errors'; -import { KbnServerError } from '../../../../kibana_utils/server'; +import { KbnServerError } from '../../../../../kibana_utils/server'; describe('ES search strategy', () => { const successBody = { diff --git a/src/plugins/data/server/search/es_search/es_search_strategy.ts b/src/plugins/data/server/search/strategies/es_search/es_search_strategy.ts similarity index 88% rename from src/plugins/data/server/search/es_search/es_search_strategy.ts rename to src/plugins/data/server/search/strategies/es_search/es_search_strategy.ts index 1afe627545248..c24aa37082bd8 100644 --- a/src/plugins/data/server/search/es_search/es_search_strategy.ts +++ b/src/plugins/data/server/search/strategies/es_search/es_search_strategy.ts @@ -9,12 +9,12 @@ import { from, Observable } from 'rxjs'; import { first, tap } from 'rxjs/operators'; import type { Logger, SharedGlobalConfig } from 'kibana/server'; -import type { ISearchStrategy } from '../types'; -import type { SearchUsage } from '../collectors'; +import type { ISearchStrategy } from '../../types'; +import type { SearchUsage } from '../../collectors'; import { getDefaultSearchParams, getShardTimeout, shimAbortSignal } from './request_utils'; import { shimHitsTotal, toKibanaSearchResponse } from './response_utils'; -import { searchUsageObserver } from '../collectors/usage'; -import { getKbnServerError, KbnServerError } from '../../../../kibana_utils/server'; +import { searchUsageObserver } from '../../collectors/usage'; +import { getKbnServerError, KbnServerError } from '../../../../../kibana_utils/server'; export const esSearchStrategyProvider = ( config$: Observable, diff --git a/src/plugins/data/server/search/es_search/index.ts b/src/plugins/data/server/search/strategies/es_search/index.ts similarity index 94% rename from src/plugins/data/server/search/es_search/index.ts rename to src/plugins/data/server/search/strategies/es_search/index.ts index 6c1a88ad48431..d43fab0a86e69 100644 --- a/src/plugins/data/server/search/es_search/index.ts +++ b/src/plugins/data/server/search/strategies/es_search/index.ts @@ -9,4 +9,4 @@ export { esSearchStrategyProvider } from './es_search_strategy'; export * from './request_utils'; export * from './response_utils'; -export { ES_SEARCH_STRATEGY, IEsSearchRequest, IEsSearchResponse } from '../../../common'; +export { ES_SEARCH_STRATEGY, IEsSearchRequest, IEsSearchResponse } from '../../../../common'; diff --git a/src/plugins/data/server/search/es_search/request_utils.test.ts b/src/plugins/data/server/search/strategies/es_search/request_utils.test.ts similarity index 100% rename from src/plugins/data/server/search/es_search/request_utils.test.ts rename to src/plugins/data/server/search/strategies/es_search/request_utils.test.ts diff --git a/src/plugins/data/server/search/es_search/request_utils.ts b/src/plugins/data/server/search/strategies/es_search/request_utils.ts similarity index 97% rename from src/plugins/data/server/search/es_search/request_utils.ts rename to src/plugins/data/server/search/strategies/es_search/request_utils.ts index 30f1d15fbf91b..829497929c20f 100644 --- a/src/plugins/data/server/search/es_search/request_utils.ts +++ b/src/plugins/data/server/search/strategies/es_search/request_utils.ts @@ -9,7 +9,7 @@ import type { TransportRequestPromise } from '@elastic/elasticsearch/lib/Transport'; import type { Search } from '@elastic/elasticsearch/api/requestParams'; import type { IUiSettingsClient, SharedGlobalConfig } from 'kibana/server'; -import { UI_SETTINGS } from '../../../common'; +import { UI_SETTINGS } from '../../../../common'; export function getShardTimeout(config: SharedGlobalConfig): Pick { const timeout = config.elasticsearch.shardTimeout.asMilliseconds(); diff --git a/src/plugins/data/server/search/es_search/response_utils.test.ts b/src/plugins/data/server/search/strategies/es_search/response_utils.test.ts similarity index 100% rename from src/plugins/data/server/search/es_search/response_utils.test.ts rename to src/plugins/data/server/search/strategies/es_search/response_utils.test.ts diff --git a/src/plugins/data/server/search/es_search/response_utils.ts b/src/plugins/data/server/search/strategies/es_search/response_utils.ts similarity index 96% rename from src/plugins/data/server/search/es_search/response_utils.ts rename to src/plugins/data/server/search/strategies/es_search/response_utils.ts index 3bee63624ef67..0553c015fb2da 100644 --- a/src/plugins/data/server/search/es_search/response_utils.ts +++ b/src/plugins/data/server/search/strategies/es_search/response_utils.ts @@ -7,7 +7,7 @@ */ import type { estypes } from '@elastic/elasticsearch'; -import { ISearchOptions } from '../../../common'; +import { ISearchOptions } from '../../../../common'; /** * Get the `total`/`loaded` for this response (see `IKibanaSearchResponse`). Note that `skipped` is diff --git a/x-pack/plugins/data_enhanced/server/search/es_search_strategy.test.ts b/src/plugins/data/server/search/strategies/ese_search/ese_search_strategy.test.ts similarity index 81% rename from x-pack/plugins/data_enhanced/server/search/es_search_strategy.test.ts rename to src/plugins/data/server/search/strategies/ese_search/ese_search_strategy.test.ts index 2ae79f4e144e0..216318339622f 100644 --- a/x-pack/plugins/data_enhanced/server/search/es_search_strategy.test.ts +++ b/src/plugins/data/server/search/strategies/ese_search/ese_search_strategy.test.ts @@ -1,18 +1,19 @@ /* * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. */ -import { enhancedEsSearchStrategyProvider } from './es_search_strategy'; import { BehaviorSubject } from 'rxjs'; -import { SearchStrategyDependencies } from '../../../../../src/plugins/data/server/search'; -import moment from 'moment'; -import { KbnServerError } from '../../../../../src/plugins/kibana_utils/server'; +import { KbnServerError } from '../../../../../kibana_utils/server'; import { ElasticsearchClientError, ResponseError } from '@elastic/elasticsearch/lib/errors'; -import * as indexNotFoundException from '../../../../../src/plugins/data/common/search/test_data/index_not_found_exception.json'; -import * as xContentParseException from '../../../../../src/plugins/data/common/search/test_data/x_content_parse_exception.json'; +import * as indexNotFoundException from '../../../../common/search/test_data/index_not_found_exception.json'; +import * as xContentParseException from '../../../../common/search/test_data/x_content_parse_exception.json'; +import { SearchStrategyDependencies } from '../../types'; +import { enhancedEsSearchStrategyProvider } from './ese_search_strategy'; +import { createSearchSessionsClientMock } from '../../mocks'; const mockAsyncResponse = { body: { @@ -61,6 +62,7 @@ describe('ES search strategy', () => { transport: { request: mockApiCaller }, }, }, + searchSessionsClient: createSearchSessionsClientMock(), } as unknown) as SearchStrategyDependencies; const mockLegacyConfig$ = new BehaviorSubject({ elasticsearch: { @@ -72,14 +74,6 @@ describe('ES search strategy', () => { }, }); - const mockConfig: any = { - search: { - sessions: { - defaultExpiration: moment.duration('1', 'm'), - }, - }, - }; - beforeEach(() => { mockApiCaller.mockClear(); mockGetCaller.mockClear(); @@ -88,11 +82,7 @@ describe('ES search strategy', () => { }); it('returns a strategy with `search and `cancel`', async () => { - const esSearch = await enhancedEsSearchStrategyProvider( - mockConfig, - mockLegacyConfig$, - mockLogger - ); + const esSearch = await enhancedEsSearchStrategyProvider(mockLegacyConfig$, mockLogger); expect(typeof esSearch.search).toBe('function'); }); @@ -103,11 +93,7 @@ describe('ES search strategy', () => { mockSubmitCaller.mockResolvedValueOnce(mockAsyncResponse); const params = { index: 'logstash-*', body: { query: {} } }; - const esSearch = await enhancedEsSearchStrategyProvider( - mockConfig, - mockLegacyConfig$, - mockLogger - ); + const esSearch = await enhancedEsSearchStrategyProvider(mockLegacyConfig$, mockLogger); await esSearch.search({ params }, {}, mockDeps).toPromise(); @@ -122,11 +108,7 @@ describe('ES search strategy', () => { mockGetCaller.mockResolvedValueOnce(mockAsyncResponse); const params = { index: 'logstash-*', body: { query: {} } }; - const esSearch = await enhancedEsSearchStrategyProvider( - mockConfig, - mockLegacyConfig$, - mockLogger - ); + const esSearch = await enhancedEsSearchStrategyProvider(mockLegacyConfig$, mockLogger); await esSearch.search({ id: 'foo', params }, {}, mockDeps).toPromise(); @@ -141,11 +123,7 @@ describe('ES search strategy', () => { mockSubmitCaller.mockResolvedValueOnce(mockAsyncResponse); const params = { index: 'foo-*', body: {} }; - const esSearch = await enhancedEsSearchStrategyProvider( - mockConfig, - mockLegacyConfig$, - mockLogger - ); + const esSearch = await enhancedEsSearchStrategyProvider(mockLegacyConfig$, mockLogger); await esSearch.search({ params }, {}, mockDeps).toPromise(); @@ -159,11 +137,7 @@ describe('ES search strategy', () => { mockApiCaller.mockResolvedValueOnce(mockRollupResponse); const params = { index: 'foo-程', body: {} }; - const esSearch = await enhancedEsSearchStrategyProvider( - mockConfig, - mockLegacyConfig$, - mockLogger - ); + const esSearch = await enhancedEsSearchStrategyProvider(mockLegacyConfig$, mockLogger); await esSearch .search( @@ -188,11 +162,7 @@ describe('ES search strategy', () => { mockSubmitCaller.mockResolvedValueOnce(mockAsyncResponse); const params = { index: 'logstash-*', body: { query: {} } }; - const esSearch = await enhancedEsSearchStrategyProvider( - mockConfig, - mockLegacyConfig$, - mockLogger - ); + const esSearch = await enhancedEsSearchStrategyProvider(mockLegacyConfig$, mockLogger); await esSearch.search({ params }, { sessionId: '1' }, mockDeps).toPromise(); @@ -208,11 +178,7 @@ describe('ES search strategy', () => { mockGetCaller.mockResolvedValueOnce(mockAsyncResponse); const params = { index: 'logstash-*', body: { query: {} } }; - const esSearch = await enhancedEsSearchStrategyProvider( - mockConfig, - mockLegacyConfig$, - mockLogger - ); + const esSearch = await enhancedEsSearchStrategyProvider(mockLegacyConfig$, mockLogger); await esSearch.search({ id: 'foo', params }, { sessionId: '1' }, mockDeps).toPromise(); @@ -236,11 +202,7 @@ describe('ES search strategy', () => { mockSubmitCaller.mockRejectedValue(errResponse); const params = { index: 'logstash-*', body: { query: {} } }; - const esSearch = await enhancedEsSearchStrategyProvider( - mockConfig, - mockLegacyConfig$, - mockLogger - ); + const esSearch = await enhancedEsSearchStrategyProvider(mockLegacyConfig$, mockLogger); let err: KbnServerError | undefined; try { @@ -261,11 +223,7 @@ describe('ES search strategy', () => { mockSubmitCaller.mockRejectedValue(errResponse); const params = { index: 'logstash-*', body: { query: {} } }; - const esSearch = await enhancedEsSearchStrategyProvider( - mockConfig, - mockLegacyConfig$, - mockLogger - ); + const esSearch = await enhancedEsSearchStrategyProvider(mockLegacyConfig$, mockLogger); let err: KbnServerError | undefined; try { @@ -286,11 +244,7 @@ describe('ES search strategy', () => { mockDeleteCaller.mockResolvedValueOnce(200); const id = 'some_id'; - const esSearch = await enhancedEsSearchStrategyProvider( - mockConfig, - mockLegacyConfig$, - mockLogger - ); + const esSearch = await enhancedEsSearchStrategyProvider(mockLegacyConfig$, mockLogger); await esSearch.cancel!(id, {}, mockDeps); @@ -310,11 +264,7 @@ describe('ES search strategy', () => { mockDeleteCaller.mockRejectedValue(errResponse); const id = 'some_id'; - const esSearch = await enhancedEsSearchStrategyProvider( - mockConfig, - mockLegacyConfig$, - mockLogger - ); + const esSearch = await enhancedEsSearchStrategyProvider(mockLegacyConfig$, mockLogger); let err: KbnServerError | undefined; try { @@ -337,11 +287,7 @@ describe('ES search strategy', () => { const id = 'some_other_id'; const keepAlive = '1d'; - const esSearch = await enhancedEsSearchStrategyProvider( - mockConfig, - mockLegacyConfig$, - mockLogger - ); + const esSearch = await enhancedEsSearchStrategyProvider(mockLegacyConfig$, mockLogger); await esSearch.extend!(id, keepAlive, {}, mockDeps); @@ -356,11 +302,7 @@ describe('ES search strategy', () => { const id = 'some_other_id'; const keepAlive = '1d'; - const esSearch = await enhancedEsSearchStrategyProvider( - mockConfig, - mockLegacyConfig$, - mockLogger - ); + const esSearch = await enhancedEsSearchStrategyProvider(mockLegacyConfig$, mockLogger); let err: KbnServerError | undefined; try { diff --git a/x-pack/plugins/data_enhanced/server/search/es_search_strategy.ts b/src/plugins/data/server/search/strategies/ese_search/ese_search_strategy.ts similarity index 87% rename from x-pack/plugins/data_enhanced/server/search/es_search_strategy.ts rename to src/plugins/data/server/search/strategies/ese_search/ese_search_strategy.ts index aec2e7bd533ec..e7f5005e7e837 100644 --- a/x-pack/plugins/data_enhanced/server/search/es_search_strategy.ts +++ b/src/plugins/data/server/search/strategies/ese_search/ese_search_strategy.ts @@ -1,8 +1,9 @@ /* * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. */ import type { Observable } from 'rxjs'; @@ -10,35 +11,31 @@ import type { IScopedClusterClient, Logger, SharedGlobalConfig } from 'kibana/se import { catchError, first, tap } from 'rxjs/operators'; import { SearchResponse } from 'elasticsearch'; import { from } from 'rxjs'; +import type { ISearchStrategy, SearchStrategyDependencies } from '../../types'; import type { + IAsyncSearchOptions, IEsSearchRequest, IEsSearchResponse, ISearchOptions, - ISearchStrategy, - SearchStrategyDependencies, - SearchUsage, -} from '../../../../../src/plugins/data/server'; -import { - getDefaultSearchParams, - getShardTimeout, - getTotalLoaded, - searchUsageObserver, - shimAbortSignal, - shimHitsTotal, -} from '../../../../../src/plugins/data/server'; -import type { IAsyncSearchOptions } from '../../common'; -import { pollSearch } from '../../common'; +} from '../../../../common'; +import { pollSearch } from '../../../../common'; import { getDefaultAsyncGetParams, getDefaultAsyncSubmitParams, getIgnoreThrottled, } from './request_utils'; import { toAsyncKibanaSearchResponse } from './response_utils'; -import { ConfigSchema } from '../../config'; -import { getKbnServerError, KbnServerError } from '../../../../../src/plugins/kibana_utils/server'; +import { getKbnServerError, KbnServerError } from '../../../../../kibana_utils/server'; +import { SearchUsage, searchUsageObserver } from '../../collectors'; +import { + getDefaultSearchParams, + getShardTimeout, + getTotalLoaded, + shimAbortSignal, + shimHitsTotal, +} from '../es_search'; export const enhancedEsSearchStrategyProvider = ( - config: ConfigSchema, legacyConfig$: Observable, logger: Logger, usage?: SearchUsage @@ -54,7 +51,7 @@ export const enhancedEsSearchStrategyProvider = ( function asyncSearch( { id, ...request }: IEsSearchRequest, options: IAsyncSearchOptions, - { esClient, uiSettingsClient }: SearchStrategyDependencies + { esClient, uiSettingsClient, searchSessionsClient }: SearchStrategyDependencies ) { const client = esClient.asCurrentUser.asyncSearch; @@ -62,7 +59,11 @@ export const enhancedEsSearchStrategyProvider = ( const params = id ? getDefaultAsyncGetParams(options) : { - ...(await getDefaultAsyncSubmitParams(uiSettingsClient, config, options)), + ...(await getDefaultAsyncSubmitParams( + uiSettingsClient, + searchSessionsClient.getConfig(), + options + )), ...request.params, }; const promise = id ? client.get({ ...params, id }) : client.submit(params); diff --git a/packages/kbn-docs-utils/src/release_notes/lib/index.ts b/src/plugins/data/server/search/strategies/ese_search/index.ts similarity index 61% rename from packages/kbn-docs-utils/src/release_notes/lib/index.ts rename to src/plugins/data/server/search/strategies/ese_search/index.ts index 8578060007d73..3129b53f6c9ca 100644 --- a/packages/kbn-docs-utils/src/release_notes/lib/index.ts +++ b/src/plugins/data/server/search/strategies/ese_search/index.ts @@ -6,10 +6,5 @@ * Side Public License, v 1. */ -export * from './pr_api'; -export * from './version'; -export * from './is_pr_relevant'; -export * from './streams'; -export * from './type_helpers'; -export * from './irrelevant_pr_summary'; -export * from './classify_pr'; +export { enhancedEsSearchStrategyProvider } from './ese_search_strategy'; +export * from './types'; diff --git a/x-pack/plugins/data_enhanced/server/search/request_utils.ts b/src/plugins/data/server/search/strategies/ese_search/request_utils.ts similarity index 70% rename from x-pack/plugins/data_enhanced/server/search/request_utils.ts rename to src/plugins/data/server/search/strategies/ese_search/request_utils.ts index 7a4e912fa0672..70da0ba2edcc3 100644 --- a/x-pack/plugins/data_enhanced/server/search/request_utils.ts +++ b/src/plugins/data/server/search/strategies/ese_search/request_utils.ts @@ -1,8 +1,9 @@ /* * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. */ import { IUiSettingsClient } from 'kibana/server'; @@ -11,9 +12,9 @@ import { AsyncSearchSubmit, Search, } from '@elastic/elasticsearch/api/requestParams'; -import { ISearchOptions, UI_SETTINGS } from '../../../../../src/plugins/data/common'; -import { getDefaultSearchParams } from '../../../../../src/plugins/data/server'; -import { ConfigSchema } from '../../config'; +import { ISearchOptions, UI_SETTINGS } from '../../../../common'; +import { getDefaultSearchParams } from '../es_search'; +import { SearchSessionsConfigSchema } from '../../../../config'; /** * @internal @@ -30,7 +31,7 @@ export async function getIgnoreThrottled( */ export async function getDefaultAsyncSubmitParams( uiSettingsClient: IUiSettingsClient, - config: ConfigSchema, + searchSessionsConfig: SearchSessionsConfigSchema | null, options: ISearchOptions ): Promise< Pick< @@ -53,7 +54,11 @@ export async function getDefaultAsyncSubmitParams( ...(await getDefaultSearchParams(uiSettingsClient)), ...(options.sessionId ? { - keep_alive: `${config.search.sessions.defaultExpiration.asMilliseconds()}ms`, + // TODO: searchSessionsConfig could be "null" if we are running without x-pack which happens only in tests. + // This can be cleaned up when we completely stop separating basic and oss + keep_alive: searchSessionsConfig + ? `${searchSessionsConfig.defaultExpiration.asMilliseconds()}ms` + : '1m', } : {}), }; diff --git a/src/plugins/data/server/search/strategies/ese_search/response_utils.ts b/src/plugins/data/server/search/strategies/ese_search/response_utils.ts new file mode 100644 index 0000000000000..ae3d258e2205d --- /dev/null +++ b/src/plugins/data/server/search/strategies/ese_search/response_utils.ts @@ -0,0 +1,23 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. + */ + +import { AsyncSearchResponse } from './types'; +import { getTotalLoaded } from '../es_search'; + +/** + * Get the Kibana representation of an async search response (see `IKibanaSearchResponse`). + */ +export function toAsyncKibanaSearchResponse(response: AsyncSearchResponse) { + return { + id: response.id, + rawResponse: response.response, + isPartial: response.is_partial, + isRunning: response.is_running, + ...getTotalLoaded(response.response), + }; +} diff --git a/x-pack/plugins/data_enhanced/server/search/types.ts b/src/plugins/data/server/search/strategies/ese_search/types.ts similarity index 67% rename from x-pack/plugins/data_enhanced/server/search/types.ts rename to src/plugins/data/server/search/strategies/ese_search/types.ts index e2a4e2ce74f15..069004b0287cd 100644 --- a/x-pack/plugins/data_enhanced/server/search/types.ts +++ b/src/plugins/data/server/search/strategies/ese_search/types.ts @@ -1,12 +1,13 @@ /* * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. */ import type { estypes } from '@elastic/elasticsearch'; -import { SearchResponse, ShardsResponse } from 'elasticsearch'; +import { ShardsResponse } from 'elasticsearch'; export interface AsyncSearchResponse { id?: string; @@ -20,9 +21,3 @@ export interface AsyncSearchStatusResponse extends Omit extends SearchResponse { - id?: string; - is_partial: boolean; - is_running: boolean; -} diff --git a/src/plugins/data/server/search/types.ts b/src/plugins/data/server/search/types.ts index e8548257c0167..229c581bf09f1 100644 --- a/src/plugins/data/server/search/types.ts +++ b/src/plugins/data/server/search/types.ts @@ -21,14 +21,14 @@ import { IKibanaSearchRequest, IKibanaSearchResponse, ISearchClient, + IEsSearchResponse, + IEsSearchRequest, } from '../../common/search'; import { AggsSetup, AggsStart } from './aggs'; import { SearchUsage } from './collectors'; -import { IEsSearchRequest, IEsSearchResponse } from './es_search'; import { IScopedSearchSessionsClient, ISearchSessionService } from './session'; export interface SearchEnhancements { - defaultStrategy: string; sessionService: ISearchSessionService; } diff --git a/src/plugins/data/server/server.api.md b/src/plugins/data/server/server.api.md index 3316e8102e50a..be502950a84e3 100644 --- a/src/plugins/data/server/server.api.md +++ b/src/plugins/data/server/server.api.md @@ -68,6 +68,7 @@ import { SavedObjectsFindResponse } from 'kibana/server'; import { SavedObjectsUpdateResponse } from 'kibana/server'; import { Search } from '@elastic/elasticsearch/api/requestParams'; import { SerializedFieldFormat as SerializedFieldFormat_2 } from 'src/plugins/expressions/common'; +import { ShardsResponse } from 'elasticsearch'; import { SharedGlobalConfig as SharedGlobalConfig_2 } from 'kibana/server'; import { ToastInputFields } from 'src/core/public/notifications'; import { TransportRequestPromise } from '@elastic/elasticsearch/lib/Transport'; @@ -281,6 +282,34 @@ export class AggParamType extends Ba makeAgg: (agg: TAggConfig, state?: AggConfigSerialized) => TAggConfig; } +// Warning: (ae-missing-release-tag) "AsyncSearchResponse" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// +// @public (undocumented) +export interface AsyncSearchResponse { + // (undocumented) + expiration_time_in_millis: number; + // (undocumented) + id?: string; + // (undocumented) + is_partial: boolean; + // (undocumented) + is_running: boolean; + // (undocumented) + response: estypes.SearchResponse; + // (undocumented) + start_time_in_millis: number; +} + +// Warning: (ae-missing-release-tag) "AsyncSearchStatusResponse" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// +// @public (undocumented) +export interface AsyncSearchStatusResponse extends Omit { + // (undocumented) + completion_status: number; + // (undocumented) + _shards: ShardsResponse; +} + // Warning: (ae-missing-release-tag) "BUCKET_TYPES" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) // // @public (undocumented) @@ -1355,6 +1384,7 @@ export class SearchSessionService implements ISearchSessionService { extend: () => Promise; cancel: () => Promise; delete: () => Promise; + getConfig: () => null; }; } @@ -1512,18 +1542,18 @@ export function usageProvider(core: CoreSetup_2): SearchUsage; // src/plugins/data/server/index.ts:101:26 - (ae-forgotten-export) The symbol "HistogramFormat" needs to be exported by the entry point index.d.ts // src/plugins/data/server/index.ts:128:27 - (ae-forgotten-export) The symbol "isFilterable" needs to be exported by the entry point index.d.ts // src/plugins/data/server/index.ts:128:27 - (ae-forgotten-export) The symbol "isNestedField" needs to be exported by the entry point index.d.ts -// src/plugins/data/server/index.ts:241:20 - (ae-forgotten-export) The symbol "tabifyAggResponse" needs to be exported by the entry point index.d.ts -// src/plugins/data/server/index.ts:241:20 - (ae-forgotten-export) The symbol "tabifyGetColumns" needs to be exported by the entry point index.d.ts -// src/plugins/data/server/index.ts:243:1 - (ae-forgotten-export) The symbol "CidrMask" needs to be exported by the entry point index.d.ts -// src/plugins/data/server/index.ts:244:1 - (ae-forgotten-export) The symbol "dateHistogramInterval" needs to be exported by the entry point index.d.ts -// src/plugins/data/server/index.ts:253:1 - (ae-forgotten-export) The symbol "InvalidEsCalendarIntervalError" needs to be exported by the entry point index.d.ts -// src/plugins/data/server/index.ts:254:1 - (ae-forgotten-export) The symbol "InvalidEsIntervalFormatError" needs to be exported by the entry point index.d.ts -// src/plugins/data/server/index.ts:255:1 - (ae-forgotten-export) The symbol "Ipv4Address" needs to be exported by the entry point index.d.ts -// src/plugins/data/server/index.ts:259:1 - (ae-forgotten-export) The symbol "isValidEsInterval" needs to be exported by the entry point index.d.ts -// src/plugins/data/server/index.ts:260:1 - (ae-forgotten-export) The symbol "isValidInterval" needs to be exported by the entry point index.d.ts -// src/plugins/data/server/index.ts:264:1 - (ae-forgotten-export) The symbol "propFilter" needs to be exported by the entry point index.d.ts -// src/plugins/data/server/index.ts:267:1 - (ae-forgotten-export) The symbol "toAbsoluteDates" needs to be exported by the entry point index.d.ts -// src/plugins/data/server/index.ts:268:1 - (ae-forgotten-export) The symbol "calcAutoIntervalLessThan" needs to be exported by the entry point index.d.ts +// src/plugins/data/server/index.ts:243:20 - (ae-forgotten-export) The symbol "tabifyAggResponse" needs to be exported by the entry point index.d.ts +// src/plugins/data/server/index.ts:243:20 - (ae-forgotten-export) The symbol "tabifyGetColumns" needs to be exported by the entry point index.d.ts +// src/plugins/data/server/index.ts:245:1 - (ae-forgotten-export) The symbol "CidrMask" needs to be exported by the entry point index.d.ts +// src/plugins/data/server/index.ts:246:1 - (ae-forgotten-export) The symbol "dateHistogramInterval" needs to be exported by the entry point index.d.ts +// src/plugins/data/server/index.ts:255:1 - (ae-forgotten-export) The symbol "InvalidEsCalendarIntervalError" needs to be exported by the entry point index.d.ts +// src/plugins/data/server/index.ts:256:1 - (ae-forgotten-export) The symbol "InvalidEsIntervalFormatError" needs to be exported by the entry point index.d.ts +// src/plugins/data/server/index.ts:257:1 - (ae-forgotten-export) The symbol "Ipv4Address" needs to be exported by the entry point index.d.ts +// src/plugins/data/server/index.ts:261:1 - (ae-forgotten-export) The symbol "isValidEsInterval" needs to be exported by the entry point index.d.ts +// src/plugins/data/server/index.ts:262:1 - (ae-forgotten-export) The symbol "isValidInterval" needs to be exported by the entry point index.d.ts +// src/plugins/data/server/index.ts:266:1 - (ae-forgotten-export) The symbol "propFilter" needs to be exported by the entry point index.d.ts +// src/plugins/data/server/index.ts:269:1 - (ae-forgotten-export) The symbol "toAbsoluteDates" needs to be exported by the entry point index.d.ts +// src/plugins/data/server/index.ts:270:1 - (ae-forgotten-export) The symbol "calcAutoIntervalLessThan" needs to be exported by the entry point index.d.ts // src/plugins/data/server/plugin.ts:81:74 - (ae-forgotten-export) The symbol "DataEnhancements" needs to be exported by the entry point index.d.ts // src/plugins/data/server/search/types.ts:114:5 - (ae-forgotten-export) The symbol "ISearchStartSearchSource" needs to be exported by the entry point index.d.ts diff --git a/src/plugins/dev_tools/public/dev_tool.ts b/src/plugins/dev_tools/public/dev_tool.ts index 197e93f20a539..8adfd4c76482d 100644 --- a/src/plugins/dev_tools/public/dev_tool.ts +++ b/src/plugins/dev_tools/public/dev_tool.ts @@ -6,6 +6,7 @@ * Side Public License, v 1. */ +import { ReactNode } from 'react'; import { AppMount } from 'src/core/public'; /** @@ -26,8 +27,9 @@ export class DevToolApp { /** * The human readable name of the dev tool. Should be internationalized. * This will be used as a label in the tab above the actual tool. + * May also be a ReactNode. */ - public readonly title: string; + public readonly title: ReactNode; public readonly mount: AppMount; /** @@ -55,7 +57,7 @@ export class DevToolApp { constructor( id: string, - title: string, + title: ReactNode, mount: AppMount, enableRouting: boolean, order: number, diff --git a/src/plugins/dev_tools/public/plugin.ts b/src/plugins/dev_tools/public/plugin.ts index 6cf3c57d19ac8..e9f5d206de918 100644 --- a/src/plugins/dev_tools/public/plugin.ts +++ b/src/plugins/dev_tools/public/plugin.ts @@ -7,7 +7,7 @@ */ import { BehaviorSubject } from 'rxjs'; -import { Plugin, CoreSetup, AppMountParameters } from 'src/core/public'; +import { Plugin, CoreSetup, AppMountParameters, AppSearchDeepLink } from 'src/core/public'; import { AppUpdater } from 'kibana/public'; import { i18n } from '@kbn/i18n'; import { sortBy } from 'lodash'; @@ -84,6 +84,20 @@ export class DevToolsPlugin implements Plugin { public start() { if (this.getSortedDevTools().length === 0) { this.appStateUpdater.next(() => ({ navLinkStatus: AppNavLinkStatus.hidden })); + } else { + this.appStateUpdater.next(() => { + const deepLinks: AppSearchDeepLink[] = [...this.devTools.values()] + .filter( + // Some tools do not use a string title, so we filter those out + (tool) => !tool.enableRouting && !tool.isDisabled() && typeof tool.title === 'string' + ) + .map((tool) => ({ + id: tool.id, + title: tool.title as string, + path: `#/${tool.id}`, + })); + return { meta: { searchDeepLinks: deepLinks } }; + }); } } diff --git a/src/plugins/discover/public/application/angular/discover_state.test.ts b/src/plugins/discover/public/application/angular/discover_state.test.ts index e7322a8588631..ddb4e874ccc64 100644 --- a/src/plugins/discover/public/application/angular/discover_state.test.ts +++ b/src/plugins/discover/public/application/angular/discover_state.test.ts @@ -79,6 +79,48 @@ describe('Test discover state', () => { expect(state.getPreviousAppState()).toEqual(stateA); }); }); +describe('Test discover initial state sort handling', () => { + test('Non-empty sort in URL should not fallback to state defaults', async () => { + history = createBrowserHistory(); + history.push('/#?_a=(sort:!(!(order_date,desc)))'); + + state = getState({ + getStateDefaults: () => ({ sort: [['fallback', 'desc']] }), + history, + uiSettings: uiSettingsMock, + }); + await state.replaceUrlAppState({}); + await state.startSync(); + expect(state.appStateContainer.getState().sort).toMatchInlineSnapshot(` + Array [ + Array [ + "order_date", + "desc", + ], + ] + `); + }); + test('Empty sort in URL should allow fallback state defaults', async () => { + history = createBrowserHistory(); + history.push('/#?_a=(sort:!())'); + + state = getState({ + getStateDefaults: () => ({ sort: [['fallback', 'desc']] }), + history, + uiSettings: uiSettingsMock, + }); + await state.replaceUrlAppState({}); + await state.startSync(); + expect(state.appStateContainer.getState().sort).toMatchInlineSnapshot(` + Array [ + Array [ + "fallback", + "desc", + ], + ] + `); + }); +}); describe('Test discover state with legacy migration', () => { test('migration of legacy query ', async () => { diff --git a/src/plugins/discover/public/application/angular/discover_state.ts b/src/plugins/discover/public/application/angular/discover_state.ts index 9ebeff69d7542..f71e3ac651f53 100644 --- a/src/plugins/discover/public/application/angular/discover_state.ts +++ b/src/plugins/discover/public/application/angular/discover_state.ts @@ -170,6 +170,12 @@ export function getState({ appStateFromUrl.query = migrateLegacyQuery(appStateFromUrl.query); } + if (appStateFromUrl?.sort && !appStateFromUrl.sort.length) { + // If there's an empty array given in the URL, the sort prop should be removed + // This allows the sort prop to be overwritten with the default sorting + delete appStateFromUrl.sort; + } + let initialAppState = handleSourceColumnState( { ...defaultAppState, @@ -177,6 +183,7 @@ export function getState({ }, uiSettings ); + // todo filter source depending on fields fetching flag (if no columns remain and source fetching is enabled, use default columns) let previousAppState: AppState; const appStateContainer = createStateContainer(initialAppState); diff --git a/src/plugins/discover/public/application/components/discover_grid/constants.ts b/src/plugins/discover/public/application/components/discover_grid/constants.ts index de2781cf159c3..34e6ca20740ad 100644 --- a/src/plugins/discover/public/application/components/discover_grid/constants.ts +++ b/src/plugins/discover/public/application/components/discover_grid/constants.ts @@ -15,8 +15,8 @@ export const gridStyle = { rowHover: 'none', }; -export const pageSizeArr = [25, 50, 100]; -export const defaultPageSize = 25; +export const pageSizeArr = [25, 50, 100, 250]; +export const defaultPageSize = 100; export const toolbarVisibility = { showColumnSelector: { allowHide: false, diff --git a/src/plugins/discover/public/application/components/discover_grid/discover_grid_flyout.tsx b/src/plugins/discover/public/application/components/discover_grid/discover_grid_flyout.tsx index f31399793c0da..3894127891041 100644 --- a/src/plugins/discover/public/application/components/discover_grid/discover_grid_flyout.tsx +++ b/src/plugins/discover/public/application/components/discover_grid/discover_grid_flyout.tsx @@ -178,15 +178,29 @@ export function DiscoverGridFlyout({ indexPattern={indexPattern} filter={(mapping, value, mode) => { onFilter(mapping, value, mode); - onClose(); + services.toastNotifications.addSuccess( + i18n.translate('discover.grid.flyout.toastFilterAdded', { + defaultMessage: `Filter was added`, + }) + ); }} onRemoveColumn={(columnName: string) => { onRemoveColumn(columnName); - onClose(); + services.toastNotifications.addSuccess( + i18n.translate('discover.grid.flyout.toastColumnRemoved', { + defaultMessage: `Column '{columnName}' was removed`, + values: { columnName }, + }) + ); }} onAddColumn={(columnName: string) => { onAddColumn(columnName); - onClose(); + services.toastNotifications.addSuccess( + i18n.translate('discover.grid.flyout.toastColumnAdded', { + defaultMessage: `Column '{columnName}' was added`, + values: { columnName }, + }) + ); }} /> diff --git a/src/plugins/discover/public/application/components/discover_topnav.test.tsx b/src/plugins/discover/public/application/components/discover_topnav.test.tsx index 891dc63c92c7c..d30e5bda1abe7 100644 --- a/src/plugins/discover/public/application/components/discover_topnav.test.tsx +++ b/src/plugins/discover/public/application/components/discover_topnav.test.tsx @@ -33,6 +33,9 @@ function getProps(): DiscoverTopNavProps { discover: { save: true, }, + advancedSettings: { + save: true, + }, }, uiSettings: mockUiSettings, } as unknown) as DiscoverServices; diff --git a/src/plugins/discover/public/application/components/sidebar/__snapshots__/discover_index_pattern_management.test.tsx.snap b/src/plugins/discover/public/application/components/sidebar/__snapshots__/discover_index_pattern_management.test.tsx.snap new file mode 100644 index 0000000000000..44b8cbb8b839a --- /dev/null +++ b/src/plugins/discover/public/application/components/sidebar/__snapshots__/discover_index_pattern_management.test.tsx.snap @@ -0,0 +1,661 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Discover IndexPattern Management renders correctly 1`] = ` + +`; diff --git a/src/plugins/discover/public/application/components/sidebar/discover_index_pattern_management.test.tsx b/src/plugins/discover/public/application/components/sidebar/discover_index_pattern_management.test.tsx new file mode 100644 index 0000000000000..88644dc213fd6 --- /dev/null +++ b/src/plugins/discover/public/application/components/sidebar/discover_index_pattern_management.test.tsx @@ -0,0 +1,73 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. + */ + +import { getStubIndexPattern } from '../../../../../data/public/index_patterns/index_pattern.stub'; +import { coreMock } from '../../../../../../core/public/mocks'; +import { DiscoverServices } from '../../../build_services'; +// @ts-ignore +import stubbedLogstashFields from '../../../__fixtures__/logstash_fields'; +import { mountWithIntl } from '@kbn/test/jest'; +import React from 'react'; +import { DiscoverIndexPatternManagement } from './discover_index_pattern_management'; + +const mockServices = ({ + history: () => ({ + location: { + search: '', + }, + }), + capabilities: { + visualize: { + show: true, + }, + discover: { + save: false, + }, + }, + uiSettings: { + get: (key: string) => { + if (key === 'fields:popularLimit') { + return 5; + } + }, + }, + indexPatternFieldEditor: { + openEditor: jest.fn(), + userPermissions: { + editIndexPattern: jest.fn(), + }, + }, +} as unknown) as DiscoverServices; + +jest.mock('../../../kibana_services', () => ({ + getServices: () => mockServices, +})); + +describe('Discover IndexPattern Management', () => { + const indexPattern = getStubIndexPattern( + 'logstash-*', + (cfg: any) => cfg, + 'time', + stubbedLogstashFields(), + coreMock.createSetup() + ); + + const editField = jest.fn(); + + test('renders correctly', () => { + const component = mountWithIntl( + + ); + expect(component).toMatchSnapshot(); + }); +}); diff --git a/src/plugins/discover/public/application/components/sidebar/discover_index_pattern_management.tsx b/src/plugins/discover/public/application/components/sidebar/discover_index_pattern_management.tsx new file mode 100644 index 0000000000000..38681d75a4e1d --- /dev/null +++ b/src/plugins/discover/public/application/components/sidebar/discover_index_pattern_management.tsx @@ -0,0 +1,107 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. + */ + +import React, { useState } from 'react'; +import { EuiButtonIcon, EuiContextMenuItem, EuiContextMenuPanel, EuiPopover } from '@elastic/eui'; +import { i18n } from '@kbn/i18n'; +import { DiscoverServices } from '../../../build_services'; +import { IndexPattern } from '../../../../../data/common/index_patterns/index_patterns'; + +export interface DiscoverIndexPatternManagementProps { + /** + * Currently selected index pattern + */ + selectedIndexPattern?: IndexPattern; + /** + * Discover plugin services; + */ + services: DiscoverServices; + /** + * Read from the Fields API + */ + useNewFieldsApi?: boolean; + /** + * Callback to execute on edit field action + * @param fieldName + */ + editField: (fieldName?: string) => void; +} + +export function DiscoverIndexPatternManagement(props: DiscoverIndexPatternManagementProps) { + const { indexPatternFieldEditor, core } = props.services; + const { useNewFieldsApi, selectedIndexPattern, editField } = props; + const indexPatternFieldEditPermission = indexPatternFieldEditor?.userPermissions.editIndexPattern(); + const canEditIndexPatternField = !!indexPatternFieldEditPermission && useNewFieldsApi; + const [isAddIndexPatternFieldPopoverOpen, setIsAddIndexPatternFieldPopoverOpen] = useState(false); + + if (!useNewFieldsApi || !selectedIndexPattern || !canEditIndexPatternField) { + return null; + } + + const addField = () => { + editField(undefined); + }; + + return ( + { + setIsAddIndexPatternFieldPopoverOpen(false); + }} + ownFocus + data-test-subj="discover-addRuntimeField-popover" + button={ + { + setIsAddIndexPatternFieldPopoverOpen(!isAddIndexPatternFieldPopoverOpen); + }} + /> + } + > + { + setIsAddIndexPatternFieldPopoverOpen(false); + addField(); + }} + > + {i18n.translate('discover.fieldChooser.indexPatterns.addFieldButton', { + defaultMessage: 'Add field to index pattern', + })} + , + { + setIsAddIndexPatternFieldPopoverOpen(false); + core.application.navigateToApp('management', { + path: `/kibana/indexPatterns/patterns/${props.selectedIndexPattern?.id}`, + }); + }} + > + {i18n.translate('discover.fieldChooser.indexPatterns.manageFieldButton', { + defaultMessage: 'Manage index pattern fields', + })} + , + ]} + /> + + ); +} diff --git a/src/plugins/discover/public/application/components/sidebar/discover_sidebar.test.tsx b/src/plugins/discover/public/application/components/sidebar/discover_sidebar.test.tsx index 0b3f55b5630cc..01541344be7e1 100644 --- a/src/plugins/discover/public/application/components/sidebar/discover_sidebar.test.tsx +++ b/src/plugins/discover/public/application/components/sidebar/discover_sidebar.test.tsx @@ -109,6 +109,7 @@ function getCompProps(): DiscoverSidebarProps { setFieldFilter: jest.fn(), setAppState: jest.fn(), onEditRuntimeField: jest.fn(), + editField: jest.fn(), }; } diff --git a/src/plugins/discover/public/application/components/sidebar/discover_sidebar.tsx b/src/plugins/discover/public/application/components/sidebar/discover_sidebar.tsx index d97f98b9e054f..aaaf72f770630 100644 --- a/src/plugins/discover/public/application/components/sidebar/discover_sidebar.tsx +++ b/src/plugins/discover/public/application/components/sidebar/discover_sidebar.tsx @@ -19,10 +19,6 @@ import { EuiSpacer, EuiNotificationBadge, EuiPageSideBar, - EuiContextMenuPanel, - EuiContextMenuItem, - EuiPopover, - EuiButtonIcon, useResizeObserver, } from '@elastic/eui'; @@ -38,6 +34,7 @@ import { getDetails } from './lib/get_details'; import { FieldFilterState, getDefaultFieldFilter, setFieldFilterProp } from './lib/field_filter'; import { getIndexPatternFieldList } from './lib/get_index_pattern_field_list'; import { DiscoverSidebarResponsiveProps } from './discover_sidebar_responsive'; +import { DiscoverIndexPatternManagement } from './discover_index_pattern_management'; /** * Default number of available fields displayed and added on scroll @@ -64,6 +61,8 @@ export interface DiscoverSidebarProps extends DiscoverSidebarResponsiveProps { * @param ref reference to the field editor component */ setFieldEditorRef?: (ref: () => void | undefined) => void; + + editField: (fieldName?: string) => void; } export function DiscoverSidebar({ @@ -90,10 +89,10 @@ export function DiscoverSidebar({ onEditRuntimeField, setFieldEditorRef, closeFlyout, + editField, }: DiscoverSidebarProps) { const [fields, setFields] = useState(null); - const [isAddIndexPatternFieldPopoverOpen, setIsAddIndexPatternFieldPopoverOpen] = useState(false); - const { indexPatternFieldEditor, core } = services; + const { indexPatternFieldEditor } = services; const indexPatternFieldEditPermission = indexPatternFieldEditor?.userPermissions.editIndexPattern(); const canEditIndexPatternField = !!indexPatternFieldEditPermission && useNewFieldsApi; const [scrollContainer, setScrollContainer] = useState(null); @@ -273,31 +272,6 @@ export function DiscoverSidebar({ return null; } - const editField = (fieldName?: string) => { - if (!canEditIndexPatternField) { - return; - } - const ref = indexPatternFieldEditor.openEditor({ - ctx: { - indexPattern: selectedIndexPattern, - }, - fieldName, - onSave: async () => { - onEditRuntimeField(); - }, - }); - if (setFieldEditorRef) { - setFieldEditorRef(ref); - } - if (closeFlyout) { - closeFlyout(); - } - }; - - const addField = () => { - editField(undefined); - }; - if (useFlyout) { return (
- o.attributes.title)} - indexPatterns={indexPatterns} - state={state} - setAppState={setAppState} - /> + + + o.attributes.title)} + indexPatterns={indexPatterns} + state={state} + setAppState={setAppState} + /> + + + + +
); } - const indexPatternActions = ( - { - setIsAddIndexPatternFieldPopoverOpen(false); - }} - ownFocus - data-test-subj="discover-addRuntimeField-popover" - button={ - { - setIsAddIndexPatternFieldPopoverOpen(!isAddIndexPatternFieldPopoverOpen); - }} - /> - } - > - { - setIsAddIndexPatternFieldPopoverOpen(false); - addField(); - }} - > - {i18n.translate('discover.fieldChooser.indexPatterns.addFieldButton', { - defaultMessage: 'Add field to index pattern', - })} - , - { - setIsAddIndexPatternFieldPopoverOpen(false); - core.application.navigateToApp('management', { - path: `/kibana/indexPatterns/patterns/${selectedIndexPattern.id}`, - }); - }} - > - {i18n.translate('discover.fieldChooser.indexPatterns.manageFieldButton', { - defaultMessage: 'Manage index pattern fields', - })} - , - ]} - /> - - ); - return ( - {useNewFieldsApi && {indexPatternActions}} + + + diff --git a/src/plugins/discover/public/application/components/sidebar/discover_sidebar_responsive.tsx b/src/plugins/discover/public/application/components/sidebar/discover_sidebar_responsive.tsx index 6a16399f0e2e1..6b8918e2d9965 100644 --- a/src/plugins/discover/public/application/components/sidebar/discover_sidebar_responsive.tsx +++ b/src/plugins/discover/public/application/components/sidebar/discover_sidebar_responsive.tsx @@ -24,6 +24,8 @@ import { EuiIcon, EuiLink, EuiPortal, + EuiFlexGroup, + EuiFlexItem, } from '@elastic/eui'; import { DiscoverIndexPattern } from './discover_index_pattern'; import { IndexPatternAttributes, IndexPatternsContract } from '../../../../../data/common'; @@ -34,6 +36,7 @@ import { DiscoverSidebar } from './discover_sidebar'; import { DiscoverServices } from '../../../build_services'; import { ElasticSearchHit } from '../../doc_views/doc_views_types'; import { AppState } from '../../angular/discover_state'; +import { DiscoverIndexPatternManagement } from './discover_index_pattern_management'; export interface DiscoverSidebarResponsiveProps { /** @@ -121,7 +124,9 @@ export interface DiscoverSidebarResponsiveProps { */ showUnmappedFields: boolean; }; - + /** + * callback to execute on edit runtime field + */ onEditRuntimeField: () => void; } @@ -160,6 +165,31 @@ export function DiscoverSidebarResponsive(props: DiscoverSidebarResponsiveProps) setIsFlyoutVisible(false); }; + const { indexPatternFieldEditor } = props.services; + const indexPatternFieldEditPermission = indexPatternFieldEditor?.userPermissions.editIndexPattern(); + const canEditIndexPatternField = !!indexPatternFieldEditPermission && props.useNewFieldsApi; + + const editField = (fieldName?: string) => { + if (!canEditIndexPatternField || !props.selectedIndexPattern) { + return; + } + const ref = indexPatternFieldEditor.openEditor({ + ctx: { + indexPattern: props.selectedIndexPattern, + }, + fieldName, + onSave: async () => { + props.onEditRuntimeField(); + }, + }); + if (setFieldEditorRef) { + setFieldEditorRef(ref); + } + if (closeFlyout) { + closeFlyout(); + } + }; + return ( <> {props.isClosed ? null : ( @@ -168,7 +198,7 @@ export function DiscoverSidebarResponsive(props: DiscoverSidebarResponsiveProps) {...props} fieldFilter={fieldFilter} setFieldFilter={setFieldFilter} - setFieldEditorRef={setFieldEditorRef} + editField={editField} /> )} @@ -182,15 +212,28 @@ export function DiscoverSidebarResponsive(props: DiscoverSidebarResponsiveProps) } )} > - o.attributes.title)} - indexPatterns={props.indexPatterns} - state={props.state} - setAppState={props.setAppState} - /> + + + o.attributes.title)} + indexPatterns={props.indexPatterns} + state={props.state} + setAppState={props.setAppState} + /> + + + + + + diff --git a/src/plugins/discover/public/application/components/table/table.test.tsx b/src/plugins/discover/public/application/components/table/table.test.tsx index 8997c1d13a474..7539f29c1ec9d 100644 --- a/src/plugins/discover/public/application/components/table/table.test.tsx +++ b/src/plugins/discover/public/application/components/table/table.test.tsx @@ -155,7 +155,7 @@ describe('DocViewTable at Discover', () => { const elementExist = check[element]; if (typeof elementExist === 'boolean') { - const btn = findTestSubject(rowComponent, element); + const btn = findTestSubject(rowComponent, element, '^='); it(`renders ${element} for '${check._property}' correctly`, () => { const disabled = btn.length ? btn.props().disabled : true; diff --git a/src/plugins/discover/public/application/components/table/table_row.tsx b/src/plugins/discover/public/application/components/table/table_row.tsx index 5c6ae49770bc7..e8977fda8576a 100644 --- a/src/plugins/discover/public/application/components/table/table_row.tsx +++ b/src/plugins/discover/public/application/components/table/table_row.tsx @@ -65,7 +65,11 @@ export function DocViewTableRow({ onClick={() => onFilter(fieldMapping, valueRaw, '-')} /> {typeof onToggleColumn === 'function' && ( - + )} void; + fieldname: string; } -export function DocViewTableRowBtnToggleColumn({ onClick, active, disabled = false }: Props) { +export function DocViewTableRowBtnToggleColumn({ + onClick, + active, + disabled = false, + fieldname = '', +}: Props) { if (disabled) { return ( diff --git a/src/plugins/discover/public/application/components/top_nav/get_top_nav_links.test.ts b/src/plugins/discover/public/application/components/top_nav/get_top_nav_links.test.ts index f6e9e70b337ba..2c50ce61c8afb 100644 --- a/src/plugins/discover/public/application/components/top_nav/get_top_nav_links.test.ts +++ b/src/plugins/discover/public/application/components/top_nav/get_top_nav_links.test.ts @@ -18,6 +18,9 @@ const services = ({ discover: { save: true, }, + advancedSettings: { + save: true, + }, }, } as unknown) as DiscoverServices; @@ -36,6 +39,13 @@ test('getTopNavLinks result', () => { }); expect(topNavLinks).toMatchInlineSnapshot(` Array [ + Object { + "description": "Options", + "id": "options", + "label": "Options", + "run": [Function], + "testId": "discoverOptionsButton", + }, Object { "description": "New Search", "id": "new", diff --git a/src/plugins/discover/public/application/components/top_nav/get_top_nav_links.ts b/src/plugins/discover/public/application/components/top_nav/get_top_nav_links.ts index 635684177e1e3..9a12cb51eac0c 100644 --- a/src/plugins/discover/public/application/components/top_nav/get_top_nav_links.ts +++ b/src/plugins/discover/public/application/components/top_nav/get_top_nav_links.ts @@ -15,6 +15,7 @@ import { SavedSearch } from '../../../saved_searches'; import { onSaveSearch } from './on_save_search'; import { GetStateReturn } from '../../angular/discover_state'; import { IndexPattern, ISearchSource } from '../../../kibana_services'; +import { openOptionsPopover } from './open_options_popover'; /** * Helper function to build the top nav links @@ -38,6 +39,22 @@ export const getTopNavLinks = ({ onOpenInspector: () => void; searchSource: ISearchSource; }) => { + const options = { + id: 'options', + label: i18n.translate('discover.localMenu.localMenu.optionsTitle', { + defaultMessage: 'Options', + }), + description: i18n.translate('discover.localMenu.optionsDescription', { + defaultMessage: 'Options', + }), + run: (anchorElement: HTMLElement) => + openOptionsPopover({ + I18nContext: services.core.i18n.Context, + anchorElement, + }), + testId: 'discoverOptionsButton', + }; + const newSearch = { id: 'new', label: i18n.translate('discover.localMenu.localMenu.newSearchTitle', { @@ -128,6 +145,7 @@ export const getTopNavLinks = ({ }; return [ + ...(services.capabilities.advancedSettings.save ? [options] : []), newSearch, ...(services.capabilities.discover.save ? [saveSearch] : []), openSearch, diff --git a/src/plugins/discover/public/application/components/top_nav/open_options_popover.scss b/src/plugins/discover/public/application/components/top_nav/open_options_popover.scss new file mode 100644 index 0000000000000..f68b2bfe74a9d --- /dev/null +++ b/src/plugins/discover/public/application/components/top_nav/open_options_popover.scss @@ -0,0 +1,5 @@ +$dscOptionsPopoverWidth: $euiSizeL * 12; + +.dscOptionsPopover { + width: $dscOptionsPopoverWidth; +} \ No newline at end of file diff --git a/src/plugins/discover/public/application/components/top_nav/open_options_popover.test.tsx b/src/plugins/discover/public/application/components/top_nav/open_options_popover.test.tsx new file mode 100644 index 0000000000000..406d2eb8eac4b --- /dev/null +++ b/src/plugins/discover/public/application/components/top_nav/open_options_popover.test.tsx @@ -0,0 +1,49 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. + */ + +import React from 'react'; +import { mountWithIntl } from '@kbn/test/jest'; +import { findTestSubject } from '@elastic/eui/lib/test'; +import { getServices } from '../../../kibana_services'; + +jest.mock('../../../kibana_services', () => { + const mockUiSettings = new Map(); + return { + getServices: () => ({ + core: { + uiSettings: { + get: (key: string) => { + return mockUiSettings.get(key); + }, + set: (key: string, value: boolean) => { + mockUiSettings.set(key, value); + }, + }, + }, + addBasePath: (path: string) => path, + }), + }; +}); + +import { OptionsPopover } from './open_options_popover'; + +test('should display the correct text if datagrid is selected', () => { + const element = document.createElement('div'); + const component = mountWithIntl(); + expect(findTestSubject(component, 'docTableMode').text()).toBe('Data grid'); +}); + +test('should display the correct text if legacy table is selected', () => { + const { + core: { uiSettings }, + } = getServices(); + uiSettings.set('doc_table:legacy', true); + const element = document.createElement('div'); + const component = mountWithIntl(); + expect(findTestSubject(component, 'docTableMode').text()).toBe('Legacy table'); +}); diff --git a/src/plugins/discover/public/application/components/top_nav/open_options_popover.tsx b/src/plugins/discover/public/application/components/top_nav/open_options_popover.tsx new file mode 100644 index 0000000000000..fb8d061bcf4a6 --- /dev/null +++ b/src/plugins/discover/public/application/components/top_nav/open_options_popover.tsx @@ -0,0 +1,112 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. + */ + +import React from 'react'; +import ReactDOM from 'react-dom'; +import { I18nStart } from 'kibana/public'; +import { i18n } from '@kbn/i18n'; +import { FormattedMessage } from '@kbn/i18n/react'; +import { EuiSpacer, EuiButton, EuiText, EuiWrappingPopover, EuiCode } from '@elastic/eui'; +import { getServices } from '../../../kibana_services'; +import './open_options_popover.scss'; +import { DOC_TABLE_LEGACY } from '../../../../common'; + +let isOpen = false; + +interface OptionsPopoverProps { + onClose: () => void; + anchorElement: HTMLElement; +} + +export function OptionsPopover(props: OptionsPopoverProps) { + const { + core: { uiSettings }, + addBasePath, + } = getServices(); + const isLegacy = uiSettings.get(DOC_TABLE_LEGACY); + + const mode = isLegacy + ? i18n.translate('discover.openOptionsPopover.legacyTableText', { + defaultMessage: 'Legacy table', + }) + : i18n.translate('discover.openOptionsPopover.dataGridText', { + defaultMessage: 'Data grid', + }); + + return ( + +
+ +

+ + + + ), + currentViewMode: {mode}, + }} + /> +

+
+ + + + + + + {i18n.translate('discover.openOptionsPopover.goToAdvancedSettings', { + defaultMessage: 'Go to Advanced Settings', + })} + +
+
+ ); +} + +export function openOptionsPopover({ + I18nContext, + anchorElement, +}: { + I18nContext: I18nStart['Context']; + anchorElement: HTMLElement; +}) { + if (isOpen) { + return; + } + + isOpen = true; + const container = document.createElement('div'); + const onClose = () => { + ReactDOM.unmountComponentAtNode(container); + document.body.removeChild(container); + isOpen = false; + }; + + document.body.appendChild(container); + + const element = ( + + + + ); + ReactDOM.render(element, container); +} diff --git a/src/plugins/discover/server/ui_settings.ts b/src/plugins/discover/server/ui_settings.ts index d3fdb6e72c651..103a06965835e 100644 --- a/src/plugins/discover/server/ui_settings.ts +++ b/src/plugins/discover/server/ui_settings.ts @@ -157,7 +157,7 @@ export const uiSettings: Record = { name: i18n.translate('discover.advancedSettings.docTableVersionName', { defaultMessage: 'Use legacy table', }), - value: true, + value: false, description: i18n.translate('discover.advancedSettings.docTableVersionDescription', { defaultMessage: 'Discover uses a new table layout that includes better data sorting, drag-and-drop columns, and a full screen ' + diff --git a/src/plugins/embeddable/public/lib/panel/_embeddable_panel.scss b/src/plugins/embeddable/public/lib/panel/_embeddable_panel.scss index d21911f10f82e..f7ee1f3c741c4 100644 --- a/src/plugins/embeddable/public/lib/panel/_embeddable_panel.scss +++ b/src/plugins/embeddable/public/lib/panel/_embeddable_panel.scss @@ -162,12 +162,5 @@ .embPanel__label { position: absolute; padding-left: $euiSizeS; -} - -.embPanel__content[data-error], -.embPanel__content[data-loading] { - pointer-events: none; - filter: grayscale(100%); - /* stylelint-disable-next-line color-named */ - filter: gray; + z-index: $euiZLevel1; } diff --git a/src/plugins/home/server/services/sample_data/data_sets/flights/saved_objects.ts b/src/plugins/home/server/services/sample_data/data_sets/flights/saved_objects.ts index f16c1c7104417..1fa19189b8c84 100644 --- a/src/plugins/home/server/services/sample_data/data_sets/flights/saved_objects.ts +++ b/src/plugins/home/server/services/sample_data/data_sets/flights/saved_objects.ts @@ -438,10 +438,10 @@ export const getSavedObjects = (): SavedObject[] => [ attributes: { title: 'kibana_sample_data_flights', timeFieldName: 'timestamp', - fields: - '[{"name":"hour_of_day","type":"number","count":0,"scripted":true,"script":"doc[\'timestamp\'].value.hourOfDay","lang":"painless","searchable":true,"aggregatable":true,"readFromDocValues":false}]', fieldFormatMap: '{"hour_of_day":{"id":"number","params":{"pattern":"00"}},"AvgTicketPrice":{"id":"number","params":{"pattern":"$0,0.[00]"}}}', + runtimeFieldMap: + '{"hour_of_day":{"type":"long","script":{"source":"emit(doc[\'timestamp\'].value.hourOfDay);"}}}', }, references: [], }, diff --git a/src/plugins/home/server/services/sample_data/data_sets/logs/saved_objects.ts b/src/plugins/home/server/services/sample_data/data_sets/logs/saved_objects.ts index 8a3469fe4f3c0..a68d6bfe9cc58 100644 --- a/src/plugins/home/server/services/sample_data/data_sets/logs/saved_objects.ts +++ b/src/plugins/home/server/services/sample_data/data_sets/logs/saved_objects.ts @@ -275,9 +275,9 @@ export const getSavedObjects = (): SavedObject[] => [ attributes: { title: 'kibana_sample_data_logs', timeFieldName: 'timestamp', - fields: - '[{"name":"hour_of_day","type":"number","count":0,"scripted":true,"script":"doc[\'timestamp\'].value.getHour()","lang":"painless","searchable":true,"aggregatable":true,"readFromDocValues":false}]', fieldFormatMap: '{"hour_of_day":{}}', + runtimeFieldMap: + '{"hour_of_day":{"type":"long","script":{"source":"emit(doc[\'timestamp\'].value.getHour());"}}}', }, references: [], }, diff --git a/src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/__snapshots__/create_index_pattern_wizard.test.tsx.snap b/src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/__snapshots__/create_index_pattern_wizard.test.tsx.snap index 70b638d5d0b8d..21248ac9d1dc0 100644 --- a/src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/__snapshots__/create_index_pattern_wizard.test.tsx.snap +++ b/src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/__snapshots__/create_index_pattern_wizard.test.tsx.snap @@ -22,6 +22,7 @@ exports[`CreateIndexPatternWizard renders index pattern step when there are indi "ELASTIC_WEBSITE_URL": "htts://jestTest.elastic.co", "links": Object { "indexPatterns": Object {}, + "runtimeFields": Object {}, "scriptedFields": Object {}, }, } @@ -72,6 +73,7 @@ exports[`CreateIndexPatternWizard renders the empty state when there are no indi "ELASTIC_WEBSITE_URL": "htts://jestTest.elastic.co", "links": Object { "indexPatterns": Object {}, + "runtimeFields": Object {}, "scriptedFields": Object {}, }, } @@ -116,6 +118,7 @@ exports[`CreateIndexPatternWizard renders time field step when step is set to 2 "ELASTIC_WEBSITE_URL": "htts://jestTest.elastic.co", "links": Object { "indexPatterns": Object {}, + "runtimeFields": Object {}, "scriptedFields": Object {}, }, } @@ -160,6 +163,7 @@ exports[`CreateIndexPatternWizard renders when there are no indices but there ar "ELASTIC_WEBSITE_URL": "htts://jestTest.elastic.co", "links": Object { "indexPatterns": Object {}, + "runtimeFields": Object {}, "scriptedFields": Object {}, }, } @@ -204,6 +208,7 @@ exports[`CreateIndexPatternWizard shows system indices even if there are no othe "ELASTIC_WEBSITE_URL": "htts://jestTest.elastic.co", "links": Object { "indexPatterns": Object {}, + "runtimeFields": Object {}, "scriptedFields": Object {}, }, } diff --git a/src/plugins/index_pattern_management/public/components/edit_index_pattern/scripted_fields_table/components/header/__snapshots__/header.test.tsx.snap b/src/plugins/index_pattern_management/public/components/edit_index_pattern/scripted_fields_table/components/header/__snapshots__/header.test.tsx.snap index 5218ebd1b4ad4..f4eb2a0e74089 100644 --- a/src/plugins/index_pattern_management/public/components/edit_index_pattern/scripted_fields_table/components/header/__snapshots__/header.test.tsx.snap +++ b/src/plugins/index_pattern_management/public/components/edit_index_pattern/scripted_fields_table/components/header/__snapshots__/header.test.tsx.snap @@ -1,49 +1,205 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`Header should render normally 1`] = ` -
-
-

- - Scripted fields - -

-

- - You can use scripted fields in visualizations and display them in your documents. However, you cannot search scripted fields. - -

-
-
-
- + + instead. + + +

+
+ +
+
+ - - - Add scripted field - - - - - - + + + + + + + + + + `; diff --git a/src/plugins/index_pattern_management/public/components/edit_index_pattern/scripted_fields_table/components/header/header.test.tsx b/src/plugins/index_pattern_management/public/components/edit_index_pattern/scripted_fields_table/components/header/header.test.tsx index 3e2da10cb1473..609769690dbae 100644 --- a/src/plugins/index_pattern_management/public/components/edit_index_pattern/scripted_fields_table/components/header/header.test.tsx +++ b/src/plugins/index_pattern_management/public/components/edit_index_pattern/scripted_fields_table/components/header/header.test.tsx @@ -7,22 +7,31 @@ */ import React from 'react'; -import { render } from 'enzyme'; +import { mount } from 'enzyme'; import { RouteComponentProps } from 'react-router-dom'; import { ScopedHistory } from 'kibana/public'; import { scopedHistoryMock } from '../../../../../../../../core/public/mocks'; +import { KibanaContextProvider } from 'src/plugins/kibana_react/public'; +import { mockManagementPlugin } from '../../../../../mocks'; import { Header } from './header'; describe('Header', () => { + const mockedContext = mockManagementPlugin.createIndexPatternManagmentContext(); test('should render normally', () => { - const component = render( + const component = mount( + />, + { + wrappingComponent: KibanaContextProvider, + wrappingComponentProps: { + services: mockedContext, + }, + } ); expect(component).toMatchSnapshot(); diff --git a/src/plugins/index_pattern_management/public/components/edit_index_pattern/scripted_fields_table/components/header/header.tsx b/src/plugins/index_pattern_management/public/components/edit_index_pattern/scripted_fields_table/components/header/header.tsx index 607f9ff804e7d..22da83b179652 100644 --- a/src/plugins/index_pattern_management/public/components/edit_index_pattern/scripted_fields_table/components/header/header.tsx +++ b/src/plugins/index_pattern_management/public/components/edit_index_pattern/scripted_fields_table/components/header/header.tsx @@ -8,50 +8,61 @@ import React from 'react'; import { withRouter, RouteComponentProps } from 'react-router-dom'; -import { EuiButton, EuiFlexGroup, EuiFlexItem, EuiText, EuiTitle } from '@elastic/eui'; +import { EuiButton, EuiFlexGroup, EuiFlexItem, EuiText, EuiLink, EuiIcon } from '@elastic/eui'; import { FormattedMessage } from '@kbn/i18n/react'; import { ScopedHistory } from 'kibana/public'; -import { reactRouterNavigate } from '../../../../../../../kibana_react/public'; +import { reactRouterNavigate, useKibana } from '../../../../../../../kibana_react/public'; +import { IndexPatternManagmentContext } from '../../../../../types'; interface HeaderProps extends RouteComponentProps { indexPatternId: string; history: ScopedHistory; } -export const Header = withRouter(({ indexPatternId, history }: HeaderProps) => ( - - - -

- -

-
- -

+export const Header = withRouter(({ indexPatternId, history }: HeaderProps) => { + const docLinks = useKibana().services.docLinks?.links; + return ( + + + +

+ +
+ + + + + ), + }} + /> +

+
+
+ + + -

- -
- - - - - - -
-)); + + + + ); +}); diff --git a/src/plugins/index_pattern_management/public/components/edit_index_pattern/source_filters_table/components/header/__snapshots__/header.test.tsx.snap b/src/plugins/index_pattern_management/public/components/edit_index_pattern/source_filters_table/components/header/__snapshots__/header.test.tsx.snap index daa8e4a1c7063..1f56e3caeaf6b 100644 --- a/src/plugins/index_pattern_management/public/components/edit_index_pattern/source_filters_table/components/header/__snapshots__/header.test.tsx.snap +++ b/src/plugins/index_pattern_management/public/components/edit_index_pattern/source_filters_table/components/header/__snapshots__/header.test.tsx.snap @@ -2,18 +2,9 @@ exports[`Header should render normally 1`] = ` - -

- -

-
-

( <> - -

- -

- - +

+ +

+

+ + + , + "scriptsInAggregation": + + , + } + } + > + + Familiarize yourself with + + + + and + + + + before using this feature. Scripted fields can be used to display and aggregate calculated values. As such, they can be very slow and, if done incorrectly, can cause Kibana to become unusable. + + +

+
+
+ +
+ } @@ -38,12 +126,13 @@ exports[`ScriptingWarningCallOut should render normally 1`] = ` className="euiCallOutHeader__title" > - Proceed with caution + Scripted fields are deprecated @@ -54,113 +143,57 @@ exports[`ScriptingWarningCallOut should render normally 1`] = `
-

- - -   - - , - "scriptsInAggregation": - -   - - , - } - } + +

- - Please familiarize yourself with - + + + , + } + } > - - - and with - - - - before using scripted fields. - - -

-

- - - Scripted fields can be used to display and aggregate calculated values. As such, they can be very slow, and if done incorrectly, can cause Kibana to be unusable. There's no safety net here. If you make a typo, unexpected exceptions will be thrown all over the place! - - -

+ + + . + + +

+
+
diff --git a/src/plugins/index_pattern_management/public/components/field_editor/components/scripting_call_outs/warning_call_out.tsx b/src/plugins/index_pattern_management/public/components/field_editor/components/scripting_call_outs/warning_call_out.tsx index e52136476dd03..d992a3fc5c192 100644 --- a/src/plugins/index_pattern_management/public/components/field_editor/components/scripting_call_outs/warning_call_out.tsx +++ b/src/plugins/index_pattern_management/public/components/field_editor/components/scripting_call_outs/warning_call_out.tsx @@ -8,7 +8,7 @@ import React, { Fragment } from 'react'; -import { EuiCallOut, EuiIcon, EuiLink, EuiSpacer } from '@elastic/eui'; +import { EuiCallOut, EuiLink, EuiSpacer, EuiText } from '@elastic/eui'; import { FormattedMessage } from '@kbn/i18n/react'; @@ -20,56 +20,67 @@ export interface ScriptingWarningCallOutProps { } export const ScriptingWarningCallOut = ({ isVisible = false }: ScriptingWarningCallOutProps) => { - const docLinksScriptedFields = useKibana().services.docLinks?.links - .scriptedFields; + const docLinks = useKibana().services.docLinks?.links; return isVisible ? ( - - } - color="warning" - iconType="alert" - > +

+ -   - ), scriptsInAggregation: ( - + -   - ), }} />

-

+ + + -

+ } + > + +

+ + + + ), + }} + /> +

+
diff --git a/src/plugins/index_pattern_management/public/mocks.ts b/src/plugins/index_pattern_management/public/mocks.ts index 606f9edafbca9..3462131e50463 100644 --- a/src/plugins/index_pattern_management/public/mocks.ts +++ b/src/plugins/index_pattern_management/public/mocks.ts @@ -69,6 +69,7 @@ const docLinks = { links: { indexPatterns: {}, scriptedFields: {}, + runtimeFields: {}, } as any, }; diff --git a/src/plugins/kibana_overview/public/assets/solutions_enterprise_search_2x.png b/src/plugins/kibana_overview/public/assets/solutions_enterprise_search_2x.png new file mode 100644 index 0000000000000..e8a8d08c78fe0 Binary files /dev/null and b/src/plugins/kibana_overview/public/assets/solutions_enterprise_search_2x.png differ diff --git a/src/plugins/kibana_overview/public/assets/solutions_enterprise_search_dark_2x.png b/src/plugins/kibana_overview/public/assets/solutions_enterprise_search_dark_2x.png deleted file mode 100644 index 86ac827f06a77..0000000000000 Binary files a/src/plugins/kibana_overview/public/assets/solutions_enterprise_search_dark_2x.png and /dev/null differ diff --git a/src/plugins/kibana_overview/public/assets/solutions_enterprise_search_light_2x.png b/src/plugins/kibana_overview/public/assets/solutions_enterprise_search_light_2x.png deleted file mode 100644 index 527a09aad05ec..0000000000000 Binary files a/src/plugins/kibana_overview/public/assets/solutions_enterprise_search_light_2x.png and /dev/null differ diff --git a/src/plugins/kibana_overview/public/assets/solutions_observability_2x.png b/src/plugins/kibana_overview/public/assets/solutions_observability_2x.png new file mode 100644 index 0000000000000..d73b3e311f9f6 Binary files /dev/null and b/src/plugins/kibana_overview/public/assets/solutions_observability_2x.png differ diff --git a/src/plugins/kibana_overview/public/assets/solutions_observability_dark_2x.png b/src/plugins/kibana_overview/public/assets/solutions_observability_dark_2x.png deleted file mode 100644 index c9dd85ee07f35..0000000000000 Binary files a/src/plugins/kibana_overview/public/assets/solutions_observability_dark_2x.png and /dev/null differ diff --git a/src/plugins/kibana_overview/public/assets/solutions_observability_light_2x.png b/src/plugins/kibana_overview/public/assets/solutions_observability_light_2x.png deleted file mode 100644 index 85120b906c967..0000000000000 Binary files a/src/plugins/kibana_overview/public/assets/solutions_observability_light_2x.png and /dev/null differ diff --git a/src/plugins/kibana_overview/public/assets/solutions_security_solution_2x.png b/src/plugins/kibana_overview/public/assets/solutions_security_solution_2x.png new file mode 100644 index 0000000000000..771bbb9790c4e Binary files /dev/null and b/src/plugins/kibana_overview/public/assets/solutions_security_solution_2x.png differ diff --git a/src/plugins/kibana_overview/public/assets/solutions_security_solution_dark_2x.png b/src/plugins/kibana_overview/public/assets/solutions_security_solution_dark_2x.png deleted file mode 100644 index 24f902bff090b..0000000000000 Binary files a/src/plugins/kibana_overview/public/assets/solutions_security_solution_dark_2x.png and /dev/null differ diff --git a/src/plugins/kibana_overview/public/assets/solutions_security_solution_light_2x.png b/src/plugins/kibana_overview/public/assets/solutions_security_solution_light_2x.png deleted file mode 100644 index 2b35af848f912..0000000000000 Binary files a/src/plugins/kibana_overview/public/assets/solutions_security_solution_light_2x.png and /dev/null differ diff --git a/src/plugins/kibana_overview/public/components/_overview.scss b/src/plugins/kibana_overview/public/components/_overview.scss index 94555013d0a77..12e2d9cd921ec 100644 --- a/src/plugins/kibana_overview/public/components/_overview.scss +++ b/src/plugins/kibana_overview/public/components/_overview.scss @@ -59,6 +59,24 @@ } } +.kbnOverviewSolution { + &.enterpriseSearch { + .euiCard__image { + background-color: $euiColorSecondary; + } + } + &.observability { + .euiCard__image { + background-color: $euiColorAccent; + } + } + &.securitySolution { + .euiCard__image { + background-color: $euiColorDarkestShade; + } + } +} + .kbnOverviewSolution__icon { background-color: $euiColorEmptyShade !important; box-shadow: none !important; diff --git a/src/plugins/kibana_overview/public/components/overview/__snapshots__/overview.test.tsx.snap b/src/plugins/kibana_overview/public/components/overview/__snapshots__/overview.test.tsx.snap index 142fe37ae932f..2e7dc9a7ddc60 100644 --- a/src/plugins/kibana_overview/public/components/overview/__snapshots__/overview.test.tsx.snap +++ b/src/plugins/kibana_overview/public/components/overview/__snapshots__/overview.test.tsx.snap @@ -13,25 +13,25 @@ exports[`Overview render 1`] = ` "kibana_landing_page", ], Array [ - "/plugins/kibanaOverview/assets/solutions_kibana_light_2x.png", + "/plugins/kibanaOverview/assets/solutions_kibana_2x.png", ], Array [ "path-to-solution-two", ], Array [ - "/plugins/kibanaOverview/assets/solutions_solution_2_light_2x.png", + "/plugins/kibanaOverview/assets/solutions_solution_2_2x.png", ], Array [ "path-to-solution-three", ], Array [ - "/plugins/kibanaOverview/assets/solutions_solution_3_light_2x.png", + "/plugins/kibanaOverview/assets/solutions_solution_3_2x.png", ], Array [ "path-to-solution-four", ], Array [ - "/plugins/kibanaOverview/assets/solutions_solution_4_light_2x.png", + "/plugins/kibanaOverview/assets/solutions_solution_4_2x.png", ], ], "results": Array [ @@ -41,7 +41,7 @@ exports[`Overview render 1`] = ` }, Object { "type": "return", - "value": "/plugins/kibanaOverview/assets/solutions_kibana_light_2x.png", + "value": "/plugins/kibanaOverview/assets/solutions_kibana_2x.png", }, Object { "type": "return", @@ -49,7 +49,7 @@ exports[`Overview render 1`] = ` }, Object { "type": "return", - "value": "/plugins/kibanaOverview/assets/solutions_solution_2_light_2x.png", + "value": "/plugins/kibanaOverview/assets/solutions_solution_2_2x.png", }, Object { "type": "return", @@ -57,7 +57,7 @@ exports[`Overview render 1`] = ` }, Object { "type": "return", - "value": "/plugins/kibanaOverview/assets/solutions_solution_3_light_2x.png", + "value": "/plugins/kibanaOverview/assets/solutions_solution_3_2x.png", }, Object { "type": "return", @@ -65,7 +65,7 @@ exports[`Overview render 1`] = ` }, Object { "type": "return", - "value": "/plugins/kibanaOverview/assets/solutions_solution_4_light_2x.png", + "value": "/plugins/kibanaOverview/assets/solutions_solution_4_2x.png", }, ], } @@ -191,7 +191,7 @@ exports[`Overview render 1`] = ` > } - image="/plugins/kibanaOverview/assets/solutions_kibana_light_2x.png" + image="/plugins/kibanaOverview/assets/solutions_kibana_2x.png" onClick={[Function]} title="Kibana" titleElement="h3" @@ -217,7 +217,7 @@ exports[`Overview render 1`] = ` > } - image="/plugins/kibanaOverview/assets/solutions_solution_2_light_2x.png" + image="/plugins/kibanaOverview/assets/solutions_solution_2_2x.png" onClick={[Function]} title="Solution two" titleElement="h3" @@ -243,7 +243,7 @@ exports[`Overview render 1`] = ` > } - image="/plugins/kibanaOverview/assets/solutions_solution_3_light_2x.png" + image="/plugins/kibanaOverview/assets/solutions_solution_3_2x.png" onClick={[Function]} title="Solution three" titleElement="h3" @@ -269,7 +269,7 @@ exports[`Overview render 1`] = ` > } - image="/plugins/kibanaOverview/assets/solutions_solution_4_light_2x.png" + image="/plugins/kibanaOverview/assets/solutions_solution_4_2x.png" onClick={[Function]} title="Solution four" titleElement="h3" @@ -305,25 +305,25 @@ exports[`Overview render 1`] = ` "kibana_landing_page", ], Array [ - "/plugins/kibanaOverview/assets/solutions_kibana_light_2x.png", + "/plugins/kibanaOverview/assets/solutions_kibana_2x.png", ], Array [ "path-to-solution-two", ], Array [ - "/plugins/kibanaOverview/assets/solutions_solution_2_light_2x.png", + "/plugins/kibanaOverview/assets/solutions_solution_2_2x.png", ], Array [ "path-to-solution-three", ], Array [ - "/plugins/kibanaOverview/assets/solutions_solution_3_light_2x.png", + "/plugins/kibanaOverview/assets/solutions_solution_3_2x.png", ], Array [ "path-to-solution-four", ], Array [ - "/plugins/kibanaOverview/assets/solutions_solution_4_light_2x.png", + "/plugins/kibanaOverview/assets/solutions_solution_4_2x.png", ], ], "results": Array [ @@ -333,7 +333,7 @@ exports[`Overview render 1`] = ` }, Object { "type": "return", - "value": "/plugins/kibanaOverview/assets/solutions_kibana_light_2x.png", + "value": "/plugins/kibanaOverview/assets/solutions_kibana_2x.png", }, Object { "type": "return", @@ -341,7 +341,7 @@ exports[`Overview render 1`] = ` }, Object { "type": "return", - "value": "/plugins/kibanaOverview/assets/solutions_solution_2_light_2x.png", + "value": "/plugins/kibanaOverview/assets/solutions_solution_2_2x.png", }, Object { "type": "return", @@ -349,7 +349,7 @@ exports[`Overview render 1`] = ` }, Object { "type": "return", - "value": "/plugins/kibanaOverview/assets/solutions_solution_3_light_2x.png", + "value": "/plugins/kibanaOverview/assets/solutions_solution_3_2x.png", }, Object { "type": "return", @@ -357,7 +357,7 @@ exports[`Overview render 1`] = ` }, Object { "type": "return", - "value": "/plugins/kibanaOverview/assets/solutions_solution_4_light_2x.png", + "value": "/plugins/kibanaOverview/assets/solutions_solution_4_2x.png", }, ], } @@ -383,49 +383,49 @@ exports[`Overview without features 1`] = ` "kibana_landing_page", ], Array [ - "/plugins/kibanaOverview/assets/solutions_kibana_light_2x.png", + "/plugins/kibanaOverview/assets/solutions_kibana_2x.png", ], Array [ "path-to-solution-two", ], Array [ - "/plugins/kibanaOverview/assets/solutions_solution_2_light_2x.png", + "/plugins/kibanaOverview/assets/solutions_solution_2_2x.png", ], Array [ "path-to-solution-three", ], Array [ - "/plugins/kibanaOverview/assets/solutions_solution_3_light_2x.png", + "/plugins/kibanaOverview/assets/solutions_solution_3_2x.png", ], Array [ "path-to-solution-four", ], Array [ - "/plugins/kibanaOverview/assets/solutions_solution_4_light_2x.png", + "/plugins/kibanaOverview/assets/solutions_solution_4_2x.png", ], Array [ "kibana_landing_page", ], Array [ - "/plugins/kibanaOverview/assets/solutions_kibana_light_2x.png", + "/plugins/kibanaOverview/assets/solutions_kibana_2x.png", ], Array [ "path-to-solution-two", ], Array [ - "/plugins/kibanaOverview/assets/solutions_solution_2_light_2x.png", + "/plugins/kibanaOverview/assets/solutions_solution_2_2x.png", ], Array [ "path-to-solution-three", ], Array [ - "/plugins/kibanaOverview/assets/solutions_solution_3_light_2x.png", + "/plugins/kibanaOverview/assets/solutions_solution_3_2x.png", ], Array [ "path-to-solution-four", ], Array [ - "/plugins/kibanaOverview/assets/solutions_solution_4_light_2x.png", + "/plugins/kibanaOverview/assets/solutions_solution_4_2x.png", ], ], "results": Array [ @@ -435,7 +435,7 @@ exports[`Overview without features 1`] = ` }, Object { "type": "return", - "value": "/plugins/kibanaOverview/assets/solutions_kibana_light_2x.png", + "value": "/plugins/kibanaOverview/assets/solutions_kibana_2x.png", }, Object { "type": "return", @@ -443,7 +443,7 @@ exports[`Overview without features 1`] = ` }, Object { "type": "return", - "value": "/plugins/kibanaOverview/assets/solutions_solution_2_light_2x.png", + "value": "/plugins/kibanaOverview/assets/solutions_solution_2_2x.png", }, Object { "type": "return", @@ -451,7 +451,7 @@ exports[`Overview without features 1`] = ` }, Object { "type": "return", - "value": "/plugins/kibanaOverview/assets/solutions_solution_3_light_2x.png", + "value": "/plugins/kibanaOverview/assets/solutions_solution_3_2x.png", }, Object { "type": "return", @@ -459,7 +459,7 @@ exports[`Overview without features 1`] = ` }, Object { "type": "return", - "value": "/plugins/kibanaOverview/assets/solutions_solution_4_light_2x.png", + "value": "/plugins/kibanaOverview/assets/solutions_solution_4_2x.png", }, Object { "type": "return", @@ -467,7 +467,7 @@ exports[`Overview without features 1`] = ` }, Object { "type": "return", - "value": "/plugins/kibanaOverview/assets/solutions_kibana_light_2x.png", + "value": "/plugins/kibanaOverview/assets/solutions_kibana_2x.png", }, Object { "type": "return", @@ -475,7 +475,7 @@ exports[`Overview without features 1`] = ` }, Object { "type": "return", - "value": "/plugins/kibanaOverview/assets/solutions_solution_2_light_2x.png", + "value": "/plugins/kibanaOverview/assets/solutions_solution_2_2x.png", }, Object { "type": "return", @@ -483,7 +483,7 @@ exports[`Overview without features 1`] = ` }, Object { "type": "return", - "value": "/plugins/kibanaOverview/assets/solutions_solution_3_light_2x.png", + "value": "/plugins/kibanaOverview/assets/solutions_solution_3_2x.png", }, Object { "type": "return", @@ -491,7 +491,7 @@ exports[`Overview without features 1`] = ` }, Object { "type": "return", - "value": "/plugins/kibanaOverview/assets/solutions_solution_4_light_2x.png", + "value": "/plugins/kibanaOverview/assets/solutions_solution_4_2x.png", }, ], } @@ -617,7 +617,7 @@ exports[`Overview without features 1`] = ` > } - image="/plugins/kibanaOverview/assets/solutions_kibana_light_2x.png" + image="/plugins/kibanaOverview/assets/solutions_kibana_2x.png" onClick={[Function]} title="Kibana" titleElement="h3" @@ -643,7 +643,7 @@ exports[`Overview without features 1`] = ` > } - image="/plugins/kibanaOverview/assets/solutions_solution_2_light_2x.png" + image="/plugins/kibanaOverview/assets/solutions_solution_2_2x.png" onClick={[Function]} title="Solution two" titleElement="h3" @@ -669,7 +669,7 @@ exports[`Overview without features 1`] = ` > } - image="/plugins/kibanaOverview/assets/solutions_solution_3_light_2x.png" + image="/plugins/kibanaOverview/assets/solutions_solution_3_2x.png" onClick={[Function]} title="Solution three" titleElement="h3" @@ -695,7 +695,7 @@ exports[`Overview without features 1`] = ` > } - image="/plugins/kibanaOverview/assets/solutions_solution_4_light_2x.png" + image="/plugins/kibanaOverview/assets/solutions_solution_4_2x.png" onClick={[Function]} title="Solution four" titleElement="h3" @@ -731,49 +731,49 @@ exports[`Overview without features 1`] = ` "kibana_landing_page", ], Array [ - "/plugins/kibanaOverview/assets/solutions_kibana_light_2x.png", + "/plugins/kibanaOverview/assets/solutions_kibana_2x.png", ], Array [ "path-to-solution-two", ], Array [ - "/plugins/kibanaOverview/assets/solutions_solution_2_light_2x.png", + "/plugins/kibanaOverview/assets/solutions_solution_2_2x.png", ], Array [ "path-to-solution-three", ], Array [ - "/plugins/kibanaOverview/assets/solutions_solution_3_light_2x.png", + "/plugins/kibanaOverview/assets/solutions_solution_3_2x.png", ], Array [ "path-to-solution-four", ], Array [ - "/plugins/kibanaOverview/assets/solutions_solution_4_light_2x.png", + "/plugins/kibanaOverview/assets/solutions_solution_4_2x.png", ], Array [ "kibana_landing_page", ], Array [ - "/plugins/kibanaOverview/assets/solutions_kibana_light_2x.png", + "/plugins/kibanaOverview/assets/solutions_kibana_2x.png", ], Array [ "path-to-solution-two", ], Array [ - "/plugins/kibanaOverview/assets/solutions_solution_2_light_2x.png", + "/plugins/kibanaOverview/assets/solutions_solution_2_2x.png", ], Array [ "path-to-solution-three", ], Array [ - "/plugins/kibanaOverview/assets/solutions_solution_3_light_2x.png", + "/plugins/kibanaOverview/assets/solutions_solution_3_2x.png", ], Array [ "path-to-solution-four", ], Array [ - "/plugins/kibanaOverview/assets/solutions_solution_4_light_2x.png", + "/plugins/kibanaOverview/assets/solutions_solution_4_2x.png", ], ], "results": Array [ @@ -783,7 +783,7 @@ exports[`Overview without features 1`] = ` }, Object { "type": "return", - "value": "/plugins/kibanaOverview/assets/solutions_kibana_light_2x.png", + "value": "/plugins/kibanaOverview/assets/solutions_kibana_2x.png", }, Object { "type": "return", @@ -791,7 +791,7 @@ exports[`Overview without features 1`] = ` }, Object { "type": "return", - "value": "/plugins/kibanaOverview/assets/solutions_solution_2_light_2x.png", + "value": "/plugins/kibanaOverview/assets/solutions_solution_2_2x.png", }, Object { "type": "return", @@ -799,7 +799,7 @@ exports[`Overview without features 1`] = ` }, Object { "type": "return", - "value": "/plugins/kibanaOverview/assets/solutions_solution_3_light_2x.png", + "value": "/plugins/kibanaOverview/assets/solutions_solution_3_2x.png", }, Object { "type": "return", @@ -807,7 +807,7 @@ exports[`Overview without features 1`] = ` }, Object { "type": "return", - "value": "/plugins/kibanaOverview/assets/solutions_solution_4_light_2x.png", + "value": "/plugins/kibanaOverview/assets/solutions_solution_4_2x.png", }, Object { "type": "return", @@ -815,7 +815,7 @@ exports[`Overview without features 1`] = ` }, Object { "type": "return", - "value": "/plugins/kibanaOverview/assets/solutions_kibana_light_2x.png", + "value": "/plugins/kibanaOverview/assets/solutions_kibana_2x.png", }, Object { "type": "return", @@ -823,7 +823,7 @@ exports[`Overview without features 1`] = ` }, Object { "type": "return", - "value": "/plugins/kibanaOverview/assets/solutions_solution_2_light_2x.png", + "value": "/plugins/kibanaOverview/assets/solutions_solution_2_2x.png", }, Object { "type": "return", @@ -831,7 +831,7 @@ exports[`Overview without features 1`] = ` }, Object { "type": "return", - "value": "/plugins/kibanaOverview/assets/solutions_solution_3_light_2x.png", + "value": "/plugins/kibanaOverview/assets/solutions_solution_3_2x.png", }, Object { "type": "return", @@ -839,7 +839,7 @@ exports[`Overview without features 1`] = ` }, Object { "type": "return", - "value": "/plugins/kibanaOverview/assets/solutions_solution_4_light_2x.png", + "value": "/plugins/kibanaOverview/assets/solutions_solution_4_2x.png", }, ], } @@ -865,25 +865,25 @@ exports[`Overview without solutions 1`] = ` "kibana_landing_page", ], Array [ - "/plugins/kibanaOverview/assets/solutions_kibana_light_2x.png", + "/plugins/kibanaOverview/assets/solutions_kibana_2x.png", ], Array [ "path-to-solution-two", ], Array [ - "/plugins/kibanaOverview/assets/solutions_solution_2_light_2x.png", + "/plugins/kibanaOverview/assets/solutions_solution_2_2x.png", ], Array [ "path-to-solution-three", ], Array [ - "/plugins/kibanaOverview/assets/solutions_solution_3_light_2x.png", + "/plugins/kibanaOverview/assets/solutions_solution_3_2x.png", ], Array [ "path-to-solution-four", ], Array [ - "/plugins/kibanaOverview/assets/solutions_solution_4_light_2x.png", + "/plugins/kibanaOverview/assets/solutions_solution_4_2x.png", ], ], "results": Array [ @@ -893,7 +893,7 @@ exports[`Overview without solutions 1`] = ` }, Object { "type": "return", - "value": "/plugins/kibanaOverview/assets/solutions_kibana_light_2x.png", + "value": "/plugins/kibanaOverview/assets/solutions_kibana_2x.png", }, Object { "type": "return", @@ -901,7 +901,7 @@ exports[`Overview without solutions 1`] = ` }, Object { "type": "return", - "value": "/plugins/kibanaOverview/assets/solutions_solution_2_light_2x.png", + "value": "/plugins/kibanaOverview/assets/solutions_solution_2_2x.png", }, Object { "type": "return", @@ -909,7 +909,7 @@ exports[`Overview without solutions 1`] = ` }, Object { "type": "return", - "value": "/plugins/kibanaOverview/assets/solutions_solution_3_light_2x.png", + "value": "/plugins/kibanaOverview/assets/solutions_solution_3_2x.png", }, Object { "type": "return", @@ -917,7 +917,7 @@ exports[`Overview without solutions 1`] = ` }, Object { "type": "return", - "value": "/plugins/kibanaOverview/assets/solutions_solution_4_light_2x.png", + "value": "/plugins/kibanaOverview/assets/solutions_solution_4_2x.png", }, ], } @@ -1026,25 +1026,25 @@ exports[`Overview without solutions 1`] = ` "kibana_landing_page", ], Array [ - "/plugins/kibanaOverview/assets/solutions_kibana_light_2x.png", + "/plugins/kibanaOverview/assets/solutions_kibana_2x.png", ], Array [ "path-to-solution-two", ], Array [ - "/plugins/kibanaOverview/assets/solutions_solution_2_light_2x.png", + "/plugins/kibanaOverview/assets/solutions_solution_2_2x.png", ], Array [ "path-to-solution-three", ], Array [ - "/plugins/kibanaOverview/assets/solutions_solution_3_light_2x.png", + "/plugins/kibanaOverview/assets/solutions_solution_3_2x.png", ], Array [ "path-to-solution-four", ], Array [ - "/plugins/kibanaOverview/assets/solutions_solution_4_light_2x.png", + "/plugins/kibanaOverview/assets/solutions_solution_4_2x.png", ], ], "results": Array [ @@ -1054,7 +1054,7 @@ exports[`Overview without solutions 1`] = ` }, Object { "type": "return", - "value": "/plugins/kibanaOverview/assets/solutions_kibana_light_2x.png", + "value": "/plugins/kibanaOverview/assets/solutions_kibana_2x.png", }, Object { "type": "return", @@ -1062,7 +1062,7 @@ exports[`Overview without solutions 1`] = ` }, Object { "type": "return", - "value": "/plugins/kibanaOverview/assets/solutions_solution_2_light_2x.png", + "value": "/plugins/kibanaOverview/assets/solutions_solution_2_2x.png", }, Object { "type": "return", @@ -1070,7 +1070,7 @@ exports[`Overview without solutions 1`] = ` }, Object { "type": "return", - "value": "/plugins/kibanaOverview/assets/solutions_solution_3_light_2x.png", + "value": "/plugins/kibanaOverview/assets/solutions_solution_3_2x.png", }, Object { "type": "return", @@ -1078,7 +1078,7 @@ exports[`Overview without solutions 1`] = ` }, Object { "type": "return", - "value": "/plugins/kibanaOverview/assets/solutions_solution_4_light_2x.png", + "value": "/plugins/kibanaOverview/assets/solutions_solution_4_2x.png", }, ], } @@ -1095,25 +1095,25 @@ exports[`Overview without solutions 1`] = ` "kibana_landing_page", ], Array [ - "/plugins/kibanaOverview/assets/solutions_kibana_light_2x.png", + "/plugins/kibanaOverview/assets/solutions_kibana_2x.png", ], Array [ "path-to-solution-two", ], Array [ - "/plugins/kibanaOverview/assets/solutions_solution_2_light_2x.png", + "/plugins/kibanaOverview/assets/solutions_solution_2_2x.png", ], Array [ "path-to-solution-three", ], Array [ - "/plugins/kibanaOverview/assets/solutions_solution_3_light_2x.png", + "/plugins/kibanaOverview/assets/solutions_solution_3_2x.png", ], Array [ "path-to-solution-four", ], Array [ - "/plugins/kibanaOverview/assets/solutions_solution_4_light_2x.png", + "/plugins/kibanaOverview/assets/solutions_solution_4_2x.png", ], ], "results": Array [ @@ -1123,7 +1123,7 @@ exports[`Overview without solutions 1`] = ` }, Object { "type": "return", - "value": "/plugins/kibanaOverview/assets/solutions_kibana_light_2x.png", + "value": "/plugins/kibanaOverview/assets/solutions_kibana_2x.png", }, Object { "type": "return", @@ -1131,7 +1131,7 @@ exports[`Overview without solutions 1`] = ` }, Object { "type": "return", - "value": "/plugins/kibanaOverview/assets/solutions_solution_2_light_2x.png", + "value": "/plugins/kibanaOverview/assets/solutions_solution_2_2x.png", }, Object { "type": "return", @@ -1139,7 +1139,7 @@ exports[`Overview without solutions 1`] = ` }, Object { "type": "return", - "value": "/plugins/kibanaOverview/assets/solutions_solution_3_light_2x.png", + "value": "/plugins/kibanaOverview/assets/solutions_solution_3_2x.png", }, Object { "type": "return", @@ -1147,7 +1147,7 @@ exports[`Overview without solutions 1`] = ` }, Object { "type": "return", - "value": "/plugins/kibanaOverview/assets/solutions_solution_4_light_2x.png", + "value": "/plugins/kibanaOverview/assets/solutions_solution_4_2x.png", }, ], } @@ -1170,25 +1170,25 @@ exports[`Overview without solutions 1`] = ` "kibana_landing_page", ], Array [ - "/plugins/kibanaOverview/assets/solutions_kibana_light_2x.png", + "/plugins/kibanaOverview/assets/solutions_kibana_2x.png", ], Array [ "path-to-solution-two", ], Array [ - "/plugins/kibanaOverview/assets/solutions_solution_2_light_2x.png", + "/plugins/kibanaOverview/assets/solutions_solution_2_2x.png", ], Array [ "path-to-solution-three", ], Array [ - "/plugins/kibanaOverview/assets/solutions_solution_3_light_2x.png", + "/plugins/kibanaOverview/assets/solutions_solution_3_2x.png", ], Array [ "path-to-solution-four", ], Array [ - "/plugins/kibanaOverview/assets/solutions_solution_4_light_2x.png", + "/plugins/kibanaOverview/assets/solutions_solution_4_2x.png", ], ], "results": Array [ @@ -1198,7 +1198,7 @@ exports[`Overview without solutions 1`] = ` }, Object { "type": "return", - "value": "/plugins/kibanaOverview/assets/solutions_kibana_light_2x.png", + "value": "/plugins/kibanaOverview/assets/solutions_kibana_2x.png", }, Object { "type": "return", @@ -1206,7 +1206,7 @@ exports[`Overview without solutions 1`] = ` }, Object { "type": "return", - "value": "/plugins/kibanaOverview/assets/solutions_solution_2_light_2x.png", + "value": "/plugins/kibanaOverview/assets/solutions_solution_2_2x.png", }, Object { "type": "return", @@ -1214,7 +1214,7 @@ exports[`Overview without solutions 1`] = ` }, Object { "type": "return", - "value": "/plugins/kibanaOverview/assets/solutions_solution_3_light_2x.png", + "value": "/plugins/kibanaOverview/assets/solutions_solution_3_2x.png", }, Object { "type": "return", @@ -1222,7 +1222,7 @@ exports[`Overview without solutions 1`] = ` }, Object { "type": "return", - "value": "/plugins/kibanaOverview/assets/solutions_solution_4_light_2x.png", + "value": "/plugins/kibanaOverview/assets/solutions_solution_4_2x.png", }, ], } diff --git a/src/plugins/kibana_overview/public/components/overview/overview.tsx b/src/plugins/kibana_overview/public/components/overview/overview.tsx index 43f7dc82a6bd1..68c52b0395591 100644 --- a/src/plugins/kibana_overview/public/components/overview/overview.tsx +++ b/src/plugins/kibana_overview/public/components/overview/overview.tsx @@ -64,9 +64,7 @@ export const Overview: FC = ({ newsFetchResult, solutions, features }) => .sort(sortByOrder); const getSolutionGraphicURL = (solutionId: string) => - `/plugins/${PLUGIN_ID}/assets/solutions_${solutionId}_${ - IS_DARK_THEME ? 'dark' : 'light' - }_2x.png`; + `/plugins/${PLUGIN_ID}/assets/solutions_${solutionId}_2x.png`; const findFeatureById = (featureId: string) => features.find(({ id }) => id === featureId); const kibanaApps = features.filter(({ solutionId }) => solutionId === 'kibana').sort(sortByOrder); @@ -199,7 +197,7 @@ export const Overview: FC = ({ newsFetchResult, solutions, features }) => = { + schema: configSchema, + exposeToUsage: { + uiCounters: true, + usageCounters: { + bufferDuration: true, + }, + maximumWaitTimeForAllCollectorsInS: false, + }, +}; +``` + +In the above example setting `uiCounters: true` in the `exposeToUsage` property marks all configs +under the path `uiCounters` as safe. The collector will send the actual non-default config value +when setting an exact config or its parent path to `true`. + +Settings the config path or its parent path to `false` will explicitly mark this config as unsafe. +The collector will send `[redacted]` for non-default configs +when setting an exact config or its parent path to `false`. + +### Output of the collector + +```json +{ + "kibana_config_usage": { + "xpack.apm.serviceMapTraceIdBucketSize": 30, + "elasticsearch.username": "[redacted]", + "elasticsearch.password": "[redacted]", + "plugins.paths": "[redacted]", + "server.port": 5603, + "server.basePath": "[redacted]", + "server.rewriteBasePath": true, + "logging.json": false, + "usageCollection.uiCounters.debug": true + } +} +``` + +Note that arrays of objects will be reported as `[redacted]` and cannot be explicitly marked as safe. \ No newline at end of file diff --git a/src/plugins/kibana_usage_collection/server/collectors/config_usage/index.ts b/src/plugins/kibana_usage_collection/server/collectors/config_usage/index.ts new file mode 100644 index 0000000000000..5d37cfe5957ab --- /dev/null +++ b/src/plugins/kibana_usage_collection/server/collectors/config_usage/index.ts @@ -0,0 +1,9 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. + */ + +export { registerConfigUsageCollector } from './register_config_usage_collector'; diff --git a/src/plugins/kibana_usage_collection/server/collectors/config_usage/register_config_usage_collector.test.ts b/src/plugins/kibana_usage_collection/server/collectors/config_usage/register_config_usage_collector.test.ts new file mode 100644 index 0000000000000..7d4f03fd30edf --- /dev/null +++ b/src/plugins/kibana_usage_collection/server/collectors/config_usage/register_config_usage_collector.test.ts @@ -0,0 +1,44 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. + */ + +import { + Collector, + createUsageCollectionSetupMock, + createCollectorFetchContextMock, +} from '../../../../usage_collection/server/mocks'; +import { registerConfigUsageCollector } from './register_config_usage_collector'; +import { coreUsageDataServiceMock, loggingSystemMock } from '../../../../../core/server/mocks'; +import type { ConfigUsageData } from '../../../../../core/server'; + +const logger = loggingSystemMock.createLogger(); + +describe('kibana_config_usage', () => { + let collector: Collector; + + const usageCollectionMock = createUsageCollectionSetupMock(); + usageCollectionMock.makeUsageCollector.mockImplementation((config) => { + collector = new Collector(logger, config); + return createUsageCollectionSetupMock().makeUsageCollector(config); + }); + + const collectorFetchContext = createCollectorFetchContextMock(); + const coreUsageDataStart = coreUsageDataServiceMock.createStartContract(); + const mockConfigUsage = (Symbol('config usage telemetry') as any) as ConfigUsageData; + coreUsageDataStart.getConfigsUsageData.mockResolvedValue(mockConfigUsage); + + beforeAll(() => registerConfigUsageCollector(usageCollectionMock, () => coreUsageDataStart)); + + test('registered collector is set', () => { + expect(collector).not.toBeUndefined(); + expect(collector.type).toBe('kibana_config_usage'); + }); + + test('fetch', async () => { + expect(await collector.fetch(collectorFetchContext)).toEqual(mockConfigUsage); + }); +}); diff --git a/src/plugins/kibana_usage_collection/server/collectors/config_usage/register_config_usage_collector.ts b/src/plugins/kibana_usage_collection/server/collectors/config_usage/register_config_usage_collector.ts new file mode 100644 index 0000000000000..ad7f570432abf --- /dev/null +++ b/src/plugins/kibana_usage_collection/server/collectors/config_usage/register_config_usage_collector.ts @@ -0,0 +1,39 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. + */ + +import { UsageCollectionSetup } from '../../../../usage_collection/server'; +import { ConfigUsageData, CoreUsageDataStart } from '../../../../../core/server'; + +export function registerConfigUsageCollector( + usageCollection: UsageCollectionSetup, + getCoreUsageDataService: () => CoreUsageDataStart +) { + const collector = usageCollection.makeUsageCollector({ + type: 'kibana_config_usage', + isReady: () => typeof getCoreUsageDataService() !== 'undefined', + /** + * No schema for this collector. + * This collector will collect non-default configs from all plugins. + * Mapping each config to the schema is inconvenient for developers + * and would result in 100's of extra field mappings. + * + * We'll experiment with flattened type and runtime fields before comitting to a schema. + */ + schema: {}, + fetch: async () => { + const coreUsageDataService = getCoreUsageDataService(); + if (!coreUsageDataService) { + return; + } + + return await coreUsageDataService.getConfigsUsageData(); + }, + }); + + usageCollection.registerCollector(collector); +} diff --git a/src/plugins/kibana_usage_collection/server/collectors/core/index.test.ts b/src/plugins/kibana_usage_collection/server/collectors/core/core_usage_collector.test.ts similarity index 89% rename from src/plugins/kibana_usage_collection/server/collectors/core/index.test.ts rename to src/plugins/kibana_usage_collection/server/collectors/core/core_usage_collector.test.ts index cbc38129fdddf..b671a9f93d369 100644 --- a/src/plugins/kibana_usage_collection/server/collectors/core/index.test.ts +++ b/src/plugins/kibana_usage_collection/server/collectors/core/core_usage_collector.test.ts @@ -9,11 +9,11 @@ import { Collector, createUsageCollectionSetupMock, + createCollectorFetchContextMock, } from '../../../../usage_collection/server/mocks'; -import { createCollectorFetchContextMock } from 'src/plugins/usage_collection/server/mocks'; -import { registerCoreUsageCollector } from '.'; +import { registerCoreUsageCollector } from './core_usage_collector'; import { coreUsageDataServiceMock, loggingSystemMock } from '../../../../../core/server/mocks'; -import { CoreUsageData } from 'src/core/server/'; +import type { CoreUsageData } from '../../../../../core/server'; const logger = loggingSystemMock.createLogger(); diff --git a/src/plugins/kibana_usage_collection/server/collectors/index.ts b/src/plugins/kibana_usage_collection/server/collectors/index.ts index 522860e58918c..94ed0eefe7a06 100644 --- a/src/plugins/kibana_usage_collection/server/collectors/index.ts +++ b/src/plugins/kibana_usage_collection/server/collectors/index.ts @@ -15,6 +15,7 @@ export { registerCloudProviderUsageCollector } from './cloud'; export { registerCspCollector } from './csp'; export { registerCoreUsageCollector } from './core'; export { registerLocalizationUsageCollector } from './localization'; +export { registerConfigUsageCollector } from './config_usage'; export { registerUiCountersUsageCollector, registerUiCounterSavedObjectType, diff --git a/src/plugins/kibana_usage_collection/server/collectors/management/schema.ts b/src/plugins/kibana_usage_collection/server/collectors/management/schema.ts index 142bcef521c15..dfe31b1da3643 100644 --- a/src/plugins/kibana_usage_collection/server/collectors/management/schema.ts +++ b/src/plugins/kibana_usage_collection/server/collectors/management/schema.ts @@ -432,10 +432,6 @@ export const stackManagementSchema: MakeSchemaFrom = { type: 'text', _meta: { description: 'Non-default value of setting.' }, }, - 'observability:enableAlertingExperience': { - type: 'boolean', - _meta: { description: 'Non-default value of setting.' }, - }, 'labs:presentation:unifiedToolbar': { type: 'boolean', _meta: { description: 'Non-default value of setting.' }, diff --git a/src/plugins/kibana_usage_collection/server/collectors/management/types.ts b/src/plugins/kibana_usage_collection/server/collectors/management/types.ts index b457adecc1a79..b8bc06d8a6a29 100644 --- a/src/plugins/kibana_usage_collection/server/collectors/management/types.ts +++ b/src/plugins/kibana_usage_collection/server/collectors/management/types.ts @@ -32,7 +32,6 @@ export interface UsageStats { 'securitySolution:rulesTableRefresh': string; 'apm:enableSignificantTerms': boolean; 'apm:enableServiceOverview': boolean; - 'observability:enableAlertingExperience': boolean; 'observability:enableInspectEsQueries': boolean; 'visualize:enableLabs': boolean; 'visualization:heatmap:maxBuckets': number; diff --git a/src/plugins/kibana_usage_collection/server/plugin.test.ts b/src/plugins/kibana_usage_collection/server/plugin.test.ts index 86204ed30e656..450c610afc620 100644 --- a/src/plugins/kibana_usage_collection/server/plugin.test.ts +++ b/src/plugins/kibana_usage_collection/server/plugin.test.ts @@ -93,6 +93,10 @@ describe('kibana_usage_collection', () => { "isReady": false, "type": "core", }, + Object { + "isReady": false, + "type": "kibana_config_usage", + }, Object { "isReady": true, "type": "localization", diff --git a/src/plugins/kibana_usage_collection/server/plugin.ts b/src/plugins/kibana_usage_collection/server/plugin.ts index a27b8dff57b67..c144384e0882f 100644 --- a/src/plugins/kibana_usage_collection/server/plugin.ts +++ b/src/plugins/kibana_usage_collection/server/plugin.ts @@ -35,6 +35,7 @@ import { registerUiCountersUsageCollector, registerUiCounterSavedObjectType, registerUiCountersRollups, + registerConfigUsageCollector, registerUsageCountersRollups, registerUsageCountersUsageCollector, } from './collectors'; @@ -122,6 +123,7 @@ export class KibanaUsageCollectionPlugin implements Plugin { registerCloudProviderUsageCollector(usageCollection); registerCspCollector(usageCollection, coreSetup.http); registerCoreUsageCollector(usageCollection, getCoreUsageDataService); + registerConfigUsageCollector(usageCollection, getCoreUsageDataService); registerLocalizationUsageCollector(usageCollection, coreSetup.i18n); } } diff --git a/src/plugins/maps_ems/common/ems_defaults.ts b/src/plugins/maps_ems/common/ems_defaults.ts index 6d99f2041484c..a494386b100b7 100644 --- a/src/plugins/maps_ems/common/ems_defaults.ts +++ b/src/plugins/maps_ems/common/ems_defaults.ts @@ -9,6 +9,10 @@ // Default config for the elastic hosted EMS endpoints export const DEFAULT_EMS_FILE_API_URL = 'https://vector.maps.elastic.co'; export const DEFAULT_EMS_TILE_API_URL = 'https://tiles.maps.elastic.co'; -export const DEFAULT_EMS_LANDING_PAGE_URL = 'https://maps.elastic.co/v7.12'; +export const DEFAULT_EMS_LANDING_PAGE_URL = 'https://maps.elastic.co/v7.13'; export const DEFAULT_EMS_FONT_LIBRARY_URL = 'https://tiles.maps.elastic.co/fonts/{fontstack}/{range}.pbf'; + +export const DEFAULT_EMS_ROADMAP_ID = 'road_map'; +export const DEFAULT_EMS_ROADMAP_DESATURATED_ID = 'road_map_desaturated'; +export const DEFAULT_EMS_DARKMAP_ID = 'dark_map'; diff --git a/src/plugins/maps_ems/config.ts b/src/plugins/maps_ems/config.ts index e74a8f5cec29c..1deff36a10e45 100644 --- a/src/plugins/maps_ems/config.ts +++ b/src/plugins/maps_ems/config.ts @@ -13,6 +13,9 @@ import { DEFAULT_EMS_LANDING_PAGE_URL, DEFAULT_EMS_TILE_API_URL, DEFAULT_EMS_FILE_API_URL, + DEFAULT_EMS_ROADMAP_ID, + DEFAULT_EMS_ROADMAP_DESATURATED_ID, + DEFAULT_EMS_DARKMAP_ID, } from './common'; const tileMapConfigOptionsSchema = schema.object({ @@ -77,9 +80,9 @@ export const emsConfigSchema = schema.object({ defaultValue: DEFAULT_EMS_FONT_LIBRARY_URL, }), emsTileLayerId: schema.object({ - bright: schema.string({ defaultValue: 'road_map' }), - desaturated: schema.string({ defaultValue: 'road_map_desaturated' }), - dark: schema.string({ defaultValue: 'dark_map' }), + bright: schema.string({ defaultValue: DEFAULT_EMS_ROADMAP_ID }), + desaturated: schema.string({ defaultValue: DEFAULT_EMS_ROADMAP_DESATURATED_ID }), + dark: schema.string({ defaultValue: DEFAULT_EMS_DARKMAP_ID }), }), }); diff --git a/src/plugins/telemetry/schema/oss_plugins.json b/src/plugins/telemetry/schema/oss_plugins.json index af2c7330c6a4d..842496815c15c 100644 --- a/src/plugins/telemetry/schema/oss_plugins.json +++ b/src/plugins/telemetry/schema/oss_plugins.json @@ -3954,6 +3954,137 @@ } } }, + "osquery": { + "properties": { + "appId": { + "type": "keyword", + "_meta": { + "description": "The application being tracked" + } + }, + "viewId": { + "type": "keyword", + "_meta": { + "description": "Always `main`" + } + }, + "clicks_total": { + "type": "long", + "_meta": { + "description": "General number of clicks in the application since we started counting them" + } + }, + "clicks_7_days": { + "type": "long", + "_meta": { + "description": "General number of clicks in the application over the last 7 days" + } + }, + "clicks_30_days": { + "type": "long", + "_meta": { + "description": "General number of clicks in the application over the last 30 days" + } + }, + "clicks_90_days": { + "type": "long", + "_meta": { + "description": "General number of clicks in the application over the last 90 days" + } + }, + "minutes_on_screen_total": { + "type": "float", + "_meta": { + "description": "Minutes the application is active and on-screen since we started counting them." + } + }, + "minutes_on_screen_7_days": { + "type": "float", + "_meta": { + "description": "Minutes the application is active and on-screen over the last 7 days" + } + }, + "minutes_on_screen_30_days": { + "type": "float", + "_meta": { + "description": "Minutes the application is active and on-screen over the last 30 days" + } + }, + "minutes_on_screen_90_days": { + "type": "float", + "_meta": { + "description": "Minutes the application is active and on-screen over the last 90 days" + } + }, + "views": { + "type": "array", + "items": { + "properties": { + "appId": { + "type": "keyword", + "_meta": { + "description": "The application being tracked" + } + }, + "viewId": { + "type": "keyword", + "_meta": { + "description": "The application view being tracked" + } + }, + "clicks_total": { + "type": "long", + "_meta": { + "description": "General number of clicks in the application sub view since we started counting them" + } + }, + "clicks_7_days": { + "type": "long", + "_meta": { + "description": "General number of clicks in the active application sub view over the last 7 days" + } + }, + "clicks_30_days": { + "type": "long", + "_meta": { + "description": "General number of clicks in the active application sub view over the last 30 days" + } + }, + "clicks_90_days": { + "type": "long", + "_meta": { + "description": "General number of clicks in the active application sub view over the last 90 days" + } + }, + "minutes_on_screen_total": { + "type": "float", + "_meta": { + "description": "Minutes the application sub view is active and on-screen since we started counting them." + } + }, + "minutes_on_screen_7_days": { + "type": "float", + "_meta": { + "description": "Minutes the application is active and on-screen active application sub view over the last 7 days" + } + }, + "minutes_on_screen_30_days": { + "type": "float", + "_meta": { + "description": "Minutes the application is active and on-screen active application sub view over the last 30 days" + } + }, + "minutes_on_screen_90_days": { + "type": "float", + "_meta": { + "description": "Minutes the application is active and on-screen active application sub view over the last 90 days" + } + } + } + } + } + } + }, "security_account": { "properties": { "appId": { @@ -8200,12 +8331,6 @@ "description": "Non-default value of setting." } }, - "observability:enableAlertingExperience": { - "type": "boolean", - "_meta": { - "description": "Non-default value of setting." - } - }, "labs:presentation:unifiedToolbar": { "type": "boolean", "_meta": { diff --git a/src/plugins/telemetry/schema/oss_root.json b/src/plugins/telemetry/schema/oss_root.json index 658f5ee4e66da..c4dd1096a6e98 100644 --- a/src/plugins/telemetry/schema/oss_root.json +++ b/src/plugins/telemetry/schema/oss_root.json @@ -183,8 +183,8 @@ }, "plugins": { "properties": { - "THIS_WILL_BE_REPLACED_BY_THE_PLUGINS_JSON": { - "type": "text" + "kibana_config_usage": { + "type": "pass_through" } } } diff --git a/src/plugins/usage_collection/server/config.ts b/src/plugins/usage_collection/server/config.ts index cd6f6b9d81396..faf8ce7535e8a 100644 --- a/src/plugins/usage_collection/server/config.ts +++ b/src/plugins/usage_collection/server/config.ts @@ -38,4 +38,9 @@ export const config: PluginConfigDescriptor = { exposeToBrowser: { uiCounters: true, }, + exposeToUsage: { + usageCounters: { + bufferDuration: true, + }, + }, }; diff --git a/src/plugins/usage_collection/server/usage_counters/usage_counters_service.test.ts b/src/plugins/usage_collection/server/usage_counters/usage_counters_service.test.ts index c800bce6390c9..8a76368c8cd9d 100644 --- a/src/plugins/usage_collection/server/usage_counters/usage_counters_service.test.ts +++ b/src/plugins/usage_collection/server/usage_counters/usage_counters_service.test.ts @@ -187,10 +187,13 @@ describe('UsageCountersService', () => { await tick(); // number of incrementCounter calls + number of retries expect(mockIncrementCounter).toBeCalledTimes(2 + 1); - expect(logger.debug).toHaveBeenNthCalledWith(1, 'Store counters into savedObjects', [ - mockError, - 'pass', - ]); + expect(logger.debug).toHaveBeenNthCalledWith(1, 'Store counters into savedObjects', { + kibana: { + usageCounters: { + results: [mockError, 'pass'], + }, + }, + }); }); it('buffers counters within `bufferDurationMs` time', async () => { diff --git a/src/plugins/usage_collection/server/usage_counters/usage_counters_service.ts b/src/plugins/usage_collection/server/usage_counters/usage_counters_service.ts index 88ca9f6358926..a698ea3db5bad 100644 --- a/src/plugins/usage_collection/server/usage_counters/usage_counters_service.ts +++ b/src/plugins/usage_collection/server/usage_counters/usage_counters_service.ts @@ -13,7 +13,7 @@ import { SavedObjectsServiceSetup, SavedObjectsServiceStart, } from 'src/core/server'; -import type { Logger } from 'src/core/server'; +import type { Logger, LogMeta } from 'src/core/server'; import moment from 'moment'; import { CounterMetric, UsageCounter } from './usage_counter'; @@ -23,6 +23,10 @@ import { serializeCounterKey, } from './saved_objects'; +interface UsageCountersLogMeta extends LogMeta { + kibana: { usageCounters: { results: unknown[] } }; +} + export interface UsageCountersServiceDeps { logger: Logger; retryCount: number; @@ -116,7 +120,11 @@ export class UsageCountersService { rxOp.concatMap((counters) => this.storeDate$(counters, internalRepository)) ) .subscribe((results) => { - this.logger.debug('Store counters into savedObjects', results); + this.logger.debug('Store counters into savedObjects', { + kibana: { + usageCounters: { results }, + }, + }); }); this.flushCache$.next(); diff --git a/src/plugins/vis_default_editor/public/components/controls/raw_json.tsx b/src/plugins/vis_default_editor/public/components/controls/raw_json.tsx index 8deec8ba66546..af6096be87f59 100644 --- a/src/plugins/vis_default_editor/public/components/controls/raw_json.tsx +++ b/src/plugins/vis_default_editor/public/components/controls/raw_json.tsx @@ -8,13 +8,13 @@ import React, { useState, useMemo, useCallback } from 'react'; -import { EuiFormRow, EuiIconTip, EuiCodeEditor, EuiScreenReaderOnly } from '@elastic/eui'; +import { EuiFormRow, EuiIconTip, EuiScreenReaderOnly } from '@elastic/eui'; import { i18n } from '@kbn/i18n'; +import { XJsonLang } from '@kbn/monaco'; +import { CodeEditor } from '../../../../kibana_react/public'; import { AggParamEditorProps } from '../agg_param_props'; -import 'brace/theme/github'; - function RawJsonParamEditor({ showValidation, value = '', @@ -23,7 +23,6 @@ function RawJsonParamEditor({ setTouched, }: AggParamEditorProps) { const [isFieldValid, setFieldValidity] = useState(true); - const [editorReady, setEditorReady] = useState(false); const editorTooltipText = useMemo( () => @@ -52,18 +51,22 @@ function RawJsonParamEditor({ [jsonEditorLabelText, editorTooltipText] ); - const onEditorValidate = useCallback( - (annotations: unknown[]) => { - // The first onValidate returned from EuiCodeEditor is a false negative - if (editorReady) { - const validity = annotations.length === 0; - setFieldValidity(validity); - setValidity(validity); - } else { - setEditorReady(true); + const onChange = useCallback( + (newValue: string) => { + setValue(newValue); + // validation for value + let isJsonValid = true; + try { + if (newValue) { + JSON.parse(newValue); + } + } catch (e) { + isJsonValid = false; } + setFieldValidity(isJsonValid); + setValidity(isJsonValid); }, - [setValidity, editorReady] + [setValidity, setFieldValidity, setValue] ); return ( @@ -72,22 +75,38 @@ function RawJsonParamEditor({ isInvalid={showValidation ? !isFieldValid : false} fullWidth={true} display="rowCompressed" + onBlur={setTouched} > <> -

{editorTooltipText}

diff --git a/src/plugins/vis_type_table/public/components/table_visualization.scss b/src/plugins/vis_type_table/public/components/table_visualization.scss index 28dbf17b18739..21c235adf6db2 100644 --- a/src/plugins/vis_type_table/public/components/table_visualization.scss +++ b/src/plugins/vis_type_table/public/components/table_visualization.scss @@ -12,6 +12,15 @@ overflow: auto; @include euiScrollBar; + + // Sticky footer doesn't correct work with inline-flex in Firefox. + // As footer the last element I don't see any reason to use inline-flex for this element. + // Display: flex fixes jumping on hover in Firefox. + // Created issue on EUI (https://github.com/elastic/eui/issues/4729). + // Once addressed, we can remove this local fix. + .euiDataGrid--stickyFooter .euiDataGridFooter { + display: flex; + } } .tbvChart__split { diff --git a/src/plugins/vis_type_timelion/common/types.ts b/src/plugins/vis_type_timelion/common/types.ts index f3f2a74a711a9..8ce4bd8b45f0d 100644 --- a/src/plugins/vis_type_timelion/common/types.ts +++ b/src/plugins/vis_type_timelion/common/types.ts @@ -16,6 +16,7 @@ export interface TimelionFunctionArgsSuggestion { export interface TimelionFunctionArgs { name: string; help?: string; + insertText?: string; multi?: boolean; types: TimelionFunctionArgsTypes[]; suggestions?: TimelionFunctionArgsSuggestion[]; diff --git a/src/plugins/vis_type_timelion/public/components/timelion_expression_input_helpers.ts b/src/plugins/vis_type_timelion/public/components/timelion_expression_input_helpers.ts index 7c24eaa5902b4..6c3cd8058627a 100644 --- a/src/plugins/vis_type_timelion/public/components/timelion_expression_input_helpers.ts +++ b/src/plugins/vis_type_timelion/public/components/timelion_expression_input_helpers.ts @@ -244,10 +244,9 @@ export function getSuggestion( break; case SUGGESTION_TYPE.ARGUMENT_VALUE: - const param = suggestion.name.split(':'); - - if (param.length === 1 || param[1]) { - insertText = `${param.length === 1 ? insertText : param[1]},`; + const defaultText = (suggestion as TimelionFunctionArgs).insertText; + if (defaultText) { + insertText = `${defaultText},`; } command = { diff --git a/src/plugins/vis_type_timelion/public/helpers/arg_value_suggestions.ts b/src/plugins/vis_type_timelion/public/helpers/arg_value_suggestions.ts index 0a989858706df..d8ec46eba004f 100644 --- a/src/plugins/vis_type_timelion/public/helpers/arg_value_suggestions.ts +++ b/src/plugins/vis_type_timelion/public/helpers/arg_value_suggestions.ts @@ -51,6 +51,7 @@ export function getArgValueSuggestions() { return (await indexPatterns.find(search, size)).map(({ title }) => ({ name: title, + insertText: title, })); }, async metric(partial: string, functionArgs: TimelionExpressionFunction[]) { @@ -81,7 +82,14 @@ export function getArgValueSuggestions() { containsFieldName(valueSplit[1], field) && !indexPatternsUtils.isNestedField(field) ) - .map((field) => ({ name: `${valueSplit[0]}:${field.name}`, help: field.type })); + .map((field) => { + const suggestionValue = field.name.replaceAll(':', '\\:'); + return { + name: `${valueSplit[0]}:${suggestionValue}`, + help: field.type, + insertText: suggestionValue, + }; + }); }, async split(partial: string, functionArgs: TimelionExpressionFunction[]) { const indexPattern = await getIndexPattern(functionArgs); @@ -105,7 +113,7 @@ export function getArgValueSuggestions() { containsFieldName(partial, field) && !indexPatternsUtils.isNestedField(field) ) - .map((field) => ({ name: field.name, help: field.type })); + .map((field) => ({ name: field.name, help: field.type, insertText: field.name })); }, async timefield(partial: string, functionArgs: TimelionExpressionFunction[]) { const indexPattern = await getIndexPattern(functionArgs); @@ -121,7 +129,7 @@ export function getArgValueSuggestions() { containsFieldName(partial, field) && !indexPatternsUtils.isNestedField(field) ) - .map((field) => ({ name: field.name })); + .map((field) => ({ name: field.name, insertText: field.name })); }, }, }; diff --git a/src/plugins/vis_type_timelion/server/series_functions/es/es.test.js b/src/plugins/vis_type_timelion/server/series_functions/es/es.test.js index 566001ce44182..3ace745604660 100644 --- a/src/plugins/vis_type_timelion/server/series_functions/es/es.test.js +++ b/src/plugins/vis_type_timelion/server/series_functions/es/es.test.js @@ -123,13 +123,35 @@ describe('es', () => { const emptyScriptedFields = []; test('adds a metric agg for each metric', () => { - config.metric = ['sum:beer', 'avg:bytes', 'percentiles:bytes']; + config.metric = [ + 'sum:beer', + 'avg:bytes', + 'percentiles:bytes', + 'cardinality:\\:sample', + 'sum:\\:beer', + 'percentiles:\\:\\:bytes:1.2,1.3,2.7', + 'percentiles:\\:bytes\\:123:20.0,50.0,100.0', + 'percentiles:a:2', + ]; agg = createDateAgg(config, tlConfig, emptyScriptedFields); expect(agg.time_buckets.aggs['sum(beer)']).toEqual({ sum: { field: 'beer' } }); expect(agg.time_buckets.aggs['avg(bytes)']).toEqual({ avg: { field: 'bytes' } }); expect(agg.time_buckets.aggs['percentiles(bytes)']).toEqual({ percentiles: { field: 'bytes' }, }); + expect(agg.time_buckets.aggs['cardinality(:sample)']).toEqual({ + cardinality: { field: ':sample' }, + }); + expect(agg.time_buckets.aggs['sum(:beer)']).toEqual({ sum: { field: ':beer' } }); + expect(agg.time_buckets.aggs['percentiles(::bytes)']).toEqual({ + percentiles: { field: '::bytes', percents: [1.2, 1.3, 2.7] }, + }); + expect(agg.time_buckets.aggs['percentiles(:bytes:123)']).toEqual({ + percentiles: { field: ':bytes:123', percents: [20.0, 50.0, 100.0] }, + }); + expect(agg.time_buckets.aggs['percentiles(a)']).toEqual({ + percentiles: { field: 'a', percents: [2] }, + }); }); test('adds a scripted metric agg for each scripted metric', () => { @@ -158,6 +180,13 @@ describe('es', () => { expect(typeof agg.time_buckets.aggs.count.bucket_script).toBe('object'); expect(agg.time_buckets.aggs.count.bucket_script.buckets_path).toEqual('_count'); }); + + test('has a special `count` metric with redundant field which use a script', () => { + config.metric = ['count:beer']; + agg = createDateAgg(config, tlConfig, emptyScriptedFields); + expect(typeof agg.time_buckets.aggs.count.bucket_script).toBe('object'); + expect(agg.time_buckets.aggs.count.bucket_script.buckets_path).toEqual('_count'); + }); }); }); @@ -305,10 +334,10 @@ describe('es', () => { describe('config.split', () => { test('adds terms aggs, in order, under the filters agg', () => { - config.split = ['beer:5', 'wine:10']; + config.split = ['beer:5', 'wine:10', ':lemo:nade::15', ':jui:ce:723::45']; const request = fn(config, tlConfig, emptyScriptedFields); - const aggs = request.params.body.aggs.q.aggs; + let aggs = request.params.body.aggs.q.aggs; expect(aggs.beer.meta.type).toEqual('split'); expect(aggs.beer.terms.field).toEqual('beer'); @@ -317,6 +346,18 @@ describe('es', () => { expect(aggs.beer.aggs.wine.meta.type).toEqual('split'); expect(aggs.beer.aggs.wine.terms.field).toEqual('wine'); expect(aggs.beer.aggs.wine.terms.size).toEqual(10); + + aggs = aggs.beer.aggs.wine.aggs; + expect(aggs).toHaveProperty(':lemo:nade:'); + expect(aggs[':lemo:nade:'].meta.type).toEqual('split'); + expect(aggs[':lemo:nade:'].terms.field).toEqual(':lemo:nade:'); + expect(aggs[':lemo:nade:'].terms.size).toEqual(15); + + aggs = aggs[':lemo:nade:'].aggs; + expect(aggs).toHaveProperty(':jui:ce:723:'); + expect(aggs[':jui:ce:723:'].meta.type).toEqual('split'); + expect(aggs[':jui:ce:723:'].terms.field).toEqual(':jui:ce:723:'); + expect(aggs[':jui:ce:723:'].terms.size).toEqual(45); }); test('adds scripted terms aggs, in order, under the filters agg', () => { diff --git a/src/plugins/vis_type_timelion/server/series_functions/es/lib/build_request.js b/src/plugins/vis_type_timelion/server/series_functions/es/lib/build_request.js index a4aa4f73547e4..a30b197e46067 100644 --- a/src/plugins/vis_type_timelion/server/series_functions/es/lib/build_request.js +++ b/src/plugins/vis_type_timelion/server/series_functions/es/lib/build_request.js @@ -48,17 +48,17 @@ export default function buildRequest(config, tlConfig, scriptedFields, timeout) let aggCursor = aggs.q.aggs; - _.each(config.split, function (clause) { - clause = clause.split(':'); - if (clause[0] && clause[1]) { - const termsAgg = buildAggBody(clause[0], scriptedFields); - termsAgg.size = parseInt(clause[1], 10); - aggCursor[clause[0]] = { + (config.split || []).forEach((clause) => { + const [field, arg] = clause.split(/:(\d+$)/); + if (field && arg) { + const termsAgg = buildAggBody(field, scriptedFields); + termsAgg.size = parseInt(arg, 10); + aggCursor[field] = { meta: { type: 'split' }, terms: termsAgg, aggs: {}, }; - aggCursor = aggCursor[clause[0]].aggs; + aggCursor = aggCursor[field].aggs; } else { throw new Error('`split` requires field:limit'); } diff --git a/src/plugins/vis_type_timelion/server/series_functions/es/lib/create_date_agg.js b/src/plugins/vis_type_timelion/server/series_functions/es/lib/create_date_agg.js index 09ae4d8ef3467..55538fbff4e79 100644 --- a/src/plugins/vis_type_timelion/server/series_functions/es/lib/create_date_agg.js +++ b/src/plugins/vis_type_timelion/server/series_functions/es/lib/create_date_agg.js @@ -6,9 +6,9 @@ * Side Public License, v 1. */ -import _ from 'lodash'; import { buildAggBody } from './agg_body'; -import { search } from '../../../../../../plugins/data/server'; +import { search, METRIC_TYPES } from '../../../../../data/server'; + const { dateHistogramInterval } = search.aggs; export default function createDateAgg(config, tlConfig, scriptedFields) { @@ -29,29 +29,39 @@ export default function createDateAgg(config, tlConfig, scriptedFields) { }; dateAgg.time_buckets.aggs = {}; - _.each(config.metric, function (metric) { - metric = metric.split(':'); - if (metric[0] === 'count') { + (config.metric || []).forEach((metric) => { + const metricBody = {}; + const [metricName, metricArgs] = metric.split(/:(.+)/); + if (metricName === METRIC_TYPES.COUNT) { // This is pretty lame, but its how the "doc_count" metric has to be implemented at the moment // It simplifies the aggregation tree walking code considerably - dateAgg.time_buckets.aggs[metric] = { + metricBody[metricName] = { bucket_script: { buckets_path: '_count', script: { source: '_value', lang: 'expression' }, }, }; - } else if (metric[0] && metric[1]) { - const metricName = metric[0] + '(' + metric[1] + ')'; - dateAgg.time_buckets.aggs[metricName] = {}; - dateAgg.time_buckets.aggs[metricName][metric[0]] = buildAggBody(metric[1], scriptedFields); - if (metric[0] === 'percentiles' && metric[2]) { - let percentList = metric[2].split(','); + } else if (metricName && metricArgs) { + const splittedArgs = metricArgs.split(/(.*[^\\]):/).filter(Boolean); + const field = splittedArgs[0].replace(/\\:/g, ':'); + const percentArgs = splittedArgs[1]; + const metricKey = metricName + '(' + field + ')'; + + metricBody[metricKey] = { [metricName]: buildAggBody(field, scriptedFields) }; + + if (metricName === METRIC_TYPES.PERCENTILES && percentArgs) { + let percentList = percentArgs.split(','); percentList = percentList.map((x) => parseFloat(x)); - dateAgg.time_buckets.aggs[metricName][metric[0]].percents = percentList; + metricBody[metricKey][metricName].percents = percentList; } } else { throw new Error('`metric` requires metric:field or simply count'); } + + dateAgg.time_buckets.aggs = { + ...dateAgg.time_buckets.aggs, + ...metricBody, + }; }); return dateAgg; diff --git a/src/plugins/vis_type_timeseries/public/application/components/index_pattern.js b/src/plugins/vis_type_timeseries/public/application/components/index_pattern.js index e7a34c6e6596d..c5b3d86f61b5d 100644 --- a/src/plugins/vis_type_timeseries/public/application/components/index_pattern.js +++ b/src/plugins/vis_type_timeseries/public/application/components/index_pattern.js @@ -18,7 +18,6 @@ import { EuiComboBox, EuiRange, EuiIconTip, - EuiText, EuiFormLabel, } from '@elastic/eui'; import { FieldSelect } from './aggs/field_select'; @@ -126,6 +125,9 @@ export const IndexPattern = ({ ({ value }) => model[TIME_RANGE_MODE_KEY] === value ); const isTimeSeries = model.type === PANEL_TYPES.TIMESERIES; + const isDataTimerangeModeInvalid = + selectedTimeRangeOption && + !isTimerangeModeEnabled(selectedTimeRangeOption.value, uiRestrictions); useEffect(() => { updateControlValidity(intervalName, intervalValidation.isValid); @@ -143,13 +145,38 @@ export const IndexPattern = ({ + {' '} + + } + type="questionInCircle" + /> + + } + isInvalid={isDataTimerangeModeInvalid} + error={i18n.translate('visTypeTimeseries.indexPattern.timeRange.error', { + defaultMessage: 'You cannot use "{mode}" with the current index type.', + values: { + mode: selectedTimeRangeOption?.label, + }, })} > - - {i18n.translate('visTypeTimeseries.indexPattern.timeRange.hint', { - defaultMessage: `This setting controls the timespan used for matching documents. - "Entire timerange" will match all the documents selected in the timepicker. - "Last value" will match only the documents for the specified interval from the end of the timerange.`, - })} - )} diff --git a/src/plugins/vis_type_timeseries/server/lib/search_strategies/strategies/rollup_search_strategy.ts b/src/plugins/vis_type_timeseries/server/lib/search_strategies/strategies/rollup_search_strategy.ts index ec6f2a7c21af6..0ac00863d0a73 100644 --- a/src/plugins/vis_type_timeseries/server/lib/search_strategies/strategies/rollup_search_strategy.ts +++ b/src/plugins/vis_type_timeseries/server/lib/search_strategies/strategies/rollup_search_strategy.ts @@ -58,8 +58,8 @@ export class RollupSearchStrategy extends AbstractSearchStrategy { if ( indexPatternString && - !isIndexPatternContainsWildcard(indexPatternString) && - (!indexPattern || indexPattern.type === 'rollup') + ((!indexPattern && !isIndexPatternContainsWildcard(indexPatternString)) || + indexPattern?.type === 'rollup') ) { const rollupData = await this.getRollupData(requestContext, indexPatternString); const rollupIndices = getRollupIndices(rollupData); diff --git a/src/plugins/vis_type_timeseries/server/lib/vis_data/get_series_data.ts b/src/plugins/vis_type_timeseries/server/lib/vis_data/get_series_data.ts index 6d165d3343eaa..1d910dab5a786 100644 --- a/src/plugins/vis_type_timeseries/server/lib/vis_data/get_series_data.ts +++ b/src/plugins/vis_type_timeseries/server/lib/vis_data/get_series_data.ts @@ -105,5 +105,6 @@ export async function getSeriesData( ...handleErrorResponse(panel)(err), }; } + return meta; } } diff --git a/src/plugins/vis_type_timeseries/server/lib/vis_data/get_table_data.ts b/src/plugins/vis_type_timeseries/server/lib/vis_data/get_table_data.ts index 00d23ee45e6da..075e90762f151 100644 --- a/src/plugins/vis_type_timeseries/server/lib/vis_data/get_table_data.ts +++ b/src/plugins/vis_type_timeseries/server/lib/vis_data/get_table_data.ts @@ -115,5 +115,6 @@ export async function getTableData( ...handleErrorResponse(panel)(err), }; } + return meta; } } diff --git a/src/setup_node_env/ensure_node_preserve_symlinks.js b/src/setup_node_env/ensure_node_preserve_symlinks.js index 826244c4829fc..3899564203622 100644 --- a/src/setup_node_env/ensure_node_preserve_symlinks.js +++ b/src/setup_node_env/ensure_node_preserve_symlinks.js @@ -99,6 +99,13 @@ return 0; }; + // Since we are using `stdio: inherit`, the child process will receive + // the `SIGINT` and `SIGTERM` from the terminal. + // However, we want the parent process not to exit until the child does. + // Adding the following handlers achieves that. + process.on('SIGINT', function () {}); + process.on('SIGTERM', function () {}); + var spawnResult = cp.spawnSync(nodeArgv[0], nodeArgs.concat(restArgs), { stdio: 'inherit' }); process.exit(getExitCodeFromSpawnResult(spawnResult)); })(); diff --git a/test/accessibility/apps/discover.ts b/test/accessibility/apps/discover.ts index a46a27a5bdf9c..67abe15ea537a 100644 --- a/test/accessibility/apps/discover.ts +++ b/test/accessibility/apps/discover.ts @@ -23,6 +23,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { await esArchiver.loadIfNeeded('logstash_functional'); await kibanaServer.uiSettings.update({ defaultIndex: 'logstash-*', + 'doc_table:legacy': true, }); await PageObjects.common.navigateToApp('discover'); await PageObjects.timePicker.setDefaultAbsoluteRange(); diff --git a/test/api_integration/apis/search/bsearch.ts b/test/api_integration/apis/search/bsearch.ts index 89fe606857c1c..d0322624778ae 100644 --- a/test/api_integration/apis/search/bsearch.ts +++ b/test/api_integration/apis/search/bsearch.ts @@ -116,7 +116,7 @@ export default function ({ getService }: FtrProviderContext) { }); }); - it('should return 400 when index type is provided in OSS', async () => { + it('should return 400 when index type is provided in "es" strategy', async () => { const resp = await supertest.post(`/internal/bsearch`).send({ batch: [ { @@ -130,6 +130,9 @@ export default function ({ getService }: FtrProviderContext) { }, }, }, + options: { + strategy: 'es', + }, }, ], }); @@ -151,11 +154,14 @@ export default function ({ getService }: FtrProviderContext) { after(async () => { await esArchiver.unload('../../../functional/fixtures/es_archiver/logstash_functional'); }); - it('should return 400 for Painless error', async () => { + it('should return 400 "search_phase_execution_exception" for Painless error in "es" strategy', async () => { const resp = await supertest.post(`/internal/bsearch`).send({ batch: [ { request: painlessErrReq, + options: { + strategy: 'es', + }, }, ], }); diff --git a/test/api_integration/apis/telemetry/telemetry_local.ts b/test/api_integration/apis/telemetry/telemetry_local.ts index 9b92576c84b3a..c14fc658f2768 100644 --- a/test/api_integration/apis/telemetry/telemetry_local.ts +++ b/test/api_integration/apis/telemetry/telemetry_local.ts @@ -8,6 +8,7 @@ import expect from '@kbn/expect'; import supertestAsPromised from 'supertest-as-promised'; +import { omit } from 'lodash'; import { basicUiCounters } from './__fixtures__/ui_counters'; import { basicUsageCounters } from './__fixtures__/usage_counters'; import type { FtrProviderContext } from '../../ftr_provider_context'; @@ -86,6 +87,35 @@ export default function ({ getService }: FtrProviderContext) { expect(stats.stack_stats.kibana.plugins.csp.strict).to.be(true); expect(stats.stack_stats.kibana.plugins.csp.warnLegacyBrowsers).to.be(true); expect(stats.stack_stats.kibana.plugins.csp.rulesChangedFromDefault).to.be(false); + expect(stats.stack_stats.kibana.plugins.kibana_config_usage).to.be.an('object'); + // non-default kibana configs. Configs set at 'test/api_integration/config.js'. + expect(omit(stats.stack_stats.kibana.plugins.kibana_config_usage, 'server.port')).to.eql({ + 'elasticsearch.username': '[redacted]', + 'elasticsearch.password': '[redacted]', + 'elasticsearch.hosts': '[redacted]', + 'elasticsearch.healthCheck.delay': 3600000, + 'plugins.paths': '[redacted]', + 'logging.json': false, + 'server.xsrf.disableProtection': true, + 'server.compression.referrerWhitelist': '[redacted]', + 'server.maxPayload': 1679958, + 'status.allowAnonymous': true, + 'home.disableWelcomeScreen': true, + 'data.search.aggs.shardDelay.enabled': true, + 'security.showInsecureClusterWarning': false, + 'telemetry.banner': false, + 'telemetry.url': '[redacted]', + 'telemetry.optInStatusUrl': '[redacted]', + 'telemetry.optIn': false, + 'newsfeed.service.urlRoot': '[redacted]', + 'newsfeed.service.pathTemplate': '[redacted]', + 'savedObjects.maxImportPayloadBytes': 10485760, + 'savedObjects.maxImportExportSize': 10001, + 'usageCollection.usageCounters.bufferDuration': 0, + }); + expect(stats.stack_stats.kibana.plugins.kibana_config_usage['server.port']).to.be.a( + 'number' + ); // Testing stack_stats.data expect(stats.stack_stats.data).to.be.an('object'); diff --git a/test/api_integration/apis/telemetry/utils/schema_to_config_schema.ts b/test/api_integration/apis/telemetry/utils/schema_to_config_schema.ts index b45930682e3aa..ec44cec39c29a 100644 --- a/test/api_integration/apis/telemetry/utils/schema_to_config_schema.ts +++ b/test/api_integration/apis/telemetry/utils/schema_to_config_schema.ts @@ -8,8 +8,8 @@ import type { ObjectType, Type } from '@kbn/config-schema'; import { schema } from '@kbn/config-schema'; -import { get } from 'lodash'; import { set } from '@elastic/safer-lodash-set'; +import { get, merge } from 'lodash'; import type { AllowedSchemaTypes } from 'src/plugins/usage_collection/server'; /** @@ -125,11 +125,19 @@ export function assertTelemetryPayload( stats: unknown ): void { const fullSchema = telemetrySchema.root; + + const mergedPluginsSchema = merge( + {}, + get(fullSchema, 'properties.stack_stats.properties.kibana.properties.plugins'), + telemetrySchema.plugins + ); + set( fullSchema, 'properties.stack_stats.properties.kibana.properties.plugins', - telemetrySchema.plugins + mergedPluginsSchema ); + const ossTelemetryValidationSchema = convertSchemaToConfigSchema(fullSchema); // Run @kbn/config-schema validation to the entire payload diff --git a/test/common/config.js b/test/common/config.js index 84848347f94cd..b44f2de5042eb 100644 --- a/test/common/config.js +++ b/test/common/config.js @@ -21,7 +21,7 @@ export default function () { servers, esTestCluster: { - serverArgs: ['xpack.security.enabled=false'], + serverArgs: ['xpack.security.enabled=false', 'geoip.downloader.enabled=false'], }, kbnTestServer: { diff --git a/test/examples/embeddables/dashboard.ts b/test/examples/embeddables/dashboard.ts index 7db49d9dfbfcb..70e5ba115c3af 100644 --- a/test/examples/embeddables/dashboard.ts +++ b/test/examples/embeddables/dashboard.ts @@ -117,7 +117,7 @@ export default function ({ getService, getPageObjects }: PluginFunctionalProvide }); it('saved search', async () => { - await dashboardExpect.savedSearchRowCount(50); + await dashboardExpect.savedSearchRowCount(11); }); }); diff --git a/test/functional/apps/context/_context_navigation.js b/test/functional/apps/context/_context_navigation.js index 56415f38f92fd..7f72d44c50ea0 100644 --- a/test/functional/apps/context/_context_navigation.js +++ b/test/functional/apps/context/_context_navigation.js @@ -19,10 +19,12 @@ export default function ({ getService, getPageObjects }) { const browser = getService('browser'); const docTable = getService('docTable'); const PageObjects = getPageObjects(['common', 'context', 'discover', 'timePicker']); + const kibanaServer = getService('kibanaServer'); describe('discover - context - back navigation', function contextSize() { before(async function () { await PageObjects.timePicker.setDefaultAbsoluteRangeViaUiSettings(); + await kibanaServer.uiSettings.update({ 'doc_table:legacy': true }); await PageObjects.common.navigateToApp('discover'); for (const [columnName, value] of TEST_FILTER_COLUMN_NAMES) { await PageObjects.discover.clickFieldListItem(columnName); @@ -30,6 +32,10 @@ export default function ({ getService, getPageObjects }) { } }); + after(async function () { + await kibanaServer.uiSettings.replace({}); + }); + it('should go back after loading', async function () { await retry.waitFor('user navigating to context and returning to discover', async () => { // navigate to the context view diff --git a/test/functional/apps/context/_discover_navigation.js b/test/functional/apps/context/_discover_navigation.js index 572ee3dedf35a..dc5d56271c7fd 100644 --- a/test/functional/apps/context/_discover_navigation.js +++ b/test/functional/apps/context/_discover_navigation.js @@ -30,10 +30,12 @@ export default function ({ getService, getPageObjects }) { const testSubjects = getService('testSubjects'); const dashboardAddPanel = getService('dashboardAddPanel'); const browser = getService('browser'); + const kibanaServer = getService('kibanaServer'); describe('context link in discover', () => { before(async () => { await PageObjects.timePicker.setDefaultAbsoluteRangeViaUiSettings(); + await kibanaServer.uiSettings.update({ 'doc_table:legacy': true }); await PageObjects.common.navigateToApp('discover'); for (const columnName of TEST_COLUMN_NAMES) { @@ -46,7 +48,7 @@ export default function ({ getService, getPageObjects }) { } }); after(async () => { - await PageObjects.timePicker.resetDefaultAbsoluteRangeViaUiSettings(); + await kibanaServer.uiSettings.replace({}); }); it('should open the context view with the selected document as anchor', async () => { diff --git a/test/functional/apps/dashboard/dashboard_filter_bar.ts b/test/functional/apps/dashboard/dashboard_filter_bar.ts index cb2b4a1792a47..ad7e4be9b1935 100644 --- a/test/functional/apps/dashboard/dashboard_filter_bar.ts +++ b/test/functional/apps/dashboard/dashboard_filter_bar.ts @@ -11,6 +11,7 @@ import expect from '@kbn/expect'; import { FtrProviderContext } from '../../ftr_provider_context'; export default function ({ getService, getPageObjects }: FtrProviderContext) { + const dataGrid = getService('dataGrid'); const dashboardExpect = getService('dashboardExpect'); const dashboardAddPanel = getService('dashboardAddPanel'); const testSubjects = getService('testSubjects'); @@ -173,8 +174,13 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { it('are added when a cell magnifying glass is clicked', async function () { await dashboardAddPanel.addSavedSearch('Rendering-Test:-saved-search'); await PageObjects.dashboard.waitForRenderComplete(); - await testSubjects.click('docTableCellFilter'); - + const documentCell = await dataGrid.getCellElement(1, 3); + await documentCell.click(); + const expandCellContentButton = await documentCell.findByClassName( + 'euiDataGridRowCell__expandButtonIcon' + ); + await expandCellContentButton.click(); + await testSubjects.click('filterForButton'); const filterCount = await filterBar.getFilterCount(); expect(filterCount).to.equal(1); }); diff --git a/test/functional/apps/dashboard/dashboard_time_picker.ts b/test/functional/apps/dashboard/dashboard_time_picker.ts index ef03320438582..eb7c05079fb44 100644 --- a/test/functional/apps/dashboard/dashboard_time_picker.ts +++ b/test/functional/apps/dashboard/dashboard_time_picker.ts @@ -12,13 +12,13 @@ import { PIE_CHART_VIS_NAME } from '../../page_objects/dashboard_page'; import { FtrProviderContext } from '../../ftr_provider_context'; export default function ({ getService, getPageObjects }: FtrProviderContext) { - const dashboardExpect = getService('dashboardExpect'); const pieChart = getService('pieChart'); const dashboardVisualizations = getService('dashboardVisualizations'); const PageObjects = getPageObjects(['dashboard', 'header', 'visualize', 'timePicker']); const browser = getService('browser'); const log = getService('log'); const kibanaServer = getService('kibanaServer'); + const dataGrid = getService('dataGrid'); describe('dashboard time picker', function describeIndexTests() { before(async function () { @@ -49,14 +49,16 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { name: 'saved search', fields: ['bytes', 'agent'], }); - await dashboardExpect.docTableFieldCount(150); + const initialRows = await dataGrid.getDocTableRows(); + expect(initialRows.length).to.be(11); // Set to time range with no data await PageObjects.timePicker.setAbsoluteRange( 'Jan 1, 2000 @ 00:00:00.000', 'Jan 1, 2000 @ 01:00:00.000' ); - await dashboardExpect.docTableFieldCount(0); + const noResults = await dataGrid.hasNoResults(); + expect(noResults).to.be.ok(); }); it('Timepicker start, end, interval values are set by url', async () => { diff --git a/test/functional/apps/dashboard/embeddable_rendering.ts b/test/functional/apps/dashboard/embeddable_rendering.ts index 2a9551786de6e..11807831dc352 100644 --- a/test/functional/apps/dashboard/embeddable_rendering.ts +++ b/test/functional/apps/dashboard/embeddable_rendering.ts @@ -64,7 +64,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { // TODO add test for 'scripted filter and query' viz // TODO add test for 'animal weight linked to search' viz // TODO add test for the last vega viz - await dashboardExpect.savedSearchRowCount(50); + await dashboardExpect.savedSearchRowCount(11); }; const expectNoDataRenders = async () => { diff --git a/test/functional/apps/dashboard/saved_search_embeddable.ts b/test/functional/apps/dashboard/saved_search_embeddable.ts index 71f19b23da9dd..bea5c7d749162 100644 --- a/test/functional/apps/dashboard/saved_search_embeddable.ts +++ b/test/functional/apps/dashboard/saved_search_embeddable.ts @@ -45,7 +45,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { const marks = $('mark') .toArray() .map((mark) => $(mark).text()); - expect(marks.length).to.be(50); + expect(marks.length).to.be(11); }); it('removing a filter removes highlights', async function () { diff --git a/test/functional/apps/discover/_data_grid.ts b/test/functional/apps/discover/_data_grid.ts index a8b05c0d90288..366865b53fb0d 100644 --- a/test/functional/apps/discover/_data_grid.ts +++ b/test/functional/apps/discover/_data_grid.ts @@ -23,7 +23,8 @@ export default function ({ const testSubjects = getService('testSubjects'); before(async function () { - await esArchiver.load('discover'); + await kibanaServer.savedObjects.clean({ types: ['search', 'index-pattern'] }); + await kibanaServer.importExport.load('discover'); await esArchiver.loadIfNeeded('logstash_functional'); await kibanaServer.uiSettings.replace(defaultSettings); await PageObjects.common.navigateToApp('discover'); diff --git a/test/functional/apps/discover/_data_grid_context.ts b/test/functional/apps/discover/_data_grid_context.ts index bc259c71b47b4..275ac011820be 100644 --- a/test/functional/apps/discover/_data_grid_context.ts +++ b/test/functional/apps/discover/_data_grid_context.ts @@ -34,10 +34,10 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { const dashboardAddPanel = getService('dashboardAddPanel'); const browser = getService('browser'); - // FLAKY: https://github.com/elastic/kibana/issues/94545 - describe.skip('discover data grid context tests', () => { + describe('discover data grid context tests', () => { before(async () => { - await esArchiver.load('discover'); + await kibanaServer.savedObjects.clean({ types: ['search', 'index-pattern'] }); + await kibanaServer.importExport.load('discover'); await esArchiver.loadIfNeeded('logstash_functional'); await PageObjects.timePicker.setDefaultAbsoluteRangeViaUiSettings(); await kibanaServer.uiSettings.update(defaultSettings); @@ -110,7 +110,10 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { await alert?.accept(); expect(await browser.getCurrentUrl()).to.contain('#/context'); await PageObjects.header.waitUntilLoadingHasFinished(); - expect(await docTable.getBodyRows()).to.have.length(6); + await retry.waitFor('document table has a length of 6', async () => { + const nrOfDocs = (await docTable.getBodyRows()).length; + return nrOfDocs === 6; + }); }); }); } diff --git a/test/functional/apps/discover/_data_grid_doc_table.ts b/test/functional/apps/discover/_data_grid_doc_table.ts index 5499f0250eb73..feecc7f535519 100644 --- a/test/functional/apps/discover/_data_grid_doc_table.ts +++ b/test/functional/apps/discover/_data_grid_doc_table.ts @@ -22,11 +22,13 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { defaultIndex: 'logstash-*', 'doc_table:legacy': false, }; + const testSubjects = getService('testSubjects'); describe('discover data grid doc table', function describeIndexTests() { before(async function () { log.debug('load kibana index with default index pattern'); - await esArchiver.load('discover'); + await kibanaServer.savedObjects.clean({ types: ['search', 'index-pattern'] }); + await kibanaServer.importExport.load('discover'); await esArchiver.loadIfNeeded('logstash_functional'); await kibanaServer.uiSettings.replace(defaultSettings); await PageObjects.timePicker.setDefaultAbsoluteRangeViaUiSettings(); @@ -102,6 +104,31 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { await dataGrid.closeFlyout(); }); }); + + it('should show allow adding columns from the detail panel', async function () { + await retry.try(async function () { + await dataGrid.clickRowToggle({ isAnchorRow: false, rowIndex: rowToInspect - 1 }); + + // add columns + const fields = ['_id', '_index', 'agent']; + for (const field of fields) { + await testSubjects.click(`toggleColumnButton_${field}`); + } + + const headerWithFields = await dataGrid.getHeaderFields(); + expect(headerWithFields.join(' ')).to.contain(fields.join(' ')); + + // remove columns + for (const field of fields) { + await testSubjects.click(`toggleColumnButton_${field}`); + } + + const headerWithoutFields = await dataGrid.getHeaderFields(); + expect(headerWithoutFields.join(' ')).not.to.contain(fields.join(' ')); + + await dataGrid.closeFlyout(); + }); + }); }); describe('add and remove columns', function () { diff --git a/test/functional/apps/discover/_data_grid_field_data.ts b/test/functional/apps/discover/_data_grid_field_data.ts index f41a98e2f3364..5d73192c1608c 100644 --- a/test/functional/apps/discover/_data_grid_field_data.ts +++ b/test/functional/apps/discover/_data_grid_field_data.ts @@ -22,7 +22,8 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { describe('discover data grid field data tests', function describeIndexTests() { this.tags('includeFirefox'); before(async function () { - await esArchiver.load('discover'); + await kibanaServer.savedObjects.clean({ types: ['search', 'index-pattern'] }); + await kibanaServer.importExport.load('discover'); await esArchiver.loadIfNeeded('logstash_functional'); await PageObjects.timePicker.setDefaultAbsoluteRangeViaUiSettings(); await kibanaServer.uiSettings.update(defaultSettings); @@ -41,9 +42,11 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { it('the search term should be highlighted in the field data', async function () { // marks is the style that highlights the text in yellow + await PageObjects.discover.clickFieldListItemAdd('extension'); const marks = await PageObjects.discover.getMarks(); - expect(marks.length).to.be(50); + expect(marks.length).to.be.greaterThan(0); expect(marks.indexOf('php')).to.be(0); + await PageObjects.discover.clickFieldListItemRemove('extension'); }); it('search type:apache should show the correct hit count', async function () { diff --git a/test/functional/apps/discover/_date_nanos_mixed.ts b/test/functional/apps/discover/_date_nanos_mixed.ts index 35439ef1e8eb0..47c3a19c06986 100644 --- a/test/functional/apps/discover/_date_nanos_mixed.ts +++ b/test/functional/apps/discover/_date_nanos_mixed.ts @@ -33,14 +33,14 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { }); it('shows a list of records of indices with date & date_nanos fields in the right order', async function () { - const rowData1 = await PageObjects.discover.getDocTableIndex(1); - expect(rowData1.startsWith('Jan 1, 2019 @ 12:10:30.124000000')).to.be.ok(); - const rowData2 = await PageObjects.discover.getDocTableIndex(3); - expect(rowData2.startsWith('Jan 1, 2019 @ 12:10:30.123498765')).to.be.ok(); - const rowData3 = await PageObjects.discover.getDocTableIndex(5); - expect(rowData3.startsWith('Jan 1, 2019 @ 12:10:30.123456789')).to.be.ok(); - const rowData4 = await PageObjects.discover.getDocTableIndex(7); - expect(rowData4.startsWith('Jan 1, 2019 @ 12:10:30.123000000')).to.be.ok(); + const rowData1 = await PageObjects.discover.getDocTableField(1); + expect(rowData1).to.be('Jan 1, 2019 @ 12:10:30.124000000'); + const rowData2 = await PageObjects.discover.getDocTableField(2); + expect(rowData2).to.be('Jan 1, 2019 @ 12:10:30.123498765'); + const rowData3 = await PageObjects.discover.getDocTableField(3); + expect(rowData3).to.be('Jan 1, 2019 @ 12:10:30.123456789'); + const rowData4 = await PageObjects.discover.getDocTableField(4); + expect(rowData4).to.be('Jan 1, 2019 @ 12:10:30.123000000'); }); }); } diff --git a/test/functional/apps/discover/_discover.ts b/test/functional/apps/discover/_discover.ts index 0c12f32f6e717..7bdc3490a959f 100644 --- a/test/functional/apps/discover/_discover.ts +++ b/test/functional/apps/discover/_discover.ts @@ -11,7 +11,6 @@ import expect from '@kbn/expect'; import { FtrProviderContext } from '../../ftr_provider_context'; export default function ({ getService, getPageObjects }: FtrProviderContext) { - const savedObjectInfo = getService('savedObjectInfo'); const browser = getService('browser'); const log = getService('log'); const retry = getService('retry'); @@ -30,11 +29,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { before(async function () { log.debug('load kibana index with default index pattern'); - await kibanaServer.savedObjects.clean({ types: ['search'] }); await kibanaServer.importExport.load('discover'); - log.info( - `\n### SAVED OBJECT TYPES IN index: [.kibana]: \n\t${await savedObjectInfo.types()}` - ); // and load a set of makelogs data await esArchiver.loadIfNeeded('logstash_functional'); @@ -52,7 +47,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { expect(time.end).to.be(PageObjects.timePicker.defaultEndTime); const rowData = await PageObjects.discover.getDocTableIndex(1); log.debug('check the newest doc timestamp in UTC (check diff timezone in last test)'); - expect(rowData.startsWith('Sep 22, 2015 @ 23:50:13.253')).to.be.ok(); + expect(rowData).to.contain('Sep 22, 2015 @ 23:50:13.253'); }); it('save query should show toast message and display query name', async function () { @@ -99,11 +94,15 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { const time = await PageObjects.timePicker.getTimeConfig(); expect(time.start).to.be('Sep 21, 2015 @ 09:00:00.000'); expect(time.end).to.be('Sep 21, 2015 @ 12:00:00.000'); - await retry.waitFor('doc table to contain the right search result', async () => { - const rowData = await PageObjects.discover.getDocTableField(1); - log.debug(`The first timestamp value in doc table: ${rowData}`); - return rowData.includes('Sep 21, 2015 @ 11:59:22.316'); - }); + await retry.waitForWithTimeout( + 'doc table to contain the right search result', + 1000, + async () => { + const rowData = await PageObjects.discover.getDocTableField(1); + log.debug(`The first timestamp value in doc table: ${rowData}`); + return rowData.includes('Sep 21, 2015 @ 11:59:22.316'); + } + ); }); it('should modify the time range when the histogram is brushed', async function () { @@ -304,7 +303,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { await PageObjects.timePicker.setDefaultAbsoluteRangeViaUiSettings(); await PageObjects.common.navigateToApp('discover'); await PageObjects.discover.clickFieldListItemAdd('_score'); - await PageObjects.discover.clickFieldSort('_score'); + await PageObjects.discover.clickFieldSort('_score', 'Sort Low-High'); const currentUrlWithScore = await browser.getCurrentUrl(); expect(currentUrlWithScore).to.contain('_score'); await PageObjects.discover.clickFieldListItemAdd('_score'); @@ -315,7 +314,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { await PageObjects.timePicker.setDefaultAbsoluteRangeViaUiSettings(); await PageObjects.common.navigateToApp('discover'); await PageObjects.discover.clickFieldListItemAdd('referer'); - await PageObjects.discover.clickFieldSort('referer'); + await PageObjects.discover.clickFieldSort('referer', 'Sort A-Z'); expect(await PageObjects.discover.getDocHeader()).to.have.string('Referer custom'); expect(await PageObjects.discover.getAllFieldNames()).to.contain('Referer custom'); const url = await browser.getCurrentUrl(); diff --git a/test/functional/apps/discover/_discover_fields_api.ts b/test/functional/apps/discover/_discover_fields_api.ts index 8ee8aabbfbbe0..0a6029a9f10e8 100644 --- a/test/functional/apps/discover/_discover_fields_api.ts +++ b/test/functional/apps/discover/_discover_fields_api.ts @@ -22,7 +22,8 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { describe('discover uses fields API test', function describeIndexTests() { before(async function () { log.debug('load kibana index with default index pattern'); - await esArchiver.load('discover'); + await kibanaServer.savedObjects.clean({ types: ['search', 'index-pattern'] }); + await kibanaServer.importExport.load('discover'); await esArchiver.loadIfNeeded('logstash_functional'); await kibanaServer.uiSettings.replace(defaultSettings); log.debug('discover'); diff --git a/test/functional/apps/discover/_doc_navigation.ts b/test/functional/apps/discover/_doc_navigation.ts index e783d159cb261..90d3c4eca423a 100644 --- a/test/functional/apps/discover/_doc_navigation.ts +++ b/test/functional/apps/discover/_doc_navigation.ts @@ -17,12 +17,23 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { const PageObjects = getPageObjects(['common', 'discover', 'timePicker', 'context']); const esArchiver = getService('esArchiver'); const retry = getService('retry'); + const kibanaServer = getService('kibanaServer'); describe('doc link in discover', function contextSize() { - beforeEach(async function () { + before(async () => { await esArchiver.loadIfNeeded('logstash_functional'); await esArchiver.loadIfNeeded('discover'); await PageObjects.timePicker.setDefaultAbsoluteRangeViaUiSettings(); + await kibanaServer.uiSettings.update({ + 'doc_table:legacy': true, + 'discover:searchFieldsFromSource': true, + }); + }); + after(async () => { + await kibanaServer.uiSettings.replace({}); + }); + + beforeEach(async function () { await PageObjects.common.navigateToApp('discover'); await PageObjects.discover.waitForDocTableLoadingComplete(); }); diff --git a/test/functional/apps/discover/_doc_table.ts b/test/functional/apps/discover/_doc_table.ts index edcb002000183..7cb33e6a7c2b8 100644 --- a/test/functional/apps/discover/_doc_table.ts +++ b/test/functional/apps/discover/_doc_table.ts @@ -16,18 +16,20 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { const kibanaServer = getService('kibanaServer'); const docTable = getService('docTable'); const queryBar = getService('queryBar'); + const find = getService('find'); const PageObjects = getPageObjects(['common', 'discover', 'header', 'timePicker']); const defaultSettings = { defaultIndex: 'logstash-*', }; + const testSubjects = getService('testSubjects'); describe('discover doc table', function describeIndexTests() { - const defaultRowsLimit = 50; const rowsHardLimit = 500; before(async function () { log.debug('load kibana index with default index pattern'); - await esArchiver.load('discover'); + await kibanaServer.savedObjects.clean({ types: ['search', 'index-pattern'] }); + await kibanaServer.importExport.load('discover'); // and load a set of makelogs data await esArchiver.loadIfNeeded('logstash_functional'); @@ -37,10 +39,10 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { await PageObjects.common.navigateToApp('discover'); }); - it('should show the first 50 rows by default', async function () { + it('should show records by default', async function () { // with the default range the number of hits is ~14000 const rows = await PageObjects.discover.getDocTableRows(); - expect(rows.length).to.be(defaultRowsLimit); + expect(rows.length).to.be.greaterThan(0); }); it('should refresh the table content when changing time window', async function () { @@ -57,113 +59,130 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { await PageObjects.timePicker.setDefaultAbsoluteRange(); }); - it(`should load up to ${rowsHardLimit} rows when scrolling at the end of the table`, async function () { - const initialRows = await PageObjects.discover.getDocTableRows(); - // click the Skip to the end of the table - await PageObjects.discover.skipToEndOfDocTable(); - // now count the rows - const finalRows = await PageObjects.discover.getDocTableRows(); - expect(finalRows.length).to.be.above(initialRows.length); - expect(finalRows.length).to.be(rowsHardLimit); - await PageObjects.discover.backToTop(); - }); - - it('should go the end of the table when using the accessible Skip button', async function () { - // click the Skip to the end of the table - await PageObjects.discover.skipToEndOfDocTable(); - // now check the footer text content - const footer = await PageObjects.discover.getDocTableFooter(); - log.debug(await footer.getVisibleText()); - expect(await footer.getVisibleText()).to.have.string(rowsHardLimit); - await PageObjects.discover.backToTop(); - }); + describe('legacy', async function () { + before(async () => { + await kibanaServer.uiSettings.update({ 'doc_table:legacy': true }); + await PageObjects.common.navigateToApp('discover'); + await PageObjects.discover.waitUntilSearchingHasFinished(); + }); + after(async () => { + await kibanaServer.uiSettings.replace({}); + }); + it(`should load up to ${rowsHardLimit} rows when scrolling at the end of the table`, async function () { + const initialRows = await testSubjects.findAll('docTableRow'); + // click the Skip to the end of the table + await PageObjects.discover.skipToEndOfDocTable(); + // now count the rows + const finalRows = await testSubjects.findAll('docTableRow'); + expect(finalRows.length).to.be.above(initialRows.length); + expect(finalRows.length).to.be(rowsHardLimit); + await PageObjects.discover.backToTop(); + }); - describe('expand a document row', function () { - const rowToInspect = 1; - beforeEach(async function () { - // close the toggle if open - const details = await docTable.getDetailsRows(); - if (details.length) { - await docTable.clickRowToggle({ isAnchorRow: false, rowIndex: rowToInspect - 1 }); - } + it('should go the end of the table when using the accessible Skip button', async function () { + // click the Skip to the end of the table + await PageObjects.discover.skipToEndOfDocTable(); + // now check the footer text content + const footer = await PageObjects.discover.getDocTableFooter(); + log.debug(await footer.getVisibleText()); + expect(await footer.getVisibleText()).to.have.string(rowsHardLimit); + await PageObjects.discover.backToTop(); }); - it('should expand the detail row when the toggle arrow is clicked', async function () { - await retry.try(async function () { - await docTable.clickRowToggle({ isAnchorRow: false, rowIndex: rowToInspect - 1 }); - const detailsEl = await docTable.getDetailsRows(); - const defaultMessageEl = await detailsEl[0].findByTestSubject('docTableRowDetailsTitle'); - expect(defaultMessageEl).to.be.ok(); + describe('expand a document row', function () { + const rowToInspect = 1; + beforeEach(async function () { + // close the toggle if open + const details = await docTable.getDetailsRows(); + if (details.length) { + await docTable.clickRowToggle({ isAnchorRow: false, rowIndex: rowToInspect - 1 }); + } }); - }); - it('should show the detail panel actions', async function () { - await retry.try(async function () { - await docTable.clickRowToggle({ isAnchorRow: false, rowIndex: rowToInspect - 1 }); - // const detailsEl = await PageObjects.discover.getDocTableRowDetails(rowToInspect); - const [surroundingActionEl, singleActionEl] = await docTable.getRowActions({ - isAnchorRow: false, - rowIndex: rowToInspect - 1, + it('should expand the detail row when the toggle arrow is clicked', async function () { + await retry.try(async function () { + await docTable.clickRowToggle({ isAnchorRow: false, rowIndex: rowToInspect - 1 }); + const detailsEl = await docTable.getDetailsRows(); + const defaultMessageEl = await detailsEl[0].findByTestSubject( + 'docTableRowDetailsTitle' + ); + expect(defaultMessageEl).to.be.ok(); + }); + }); + + it('should show the detail panel actions', async function () { + await retry.try(async function () { + await docTable.clickRowToggle({ isAnchorRow: false, rowIndex: rowToInspect - 1 }); + // const detailsEl = await PageObjects.discover.getDocTableRowDetails(rowToInspect); + const [surroundingActionEl, singleActionEl] = await docTable.getRowActions({ + isAnchorRow: false, + rowIndex: rowToInspect - 1, + }); + expect(surroundingActionEl).to.be.ok(); + expect(singleActionEl).to.be.ok(); + // TODO: test something more meaninful here? }); - expect(surroundingActionEl).to.be.ok(); - expect(singleActionEl).to.be.ok(); - // TODO: test something more meaninful here? }); - }); - it('should not close the detail panel actions when data is re-requested', async function () { - await retry.try(async function () { - const nrOfFetches = await PageObjects.discover.getNrOfFetches(); - await docTable.clickRowToggle({ isAnchorRow: false, rowIndex: rowToInspect - 1 }); - const detailsEl = await docTable.getDetailsRows(); - const defaultMessageEl = await detailsEl[0].findByTestSubject('docTableRowDetailsTitle'); - expect(defaultMessageEl).to.be.ok(); - await queryBar.submitQuery(); - const nrOfFetchesResubmit = await PageObjects.discover.getNrOfFetches(); - expect(nrOfFetchesResubmit).to.be.above(nrOfFetches); - const defaultMessageElResubmit = await detailsEl[0].findByTestSubject( - 'docTableRowDetailsTitle' - ); - - expect(defaultMessageElResubmit).to.be.ok(); + it('should not close the detail panel actions when data is re-requested', async function () { + await retry.try(async function () { + const nrOfFetches = await PageObjects.discover.getNrOfFetches(); + await docTable.clickRowToggle({ isAnchorRow: false, rowIndex: rowToInspect - 1 }); + const detailsEl = await docTable.getDetailsRows(); + const defaultMessageEl = await detailsEl[0].findByTestSubject( + 'docTableRowDetailsTitle' + ); + expect(defaultMessageEl).to.be.ok(); + await queryBar.submitQuery(); + const nrOfFetchesResubmit = await PageObjects.discover.getNrOfFetches(); + expect(nrOfFetchesResubmit).to.be.above(nrOfFetches); + const defaultMessageElResubmit = await detailsEl[0].findByTestSubject( + 'docTableRowDetailsTitle' + ); + + expect(defaultMessageElResubmit).to.be.ok(); + }); }); }); - }); - describe('add and remove columns', function () { - const extraColumns = ['phpmemory', 'ip']; + describe('add and remove columns', function () { + const extraColumns = ['phpmemory', 'ip']; - afterEach(async function () { - for (const column of extraColumns) { - await PageObjects.discover.clickFieldListItemRemove(column); - await PageObjects.header.waitUntilLoadingHasFinished(); - } - }); + afterEach(async function () { + for (const column of extraColumns) { + await PageObjects.discover.clickFieldListItemRemove(column); + await PageObjects.header.waitUntilLoadingHasFinished(); + } + }); - it('should add more columns to the table', async function () { - for (const column of extraColumns) { - await PageObjects.discover.clearFieldSearchInput(); - await PageObjects.discover.findFieldByName(column); - await PageObjects.discover.clickFieldListItemAdd(column); - await PageObjects.header.waitUntilLoadingHasFinished(); - // test the header now - expect(await PageObjects.discover.getDocHeader()).to.have.string(column); - } - }); + it('should add more columns to the table', async function () { + for (const column of extraColumns) { + await PageObjects.discover.clearFieldSearchInput(); + await PageObjects.discover.findFieldByName(column); + await PageObjects.discover.clickFieldListItemAdd(column); + await PageObjects.header.waitUntilLoadingHasFinished(); + // test the header now + const docHeader = await find.byCssSelector('thead > tr:nth-child(1)'); + const docHeaderText = await docHeader.getVisibleText(); + expect(docHeaderText).to.have.string(column); + } + }); - it('should remove columns from the table', async function () { - for (const column of extraColumns) { - await PageObjects.discover.clearFieldSearchInput(); - await PageObjects.discover.findFieldByName(column); - log.debug(`add a ${column} column`); - await PageObjects.discover.clickFieldListItemAdd(column); + it('should remove columns from the table', async function () { + for (const column of extraColumns) { + await PageObjects.discover.clearFieldSearchInput(); + await PageObjects.discover.findFieldByName(column); + log.debug(`add a ${column} column`); + await PageObjects.discover.clickFieldListItemAdd(column); + await PageObjects.header.waitUntilLoadingHasFinished(); + } + // remove the second column + await PageObjects.discover.clickFieldListItemAdd(extraColumns[1]); await PageObjects.header.waitUntilLoadingHasFinished(); - } - // remove the second column - await PageObjects.discover.clickFieldListItemAdd(extraColumns[1]); - await PageObjects.header.waitUntilLoadingHasFinished(); - // test that the second column is no longer there - expect(await PageObjects.discover.getDocHeader()).to.not.have.string(extraColumns[1]); + // test that the second column is no longer there + const docHeader = await find.byCssSelector('thead > tr:nth-child(1)'); + expect(await docHeader.getVisibleText()).to.not.have.string(extraColumns[1]); + }); }); }); }); diff --git a/test/functional/apps/discover/_errors.ts b/test/functional/apps/discover/_errors.ts index fefa8665b0a57..8b8877016b103 100644 --- a/test/functional/apps/discover/_errors.ts +++ b/test/functional/apps/discover/_errors.ts @@ -23,7 +23,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { }); after(async function () { - await esArchiver.unload('invalid_scripted_field'); + await esArchiver.load('empty_kibana'); }); describe('invalid scripted field error', () => { diff --git a/test/functional/apps/discover/_field_data.ts b/test/functional/apps/discover/_field_data.ts index 3583a8b12c415..265c39678ce9d 100644 --- a/test/functional/apps/discover/_field_data.ts +++ b/test/functional/apps/discover/_field_data.ts @@ -18,12 +18,14 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { const queryBar = getService('queryBar'); const browser = getService('browser'); const PageObjects = getPageObjects(['common', 'header', 'discover', 'visualize', 'timePicker']); + const find = getService('find'); describe('discover tab', function describeIndexTests() { this.tags('includeFirefox'); before(async function () { + await kibanaServer.savedObjects.clean({ types: ['search', 'index-pattern'] }); + await kibanaServer.importExport.load('discover'); await esArchiver.loadIfNeeded('logstash_functional'); - await esArchiver.load('discover'); await kibanaServer.uiSettings.replace({ defaultIndex: 'logstash-*', 'discover:searchFieldsFromSource': true, @@ -44,9 +46,13 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { it('the search term should be highlighted in the field data', async function () { // marks is the style that highlights the text in yellow + await queryBar.setQuery('php'); + await queryBar.submitQuery(); + await PageObjects.discover.clickFieldListItemAdd('extension'); const marks = await PageObjects.discover.getMarks(); - expect(marks.length).to.be(50); + expect(marks.length).to.be.greaterThan(0); expect(marks.indexOf('php')).to.be(0); + await PageObjects.discover.clickFieldListItemRemove('extension'); }); it('search type:apache should show the correct hit count', async function () { @@ -59,27 +65,6 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { }); }); - it('doc view should show Time and _source columns', async function () { - const expectedHeader = 'Time _source'; - const Docheader = await PageObjects.discover.getDocHeader(); - expect(Docheader).to.be(expectedHeader); - }); - - it('doc view should sort ascending', async function () { - const expectedTimeStamp = 'Sep 20, 2015 @ 00:00:00.000'; - await PageObjects.discover.clickDocSortDown(); - - // we don't technically need this sleep here because the tryForTime will retry and the - // results will match on the 2nd or 3rd attempt, but that debug output is huge in this - // case and it can be avoided with just a few seconds sleep. - await PageObjects.common.sleep(2000); - await retry.try(async function tryingForTime() { - const rowData = await PageObjects.discover.getDocTableIndex(1); - - expect(rowData.startsWith(expectedTimeStamp)).to.be.ok(); - }); - }); - it('a bad syntax query should show an error message', async function () { const expectedError = 'Expected ":", "<", "<=", ">", ">=", AND, OR, end of input, ' + @@ -102,15 +87,47 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { { useActualUrl: true } ); await retry.try(async function tryingForTime() { - expect(await PageObjects.discover.getDocHeader()).to.be('Time relatedContent'); + expect(await PageObjects.discover.getDocHeader()).to.contain('relatedContent'); }); - const field = await PageObjects.discover.getDocTableField(1, 1); + const field = await PageObjects.discover.getDocTableField(1, 3); expect(field).to.include.string('"og:description":'); const marks = await PageObjects.discover.getMarks(); expect(marks.length).to.be(0); }); + + describe('legacy table tests', async function () { + before(async function () { + await kibanaServer.uiSettings.update({ 'doc_table:legacy': true }); + await PageObjects.common.navigateToApp('discover'); + }); + + after(async function () { + await kibanaServer.uiSettings.replace({}); + }); + it('doc view should show Time and _source columns', async function () { + const expectedHeader = 'Time _source'; + const docHeader = await find.byCssSelector('thead > tr:nth-child(1)'); + const docHeaderText = await docHeader.getVisibleText(); + expect(docHeaderText).to.be(expectedHeader); + }); + + it('doc view should sort ascending', async function () { + const expectedTimeStamp = 'Sep 20, 2015 @ 00:00:00.000'; + await find.clickByCssSelector('.fa-sort-down'); + + // we don't technically need this sleep here because the tryForTime will retry and the + // results will match on the 2nd or 3rd attempt, but that debug output is huge in this + // case and it can be avoided with just a few seconds sleep. + await PageObjects.common.sleep(2000); + await retry.try(async function tryingForTime() { + const row = await find.byCssSelector(`tr.kbnDocTable__row:nth-child(1)`); + const rowData = await row.getVisibleText(); + expect(rowData.startsWith(expectedTimeStamp)).to.be.ok(); + }); + }); + }); }); }); } diff --git a/test/functional/apps/discover/_field_data_with_fields_api.ts b/test/functional/apps/discover/_field_data_with_fields_api.ts index 168f718c38602..92d36a243370b 100644 --- a/test/functional/apps/discover/_field_data_with_fields_api.ts +++ b/test/functional/apps/discover/_field_data_with_fields_api.ts @@ -18,12 +18,14 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { const queryBar = getService('queryBar'); const browser = getService('browser'); const PageObjects = getPageObjects(['common', 'header', 'discover', 'visualize', 'timePicker']); + const find = getService('find'); describe('discover tab with new fields API', function describeIndexTests() { this.tags('includeFirefox'); before(async function () { + await kibanaServer.savedObjects.clean({ types: ['search', 'index-pattern'] }); + await kibanaServer.importExport.load('discover'); await esArchiver.loadIfNeeded('logstash_functional'); - await esArchiver.load('discover'); await kibanaServer.uiSettings.replace({ defaultIndex: 'logstash-*', 'discover:searchFieldsFromSource': false, @@ -44,9 +46,11 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { it('the search term should be highlighted in the field data', async function () { // marks is the style that highlights the text in yellow + await PageObjects.discover.clickFieldListItemAdd('extension'); const marks = await PageObjects.discover.getMarks(); - expect(marks.length).to.be(100); + expect(marks.length).to.be.greaterThan(0); expect(marks.indexOf('php')).to.be(0); + await PageObjects.discover.clickFieldListItemRemove('extension'); }); it('search type:apache should show the correct hit count', async function () { @@ -60,24 +64,9 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { }); it('doc view should show Time and Document columns', async function () { - const expectedHeader = 'Time Document'; const Docheader = await PageObjects.discover.getDocHeader(); - expect(Docheader).to.be(expectedHeader); - }); - - it('doc view should sort ascending', async function () { - const expectedTimeStamp = 'Sep 20, 2015 @ 00:00:00.000'; - await PageObjects.discover.clickDocSortDown(); - - // we don't technically need this sleep here because the tryForTime will retry and the - // results will match on the 2nd or 3rd attempt, but that debug output is huge in this - // case and it can be avoided with just a few seconds sleep. - await PageObjects.common.sleep(2000); - await retry.try(async function tryingForTime() { - const rowData = await PageObjects.discover.getDocTableIndex(1); - - expect(rowData.startsWith(expectedTimeStamp)).to.be.ok(); - }); + expect(Docheader).to.contain('Time'); + expect(Docheader).to.contain('Document'); }); it('a bad syntax query should show an error message', async function () { @@ -102,15 +91,42 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { { useActualUrl: true } ); await retry.try(async function tryingForTime() { - expect(await PageObjects.discover.getDocHeader()).to.be('Time relatedContent'); + expect(await PageObjects.discover.getDocHeader()).to.contain('relatedContent'); }); - const field = await PageObjects.discover.getDocTableField(1, 1); - expect(field).to.include.string('relatedContent.url:'); + const field = await PageObjects.discover.getDocTableField(1, 3); + expect(field).to.include.string('relatedContent.url'); const marks = await PageObjects.discover.getMarks(); - expect(marks.length).to.be(172); - expect(marks.indexOf('election')).to.be(0); + expect(marks.length).to.be.above(0); + expect(marks).to.contain('election'); + }); + + describe('legacy table tests', async function () { + before(async function () { + await kibanaServer.uiSettings.update({ 'doc_table:legacy': true }); + await PageObjects.common.navigateToApp('discover'); + }); + + after(async function () { + await kibanaServer.uiSettings.replace({}); + }); + + it('doc view should sort ascending', async function () { + const expectedTimeStamp = 'Sep 20, 2015 @ 00:00:00.000'; + await find.clickByCssSelector('.fa-sort-down'); + + // we don't technically need this sleep here because the tryForTime will retry and the + // results will match on the 2nd or 3rd attempt, but that debug output is huge in this + // case and it can be avoided with just a few seconds sleep. + await PageObjects.common.sleep(2000); + await retry.try(async function tryingForTime() { + const row = await find.byCssSelector(`tr.kbnDocTable__row:nth-child(1)`); + const rowData = await row.getVisibleText(); + + expect(rowData.startsWith(expectedTimeStamp)).to.be.ok(); + }); + }); }); }); }); diff --git a/test/functional/apps/discover/_filter_editor.ts b/test/functional/apps/discover/_filter_editor.ts index 903059fc54020..b94ba3cda4044 100644 --- a/test/functional/apps/discover/_filter_editor.ts +++ b/test/functional/apps/discover/_filter_editor.ts @@ -24,7 +24,8 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { describe('discover filter editor', function describeIndexTests() { before(async function () { log.debug('load kibana index with default index pattern'); - await esArchiver.loadIfNeeded('discover'); + await kibanaServer.savedObjects.clean({ types: ['search', 'index-pattern'] }); + await kibanaServer.importExport.load('discover'); // and load a set of makelogs data await esArchiver.loadIfNeeded('logstash_functional'); diff --git a/test/functional/apps/discover/_inspector.ts b/test/functional/apps/discover/_inspector.ts index 8516e202e2d53..ca8539df9a926 100644 --- a/test/functional/apps/discover/_inspector.ts +++ b/test/functional/apps/discover/_inspector.ts @@ -32,8 +32,10 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { describe('inspect', () => { before(async () => { + await kibanaServer.savedObjects.clean({ types: ['search', 'index-pattern'] }); + + await kibanaServer.importExport.load('discover'); await esArchiver.loadIfNeeded('logstash_functional'); - await esArchiver.load('discover'); // delete .kibana index and update configDoc await kibanaServer.uiSettings.replace({ defaultIndex: 'logstash-*', diff --git a/test/functional/apps/discover/_large_string.ts b/test/functional/apps/discover/_large_string.ts index 3f9a5ab264c7a..9383f8fdc8c77 100644 --- a/test/functional/apps/discover/_large_string.ts +++ b/test/functional/apps/discover/_large_string.ts @@ -22,14 +22,15 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { describe('test large strings', function () { before(async function () { await security.testUser.setRoles(['kibana_admin', 'kibana_large_strings']); - await esArchiver.load('empty_kibana'); + + await kibanaServer.importExport.load('testlargestring'); await esArchiver.loadIfNeeded('hamlet'); await kibanaServer.uiSettings.replace({ defaultIndex: 'testlargestring' }); }); it('verify the large string book present', async function () { const ExpectedDoc = - 'mybook:Project Gutenberg EBook of Hamlet, by William Shakespeare' + + 'mybookProject Gutenberg EBook of Hamlet, by William Shakespeare' + ' This eBook is for the use of anyone anywhere in the United States' + ' and most other parts of the world at no cost and with almost no restrictions whatsoever.' + ' You may copy it, give it away or re-use it under the terms of the' + @@ -73,6 +74,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { after(async () => { await security.testUser.restoreDefaults(); await esArchiver.unload('hamlet'); + await kibanaServer.savedObjects.clean({ types: ['search', 'index-pattern'] }); }); }); } diff --git a/test/functional/apps/discover/_runtime_fields_editor.ts b/test/functional/apps/discover/_runtime_fields_editor.ts index 7df697a2e7a3a..ea95e0adff617 100644 --- a/test/functional/apps/discover/_runtime_fields_editor.ts +++ b/test/functional/apps/discover/_runtime_fields_editor.ts @@ -12,7 +12,7 @@ import { FtrProviderContext } from './ftr_provider_context'; export default function ({ getService, getPageObjects }: FtrProviderContext) { const log = getService('log'); const retry = getService('retry'); - const docTable = getService('docTable'); + const dataGrid = getService('dataGrid'); const testSubjects = getService('testSubjects'); const kibanaServer = getService('kibanaServer'); const esArchiver = getService('esArchiver'); @@ -32,7 +32,8 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { await fieldEditor.save(); }; - describe('discover integration with runtime fields editor', function describeIndexTests() { + // FLAKY: https://github.com/elastic/kibana/issues/97864 + describe.skip('discover integration with runtime fields editor', function describeIndexTests() { before(async function () { await esArchiver.load('discover'); await esArchiver.loadIfNeeded('logstash_functional'); @@ -103,15 +104,15 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { it('doc view includes runtime fields', async function () { // navigate to doc view - await docTable.clickRowToggle({ rowIndex: 0 }); + await dataGrid.clickRowToggle(); // click the open action await retry.try(async () => { - const rowActions = await docTable.getRowActions({ rowIndex: 0 }); + const rowActions = await dataGrid.getRowActions({ rowIndex: 0 }); if (!rowActions.length) { throw new Error('row actions empty, trying again'); } - await rowActions[1].click(); + await rowActions[0].click(); }); const hasDocHit = await testSubjects.exists('doc-hit'); diff --git a/test/functional/apps/discover/_saved_queries.ts b/test/functional/apps/discover/_saved_queries.ts index a7374c8128630..acf78802fa18f 100644 --- a/test/functional/apps/discover/_saved_queries.ts +++ b/test/functional/apps/discover/_saved_queries.ts @@ -29,7 +29,8 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { describe('saved queries saved objects', function describeIndexTests() { before(async function () { log.debug('load kibana index with default index pattern'); - await esArchiver.load('discover'); + await kibanaServer.savedObjects.clean({ types: ['search', 'index-pattern'] }); + await kibanaServer.importExport.load('discover'); // and load a set of makelogs data await esArchiver.loadIfNeeded('logstash_functional'); diff --git a/test/functional/apps/discover/_shared_links.ts b/test/functional/apps/discover/_shared_links.ts index 2893102367b04..555d5ad2d94d2 100644 --- a/test/functional/apps/discover/_shared_links.ts +++ b/test/functional/apps/discover/_shared_links.ts @@ -19,6 +19,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { const browser = getService('browser'); const toasts = getService('toasts'); const deployment = getService('deployment'); + const dataGrid = getService('dataGrid'); describe('shared links', function describeIndexTests() { let baseUrl: string; @@ -37,7 +38,8 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { }); log.debug('load kibana index with default index pattern'); - await esArchiver.load('discover'); + await kibanaServer.savedObjects.clean({ types: ['search', 'index-pattern'] }); + await kibanaServer.importExport.load('discover'); await esArchiver.loadIfNeeded('logstash_functional'); await kibanaServer.uiSettings.replace({ @@ -110,6 +112,32 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { const actualUrl = await PageObjects.share.getSharedUrl(); expect(actualUrl).to.be(expectedUrl); }); + + it('should load snapshot URL with empty sort param correctly', async function () { + const expectedUrl = + baseUrl + + '/app/discover?_t=1453775307251#' + + '/?_g=(filters:!(),refreshInterval:(pause:!t,value:0),time' + + ":(from:'2015-09-19T06:31:44.000Z',to:'2015-09" + + "-23T18:31:44.000Z'))&_a=(columns:!(),filters:!(),index:'logstash-" + + "*',interval:auto,query:(language:kuery,query:'')" + + ',sort:!())'; + await browser.navigateTo(expectedUrl); + await PageObjects.discover.waitUntilSearchingHasFinished(); + await retry.waitFor('url to contain default sorting', async () => { + // url fallback default sort should have been pushed to URL + const url = await browser.getCurrentUrl(); + return url.includes('sort:!(!(%27@timestamp%27,desc))'); + }); + + const row = await dataGrid.getRow({ rowIndex: 0 }); + const firstRowText = await Promise.all( + row.map(async (cell) => await cell.getVisibleText()) + ); + + // sorting requested by ES should be correct + expect(firstRowText).to.contain('Sep 22, 2015 @ 23:50:13.253'); + }); }); }); diff --git a/test/functional/apps/home/_sample_data.ts b/test/functional/apps/home/_sample_data.ts index 12669bafcd780..5a4bdfeb6b3e8 100644 --- a/test/functional/apps/home/_sample_data.ts +++ b/test/functional/apps/home/_sample_data.ts @@ -101,7 +101,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { log.debug('Checking area, bar and heatmap charts rendered'); await dashboardExpect.seriesElementCount(15); log.debug('Checking saved searches rendered'); - await dashboardExpect.savedSearchRowCount(50); + await dashboardExpect.savedSearchRowCount(11); log.debug('Checking input controls rendered'); await dashboardExpect.inputControlItemCount(3); log.debug('Checking tag cloud rendered'); diff --git a/test/functional/apps/management/_import_objects.ts b/test/functional/apps/management/_import_objects.ts index cb4d46f02f56b..d9eb945be7777 100644 --- a/test/functional/apps/management/_import_objects.ts +++ b/test/functional/apps/management/_import_objects.ts @@ -12,6 +12,7 @@ import { keyBy } from 'lodash'; import { FtrProviderContext } from '../../ftr_provider_context'; const delay = (ms: number) => new Promise((resolve) => setTimeout(resolve, ms)); + function uniq(input: T[]): T[] { return [...new Set(input)]; } @@ -23,9 +24,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { const testSubjects = getService('testSubjects'); const log = getService('log'); - // FLAKY: https://github.com/elastic/kibana/issues/95660 - // FLAKY: https://github.com/elastic/kibana/issues/95706 - describe.skip('import objects', function describeIndexTests() { + describe('import objects', function describeIndexTests() { describe('.ndjson file', () => { beforeEach(async function () { await esArchiver.load('management'); @@ -314,7 +313,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { // but as the initial popin can take a few ms before fading, we need to wait a little // to avoid clicking twice on the same modal. await delay(1000); - await PageObjects.common.clickConfirmOnModal(false); + await PageObjects.common.clickConfirmOnModal(true); const isSuccessful = await testSubjects.exists('importSavedObjectsSuccess'); expect(isSuccessful).to.be(true); @@ -335,7 +334,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { // but as the initial popin can take a few ms before fading, we need to wait a little // to avoid clicking twice on the same modal. await delay(1000); - await PageObjects.common.clickConfirmOnModal(false); + await PageObjects.common.clickConfirmOnModal(true); const isSuccessful = await testSubjects.exists('importSavedObjectsSuccess'); expect(isSuccessful).to.be(true); diff --git a/test/functional/apps/management/_scripted_fields.js b/test/functional/apps/management/_scripted_fields.js index 13af3206a166d..fdbc419c16241 100644 --- a/test/functional/apps/management/_scripted_fields.js +++ b/test/functional/apps/management/_scripted_fields.js @@ -50,7 +50,7 @@ export default function ({ getService, getPageObjects }) { await esArchiver.load('discover'); // delete .kibana index and then wait for Kibana to re-create it await kibanaServer.uiSettings.replace({}); - await kibanaServer.uiSettings.update({}); + await kibanaServer.uiSettings.update({ 'doc_table:legacy': true }); }); after(async function afterAll() { @@ -149,7 +149,7 @@ export default function ({ getService, getPageObjects }) { await PageObjects.header.waitUntilLoadingHasFinished(); await retry.try(async function () { - const rowData = await PageObjects.discover.getDocTableIndex(1); + const rowData = await PageObjects.discover.getDocTableIndexLegacy(1); expect(rowData).to.be('Sep 18, 2015 @ 18:20:57.916\n18'); }); }); @@ -163,14 +163,14 @@ export default function ({ getService, getPageObjects }) { await testSubjects.click('docTableHeaderFieldSort_@timestamp'); await PageObjects.header.waitUntilLoadingHasFinished(); await retry.try(async function () { - const rowData = await PageObjects.discover.getDocTableIndex(1); + const rowData = await PageObjects.discover.getDocTableIndexLegacy(1); expect(rowData).to.be('Sep 17, 2015 @ 10:53:14.181\n-1'); }); await testSubjects.click(`docTableHeaderFieldSort_${scriptedPainlessFieldName}`); await PageObjects.header.waitUntilLoadingHasFinished(); await retry.try(async function () { - const rowData = await PageObjects.discover.getDocTableIndex(1); + const rowData = await PageObjects.discover.getDocTableIndexLegacy(1); expect(rowData).to.be('Sep 17, 2015 @ 06:32:29.479\n20'); }); }); @@ -238,7 +238,7 @@ export default function ({ getService, getPageObjects }) { await PageObjects.header.waitUntilLoadingHasFinished(); await retry.try(async function () { - const rowData = await PageObjects.discover.getDocTableIndex(1); + const rowData = await PageObjects.discover.getDocTableIndexLegacy(1); expect(rowData).to.be('Sep 18, 2015 @ 18:20:57.916\ngood'); }); }); @@ -252,14 +252,14 @@ export default function ({ getService, getPageObjects }) { await testSubjects.click('docTableHeaderFieldSort_@timestamp'); await PageObjects.header.waitUntilLoadingHasFinished(); await retry.try(async function () { - const rowData = await PageObjects.discover.getDocTableIndex(1); + const rowData = await PageObjects.discover.getDocTableIndexLegacy(1); expect(rowData).to.be('Sep 17, 2015 @ 09:48:40.594\nbad'); }); await testSubjects.click(`docTableHeaderFieldSort_${scriptedPainlessFieldName2}`); await PageObjects.header.waitUntilLoadingHasFinished(); await retry.try(async function () { - const rowData = await PageObjects.discover.getDocTableIndex(1); + const rowData = await PageObjects.discover.getDocTableIndexLegacy(1); expect(rowData).to.be('Sep 17, 2015 @ 06:32:29.479\ngood'); }); }); @@ -327,7 +327,7 @@ export default function ({ getService, getPageObjects }) { await PageObjects.header.waitUntilLoadingHasFinished(); await retry.try(async function () { - const rowData = await PageObjects.discover.getDocTableIndex(1); + const rowData = await PageObjects.discover.getDocTableIndexLegacy(1); expect(rowData).to.be('Sep 18, 2015 @ 18:20:57.916\ntrue'); }); }); @@ -354,14 +354,14 @@ export default function ({ getService, getPageObjects }) { await testSubjects.click('docTableHeaderFieldSort_@timestamp'); await PageObjects.header.waitUntilLoadingHasFinished(); await retry.try(async function () { - const rowData = await PageObjects.discover.getDocTableIndex(1); + const rowData = await PageObjects.discover.getDocTableIndexLegacy(1); expect(rowData).to.be('updateExpectedResultHere\ntrue'); }); await testSubjects.click(`docTableHeaderFieldSort_${scriptedPainlessFieldName2}`); await PageObjects.header.waitUntilLoadingHasFinished(); await retry.try(async function () { - const rowData = await PageObjects.discover.getDocTableIndex(1); + const rowData = await PageObjects.discover.getDocTableIndexLegacy(1); expect(rowData).to.be('updateExpectedResultHere\nfalse'); }); }); @@ -417,7 +417,7 @@ export default function ({ getService, getPageObjects }) { await PageObjects.header.waitUntilLoadingHasFinished(); await retry.try(async function () { - const rowData = await PageObjects.discover.getDocTableIndex(1); + const rowData = await PageObjects.discover.getDocTableIndexLegacy(1); expect(rowData).to.be('Sep 18, 2015 @ 06:52:55.953\n2015-09-18 07:00'); }); }); @@ -432,14 +432,14 @@ export default function ({ getService, getPageObjects }) { await testSubjects.click('docTableHeaderFieldSort_@timestamp'); await PageObjects.header.waitUntilLoadingHasFinished(); await retry.try(async function () { - const rowData = await PageObjects.discover.getDocTableIndex(1); + const rowData = await PageObjects.discover.getDocTableIndexLegacy(1); expect(rowData).to.be('updateExpectedResultHere\n2015-09-18 07:00'); }); await testSubjects.click(`docTableHeaderFieldSort_${scriptedPainlessFieldName2}`); await PageObjects.header.waitUntilLoadingHasFinished(); await retry.try(async function () { - const rowData = await PageObjects.discover.getDocTableIndex(1); + const rowData = await PageObjects.discover.getDocTableIndexLegacy(1); expect(rowData).to.be('updateExpectedResultHere\n2015-09-18 07:00'); }); }); diff --git a/test/functional/apps/visualize/_inspector.ts b/test/functional/apps/visualize/_inspector.ts index edb2f87aab13e..e46a833fd0fd7 100644 --- a/test/functional/apps/visualize/_inspector.ts +++ b/test/functional/apps/visualize/_inspector.ts @@ -15,7 +15,6 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { const inspector = getService('inspector'); const filterBar = getService('filterBar'); const monacoEditor = getService('monacoEditor'); - const testSubjects = getService('testSubjects'); const PageObjects = getPageObjects(['visualize', 'visEditor', 'visChart', 'timePicker']); describe('inspector', function describeIndexTests() { @@ -36,14 +35,14 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { log.debug('Add value to advanced JSON input'); await PageObjects.visEditor.toggleAdvancedParams('2'); - await testSubjects.setValue('codeEditorContainer', '{ "missing": 10 }'); + await PageObjects.visEditor.inputValueInCodeEditor('{ "missing": 10 }'); await PageObjects.visEditor.clickGo(); await inspector.open(); await inspector.openInspectorRequestsView(); const requestTab = await inspector.getOpenRequestDetailRequestButton(); await requestTab.click(); - const requestJSON = JSON.parse(await monacoEditor.getCodeEditorValue()); + const requestJSON = JSON.parse(await monacoEditor.getCodeEditorValue(1)); expect(requestJSON.aggs['2'].max).property('missing', 10); }); diff --git a/test/functional/apps/visualize/_line_chart_split_chart.ts b/test/functional/apps/visualize/_line_chart_split_chart.ts index b7edcde832379..1b6da1b39f1e3 100644 --- a/test/functional/apps/visualize/_line_chart_split_chart.ts +++ b/test/functional/apps/visualize/_line_chart_split_chart.ts @@ -12,6 +12,7 @@ import { FtrProviderContext } from '../../ftr_provider_context'; export default function ({ getService, getPageObjects }: FtrProviderContext) { const log = getService('log'); + const find = getService('find'); const inspector = getService('inspector'); const retry = getService('retry'); const testSubjects = getService('testSubjects'); @@ -283,7 +284,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { it('should have advanced accordion and json input', async () => { await testSubjects.click('advancedParams-1'); - await testSubjects.existOrFail('advancedParams-1 > codeEditorContainer'); + await find.byCssSelector('.euiAccordion .react-monaco-editor-container'); }); }); @@ -314,7 +315,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { it('should have advanced accordion and json input', async () => { await testSubjects.click('advancedParams-1'); - await testSubjects.existOrFail('advancedParams-1 > codeEditorContainer'); + await find.byCssSelector('.euiAccordion .react-monaco-editor-container'); }); }); }); diff --git a/test/functional/apps/visualize/_line_chart_split_series.ts b/test/functional/apps/visualize/_line_chart_split_series.ts index 4f9ffe3b41196..b3debc13c7770 100644 --- a/test/functional/apps/visualize/_line_chart_split_series.ts +++ b/test/functional/apps/visualize/_line_chart_split_series.ts @@ -12,6 +12,7 @@ import { FtrProviderContext } from '../../ftr_provider_context'; export default function ({ getService, getPageObjects }: FtrProviderContext) { const log = getService('log'); + const find = getService('find'); const inspector = getService('inspector'); const retry = getService('retry'); const testSubjects = getService('testSubjects'); @@ -305,7 +306,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { it('should have advanced accordion and json input', async () => { await testSubjects.click('advancedParams-1'); - await testSubjects.existOrFail('advancedParams-1 > codeEditorContainer'); + await find.byCssSelector('.euiAccordion .react-monaco-editor-container'); }); }); @@ -336,7 +337,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { it('should have advanced accordion and json input', async () => { await testSubjects.click('advancedParams-1'); - await testSubjects.existOrFail('advancedParams-1 > codeEditorContainer'); + await find.byCssSelector('.euiAccordion .react-monaco-editor-container'); }); }); }); diff --git a/test/functional/fixtures/es_archiver/hamlet/data.json.gz b/test/functional/fixtures/es_archiver/hamlet/data.json.gz index 822022489ae9d..add8df3a73f4a 100644 Binary files a/test/functional/fixtures/es_archiver/hamlet/data.json.gz and b/test/functional/fixtures/es_archiver/hamlet/data.json.gz differ diff --git a/test/functional/fixtures/es_archiver/hamlet/mappings.json b/test/functional/fixtures/es_archiver/hamlet/mappings.json index bf051eb072be5..fdfac3b5ad52c 100644 --- a/test/functional/fixtures/es_archiver/hamlet/mappings.json +++ b/test/functional/fixtures/es_archiver/hamlet/mappings.json @@ -1,352 +1,3 @@ -{ - "type": "index", - "value": { - "aliases": { - ".kibana": { - } - }, - "index": ".kibana_1", - "mappings": { - "_meta": { - "migrationMappingPropertyHashes": { - "config": "87aca8fdb053154f11383fce3dbf3edf", - "dashboard": "eb3789e1af878e73f85304333240f65f", - "index-pattern": "66eccb05066c5a89924f48a9e9736499", - "kql-telemetry": "d12a98a6f19a2d273696597547e064ee", - "migrationVersion": "4a1746014a75ade3a714e1db5763276f", - "namespace": "2f4316de49999235636386fe51dc06c1", - "references": "7997cf5a56cc02bdc9c93361bde732b0", - "sample-data-telemetry": "7d3cfeb915303c9641c59681967ffeb4", - "search": "181661168bbadd1eff5902361e2a0d5c", - "server": "ec97f1c5da1a19609a60874e5af1100c", - "timelion-sheet": "9a2a2748877c7a7b582fef201ab1d4cf", - "type": "2f4316de49999235636386fe51dc06c1", - "ui-metric": "0d409297dc5ebe1e3a1da691c6ee32e3", - "updated_at": "00da57df13e94e9d98437d13ace4bfe0", - "url": "c7f66a0df8b1b52f17c28c4adb111105", - "visualization": "52d7a13ad68a150c4525b292d23e12cc" - } - }, - "dynamic": "strict", - "properties": { - "config": { - "dynamic": "true", - "properties": { - "buildNum": { - "type": "keyword" - }, - "dateFormat:tz": { - "fields": { - "keyword": { - "ignore_above": 256, - "type": "keyword" - } - }, - "type": "text" - }, - "defaultIndex": { - "fields": { - "keyword": { - "ignore_above": 256, - "type": "keyword" - } - }, - "type": "text" - } - } - }, - "dashboard": { - "properties": { - "description": { - "type": "text" - }, - "hits": { - "type": "integer" - }, - "kibanaSavedObjectMeta": { - "properties": { - "searchSourceJSON": { - "type": "text" - } - } - }, - "optionsJSON": { - "type": "text" - }, - "panelsJSON": { - "type": "text" - }, - "refreshInterval": { - "properties": { - "display": { - "type": "keyword" - }, - "pause": { - "type": "boolean" - }, - "section": { - "type": "integer" - }, - "value": { - "type": "integer" - } - } - }, - "timeFrom": { - "type": "keyword" - }, - "timeRestore": { - "type": "boolean" - }, - "timeTo": { - "type": "keyword" - }, - "title": { - "type": "text" - }, - "uiStateJSON": { - "type": "text" - }, - "version": { - "type": "integer" - } - } - }, - "index-pattern": { - "properties": { - "fieldFormatMap": { - "type": "text" - }, - "fields": { - "type": "text" - }, - "intervalName": { - "type": "keyword" - }, - "notExpandable": { - "type": "boolean" - }, - "sourceFilters": { - "type": "text" - }, - "timeFieldName": { - "type": "keyword" - }, - "title": { - "type": "text" - }, - "type": { - "type": "keyword" - }, - "typeMeta": { - "type": "keyword" - } - } - }, - "kql-telemetry": { - "properties": { - "optInCount": { - "type": "long" - }, - "optOutCount": { - "type": "long" - } - } - }, - "migrationVersion": { - "dynamic": "true", - "properties": { - "index-pattern": { - "fields": { - "keyword": { - "ignore_above": 256, - "type": "keyword" - } - }, - "type": "text" - } - } - }, - "namespace": { - "type": "keyword" - }, - "references": { - "properties": { - "id": { - "type": "keyword" - }, - "name": { - "type": "keyword" - }, - "type": { - "type": "keyword" - } - }, - "type": "nested" - }, - "sample-data-telemetry": { - "properties": { - "installCount": { - "type": "long" - }, - "unInstallCount": { - "type": "long" - } - } - }, - "search": { - "properties": { - "columns": { - "type": "keyword" - }, - "description": { - "type": "text" - }, - "hits": { - "type": "integer" - }, - "kibanaSavedObjectMeta": { - "properties": { - "searchSourceJSON": { - "type": "text" - } - } - }, - "sort": { - "type": "keyword" - }, - "title": { - "type": "text" - }, - "version": { - "type": "integer" - } - } - }, - "server": { - "properties": { - "uuid": { - "type": "keyword" - } - } - }, - "timelion-sheet": { - "properties": { - "description": { - "type": "text" - }, - "hits": { - "type": "integer" - }, - "kibanaSavedObjectMeta": { - "properties": { - "searchSourceJSON": { - "type": "text" - } - } - }, - "timelion_chart_height": { - "type": "integer" - }, - "timelion_columns": { - "type": "integer" - }, - "timelion_interval": { - "type": "keyword" - }, - "timelion_other_interval": { - "type": "keyword" - }, - "timelion_rows": { - "type": "integer" - }, - "timelion_sheet": { - "type": "text" - }, - "title": { - "type": "text" - }, - "version": { - "type": "integer" - } - } - }, - "type": { - "type": "keyword" - }, - "ui-metric": { - "properties": { - "count": { - "type": "integer" - } - } - }, - "updated_at": { - "type": "date" - }, - "url": { - "properties": { - "accessCount": { - "type": "long" - }, - "accessDate": { - "type": "date" - }, - "createDate": { - "type": "date" - }, - "url": { - "fields": { - "keyword": { - "ignore_above": 2048, - "type": "keyword" - } - }, - "type": "text" - } - } - }, - "visualization": { - "properties": { - "description": { - "type": "text" - }, - "kibanaSavedObjectMeta": { - "properties": { - "searchSourceJSON": { - "type": "text" - } - } - }, - "savedSearchRefName": { - "type": "keyword" - }, - "title": { - "type": "text" - }, - "uiStateJSON": { - "type": "text" - }, - "version": { - "type": "integer" - }, - "visState": { - "type": "text" - } - } - } - } - }, - "settings": { - "index": { - "auto_expand_replicas": "0-1", - "number_of_replicas": "0", - "number_of_shards": "1" - } - } - } -} - { "type": "index", "value": { diff --git a/test/functional/fixtures/kbn_archiver/testlargestring.json b/test/functional/fixtures/kbn_archiver/testlargestring.json new file mode 100644 index 0000000000000..874e6adc983aa --- /dev/null +++ b/test/functional/fixtures/kbn_archiver/testlargestring.json @@ -0,0 +1,17 @@ +{ + "attributes": { + "fieldAttrs": "{}", + "fields": "[]", + "runtimeFieldMap": "{}", + "title": "testlargestring" + }, + "coreMigrationVersion": "8.0.0", + "id": "testlargestring", + "migrationVersion": { + "index-pattern": "7.11.0" + }, + "references": [], + "type": "index-pattern", + "updated_at": "2021-04-14T20:35:29.121Z", + "version": "WzExLDJd" +} \ No newline at end of file diff --git a/test/functional/page_objects/dashboard_page.ts b/test/functional/page_objects/dashboard_page.ts index 9c12296db138c..b0610b36eb65f 100644 --- a/test/functional/page_objects/dashboard_page.ts +++ b/test/functional/page_objects/dashboard_page.ts @@ -220,14 +220,15 @@ export function DashboardPageProvider({ getService, getPageObjects }: FtrProvide /** * Asserts that the toolbar pagination (count and arrows) is either displayed or not displayed. - * @param { displayed: boolean } + */ - public async expectToolbarPaginationDisplayed({ displayed = true }) { - const subjects = ['btnPrevPage', 'btnNextPage', 'toolBarPagerText']; - if (displayed) { - await Promise.all(subjects.map(async (subj) => await testSubjects.existOrFail(subj))); - } else { - await Promise.all(subjects.map(async (subj) => await testSubjects.missingOrFail(subj))); + public async expectToolbarPaginationDisplayed() { + const subjects = ['pagination-button-previous', 'pagination-button-next']; + + await Promise.all(subjects.map(async (subj) => await testSubjects.existOrFail(subj))); + const paginationListExists = await find.existsByCssSelector('.euiPagination__list'); + if (!paginationListExists) { + throw new Error(`expected discover data grid pagination list to exist`); } } diff --git a/test/functional/page_objects/discover_page.ts b/test/functional/page_objects/discover_page.ts index 62375a39dd7d3..62aa41d89f75e 100644 --- a/test/functional/page_objects/discover_page.ts +++ b/test/functional/page_objects/discover_page.ts @@ -20,6 +20,7 @@ export function DiscoverPageProvider({ getService, getPageObjects }: FtrProvider const docTable = getService('docTable'); const config = getService('config'); const defaultFindTimeout = config.get('timeouts.find'); + const dataGrid = getService('dataGrid'); class DiscoverPage { public async getChartTimespan() { @@ -77,7 +78,7 @@ export function DiscoverPageProvider({ getService, getPageObjects }: FtrProvider } public async getColumnHeaders() { - return await docTable.getHeaderFields('embeddedSavedSearchDocTable'); + return await dataGrid.getHeaderFields(); } public async openLoadSavedSearchPanel() { @@ -139,7 +140,7 @@ export function DiscoverPageProvider({ getService, getPageObjects }: FtrProvider await elasticChart.waitForRenderComplete(); const el = await elasticChart.getCanvas(); - await browser.getActions().move({ x: 0, y: 20, origin: el._webElement }).click().perform(); + await browser.getActions().move({ x: 0, y: 0, origin: el._webElement }).click().perform(); } public async brushHistogram() { @@ -179,26 +180,31 @@ export function DiscoverPageProvider({ getService, getPageObjects }: FtrProvider } public async getDocHeader() { - const docHeader = await find.byCssSelector('thead > tr:nth-child(1)'); - return await docHeader.getVisibleText(); + const docHeader = await dataGrid.getHeaders(); + return docHeader.join(); } public async getDocTableRows() { await header.waitUntilLoadingHasFinished(); - const rows = await testSubjects.findAll('docTableRow'); - return rows; + return await dataGrid.getBodyRows(); } public async getDocTableIndex(index: number) { + const row = await dataGrid.getRow({ rowIndex: index - 1 }); + const result = await Promise.all(row.map(async (cell) => await cell.getVisibleText())); + // Remove control columns + return result.slice(2).join(' '); + } + + public async getDocTableIndexLegacy(index: number) { const row = await find.byCssSelector(`tr.kbnDocTable__row:nth-child(${index})`); return await row.getVisibleText(); } - public async getDocTableField(index: number, cellIndex = 0) { - const fields = await find.allByCssSelector( - `tr.kbnDocTable__row:nth-child(${index}) [data-test-subj='docTableField']` - ); - return await fields[cellIndex].getVisibleText(); + public async getDocTableField(index: number, cellIdx: number = 2) { + const row = await dataGrid.getRow({ rowIndex: index - 1 }); + const result = await Promise.all(row.map(async (cell) => await cell.getVisibleText())); + return result[cellIdx]; } public async skipToEndOfDocTable() { @@ -224,11 +230,11 @@ export function DiscoverPageProvider({ getService, getPageObjects }: FtrProvider } public async clickDocSortDown() { - await find.clickByCssSelector('.fa-sort-down'); + await dataGrid.clickDocSortAsc(); } public async clickDocSortUp() { - await find.clickByCssSelector('.fa-sort-up'); + await dataGrid.clickDocSortDesc(); } public async isShowingDocViewer() { @@ -237,10 +243,8 @@ export function DiscoverPageProvider({ getService, getPageObjects }: FtrProvider public async getMarks() { const table = await docTable.getTable(); - const $ = await table.parseDomContent(); - return $('mark') - .toArray() - .map((mark) => $(mark).text()); + const marks = await table.findAllByTagName('mark'); + return await Promise.all(marks.map((mark) => mark.getVisibleText())); } public async toggleSidebarCollapse() { @@ -295,8 +299,8 @@ export function DiscoverPageProvider({ getService, getPageObjects }: FtrProvider return await testSubjects.click(`field-${field}`); } - public async clickFieldSort(field: string) { - return await testSubjects.click(`docTableHeaderFieldSort_${field}`); + public async clickFieldSort(field: string, text = 'Sort New-Old') { + await dataGrid.clickDocSortAsc(field, text); } public async clickFieldListItemToggle(field: string) { @@ -368,8 +372,7 @@ export function DiscoverPageProvider({ getService, getPageObjects }: FtrProvider } public async removeHeaderColumn(name: string) { - await testSubjects.moveMouseTo(`docTableHeader-${name}`); - await testSubjects.click(`docTableRemoveHeader-${name}`); + await dataGrid.clickRemoveColumn(name); } public async openSidebarFieldFilter() { diff --git a/test/functional/page_objects/tile_map_page.ts b/test/functional/page_objects/tile_map_page.ts index db17268f20a15..6008d7434bf1d 100644 --- a/test/functional/page_objects/tile_map_page.ts +++ b/test/functional/page_objects/tile_map_page.ts @@ -40,8 +40,9 @@ export function TileMapPageProvider({ getService, getPageObjects }: FtrProviderC await testSubjects.click('inspectorViewChooser'); await testSubjects.click('inspectorViewChooserRequests'); await testSubjects.click('inspectorRequestDetailRequest'); + await find.byCssSelector('.react-monaco-editor-container'); - return await monacoEditor.getCodeEditorValue(); + return await monacoEditor.getCodeEditorValue(1); } public async getMapBounds(): Promise { diff --git a/test/functional/page_objects/visualize_editor_page.ts b/test/functional/page_objects/visualize_editor_page.ts index 97627556abc63..59e93bd1f5700 100644 --- a/test/functional/page_objects/visualize_editor_page.ts +++ b/test/functional/page_objects/visualize_editor_page.ts @@ -353,6 +353,14 @@ export function VisualizeEditorPageProvider({ getService, getPageObjects }: FtrP await accordionButton.click(); } + public async inputValueInCodeEditor(value: string) { + const codeEditor = await find.byCssSelector('.react-monaco-editor-container'); + const textarea = await codeEditor.findByClassName('monaco-mouse-cursor-text'); + + await textarea.click(); + await browser.pressKeys(value); + } + public async clickReset() { await testSubjects.click('visualizeEditorResetButton'); await visChart.waitForVisualization(); diff --git a/test/functional/services/dashboard/expectations.ts b/test/functional/services/dashboard/expectations.ts index e4dc59ae71566..329a8204cce0e 100644 --- a/test/functional/services/dashboard/expectations.ts +++ b/test/functional/services/dashboard/expectations.ts @@ -47,14 +47,6 @@ export function DashboardExpectProvider({ getService, getPageObjects }: FtrProvi }); } - async docTableFieldCount(expectedCount: number) { - log.debug(`DashboardExpect.docTableFieldCount(${expectedCount})`); - await retry.try(async () => { - const docTableCells = await testSubjects.findAll('docTableField', findTimeout); - expect(docTableCells.length).to.be(expectedCount); - }); - } - async fieldSuggestions(expectedFields: string[]) { log.debug(`DashboardExpect.fieldSuggestions(${expectedFields})`); const fields = await filterBar.getFilterEditorFields(); diff --git a/test/functional/services/data_grid.ts b/test/functional/services/data_grid.ts index 87fa59b48a324..8ca6c6e816aa5 100644 --- a/test/functional/services/data_grid.ts +++ b/test/functional/services/data_grid.ts @@ -23,6 +23,7 @@ export function DataGridProvider({ getService, getPageObjects }: FtrProviderCont const find = getService('find'); const testSubjects = getService('testSubjects'); const PageObjects = getPageObjects(['common', 'header']); + const retry = getService('retry'); class DataGrid { async getDataGridTableData(): Promise { @@ -126,6 +127,9 @@ export function DataGridProvider({ getService, getPageObjects }: FtrProviderCont */ public async getDocTableRows() { const table = await this.getTable(); + if (!table) { + return []; + } const cells = await table.findAllByCssSelector('.euiDataGridRowCell'); const rows: WebElementWrapper[][] = []; @@ -183,14 +187,39 @@ export function DataGridProvider({ getService, getPageObjects }: FtrProviderCont return await detailsRow.findAllByTestSubject('~docTableRowAction'); } - public async clickDocSortAsc() { - await find.clickByCssSelector('.euiDataGridHeaderCell__button'); - await find.clickByButtonText('Sort New-Old'); + public async openColMenuByField(field: string) { + await retry.waitFor('header cell action being displayed', async () => { + // to prevent flakiness + await testSubjects.click(`dataGridHeaderCell-${field}`); + return await testSubjects.exists(`dataGridHeaderCellActionGroup-${field}`); + }); + } + + public async clickDocSortAsc(field?: string, sortText = 'Sort New-Old') { + if (field) { + await this.openColMenuByField(field); + } else { + await find.clickByCssSelector('.euiDataGridHeaderCell__button'); + } + await find.clickByButtonText(sortText); + } + + public async clickDocSortDesc(field?: string, sortText = 'Sort Old-New') { + if (field) { + await this.openColMenuByField(field); + } else { + await find.clickByCssSelector('.euiDataGridHeaderCell__button'); + } + await find.clickByButtonText(sortText); } - public async clickDocSortDesc() { - await find.clickByCssSelector('.euiDataGridHeaderCell__button'); - await find.clickByButtonText('Sort Old-New'); + public async clickRemoveColumn(field?: string) { + if (field) { + await this.openColMenuByField(field); + } else { + await find.clickByCssSelector('.euiDataGridHeaderCell__button'); + } + await find.clickByButtonText('Remove column'); } public async getDetailsRow(): Promise { const detailRows = await this.getDetailsRows(); @@ -234,6 +263,10 @@ export function DataGridProvider({ getService, getPageObjects }: FtrProviderCont await addInclusiveFilterButton.click(); await PageObjects.header.awaitGlobalLoadingIndicatorHidden(); } + + public async hasNoResults() { + return await find.existsByCssSelector('.euiDataGrid__noResults'); + } } return new DataGrid(); diff --git a/test/functional/services/lib/web_element_wrapper/custom_cheerio_api.ts b/test/functional/services/lib/web_element_wrapper/custom_cheerio_api.ts index 301eb656ed6f6..c01e07fd07624 100644 --- a/test/functional/services/lib/web_element_wrapper/custom_cheerio_api.ts +++ b/test/functional/services/lib/web_element_wrapper/custom_cheerio_api.ts @@ -8,13 +8,13 @@ interface CheerioSelector { (selector: string): CustomCheerio; (selector: string, context: string): CustomCheerio; - (selector: string, context: CheerioElement): CustomCheerio; - (selector: string, context: CheerioElement[]): CustomCheerio; - (selector: string, context: Cheerio): CustomCheerio; + (selector: string, context: cheerio.Element): CustomCheerio; + (selector: string, context: cheerio.Element[]): CustomCheerio; + (selector: string, context: cheerio.Cheerio): CustomCheerio; (selector: string, context: string, root: string): CustomCheerio; - (selector: string, context: CheerioElement, root: string): CustomCheerio; - (selector: string, context: CheerioElement[], root: string): CustomCheerio; - (selector: string, context: Cheerio, root: string): CustomCheerio; + (selector: string, context: cheerio.Element, root: string): CustomCheerio; + (selector: string, context: cheerio.Element[], root: string): CustomCheerio; + (selector: string, context: cheerio.Cheerio, root: string): CustomCheerio; (selector: any): CustomCheerio; } @@ -24,13 +24,13 @@ export interface CustomCheerioStatic extends CheerioSelector { // JQuery http://api.jquery.com xml(): string; root(): CustomCheerio; - contains(container: CheerioElement, contained: CheerioElement): boolean; + contains(container: cheerio.Element, contained: cheerio.Element): boolean; parseHTML(data: string, context?: Document, keepScripts?: boolean): Document[]; - html(options?: CheerioOptionsInterface): string; - html(selector: string, options?: CheerioOptionsInterface): string; - html(element: CustomCheerio, options?: CheerioOptionsInterface): string; - html(element: CheerioElement, options?: CheerioOptionsInterface): string; + html(options?: cheerio.CheerioParserOptions): string; + html(selector: string, options?: cheerio.CheerioParserOptions): string; + html(element: CustomCheerio, options?: cheerio.CheerioParserOptions): string; + html(element: cheerio.Element, options?: cheerio.CheerioParserOptions): string; // // CUSTOM METHODS @@ -44,7 +44,7 @@ export interface CustomCheerio { // Cheerio https://github.com/cheeriojs/cheerio // JQuery http://api.jquery.com - [index: number]: CheerioElement; + [index: number]: cheerio.Element; length: number; // Attributes @@ -63,7 +63,7 @@ export interface CustomCheerio { removeAttr(name: string): CustomCheerio; has(selector: string): CustomCheerio; - has(element: CheerioElement): CustomCheerio; + has(element: cheerio.Element): CustomCheerio; hasClass(className: string): boolean; addClass(classNames: string): CustomCheerio; @@ -81,10 +81,10 @@ export interface CustomCheerio { ): CustomCheerio; is(selector: string): boolean; - is(element: CheerioElement): boolean; - is(element: CheerioElement[]): boolean; + is(element: cheerio.Element): boolean; + is(element: cheerio.Element[]): boolean; is(selection: CustomCheerio): boolean; - is(func: (index: number, element: CheerioElement) => boolean): boolean; + is(func: (index: number, element: cheerio.Element) => boolean): boolean; // Form serialize(): string; @@ -98,7 +98,7 @@ export interface CustomCheerio { parent(selector?: string): CustomCheerio; parents(selector?: string): CustomCheerio; parentsUntil(selector?: string, filter?: string): CustomCheerio; - parentsUntil(element: CheerioElement, filter?: string): CustomCheerio; + parentsUntil(element: cheerio.Element, filter?: string): CustomCheerio; parentsUntil(element: CustomCheerio, filter?: string): CustomCheerio; prop(name: string): any; @@ -112,7 +112,7 @@ export interface CustomCheerio { nextAll(selector: string): CustomCheerio; nextUntil(selector?: string, filter?: string): CustomCheerio; - nextUntil(element: CheerioElement, filter?: string): CustomCheerio; + nextUntil(element: cheerio.Element, filter?: string): CustomCheerio; nextUntil(element: CustomCheerio, filter?: string): CustomCheerio; prev(selector?: string): CustomCheerio; @@ -120,7 +120,7 @@ export interface CustomCheerio { prevAll(selector: string): CustomCheerio; prevUntil(selector?: string, filter?: string): CustomCheerio; - prevUntil(element: CheerioElement, filter?: string): CustomCheerio; + prevUntil(element: cheerio.Element, filter?: string): CustomCheerio; prevUntil(element: CustomCheerio, filter?: string): CustomCheerio; slice(start: number, end?: number): CustomCheerio; @@ -131,19 +131,19 @@ export interface CustomCheerio { contents(): CustomCheerio; - each(func: (index: number, element: CheerioElement) => any): CustomCheerio; - map(func: (index: number, element: CheerioElement) => any): CustomCheerio; + each(func: (index: number, element: cheerio.Element) => any): CustomCheerio; + map(func: (index: number, element: cheerio.Element) => any): CustomCheerio; filter(selector: string): CustomCheerio; filter(selection: CustomCheerio): CustomCheerio; - filter(element: CheerioElement): CustomCheerio; - filter(elements: CheerioElement[]): CustomCheerio; - filter(func: (index: number, element: CheerioElement) => boolean): CustomCheerio; + filter(element: cheerio.Element): CustomCheerio; + filter(elements: cheerio.Element[]): CustomCheerio; + filter(func: (index: number, element: cheerio.Element) => boolean): CustomCheerio; not(selector: string): CustomCheerio; not(selection: CustomCheerio): CustomCheerio; - not(element: CheerioElement): CustomCheerio; - not(func: (index: number, element: CheerioElement) => boolean): CustomCheerio; + not(element: cheerio.Element): CustomCheerio; + not(func: (index: number, element: cheerio.Element) => boolean): CustomCheerio; first(): CustomCheerio; last(): CustomCheerio; @@ -161,8 +161,8 @@ export interface CustomCheerio { add(selectorOrHtml: string): CustomCheerio; add(selector: string, context: Document): CustomCheerio; - add(element: CheerioElement): CustomCheerio; - add(elements: CheerioElement[]): CustomCheerio; + add(element: cheerio.Element): CustomCheerio; + add(elements: cheerio.Element[]): CustomCheerio; add(selection: CustomCheerio): CustomCheerio; addBack(): CustomCheerio; @@ -203,8 +203,8 @@ export interface CustomCheerio { remove(selector?: string): CustomCheerio; replaceWith(content: string): CustomCheerio; - replaceWith(content: CheerioElement): CustomCheerio; - replaceWith(content: CheerioElement[]): CustomCheerio; + replaceWith(content: cheerio.Element): CustomCheerio; + replaceWith(content: cheerio.Element[]): CustomCheerio; replaceWith(content: CustomCheerio): CustomCheerio; replaceWith(content: () => CustomCheerio): CustomCheerio; @@ -236,7 +236,7 @@ export interface CustomCheerio { // Not Documented - toArray(): CheerioElement[]; + toArray(): CustomCheerio[]; // // CUSTOM METHODS diff --git a/test/functional/services/monaco_editor.ts b/test/functional/services/monaco_editor.ts index e0763659be9c5..4e791e54c4b09 100644 --- a/test/functional/services/monaco_editor.ts +++ b/test/functional/services/monaco_editor.ts @@ -13,16 +13,19 @@ export function MonacoEditorProvider({ getService }: FtrProviderContext) { const browser = getService('browser'); return new (class MonacoEditor { - public async getCodeEditorValue() { - let request: string = ''; + public async getCodeEditorValue(nthIndex: number = 0) { + let values: string[] = []; await retry.try(async () => { - request = await browser.execute( - () => (window as any).MonacoEnvironment.monaco.editor.getModels()[0].getValue() as string + values = await browser.execute( + () => + (window as any).MonacoEnvironment.monaco.editor + .getModels() + .map((model: any) => model.getValue()) as string[] ); }); - return request; + return values[nthIndex] as string; } })(); } diff --git a/test/plugin_functional/test_suites/data_plugin/session.ts b/test/plugin_functional/test_suites/data_plugin/session.ts index 0194a9c8e120b..ae4f8ffdf4072 100644 --- a/test/plugin_functional/test_suites/data_plugin/session.ts +++ b/test/plugin_functional/test_suites/data_plugin/session.ts @@ -54,7 +54,7 @@ export default function ({ getService, getPageObjects }: PluginFunctionalProvide it('Starts a new session on sort', async () => { await PageObjects.discover.clickFieldListItemAdd('speaker'); - await PageObjects.discover.clickFieldSort('speaker'); + await PageObjects.discover.clickFieldSort('speaker', 'Sort A-Z'); await PageObjects.header.waitUntilLoadingHasFinished(); const sessionIds = await getSessionIds(); expect(sessionIds.length).to.be(1); diff --git a/x-pack/.i18nrc.json b/x-pack/.i18nrc.json index 3fee52ff55857..4a03478800fc8 100644 --- a/x-pack/.i18nrc.json +++ b/x-pack/.i18nrc.json @@ -20,6 +20,7 @@ "xpack.endpoint": "plugins/endpoint", "xpack.enterpriseSearch": "plugins/enterprise_search", "xpack.features": "plugins/features", + "xpack.fileDataVisualizer": "plugins/file_data_visualizer", "xpack.fileUpload": "plugins/file_upload", "xpack.globalSearch": ["plugins/global_search"], "xpack.globalSearchBar": ["plugins/global_search_bar"], diff --git a/x-pack/plugins/actions/server/actions_client.test.ts b/x-pack/plugins/actions/server/actions_client.test.ts index ae7faca1465c7..9b22e31c05e8a 100644 --- a/x-pack/plugins/actions/server/actions_client.test.ts +++ b/x-pack/plugins/actions/server/actions_client.test.ts @@ -413,6 +413,12 @@ describe('create()', () => { proxyOnlyHosts: undefined, maxResponseContentLength: new ByteSizeValue(1000000), responseTimeout: moment.duration('60s'), + cleanupFailedExecutionsTask: { + enabled: true, + cleanupInterval: schema.duration().validate('5m'), + idleInterval: schema.duration().validate('1h'), + pageSize: 100, + }, }); const localActionTypeRegistryParams = { diff --git a/x-pack/plugins/actions/server/actions_client.ts b/x-pack/plugins/actions/server/actions_client.ts index d8dcde2fab103..9f87de5f686cc 100644 --- a/x-pack/plugins/actions/server/actions_client.ts +++ b/x-pack/plugins/actions/server/actions_client.ts @@ -18,7 +18,7 @@ import { KibanaRequest, SavedObjectsUtils, } from '../../../../src/core/server'; -import { AuditLogger, EventOutcome } from '../../security/server'; +import { AuditLogger } from '../../security/server'; import { ActionType } from '../common'; import { ActionTypeRegistry } from './action_type_registry'; import { validateConfig, validateSecrets, ActionExecutorContract } from './lib'; @@ -146,7 +146,7 @@ export class ActionsClient { connectorAuditEvent({ action: ConnectorAuditAction.CREATE, savedObject: { type: 'action', id }, - outcome: EventOutcome.UNKNOWN, + outcome: 'unknown', }) ); @@ -218,7 +218,7 @@ export class ActionsClient { connectorAuditEvent({ action: ConnectorAuditAction.UPDATE, savedObject: { type: 'action', id }, - outcome: EventOutcome.UNKNOWN, + outcome: 'unknown', }) ); @@ -452,7 +452,7 @@ export class ActionsClient { this.auditLogger?.log( connectorAuditEvent({ action: ConnectorAuditAction.DELETE, - outcome: EventOutcome.UNKNOWN, + outcome: 'unknown', savedObject: { type: 'action', id }, }) ); diff --git a/x-pack/plugins/actions/server/actions_config.test.ts b/x-pack/plugins/actions/server/actions_config.test.ts index 1b9de0162f340..70c8b0e8185d5 100644 --- a/x-pack/plugins/actions/server/actions_config.test.ts +++ b/x-pack/plugins/actions/server/actions_config.test.ts @@ -5,6 +5,7 @@ * 2.0. */ +import { schema } from '@kbn/config-schema'; import { ByteSizeValue } from '@kbn/config-schema'; import { ActionsConfig } from './config'; import { @@ -24,6 +25,12 @@ const defaultActionsConfig: ActionsConfig = { rejectUnauthorized: true, maxResponseContentLength: new ByteSizeValue(1000000), responseTimeout: moment.duration(60000), + cleanupFailedExecutionsTask: { + enabled: true, + cleanupInterval: schema.duration().validate('5m'), + idleInterval: schema.duration().validate('1h'), + pageSize: 100, + }, }; describe('ensureUriAllowed', () => { diff --git a/x-pack/plugins/actions/server/builtin_action_types/server_log.ts b/x-pack/plugins/actions/server/builtin_action_types/server_log.ts index ac9c4211f07cc..6c54c1b9f2ff1 100644 --- a/x-pack/plugins/actions/server/builtin_action_types/server_log.ts +++ b/x-pack/plugins/actions/server/builtin_action_types/server_log.ts @@ -9,7 +9,7 @@ import { curry } from 'lodash'; import { i18n } from '@kbn/i18n'; import { schema, TypeOf } from '@kbn/config-schema'; -import { Logger } from '../../../../../src/core/server'; +import { Logger, LogMeta } from '../../../../../src/core/server'; import { ActionType, ActionTypeExecutorOptions, ActionTypeExecutorResult } from '../types'; import { withoutControlCharacters } from './lib/string_utils'; @@ -66,7 +66,7 @@ async function executor( const sanitizedMessage = withoutControlCharacters(params.message); try { - logger[params.level](`Server log: ${sanitizedMessage}`); + (logger[params.level] as Logger['info'])(`Server log: ${sanitizedMessage}`); } catch (err) { const message = i18n.translate('xpack.actions.builtin.serverLog.errorLoggingErrorMessage', { defaultMessage: 'error logging message', diff --git a/x-pack/plugins/actions/server/cleanup_failed_executions/cleanup_tasks.test.ts b/x-pack/plugins/actions/server/cleanup_failed_executions/cleanup_tasks.test.ts new file mode 100644 index 0000000000000..07c09a2dfef76 --- /dev/null +++ b/x-pack/plugins/actions/server/cleanup_failed_executions/cleanup_tasks.test.ts @@ -0,0 +1,126 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import type { SavedObjectsFindResult, SavedObjectsSerializer } from 'kibana/server'; +import { loggingSystemMock, elasticsearchServiceMock } from '../../../../../src/core/server/mocks'; +import { spacesMock } from '../../../spaces/server/mocks'; +import { CleanupTasksOpts, cleanupTasks } from './cleanup_tasks'; +import { TaskInstance } from '../../../task_manager/server'; +import { ApiResponse, estypes } from '@elastic/elasticsearch'; + +describe('cleanupTasks', () => { + const logger = loggingSystemMock.create().get(); + const esClient = elasticsearchServiceMock.createElasticsearchClient(); + const spaces = spacesMock.createStart(); + const savedObjectsSerializer = ({ + generateRawId: jest + .fn() + .mockImplementation((namespace: string | undefined, type: string, id: string) => { + const namespacePrefix = namespace ? `${namespace}:` : ''; + return `${namespacePrefix}${type}:${id}`; + }), + } as unknown) as SavedObjectsSerializer; + + const cleanupTasksOpts: CleanupTasksOpts = { + logger, + esClient, + spaces, + savedObjectsSerializer, + kibanaIndex: '.kibana', + taskManagerIndex: '.kibana_task_manager', + tasks: [], + }; + + const taskSO: SavedObjectsFindResult = { + id: '123', + type: 'task', + references: [], + score: 0, + attributes: { + id: '123', + taskType: 'foo', + scheduledAt: new Date(), + state: {}, + runAt: new Date(), + startedAt: new Date(), + retryAt: new Date(), + ownerId: '234', + params: { spaceId: undefined, actionTaskParamsId: '123' }, + schedule: { interval: '5m' }, + }, + }; + + beforeEach(() => { + esClient.bulk.mockReset(); + }); + + it('should skip cleanup when there are no tasks to cleanup', async () => { + const result = await cleanupTasks(cleanupTasksOpts); + expect(result).toEqual({ + success: true, + successCount: 0, + failureCount: 0, + }); + expect(esClient.bulk).not.toHaveBeenCalled(); + }); + + it('should delete action_task_params and task objects', async () => { + esClient.bulk.mockResolvedValue(({ + body: { items: [], errors: false, took: 1 }, + } as unknown) as ApiResponse); + const result = await cleanupTasks({ + ...cleanupTasksOpts, + tasks: [taskSO], + }); + expect(esClient.bulk).toHaveBeenCalledWith({ + body: [{ delete: { _index: cleanupTasksOpts.kibanaIndex, _id: 'action_task_params:123' } }], + }); + expect(esClient.bulk).toHaveBeenCalledWith({ + body: [{ delete: { _index: cleanupTasksOpts.taskManagerIndex, _id: 'task:123' } }], + }); + expect(result).toEqual({ + success: true, + successCount: 1, + failureCount: 0, + }); + }); + + it('should not delete the task if the action_task_params failed to delete', async () => { + esClient.bulk.mockResolvedValue(({ + body: { + items: [ + { + delete: { + _index: cleanupTasksOpts.kibanaIndex, + _id: 'action_task_params:123', + status: 500, + result: 'Failure', + error: true, + }, + }, + ], + errors: true, + took: 1, + }, + } as unknown) as ApiResponse); + const result = await cleanupTasks({ + ...cleanupTasksOpts, + tasks: [taskSO], + }); + expect(esClient.bulk).toHaveBeenCalledWith({ + body: [{ delete: { _index: cleanupTasksOpts.kibanaIndex, _id: 'action_task_params:123' } }], + }); + expect(esClient.bulk).not.toHaveBeenCalledWith({ + body: [{ delete: { _index: cleanupTasksOpts.taskManagerIndex, _id: 'task:123' } }], + }); + expect(result).toEqual({ + success: false, + successCount: 0, + failureCount: 1, + }); + }); +}); diff --git a/x-pack/plugins/actions/server/cleanup_failed_executions/cleanup_tasks.ts b/x-pack/plugins/actions/server/cleanup_failed_executions/cleanup_tasks.ts new file mode 100644 index 0000000000000..3009bfe1a277b --- /dev/null +++ b/x-pack/plugins/actions/server/cleanup_failed_executions/cleanup_tasks.ts @@ -0,0 +1,109 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import { + Logger, + ElasticsearchClient, + SavedObjectsFindResult, + SavedObjectsSerializer, +} from 'kibana/server'; +import { TaskInstance } from '../../../task_manager/server'; +import { SpacesPluginStart } from '../../../spaces/server'; +import { + bulkDelete, + extractBulkResponseDeleteFailures, + getRawActionTaskParamsIdFromTask, +} from './lib'; + +export interface CleanupTasksOpts { + logger: Logger; + esClient: ElasticsearchClient; + tasks: Array>; + spaces?: SpacesPluginStart; + savedObjectsSerializer: SavedObjectsSerializer; + kibanaIndex: string; + taskManagerIndex: string; +} + +export interface CleanupTasksResult { + success: boolean; + successCount: number; + failureCount: number; +} + +/** + * Cleanup tasks + * + * This function receives action execution tasks that are in a failed state, removes + * the linked "action_task_params" object first and then if successful, the task manager's task. + */ +export async function cleanupTasks({ + logger, + esClient, + tasks, + spaces, + savedObjectsSerializer, + kibanaIndex, + taskManagerIndex, +}: CleanupTasksOpts): Promise { + const deserializedTasks = tasks.map((task) => ({ + ...task, + attributes: { + ...task.attributes, + params: + typeof task.attributes.params === 'string' + ? JSON.parse(task.attributes.params) + : task.attributes.params || {}, + }, + })); + + // Remove accumulated action task params + const actionTaskParamIdsToDelete = deserializedTasks.map((task) => + getRawActionTaskParamsIdFromTask({ task, spaces, savedObjectsSerializer }) + ); + const actionTaskParamBulkDeleteResult = await bulkDelete( + esClient, + kibanaIndex, + actionTaskParamIdsToDelete + ); + const failedActionTaskParams = actionTaskParamBulkDeleteResult + ? extractBulkResponseDeleteFailures(actionTaskParamBulkDeleteResult) + : []; + if (failedActionTaskParams?.length) { + logger.debug( + `Failed to delete the following action_task_params [${JSON.stringify( + failedActionTaskParams + )}]` + ); + } + + // Remove accumulated tasks + const taskIdsToDelete = deserializedTasks + .map((task) => { + const rawId = getRawActionTaskParamsIdFromTask({ task, spaces, savedObjectsSerializer }); + // Avoid removing tasks that failed to remove linked objects + if (failedActionTaskParams?.find((item) => item._id === rawId)) { + return null; + } + const rawTaskId = savedObjectsSerializer.generateRawId(undefined, 'task', task.id); + return rawTaskId; + }) + .filter((id) => !!id) as string[]; + const taskBulkDeleteResult = await bulkDelete(esClient, taskManagerIndex, taskIdsToDelete); + const failedTasks = taskBulkDeleteResult + ? extractBulkResponseDeleteFailures(taskBulkDeleteResult) + : []; + if (failedTasks?.length) { + logger.debug(`Failed to delete the following tasks [${JSON.stringify(failedTasks)}]`); + } + + return { + success: failedActionTaskParams?.length === 0 && failedTasks.length === 0, + successCount: tasks.length - failedActionTaskParams.length - failedTasks.length, + failureCount: failedActionTaskParams.length + failedTasks.length, + }; +} diff --git a/x-pack/plugins/security_solution/server/graphql/note/index.ts b/x-pack/plugins/actions/server/cleanup_failed_executions/constants.ts similarity index 70% rename from x-pack/plugins/security_solution/server/graphql/note/index.ts rename to x-pack/plugins/actions/server/cleanup_failed_executions/constants.ts index f15ab97ca7676..c8c1d6105586a 100644 --- a/x-pack/plugins/security_solution/server/graphql/note/index.ts +++ b/x-pack/plugins/actions/server/cleanup_failed_executions/constants.ts @@ -5,5 +5,5 @@ * 2.0. */ -export { createNoteResolvers } from './resolvers'; -export { noteSchema } from './schema.gql'; +export const TASK_TYPE = 'cleanup_failed_action_executions'; +export const TASK_ID = `Actions-${TASK_TYPE}`; diff --git a/x-pack/plugins/actions/server/cleanup_failed_executions/ensure_scheduled.test.ts b/x-pack/plugins/actions/server/cleanup_failed_executions/ensure_scheduled.test.ts new file mode 100644 index 0000000000000..3c27a38e818ef --- /dev/null +++ b/x-pack/plugins/actions/server/cleanup_failed_executions/ensure_scheduled.test.ts @@ -0,0 +1,55 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import { schema } from '@kbn/config-schema'; +import { ActionsConfig } from '../config'; +import { ensureScheduled } from './ensure_scheduled'; +import { taskManagerMock } from '../../../task_manager/server/mocks'; +import { loggingSystemMock } from '../../../../../src/core/server/mocks'; + +describe('ensureScheduled', () => { + const logger = loggingSystemMock.create().get(); + const taskManager = taskManagerMock.createStart(); + + const config: ActionsConfig['cleanupFailedExecutionsTask'] = { + enabled: true, + cleanupInterval: schema.duration().validate('5m'), + idleInterval: schema.duration().validate('1h'), + pageSize: 100, + }; + + beforeEach(() => jest.resetAllMocks()); + + it(`should call task manager's ensureScheduled function with proper params`, async () => { + await ensureScheduled(taskManager, logger, config); + expect(taskManager.ensureScheduled).toHaveBeenCalledTimes(1); + expect(taskManager.ensureScheduled.mock.calls[0]).toMatchInlineSnapshot(` + Array [ + Object { + "id": "Actions-cleanup_failed_action_executions", + "params": Object {}, + "schedule": Object { + "interval": "5m", + }, + "state": Object { + "runs": 0, + "total_cleaned_up": 0, + }, + "taskType": "cleanup_failed_action_executions", + }, + ] + `); + }); + + it('should log an error and not throw when ensureScheduled function throws', async () => { + taskManager.ensureScheduled.mockRejectedValue(new Error('Fail')); + await ensureScheduled(taskManager, logger, config); + expect(logger.error).toHaveBeenCalledWith( + 'Error scheduling Actions-cleanup_failed_action_executions, received Fail' + ); + }); +}); diff --git a/x-pack/plugins/actions/server/cleanup_failed_executions/ensure_scheduled.ts b/x-pack/plugins/actions/server/cleanup_failed_executions/ensure_scheduled.ts new file mode 100644 index 0000000000000..6dc1ce44982c1 --- /dev/null +++ b/x-pack/plugins/actions/server/cleanup_failed_executions/ensure_scheduled.ts @@ -0,0 +1,34 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import { Logger } from 'kibana/server'; +import { TASK_ID, TASK_TYPE } from './constants'; +import { ActionsConfig } from '../config'; +import { TaskManagerStartContract, asInterval } from '../../../task_manager/server'; + +export async function ensureScheduled( + taskManager: TaskManagerStartContract, + logger: Logger, + { cleanupInterval }: ActionsConfig['cleanupFailedExecutionsTask'] +) { + try { + await taskManager.ensureScheduled({ + id: TASK_ID, + taskType: TASK_TYPE, + schedule: { + interval: asInterval(cleanupInterval.asMilliseconds()), + }, + state: { + runs: 0, + total_cleaned_up: 0, + }, + params: {}, + }); + } catch (e) { + logger.error(`Error scheduling ${TASK_ID}, received ${e.message}`); + } +} diff --git a/x-pack/plugins/actions/server/cleanup_failed_executions/find_and_cleanup_tasks.test.ts b/x-pack/plugins/actions/server/cleanup_failed_executions/find_and_cleanup_tasks.test.ts new file mode 100644 index 0000000000000..81c2a348bc096 --- /dev/null +++ b/x-pack/plugins/actions/server/cleanup_failed_executions/find_and_cleanup_tasks.test.ts @@ -0,0 +1,167 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import { CoreStart } from 'kibana/server'; +import { schema } from '@kbn/config-schema'; +import { ActionsConfig } from '../config'; +import { ActionsPluginsStart } from '../plugin'; +import { spacesMock } from '../../../spaces/server/mocks'; +import { esKuery } from '../../../../../src/plugins/data/server'; +import { + loggingSystemMock, + savedObjectsRepositoryMock, + savedObjectsServiceMock, + elasticsearchServiceMock, +} from '../../../../../src/core/server/mocks'; +import { actionTypeRegistryMock } from '../action_type_registry.mock'; +import { FindAndCleanupTasksOpts, findAndCleanupTasks } from './find_and_cleanup_tasks'; + +jest.mock('./cleanup_tasks', () => ({ + cleanupTasks: jest.fn(), +})); + +describe('findAndCleanupTasks', () => { + const logger = loggingSystemMock.create().get(); + const actionTypeRegistry = actionTypeRegistryMock.create(); + const savedObjectsRepository = savedObjectsRepositoryMock.create(); + const esStart = elasticsearchServiceMock.createStart(); + const spaces = spacesMock.createStart(); + const soService = savedObjectsServiceMock.createStartContract(); + const coreStartServices = (Promise.resolve([ + { + savedObjects: { + ...soService, + createInternalRepository: () => savedObjectsRepository, + }, + elasticsearch: esStart, + }, + { + spaces, + }, + {}, + ]) as unknown) as Promise<[CoreStart, ActionsPluginsStart, unknown]>; + + const config: ActionsConfig['cleanupFailedExecutionsTask'] = { + enabled: true, + cleanupInterval: schema.duration().validate('5m'), + idleInterval: schema.duration().validate('1h'), + pageSize: 100, + }; + + const findAndCleanupTasksOpts: FindAndCleanupTasksOpts = { + logger, + actionTypeRegistry, + coreStartServices, + config, + kibanaIndex: '.kibana', + taskManagerIndex: '.kibana_task_manager', + }; + + beforeEach(() => { + actionTypeRegistry.list.mockReturnValue([ + { + id: 'my-action-type', + name: 'My action type', + enabled: true, + enabledInConfig: true, + enabledInLicense: true, + minimumLicenseRequired: 'basic', + }, + ]); + jest.requireMock('./cleanup_tasks').cleanupTasks.mockResolvedValue({ + success: true, + successCount: 0, + failureCount: 0, + }); + savedObjectsRepository.find.mockResolvedValue({ + total: 0, + page: 1, + per_page: 10, + saved_objects: [], + }); + }); + + it('should call the find function with proper parameters', async () => { + await findAndCleanupTasks(findAndCleanupTasksOpts); + expect(savedObjectsRepository.find).toHaveBeenCalledWith({ + type: 'task', + filter: expect.any(Object), + page: 1, + perPage: config.pageSize, + sortField: 'runAt', + sortOrder: 'asc', + }); + expect(esKuery.toElasticsearchQuery(savedObjectsRepository.find.mock.calls[0][0].filter)) + .toMatchInlineSnapshot(` + Object { + "bool": Object { + "filter": Array [ + Object { + "bool": Object { + "minimum_should_match": 1, + "should": Array [ + Object { + "match": Object { + "task.attributes.status": "failed", + }, + }, + ], + }, + }, + Object { + "bool": Object { + "minimum_should_match": 1, + "should": Array [ + Object { + "match": Object { + "task.attributes.taskType": "actions:my-action-type", + }, + }, + ], + }, + }, + ], + }, + } + `); + }); + + it('should call the cleanupTasks function with proper parameters', async () => { + await findAndCleanupTasks(findAndCleanupTasksOpts); + expect(jest.requireMock('./cleanup_tasks').cleanupTasks).toHaveBeenCalledWith({ + logger: findAndCleanupTasksOpts.logger, + esClient: esStart.client.asInternalUser, + spaces, + kibanaIndex: findAndCleanupTasksOpts.kibanaIndex, + taskManagerIndex: findAndCleanupTasksOpts.taskManagerIndex, + savedObjectsSerializer: soService.createSerializer(), + tasks: [], + }); + }); + + it('should return the cleanup result', async () => { + const result = await findAndCleanupTasks(findAndCleanupTasksOpts); + expect(result).toEqual({ + success: true, + successCount: 0, + failureCount: 0, + remaining: 0, + }); + }); + + it('should log a message before cleaning up tasks', async () => { + await findAndCleanupTasks(findAndCleanupTasksOpts); + expect(logger.debug).toHaveBeenCalledWith('Removing 0 of 0 failed execution task(s)'); + }); + + it('should log a message after cleaning up tasks', async () => { + await findAndCleanupTasks(findAndCleanupTasksOpts); + expect(logger.debug).toHaveBeenCalledWith( + 'Finished cleanup of failed executions. [success=0, failures=0]' + ); + }); +}); diff --git a/x-pack/plugins/actions/server/cleanup_failed_executions/find_and_cleanup_tasks.ts b/x-pack/plugins/actions/server/cleanup_failed_executions/find_and_cleanup_tasks.ts new file mode 100644 index 0000000000000..0afb82a515b7c --- /dev/null +++ b/x-pack/plugins/actions/server/cleanup_failed_executions/find_and_cleanup_tasks.ts @@ -0,0 +1,80 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import { Logger, CoreStart } from 'kibana/server'; +import { ActionsConfig } from '../config'; +import { ActionsPluginsStart } from '../plugin'; +import { ActionTypeRegistryContract } from '../types'; +import { cleanupTasks, CleanupTasksResult } from './cleanup_tasks'; +import { TaskInstance } from '../../../task_manager/server'; +import { nodeBuilder } from '../../../../../src/plugins/data/common'; + +export interface FindAndCleanupTasksOpts { + logger: Logger; + actionTypeRegistry: ActionTypeRegistryContract; + coreStartServices: Promise<[CoreStart, ActionsPluginsStart, unknown]>; + config: ActionsConfig['cleanupFailedExecutionsTask']; + kibanaIndex: string; + taskManagerIndex: string; +} + +export interface FindAndCleanupTasksResult extends CleanupTasksResult { + remaining: number; +} + +export async function findAndCleanupTasks({ + logger, + actionTypeRegistry, + coreStartServices, + config, + kibanaIndex, + taskManagerIndex, +}: FindAndCleanupTasksOpts): Promise { + logger.debug('Starting cleanup of failed executions'); + const [{ savedObjects, elasticsearch }, { spaces }] = await coreStartServices; + const esClient = elasticsearch.client.asInternalUser; + const savedObjectsClient = savedObjects.createInternalRepository(['task']); + const savedObjectsSerializer = savedObjects.createSerializer(); + + const result = await savedObjectsClient.find({ + type: 'task', + filter: nodeBuilder.and([ + nodeBuilder.is('task.attributes.status', 'failed'), + nodeBuilder.or( + actionTypeRegistry + .list() + .map((actionType) => + nodeBuilder.is('task.attributes.taskType', `actions:${actionType.id}`) + ) + ), + ]), + page: 1, + perPage: config.pageSize, + sortField: 'runAt', + sortOrder: 'asc', + }); + + logger.debug( + `Removing ${result.saved_objects.length} of ${result.total} failed execution task(s)` + ); + const cleanupResult = await cleanupTasks({ + logger, + esClient, + spaces, + kibanaIndex, + taskManagerIndex, + savedObjectsSerializer, + tasks: result.saved_objects, + }); + logger.debug( + `Finished cleanup of failed executions. [success=${cleanupResult.successCount}, failures=${cleanupResult.failureCount}]` + ); + return { + ...cleanupResult, + remaining: result.total - cleanupResult.successCount, + }; +} diff --git a/x-pack/plugins/actions/server/cleanup_failed_executions/index.ts b/x-pack/plugins/actions/server/cleanup_failed_executions/index.ts new file mode 100644 index 0000000000000..e8e93caed4f81 --- /dev/null +++ b/x-pack/plugins/actions/server/cleanup_failed_executions/index.ts @@ -0,0 +1,9 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +export { ensureScheduled as ensureCleanupFailedExecutionsTaskScheduled } from './ensure_scheduled'; +export { registerTaskDefinition as registerCleanupFailedExecutionsTaskDefinition } from './register_task_definition'; diff --git a/x-pack/plugins/actions/server/cleanup_failed_executions/lib/bulk_delete.ts b/x-pack/plugins/actions/server/cleanup_failed_executions/lib/bulk_delete.ts new file mode 100644 index 0000000000000..2e0037d01943d --- /dev/null +++ b/x-pack/plugins/actions/server/cleanup_failed_executions/lib/bulk_delete.ts @@ -0,0 +1,25 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import { ElasticsearchClient } from 'kibana/server'; +import { ApiResponse, estypes } from '@elastic/elasticsearch'; + +export async function bulkDelete( + esClient: ElasticsearchClient, + index: string, + ids: string[] +): Promise | undefined> { + if (ids.length === 0) { + return; + } + + return await esClient.bulk({ + body: ids.map((id) => ({ + delete: { _index: index, _id: id }, + })), + }); +} diff --git a/x-pack/plugins/actions/server/cleanup_failed_executions/lib/extract_bulk_response_delete_failures.ts b/x-pack/plugins/actions/server/cleanup_failed_executions/lib/extract_bulk_response_delete_failures.ts new file mode 100644 index 0000000000000..90418c9763a4d --- /dev/null +++ b/x-pack/plugins/actions/server/cleanup_failed_executions/lib/extract_bulk_response_delete_failures.ts @@ -0,0 +1,29 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import { ApiResponse, estypes } from '@elastic/elasticsearch'; + +type ResponseFailures = Array>; + +export function extractBulkResponseDeleteFailures( + response: ApiResponse +): ResponseFailures { + const result: ResponseFailures = []; + for (const item of response.body.items) { + if (!item.delete || !item.delete.error) { + continue; + } + + result.push({ + _id: item.delete._id, + status: item.delete.status, + result: item.delete.result, + }); + } + + return result; +} diff --git a/x-pack/plugins/actions/server/cleanup_failed_executions/lib/get_raw_action_task_params_id_from_task.ts b/x-pack/plugins/actions/server/cleanup_failed_executions/lib/get_raw_action_task_params_id_from_task.ts new file mode 100644 index 0000000000000..7a9b664387ff4 --- /dev/null +++ b/x-pack/plugins/actions/server/cleanup_failed_executions/lib/get_raw_action_task_params_id_from_task.ts @@ -0,0 +1,27 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import { SavedObjectsFindResult, SavedObjectsSerializer } from 'kibana/server'; +import { spaceIdToNamespace } from '../../lib'; +import { TaskInstance } from '../../../../task_manager/server'; +import { SpacesPluginStart } from '../../../../spaces/server'; + +interface GetRawActionTaskParamsIdFromTaskOpts { + task: SavedObjectsFindResult; + spaces?: SpacesPluginStart; + savedObjectsSerializer: SavedObjectsSerializer; +} + +export function getRawActionTaskParamsIdFromTask({ + task, + spaces, + savedObjectsSerializer, +}: GetRawActionTaskParamsIdFromTaskOpts) { + const { spaceId, actionTaskParamsId } = task.attributes.params; + const namespace = spaceIdToNamespace(spaces, spaceId); + return savedObjectsSerializer.generateRawId(namespace, 'action_task_params', actionTaskParamsId); +} diff --git a/x-pack/plugins/actions/server/cleanup_failed_executions/lib/index.ts b/x-pack/plugins/actions/server/cleanup_failed_executions/lib/index.ts new file mode 100644 index 0000000000000..d332c2e1ef063 --- /dev/null +++ b/x-pack/plugins/actions/server/cleanup_failed_executions/lib/index.ts @@ -0,0 +1,10 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +export { extractBulkResponseDeleteFailures } from './extract_bulk_response_delete_failures'; +export { bulkDelete } from './bulk_delete'; +export { getRawActionTaskParamsIdFromTask } from './get_raw_action_task_params_id_from_task'; diff --git a/x-pack/plugins/actions/server/cleanup_failed_executions/register_task_definition.test.ts b/x-pack/plugins/actions/server/cleanup_failed_executions/register_task_definition.test.ts new file mode 100644 index 0000000000000..a12ab16facdcd --- /dev/null +++ b/x-pack/plugins/actions/server/cleanup_failed_executions/register_task_definition.test.ts @@ -0,0 +1,71 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import { CoreStart } from 'kibana/server'; +import { schema } from '@kbn/config-schema'; +import { ActionsConfig } from '../config'; +import { ActionsPluginsStart } from '../plugin'; +import { registerTaskDefinition } from './register_task_definition'; +import { taskManagerMock } from '../../../task_manager/server/mocks'; +import { loggingSystemMock, coreMock } from '../../../../../src/core/server/mocks'; +import { actionTypeRegistryMock } from '../action_type_registry.mock'; +import { TaskRunnerOpts } from './task_runner'; + +jest.mock('./task_runner', () => ({ taskRunner: jest.fn() })); + +describe('registerTaskDefinition', () => { + const logger = loggingSystemMock.create().get(); + const taskManager = taskManagerMock.createSetup(); + const actionTypeRegistry = actionTypeRegistryMock.create(); + const coreStartServices = coreMock.createSetup().getStartServices() as Promise< + [CoreStart, ActionsPluginsStart, unknown] + >; + + const config: ActionsConfig['cleanupFailedExecutionsTask'] = { + enabled: true, + cleanupInterval: schema.duration().validate('5m'), + idleInterval: schema.duration().validate('1h'), + pageSize: 100, + }; + + const taskRunnerOpts: TaskRunnerOpts = { + logger, + coreStartServices, + actionTypeRegistry, + config, + kibanaIndex: '.kibana', + taskManagerIndex: '.kibana_task_manager', + }; + + beforeEach(() => { + jest.resetAllMocks(); + jest.requireMock('./task_runner').taskRunner.mockReturnValue(jest.fn()); + }); + + it('should call registerTaskDefinitions with proper parameters', () => { + registerTaskDefinition(taskManager, taskRunnerOpts); + expect(taskManager.registerTaskDefinitions).toHaveBeenCalledTimes(1); + expect(taskManager.registerTaskDefinitions.mock.calls).toMatchInlineSnapshot(` + Array [ + Array [ + Object { + "cleanup_failed_action_executions": Object { + "createTaskRunner": [MockFunction], + "title": "Cleanup failed action executions", + }, + }, + ], + ] + `); + }); + + it('should call taskRunner with proper parameters', () => { + registerTaskDefinition(taskManager, taskRunnerOpts); + const { taskRunner } = jest.requireMock('./task_runner'); + expect(taskRunner).toHaveBeenCalledWith(taskRunnerOpts); + }); +}); diff --git a/x-pack/plugins/actions/server/cleanup_failed_executions/register_task_definition.ts b/x-pack/plugins/actions/server/cleanup_failed_executions/register_task_definition.ts new file mode 100644 index 0000000000000..c9a6b486a6463 --- /dev/null +++ b/x-pack/plugins/actions/server/cleanup_failed_executions/register_task_definition.ts @@ -0,0 +1,22 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import { TASK_TYPE } from './constants'; +import { taskRunner, TaskRunnerOpts } from './task_runner'; +import { TaskManagerSetupContract } from '../../../task_manager/server'; + +export function registerTaskDefinition( + taskManager: TaskManagerSetupContract, + taskRunnerOpts: TaskRunnerOpts +) { + taskManager.registerTaskDefinitions({ + [TASK_TYPE]: { + title: 'Cleanup failed action executions', + createTaskRunner: taskRunner(taskRunnerOpts), + }, + }); +} diff --git a/x-pack/plugins/actions/server/cleanup_failed_executions/task_runner.test.ts b/x-pack/plugins/actions/server/cleanup_failed_executions/task_runner.test.ts new file mode 100644 index 0000000000000..d465e532b0284 --- /dev/null +++ b/x-pack/plugins/actions/server/cleanup_failed_executions/task_runner.test.ts @@ -0,0 +1,108 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import { CoreStart } from 'kibana/server'; +import { schema } from '@kbn/config-schema'; +import { ActionsConfig } from '../config'; +import { ActionsPluginsStart } from '../plugin'; +import { ConcreteTaskInstance, TaskStatus } from '../../../task_manager/server'; +import { loggingSystemMock, coreMock } from '../../../../../src/core/server/mocks'; +import { actionTypeRegistryMock } from '../action_type_registry.mock'; +import { taskRunner, TaskRunnerOpts } from './task_runner'; + +jest.mock('./find_and_cleanup_tasks', () => ({ + findAndCleanupTasks: jest.fn(), +})); + +describe('taskRunner', () => { + const logger = loggingSystemMock.create().get(); + const actionTypeRegistry = actionTypeRegistryMock.create(); + const coreStartServices = coreMock.createSetup().getStartServices() as Promise< + [CoreStart, ActionsPluginsStart, unknown] + >; + + const config: ActionsConfig['cleanupFailedExecutionsTask'] = { + enabled: true, + cleanupInterval: schema.duration().validate('5m'), + idleInterval: schema.duration().validate('1h'), + pageSize: 100, + }; + + const taskRunnerOpts: TaskRunnerOpts = { + logger, + coreStartServices, + actionTypeRegistry, + config, + kibanaIndex: '.kibana', + taskManagerIndex: '.kibana_task_manager', + }; + + const taskInstance: ConcreteTaskInstance = { + id: '123', + scheduledAt: new Date(), + attempts: 0, + status: TaskStatus.Running, + state: { runs: 0, total_cleaned_up: 0 }, + runAt: new Date(), + startedAt: new Date(), + retryAt: new Date(), + ownerId: '234', + taskType: 'foo', + params: {}, + }; + + beforeEach(() => { + jest.resetAllMocks(); + jest.requireMock('./find_and_cleanup_tasks').findAndCleanupTasks.mockResolvedValue({ + success: true, + successCount: 1, + failureCount: 1, + remaining: 0, + }); + }); + + describe('run', () => { + it('should call findAndCleanupTasks with proper parameters', async () => { + const runner = taskRunner(taskRunnerOpts)({ taskInstance }); + await runner.run(); + expect(jest.requireMock('./find_and_cleanup_tasks').findAndCleanupTasks).toHaveBeenCalledWith( + taskRunnerOpts + ); + }); + + it('should update state to reflect cleanup result', async () => { + const runner = taskRunner(taskRunnerOpts)({ taskInstance }); + const { state } = await runner.run(); + expect(state).toEqual({ + runs: 1, + total_cleaned_up: 1, + }); + }); + + it('should return idle schedule when no remaining tasks to cleanup', async () => { + const runner = taskRunner(taskRunnerOpts)({ taskInstance }); + const { schedule } = await runner.run(); + expect(schedule).toEqual({ + interval: '60m', + }); + }); + + it('should return cleanup schedule when there are some remaining tasks to cleanup', async () => { + jest.requireMock('./find_and_cleanup_tasks').findAndCleanupTasks.mockResolvedValue({ + success: true, + successCount: 1, + failureCount: 1, + remaining: 1, + }); + const runner = taskRunner(taskRunnerOpts)({ taskInstance }); + const { schedule } = await runner.run(); + expect(schedule).toEqual({ + interval: '5m', + }); + }); + }); +}); diff --git a/x-pack/plugins/actions/server/cleanup_failed_executions/task_runner.ts b/x-pack/plugins/actions/server/cleanup_failed_executions/task_runner.ts new file mode 100644 index 0000000000000..38eb672238c7f --- /dev/null +++ b/x-pack/plugins/actions/server/cleanup_failed_executions/task_runner.ts @@ -0,0 +1,45 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import { Logger, CoreStart } from 'kibana/server'; +import { ActionsConfig } from '../config'; +import { RunContext, asInterval } from '../../../task_manager/server'; +import { ActionsPluginsStart } from '../plugin'; +import { ActionTypeRegistryContract } from '../types'; +import { findAndCleanupTasks } from './find_and_cleanup_tasks'; + +export interface TaskRunnerOpts { + logger: Logger; + actionTypeRegistry: ActionTypeRegistryContract; + coreStartServices: Promise<[CoreStart, ActionsPluginsStart, unknown]>; + config: ActionsConfig['cleanupFailedExecutionsTask']; + kibanaIndex: string; + taskManagerIndex: string; +} + +export function taskRunner(opts: TaskRunnerOpts) { + return ({ taskInstance }: RunContext) => { + const { state } = taskInstance; + return { + async run() { + const cleanupResult = await findAndCleanupTasks(opts); + return { + state: { + runs: state.runs + 1, + total_cleaned_up: state.total_cleaned_up + cleanupResult.successCount, + }, + schedule: { + interval: + cleanupResult.remaining > 0 + ? asInterval(opts.config.cleanupInterval.asMilliseconds()) + : asInterval(opts.config.idleInterval.asMilliseconds()), + }, + }; + }, + }; + }; +} diff --git a/x-pack/plugins/actions/server/config.test.ts b/x-pack/plugins/actions/server/config.test.ts index ad598bffe04b4..092b5d2cce587 100644 --- a/x-pack/plugins/actions/server/config.test.ts +++ b/x-pack/plugins/actions/server/config.test.ts @@ -23,6 +23,12 @@ describe('config validation', () => { "allowedHosts": Array [ "*", ], + "cleanupFailedExecutionsTask": Object { + "cleanupInterval": "PT5M", + "enabled": true, + "idleInterval": "PT1H", + "pageSize": 100, + }, "enabled": true, "enabledActionTypes": Array [ "*", @@ -58,6 +64,12 @@ describe('config validation', () => { "allowedHosts": Array [ "*", ], + "cleanupFailedExecutionsTask": Object { + "cleanupInterval": "PT5M", + "enabled": true, + "idleInterval": "PT1H", + "pageSize": 100, + }, "enabled": true, "enabledActionTypes": Array [ "*", diff --git a/x-pack/plugins/actions/server/config.ts b/x-pack/plugins/actions/server/config.ts index 36948478816c9..7225c54d57596 100644 --- a/x-pack/plugins/actions/server/config.ts +++ b/x-pack/plugins/actions/server/config.ts @@ -50,6 +50,12 @@ export const configSchema = schema.object({ rejectUnauthorized: schema.boolean({ defaultValue: true }), maxResponseContentLength: schema.byteSize({ defaultValue: '1mb' }), responseTimeout: schema.duration({ defaultValue: '60s' }), + cleanupFailedExecutionsTask: schema.object({ + enabled: schema.boolean({ defaultValue: true }), + cleanupInterval: schema.duration({ defaultValue: '5m' }), + idleInterval: schema.duration({ defaultValue: '1h' }), + pageSize: schema.number({ defaultValue: 100 }), + }), }); export type ActionsConfig = TypeOf; diff --git a/x-pack/plugins/actions/server/lib/audit_events.test.ts b/x-pack/plugins/actions/server/lib/audit_events.test.ts index 6047a97b63c54..b30ccc1fb372b 100644 --- a/x-pack/plugins/actions/server/lib/audit_events.test.ts +++ b/x-pack/plugins/actions/server/lib/audit_events.test.ts @@ -5,7 +5,6 @@ * 2.0. */ -import { EventOutcome } from '../../../security/server/audit'; import { ConnectorAuditAction, connectorAuditEvent } from './audit_events'; describe('#connectorAuditEvent', () => { @@ -13,7 +12,7 @@ describe('#connectorAuditEvent', () => { expect( connectorAuditEvent({ action: ConnectorAuditAction.CREATE, - outcome: EventOutcome.UNKNOWN, + outcome: 'unknown', savedObject: { type: 'action', id: 'ACTION_ID' }, }) ).toMatchInlineSnapshot(` @@ -21,9 +20,13 @@ describe('#connectorAuditEvent', () => { "error": undefined, "event": Object { "action": "connector_create", - "category": "database", + "category": Array [ + "database", + ], "outcome": "unknown", - "type": "creation", + "type": Array [ + "creation", + ], }, "kibana": Object { "saved_object": Object { @@ -47,9 +50,13 @@ describe('#connectorAuditEvent', () => { "error": undefined, "event": Object { "action": "connector_create", - "category": "database", + "category": Array [ + "database", + ], "outcome": "success", - "type": "creation", + "type": Array [ + "creation", + ], }, "kibana": Object { "saved_object": Object { @@ -77,9 +84,13 @@ describe('#connectorAuditEvent', () => { }, "event": Object { "action": "connector_create", - "category": "database", + "category": Array [ + "database", + ], "outcome": "failure", - "type": "creation", + "type": Array [ + "creation", + ], }, "kibana": Object { "saved_object": Object { diff --git a/x-pack/plugins/actions/server/lib/audit_events.ts b/x-pack/plugins/actions/server/lib/audit_events.ts index f80fa00e11641..5231c9bab7c37 100644 --- a/x-pack/plugins/actions/server/lib/audit_events.ts +++ b/x-pack/plugins/actions/server/lib/audit_events.ts @@ -5,7 +5,8 @@ * 2.0. */ -import { AuditEvent, EventOutcome, EventCategory, EventType } from '../../../security/server'; +import type { EcsEventOutcome, EcsEventType } from 'src/core/server'; +import { AuditEvent } from '../../../security/server'; export enum ConnectorAuditAction { CREATE = 'connector_create', @@ -27,18 +28,18 @@ const eventVerbs: Record = { connector_execute: ['execute', 'executing', 'executed'], }; -const eventTypes: Record = { - connector_create: EventType.CREATION, - connector_get: EventType.ACCESS, - connector_update: EventType.CHANGE, - connector_delete: EventType.DELETION, - connector_find: EventType.ACCESS, +const eventTypes: Record = { + connector_create: 'creation', + connector_get: 'access', + connector_update: 'change', + connector_delete: 'deletion', + connector_find: 'access', connector_execute: undefined, }; export interface ConnectorAuditEventParams { action: ConnectorAuditAction; - outcome?: EventOutcome; + outcome?: EcsEventOutcome; savedObject?: NonNullable['saved_object']; error?: Error; } @@ -53,7 +54,7 @@ export function connectorAuditEvent({ const [present, progressive, past] = eventVerbs[action]; const message = error ? `Failed attempt to ${present} ${doc}` - : outcome === EventOutcome.UNKNOWN + : outcome === 'unknown' ? `User is ${progressive} ${doc}` : `User has ${past} ${doc}`; const type = eventTypes[action]; @@ -62,9 +63,9 @@ export function connectorAuditEvent({ message, event: { action, - category: EventCategory.DATABASE, - type, - outcome: outcome ?? (error ? EventOutcome.FAILURE : EventOutcome.SUCCESS), + category: ['database'], + type: type ? [type] : undefined, + outcome: outcome ?? (error ? 'failure' : 'success'), }, kibana: { saved_object: savedObject, diff --git a/x-pack/plugins/actions/server/lib/index.ts b/x-pack/plugins/actions/server/lib/index.ts index e900b81bb65a0..fba47f9a0f995 100644 --- a/x-pack/plugins/actions/server/lib/index.ts +++ b/x-pack/plugins/actions/server/lib/index.ts @@ -12,6 +12,7 @@ export { ActionExecutor, ActionExecutorContract } from './action_executor'; export { ILicenseState, LicenseState } from './license_state'; export { verifyApiAccess } from './verify_api_access'; export { getActionTypeFeatureUsageName } from './get_action_type_feature_usage_name'; +export { spaceIdToNamespace } from './space_id_to_namespace'; export { ActionTypeDisabledError, ActionTypeDisabledReason, diff --git a/x-pack/plugins/actions/server/lib/space_id_to_namespace.ts b/x-pack/plugins/actions/server/lib/space_id_to_namespace.ts new file mode 100644 index 0000000000000..826c4e44b2b85 --- /dev/null +++ b/x-pack/plugins/actions/server/lib/space_id_to_namespace.ts @@ -0,0 +1,12 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import { SpacesPluginStart } from '../../../spaces/server'; + +export function spaceIdToNamespace(spaces?: SpacesPluginStart, spaceId?: string) { + return spaces && spaceId ? spaces.spacesService.spaceIdToNamespace(spaceId) : undefined; +} diff --git a/x-pack/plugins/actions/server/plugin.test.ts b/x-pack/plugins/actions/server/plugin.test.ts index 3485891a01267..9464421d5f0fb 100644 --- a/x-pack/plugins/actions/server/plugin.test.ts +++ b/x-pack/plugins/actions/server/plugin.test.ts @@ -6,7 +6,7 @@ */ import moment from 'moment'; -import { ByteSizeValue } from '@kbn/config-schema'; +import { schema, ByteSizeValue } from '@kbn/config-schema'; import { PluginInitializerContext, RequestHandlerContext } from '../../../../src/core/server'; import { coreMock, httpServerMock } from '../../../../src/core/server/mocks'; import { usageCollectionPluginMock } from '../../../../src/plugins/usage_collection/server/mocks'; @@ -43,6 +43,12 @@ describe('Actions Plugin', () => { rejectUnauthorized: true, maxResponseContentLength: new ByteSizeValue(1000000), responseTimeout: moment.duration(60000), + cleanupFailedExecutionsTask: { + enabled: true, + cleanupInterval: schema.duration().validate('5m'), + idleInterval: schema.duration().validate('1h'), + pageSize: 100, + }, }); plugin = new ActionsPlugin(context); coreSetup = coreMock.createSetup(); @@ -207,6 +213,12 @@ describe('Actions Plugin', () => { rejectUnauthorized: true, maxResponseContentLength: new ByteSizeValue(1000000), responseTimeout: moment.duration(60000), + cleanupFailedExecutionsTask: { + enabled: true, + cleanupInterval: schema.duration().validate('5m'), + idleInterval: schema.duration().validate('1h'), + pageSize: 100, + }, }); plugin = new ActionsPlugin(context); coreSetup = coreMock.createSetup(); @@ -274,6 +286,12 @@ describe('Actions Plugin', () => { rejectUnauthorized: true, maxResponseContentLength: new ByteSizeValue(1000000), responseTimeout: moment.duration('60s'), + cleanupFailedExecutionsTask: { + enabled: true, + cleanupInterval: schema.duration().validate('5m'), + idleInterval: schema.duration().validate('1h'), + pageSize: 100, + }, ...overrides, }; } diff --git a/x-pack/plugins/actions/server/plugin.ts b/x-pack/plugins/actions/server/plugin.ts index 1d941617789b7..106e41259e692 100644 --- a/x-pack/plugins/actions/server/plugin.ts +++ b/x-pack/plugins/actions/server/plugin.ts @@ -26,17 +26,27 @@ import { } from '../../encrypted_saved_objects/server'; import { TaskManagerSetupContract, TaskManagerStartContract } from '../../task_manager/server'; import { LicensingPluginSetup, LicensingPluginStart } from '../../licensing/server'; -import { SpacesPluginStart } from '../../spaces/server'; +import { SpacesPluginStart, SpacesPluginSetup } from '../../spaces/server'; import { PluginSetupContract as FeaturesPluginSetup } from '../../features/server'; import { SecurityPluginSetup } from '../../security/server'; +import { + ensureCleanupFailedExecutionsTaskScheduled, + registerCleanupFailedExecutionsTaskDefinition, +} from './cleanup_failed_executions'; import { ActionsConfig, getValidatedConfig } from './config'; -import { ActionExecutor, TaskRunnerFactory, LicenseState, ILicenseState } from './lib'; import { ActionsClient } from './actions_client'; import { ActionTypeRegistry } from './action_type_registry'; import { createExecutionEnqueuerFunction } from './create_execute_function'; import { registerBuiltInActionTypes } from './builtin_action_types'; import { registerActionsUsageCollector } from './usage'; +import { + ActionExecutor, + TaskRunnerFactory, + LicenseState, + ILicenseState, + spaceIdToNamespace, +} from './lib'; import { Services, ActionType, @@ -115,6 +125,7 @@ export interface ActionsPluginsSetup { usageCollection?: UsageCollectionSetup; security?: SecurityPluginSetup; features: FeaturesPluginSetup; + spaces?: SpacesPluginSetup; } export interface ActionsPluginsStart { encryptedSavedObjects: EncryptedSavedObjectsPluginStart; @@ -245,6 +256,18 @@ export class ActionsPlugin implements Plugin(), this.licenseState); + // Cleanup failed execution task definition + if (this.actionsConfig.cleanupFailedExecutionsTask.enabled) { + registerCleanupFailedExecutionsTaskDefinition(plugins.taskManager, { + actionTypeRegistry, + logger: this.logger, + coreStartServices: core.getStartServices(), + config: this.actionsConfig.cleanupFailedExecutionsTask, + kibanaIndex: this.kibanaIndexConfig.kibana.index, + taskManagerIndex: plugins.taskManager.index, + }); + } + return { registerType: < Config extends ActionTypeConfig = ActionTypeConfig, @@ -352,18 +375,12 @@ export class ActionsPlugin implements Plugin { - return plugins.spaces && spaceId - ? plugins.spaces.spacesService.spaceIdToNamespace(spaceId) - : undefined; - }; - taskRunnerFactory!.initialize({ logger, actionTypeRegistry: actionTypeRegistry!, encryptedSavedObjectsClient, basePathService: core.http.basePath, - spaceIdToNamespace, + spaceIdToNamespace: (spaceId?: string) => spaceIdToNamespace(plugins.spaces, spaceId), getUnsecuredSavedObjectsClient: (request: KibanaRequest) => this.getUnsecuredSavedObjectsClient(core.savedObjects, request), }); @@ -377,6 +394,15 @@ export class ActionsPlugin implements Plugin { return this.actionTypeRegistry!.isActionTypeEnabled(id, options); diff --git a/x-pack/plugins/actions/server/saved_objects/migrations.ts b/x-pack/plugins/actions/server/saved_objects/migrations.ts index 9b8b887fbec28..9bd54330f5d05 100644 --- a/x-pack/plugins/actions/server/saved_objects/migrations.ts +++ b/x-pack/plugins/actions/server/saved_objects/migrations.ts @@ -6,6 +6,7 @@ */ import { + LogMeta, SavedObjectMigrationMap, SavedObjectUnsanitizedDoc, SavedObjectMigrationFn, @@ -14,6 +15,10 @@ import { import { RawAction } from '../types'; import { EncryptedSavedObjectsPluginSetup } from '../../../encrypted_saved_objects/server'; +interface ActionsLogMeta extends LogMeta { + migrations: { actionDocument: SavedObjectUnsanitizedDoc }; +} + type ActionMigration = ( doc: SavedObjectUnsanitizedDoc ) => SavedObjectUnsanitizedDoc; @@ -50,9 +55,13 @@ function executeMigrationWithErrorHandling( try { return migrationFunc(doc, context); } catch (ex) { - context.log.error( + context.log.error( `encryptedSavedObject ${version} migration failed for action ${doc.id} with error: ${ex.message}`, - { actionDocument: doc } + { + migrations: { + actionDocument: doc, + }, + } ); } return doc; diff --git a/x-pack/plugins/alerting/server/alerts_client/alerts_client.ts b/x-pack/plugins/alerting/server/alerts_client/alerts_client.ts index e316ecd3c6fec..210bdf954ada4 100644 --- a/x-pack/plugins/alerting/server/alerts_client/alerts_client.ts +++ b/x-pack/plugins/alerting/server/alerts_client/alerts_client.ts @@ -51,7 +51,7 @@ import { IEventLogClient } from '../../../../plugins/event_log/server'; import { parseIsoOrRelativeDate } from '../lib/iso_or_relative_date'; import { alertInstanceSummaryFromEventLog } from '../lib/alert_instance_summary_from_event_log'; import { IEvent } from '../../../event_log/server'; -import { AuditLogger, EventOutcome } from '../../../security/server'; +import { AuditLogger } from '../../../security/server'; import { parseDuration } from '../../common/parse_duration'; import { retryIfConflicts } from '../lib/retry_if_conflicts'; import { partiallyUpdateAlert } from '../saved_objects'; @@ -293,7 +293,7 @@ export class AlertsClient { this.auditLogger?.log( alertAuditEvent({ action: AlertAuditAction.CREATE, - outcome: EventOutcome.UNKNOWN, + outcome: 'unknown', savedObject: { type: 'alert', id }, }) ); @@ -598,7 +598,7 @@ export class AlertsClient { this.auditLogger?.log( alertAuditEvent({ action: AlertAuditAction.DELETE, - outcome: EventOutcome.UNKNOWN, + outcome: 'unknown', savedObject: { type: 'alert', id }, }) ); @@ -671,7 +671,7 @@ export class AlertsClient { this.auditLogger?.log( alertAuditEvent({ action: AlertAuditAction.UPDATE, - outcome: EventOutcome.UNKNOWN, + outcome: 'unknown', savedObject: { type: 'alert', id }, }) ); @@ -850,7 +850,7 @@ export class AlertsClient { this.auditLogger?.log( alertAuditEvent({ action: AlertAuditAction.UPDATE_API_KEY, - outcome: EventOutcome.UNKNOWN, + outcome: 'unknown', savedObject: { type: 'alert', id }, }) ); @@ -935,7 +935,7 @@ export class AlertsClient { this.auditLogger?.log( alertAuditEvent({ action: AlertAuditAction.ENABLE, - outcome: EventOutcome.UNKNOWN, + outcome: 'unknown', savedObject: { type: 'alert', id }, }) ); @@ -1036,7 +1036,7 @@ export class AlertsClient { this.auditLogger?.log( alertAuditEvent({ action: AlertAuditAction.DISABLE, - outcome: EventOutcome.UNKNOWN, + outcome: 'unknown', savedObject: { type: 'alert', id }, }) ); @@ -1112,7 +1112,7 @@ export class AlertsClient { this.auditLogger?.log( alertAuditEvent({ action: AlertAuditAction.MUTE, - outcome: EventOutcome.UNKNOWN, + outcome: 'unknown', savedObject: { type: 'alert', id }, }) ); @@ -1173,7 +1173,7 @@ export class AlertsClient { this.auditLogger?.log( alertAuditEvent({ action: AlertAuditAction.UNMUTE, - outcome: EventOutcome.UNKNOWN, + outcome: 'unknown', savedObject: { type: 'alert', id }, }) ); @@ -1234,7 +1234,7 @@ export class AlertsClient { this.auditLogger?.log( alertAuditEvent({ action: AlertAuditAction.MUTE_INSTANCE, - outcome: EventOutcome.UNKNOWN, + outcome: 'unknown', savedObject: { type: 'alert', id: alertId }, }) ); @@ -1300,7 +1300,7 @@ export class AlertsClient { this.auditLogger?.log( alertAuditEvent({ action: AlertAuditAction.UNMUTE_INSTANCE, - outcome: EventOutcome.UNKNOWN, + outcome: 'unknown', savedObject: { type: 'alert', id: alertId }, }) ); diff --git a/x-pack/plugins/alerting/server/alerts_client/audit_events.test.ts b/x-pack/plugins/alerting/server/alerts_client/audit_events.test.ts index fd79e9fac4fd1..4ccb69832cd26 100644 --- a/x-pack/plugins/alerting/server/alerts_client/audit_events.test.ts +++ b/x-pack/plugins/alerting/server/alerts_client/audit_events.test.ts @@ -5,7 +5,6 @@ * 2.0. */ -import { EventOutcome } from '../../../security/server/audit'; import { AlertAuditAction, alertAuditEvent } from './audit_events'; describe('#alertAuditEvent', () => { @@ -13,7 +12,7 @@ describe('#alertAuditEvent', () => { expect( alertAuditEvent({ action: AlertAuditAction.CREATE, - outcome: EventOutcome.UNKNOWN, + outcome: 'unknown', savedObject: { type: 'alert', id: 'ALERT_ID' }, }) ).toMatchInlineSnapshot(` @@ -21,9 +20,13 @@ describe('#alertAuditEvent', () => { "error": undefined, "event": Object { "action": "alert_create", - "category": "database", + "category": Array [ + "database", + ], "outcome": "unknown", - "type": "creation", + "type": Array [ + "creation", + ], }, "kibana": Object { "saved_object": Object { @@ -47,9 +50,13 @@ describe('#alertAuditEvent', () => { "error": undefined, "event": Object { "action": "alert_create", - "category": "database", + "category": Array [ + "database", + ], "outcome": "success", - "type": "creation", + "type": Array [ + "creation", + ], }, "kibana": Object { "saved_object": Object { @@ -77,9 +84,13 @@ describe('#alertAuditEvent', () => { }, "event": Object { "action": "alert_create", - "category": "database", + "category": Array [ + "database", + ], "outcome": "failure", - "type": "creation", + "type": Array [ + "creation", + ], }, "kibana": Object { "saved_object": Object { diff --git a/x-pack/plugins/alerting/server/alerts_client/audit_events.ts b/x-pack/plugins/alerting/server/alerts_client/audit_events.ts index 354f58bafd888..93cca255d6ebc 100644 --- a/x-pack/plugins/alerting/server/alerts_client/audit_events.ts +++ b/x-pack/plugins/alerting/server/alerts_client/audit_events.ts @@ -5,7 +5,8 @@ * 2.0. */ -import { AuditEvent, EventOutcome, EventCategory, EventType } from '../../../security/server'; +import { EcsEventOutcome, EcsEventType } from 'src/core/server'; +import { AuditEvent } from '../../../security/server'; export enum AlertAuditAction { CREATE = 'alert_create', @@ -39,24 +40,24 @@ const eventVerbs: Record = { alert_instance_unmute: ['unmute instance of', 'unmuting instance of', 'unmuted instance of'], }; -const eventTypes: Record = { - alert_create: EventType.CREATION, - alert_get: EventType.ACCESS, - alert_update: EventType.CHANGE, - alert_update_api_key: EventType.CHANGE, - alert_enable: EventType.CHANGE, - alert_disable: EventType.CHANGE, - alert_delete: EventType.DELETION, - alert_find: EventType.ACCESS, - alert_mute: EventType.CHANGE, - alert_unmute: EventType.CHANGE, - alert_instance_mute: EventType.CHANGE, - alert_instance_unmute: EventType.CHANGE, +const eventTypes: Record = { + alert_create: 'creation', + alert_get: 'access', + alert_update: 'change', + alert_update_api_key: 'change', + alert_enable: 'change', + alert_disable: 'change', + alert_delete: 'deletion', + alert_find: 'access', + alert_mute: 'change', + alert_unmute: 'change', + alert_instance_mute: 'change', + alert_instance_unmute: 'change', }; export interface AlertAuditEventParams { action: AlertAuditAction; - outcome?: EventOutcome; + outcome?: EcsEventOutcome; savedObject?: NonNullable['saved_object']; error?: Error; } @@ -71,7 +72,7 @@ export function alertAuditEvent({ const [present, progressive, past] = eventVerbs[action]; const message = error ? `Failed attempt to ${present} ${doc}` - : outcome === EventOutcome.UNKNOWN + : outcome === 'unknown' ? `User is ${progressive} ${doc}` : `User has ${past} ${doc}`; const type = eventTypes[action]; @@ -80,9 +81,9 @@ export function alertAuditEvent({ message, event: { action, - category: EventCategory.DATABASE, - type, - outcome: outcome ?? (error ? EventOutcome.FAILURE : EventOutcome.SUCCESS), + category: ['database'], + type: type ? [type] : undefined, + outcome: outcome ?? (error ? 'failure' : 'success'), }, kibana: { saved_object: savedObject, diff --git a/x-pack/plugins/alerting/server/saved_objects/migrations.test.ts b/x-pack/plugins/alerting/server/saved_objects/migrations.test.ts index a080809bbc968..4888116e43602 100644 --- a/x-pack/plugins/alerting/server/saved_objects/migrations.test.ts +++ b/x-pack/plugins/alerting/server/saved_objects/migrations.test.ts @@ -252,10 +252,12 @@ describe('7.10.0 migrates with failure', () => { expect(migrationContext.log.error).toHaveBeenCalledWith( `encryptedSavedObject 7.10.0 migration failed for alert ${alert.id} with error: Can't migrate!`, { - alertDocument: { - ...alert, - attributes: { - ...alert.attributes, + migrations: { + alertDocument: { + ...alert, + attributes: { + ...alert.attributes, + }, }, }, } diff --git a/x-pack/plugins/alerting/server/saved_objects/migrations.ts b/x-pack/plugins/alerting/server/saved_objects/migrations.ts index c9327ed8f186a..8969e3ad0fdef 100644 --- a/x-pack/plugins/alerting/server/saved_objects/migrations.ts +++ b/x-pack/plugins/alerting/server/saved_objects/migrations.ts @@ -6,6 +6,7 @@ */ import { + LogMeta, SavedObjectMigrationMap, SavedObjectUnsanitizedDoc, SavedObjectMigrationFn, @@ -20,6 +21,10 @@ const SIEM_APP_ID = 'securitySolution'; const SIEM_SERVER_APP_ID = 'siem'; export const LEGACY_LAST_MODIFIED_VERSION = 'pre-7.10.0'; +interface AlertLogMeta extends LogMeta { + migrations: { alertDocument: SavedObjectUnsanitizedDoc }; +} + type AlertMigration = ( doc: SavedObjectUnsanitizedDoc ) => SavedObjectUnsanitizedDoc; @@ -84,9 +89,13 @@ function executeMigrationWithErrorHandling( try { return migrationFunc(doc, context); } catch (ex) { - context.log.error( + context.log.error( `encryptedSavedObject ${version} migration failed for alert ${doc.id} with error: ${ex.message}`, - { alertDocument: doc } + { + migrations: { + alertDocument: doc, + }, + } ); } return doc; diff --git a/x-pack/plugins/apm/common/__snapshots__/apm_telemetry.test.ts.snap b/x-pack/plugins/apm/common/__snapshots__/apm_telemetry.test.ts.snap index 14343bd8d52c4..d7fc8e6442f12 100644 --- a/x-pack/plugins/apm/common/__snapshots__/apm_telemetry.test.ts.snap +++ b/x-pack/plugins/apm/common/__snapshots__/apm_telemetry.test.ts.snap @@ -28,6 +28,9 @@ exports[`APM telemetry helpers getApmTelemetry generates a JSON object with the "nodejs": { "type": "long" }, + "php": { + "type": "long" + }, "python": { "type": "long" }, @@ -344,6 +347,60 @@ exports[`APM telemetry helpers getApmTelemetry generates a JSON object with the } } }, + "php": { + "properties": { + "agent": { + "properties": { + "version": { + "type": "keyword" + } + } + }, + "service": { + "properties": { + "framework": { + "properties": { + "name": { + "type": "keyword" + }, + "version": { + "type": "keyword" + }, + "composite": { + "type": "keyword" + } + } + }, + "language": { + "properties": { + "name": { + "type": "keyword" + }, + "version": { + "type": "keyword" + }, + "composite": { + "type": "keyword" + } + } + }, + "runtime": { + "properties": { + "name": { + "type": "keyword" + }, + "version": { + "type": "keyword" + }, + "composite": { + "type": "keyword" + } + } + } + } + } + } + }, "python": { "properties": { "agent": { diff --git a/x-pack/plugins/apm/common/__snapshots__/elasticsearch_fieldnames.test.ts.snap b/x-pack/plugins/apm/common/__snapshots__/elasticsearch_fieldnames.test.ts.snap index cc1b6688daa46..67cf7977974d7 100644 --- a/x-pack/plugins/apm/common/__snapshots__/elasticsearch_fieldnames.test.ts.snap +++ b/x-pack/plugins/apm/common/__snapshots__/elasticsearch_fieldnames.test.ts.snap @@ -23,8 +23,14 @@ Object { } `; +exports[`Error CLOUD_ACCOUNT_ID 1`] = `undefined`; + exports[`Error CLOUD_AVAILABILITY_ZONE 1`] = `"europe-west1-c"`; +exports[`Error CLOUD_INSTANCE_ID 1`] = `undefined`; + +exports[`Error CLOUD_INSTANCE_NAME 1`] = `undefined`; + exports[`Error CLOUD_MACHINE_TYPE 1`] = `undefined`; exports[`Error CLOUD_PROVIDER 1`] = `"gcp"`; @@ -258,8 +264,14 @@ Object { } `; +exports[`Span CLOUD_ACCOUNT_ID 1`] = `undefined`; + exports[`Span CLOUD_AVAILABILITY_ZONE 1`] = `"europe-west1-c"`; +exports[`Span CLOUD_INSTANCE_ID 1`] = `undefined`; + +exports[`Span CLOUD_INSTANCE_NAME 1`] = `undefined`; + exports[`Span CLOUD_MACHINE_TYPE 1`] = `undefined`; exports[`Span CLOUD_PROVIDER 1`] = `"gcp"`; @@ -485,8 +497,14 @@ Object { } `; +exports[`Transaction CLOUD_ACCOUNT_ID 1`] = `undefined`; + exports[`Transaction CLOUD_AVAILABILITY_ZONE 1`] = `"europe-west1-c"`; +exports[`Transaction CLOUD_INSTANCE_ID 1`] = `undefined`; + +exports[`Transaction CLOUD_INSTANCE_NAME 1`] = `undefined`; + exports[`Transaction CLOUD_MACHINE_TYPE 1`] = `undefined`; exports[`Transaction CLOUD_PROVIDER 1`] = `"gcp"`; diff --git a/x-pack/plugins/apm/common/agent_configuration/setting_definitions/general_settings.ts b/x-pack/plugins/apm/common/agent_configuration/setting_definitions/general_settings.ts index 1e18fe663ef20..0e565e1d88030 100644 --- a/x-pack/plugins/apm/common/agent_configuration/setting_definitions/general_settings.ts +++ b/x-pack/plugins/apm/common/agent_configuration/setting_definitions/general_settings.ts @@ -26,7 +26,7 @@ export const generalSettings: RawSettingDefinition[] = [ 'The maximum total compressed size of the request body which is sent to the APM Server intake api via a chunked encoding (HTTP streaming).\nNote that a small overshoot is possible.\n\nAllowed byte units are `b`, `kb` and `mb`. `1kb` is equal to `1024b`.', } ), - excludeAgents: ['js-base', 'rum-js', 'dotnet', 'go', 'nodejs'], + excludeAgents: ['js-base', 'rum-js', 'dotnet', 'go', 'nodejs', 'php'], }, // API Request Time @@ -44,7 +44,7 @@ export const generalSettings: RawSettingDefinition[] = [ "Maximum time to keep an HTTP request to the APM Server open for.\n\nNOTE: This value has to be lower than the APM Server's `read_timeout` setting.", } ), - excludeAgents: ['js-base', 'rum-js', 'dotnet', 'go', 'nodejs'], + excludeAgents: ['js-base', 'rum-js', 'dotnet', 'go', 'nodejs', 'php'], }, // Capture body @@ -69,7 +69,7 @@ export const generalSettings: RawSettingDefinition[] = [ { text: 'transactions', value: 'transactions' }, { text: 'all', value: 'all' }, ], - excludeAgents: ['js-base', 'rum-js'], + excludeAgents: ['js-base', 'rum-js', 'php'], }, // Capture headers @@ -87,7 +87,7 @@ export const generalSettings: RawSettingDefinition[] = [ 'If set to `true`, the agent will capture HTTP request and response headers (including cookies), as well as message headers/properties when using messaging frameworks (like Kafka).\n\nNOTE: Setting this to `false` reduces network bandwidth, disk space and object allocations.', } ), - excludeAgents: ['js-base', 'rum-js', 'nodejs'], + excludeAgents: ['js-base', 'rum-js', 'nodejs', 'php'], }, // LOG_LEVEL @@ -111,7 +111,7 @@ export const generalSettings: RawSettingDefinition[] = [ { text: 'critical', value: 'critical' }, { text: 'off', value: 'off' }, ], - includeAgents: ['dotnet', 'ruby', 'java', 'python', 'nodejs', 'go'], + includeAgents: ['dotnet', 'ruby', 'java', 'python', 'nodejs', 'go', 'php'], }, // Recording @@ -163,7 +163,7 @@ export const generalSettings: RawSettingDefinition[] = [ 'In its default settings, the APM agent will collect a stack trace with every recorded span.\nWhile this is very helpful to find the exact place in your code that causes the span, collecting this stack trace does have some overhead. \nWhen setting this option to a negative value, like `-1ms`, stack traces will be collected for all spans. Setting it to a positive value, e.g. `5ms`, will limit stack trace collection to spans with durations equal to or longer than the given value, e.g. 5 milliseconds.\n\nTo disable stack trace collection for spans completely, set the value to `0ms`.', } ), - excludeAgents: ['js-base', 'rum-js', 'nodejs'], + excludeAgents: ['js-base', 'rum-js', 'nodejs', 'php'], }, // STACK_TRACE_LIMIT diff --git a/x-pack/plugins/apm/common/agent_configuration/setting_definitions/index.test.ts b/x-pack/plugins/apm/common/agent_configuration/setting_definitions/index.test.ts index a4560eb2ae17d..0ffa21cbd4a4d 100644 --- a/x-pack/plugins/apm/common/agent_configuration/setting_definitions/index.test.ts +++ b/x-pack/plugins/apm/common/agent_configuration/setting_definitions/index.test.ts @@ -157,9 +157,17 @@ describe('filterByAgent', () => { ]); }); + it('php', () => { + expect(getSettingKeysForAgent('php')).toEqual([ + 'log_level', + 'recording', + 'transaction_max_spans', + 'transaction_sample_rate', + ]); + }); + it('"All" services (no agent name)', () => { expect(getSettingKeysForAgent(undefined)).toEqual([ - 'capture_body', 'transaction_max_spans', 'transaction_sample_rate', ]); diff --git a/x-pack/plugins/apm/common/elasticsearch_fieldnames.ts b/x-pack/plugins/apm/common/elasticsearch_fieldnames.ts index ffd05b281208d..4b77a88e54007 100644 --- a/x-pack/plugins/apm/common/elasticsearch_fieldnames.ts +++ b/x-pack/plugins/apm/common/elasticsearch_fieldnames.ts @@ -10,6 +10,9 @@ export const CLOUD_AVAILABILITY_ZONE = 'cloud.availability_zone'; export const CLOUD_PROVIDER = 'cloud.provider'; export const CLOUD_REGION = 'cloud.region'; export const CLOUD_MACHINE_TYPE = 'cloud.machine.type'; +export const CLOUD_ACCOUNT_ID = 'cloud.account.id'; +export const CLOUD_INSTANCE_ID = 'cloud.instance.id'; +export const CLOUD_INSTANCE_NAME = 'cloud.instance.name'; export const SERVICE = 'service'; export const SERVICE_NAME = 'service.name'; diff --git a/x-pack/plugins/apm/public/application/application.test.tsx b/x-pack/plugins/apm/public/application/application.test.tsx index 7df6ca343426c..e6415f76c60dc 100644 --- a/x-pack/plugins/apm/public/application/application.test.tsx +++ b/x-pack/plugins/apm/public/application/application.test.tsx @@ -8,9 +8,8 @@ import { act } from '@testing-library/react'; import { createMemoryHistory } from 'history'; import { Observable } from 'rxjs'; -import { AppMountParameters, CoreStart } from 'src/core/public'; +import { CoreStart } from 'src/core/public'; import { mockApmPluginContextValue } from '../context/apm_plugin/mock_apm_plugin_context'; -import { ApmPluginSetupDeps, ApmPluginStartDeps } from '../plugin'; import { createCallApmApi } from '../services/rest/createCallApmApi'; import { renderApp } from './'; import { disableConsoleWarning } from '../utils/testHelpers'; @@ -40,7 +39,7 @@ describe('renderApp', () => { }); it('renders the app', () => { - const { core, config } = mockApmPluginContextValue; + const { core, config, apmRuleRegistry } = mockApmPluginContextValue; const plugins = { licensing: { license$: new Observable() }, triggersActionsUi: { actionTypeRegistry: {}, alertTypeRegistry: {} }, @@ -87,13 +86,14 @@ describe('renderApp', () => { let unmount: () => void; act(() => { - unmount = renderApp( - (core as unknown) as CoreStart, - (plugins as unknown) as ApmPluginSetupDeps, - (params as unknown) as AppMountParameters, + unmount = renderApp({ + coreStart: core as any, + pluginsSetup: plugins as any, + appMountParameters: params as any, + pluginsStart: startDeps as any, config, - (startDeps as unknown) as ApmPluginStartDeps - ); + apmRuleRegistry, + }); }); expect(() => { diff --git a/x-pack/plugins/apm/public/application/csmApp.tsx b/x-pack/plugins/apm/public/application/csmApp.tsx index 787b15d0a5675..b1cfd59a37cec 100644 --- a/x-pack/plugins/apm/public/application/csmApp.tsx +++ b/x-pack/plugins/apm/public/application/csmApp.tsx @@ -26,7 +26,11 @@ import { ApmPluginContext } from '../context/apm_plugin/apm_plugin_context'; import { UrlParamsProvider } from '../context/url_params_context/url_params_context'; import { useBreadcrumbs } from '../hooks/use_breadcrumbs'; import { ConfigSchema } from '../index'; -import { ApmPluginSetupDeps, ApmPluginStartDeps } from '../plugin'; +import { + ApmPluginSetupDeps, + ApmPluginStartDeps, + ApmRuleRegistry, +} from '../plugin'; import { createCallApmApi } from '../services/rest/createCallApmApi'; import { px, units } from '../style/variables'; import { createStaticIndexPattern } from '../services/rest/index_pattern'; @@ -72,12 +76,14 @@ export function CsmAppRoot({ deps, config, corePlugins: { embeddable, maps }, + apmRuleRegistry, }: { appMountParameters: AppMountParameters; core: CoreStart; deps: ApmPluginSetupDeps; config: ConfigSchema; corePlugins: ApmPluginStartDeps; + apmRuleRegistry: ApmRuleRegistry; }) { const { history } = appMountParameters; const i18nCore = core.i18n; @@ -87,7 +93,9 @@ export function CsmAppRoot({ config, core, plugins, + apmRuleRegistry, }; + return ( @@ -109,13 +117,21 @@ export function CsmAppRoot({ * This module is rendered asynchronously in the Kibana platform. */ -export const renderApp = ( - core: CoreStart, - deps: ApmPluginSetupDeps, - appMountParameters: AppMountParameters, - config: ConfigSchema, - corePlugins: ApmPluginStartDeps -) => { +export const renderApp = ({ + core, + deps, + appMountParameters, + config, + corePlugins, + apmRuleRegistry, +}: { + core: CoreStart; + deps: ApmPluginSetupDeps; + appMountParameters: AppMountParameters; + config: ConfigSchema; + corePlugins: ApmPluginStartDeps; + apmRuleRegistry: ApmRuleRegistry; +}) => { const { element } = appMountParameters; createCallApmApi(core); @@ -133,6 +149,7 @@ export const renderApp = ( deps={deps} config={config} corePlugins={corePlugins} + apmRuleRegistry={apmRuleRegistry} />, element ); diff --git a/x-pack/plugins/apm/public/application/index.tsx b/x-pack/plugins/apm/public/application/index.tsx index bc14bc1531686..acb55a02599f1 100644 --- a/x-pack/plugins/apm/public/application/index.tsx +++ b/x-pack/plugins/apm/public/application/index.tsx @@ -30,7 +30,11 @@ import { import { LicenseProvider } from '../context/license/license_context'; import { UrlParamsProvider } from '../context/url_params_context/url_params_context'; import { useBreadcrumbs } from '../hooks/use_breadcrumbs'; -import { ApmPluginSetupDeps, ApmPluginStartDeps } from '../plugin'; +import { + ApmPluginSetupDeps, + ApmPluginStartDeps, + ApmRuleRegistry, +} from '../plugin'; import { createCallApmApi } from '../services/rest/createCallApmApi'; import { createStaticIndexPattern } from '../services/rest/index_pattern'; import { setHelpExtension } from '../setHelpExtension'; @@ -102,25 +106,34 @@ export function ApmAppRoot({ * This module is rendered asynchronously in the Kibana platform. */ -export const renderApp = ( - core: CoreStart, - setupDeps: ApmPluginSetupDeps, - appMountParameters: AppMountParameters, - config: ConfigSchema, - startDeps: ApmPluginStartDeps -) => { +export const renderApp = ({ + coreStart, + pluginsSetup, + appMountParameters, + config, + pluginsStart, + apmRuleRegistry, +}: { + coreStart: CoreStart; + pluginsSetup: ApmPluginSetupDeps; + appMountParameters: AppMountParameters; + config: ConfigSchema; + pluginsStart: ApmPluginStartDeps; + apmRuleRegistry: ApmRuleRegistry; +}) => { const { element } = appMountParameters; const apmPluginContextValue = { appMountParameters, config, - core, - plugins: setupDeps, + core: coreStart, + plugins: pluginsSetup, + apmRuleRegistry, }; // render APM feedback link in global help menu - setHelpExtension(core); - setReadonlyBadge(core); - createCallApmApi(core); + setHelpExtension(coreStart); + setReadonlyBadge(coreStart); + createCallApmApi(coreStart); // Automatically creates static index pattern and stores as saved object createStaticIndexPattern().catch((e) => { @@ -131,7 +144,7 @@ export const renderApp = ( ReactDOM.render( , element ); diff --git a/x-pack/plugins/apm/public/components/alerting/register_apm_alerts.ts b/x-pack/plugins/apm/public/components/alerting/register_apm_alerts.ts index 583be94c30a34..98c8b99411bc3 100644 --- a/x-pack/plugins/apm/public/components/alerting/register_apm_alerts.ts +++ b/x-pack/plugins/apm/public/components/alerting/register_apm_alerts.ts @@ -40,7 +40,7 @@ export function registerApmAlerts(apmRuleRegistry: ApmRuleRegistry) { }, }), link: format({ - pathname: `/app/apm/services/${alert['service.name']!}`, + pathname: `/app/apm/services/${alert['service.name']!}/errors`, query: { ...(alert['service.environment'] ? { environment: alert['service.environment'] } diff --git a/x-pack/plugins/apm/public/components/app/ErrorGroupDetails/Distribution/index.tsx b/x-pack/plugins/apm/public/components/app/ErrorGroupDetails/Distribution/index.tsx index a0bcfe60e72b5..19a567a3866bd 100644 --- a/x-pack/plugins/apm/public/components/app/ErrorGroupDetails/Distribution/index.tsx +++ b/x-pack/plugins/apm/public/components/app/ErrorGroupDetails/Distribution/index.tsx @@ -19,9 +19,12 @@ import { import { EuiTitle } from '@elastic/eui'; import d3 from 'd3'; import React from 'react'; +import { useApmServiceContext } from '../../../../context/apm_service/use_apm_service_context'; import { APIReturnType } from '../../../../services/rest/createCallApmApi'; import { asRelativeDateTimeRange } from '../../../../../common/utils/formatters'; import { useTheme } from '../../../../hooks/use_theme'; +import { AlertType } from '../../../../../common/alert_types'; +import { getAlertAnnotations } from '../../../shared/charts/helper/get_alert_annotations'; type ErrorDistributionAPIResponse = APIReturnType<'GET /api/apm/services/{serviceName}/errors/distribution'>; @@ -61,6 +64,8 @@ export function ErrorDistribution({ distribution, title }: Props) { const xFormatter = niceTimeFormatter([xMin, xMax]); + const { alerts } = useApmServiceContext(); + const tooltipProps: SettingsSpec['tooltip'] = { headerFormatter: (tooltip: TooltipValue) => { const serie = buckets.find((bucket) => bucket.x0 === tooltip.value); @@ -108,6 +113,12 @@ export function ErrorDistribution({ distribution, title }: Props) { data={buckets} color={theme.eui.euiColorVis1} /> + {getAlertAnnotations({ + alerts: alerts?.filter( + (alert) => alert['rule.id'] === AlertType.ErrorCount + ), + theme, + })} diff --git a/x-pack/plugins/apm/public/components/app/Home/__snapshots__/Home.test.tsx.snap b/x-pack/plugins/apm/public/components/app/Home/__snapshots__/Home.test.tsx.snap index 5094287a402ea..b1bcf561bed84 100644 --- a/x-pack/plugins/apm/public/components/app/Home/__snapshots__/Home.test.tsx.snap +++ b/x-pack/plugins/apm/public/components/app/Home/__snapshots__/Home.test.tsx.snap @@ -4,6 +4,10 @@ exports[`Home component should render services 1`] = ` { setPercentileRange({ min: null, max: null }); }; - return ( - <> + return !isDisabled ? ( + - + {I18LABELS.resetZoom} - - ); + + ) : null; } diff --git a/x-pack/plugins/apm/public/components/app/RumDashboard/PageLoadDistribution/index.tsx b/x-pack/plugins/apm/public/components/app/RumDashboard/PageLoadDistribution/index.tsx index 050d3b54a200f..b2e8ca5fda805 100644 --- a/x-pack/plugins/apm/public/components/app/RumDashboard/PageLoadDistribution/index.tsx +++ b/x-pack/plugins/apm/public/components/app/RumDashboard/PageLoadDistribution/index.tsx @@ -6,7 +6,14 @@ */ import React, { useState } from 'react'; -import { EuiFlexGroup, EuiFlexItem, EuiSpacer, EuiTitle } from '@elastic/eui'; +import { + EuiButton, + EuiFlexGroup, + EuiFlexItem, + EuiSpacer, + EuiTitle, +} from '@elastic/eui'; +import { FormattedMessage } from '@kbn/i18n/react'; import { useUrlParams } from '../../../../context/url_params_context/use_url_params'; import { useFetcher } from '../../../../hooks/use_fetcher'; import { I18LABELS } from '../translations'; @@ -14,6 +21,8 @@ import { BreakdownFilter } from '../Breakdowns/BreakdownFilter'; import { PageLoadDistChart } from '../Charts/PageLoadDistChart'; import { BreakdownItem } from '../../../../../typings/ui_filters'; import { ResetPercentileZoom } from './ResetPercentileZoom'; +import { createExploratoryViewUrl } from '../../../../../../observability/public'; +import { useKibana } from '../../../../../../../../src/plugins/kibana_react/public'; export interface PercentileRange { min?: number | null; @@ -21,9 +30,15 @@ export interface PercentileRange { } export function PageLoadDistribution() { + const { + services: { http }, + } = useKibana(); + const { urlParams, uiFilters } = useUrlParams(); - const { start, end, searchTerm } = urlParams; + const { start, end, rangeFrom, rangeTo, searchTerm } = urlParams; + + const { serviceName } = uiFilters; const [percentileRange, setPercentileRange] = useState({ min: null, @@ -34,8 +49,6 @@ export function PageLoadDistribution() { const { data, status } = useFetcher( (callApmApi) => { - const { serviceName } = uiFilters; - if (start && end && serviceName) { return callApmApi({ endpoint: 'GET /api/apm/rum-client/page-load-distribution', @@ -64,6 +77,7 @@ export function PageLoadDistribution() { percentileRange.min, percentileRange.max, searchTerm, + serviceName, ] ); @@ -71,6 +85,20 @@ export function PageLoadDistribution() { setPercentileRange({ min, max }); }; + const exploratoryViewLink = createExploratoryViewUrl( + { + [`${serviceName}-page-views`]: { + reportType: 'pld', + time: { from: rangeFrom!, to: rangeTo! }, + reportDefinitions: { + 'service.name': serviceName?.[0] as string, + }, + ...(breakdown ? { breakdown: breakdown.fieldName } : {}), + }, + }, + http?.basePath.get() + ); + return (
@@ -79,12 +107,10 @@ export function PageLoadDistribution() {

{I18LABELS.pageLoadDistribution}

- - - + + + + + +
List should render empty state 1`] = ` - - Group ID - - - , - "render": [Function], - "sortable": false, - "width": "96px", - }, - Object { - "field": "type", - "name": "Type", - "render": [Function], - "sortable": false, - }, - Object { - "field": "message", - "name": "Error message and culprit", - "render": [Function], - "sortable": false, - "width": "50%", - }, - Object { - "align": "right", - "field": "handled", - "name": "", - "render": [Function], - "sortable": false, - }, - Object { - "dataType": "number", - "field": "occurrenceCount", - "name": "Occurrences", - "render": [Function], - "sortable": true, - }, - Object { - "align": "right", - "field": "latestOccurrenceAt", - "name": "Latest occurrence", - "render": [Function], - "sortable": true, - }, - ] - } - initialPageSize={25} - initialSortDirection="desc" - initialSortField="occurrenceCount" - items={Array []} - noItemsMessage="No errors were found" - sortItems={false} +
-
-
+
+
- +
-
-
-
- -
-
+ Sorting + + +
- +
- - - - + +
-
+ + + + - + - + - - - + - - - - - + + + + - - -
+
+
-
+ Group ID + - Group ID - - - + aria-label="Info" + className="eui-alignTop" + color="subdued" + data-euiicon-type="questionInCircle" + onBlur={[Function]} + onFocus={[Function]} + size="s" + tabIndex={0} + /> -
-
+ + +
-
- - Type - -
-
+ + +
-
- - Error message and culprit - -
-
+ + + +
-
- -
-
+ + + + - + + + Click to sort in ascending order + + + + -
+ + Click to sort in ascending order + + + +
+
-
- - No errors were found - -
-
- + No errors were found + + + +
- +
`; exports[`ErrorGroupOverview -> List should render with data 1`] = ` @@ -382,591 +307,524 @@ exports[`ErrorGroupOverview -> List should render with data 1`] = ` font-family: "Roboto Mono",Consolas,Menlo,Courier,monospace; } - - Group ID - - - , - "render": [Function], - "sortable": false, - "width": "96px", - }, - Object { - "field": "type", - "name": "Type", - "render": [Function], - "sortable": false, - }, - Object { - "field": "message", - "name": "Error message and culprit", - "render": [Function], - "sortable": false, - "width": "50%", - }, - Object { - "align": "right", - "field": "handled", - "name": "", - "render": [Function], - "sortable": false, - }, - Object { - "dataType": "number", - "field": "occurrenceCount", - "name": "Occurrences", - "render": [Function], - "sortable": true, - }, - Object { - "align": "right", - "field": "latestOccurrenceAt", - "name": "Latest occurrence", - "render": [Function], - "sortable": true, - }, - ] - } - initialPageSize={25} - initialSortDirection="desc" - initialSortField="occurrenceCount" - items={ - Array [ - Object { - "culprit": "elasticapm.contrib.django.client.capture", - "groupId": "a0ce2c8978ef92cdf2ff163ae28576ee", - "handled": true, - "latestOccurrenceAt": "2018-01-10T10:06:37.561Z", - "message": "About to blow up!", - "occurrenceCount": 75, - "type": "AssertionError", - }, - Object { - "culprit": "opbeans.views.oopsie", - "groupId": "f3ac95493913cc7a3cfec30a19d2120a", - "handled": true, - "latestOccurrenceAt": "2018-01-10T10:06:37.630Z", - "message": "AssertionError: ", - "occurrenceCount": 75, - "type": "AssertionError", - }, - Object { - "culprit": "opbeans.tasks.update_stats", - "groupId": "e90863d04b7a692435305f09bbe8c840", - "handled": true, - "latestOccurrenceAt": "2018-01-10T10:06:36.859Z", - "message": "AssertionError: Bad luck!", - "occurrenceCount": 24, - "type": "AssertionError", - }, - Object { - "culprit": "opbeans.views.customer", - "groupId": "8673d8bf7a032e387c101bafbab0d2bc", - "handled": true, - "latestOccurrenceAt": "2018-01-10T10:06:13.211Z", - "message": "Customer with ID 8517 not found", - "occurrenceCount": 15, - "type": "AssertionError", - }, - ] - } - noItemsMessage="No errors were found" - sortItems={false} +
-
-
+
+
- +
-
-
-
- -
-
+ Sorting + + +
- +
- - - - + +
-
+ + + + - + - + - + + - + + + + + - - - + + + + + + - + + + - + + + - + - - + - - - - + + + - + + + - + - - + - - - - + + + - + + + - + - - + - - - - + - + - - + - - - -
+
+
-
+ Group ID + - Group ID - - - + aria-label="Info" + className="eui-alignTop" + color="subdued" + data-euiicon-type="questionInCircle" + onBlur={[Function]} + onFocus={[Function]} + size="s" + tabIndex={0} + /> -
-
+ + +
-
- - Type - -
-
+ + +
-
- - Error message and culprit - -
-
+ + + +
-
+
+
+ + + Click to sort in ascending order + + + + - + + Click to sort in ascending order + + +
+
- - -
- + Type + + + +
+ Error message and culprit +
+
- Group ID - - + rel="noreferrer" + > + About to blow up! + -
-
- + - - - a0ce2 - - - + elasticapm.contrib.django.client.capture +
+
-
+ +
+
+
-
- Type -
-
+
+ 75 +
+
+
+ Latest occurrence +
+
+ - - - - AssertionError - - - -
-
+ +
+
-
- Error message and culprit -
-
+ +
+
+ - -
- - - - - About to blow up! - - - - -
- - -
- elasticapm.contrib.django.client.capture -
-
-
-
- -
-
+ + +
-
-
+
-
- Occurrences -
-
- 75 -
-
+ + +
+ Error message and culprit +
+
- Latest occurrence -
-
List should render with data 1`] = ` onMouseOut={[Function]} onMouseOver={[Function]} > - 1337 minutes ago (mocking 1515578797) + + AssertionError: + -
-
-
- Group ID - +
- - -
-
- - - - f3ac9 - - - + opbeans.views.oopsie +
+ -
+ +
+
+
-
- Type -
-
+
+ 75 +
+
+
+ Latest occurrence +
+
+ - - - - AssertionError - - - -
-
+ +
+
-
- Error message and culprit -
-
+ +
+
+ - -
- - - - - AssertionError: - - - - -
- - -
- opbeans.views.oopsie -
-
-
-
- -
-
+ + +
-
-
+
-
- Occurrences -
-
- 75 -
-
+ + +
+ Error message and culprit +
+
- Latest occurrence -
-
List should render with data 1`] = ` onMouseOut={[Function]} onMouseOver={[Function]} > - 1337 minutes ago (mocking 1515578797) + + AssertionError: Bad luck! + -
-
-
- Group ID - +
- - -
-
- - - - e9086 - - - + opbeans.tasks.update_stats +
+ -
+ +
+
+
-
- Type -
-
+
+ 24 +
+
+
+ Latest occurrence +
+
+ - - - - AssertionError - - - -
-
+ +
+
-
- Error message and culprit -
-
+ +
+
+ - -
- - - - - AssertionError: Bad luck! - - - - -
- - -
- opbeans.tasks.update_stats -
-
-
-
- -
-
+ + +
-
-
+
-
- Occurrences -
-
- 24 -
-
+ + +
+ Error message and culprit +
+
- Latest occurrence -
-
List should render with data 1`] = ` onMouseOut={[Function]} onMouseOver={[Function]} > - 1337 minutes ago (mocking 1515578796) + + Customer with ID 8517 not found + -
-
-
- Group ID - +
- - -
-
- - - - 8673d - - - + opbeans.views.customer +
+ -
+ -
- Type -
- -
+
+
+
-
- Error message and culprit -
-
- -
- - - - - Customer with ID 8517 not found - - - - -
- - -
- opbeans.views.customer -
-
-
-
-
-
-
+
-
-
+ +
-
- Occurrences -
-
- 15 -
-
+
-
- Latest occurrence -
-
- - 1337 minutes ago (mocking 1515578773) - -
-
- -
+ 1337 minutes ago (mocking 1515578773) + +
+ +
+
+
+
+
- -
-
-
+
-
- + + + + +
- +
`; diff --git a/x-pack/plugins/apm/public/components/app/service_details/service_icons/alert_details.tsx b/x-pack/plugins/apm/public/components/app/service_details/service_icons/alert_details.tsx new file mode 100644 index 0000000000000..7607b6fd91392 --- /dev/null +++ b/x-pack/plugins/apm/public/components/app/service_details/service_icons/alert_details.tsx @@ -0,0 +1,91 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ +import React from 'react'; +import { EuiFlexGroup, EuiFlexItem, EuiLink } from '@elastic/eui'; +import { parse, format } from 'url'; +import { uniqBy } from 'lodash'; +import { useUrlParams } from '../../../../context/url_params_context/use_url_params'; +import { useApmPluginContext } from '../../../../context/apm_plugin/use_apm_plugin_context'; +import { APIReturnType } from '../../../../services/rest/createCallApmApi'; +import { asPercent, asDuration } from '../../../../../common/utils/formatters'; +import { TimestampTooltip } from '../../../shared/TimestampTooltip'; + +interface AlertDetailProps { + alerts: APIReturnType<'GET /api/apm/services/{serviceName}/alerts'>['alerts']; +} + +export function AlertDetails({ alerts }: AlertDetailProps) { + const { + apmRuleRegistry, + core: { + http: { + basePath: { prepend }, + }, + }, + } = useApmPluginContext(); + + const { + urlParams: { rangeFrom, rangeTo }, + } = useUrlParams(); + + const collapsedAlerts = uniqBy( + alerts, + (alert) => alert['kibana.rac.alert.id']! + ); + + return ( + + {collapsedAlerts.map((alert) => { + const ruleType = apmRuleRegistry.getTypeByRuleId(alert['rule.id']!); + const formatted = { + link: undefined, + reason: alert['rule.name'], + ...(ruleType?.format?.({ + alert, + formatters: { asDuration, asPercent }, + }) ?? {}), + }; + + const parsedLink = formatted.link + ? parse(formatted.link, true) + : undefined; + + return ( + + + + {parsedLink ? ( + + {formatted.reason} + + ) : ( + formatted.reason + )} + + + + + + + ); + })} + + ); +} diff --git a/x-pack/plugins/apm/public/components/app/service_details/service_icons/icon_popover.tsx b/x-pack/plugins/apm/public/components/app/service_details/service_icons/icon_popover.tsx index f7495d3e51671..79f93ea76ee51 100644 --- a/x-pack/plugins/apm/public/components/app/service_details/service_icons/icon_popover.tsx +++ b/x-pack/plugins/apm/public/components/app/service_details/service_icons/icon_popover.tsx @@ -23,7 +23,11 @@ interface IconPopoverProps { onClose: () => void; detailsFetchStatus: FETCH_STATUS; isOpen: boolean; - icon?: string; + icon: { + type?: string; + size?: 's' | 'm' | 'l'; + color?: string; + }; } export function IconPopover({ icon, @@ -34,7 +38,7 @@ export function IconPopover({ detailsFetchStatus, isOpen, }: IconPopoverProps) { - if (!icon) { + if (!icon.type) { return null; } const isLoading = detailsFetchStatus === FETCH_STATUS.LOADING; @@ -44,7 +48,11 @@ export function IconPopover({ ownFocus={false} button={ - + } isOpen={isOpen} diff --git a/x-pack/plugins/apm/public/components/app/service_details/service_icons/index.tsx b/x-pack/plugins/apm/public/components/app/service_details/service_icons/index.tsx index 6f9c82200fb60..f7bed4e09a696 100644 --- a/x-pack/plugins/apm/public/components/app/service_details/service_icons/index.tsx +++ b/x-pack/plugins/apm/public/components/app/service_details/service_icons/index.tsx @@ -8,6 +8,7 @@ import { EuiFlexGroup, EuiFlexItem, EuiLoadingSpinner } from '@elastic/eui'; import { i18n } from '@kbn/i18n'; import React, { ReactChild, useState } from 'react'; +import { useApmServiceContext } from '../../../../context/apm_service/use_apm_service_context'; import { useTheme } from '../../../../hooks/use_theme'; import { ContainerType } from '../../../../../common/service_metadata'; import { useUrlParams } from '../../../../context/url_params_context/use_url_params'; @@ -17,6 +18,7 @@ import { CloudDetails } from './cloud_details'; import { ContainerDetails } from './container_details'; import { IconPopover } from './icon_popover'; import { ServiceDetails } from './service_details'; +import { AlertDetails } from './alert_details'; interface Props { serviceName: string; @@ -28,13 +30,13 @@ const cloudIcons: Record = { azure: 'logoAzure', }; -function getCloudIcon(provider?: string) { +export function getCloudIcon(provider?: string) { if (provider) { return cloudIcons[provider]; } } -function getContainerIcon(container?: ContainerType) { +export function getContainerIcon(container?: ContainerType) { if (!container) { return; } @@ -46,10 +48,15 @@ function getContainerIcon(container?: ContainerType) { } } -type Icons = 'service' | 'container' | 'cloud'; +type Icons = 'service' | 'container' | 'cloud' | 'alerts'; + interface PopoverItem { key: Icons; - icon?: string; + icon: { + type?: string; + color?: string; + size?: 's' | 'm' | 'l'; + }; isVisible: boolean; title: string; component: ReactChild; @@ -66,6 +73,8 @@ export function ServiceIcons({ serviceName }: Props) { const theme = useTheme(); + const { alerts } = useApmServiceContext(); + const { data: icons, status: iconsFetchStatus } = useFetcher( (callApmApi) => { if (serviceName && start && end) { @@ -106,7 +115,9 @@ export function ServiceIcons({ serviceName }: Props) { const popoverItems: PopoverItem[] = [ { key: 'service', - icon: getAgentIcon(icons?.agentName, theme.darkMode) || 'node', + icon: { + type: getAgentIcon(icons?.agentName, theme.darkMode) || 'node', + }, isVisible: !!icons?.agentName, title: i18n.translate('xpack.apm.serviceIcons.service', { defaultMessage: 'Service', @@ -115,7 +126,9 @@ export function ServiceIcons({ serviceName }: Props) { }, { key: 'container', - icon: getContainerIcon(icons?.containerType), + icon: { + type: getContainerIcon(icons?.containerType), + }, isVisible: !!icons?.containerType, title: i18n.translate('xpack.apm.serviceIcons.container', { defaultMessage: 'Container', @@ -124,13 +137,28 @@ export function ServiceIcons({ serviceName }: Props) { }, { key: 'cloud', - icon: getCloudIcon(icons?.cloudProvider), + icon: { + type: getCloudIcon(icons?.cloudProvider), + }, isVisible: !!icons?.cloudProvider, title: i18n.translate('xpack.apm.serviceIcons.cloud', { defaultMessage: 'Cloud', }), component: , }, + { + key: 'alerts', + icon: { + type: 'bell', + color: theme.eui.euiColorDanger, + size: 'm', + }, + isVisible: alerts.length > 0, + title: i18n.translate('xpack.apm.serviceIcons.alerts', { + defaultMessage: 'Alerts', + }), + component: , + }, ]; return ( diff --git a/x-pack/plugins/apm/public/components/app/service_overview/index.tsx b/x-pack/plugins/apm/public/components/app/service_overview/index.tsx index 78c8f151b82d9..cd1ced1830123 100644 --- a/x-pack/plugins/apm/public/components/app/service_overview/index.tsx +++ b/x-pack/plugins/apm/public/components/app/service_overview/index.tsx @@ -119,7 +119,7 @@ export function ServiceOverview({ {!isRumAgent && ( diff --git a/x-pack/plugins/apm/public/components/app/service_overview/service_overview.test.tsx b/x-pack/plugins/apm/public/components/app/service_overview/service_overview.test.tsx index c6ed4e640693f..4d6c0be9ff818 100644 --- a/x-pack/plugins/apm/public/components/app/service_overview/service_overview.test.tsx +++ b/x-pack/plugins/apm/public/components/app/service_overview/service_overview.test.tsx @@ -72,6 +72,7 @@ describe('ServiceOverview', () => { agentName: 'java', transactionType: 'request', transactionTypes: ['request'], + alerts: [], }); jest .spyOn(useAnnotationsHooks, 'useAnnotationsContext') @@ -85,16 +86,16 @@ describe('ServiceOverview', () => { /* eslint-disable @typescript-eslint/naming-convention */ const calls = { - 'GET /api/apm/services/{serviceName}/error_groups/primary_statistics': { + 'GET /api/apm/services/{serviceName}/error_groups/main_statistics': { error_groups: [] as any[], }, - 'GET /api/apm/services/{serviceName}/transactions/groups/primary_statistics': { + 'GET /api/apm/services/{serviceName}/transactions/groups/main_statistics': { transactionGroups: [] as any[], totalTransactionGroups: 0, isAggregationAccurate: true, }, 'GET /api/apm/services/{serviceName}/dependencies': [], - 'GET /api/apm/services/{serviceName}/service_overview_instances/primary_statistics': [], + 'GET /api/apm/services/{serviceName}/service_overview_instances/main_statistics': [], }; /* eslint-enable @typescript-eslint/naming-convention */ diff --git a/x-pack/plugins/apm/public/components/app/service_overview/service_overview_errors_table/get_column.tsx b/x-pack/plugins/apm/public/components/app/service_overview/service_overview_errors_table/get_column.tsx index fd1120808db9e..4ad83f7d87426 100644 --- a/x-pack/plugins/apm/public/components/app/service_overview/service_overview_errors_table/get_column.tsx +++ b/x-pack/plugins/apm/public/components/app/service_overview/service_overview_errors_table/get_column.tsx @@ -16,18 +16,18 @@ import { TimestampTooltip } from '../../../shared/TimestampTooltip'; import { TruncateWithTooltip } from '../../../shared/truncate_with_tooltip'; import { APIReturnType } from '../../../../services/rest/createCallApmApi'; -type ErrorGroupPrimaryStatistics = APIReturnType<'GET /api/apm/services/{serviceName}/error_groups/primary_statistics'>; -type ErrorGroupComparisonStatistics = APIReturnType<'GET /api/apm/services/{serviceName}/error_groups/comparison_statistics'>; +type ErrorGroupMainStatistics = APIReturnType<'GET /api/apm/services/{serviceName}/error_groups/main_statistics'>; +type ErrorGroupDetailedStatistics = APIReturnType<'GET /api/apm/services/{serviceName}/error_groups/detailed_statistics'>; export function getColumns({ serviceName, - errorGroupComparisonStatistics, + errorGroupDetailedStatistics, comparisonEnabled, }: { serviceName: string; - errorGroupComparisonStatistics: ErrorGroupComparisonStatistics; + errorGroupDetailedStatistics: ErrorGroupDetailedStatistics; comparisonEnabled?: boolean; -}): Array> { +}): Array> { return [ { field: 'name', @@ -74,10 +74,10 @@ export function getColumns({ width: px(unit * 12), render: (_, { occurrences, group_id: errorGroupId }) => { const currentPeriodTimeseries = - errorGroupComparisonStatistics?.currentPeriod?.[errorGroupId] + errorGroupDetailedStatistics?.currentPeriod?.[errorGroupId] ?.timeseries; const previousPeriodTimeseries = - errorGroupComparisonStatistics?.previousPeriod?.[errorGroupId] + errorGroupDetailedStatistics?.previousPeriod?.[errorGroupId] ?.timeseries; return ( diff --git a/x-pack/plugins/apm/public/components/app/service_overview/service_overview_errors_table/index.tsx b/x-pack/plugins/apm/public/components/app/service_overview/service_overview_errors_table/index.tsx index d36bee8d6be73..7c222f85133e3 100644 --- a/x-pack/plugins/apm/public/components/app/service_overview/service_overview_errors_table/index.tsx +++ b/x-pack/plugins/apm/public/components/app/service_overview/service_overview_errors_table/index.tsx @@ -28,8 +28,8 @@ import { getColumns } from './get_column'; interface Props { serviceName: string; } -type ErrorGroupPrimaryStatistics = APIReturnType<'GET /api/apm/services/{serviceName}/error_groups/primary_statistics'>; -type ErrorGroupComparisonStatistics = APIReturnType<'GET /api/apm/services/{serviceName}/error_groups/comparison_statistics'>; +type ErrorGroupMainStatistics = APIReturnType<'GET /api/apm/services/{serviceName}/error_groups/main_statistics'>; +type ErrorGroupDetailedStatistics = APIReturnType<'GET /api/apm/services/{serviceName}/error_groups/detailed_statistics'>; type SortDirection = 'asc' | 'desc'; type SortField = 'name' | 'last_seen' | 'occurrences'; @@ -40,8 +40,8 @@ const DEFAULT_SORT = { field: 'occurrences' as const, }; -const INITIAL_STATE_PRIMARY_STATISTICS: { - items: ErrorGroupPrimaryStatistics['error_groups']; +const INITIAL_STATE_MAIN_STATISTICS: { + items: ErrorGroupMainStatistics['error_groups']; totalItems: number; requestId?: string; } = { @@ -50,7 +50,7 @@ const INITIAL_STATE_PRIMARY_STATISTICS: { requestId: undefined, }; -const INITIAL_STATE_COMPARISON_STATISTICS: ErrorGroupComparisonStatistics = { +const INITIAL_STATE_DETAILED_STATISTICS: ErrorGroupDetailedStatistics = { currentPeriod: {}, previousPeriod: {}, }; @@ -82,19 +82,20 @@ export function ServiceOverviewErrorsTable({ serviceName }: Props) { start, end, comparisonType, + comparisonEnabled, }); const { pageIndex, sort } = tableOptions; const { direction, field } = sort; - const { data = INITIAL_STATE_PRIMARY_STATISTICS, status } = useFetcher( + const { data = INITIAL_STATE_MAIN_STATISTICS, status } = useFetcher( (callApmApi) => { if (!start || !end || !transactionType) { return; } return callApmApi({ endpoint: - 'GET /api/apm/services/{serviceName}/error_groups/primary_statistics', + 'GET /api/apm/services/{serviceName}/error_groups/main_statistics', params: { path: { serviceName }, query: { @@ -113,13 +114,13 @@ export function ServiceOverviewErrorsTable({ serviceName }: Props) { ).slice(pageIndex * PAGE_SIZE, (pageIndex + 1) * PAGE_SIZE); return { + // Everytime the main statistics is refetched, updates the requestId making the comparison API to be refetched. requestId: uuid(), items: currentPageErrorGroups, totalItems: response.error_groups.length, }; }); }, - // comparisonType is listed as dependency even thought it is not used. This is needed to trigger the comparison api when it is changed. // eslint-disable-next-line react-hooks/exhaustive-deps [ environment, @@ -131,21 +132,24 @@ export function ServiceOverviewErrorsTable({ serviceName }: Props) { pageIndex, direction, field, + // not used, but needed to trigger an update when comparisonType is changed either manually by user or when time range is changed comparisonType, + // not used, but needed to trigger an update when comparison feature is disabled/enabled by user + comparisonEnabled, ] ); const { requestId, items, totalItems } = data; const { - data: errorGroupComparisonStatistics = INITIAL_STATE_COMPARISON_STATISTICS, - status: errorGroupComparisonStatisticsStatus, + data: errorGroupDetailedStatistics = INITIAL_STATE_DETAILED_STATISTICS, + status: errorGroupDetailedStatisticsStatus, } = useFetcher( (callApmApi) => { if (requestId && items.length && start && end && transactionType) { return callApmApi({ endpoint: - 'GET /api/apm/services/{serviceName}/error_groups/comparison_statistics', + 'GET /api/apm/services/{serviceName}/error_groups/detailed_statistics', params: { path: { serviceName }, query: { @@ -173,7 +177,7 @@ export function ServiceOverviewErrorsTable({ serviceName }: Props) { const columns = getColumns({ serviceName, - errorGroupComparisonStatistics, + errorGroupDetailedStatistics, comparisonEnabled, }); @@ -218,7 +222,7 @@ export function ServiceOverviewErrorsTable({ serviceName }: Props) { }} loading={ status === FETCH_STATUS.LOADING || - errorGroupComparisonStatisticsStatus === FETCH_STATUS.LOADING + errorGroupDetailedStatisticsStatus === FETCH_STATUS.LOADING } onChange={(newTableOptions: { page?: { diff --git a/x-pack/plugins/apm/public/components/app/service_overview/service_overview_instances_chart_and_table.tsx b/x-pack/plugins/apm/public/components/app/service_overview/service_overview_instances_chart_and_table.tsx index 55eb2e3ddab73..8305b5a0dde3b 100644 --- a/x-pack/plugins/apm/public/components/app/service_overview/service_overview_instances_chart_and_table.tsx +++ b/x-pack/plugins/apm/public/components/app/service_overview/service_overview_instances_chart_and_table.tsx @@ -25,7 +25,7 @@ interface ServiceOverviewInstancesChartAndTableProps { serviceName: string; } -export interface PrimaryStatsServiceInstanceItem { +export interface MainStatsServiceInstanceItem { serviceNodeName: string; errorRate: number; throughput: number; @@ -34,15 +34,15 @@ export interface PrimaryStatsServiceInstanceItem { memoryUsage: number; } -const INITIAL_STATE_PRIMARY_STATS = { - primaryStatsItems: [] as PrimaryStatsServiceInstanceItem[], - primaryStatsRequestId: undefined, - primaryStatsItemCount: 0, +const INITIAL_STATE_MAIN_STATS = { + mainStatsItems: [] as MainStatsServiceInstanceItem[], + mainStatsRequestId: undefined, + mainStatsItemCount: 0, }; -type ApiResponseComparisonStats = APIReturnType<'GET /api/apm/services/{serviceName}/service_overview_instances/comparison_statistics'>; +type ApiResponseDetailedStats = APIReturnType<'GET /api/apm/services/{serviceName}/service_overview_instances/detailed_statistics'>; -const INITIAL_STATE_COMPARISON_STATISTICS: ApiResponseComparisonStats = { +const INITIAL_STATE_DETAILED_STATISTICS: ApiResponseDetailedStats = { currentPeriod: {}, previousPeriod: {}, }; @@ -83,6 +83,7 @@ export function ServiceOverviewInstancesChartAndTable({ start, end, comparisonType, + comparisonEnabled, }, } = useUrlParams(); @@ -90,11 +91,12 @@ export function ServiceOverviewInstancesChartAndTable({ start, end, comparisonType, + comparisonEnabled, }); const { - data: primaryStatsData = INITIAL_STATE_PRIMARY_STATS, - status: primaryStatsStatus, + data: mainStatsData = INITIAL_STATE_MAIN_STATS, + status: mainStatsStatus, } = useFetcher( (callApmApi) => { if (!start || !end || !transactionType || !latencyAggregationType) { @@ -103,7 +105,7 @@ export function ServiceOverviewInstancesChartAndTable({ return callApmApi({ endpoint: - 'GET /api/apm/services/{serviceName}/service_overview_instances/primary_statistics', + 'GET /api/apm/services/{serviceName}/service_overview_instances/main_statistics', params: { path: { serviceName, @@ -118,7 +120,7 @@ export function ServiceOverviewInstancesChartAndTable({ }, }, }).then((response) => { - const primaryStatsItems = orderBy( + const mainStatsItems = orderBy( // need top-level sortable fields for the managed table response.serviceInstances.map((item) => ({ ...item, @@ -133,13 +135,13 @@ export function ServiceOverviewInstancesChartAndTable({ ).slice(pageIndex * PAGE_SIZE, (pageIndex + 1) * PAGE_SIZE); return { - primaryStatsRequestId: uuid(), - primaryStatsItems, - primaryStatsItemCount: response.serviceInstances.length, + // Everytime the main statistics is refetched, updates the requestId making the detailed API to be refetched. + mainStatsRequestId: uuid(), + mainStatsItems, + mainStatsItemCount: response.serviceInstances.length, }; }); }, - // comparisonType is listed as dependency even thought it is not used. This is needed to trigger the comparison api when it is changed. // eslint-disable-next-line react-hooks/exhaustive-deps [ environment, @@ -152,19 +154,22 @@ export function ServiceOverviewInstancesChartAndTable({ pageIndex, field, direction, + // not used, but needed to trigger an update when comparisonType is changed either manually by user or when time range is changed comparisonType, + // not used, but needed to trigger an update when comparison feature is disabled/enabled by user + comparisonEnabled, ] ); const { - primaryStatsItems, - primaryStatsRequestId, - primaryStatsItemCount, - } = primaryStatsData; + mainStatsItems, + mainStatsRequestId, + mainStatsItemCount, + } = mainStatsData; const { - data: comparisonStatsData = INITIAL_STATE_COMPARISON_STATISTICS, - status: comparisonStatisticsStatus, + data: detailedStatsData = INITIAL_STATE_DETAILED_STATISTICS, + status: detailedStatsStatus, } = useFetcher( (callApmApi) => { if ( @@ -172,14 +177,14 @@ export function ServiceOverviewInstancesChartAndTable({ !end || !transactionType || !latencyAggregationType || - !primaryStatsItemCount + !mainStatsItemCount ) { return; } return callApmApi({ endpoint: - 'GET /api/apm/services/{serviceName}/service_overview_instances/comparison_statistics', + 'GET /api/apm/services/{serviceName}/service_overview_instances/detailed_statistics', params: { path: { serviceName, @@ -193,7 +198,7 @@ export function ServiceOverviewInstancesChartAndTable({ numBuckets: 20, transactionType, serviceNodeIds: JSON.stringify( - primaryStatsItems.map((item) => item.serviceNodeName) + mainStatsItems.map((item) => item.serviceNodeName) ), comparisonStart, comparisonEnd, @@ -201,9 +206,9 @@ export function ServiceOverviewInstancesChartAndTable({ }, }); }, - // only fetches comparison statistics when requestId is invalidated by primary statistics api call + // only fetches detailed statistics when requestId is invalidated by main statistics api call // eslint-disable-next-line react-hooks/exhaustive-deps - [primaryStatsRequestId], + [mainStatsRequestId], { preservePreviousData: false } ); @@ -212,22 +217,22 @@ export function ServiceOverviewInstancesChartAndTable({ { setTableOptions({ diff --git a/x-pack/plugins/apm/public/components/app/service_overview/service_overview_instances_table/get_columns.tsx b/x-pack/plugins/apm/public/components/app/service_overview/service_overview_instances_table/get_columns.tsx index d61593f52b2ed..4da5ba5a4ae64 100644 --- a/x-pack/plugins/apm/public/components/app/service_overview/service_overview_instances_table/get_columns.tsx +++ b/x-pack/plugins/apm/public/components/app/service_overview/service_overview_instances_table/get_columns.tsx @@ -5,11 +5,16 @@ * 2.0. */ -import { EuiBasicTableColumn } from '@elastic/eui'; +import { + EuiBasicTableColumn, + EuiButtonIcon, + RIGHT_ALIGNMENT, +} from '@elastic/eui'; import { i18n } from '@kbn/i18n'; -import React from 'react'; -import { LatencyAggregationType } from '../../../../../common/latency_aggregation_types'; +import React, { ReactNode } from 'react'; +import { ActionMenu } from '../../../../../../observability/public'; import { isJavaAgentName } from '../../../../../common/agent_name'; +import { LatencyAggregationType } from '../../../../../common/latency_aggregation_types'; import { getServiceNodeName, SERVICE_NODE_NAME_MISSING, @@ -26,23 +31,32 @@ import { MetricOverviewLink } from '../../../shared/Links/apm/MetricOverviewLink import { ServiceNodeMetricOverviewLink } from '../../../shared/Links/apm/ServiceNodeMetricOverviewLink'; import { TruncateWithTooltip } from '../../../shared/truncate_with_tooltip'; import { getLatencyColumnLabel } from '../get_latency_column_label'; -import { PrimaryStatsServiceInstanceItem } from '../service_overview_instances_chart_and_table'; +import { InstanceActionsMenu } from './instance_actions_menu'; +import { MainStatsServiceInstanceItem } from '../service_overview_instances_chart_and_table'; -type ServiceInstanceComparisonStatistics = APIReturnType<'GET /api/apm/services/{serviceName}/service_overview_instances/comparison_statistics'>; +type ServiceInstanceDetailedStatistics = APIReturnType<'GET /api/apm/services/{serviceName}/service_overview_instances/detailed_statistics'>; export function getColumns({ serviceName, agentName, latencyAggregationType, - comparisonStatsData, + detailedStatsData, comparisonEnabled, + toggleRowDetails, + itemIdToExpandedRowMap, + toggleRowActionMenu, + itemIdToOpenActionMenuRowMap, }: { serviceName: string; agentName?: string; latencyAggregationType?: LatencyAggregationType; - comparisonStatsData?: ServiceInstanceComparisonStatistics; + detailedStatsData?: ServiceInstanceDetailedStatistics; comparisonEnabled?: boolean; -}): Array> { + toggleRowDetails: (selectedServiceNodeName: string) => void; + itemIdToExpandedRowMap: Record; + toggleRowActionMenu: (selectedServiceNodeName: string) => void; + itemIdToOpenActionMenuRowMap: Record; +}): Array> { return [ { field: 'serviceNodeName', @@ -82,14 +96,14 @@ export function getColumns({ sortable: true, }, { - field: 'latencyValue', + field: 'latency', name: getLatencyColumnLabel(latencyAggregationType), width: px(unit * 10), render: (_, { serviceNodeName, latency }) => { const currentPeriodTimestamp = - comparisonStatsData?.currentPeriod?.[serviceNodeName]?.latency; + detailedStatsData?.currentPeriod?.[serviceNodeName]?.latency; const previousPeriodTimestamp = - comparisonStatsData?.previousPeriod?.[serviceNodeName]?.latency; + detailedStatsData?.previousPeriod?.[serviceNodeName]?.latency; return ( { const currentPeriodTimestamp = - comparisonStatsData?.currentPeriod?.[serviceNodeName]?.throughput; + detailedStatsData?.currentPeriod?.[serviceNodeName]?.throughput; const previousPeriodTimestamp = - comparisonStatsData?.previousPeriod?.[serviceNodeName]?.throughput; + detailedStatsData?.previousPeriod?.[serviceNodeName]?.throughput; return ( { const currentPeriodTimestamp = - comparisonStatsData?.currentPeriod?.[serviceNodeName]?.errorRate; + detailedStatsData?.currentPeriod?.[serviceNodeName]?.errorRate; const previousPeriodTimestamp = - comparisonStatsData?.previousPeriod?.[serviceNodeName]?.errorRate; + detailedStatsData?.previousPeriod?.[serviceNodeName]?.errorRate; return ( { const currentPeriodTimestamp = - comparisonStatsData?.currentPeriod?.[serviceNodeName]?.cpuUsage; + detailedStatsData?.currentPeriod?.[serviceNodeName]?.cpuUsage; const previousPeriodTimestamp = - comparisonStatsData?.previousPeriod?.[serviceNodeName]?.cpuUsage; + detailedStatsData?.previousPeriod?.[serviceNodeName]?.cpuUsage; return ( { const currentPeriodTimestamp = - comparisonStatsData?.currentPeriod?.[serviceNodeName]?.memoryUsage; + detailedStatsData?.currentPeriod?.[serviceNodeName]?.memoryUsage; const previousPeriodTimestamp = - comparisonStatsData?.previousPeriod?.[serviceNodeName]?.memoryUsage; + detailedStatsData?.previousPeriod?.[serviceNodeName]?.memoryUsage; return ( { + return ( + + toggleRowActionMenu(instanceItem.serviceNodeName) + } + isOpen={itemIdToOpenActionMenuRowMap[instanceItem.serviceNodeName]} + anchorPosition="leftCenter" + button={ + + toggleRowActionMenu(instanceItem.serviceNodeName) + } + /> + } + > + toggleRowActionMenu(instanceItem.serviceNodeName)} + /> + + ); + }, + }, + { + align: RIGHT_ALIGNMENT, + width: '40px', + isExpander: true, + render: (instanceItem: MainStatsServiceInstanceItem) => { + return ( + toggleRowDetails(instanceItem.serviceNodeName)} + aria-label={ + itemIdToExpandedRowMap[instanceItem.serviceNodeName] + ? 'Collapse' + : 'Expand' + } + iconType={ + itemIdToExpandedRowMap[instanceItem.serviceNodeName] + ? 'arrowUp' + : 'arrowDown' + } + /> + ); + }, + }, ]; } diff --git a/x-pack/plugins/apm/public/components/app/service_overview/service_overview_instances_table/index.tsx b/x-pack/plugins/apm/public/components/app/service_overview/service_overview_instances_table/index.tsx index 28654acbefa46..fe367896c4652 100644 --- a/x-pack/plugins/apm/public/components/app/service_overview/service_overview_instances_table/index.tsx +++ b/x-pack/plugins/apm/public/components/app/service_overview/service_overview_instances_table/index.tsx @@ -12,7 +12,7 @@ import { EuiTitle, } from '@elastic/eui'; import { i18n } from '@kbn/i18n'; -import React from 'react'; +import React, { ReactNode, useEffect, useState } from 'react'; import { useApmServiceContext } from '../../../../context/apm_service/use_apm_service_context'; import { useUrlParams } from '../../../../context/url_params_context/use_url_params'; import { FETCH_STATUS } from '../../../../hooks/use_fetcher'; @@ -20,14 +20,15 @@ import { APIReturnType } from '../../../../services/rest/createCallApmApi'; import { TableFetchWrapper } from '../../../shared/table_fetch_wrapper'; import { PAGE_SIZE, - PrimaryStatsServiceInstanceItem, + MainStatsServiceInstanceItem, SortDirection, SortField, } from '../service_overview_instances_chart_and_table'; import { ServiceOverviewTableContainer } from '../service_overview_table_container'; import { getColumns } from './get_columns'; +import { InstanceDetails } from './intance_details'; -type ServiceInstanceComparisonStatistics = APIReturnType<'GET /api/apm/services/{serviceName}/service_overview_instances/comparison_statistics'>; +type ServiceInstanceDetailedStatistics = APIReturnType<'GET /api/apm/services/{serviceName}/service_overview_instances/detailed_statistics'>; export interface TableOptions { pageIndex: number; @@ -38,26 +39,26 @@ export interface TableOptions { } interface Props { - primaryStatsItems: PrimaryStatsServiceInstanceItem[]; + mainStatsItems: MainStatsServiceInstanceItem[]; serviceName: string; - primaryStatsStatus: FETCH_STATUS; - primaryStatsItemCount: number; + mainStatsStatus: FETCH_STATUS; + mainStatsItemCount: number; tableOptions: TableOptions; onChangeTableOptions: (newTableOptions: { page?: { index: number }; sort?: { field: string; direction: SortDirection }; }) => void; - comparisonStatsData?: ServiceInstanceComparisonStatistics; + detailedStatsData?: ServiceInstanceDetailedStatistics; isLoading: boolean; } export function ServiceOverviewInstancesTable({ - primaryStatsItems = [], - primaryStatsItemCount, + mainStatsItems = [], + mainStatsItemCount, serviceName, - primaryStatsStatus: status, + mainStatsStatus: status, tableOptions, onChangeTableOptions, - comparisonStatsData: comparisonStatsData, + detailedStatsData: detailedStatsData, isLoading, }: Props) { const { agentName } = useApmServiceContext(); @@ -65,21 +66,64 @@ export function ServiceOverviewInstancesTable({ urlParams: { latencyAggregationType, comparisonEnabled }, } = useUrlParams(); + const [ + itemIdToOpenActionMenuRowMap, + setItemIdToOpenActionMenuRowMap, + ] = useState>({}); + + const [itemIdToExpandedRowMap, setItemIdToExpandedRowMap] = useState< + Record + >({}); + + useEffect(() => { + // Closes any open rows when fetching new items + setItemIdToExpandedRowMap({}); + }, [status]); + const { pageIndex, sort } = tableOptions; const { direction, field } = sort; + const toggleRowActionMenu = (selectedServiceNodeName: string) => { + const actionMenuRowMapValues = { ...itemIdToOpenActionMenuRowMap }; + if (actionMenuRowMapValues[selectedServiceNodeName]) { + delete actionMenuRowMapValues[selectedServiceNodeName]; + } else { + actionMenuRowMapValues[selectedServiceNodeName] = true; + } + setItemIdToOpenActionMenuRowMap(actionMenuRowMapValues); + }; + + const toggleRowDetails = (selectedServiceNodeName: string) => { + const expandedRowMapValues = { ...itemIdToExpandedRowMap }; + if (expandedRowMapValues[selectedServiceNodeName]) { + delete expandedRowMapValues[selectedServiceNodeName]; + } else { + expandedRowMapValues[selectedServiceNodeName] = ( + + ); + } + setItemIdToExpandedRowMap(expandedRowMapValues); + }; + const columns = getColumns({ agentName, serviceName, latencyAggregationType, - comparisonStatsData, + detailedStatsData, comparisonEnabled, + toggleRowDetails, + itemIdToExpandedRowMap, + toggleRowActionMenu, + itemIdToOpenActionMenuRowMap, }); const pagination = { pageIndex, pageSize: PAGE_SIZE, - totalItemCount: primaryStatsItemCount, + totalItemCount: mainStatsItemCount, hidePerPageOptions: true, }; @@ -97,15 +141,17 @@ export function ServiceOverviewInstancesTable({ diff --git a/x-pack/plugins/apm/public/components/app/service_overview/service_overview_instances_table/instance_actions_menu/index.tsx b/x-pack/plugins/apm/public/components/app/service_overview/service_overview_instances_table/instance_actions_menu/index.tsx new file mode 100644 index 0000000000000..f03c2b2fc9091 --- /dev/null +++ b/x-pack/plugins/apm/public/components/app/service_overview/service_overview_instances_table/instance_actions_menu/index.tsx @@ -0,0 +1,131 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ +import { EuiLoadingSpinner } from '@elastic/eui'; +import React from 'react'; +import { useHistory } from 'react-router-dom'; +import { + ActionMenuDivider, + Section, + SectionLink, + SectionLinks, + SectionSubtitle, + SectionTitle, +} from '../../../../../../../observability/public'; +import { isJavaAgentName } from '../../../../../../common/agent_name'; +import { SERVICE_NODE_NAME } from '../../../../../../common/elasticsearch_fieldnames'; +import { useApmPluginContext } from '../../../../../context/apm_plugin/use_apm_plugin_context'; +import { useUrlParams } from '../../../../../context/url_params_context/use_url_params'; +import { FETCH_STATUS } from '../../../../../hooks/use_fetcher'; +import { px } from '../../../../../style/variables'; +import { pushNewItemToKueryBar } from '../../../../shared/KueryBar/utils'; +import { useMetricOverviewHref } from '../../../../shared/Links/apm/MetricOverviewLink'; +import { useServiceNodeMetricOverviewHref } from '../../../../shared/Links/apm/ServiceNodeMetricOverviewLink'; +import { useInstanceDetailsFetcher } from '../use_instance_details_fetcher'; +import { getMenuSections } from './menu_sections'; + +interface Props { + serviceName: string; + serviceNodeName: string; + onClose: () => void; +} + +const POPOVER_WIDTH = px(305); + +export function InstanceActionsMenu({ + serviceName, + serviceNodeName, + onClose, +}: Props) { + const { core } = useApmPluginContext(); + const { data, status } = useInstanceDetailsFetcher({ + serviceName, + serviceNodeName, + }); + const serviceNodeMetricOverviewHref = useServiceNodeMetricOverviewHref({ + serviceName, + serviceNodeName, + }); + const metricOverviewHref = useMetricOverviewHref(serviceName); + const history = useHistory(); + const { + urlParams: { kuery }, + } = useUrlParams(); + + if ( + status === FETCH_STATUS.LOADING || + status === FETCH_STATUS.NOT_INITIATED + ) { + return ( +
+ +
+ ); + } + + if (!data) { + return null; + } + + const handleFilterByInstanceClick = () => { + onClose(); + pushNewItemToKueryBar({ + kuery, + history, + key: SERVICE_NODE_NAME, + value: serviceNodeName, + }); + }; + + const metricsHref = isJavaAgentName(data.agent?.name) + ? serviceNodeMetricOverviewHref + : metricOverviewHref; + + const sections = getMenuSections({ + instanceDetails: data, + basePath: core.http.basePath, + onFilterByInstanceClick: handleFilterByInstanceClick, + metricsHref, + }); + + return ( +
+ {sections.map((section, idx) => { + const isLastSection = idx !== sections.length - 1; + return ( +
+ {section.map((item) => ( +
+ {item.title && {item.title}} + {item.subtitle && ( + {item.subtitle} + )} + + {item.actions.map((action) => ( + + ))} + +
+ ))} + {isLastSection && } +
+ ); + })} +
+ ); +} diff --git a/x-pack/plugins/apm/public/components/app/service_overview/service_overview_instances_table/instance_actions_menu/menu_sections.ts b/x-pack/plugins/apm/public/components/app/service_overview/service_overview_instances_table/instance_actions_menu/menu_sections.ts new file mode 100644 index 0000000000000..30995fbd13397 --- /dev/null +++ b/x-pack/plugins/apm/public/components/app/service_overview/service_overview_instances_table/instance_actions_menu/menu_sections.ts @@ -0,0 +1,203 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import { i18n } from '@kbn/i18n'; +import { IBasePath } from 'kibana/public'; +import { isEmpty } from 'lodash'; +import moment from 'moment'; +import { APIReturnType } from '../../../../../services/rest/createCallApmApi'; +import { getInfraHref } from '../../../../shared/Links/InfraLink'; + +type InstaceDetails = APIReturnType<'GET /api/apm/services/{serviceName}/service_overview_instances/details/{serviceNodeName}'>; + +interface Action { + key: string; + label: string; + href?: string; + onClick?: () => void; + condition: boolean; +} + +interface Section { + key: string; + title?: string; + subtitle?: string; + actions: Action[]; +} + +type SectionRecord = Record; + +function getInfraMetricsQuery(timestamp?: string) { + if (!timestamp) { + return { from: 0, to: 0 }; + } + const timeInMilliseconds = new Date(timestamp).getTime(); + const fiveMinutes = moment.duration(5, 'minutes').asMilliseconds(); + + return { + from: timeInMilliseconds - fiveMinutes, + to: timeInMilliseconds + fiveMinutes, + }; +} + +export function getMenuSections({ + instanceDetails, + basePath, + onFilterByInstanceClick, + metricsHref, +}: { + instanceDetails: InstaceDetails; + basePath: IBasePath; + onFilterByInstanceClick: () => void; + metricsHref: string; +}) { + const podId = instanceDetails.kubernetes?.pod?.uid; + const containerId = instanceDetails.container?.id; + const time = instanceDetails['@timestamp'] + ? new Date(instanceDetails['@timestamp']).valueOf() + : undefined; + const infraMetricsQuery = getInfraMetricsQuery(instanceDetails['@timestamp']); + + const podActions: Action[] = [ + { + key: 'podLogs', + label: i18n.translate( + 'xpack.apm.serviceOverview.instancesTable.actionMenus.podLogs', + { defaultMessage: 'Pod logs' } + ), + href: getInfraHref({ + app: 'logs', + basePath, + path: `/link-to/pod-logs/${podId}`, + query: { time }, + }), + condition: !!podId, + }, + { + key: 'podMetrics', + label: i18n.translate( + 'xpack.apm.serviceOverview.instancesTable.actionMenus.podMetrics', + { defaultMessage: 'Pod metrics' } + ), + href: getInfraHref({ + app: 'metrics', + basePath, + path: `/link-to/pod-detail/${podId}`, + query: infraMetricsQuery, + }), + condition: !!podId, + }, + ]; + + const containerActions: Action[] = [ + { + key: 'containerLogs', + label: i18n.translate( + 'xpack.apm.serviceOverview.instancesTable.actionMenus.containerLogs', + { defaultMessage: 'Container logs' } + ), + href: getInfraHref({ + app: 'logs', + basePath, + path: `/link-to/container-logs/${containerId}`, + query: { time }, + }), + condition: !!containerId, + }, + { + key: 'containerMetrics', + label: i18n.translate( + 'xpack.apm.serviceOverview.instancesTable.actionMenus.containerMetrics', + { defaultMessage: 'Container metrics' } + ), + href: getInfraHref({ + app: 'metrics', + basePath, + path: `/link-to/container-detail/${containerId}`, + query: infraMetricsQuery, + }), + condition: !!containerId, + }, + ]; + + const apmActions: Action[] = [ + { + key: 'filterByInstance', + label: i18n.translate( + 'xpack.apm.serviceOverview.instancesTable.actionMenus.filterByInstance', + { + defaultMessage: 'Filter overview by instance', + } + ), + onClick: onFilterByInstanceClick, + condition: true, + }, + { + key: 'analyzeRuntimeMetric', + label: i18n.translate( + 'xpack.apm.serviceOverview.instancesTable.actionMenus.metrics', + { + defaultMessage: 'Metrics', + } + ), + href: metricsHref, + condition: true, + }, + ]; + + const sectionRecord: SectionRecord = { + observability: [ + { + key: 'podDetails', + title: i18n.translate( + 'xpack.apm.serviceOverview.instancesTable.actionMenus.pod.title', + { + defaultMessage: 'Pod details', + } + ), + subtitle: i18n.translate( + 'xpack.apm.serviceOverview.instancesTable.actionMenus.pod.subtitle', + { + defaultMessage: + 'View logs and metrics for this pod to get further details.', + } + ), + actions: podActions, + }, + { + key: 'containerDetails', + title: i18n.translate( + 'xpack.apm.serviceOverview.instancesTable.actionMenus.container.title', + { + defaultMessage: 'Container details', + } + ), + subtitle: i18n.translate( + 'xpack.apm.serviceOverview.instancesTable.actionMenus.container.subtitle', + { + defaultMessage: + 'View logs and metrics for this container to get further details.', + } + ), + actions: containerActions, + }, + ], + apm: [{ key: 'apm', actions: apmActions }], + }; + + // Filter out actions that shouldnt be shown and sections without any actions. + return Object.values(sectionRecord) + .map((sections) => + sections + .map((section) => ({ + ...section, + actions: section.actions.filter((action) => action.condition), + })) + .filter((section) => !isEmpty(section.actions)) + ) + .filter((sections) => !isEmpty(sections)); +} diff --git a/x-pack/plugins/apm/public/components/app/service_overview/service_overview_instances_table/intance_details.tsx b/x-pack/plugins/apm/public/components/app/service_overview/service_overview_instances_table/intance_details.tsx new file mode 100644 index 0000000000000..f50d02bb15454 --- /dev/null +++ b/x-pack/plugins/apm/public/components/app/service_overview/service_overview_instances_table/intance_details.tsx @@ -0,0 +1,144 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import { EuiFlexGroup, EuiFlexItem, EuiLoadingContent } from '@elastic/eui'; +import { i18n } from '@kbn/i18n'; +import { get } from 'lodash'; +import React from 'react'; +import { useHistory } from 'react-router-dom'; +import { + CLOUD_AVAILABILITY_ZONE, + CLOUD_INSTANCE_ID, + CLOUD_INSTANCE_NAME, + CLOUD_MACHINE_TYPE, + CLOUD_PROVIDER, + CONTAINER_ID, + HOST_NAME, + POD_NAME, + SERVICE_NODE_NAME, + SERVICE_RUNTIME_NAME, + SERVICE_RUNTIME_VERSION, + SERVICE_VERSION, +} from '../../../../../common/elasticsearch_fieldnames'; +import { useUrlParams } from '../../../../context/url_params_context/use_url_params'; +import { FETCH_STATUS } from '../../../../hooks/use_fetcher'; +import { useTheme } from '../../../../hooks/use_theme'; +import { APIReturnType } from '../../../../services/rest/createCallApmApi'; +import { pct } from '../../../../style/variables'; +import { getAgentIcon } from '../../../shared/AgentIcon/get_agent_icon'; +import { KeyValueFilterList } from '../../../shared/key_value_filter_list'; +import { pushNewItemToKueryBar } from '../../../shared/KueryBar/utils'; +import { + getCloudIcon, + getContainerIcon, +} from '../../service_details/service_icons'; +import { useInstanceDetailsFetcher } from './use_instance_details_fetcher'; + +type ServiceInstanceDetails = APIReturnType<'GET /api/apm/services/{serviceName}/service_overview_instances/details/{serviceNodeName}'>; + +interface Props { + serviceName: string; + serviceNodeName: string; +} + +function toKeyValuePairs(keys: string[], data: ServiceInstanceDetails) { + return keys.map((key) => ({ key, value: get(data, key) })); +} + +const serviceDetailsKeys = [ + SERVICE_NODE_NAME, + SERVICE_VERSION, + SERVICE_RUNTIME_NAME, + SERVICE_RUNTIME_VERSION, +]; +const containerDetailsKeys = [CONTAINER_ID, HOST_NAME, POD_NAME]; +const cloudDetailsKeys = [ + CLOUD_AVAILABILITY_ZONE, + CLOUD_INSTANCE_ID, + CLOUD_INSTANCE_NAME, + CLOUD_MACHINE_TYPE, + CLOUD_PROVIDER, +]; + +export function InstanceDetails({ serviceName, serviceNodeName }: Props) { + const theme = useTheme(); + const history = useHistory(); + const { + urlParams: { kuery }, + } = useUrlParams(); + + const { data, status } = useInstanceDetailsFetcher({ + serviceName, + serviceNodeName, + }); + + if ( + status === FETCH_STATUS.LOADING || + status === FETCH_STATUS.NOT_INITIATED + ) { + return ( +
+ +
+ ); + } + + if (!data) { + return null; + } + + const addKueryBarFilter = ({ key, value }: { key: string; value: any }) => { + pushNewItemToKueryBar({ kuery, history, key, value }); + }; + + const serviceDetailsKeyValuePairs = toKeyValuePairs(serviceDetailsKeys, data); + const containerDetailsKeyValuePairs = toKeyValuePairs( + containerDetailsKeys, + data + ); + const cloudDetailsKeyValuePairs = toKeyValuePairs(cloudDetailsKeys, data); + + const containerType = data.kubernetes?.pod?.name ? 'Kubernetes' : 'Docker'; + return ( + + + + + + + + + + + + ); +} diff --git a/x-pack/plugins/apm/public/components/app/service_overview/service_overview_instances_table/use_instance_details_fetcher.tsx b/x-pack/plugins/apm/public/components/app/service_overview/service_overview_instances_table/use_instance_details_fetcher.tsx new file mode 100644 index 0000000000000..7a5da7e3e462b --- /dev/null +++ b/x-pack/plugins/apm/public/components/app/service_overview/service_overview_instances_table/use_instance_details_fetcher.tsx @@ -0,0 +1,52 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ +import { useApmServiceContext } from '../../../../context/apm_service/use_apm_service_context'; +import { useFetcher } from '../../../../hooks/use_fetcher'; +import { useUrlParams } from '../../../../context/url_params_context/use_url_params'; + +export function useInstanceDetailsFetcher({ + serviceName, + serviceNodeName, +}: { + serviceName: string; + serviceNodeName: string; +}) { + const { + urlParams: { start, end, kuery, environment }, + } = useUrlParams(); + const { transactionType } = useApmServiceContext(); + + const { data, status } = useFetcher( + (callApmApi) => { + if (!start || !end || !transactionType) { + return; + } + return callApmApi({ + endpoint: + 'GET /api/apm/services/{serviceName}/service_overview_instances/details/{serviceNodeName}', + params: { + path: { + serviceName, + serviceNodeName, + }, + query: { start, end, transactionType, environment, kuery }, + }, + }); + }, + [ + serviceName, + serviceNodeName, + start, + end, + transactionType, + environment, + kuery, + ] + ); + + return { data, status }; +} diff --git a/x-pack/plugins/apm/public/components/app/service_overview/service_overview_table_container.tsx b/x-pack/plugins/apm/public/components/app/service_overview/service_overview_table_container.tsx index 738ff0d7c735f..64b6943e73260 100644 --- a/x-pack/plugins/apm/public/components/app/service_overview/service_overview_table_container.tsx +++ b/x-pack/plugins/apm/public/components/app/service_overview/service_overview_table_container.tsx @@ -32,7 +32,7 @@ const ServiceOverviewTableContainerDiv = euiStyled.div<{ shouldUseMobileLayout ? '' : ` - height: ${tableHeight}px; + min-height: ${tableHeight}px; display: flex; flex-direction: column; diff --git a/x-pack/plugins/apm/public/components/app/service_overview/service_overview_throughput_chart.tsx b/x-pack/plugins/apm/public/components/app/service_overview/service_overview_throughput_chart.tsx index 4f6f41f862e19..60f91a9571c71 100644 --- a/x-pack/plugins/apm/public/components/app/service_overview/service_overview_throughput_chart.tsx +++ b/x-pack/plugins/apm/public/components/app/service_overview/service_overview_throughput_chart.tsx @@ -48,6 +48,7 @@ export function ServiceOverviewThroughputChart({ start, end, comparisonType, + comparisonEnabled, }); const { data = INITIAL_STATE, status } = useFetcher( @@ -98,7 +99,7 @@ export function ServiceOverviewThroughputChart({ { data: data.previousPeriod, type: 'area', - color: theme.eui.euiColorLightestShade, + color: theme.eui.euiColorMediumShade, title: i18n.translate( 'xpack.apm.serviceOverview.throughtputChart.previousPeriodLabel', { defaultMessage: 'Previous period' } diff --git a/x-pack/plugins/apm/public/components/app/service_overview/service_overview_transactions_table/get_columns.tsx b/x-pack/plugins/apm/public/components/app/service_overview/service_overview_transactions_table/get_columns.tsx index d9ca3356d7fd2..02aad49ddfc9c 100644 --- a/x-pack/plugins/apm/public/components/app/service_overview/service_overview_transactions_table/get_columns.tsx +++ b/x-pack/plugins/apm/public/components/app/service_overview/service_overview_transactions_table/get_columns.tsx @@ -23,22 +23,22 @@ import { TransactionDetailLink } from '../../../shared/Links/apm/transaction_det import { TruncateWithTooltip } from '../../../shared/truncate_with_tooltip'; import { getLatencyColumnLabel } from '../get_latency_column_label'; -type TransactionGroupPrimaryStatistics = APIReturnType<'GET /api/apm/services/{serviceName}/transactions/groups/primary_statistics'>; +type TransactionGroupMainStatistics = APIReturnType<'GET /api/apm/services/{serviceName}/transactions/groups/main_statistics'>; type ServiceTransactionGroupItem = ValuesType< - TransactionGroupPrimaryStatistics['transactionGroups'] + TransactionGroupMainStatistics['transactionGroups'] >; -type TransactionGroupComparisonStatistics = APIReturnType<'GET /api/apm/services/{serviceName}/transactions/groups/comparison_statistics'>; +type TransactionGroupDetailedStatistics = APIReturnType<'GET /api/apm/services/{serviceName}/transactions/groups/detailed_statistics'>; export function getColumns({ serviceName, latencyAggregationType, - transactionGroupComparisonStatistics, + transactionGroupDetailedStatistics, comparisonEnabled, }: { serviceName: string; latencyAggregationType?: LatencyAggregationType; - transactionGroupComparisonStatistics?: TransactionGroupComparisonStatistics; + transactionGroupDetailedStatistics?: TransactionGroupDetailedStatistics; comparisonEnabled?: boolean; }): Array> { return [ @@ -74,9 +74,9 @@ export function getColumns({ width: px(unit * 10), render: (_, { latency, name }) => { const currentTimeseries = - transactionGroupComparisonStatistics?.currentPeriod?.[name]?.latency; + transactionGroupDetailedStatistics?.currentPeriod?.[name]?.latency; const previousTimeseries = - transactionGroupComparisonStatistics?.previousPeriod?.[name]?.latency; + transactionGroupDetailedStatistics?.previousPeriod?.[name]?.latency; return ( { const currentTimeseries = - transactionGroupComparisonStatistics?.currentPeriod?.[name] - ?.throughput; + transactionGroupDetailedStatistics?.currentPeriod?.[name]?.throughput; const previousTimeseries = - transactionGroupComparisonStatistics?.previousPeriod?.[name] + transactionGroupDetailedStatistics?.previousPeriod?.[name] ?.throughput; return ( { const currentTimeseries = - transactionGroupComparisonStatistics?.currentPeriod?.[name] - ?.errorRate; + transactionGroupDetailedStatistics?.currentPeriod?.[name]?.errorRate; const previousTimeseries = - transactionGroupComparisonStatistics?.previousPeriod?.[name] - ?.errorRate; + transactionGroupDetailedStatistics?.previousPeriod?.[name]?.errorRate; return ( { const currentImpact = - transactionGroupComparisonStatistics?.currentPeriod?.[name]?.impact ?? + transactionGroupDetailedStatistics?.currentPeriod?.[name]?.impact ?? 0; const previousImpact = - transactionGroupComparisonStatistics?.previousPeriod?.[name]?.impact; + transactionGroupDetailedStatistics?.previousPeriod?.[name]?.impact; return ( diff --git a/x-pack/plugins/apm/public/components/app/service_overview/service_overview_transactions_table/index.tsx b/x-pack/plugins/apm/public/components/app/service_overview/service_overview_transactions_table/index.tsx index 121b96b0361b2..0a4a735c117d2 100644 --- a/x-pack/plugins/apm/public/components/app/service_overview/service_overview_transactions_table/index.tsx +++ b/x-pack/plugins/apm/public/components/app/service_overview/service_overview_transactions_table/index.tsx @@ -29,7 +29,7 @@ interface Props { serviceName: string; } -type ApiResponse = APIReturnType<'GET /api/apm/services/{serviceName}/transactions/groups/primary_statistics'>; +type ApiResponse = APIReturnType<'GET /api/apm/services/{serviceName}/transactions/groups/main_statistics'>; const INITIAL_STATE = { transactionGroups: [] as ApiResponse['transactionGroups'], isAggregationAccurate: true, @@ -77,6 +77,7 @@ export function ServiceOverviewTransactionsTable({ serviceName }: Props) { start, end, comparisonType, + comparisonEnabled, }); const { data = INITIAL_STATE, status } = useFetcher( @@ -86,7 +87,7 @@ export function ServiceOverviewTransactionsTable({ serviceName }: Props) { } return callApmApi({ endpoint: - 'GET /api/apm/services/{serviceName}/transactions/groups/primary_statistics', + 'GET /api/apm/services/{serviceName}/transactions/groups/main_statistics', params: { path: { serviceName }, query: { @@ -107,14 +108,13 @@ export function ServiceOverviewTransactionsTable({ serviceName }: Props) { return { ...response, - // Everytime the primary statistics is refetched, updates the requestId making the comparison API to be refetched. + // Everytime the main statistics is refetched, updates the requestId making the detailed API to be refetched. requestId: uuid(), transactionGroupsTotalItems: response.transactionGroups.length, transactionGroups: currentPageTransactionGroups, }; }); }, - // comparisonType is listed as dependency even thought it is not used. This is needed to trigger the comparison api when it is changed. // eslint-disable-next-line react-hooks/exhaustive-deps [ environment, @@ -127,15 +127,18 @@ export function ServiceOverviewTransactionsTable({ serviceName }: Props) { pageIndex, direction, field, + // not used, but needed to trigger an update when comparisonType is changed either manually by user or when time range is changed comparisonType, + // not used, but needed to trigger an update when comparison feature is disabled/enabled by user + comparisonEnabled, ] ); const { transactionGroups, requestId, transactionGroupsTotalItems } = data; const { - data: transactionGroupComparisonStatistics, - status: transactionGroupComparisonStatisticsStatus, + data: transactionGroupDetailedStatistics, + status: transactionGroupDetailedStatisticsStatus, } = useFetcher( (callApmApi) => { if ( @@ -147,7 +150,7 @@ export function ServiceOverviewTransactionsTable({ serviceName }: Props) { ) { return callApmApi({ endpoint: - 'GET /api/apm/services/{serviceName}/transactions/groups/comparison_statistics', + 'GET /api/apm/services/{serviceName}/transactions/groups/detailed_statistics', params: { path: { serviceName }, query: { @@ -168,7 +171,7 @@ export function ServiceOverviewTransactionsTable({ serviceName }: Props) { }); } }, - // only fetches comparison statistics when requestId is invalidated by primary statistics api call + // only fetches detailed statistics when requestId is invalidated by main statistics api call // eslint-disable-next-line react-hooks/exhaustive-deps [requestId], { preservePreviousData: false } @@ -177,13 +180,13 @@ export function ServiceOverviewTransactionsTable({ serviceName }: Props) { const columns = getColumns({ serviceName, latencyAggregationType, - transactionGroupComparisonStatistics, + transactionGroupDetailedStatistics, comparisonEnabled, }); const isLoading = status === FETCH_STATUS.LOADING || - transactionGroupComparisonStatisticsStatus === FETCH_STATUS.LOADING; + transactionGroupDetailedStatisticsStatus === FETCH_STATUS.LOADING; const pagination = { pageIndex, diff --git a/x-pack/plugins/apm/public/components/app/transaction_details/WaterfallWithSummmary/TransactionTabs.tsx b/x-pack/plugins/apm/public/components/app/transaction_details/WaterfallWithSummmary/TransactionTabs.tsx index 5d6e46bb2ffd2..7f8ffb62d9e72 100644 --- a/x-pack/plugins/apm/public/components/app/transaction_details/WaterfallWithSummmary/TransactionTabs.tsx +++ b/x-pack/plugins/apm/public/components/app/transaction_details/WaterfallWithSummmary/TransactionTabs.tsx @@ -137,6 +137,19 @@ function LogsTabContent({ transaction }: { transaction: Transaction }) { endTimestamp={endTimestamp + framePaddingMs} query={`trace.id:"${transaction.trace.id}" OR "${transaction.trace.id}"`} height={640} + columns={[ + { type: 'timestamp' }, + { + type: 'field', + field: 'service.name', + header: i18n.translate( + 'xpack.apm.propertiesTable.tabs.logs.serviceName', + { defaultMessage: 'Service Name' } + ), + width: 200, + }, + { type: 'message' }, + ]} /> ); } diff --git a/x-pack/plugins/apm/public/components/shared/KueryBar/utils.ts b/x-pack/plugins/apm/public/components/shared/KueryBar/utils.ts new file mode 100644 index 0000000000000..56aed1227b1e0 --- /dev/null +++ b/x-pack/plugins/apm/public/components/shared/KueryBar/utils.ts @@ -0,0 +1,28 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import { History } from 'history'; +import { isEmpty } from 'lodash'; +import { push } from '../Links/url_helpers'; + +export function pushNewItemToKueryBar({ + kuery, + history, + key, + value, +}: { + kuery?: string; + history: History; + key: string; + value: any; +}) { + const newItem = `${key} :"${value}"`; + const nextKuery = isEmpty(kuery) ? newItem : `${kuery} and ${newItem}`; + push(history, { + query: { kuery: encodeURIComponent(nextKuery) }, + }); +} diff --git a/x-pack/plugins/apm/public/components/shared/Links/apm/ServiceNodeMetricOverviewLink.tsx b/x-pack/plugins/apm/public/components/shared/Links/apm/ServiceNodeMetricOverviewLink.tsx index 7ad7f18b425cd..aad5756b70e7e 100644 --- a/x-pack/plugins/apm/public/components/shared/Links/apm/ServiceNodeMetricOverviewLink.tsx +++ b/x-pack/plugins/apm/public/components/shared/Links/apm/ServiceNodeMetricOverviewLink.tsx @@ -5,40 +5,46 @@ * 2.0. */ +import { EuiLink } from '@elastic/eui'; import React from 'react'; -import { APMLink, APMLinkExtendProps } from './APMLink'; -import { useUrlParams } from '../../../../context/url_params_context/use_url_params'; -import { pickKeys } from '../../../../../common/utils/pick_keys'; +import { APMQueryParams } from '../url_helpers'; +import { APMLinkExtendProps, useAPMHref } from './APMLink'; interface Props extends APMLinkExtendProps { serviceName: string; serviceNodeName: string; } -function ServiceNodeMetricOverviewLink({ +const persistedFilters: Array = [ + 'host', + 'containerId', + 'podName', + 'serviceVersion', +]; + +export function useServiceNodeMetricOverviewHref({ + serviceName, + serviceNodeName, +}: { + serviceName: string; + serviceNodeName: string; +}) { + return useAPMHref({ + path: `/services/${serviceName}/nodes/${encodeURIComponent( + serviceNodeName + )}/metrics`, + persistedFilters, + }); +} + +export function ServiceNodeMetricOverviewLink({ serviceName, serviceNodeName, ...rest }: Props) { - const { urlParams } = useUrlParams(); - - const persistedFilters = pickKeys( - urlParams, - 'host', - 'containerId', - 'podName', - 'serviceVersion' - ); - - return ( - - ); + const href = useServiceNodeMetricOverviewHref({ + serviceName, + serviceNodeName, + }); + return ; } - -export { ServiceNodeMetricOverviewLink }; diff --git a/x-pack/plugins/apm/public/components/shared/charts/helper/get_alert_annotations.tsx b/x-pack/plugins/apm/public/components/shared/charts/helper/get_alert_annotations.tsx new file mode 100644 index 0000000000000..2c086dbb17222 --- /dev/null +++ b/x-pack/plugins/apm/public/components/shared/charts/helper/get_alert_annotations.tsx @@ -0,0 +1,74 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ +import React from 'react'; +import { ValuesType } from 'utility-types'; +import { RectAnnotation } from '@elastic/charts'; +import { EuiTheme } from 'src/plugins/kibana_react/common'; +import { rgba } from 'polished'; +import { APIReturnType } from '../../../../services/rest/createCallApmApi'; + +type Alert = ValuesType< + APIReturnType<'GET /api/apm/services/{serviceName}/alerts'>['alerts'] +>; + +function getAlertColor({ theme, ruleId }: { ruleId: string; theme: EuiTheme }) { + switch (ruleId) { + default: + return theme.eui.euiColorVis2; + } +} + +export function getAlertAnnotations({ + alerts, + theme, +}: { + alerts?: Alert[]; + theme: EuiTheme; +}) { + return alerts?.flatMap((alert) => { + const uuid = alert['kibana.rac.alert.uuid']!; + const start = new Date(alert['kibana.rac.alert.start']!).getTime(); + const end = start + alert['kibana.rac.alert.duration.us']! / 1000; + const color = getAlertColor({ ruleId: alert['rule.id']!, theme }); + + return [ + , + , + ]; + }); +} diff --git a/x-pack/plugins/apm/public/components/shared/charts/instances_latency_distribution_chart/custom_tooltip.stories.tsx b/x-pack/plugins/apm/public/components/shared/charts/instances_latency_distribution_chart/custom_tooltip.stories.tsx index 0e24c8e51c543..0eb5b0e84ff39 100644 --- a/x-pack/plugins/apm/public/components/shared/charts/instances_latency_distribution_chart/custom_tooltip.stories.tsx +++ b/x-pack/plugins/apm/public/components/shared/charts/instances_latency_distribution_chart/custom_tooltip.stories.tsx @@ -9,13 +9,13 @@ import { TooltipInfo } from '@elastic/charts'; import React, { ComponentType } from 'react'; import { EuiThemeProvider } from '../../../../../../../../src/plugins/kibana_react/common'; import { getDurationFormatter } from '../../../../../common/utils/formatters'; -import { PrimaryStatsServiceInstanceItem } from '../../../app/service_overview/service_overview_instances_chart_and_table'; +import { MainStatsServiceInstanceItem } from '../../../app/service_overview/service_overview_instances_chart_and_table'; import { CustomTooltip } from './custom_tooltip'; function getLatencyFormatter(props: TooltipInfo) { const maxLatency = Math.max( ...props.values.map((value) => { - const datum = (value.datum as unknown) as PrimaryStatsServiceInstanceItem; + const datum = (value.datum as unknown) as MainStatsServiceInstanceItem; return datum.latency ?? 0; }) ); diff --git a/x-pack/plugins/apm/public/components/shared/charts/instances_latency_distribution_chart/custom_tooltip.tsx b/x-pack/plugins/apm/public/components/shared/charts/instances_latency_distribution_chart/custom_tooltip.tsx index 2280fa91a659c..027f764317e46 100644 --- a/x-pack/plugins/apm/public/components/shared/charts/instances_latency_distribution_chart/custom_tooltip.tsx +++ b/x-pack/plugins/apm/public/components/shared/charts/instances_latency_distribution_chart/custom_tooltip.tsx @@ -15,7 +15,7 @@ import { TimeFormatter, } from '../../../../../common/utils/formatters'; import { useTheme } from '../../../../hooks/use_theme'; -import { PrimaryStatsServiceInstanceItem } from '../../../app/service_overview/service_overview_instances_chart_and_table'; +import { MainStatsServiceInstanceItem } from '../../../app/service_overview/service_overview_instances_chart_and_table'; const latencyLabel = i18n.translate( 'xpack.apm.instancesLatencyDistributionChartTooltipLatencyLabel', @@ -48,7 +48,7 @@ function SingleInstanceCustomTooltip({ }) { const value = values[0]; const { color } = value; - const datum = (value.datum as unknown) as PrimaryStatsServiceInstanceItem; + const datum = (value.datum as unknown) as MainStatsServiceInstanceItem; const { latency, serviceNodeName, throughput } = datum; return ( @@ -119,7 +119,7 @@ function MultipleInstanceCustomTooltip({
{values.map((value) => { const { color } = value; - const datum = (value.datum as unknown) as PrimaryStatsServiceInstanceItem; + const datum = (value.datum as unknown) as MainStatsServiceInstanceItem; const { latency, serviceNodeName, throughput } = datum; return (
diff --git a/x-pack/plugins/apm/public/components/shared/charts/instances_latency_distribution_chart/index.tsx b/x-pack/plugins/apm/public/components/shared/charts/instances_latency_distribution_chart/index.tsx index 57ecbd4ca0b78..394d5b5410d41 100644 --- a/x-pack/plugins/apm/public/components/shared/charts/instances_latency_distribution_chart/index.tsx +++ b/x-pack/plugins/apm/public/components/shared/charts/instances_latency_distribution_chart/index.tsx @@ -30,7 +30,7 @@ import { } from '../../../../../common/utils/formatters'; import { FETCH_STATUS } from '../../../../hooks/use_fetcher'; import { useTheme } from '../../../../hooks/use_theme'; -import { PrimaryStatsServiceInstanceItem } from '../../../app/service_overview/service_overview_instances_chart_and_table'; +import { MainStatsServiceInstanceItem } from '../../../app/service_overview/service_overview_instances_chart_and_table'; import * as urlHelpers from '../../Links/url_helpers'; import { ChartContainer } from '../chart_container'; import { getResponseTimeTickFormatter } from '../transaction_charts/helper'; @@ -38,7 +38,7 @@ import { CustomTooltip } from './custom_tooltip'; export interface InstancesLatencyDistributionChartProps { height: number; - items?: PrimaryStatsServiceInstanceItem[]; + items?: MainStatsServiceInstanceItem[]; status: FETCH_STATUS; } diff --git a/x-pack/plugins/apm/public/components/shared/charts/latency_chart/index.tsx b/x-pack/plugins/apm/public/components/shared/charts/latency_chart/index.tsx index 3f61273729e64..a20f7325f9376 100644 --- a/x-pack/plugins/apm/public/components/shared/charts/latency_chart/index.tsx +++ b/x-pack/plugins/apm/public/components/shared/charts/latency_chart/index.tsx @@ -9,6 +9,8 @@ import { EuiFlexGroup, EuiFlexItem, EuiSelect, EuiTitle } from '@elastic/eui'; import { i18n } from '@kbn/i18n'; import React from 'react'; import { useHistory } from 'react-router-dom'; +import { AlertType } from '../../../../../common/alert_types'; +import { useApmServiceContext } from '../../../../context/apm_service/use_apm_service_context'; import { LatencyAggregationType } from '../../../../../common/latency_aggregation_types'; import { getDurationFormatter } from '../../../../../common/utils/formatters'; import { useLicenseContext } from '../../../../context/license/use_license_context'; @@ -58,6 +60,8 @@ export function LatencyChart({ height }: Props) { mlJobId, } = latencyChartsData; + const { alerts } = useApmServiceContext(); + const timeseries = [ currentPeriod, comparisonEnabled ? previousPeriod : undefined, @@ -121,6 +125,11 @@ export function LatencyChart({ height }: Props) { timeseries={timeseries} yLabelFormat={getResponseTimeTickFormatter(latencyFormatter)} anomalyTimeseries={anomalyTimeseries} + alerts={alerts.filter( + (alert) => + alert['rule.id'] === AlertType.TransactionDuration || + alert['rule.id'] === AlertType.TransactionDurationAnomaly + )} /> diff --git a/x-pack/plugins/apm/public/components/shared/charts/timeseries_chart.tsx b/x-pack/plugins/apm/public/components/shared/charts/timeseries_chart.tsx index f0faec4e99490..f8e01ea37d373 100644 --- a/x-pack/plugins/apm/public/components/shared/charts/timeseries_chart.tsx +++ b/x-pack/plugins/apm/public/components/shared/charts/timeseries_chart.tsx @@ -41,6 +41,8 @@ import { unit } from '../../../style/variables'; import { ChartContainer } from './chart_container'; import { onBrushEnd, isTimeseriesEmpty } from './helper/helper'; import { getLatencyChartSelector } from '../../../selectors/latency_chart_selectors'; +import { APMServiceAlert } from '../../../context/apm_service/apm_service_context'; +import { getAlertAnnotations } from './helper/get_alert_annotations'; interface Props { id: string; @@ -62,8 +64,8 @@ interface Props { typeof getLatencyChartSelector >['anomalyTimeseries']; customTheme?: Record; + alerts?: APMServiceAlert[]; } - export function TimeseriesChart({ id, height = unit * 16, @@ -76,6 +78,7 @@ export function TimeseriesChart({ yDomain, anomalyTimeseries, customTheme = {}, + alerts, }: Props) { const history = useHistory(); const { annotations } = useAnnotationsContext(); @@ -193,6 +196,10 @@ export function TimeseriesChart({ style={{ fill: anomalyTimeseries.scores.color }} /> )} + {getAlertAnnotations({ + alerts, + theme, + })} ); diff --git a/x-pack/plugins/apm/public/components/shared/charts/transaction_error_rate_chart/index.tsx b/x-pack/plugins/apm/public/components/shared/charts/transaction_error_rate_chart/index.tsx index fd9435db57bfd..9aefa55aaaa36 100644 --- a/x-pack/plugins/apm/public/components/shared/charts/transaction_error_rate_chart/index.tsx +++ b/x-pack/plugins/apm/public/components/shared/charts/transaction_error_rate_chart/index.tsx @@ -9,6 +9,7 @@ import { EuiPanel, EuiTitle } from '@elastic/eui'; import { i18n } from '@kbn/i18n'; import React from 'react'; import { useParams } from 'react-router-dom'; +import { AlertType } from '../../../../../common/alert_types'; import { APIReturnType } from '../../../../services/rest/createCallApmApi'; import { asPercent } from '../../../../../common/utils/formatters'; import { useFetcher } from '../../../../hooks/use_fetcher'; @@ -62,12 +63,13 @@ export function TransactionErrorRateChart({ comparisonType, }, } = useUrlParams(); - const { transactionType } = useApmServiceContext(); + const { transactionType, alerts } = useApmServiceContext(); const comparisonChartThem = getComparisonChartTheme(theme); const { comparisonStart, comparisonEnd } = getTimeRangeComparison({ start, end, comparisonType, + comparisonEnabled, }); const { data = INITIAL_STATE, status } = useFetcher( @@ -121,7 +123,7 @@ export function TransactionErrorRateChart({ { data: data.previousPeriod.transactionErrorRate, type: 'area', - color: theme.eui.euiColorLightestShade, + color: theme.eui.euiColorMediumShade, title: i18n.translate( 'xpack.apm.errorRate.chart.errorRate.previousPeriodLabel', { defaultMessage: 'Previous period' } @@ -149,6 +151,9 @@ export function TransactionErrorRateChart({ yLabelFormat={yLabelFormat} yDomain={{ min: 0, max: 1 }} customTheme={comparisonChartThem} + alerts={alerts.filter( + (alert) => alert['rule.id'] === AlertType.TransactionErrorRate + )} /> ); diff --git a/x-pack/plugins/apm/public/components/shared/key_value_filter_list/index.tsx b/x-pack/plugins/apm/public/components/shared/key_value_filter_list/index.tsx new file mode 100644 index 0000000000000..c836919a8a6ab --- /dev/null +++ b/x-pack/plugins/apm/public/components/shared/key_value_filter_list/index.tsx @@ -0,0 +1,147 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ +import { + EuiAccordion, + EuiButtonEmpty, + EuiDescriptionList, + EuiDescriptionListDescription, + EuiDescriptionListTitle, + EuiFlexGroup, + EuiFlexItem, + EuiIcon, + EuiText, + EuiToolTip, +} from '@elastic/eui'; +import { i18n } from '@kbn/i18n'; +import React, { Fragment } from 'react'; +import styled from 'styled-components'; +import { px, units } from '../../../style/variables'; + +interface KeyValue { + key: string; + value: any | undefined; +} + +const StyledEuiAccordion = styled(EuiAccordion)` + width: 100%; + .buttonContentContainer .euiIEFlexWrapFix { + width: 100%; + } +`; + +const StyledEuiDescriptionList = styled(EuiDescriptionList)` + margin: ${px(units.half)} ${px(units.half)} 0 ${px(units.half)}; + .descriptionList__title, + .descriptionList__description { + border-bottom: ${({ theme }) => theme.eui.euiBorderThin}; + margin-top: 0; + align-items: center; + display: flex; +`; + +const ValueContainer = styled.div` + display: flex; + align-items: center; +`; + +function removeEmptyValues(items: KeyValue[]) { + return items.filter(({ value }) => value !== undefined); +} + +export function KeyValueFilterList({ + icon, + title, + keyValueList, + initialIsOpen = false, + onClickFilter, +}: { + title: string; + keyValueList: KeyValue[]; + initialIsOpen?: boolean; + icon?: string; + onClickFilter: (filter: { key: string; value: any }) => void; +}) { + if (!keyValueList.length) { + return null; + } + + return ( + } + buttonClassName="buttonContentContainer" + > + + {removeEmptyValues(keyValueList).map(({ key, value }) => { + return ( + + + + {key} + + + + + { + onClickFilter({ key, value }); + }} + data-test-subj={`filter_by_${key}`} + > + + + + + {value} + + + + ); + })} + + + ); +} + +function AccordionButtonContent({ + icon, + title, +}: { + icon?: string; + title: string; +}) { + return ( + + {icon && ( + + + + )} + + {title} + + + ); +} diff --git a/x-pack/plugins/apm/public/components/shared/key_value_filter_list/key_value_filter_list.test.tsx b/x-pack/plugins/apm/public/components/shared/key_value_filter_list/key_value_filter_list.test.tsx new file mode 100644 index 0000000000000..78a7698259e7a --- /dev/null +++ b/x-pack/plugins/apm/public/components/shared/key_value_filter_list/key_value_filter_list.test.tsx @@ -0,0 +1,90 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ +import React from 'react'; +import { KeyValueFilterList } from './'; +import { + expectTextsInDocument, + renderWithTheme, +} from '../../../utils/testHelpers'; +import { fireEvent } from '@testing-library/react'; + +describe('KeyValueFilterList', () => { + it('hides accordion when key value list is empty', () => { + const { container } = renderWithTheme( + + ); + expect(container).toBeEmptyDOMElement(); + }); + it('shows list of key value pairs', () => { + const component = renderWithTheme( + + ); + expectTextsInDocument(component, [ + 'title', + 'foo', + 'foo value', + 'bar', + 'bar value', + ]); + }); + it('shows icon and title on accordion', () => { + const component = renderWithTheme( + + ); + expect(component.getByTestId('accordion_title_icon')).toBeInTheDocument(); + expectTextsInDocument(component, ['title']); + }); + it('hides icon and only shows title on accordion', () => { + const component = renderWithTheme( + + ); + expect(component.queryAllByTestId('accordion_title_icon')).toEqual([]); + expectTextsInDocument(component, ['title']); + }); + it('returns selected key value when the filter button is clicked', () => { + const mockFilter = jest.fn(); + const component = renderWithTheme( + + ); + + fireEvent.click(component.getByTestId('filter_by_foo')); + expect(mockFilter).toHaveBeenCalledWith({ key: 'foo', value: 'foo value' }); + }); +}); diff --git a/x-pack/plugins/apm/public/components/shared/time_comparison/get_time_range_comparison.test.ts b/x-pack/plugins/apm/public/components/shared/time_comparison/get_time_range_comparison.test.ts index 7234e94881ce7..77ae49bff7d84 100644 --- a/x-pack/plugins/apm/public/components/shared/time_comparison/get_time_range_comparison.test.ts +++ b/x-pack/plugins/apm/public/components/shared/time_comparison/get_time_range_comparison.test.ts @@ -11,12 +11,23 @@ import { describe('getTimeRangeComparison', () => { describe('return empty object', () => { + it('when comparison is disabled', () => { + const end = '2021-01-28T15:00:00.000Z'; + const result = getTimeRangeComparison({ + start: undefined, + end, + comparisonType: TimeRangeComparisonType.DayBefore, + comparisonEnabled: false, + }); + expect(result).toEqual({}); + }); it('when start is not defined', () => { const end = '2021-01-28T15:00:00.000Z'; const result = getTimeRangeComparison({ start: undefined, end, comparisonType: TimeRangeComparisonType.DayBefore, + comparisonEnabled: true, }); expect(result).toEqual({}); }); @@ -27,6 +38,7 @@ describe('getTimeRangeComparison', () => { start, end: undefined, comparisonType: TimeRangeComparisonType.DayBefore, + comparisonEnabled: true, }); expect(result).toEqual({}); }); @@ -39,6 +51,7 @@ describe('getTimeRangeComparison', () => { const end = '2021-01-28T15:00:00.000Z'; const result = getTimeRangeComparison({ comparisonType: TimeRangeComparisonType.DayBefore, + comparisonEnabled: true, start, end, }); @@ -52,6 +65,7 @@ describe('getTimeRangeComparison', () => { const end = '2021-01-28T15:00:00.000Z'; const result = getTimeRangeComparison({ comparisonType: TimeRangeComparisonType.WeekBefore, + comparisonEnabled: true, start, end, }); @@ -67,6 +81,7 @@ describe('getTimeRangeComparison', () => { start, end, comparisonType: TimeRangeComparisonType.PeriodBefore, + comparisonEnabled: true, }); expect(result).toEqual({ comparisonStart: '2021-02-09T14:24:02.174Z', @@ -83,6 +98,7 @@ describe('getTimeRangeComparison', () => { const end = '2021-01-28T15:00:00.000Z'; const result = getTimeRangeComparison({ comparisonType: TimeRangeComparisonType.WeekBefore, + comparisonEnabled: true, start, end, }); @@ -98,6 +114,7 @@ describe('getTimeRangeComparison', () => { const end = '2021-01-18T15:00:00.000Z'; const result = getTimeRangeComparison({ comparisonType: TimeRangeComparisonType.PeriodBefore, + comparisonEnabled: true, start, end, }); @@ -110,6 +127,7 @@ describe('getTimeRangeComparison', () => { const end = '2021-01-31T15:00:00.000Z'; const result = getTimeRangeComparison({ comparisonType: TimeRangeComparisonType.PeriodBefore, + comparisonEnabled: true, start, end, }); diff --git a/x-pack/plugins/apm/public/components/shared/time_comparison/get_time_range_comparison.ts b/x-pack/plugins/apm/public/components/shared/time_comparison/get_time_range_comparison.ts index e436f65e85ad9..025e8c2a9935d 100644 --- a/x-pack/plugins/apm/public/components/shared/time_comparison/get_time_range_comparison.ts +++ b/x-pack/plugins/apm/public/components/shared/time_comparison/get_time_range_comparison.ts @@ -39,15 +39,17 @@ const oneDayInMilliseconds = moment.duration(1, 'day').asMilliseconds(); const oneWeekInMilliseconds = moment.duration(1, 'week').asMilliseconds(); export function getTimeRangeComparison({ + comparisonEnabled, comparisonType, start, end, }: { + comparisonEnabled?: boolean; comparisonType?: TimeRangeComparisonType; start?: string; end?: string; }) { - if (!comparisonType || !start || !end) { + if (!comparisonEnabled || !comparisonType || !start || !end) { return {}; } diff --git a/x-pack/plugins/apm/public/components/shared/time_comparison/index.tsx b/x-pack/plugins/apm/public/components/shared/time_comparison/index.tsx index 84a2dad278a9b..98fbd4f399d98 100644 --- a/x-pack/plugins/apm/public/components/shared/time_comparison/index.tsx +++ b/x-pack/plugins/apm/public/components/shared/time_comparison/index.tsx @@ -63,10 +63,12 @@ function getSelectOptions({ start, end, rangeTo, + comparisonEnabled, }: { start?: string; end?: string; rangeTo?: string; + comparisonEnabled?: boolean; }) { const momentStart = moment(start); const momentEnd = moment(end); @@ -112,6 +114,7 @@ function getSelectOptions({ comparisonType: TimeRangeComparisonType.PeriodBefore, start, end, + comparisonEnabled, }); const dateFormat = getDateFormat({ @@ -140,7 +143,12 @@ export function TimeComparison() { urlParams: { start, end, comparisonEnabled, comparisonType, rangeTo }, } = useUrlParams(); - const selectOptions = getSelectOptions({ start, end, rangeTo }); + const selectOptions = getSelectOptions({ + start, + end, + rangeTo, + comparisonEnabled, + }); // Sets default values if (comparisonEnabled === undefined || comparisonType === undefined) { diff --git a/x-pack/plugins/apm/public/context/apm_plugin/apm_plugin_context.tsx b/x-pack/plugins/apm/public/context/apm_plugin/apm_plugin_context.tsx index b52bf21a6be1e..175471e7ae817 100644 --- a/x-pack/plugins/apm/public/context/apm_plugin/apm_plugin_context.tsx +++ b/x-pack/plugins/apm/public/context/apm_plugin/apm_plugin_context.tsx @@ -8,7 +8,7 @@ import { AppMountParameters, CoreStart } from 'kibana/public'; import { createContext } from 'react'; import { ConfigSchema } from '../..'; -import { ApmPluginSetupDeps } from '../../plugin'; +import { ApmPluginSetupDeps, ApmRuleRegistry } from '../../plugin'; import { MapsStartApi } from '../../../../maps/public'; export interface ApmPluginContextValue { @@ -16,6 +16,7 @@ export interface ApmPluginContextValue { config: ConfigSchema; core: CoreStart; plugins: ApmPluginSetupDeps & { maps?: MapsStartApi }; + apmRuleRegistry: ApmRuleRegistry; } export const ApmPluginContext = createContext({} as ApmPluginContextValue); diff --git a/x-pack/plugins/apm/public/context/apm_plugin/mock_apm_plugin_context.tsx b/x-pack/plugins/apm/public/context/apm_plugin/mock_apm_plugin_context.tsx index 9a910787d5fe8..07da5ea7f6c1f 100644 --- a/x-pack/plugins/apm/public/context/apm_plugin/mock_apm_plugin_context.tsx +++ b/x-pack/plugins/apm/public/context/apm_plugin/mock_apm_plugin_context.tsx @@ -12,6 +12,7 @@ import { ConfigSchema } from '../..'; import { UI_SETTINGS } from '../../../../../../src/plugins/data/common'; import { createCallApmApi } from '../../services/rest/createCallApmApi'; import { MlUrlGenerator } from '../../../../ml/public'; +import { ApmRuleRegistry } from '../../plugin'; const uiSettings: Record = { [UI_SETTINGS.TIMEPICKER_QUICK_RANGES]: [ @@ -76,6 +77,11 @@ const mockCore = { }, }; +const mockApmRuleRegistry = ({ + getTypeByRuleId: () => undefined, + registerType: () => undefined, +} as unknown) as ApmRuleRegistry; + const mockConfig: ConfigSchema = { serviceMapEnabled: true, ui: { @@ -96,6 +102,9 @@ const mockPlugin = { timefilter: { timefilter: { setTime: () => {}, getTime: () => ({}) } }, }, }, + observability: { + isAlertingExperienceEnabled: () => false, + }, }; const mockAppMountParameters = { @@ -107,6 +116,7 @@ export const mockApmPluginContextValue = { config: mockConfig, core: mockCore, plugins: mockPlugin, + apmRuleRegistry: mockApmRuleRegistry, }; export function MockApmPluginContextWrapper({ diff --git a/x-pack/plugins/apm/public/context/apm_service/apm_service_context.tsx b/x-pack/plugins/apm/public/context/apm_service/apm_service_context.tsx index c99995b982a56..54914580aefbd 100644 --- a/x-pack/plugins/apm/public/context/apm_service/apm_service_context.tsx +++ b/x-pack/plugins/apm/public/context/apm_service/apm_service_context.tsx @@ -6,6 +6,7 @@ */ import React, { createContext, ReactNode } from 'react'; +import { ValuesType } from 'utility-types'; import { isRumAgentName } from '../../../common/agent_name'; import { TRANSACTION_PAGE_LOAD, @@ -15,12 +16,19 @@ import { useServiceTransactionTypesFetcher } from './use_service_transaction_typ import { useUrlParams } from '../url_params_context/use_url_params'; import { useServiceAgentNameFetcher } from './use_service_agent_name_fetcher'; import { IUrlParams } from '../url_params_context/types'; +import { APIReturnType } from '../../services/rest/createCallApmApi'; +import { useServiceAlertsFetcher } from './use_service_alerts_fetcher'; + +export type APMServiceAlert = ValuesType< + APIReturnType<'GET /api/apm/services/{serviceName}/alerts'>['alerts'] +>; export const APMServiceContext = createContext<{ agentName?: string; transactionType?: string; transactionTypes: string[]; -}>({ transactionTypes: [] }); + alerts: APMServiceAlert[]; +}>({ transactionTypes: [], alerts: [] }); export function ApmServiceContextProvider({ children, @@ -29,16 +37,25 @@ export function ApmServiceContextProvider({ }) { const { urlParams } = useUrlParams(); const { agentName } = useServiceAgentNameFetcher(); + const transactionTypes = useServiceTransactionTypesFetcher(); + const transactionType = getTransactionType({ urlParams, transactionTypes, agentName, }); + const { alerts } = useServiceAlertsFetcher(transactionType); + return ( ); diff --git a/x-pack/plugins/apm/public/context/apm_service/use_service_alerts_fetcher.tsx b/x-pack/plugins/apm/public/context/apm_service/use_service_alerts_fetcher.tsx new file mode 100644 index 0000000000000..b07e6562a2154 --- /dev/null +++ b/x-pack/plugins/apm/public/context/apm_service/use_service_alerts_fetcher.tsx @@ -0,0 +1,74 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import { useParams } from 'react-router-dom'; +import { useApmPluginContext } from '../apm_plugin/use_apm_plugin_context'; +import { useUrlParams } from '../url_params_context/use_url_params'; +import { useFetcher } from '../../hooks/use_fetcher'; +import type { APMServiceAlert } from './apm_service_context'; + +export function useServiceAlertsFetcher(transactionType?: string) { + const { + plugins: { observability }, + } = useApmPluginContext(); + + const { + urlParams: { start, end, environment }, + } = useUrlParams(); + const { serviceName } = useParams<{ serviceName?: string }>(); + + const experimentalAlertsEnabled = observability.isAlertingExperienceEnabled(); + + const fetcherStatus = useFetcher( + (callApmApi) => { + if ( + !start || + !end || + !serviceName || + !transactionType || + !experimentalAlertsEnabled + ) { + return; + } + + return callApmApi({ + endpoint: 'GET /api/apm/services/{serviceName}/alerts', + params: { + path: { + serviceName, + }, + query: { + start, + end, + transactionType, + environment, + }, + }, + }).catch((error) => { + console.error(error); + return { + alerts: [] as APMServiceAlert[], + }; + }); + }, + [ + start, + end, + serviceName, + transactionType, + environment, + experimentalAlertsEnabled, + ] + ); + + const { data, ...rest } = fetcherStatus; + + return { + ...rest, + alerts: data?.alerts ?? [], + }; +} diff --git a/x-pack/plugins/apm/public/hooks/use_transaction_latency_chart_fetcher.ts b/x-pack/plugins/apm/public/hooks/use_transaction_latency_chart_fetcher.ts index 16a82b1d4972b..0f1592ca2679f 100644 --- a/x-pack/plugins/apm/public/hooks/use_transaction_latency_chart_fetcher.ts +++ b/x-pack/plugins/apm/public/hooks/use_transaction_latency_chart_fetcher.ts @@ -27,6 +27,7 @@ export function useTransactionLatencyChartsFetcher() { transactionName, latencyAggregationType, comparisonType, + comparisonEnabled, }, } = useUrlParams(); @@ -34,6 +35,7 @@ export function useTransactionLatencyChartsFetcher() { start, end, comparisonType, + comparisonEnabled, }); const { data, error, status } = useFetcher( diff --git a/x-pack/plugins/apm/public/plugin.ts b/x-pack/plugins/apm/public/plugin.ts index 143076e56c831..f7bbe647d8e37 100644 --- a/x-pack/plugins/apm/public/plugin.ts +++ b/x-pack/plugins/apm/public/plugin.ts @@ -5,6 +5,7 @@ * 2.0. */ +import { i18n } from '@kbn/i18n'; import type { ConfigSchema } from '.'; import { AppMountParameters, @@ -86,54 +87,57 @@ export class ApmPlugin implements Plugin { pluginSetupDeps.home.featureCatalogue.register(featureCatalogueEntry); } - if (plugins.observability) { - const getApmDataHelper = async () => { - const { - fetchObservabilityOverviewPageData, - getHasData, - createCallApmApi, - } = await import('./services/rest/apm_observability_overview_fetchers'); - // have to do this here as well in case app isn't mounted yet - createCallApmApi(core); - - return { fetchObservabilityOverviewPageData, getHasData }; - }; - plugins.observability.dashboard.register({ - appName: 'apm', - hasData: async () => { - const dataHelper = await getApmDataHelper(); - return await dataHelper.getHasData(); - }, - fetchData: async (params: FetchDataParams) => { - const dataHelper = await getApmDataHelper(); - return await dataHelper.fetchObservabilityOverviewPageData(params); - }, - }); - - const getUxDataHelper = async () => { - const { - fetchUxOverviewDate, - hasRumData, - createCallApmApi, - } = await import('./components/app/RumDashboard/ux_overview_fetchers'); - // have to do this here as well in case app isn't mounted yet - createCallApmApi(core); - - return { fetchUxOverviewDate, hasRumData }; - }; - - plugins.observability.dashboard.register({ - appName: 'ux', - hasData: async (params?: HasDataParams) => { - const dataHelper = await getUxDataHelper(); - return await dataHelper.hasRumData(params!); - }, - fetchData: async (params: FetchDataParams) => { - const dataHelper = await getUxDataHelper(); - return await dataHelper.fetchUxOverviewDate(params); - }, - }); - } + const apmRuleRegistry = plugins.observability.ruleRegistry.create({ + ...apmRuleRegistrySettings, + fieldMap: {} as APMRuleFieldMap, + ctor: FormatterRuleRegistry, + }); + const getApmDataHelper = async () => { + const { + fetchObservabilityOverviewPageData, + getHasData, + createCallApmApi, + } = await import('./services/rest/apm_observability_overview_fetchers'); + // have to do this here as well in case app isn't mounted yet + createCallApmApi(core); + + return { fetchObservabilityOverviewPageData, getHasData }; + }; + plugins.observability.dashboard.register({ + appName: 'apm', + hasData: async () => { + const dataHelper = await getApmDataHelper(); + return await dataHelper.getHasData(); + }, + fetchData: async (params: FetchDataParams) => { + const dataHelper = await getApmDataHelper(); + return await dataHelper.fetchObservabilityOverviewPageData(params); + }, + }); + + const getUxDataHelper = async () => { + const { + fetchUxOverviewDate, + hasRumData, + createCallApmApi, + } = await import('./components/app/RumDashboard/ux_overview_fetchers'); + // have to do this here as well in case app isn't mounted yet + createCallApmApi(core); + + return { fetchUxOverviewDate, hasRumData }; + }; + + plugins.observability.dashboard.register({ + appName: 'ux', + hasData: async (params?: HasDataParams) => { + const dataHelper = await getUxDataHelper(); + return await dataHelper.hasRumData(params!); + }, + fetchData: async (params: FetchDataParams) => { + const dataHelper = await getUxDataHelper(); + return await dataHelper.fetchUxOverviewDate(params); + }, + }); core.application.register({ id: 'apm', @@ -143,30 +147,51 @@ export class ApmPlugin implements Plugin { appRoute: '/app/apm', icon: 'plugins/apm/public/icon.svg', category: DEFAULT_APP_CATEGORIES.observability, + meta: { + // !! Need to be kept in sync with the routes in x-pack/plugins/apm/public/components/app/Main/route_config/index.tsx + searchDeepLinks: [ + { + id: 'services', + title: i18n.translate('xpack.apm.breadcrumb.servicesTitle', { + defaultMessage: 'Services', + }), + path: '/services', + }, + { + id: 'traces', + title: i18n.translate('xpack.apm.breadcrumb.tracesTitle', { + defaultMessage: 'Traces', + }), + path: '/traces', + }, + { + id: 'service-map', + title: i18n.translate('xpack.apm.breadcrumb.serviceMapTitle', { + defaultMessage: 'Service Map', + }), + path: '/service-map', + }, + ], + }, - async mount(params: AppMountParameters) { + async mount(appMountParameters: AppMountParameters) { // Load application bundle and Get start services - const [{ renderApp }, [coreStart, corePlugins]] = await Promise.all([ + const [{ renderApp }, [coreStart, pluginsStart]] = await Promise.all([ import('./application'), core.getStartServices(), ]); - return renderApp( + return renderApp({ coreStart, - pluginSetupDeps, - params, + pluginsSetup: pluginSetupDeps, + appMountParameters, config, - corePlugins as ApmPluginStartDeps - ); + pluginsStart: pluginsStart as ApmPluginStartDeps, + apmRuleRegistry, + }); }, }); - const apmRuleRegistry = plugins.observability.ruleRegistry.create({ - ...apmRuleRegistrySettings, - fieldMap: {} as APMRuleFieldMap, - ctor: FormatterRuleRegistry, - }); - registerApmAlerts(apmRuleRegistry); core.application.register({ @@ -193,20 +218,21 @@ export class ApmPlugin implements Plugin { 'web perf', ], }, - async mount(params: AppMountParameters) { + async mount(appMountParameters: AppMountParameters) { // Load application bundle and Get start service const [{ renderApp }, [coreStart, corePlugins]] = await Promise.all([ import('./application/csmApp'), core.getStartServices(), ]); - return renderApp( - coreStart, - pluginSetupDeps, - params, + return renderApp({ + core: coreStart, + deps: pluginSetupDeps, + appMountParameters, config, - corePlugins as ApmPluginStartDeps - ); + corePlugins: corePlugins as ApmPluginStartDeps, + apmRuleRegistry, + }); }, }); diff --git a/x-pack/plugins/apm/public/selectors/latency_chart_selector.test.ts b/x-pack/plugins/apm/public/selectors/latency_chart_selector.test.ts index 252ced2be5e0e..808beb72f2e7a 100644 --- a/x-pack/plugins/apm/public/selectors/latency_chart_selector.test.ts +++ b/x-pack/plugins/apm/public/selectors/latency_chart_selector.test.ts @@ -18,7 +18,7 @@ const theme = { euiColorVis5: 'red', euiColorVis7: 'black', euiColorVis9: 'yellow', - euiColorLightestShade: 'green', + euiColorMediumShade: 'green', }, } as EuiTheme; diff --git a/x-pack/plugins/apm/public/selectors/latency_chart_selectors.ts b/x-pack/plugins/apm/public/selectors/latency_chart_selectors.ts index 2ee4a717106eb..a84a4abfe5810 100644 --- a/x-pack/plugins/apm/public/selectors/latency_chart_selectors.ts +++ b/x-pack/plugins/apm/public/selectors/latency_chart_selectors.ts @@ -65,7 +65,7 @@ function getPreviousPeriodTimeseries({ return { data: previousPeriod.latencyTimeseries ?? [], type: 'area', - color: theme.eui.euiColorLightestShade, + color: theme.eui.euiColorMediumShade, title: i18n.translate( 'xpack.apm.serviceOverview.latencyChartTitle.previousPeriodLabel', { defaultMessage: 'Previous period' } diff --git a/x-pack/plugins/apm/server/lib/apm_telemetry/schema.ts b/x-pack/plugins/apm/server/lib/apm_telemetry/schema.ts index 565e437504ee5..0b1bc3d50d4c1 100644 --- a/x-pack/plugins/apm/server/lib/apm_telemetry/schema.ts +++ b/x-pack/plugins/apm/server/lib/apm_telemetry/schema.ts @@ -78,6 +78,7 @@ const apmPerAgentSchema: Pick< java: long, 'js-base': long, nodejs: long, + php: long, python: long, ruby: long, 'rum-js': long, @@ -99,6 +100,7 @@ const apmPerAgentSchema: Pick< java: agentSchema, 'js-base': agentSchema, nodejs: agentSchema, + php: agentSchema, python: agentSchema, ruby: agentSchema, 'rum-js': agentSchema, diff --git a/x-pack/plugins/apm/server/lib/rum_client/has_rum_data.ts b/x-pack/plugins/apm/server/lib/rum_client/has_rum_data.ts index ec96b5225d617..8de2e4e1cca42 100644 --- a/x-pack/plugins/apm/server/lib/rum_client/has_rum_data.ts +++ b/x-pack/plugins/apm/server/lib/rum_client/has_rum_data.ts @@ -49,11 +49,16 @@ export async function hasRumData({ setup }: { setup: Setup & SetupTimeRange }) { const response = await apmEventClient.search(params); return { + indices: setup.indices['apm_oss.transactionIndices']!, hasData: response.hits.total.value > 0, serviceName: response.aggregations?.services?.mostTraffic?.buckets?.[0]?.key, }; } catch (e) { - return { hasData: false, serviceName: undefined }; + return { + hasData: false, + serviceName: undefined, + indices: setup.indices['apm_oss.transactionIndices']!, + }; } } diff --git a/x-pack/plugins/apm/server/lib/services/get_service_alerts.ts b/x-pack/plugins/apm/server/lib/services/get_service_alerts.ts new file mode 100644 index 0000000000000..6356731cc48d1 --- /dev/null +++ b/x-pack/plugins/apm/server/lib/services/get_service_alerts.ts @@ -0,0 +1,80 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import { + SERVICE_NAME, + TRANSACTION_TYPE, +} from '../../../common/elasticsearch_fieldnames'; +import type { PromiseReturnType } from '../../../../observability/typings/common'; +import type { APMRuleRegistry } from '../../plugin'; +import { environmentQuery, rangeQuery } from '../../utils/queries'; + +export async function getServiceAlerts({ + apmRuleRegistryClient, + start, + end, + serviceName, + environment, + transactionType, +}: { + apmRuleRegistryClient: Exclude< + PromiseReturnType, + undefined + >; + start: number; + end: number; + serviceName: string; + environment?: string; + transactionType: string; +}) { + const response = await apmRuleRegistryClient.search({ + body: { + query: { + bool: { + filter: [ + ...rangeQuery(start, end), + ...environmentQuery(environment), + { term: { [SERVICE_NAME]: serviceName } }, + ], + should: [ + { + bool: { + filter: [ + { + term: { + [TRANSACTION_TYPE]: transactionType, + }, + }, + ], + }, + }, + { + bool: { + must_not: { + exists: { + field: TRANSACTION_TYPE, + }, + }, + }, + }, + ], + minimum_should_match: 1, + }, + }, + size: 100, + fields: ['*'], + collapse: { + field: 'kibana.rac.alert.uuid', + }, + sort: { + '@timestamp': 'desc', + }, + }, + }); + + return response.events; +} diff --git a/x-pack/plugins/apm/server/lib/services/get_service_error_groups/get_service_error_group_comparison_statistics.ts b/x-pack/plugins/apm/server/lib/services/get_service_error_groups/get_service_error_group_detailed_statistics.ts similarity index 94% rename from x-pack/plugins/apm/server/lib/services/get_service_error_groups/get_service_error_group_comparison_statistics.ts rename to x-pack/plugins/apm/server/lib/services/get_service_error_groups/get_service_error_group_detailed_statistics.ts index b559f55bbe78e..dd41269f0bad6 100644 --- a/x-pack/plugins/apm/server/lib/services/get_service_error_groups/get_service_error_group_comparison_statistics.ts +++ b/x-pack/plugins/apm/server/lib/services/get_service_error_groups/get_service_error_group_detailed_statistics.ts @@ -22,7 +22,7 @@ import { withApmSpan } from '../../../utils/with_apm_span'; import { getBucketSize } from '../../helpers/get_bucket_size'; import { Setup, SetupTimeRange } from '../../helpers/setup_request'; -export async function getServiceErrorGroupComparisonStatistics({ +export async function getServiceErrorGroupDetailedStatistics({ kuery, serviceName, setup, @@ -44,7 +44,7 @@ export async function getServiceErrorGroupComparisonStatistics({ end: number; }): Promise> { return withApmSpan( - 'get_service_error_group_comparison_statistics', + 'get_service_error_group_detailed_statistics', async () => { const { apmEventClient } = setup; @@ -147,7 +147,7 @@ export async function getServiceErrorGroupPeriods({ groupIds, }; - const currentPeriodPromise = getServiceErrorGroupComparisonStatistics({ + const currentPeriodPromise = getServiceErrorGroupDetailedStatistics({ ...commonProps, start, end, @@ -155,7 +155,7 @@ export async function getServiceErrorGroupPeriods({ const previousPeriodPromise = comparisonStart && comparisonEnd - ? getServiceErrorGroupComparisonStatistics({ + ? getServiceErrorGroupDetailedStatistics({ ...commonProps, start: comparisonStart, end: comparisonEnd, diff --git a/x-pack/plugins/apm/server/lib/services/get_service_error_groups/get_service_error_group_primary_statistics.ts b/x-pack/plugins/apm/server/lib/services/get_service_error_groups/get_service_error_group_main_statistics.ts similarity index 95% rename from x-pack/plugins/apm/server/lib/services/get_service_error_groups/get_service_error_group_primary_statistics.ts rename to x-pack/plugins/apm/server/lib/services/get_service_error_groups/get_service_error_group_main_statistics.ts index 13a6069876369..361c92244aee0 100644 --- a/x-pack/plugins/apm/server/lib/services/get_service_error_groups/get_service_error_group_primary_statistics.ts +++ b/x-pack/plugins/apm/server/lib/services/get_service_error_groups/get_service_error_group_main_statistics.ts @@ -23,7 +23,7 @@ import { withApmSpan } from '../../../utils/with_apm_span'; import { getErrorName } from '../../helpers/get_error_name'; import { Setup, SetupTimeRange } from '../../helpers/setup_request'; -export function getServiceErrorGroupPrimaryStatistics({ +export function getServiceErrorGroupMainStatistics({ kuery, serviceName, setup, @@ -36,7 +36,7 @@ export function getServiceErrorGroupPrimaryStatistics({ transactionType: string; environment?: string; }) { - return withApmSpan('get_service_error_group_primary_statistics', async () => { + return withApmSpan('get_service_error_group_main_statistics', async () => { const { apmEventClient, start, end } = setup; const response = await apmEventClient.search({ diff --git a/x-pack/plugins/apm/server/lib/services/get_service_instance_metadata_details.ts b/x-pack/plugins/apm/server/lib/services/get_service_instance_metadata_details.ts new file mode 100644 index 0000000000000..25935bcc37dff --- /dev/null +++ b/x-pack/plugins/apm/server/lib/services/get_service_instance_metadata_details.ts @@ -0,0 +1,84 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import { + SERVICE_NAME, + SERVICE_NODE_NAME, + TRANSACTION_TYPE, +} from '../../../common/elasticsearch_fieldnames'; +import { environmentQuery, kqlQuery, rangeQuery } from '../../utils/queries'; +import { withApmSpan } from '../../utils/with_apm_span'; +import { getProcessorEventForAggregatedTransactions } from '../helpers/aggregated_transactions'; +import { Setup, SetupTimeRange } from '../helpers/setup_request'; + +export interface KeyValue { + key: string; + value: any | undefined; +} + +export async function getServiceInstanceMetadataDetails({ + serviceName, + serviceNodeName, + setup, + searchAggregatedTransactions, + transactionType, + environment, + kuery, +}: { + serviceName: string; + serviceNodeName: string; + setup: Setup & SetupTimeRange; + searchAggregatedTransactions: boolean; + transactionType: string; + environment?: string; + kuery?: string; +}) { + return withApmSpan('get_service_instance_metadata_details', async () => { + const { start, end, apmEventClient } = setup; + const filter = [ + { term: { [SERVICE_NAME]: serviceName } }, + { term: { [SERVICE_NODE_NAME]: serviceNodeName } }, + { term: { [TRANSACTION_TYPE]: transactionType } }, + ...rangeQuery(start, end), + ...environmentQuery(environment), + ...kqlQuery(kuery), + ]; + + const response = await apmEventClient.search({ + apm: { + events: [ + getProcessorEventForAggregatedTransactions( + searchAggregatedTransactions + ), + ], + }, + body: { + terminate_after: 1, + size: 1, + query: { bool: { filter } }, + }, + }); + + const sample = response.hits.hits[0]?._source; + + if (!sample) { + return {}; + } + + const { agent, service, container, kubernetes, host, cloud } = sample; + + return { + '@timestamp': sample['@timestamp'], + agent, + service, + container, + kubernetes, + host, + cloud, + }; + }); +} diff --git a/x-pack/plugins/apm/server/lib/services/get_service_instances/comparison_statistics.ts b/x-pack/plugins/apm/server/lib/services/get_service_instances/detailed_statistics.ts similarity index 80% rename from x-pack/plugins/apm/server/lib/services/get_service_instances/comparison_statistics.ts rename to x-pack/plugins/apm/server/lib/services/get_service_instances/detailed_statistics.ts index 6fca42723b9cc..85414100a1563 100644 --- a/x-pack/plugins/apm/server/lib/services/get_service_instances/comparison_statistics.ts +++ b/x-pack/plugins/apm/server/lib/services/get_service_instances/detailed_statistics.ts @@ -15,7 +15,7 @@ import { Setup, SetupTimeRange } from '../../helpers/setup_request'; import { getServiceInstancesSystemMetricStatistics } from './get_service_instances_system_metric_statistics'; import { getServiceInstancesTransactionStatistics } from './get_service_instances_transaction_statistics'; -interface ServiceInstanceComparisonStatisticsParams { +interface ServiceInstanceDetailedStatisticsParams { environment?: string; kuery?: string; latencyAggregationType: LatencyAggregationType; @@ -29,8 +29,8 @@ interface ServiceInstanceComparisonStatisticsParams { serviceNodeIds: string[]; } -async function getServiceInstancesComparisonStatistics( - params: ServiceInstanceComparisonStatisticsParams +async function getServiceInstancesDetailedStatistics( + params: ServiceInstanceDetailedStatisticsParams ): Promise< Array<{ serviceNodeName: string; @@ -41,31 +41,28 @@ async function getServiceInstancesComparisonStatistics( memoryUsage?: Coordinate[]; }> > { - return withApmSpan( - 'get_service_instances_comparison_statistics', - async () => { - const [transactionStats, systemMetricStats = []] = await Promise.all([ - getServiceInstancesTransactionStatistics({ - ...params, - isComparisonSearch: true, - }), - getServiceInstancesSystemMetricStatistics({ - ...params, - isComparisonSearch: true, - }), - ]); + return withApmSpan('get_service_instances_detailed_statistics', async () => { + const [transactionStats, systemMetricStats = []] = await Promise.all([ + getServiceInstancesTransactionStatistics({ + ...params, + isComparisonSearch: true, + }), + getServiceInstancesSystemMetricStatistics({ + ...params, + isComparisonSearch: true, + }), + ]); - const stats = joinByKey( - [...transactionStats, ...systemMetricStats], - 'serviceNodeName' - ); + const stats = joinByKey( + [...transactionStats, ...systemMetricStats], + 'serviceNodeName' + ); - return stats; - } - ); + return stats; + }); } -export async function getServiceInstancesComparisonStatisticsPeriods({ +export async function getServiceInstancesDetailedStatisticsPeriods({ environment, kuery, latencyAggregationType, @@ -91,7 +88,7 @@ export async function getServiceInstancesComparisonStatisticsPeriods({ comparisonEnd?: number; }) { return withApmSpan( - 'get_service_instances_comparison_statistics_periods', + 'get_service_instances_detailed_statistics_periods', async () => { const { start, end } = setup; @@ -107,7 +104,7 @@ export async function getServiceInstancesComparisonStatisticsPeriods({ serviceNodeIds, }; - const currentPeriodPromise = getServiceInstancesComparisonStatistics({ + const currentPeriodPromise = getServiceInstancesDetailedStatistics({ ...commonParams, start, end, @@ -115,7 +112,7 @@ export async function getServiceInstancesComparisonStatisticsPeriods({ const previousPeriodPromise = comparisonStart && comparisonEnd - ? getServiceInstancesComparisonStatistics({ + ? getServiceInstancesDetailedStatistics({ ...commonParams, start: comparisonStart, end: comparisonEnd, diff --git a/x-pack/plugins/apm/server/lib/services/get_service_instances/primary_statistics.ts b/x-pack/plugins/apm/server/lib/services/get_service_instances/main_statistics.ts similarity index 87% rename from x-pack/plugins/apm/server/lib/services/get_service_instances/primary_statistics.ts rename to x-pack/plugins/apm/server/lib/services/get_service_instances/main_statistics.ts index 3cd98558eff02..8bfa67f8c6247 100644 --- a/x-pack/plugins/apm/server/lib/services/get_service_instances/primary_statistics.ts +++ b/x-pack/plugins/apm/server/lib/services/get_service_instances/main_statistics.ts @@ -12,7 +12,7 @@ import { Setup, SetupTimeRange } from '../../helpers/setup_request'; import { getServiceInstancesSystemMetricStatistics } from './get_service_instances_system_metric_statistics'; import { getServiceInstancesTransactionStatistics } from './get_service_instances_transaction_statistics'; -interface ServiceInstancePrimaryStatisticsParams { +interface ServiceInstanceMainStatisticsParams { environment?: string; kuery?: string; latencyAggregationType: LatencyAggregationType; @@ -25,8 +25,8 @@ interface ServiceInstancePrimaryStatisticsParams { end: number; } -export async function getServiceInstancesPrimaryStatistics( - params: Omit +export async function getServiceInstancesMainStatistics( + params: Omit ): Promise< Array<{ serviceNodeName: string; @@ -37,7 +37,7 @@ export async function getServiceInstancesPrimaryStatistics( memoryUsage?: number | null; }> > { - return withApmSpan('get_service_instances_primary_statistics', async () => { + return withApmSpan('get_service_instances_main_statistics', async () => { const paramsForSubQueries = { ...params, size: 50, diff --git a/x-pack/plugins/apm/server/lib/services/get_service_transaction_group_comparison_statistics.ts b/x-pack/plugins/apm/server/lib/services/get_service_transaction_group_detailed_statistics.ts similarity index 95% rename from x-pack/plugins/apm/server/lib/services/get_service_transaction_group_comparison_statistics.ts rename to x-pack/plugins/apm/server/lib/services/get_service_transaction_group_detailed_statistics.ts index 54e882d1dd6da..314d6c7bd1458 100644 --- a/x-pack/plugins/apm/server/lib/services/get_service_transaction_group_comparison_statistics.ts +++ b/x-pack/plugins/apm/server/lib/services/get_service_transaction_group_detailed_statistics.ts @@ -35,7 +35,7 @@ import { import { Setup, SetupTimeRange } from '../helpers/setup_request'; import { calculateTransactionErrorPercentage } from '../helpers/transaction_error_rate'; -export async function getServiceTransactionGroupComparisonStatistics({ +export async function getServiceTransactionGroupDetailedStatistics({ environment, kuery, serviceName, @@ -69,7 +69,7 @@ export async function getServiceTransactionGroupComparisonStatistics({ }> > { return withApmSpan( - 'get_service_transaction_group_comparison_statistics', + 'get_service_transaction_group_detailed_statistics', async () => { const { apmEventClient } = setup; const { intervalString } = getBucketSize({ start, end, numBuckets }); @@ -185,7 +185,7 @@ export async function getServiceTransactionGroupComparisonStatistics({ ); } -export async function getServiceTransactionGroupComparisonStatisticsPeriods({ +export async function getServiceTransactionGroupDetailedStatisticsPeriods({ serviceName, transactionNames, setup, @@ -224,7 +224,7 @@ export async function getServiceTransactionGroupComparisonStatisticsPeriods({ kuery, }; - const currentPeriodPromise = getServiceTransactionGroupComparisonStatistics({ + const currentPeriodPromise = getServiceTransactionGroupDetailedStatistics({ ...commonProps, start, end, @@ -232,7 +232,7 @@ export async function getServiceTransactionGroupComparisonStatisticsPeriods({ const previousPeriodPromise = comparisonStart && comparisonEnd - ? getServiceTransactionGroupComparisonStatistics({ + ? getServiceTransactionGroupDetailedStatistics({ ...commonProps, start: comparisonStart, end: comparisonEnd, diff --git a/x-pack/plugins/apm/server/plugin.ts b/x-pack/plugins/apm/server/plugin.ts index d62a3e6a5d5d7..e12d089855834 100644 --- a/x-pack/plugins/apm/server/plugin.ts +++ b/x-pack/plugins/apm/server/plugin.ts @@ -124,6 +124,11 @@ export class APMPlugin registerFeaturesUsage({ licensingPlugin: plugins.licensing }); + const apmRuleRegistry = plugins.observability.ruleRegistry.create({ + ...apmRuleRegistrySettings, + fieldMap: apmRuleFieldMap, + }); + registerRoutes({ core: { setup: core, @@ -132,6 +137,7 @@ export class APMPlugin logger: this.logger, config: currentConfig, repository: getGlobalApmServerRouteRepository(), + apmRuleRegistry, plugins: mapValues(plugins, (value, key) => { return { setup: value, @@ -151,12 +157,6 @@ export class APMPlugin savedObjectsClient: await getInternalSavedObjectsClient(core), config: await mergedConfig$.pipe(take(1)).toPromise(), }); - - const apmRuleRegistry = plugins.observability.ruleRegistry.create({ - ...apmRuleRegistrySettings, - fieldMap: apmRuleFieldMap, - }); - registerApmAlerts({ registry: apmRuleRegistry, ml: plugins.ml, diff --git a/x-pack/plugins/apm/server/routes/register_routes/index.ts b/x-pack/plugins/apm/server/routes/register_routes/index.ts index 3a88a496b923f..f792e078c528a 100644 --- a/x-pack/plugins/apm/server/routes/register_routes/index.ts +++ b/x-pack/plugins/apm/server/routes/register_routes/index.ts @@ -39,12 +39,14 @@ export function registerRoutes({ plugins, logger, config, + apmRuleRegistry, }: { core: APMRouteHandlerResources['core']; plugins: APMRouteHandlerResources['plugins']; logger: APMRouteHandlerResources['logger']; repository: ServerRouteRepository; config: APMRouteHandlerResources['config']; + apmRuleRegistry: APMRouteHandlerResources['apmRuleRegistry']; }) { const routes = repository.getRoutes(); @@ -97,6 +99,7 @@ export function registerRoutes({ }, validatedParams ), + apmRuleRegistry, })) as any; if (Array.isArray(data)) { diff --git a/x-pack/plugins/apm/server/routes/services.ts b/x-pack/plugins/apm/server/routes/services.ts index 3ac76d4a5b4c2..a27c7d5ba38d2 100644 --- a/x-pack/plugins/apm/server/routes/services.ts +++ b/x-pack/plugins/apm/server/routes/services.ts @@ -16,11 +16,13 @@ import { setupRequest } from '../lib/helpers/setup_request'; import { getServiceAnnotations } from '../lib/services/annotations'; import { getServices } from '../lib/services/get_services'; import { getServiceAgentName } from '../lib/services/get_service_agent_name'; +import { getServiceAlerts } from '../lib/services/get_service_alerts'; import { getServiceDependencies } from '../lib/services/get_service_dependencies'; -import { getServiceErrorGroupPeriods } from '../lib/services/get_service_error_groups/get_service_error_group_comparison_statistics'; -import { getServiceErrorGroupPrimaryStatistics } from '../lib/services/get_service_error_groups/get_service_error_group_primary_statistics'; -import { getServiceInstancesComparisonStatisticsPeriods } from '../lib/services/get_service_instances/comparison_statistics'; -import { getServiceInstancesPrimaryStatistics } from '../lib/services/get_service_instances/primary_statistics'; +import { getServiceInstanceMetadataDetails } from '../lib/services/get_service_instance_metadata_details'; +import { getServiceErrorGroupPeriods } from '../lib/services/get_service_error_groups/get_service_error_group_detailed_statistics'; +import { getServiceErrorGroupMainStatistics } from '../lib/services/get_service_error_groups/get_service_error_group_main_statistics'; +import { getServiceInstancesDetailedStatisticsPeriods } from '../lib/services/get_service_instances/detailed_statistics'; +import { getServiceInstancesMainStatistics } from '../lib/services/get_service_instances/main_statistics'; import { getServiceMetadataDetails } from '../lib/services/get_service_metadata_details'; import { getServiceMetadataIcons } from '../lib/services/get_service_metadata_icons'; import { getServiceNodeMetadata } from '../lib/services/get_service_node_metadata'; @@ -292,9 +294,8 @@ const serviceAnnotationsCreateRoute = createApmServerRoute({ }, }); -const serviceErrorGroupsPrimaryStatisticsRoute = createApmServerRoute({ - endpoint: - 'GET /api/apm/services/{serviceName}/error_groups/primary_statistics', +const serviceErrorGroupsMainStatisticsRoute = createApmServerRoute({ + endpoint: 'GET /api/apm/services/{serviceName}/error_groups/main_statistics', params: t.type({ path: t.type({ serviceName: t.string, @@ -317,7 +318,7 @@ const serviceErrorGroupsPrimaryStatisticsRoute = createApmServerRoute({ path: { serviceName }, query: { kuery, transactionType, environment }, } = params; - return getServiceErrorGroupPrimaryStatistics({ + return getServiceErrorGroupMainStatistics({ kuery, serviceName, setup, @@ -327,9 +328,9 @@ const serviceErrorGroupsPrimaryStatisticsRoute = createApmServerRoute({ }, }); -const serviceErrorGroupsComparisonStatisticsRoute = createApmServerRoute({ +const serviceErrorGroupsDetailedStatisticsRoute = createApmServerRoute({ endpoint: - 'GET /api/apm/services/{serviceName}/error_groups/comparison_statistics', + 'GET /api/apm/services/{serviceName}/error_groups/detailed_statistics', params: t.type({ path: t.type({ serviceName: t.string, @@ -444,9 +445,9 @@ const serviceThroughputRoute = createApmServerRoute({ }, }); -const serviceInstancesPrimaryStatisticsRoute = createApmServerRoute({ +const serviceInstancesMainStatisticsRoute = createApmServerRoute({ endpoint: - 'GET /api/apm/services/{serviceName}/service_overview_instances/primary_statistics', + 'GET /api/apm/services/{serviceName}/service_overview_instances/main_statistics', params: t.type({ path: t.type({ serviceName: t.string, @@ -479,7 +480,7 @@ const serviceInstancesPrimaryStatisticsRoute = createApmServerRoute({ const { start, end } = setup; - const serviceInstances = await getServiceInstancesPrimaryStatistics({ + const serviceInstances = await getServiceInstancesMainStatistics({ environment, kuery, latencyAggregationType, @@ -495,9 +496,9 @@ const serviceInstancesPrimaryStatisticsRoute = createApmServerRoute({ }, }); -const serviceInstancesComparisonStatisticsRoute = createApmServerRoute({ +const serviceInstancesDetailedStatisticsRoute = createApmServerRoute({ endpoint: - 'GET /api/apm/services/{serviceName}/service_overview_instances/comparison_statistics', + 'GET /api/apm/services/{serviceName}/service_overview_instances/detailed_statistics', params: t.type({ path: t.type({ serviceName: t.string, @@ -535,7 +536,7 @@ const serviceInstancesComparisonStatisticsRoute = createApmServerRoute({ setup ); - return getServiceInstancesComparisonStatisticsPeriods({ + return getServiceInstancesDetailedStatisticsPeriods({ environment, kuery, latencyAggregationType, @@ -551,7 +552,44 @@ const serviceInstancesComparisonStatisticsRoute = createApmServerRoute({ }, }); -const serviceDependenciesRoute = createApmServerRoute({ +export const serviceInstancesMetadataDetails = createApmServerRoute({ + endpoint: + 'GET /api/apm/services/{serviceName}/service_overview_instances/details/{serviceNodeName}', + params: t.type({ + path: t.type({ + serviceName: t.string, + serviceNodeName: t.string, + }), + query: t.intersection([ + t.type({ transactionType: t.string }), + environmentRt, + kueryRt, + rangeRt, + ]), + }), + options: { tags: ['access:apm'] }, + handler: async (resources) => { + const setup = await setupRequest(resources); + const { serviceName, serviceNodeName } = resources.params.path; + const { transactionType, environment, kuery } = resources.params.query; + + const searchAggregatedTransactions = await getSearchAggregatedTransactions( + setup + ); + + return await getServiceInstanceMetadataDetails({ + searchAggregatedTransactions, + setup, + serviceName, + serviceNodeName, + transactionType, + environment, + kuery, + }); + }, +}); + +export const serviceDependenciesRoute = createApmServerRoute({ endpoint: 'GET /api/apm/services/{serviceName}/dependencies', params: t.type({ path: t.type({ @@ -662,6 +700,57 @@ const serviceProfilingStatisticsRoute = createApmServerRoute({ }, }); +const serviceAlertsRoute = createApmServerRoute({ + endpoint: 'GET /api/apm/services/{serviceName}/alerts', + params: t.type({ + path: t.type({ + serviceName: t.string, + }), + query: t.intersection([ + rangeRt, + environmentRt, + t.type({ + transactionType: t.string, + }), + ]), + }), + options: { + tags: ['access:apm'], + }, + handler: async ({ context, params, apmRuleRegistry }) => { + const alertsClient = context.alerting.getAlertsClient(); + + const { + query: { start, end, environment, transactionType }, + path: { serviceName }, + } = params; + + const apmRuleRegistryClient = await apmRuleRegistry.createScopedRuleRegistryClient( + { + alertsClient, + context, + } + ); + + if (!apmRuleRegistryClient) { + throw Boom.failedDependency( + 'xpack.ruleRegistry.unsafe.write.enabled is set to false' + ); + } + + return { + alerts: await getServiceAlerts({ + apmRuleRegistryClient, + start, + end, + serviceName, + environment, + transactionType, + }), + }; + }, +}); + export const serviceRouteRepository = createApmServerRouteRepository() .add(servicesRoute) .add(serviceMetadataDetailsRoute) @@ -671,11 +760,13 @@ export const serviceRouteRepository = createApmServerRouteRepository() .add(serviceNodeMetadataRoute) .add(serviceAnnotationsRoute) .add(serviceAnnotationsCreateRoute) - .add(serviceErrorGroupsPrimaryStatisticsRoute) - .add(serviceErrorGroupsComparisonStatisticsRoute) + .add(serviceErrorGroupsMainStatisticsRoute) + .add(serviceErrorGroupsDetailedStatisticsRoute) + .add(serviceInstancesMetadataDetails) .add(serviceThroughputRoute) - .add(serviceInstancesPrimaryStatisticsRoute) - .add(serviceInstancesComparisonStatisticsRoute) + .add(serviceInstancesMainStatisticsRoute) + .add(serviceInstancesDetailedStatisticsRoute) .add(serviceDependenciesRoute) .add(serviceProfilingTimelineRoute) - .add(serviceProfilingStatisticsRoute); + .add(serviceProfilingStatisticsRoute) + .add(serviceAlertsRoute); diff --git a/x-pack/plugins/apm/server/routes/transactions.ts b/x-pack/plugins/apm/server/routes/transactions.ts index b323801430dba..bcc554e552fc3 100644 --- a/x-pack/plugins/apm/server/routes/transactions.ts +++ b/x-pack/plugins/apm/server/routes/transactions.ts @@ -15,7 +15,7 @@ import { import { getSearchAggregatedTransactions } from '../lib/helpers/aggregated_transactions'; import { setupRequest } from '../lib/helpers/setup_request'; import { getServiceTransactionGroups } from '../lib/services/get_service_transaction_groups'; -import { getServiceTransactionGroupComparisonStatisticsPeriods } from '../lib/services/get_service_transaction_group_comparison_statistics'; +import { getServiceTransactionGroupDetailedStatisticsPeriods } from '../lib/services/get_service_transaction_group_detailed_statistics'; import { getTransactionBreakdown } from '../lib/transactions/breakdown'; import { getTransactionDistribution } from '../lib/transactions/distribution'; import { getAnomalySeries } from '../lib/transactions/get_anomaly_data'; @@ -34,7 +34,7 @@ import { /** * Returns a list of transactions grouped by name - * //TODO: delete this once we moved away from the old table in the transaction overview page. It should be replaced by /transactions/groups/primary_statistics/ + * //TODO: delete this once we moved away from the old table in the transaction overview page. It should be replaced by /transactions/groups/main_statistics/ */ const transactionGroupsRoute = createApmServerRoute({ endpoint: 'GET /api/apm/services/{serviceName}/transactions/groups', @@ -74,9 +74,9 @@ const transactionGroupsRoute = createApmServerRoute({ }, }); -const transactionGroupsPrimaryStatisticsRoute = createApmServerRoute({ +const transactionGroupsMainStatisticsRoute = createApmServerRoute({ endpoint: - 'GET /api/apm/services/{serviceName}/transactions/groups/primary_statistics', + 'GET /api/apm/services/{serviceName}/transactions/groups/main_statistics', params: t.type({ path: t.type({ serviceName: t.string }), query: t.intersection([ @@ -117,9 +117,9 @@ const transactionGroupsPrimaryStatisticsRoute = createApmServerRoute({ }, }); -const transactionGroupsComparisonStatisticsRoute = createApmServerRoute({ +const transactionGroupsDetailedStatisticsRoute = createApmServerRoute({ endpoint: - 'GET /api/apm/services/{serviceName}/transactions/groups/comparison_statistics', + 'GET /api/apm/services/{serviceName}/transactions/groups/detailed_statistics', params: t.type({ path: t.type({ serviceName: t.string }), query: t.intersection([ @@ -161,7 +161,7 @@ const transactionGroupsComparisonStatisticsRoute = createApmServerRoute({ }, } = params; - return await getServiceTransactionGroupComparisonStatisticsPeriods({ + return await getServiceTransactionGroupDetailedStatisticsPeriods({ environment, kuery, setup, @@ -431,8 +431,8 @@ const transactionChartsErrorRateRoute = createApmServerRoute({ export const transactionRouteRepository = createApmServerRouteRepository() .add(transactionGroupsRoute) - .add(transactionGroupsPrimaryStatisticsRoute) - .add(transactionGroupsComparisonStatisticsRoute) + .add(transactionGroupsMainStatisticsRoute) + .add(transactionGroupsDetailedStatisticsRoute) .add(transactionLatencyChartsRoute) .add(transactionThroughputChartsRoute) .add(transactionChartsDistributionRoute) diff --git a/x-pack/plugins/apm/server/routes/typings.ts b/x-pack/plugins/apm/server/routes/typings.ts index 517387c5f74ef..602e1f3e0edb9 100644 --- a/x-pack/plugins/apm/server/routes/typings.ts +++ b/x-pack/plugins/apm/server/routes/typings.ts @@ -12,12 +12,15 @@ import { KibanaRequest, CoreStart, } from 'src/core/server'; +import { AlertingApiRequestHandlerContext } from '../../../alerting/server'; import { LicensingApiRequestHandlerContext } from '../../../licensing/server'; import { APMConfig } from '..'; import { APMPluginDependencies } from '../types'; +import { APMRuleRegistry } from '../plugin'; export interface ApmPluginRequestHandlerContext extends RequestHandlerContext { licensing: LicensingApiRequestHandlerContext; + alerting: AlertingApiRequestHandlerContext; } export type InspectResponse = Array<{ @@ -59,4 +62,5 @@ export interface APMRouteHandlerResources { start: () => Promise[key]['start']>; }; }; + apmRuleRegistry: APMRuleRegistry; } diff --git a/x-pack/plugins/apm/typings/es_schemas/raw/metric_raw.ts b/x-pack/plugins/apm/typings/es_schemas/raw/metric_raw.ts index c79a35093df52..d7d015fd21da5 100644 --- a/x-pack/plugins/apm/typings/es_schemas/raw/metric_raw.ts +++ b/x-pack/plugins/apm/typings/es_schemas/raw/metric_raw.ts @@ -6,14 +6,22 @@ */ import { APMBaseDoc } from './apm_base_doc'; +import { Cloud } from './fields/cloud'; import { Container } from './fields/container'; +import { Host } from './fields/host'; import { Kubernetes } from './fields/kubernetes'; +import { Service } from './fields/service'; type BaseMetric = APMBaseDoc & { processor: { name: 'metric'; event: 'metric'; }; + cloud?: Cloud; + container?: Container; + kubernetes?: Kubernetes; + service?: Service; + host?: Host; }; type BaseBreakdownMetric = BaseMetric & { @@ -86,8 +94,6 @@ type TransactionDurationMetric = BaseMetric & { environment?: string; version?: string; }; - container?: Container; - kubernetes?: Kubernetes; }; export type SpanDestinationMetric = BaseMetric & { diff --git a/x-pack/plugins/apm/typings/es_schemas/ui/fields/agent.ts b/x-pack/plugins/apm/typings/es_schemas/ui/fields/agent.ts index 29f11e638f195..6bc18ed8b1575 100644 --- a/x-pack/plugins/apm/typings/es_schemas/ui/fields/agent.ts +++ b/x-pack/plugins/apm/typings/es_schemas/ui/fields/agent.ts @@ -13,7 +13,8 @@ export type ElasticAgentName = | 'nodejs' | 'python' | 'dotnet' - | 'ruby'; + | 'ruby' + | 'php'; export type OpenTelemetryAgentName = | 'otlp' diff --git a/x-pack/plugins/canvas/kibana.json b/x-pack/plugins/canvas/kibana.json index cff1a3e7fa8b7..6213ecb58347c 100644 --- a/x-pack/plugins/canvas/kibana.json +++ b/x-pack/plugins/canvas/kibana.json @@ -18,6 +18,7 @@ ], "optionalPlugins": [ "home", + "reporting", "usageCollection" ], "requiredBundles": [ diff --git a/x-pack/plugins/canvas/public/application.tsx b/x-pack/plugins/canvas/public/application.tsx index f910aff9a83fe..154beb6faa7b0 100644 --- a/x-pack/plugins/canvas/public/application.tsx +++ b/x-pack/plugins/canvas/public/application.tsx @@ -24,7 +24,6 @@ import { KibanaContextProvider } from '../../../../src/plugins/kibana_react/publ import { registerLanguage } from './lib/monaco_language_def'; import { SetupRegistries } from './plugin_api'; import { initRegistries, populateRegistries, destroyRegistries } from './registries'; -import { getDocumentationLinks } from './lib/documentation_links'; import { HelpMenu } from './components/help_menu/help_menu'; import { createStore } from './store'; @@ -127,6 +126,8 @@ export const initializeCanvas = async ( } ); + // Setup documentation links + const { docLinks } = coreStart; // Set help extensions coreStart.chrome.setHelpExtension({ appName: i18n.translate('xpack.canvas.helpMenu.appName', { @@ -135,7 +136,7 @@ export const initializeCanvas = async ( links: [ { linkType: 'documentation', - href: getDocumentationLinks().canvas, + href: docLinks.links.canvas.guide, }, ], content: (domNode) => { diff --git a/x-pack/plugins/canvas/public/components/workpad_header/share_menu/__stories__/share_menu.stories.tsx b/x-pack/plugins/canvas/public/components/workpad_header/share_menu/__stories__/share_menu.stories.tsx index 6943195f03dad..bca96f3851e37 100644 --- a/x-pack/plugins/canvas/public/components/workpad_header/share_menu/__stories__/share_menu.stories.tsx +++ b/x-pack/plugins/canvas/public/components/workpad_header/share_menu/__stories__/share_menu.stories.tsx @@ -12,6 +12,7 @@ import { ShareMenu } from '../share_menu.component'; storiesOf('components/WorkpadHeader/ShareMenu', module).add('default', () => ( { diff --git a/x-pack/plugins/canvas/public/components/workpad_header/share_menu/share_menu.component.tsx b/x-pack/plugins/canvas/public/components/workpad_header/share_menu/share_menu.component.tsx index 2cd545f5d65b3..0d2e877bebdfd 100644 --- a/x-pack/plugins/canvas/public/components/workpad_header/share_menu/share_menu.component.tsx +++ b/x-pack/plugins/canvas/public/components/workpad_header/share_menu/share_menu.component.tsx @@ -28,6 +28,8 @@ export type OnCloseFn = (type: CloseTypes) => void; export type GetExportUrlFn = (type: ExportUrlTypes, layout: LayoutType) => string; export interface Props { + /** Flag to include the Reporting option only if Reporting is enabled */ + includeReporting: boolean; /** Handler to invoke when an export URL is copied to the clipboard. */ onCopy: OnCopyFn; /** Handler to invoke when an end product is exported. */ @@ -39,7 +41,12 @@ export interface Props { /** * The Menu for Exporting a Workpad from Canvas. */ -export const ShareMenu: FunctionComponent = ({ onCopy, onExport, getExportUrl }) => { +export const ShareMenu: FunctionComponent = ({ + includeReporting, + onCopy, + onExport, + getExportUrl, +}) => { const [showFlyout, setShowFlyout] = useState(false); const onClose = () => { @@ -73,16 +80,18 @@ export const ShareMenu: FunctionComponent = ({ onCopy, onExport, getExpor closePopover(); }, }, - { - name: strings.getShareDownloadPDFTitle(), - icon: 'document', - panel: { - id: 1, - title: strings.getShareDownloadPDFTitle(), - content: getPDFPanel(closePopover), - }, - 'data-test-subj': 'sharePanel-PDFReports', - }, + includeReporting + ? { + name: strings.getShareDownloadPDFTitle(), + icon: 'document', + panel: { + id: 1, + title: strings.getShareDownloadPDFTitle(), + content: getPDFPanel(closePopover), + }, + 'data-test-subj': 'sharePanel-PDFReports', + } + : false, { name: strings.getShareWebsiteTitle(), icon: , @@ -91,7 +100,7 @@ export const ShareMenu: FunctionComponent = ({ onCopy, onExport, getExpor closePopover(); }, }, - ], + ].filter(Boolean), }); const shareControl = (togglePopover: React.MouseEventHandler) => ( @@ -123,6 +132,7 @@ export const ShareMenu: FunctionComponent = ({ onCopy, onExport, getExpor }; ShareMenu.propTypes = { + includeReporting: PropTypes.bool.isRequired, onCopy: PropTypes.func.isRequired, onExport: PropTypes.func.isRequired, getExportUrl: PropTypes.func.isRequired, diff --git a/x-pack/plugins/canvas/public/components/workpad_header/share_menu/share_menu.ts b/x-pack/plugins/canvas/public/components/workpad_header/share_menu/share_menu.ts index a0448504db54b..47b5e755d439c 100644 --- a/x-pack/plugins/canvas/public/components/workpad_header/share_menu/share_menu.ts +++ b/x-pack/plugins/canvas/public/components/workpad_header/share_menu/share_menu.ts @@ -46,6 +46,7 @@ export const ShareMenu = compose( withServices, withProps( ({ workpad, pageCount, services }: Props & WithServicesProps): ComponentProps => ({ + includeReporting: services.reporting.includeReporting(), getExportUrl: (type, layout) => { if (type === 'pdf') { const pdfUrl = getPdfUrl( diff --git a/x-pack/plugins/canvas/public/components/workpad_templates/examples/__snapshots__/workpad_templates.stories.storyshot b/x-pack/plugins/canvas/public/components/workpad_templates/examples/__snapshots__/workpad_templates.stories.storyshot index 2a65ea4fd0f5f..dbb78a1b99f20 100644 --- a/x-pack/plugins/canvas/public/components/workpad_templates/examples/__snapshots__/workpad_templates.stories.storyshot +++ b/x-pack/plugins/canvas/public/components/workpad_templates/examples/__snapshots__/workpad_templates.stories.storyshot @@ -185,16 +185,15 @@ exports[`Storyshots components/WorkpadTemplates default 1`] = ` Template name - - Click to sort in descending order - + + + Click to sort in descending order diff --git a/x-pack/plugins/canvas/public/lib/documentation_links.ts b/x-pack/plugins/canvas/public/lib/documentation_links.ts deleted file mode 100644 index e76ab6d1db54b..0000000000000 --- a/x-pack/plugins/canvas/public/lib/documentation_links.ts +++ /dev/null @@ -1,21 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. - */ - -import { platformService } from '../services'; - -export const getDocumentationLinks = () => ({ - canvas: `${platformService - .getService() - .getElasticWebsiteUrl()}guide/en/kibana/${platformService - .getService() - .getDocLinkVersion()}/canvas.html`, - numeral: `${platformService - .getService() - .getElasticWebsiteUrl()}guide/en/kibana/${platformService - .getService() - .getDocLinkVersion()}/guide/numeral.html`, -}); diff --git a/x-pack/plugins/canvas/public/plugin.tsx b/x-pack/plugins/canvas/public/plugin.tsx index 486cd03eb9dd6..750b542116a75 100644 --- a/x-pack/plugins/canvas/public/plugin.tsx +++ b/x-pack/plugins/canvas/public/plugin.tsx @@ -7,6 +7,7 @@ import { BehaviorSubject } from 'rxjs'; import { ChartsPluginSetup, ChartsPluginStart } from 'src/plugins/charts/public'; +import { ReportingStart } from '../../reporting/public'; import { CoreSetup, CoreStart, @@ -49,6 +50,7 @@ export interface CanvasSetupDeps { export interface CanvasStartDeps { embeddable: EmbeddableStart; expressions: ExpressionsStart; + reporting?: ReportingStart; inspector: InspectorStart; uiActions: UiActionsStart; charts: ChartsPluginStart; diff --git a/x-pack/plugins/canvas/public/services/context.tsx b/x-pack/plugins/canvas/public/services/context.tsx index 3865d98caf2b3..4c18aa68fb51e 100644 --- a/x-pack/plugins/canvas/public/services/context.tsx +++ b/x-pack/plugins/canvas/public/services/context.tsx @@ -54,6 +54,7 @@ export const ServicesProvider: FC<{ notify: specifiedProviders.notify.getService(), platform: specifiedProviders.platform.getService(), navLink: specifiedProviders.navLink.getService(), + reporting: specifiedProviders.reporting.getService(), labs: specifiedProviders.labs.getService(), }; return {children}; diff --git a/x-pack/plugins/canvas/public/services/index.ts b/x-pack/plugins/canvas/public/services/index.ts index 9bfc41a782edc..1566d6f28085a 100644 --- a/x-pack/plugins/canvas/public/services/index.ts +++ b/x-pack/plugins/canvas/public/services/index.ts @@ -14,6 +14,7 @@ import { navLinkServiceFactory } from './nav_link'; import { embeddablesServiceFactory } from './embeddables'; import { expressionsServiceFactory } from './expressions'; import { labsServiceFactory } from './labs'; +import { reportingServiceFactory } from './reporting'; export { NotifyService } from './notify'; export { PlatformService } from './platform'; @@ -79,6 +80,7 @@ export const services = { notify: new CanvasServiceProvider(notifyServiceFactory), platform: new CanvasServiceProvider(platformServiceFactory), navLink: new CanvasServiceProvider(navLinkServiceFactory), + reporting: new CanvasServiceProvider(reportingServiceFactory), labs: new CanvasServiceProvider(labsServiceFactory), }; @@ -90,6 +92,7 @@ export interface CanvasServices { notify: ServiceFromProvider; platform: ServiceFromProvider; navLink: ServiceFromProvider; + reporting: ServiceFromProvider; labs: ServiceFromProvider; } @@ -117,4 +120,5 @@ export const { platform: platformService, navLink: navLinkService, expressions: expressionsService, + reporting: reportingService, } = services; diff --git a/x-pack/plugins/canvas/public/services/reporting.ts b/x-pack/plugins/canvas/public/services/reporting.ts new file mode 100644 index 0000000000000..3299363cd5c7f --- /dev/null +++ b/x-pack/plugins/canvas/public/services/reporting.ts @@ -0,0 +1,35 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import { CanvasServiceFactory } from './'; + +export interface ReportingService { + includeReporting: () => boolean; +} + +export const reportingServiceFactory: CanvasServiceFactory = ( + _coreSetup, + coreStart, + _setupPlugins, + startPlugins +): ReportingService => { + const { reporting } = startPlugins; + if (!reporting) { + // Reporting is not enabled + return { includeReporting: () => false }; + } + + if (reporting.usesUiCapabilities()) { + // Canvas has declared Reporting as a subfeature with the `generatePdf` UI Capability + return { + includeReporting: () => coreStart.application.capabilities.canvas?.generatePdf === true, + }; + } + + // Reporting is enabled as an Elasticsearch feature (Legacy/Deprecated) + return { includeReporting: () => true }; +}; diff --git a/x-pack/plugins/canvas/public/services/stubs/index.ts b/x-pack/plugins/canvas/public/services/stubs/index.ts index 91bda2556284e..786582ed94bd2 100644 --- a/x-pack/plugins/canvas/public/services/stubs/index.ts +++ b/x-pack/plugins/canvas/public/services/stubs/index.ts @@ -8,6 +8,7 @@ import { CanvasServices, services } from '../'; import { embeddablesService } from './embeddables'; import { expressionsService } from './expressions'; +import { reportingService } from './reporting'; import { navLinkService } from './nav_link'; import { notifyService } from './notify'; import { labsService } from './labs'; @@ -16,6 +17,7 @@ import { platformService } from './platform'; export const stubs: CanvasServices = { embeddables: embeddablesService, expressions: expressionsService, + reporting: reportingService, navLink: navLinkService, notify: notifyService, platform: platformService, diff --git a/x-pack/plugins/canvas/public/services/stubs/reporting.ts b/x-pack/plugins/canvas/public/services/stubs/reporting.ts new file mode 100644 index 0000000000000..f257dd14543ec --- /dev/null +++ b/x-pack/plugins/canvas/public/services/stubs/reporting.ts @@ -0,0 +1,12 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import { ReportingService } from '../reporting'; + +export const reportingService: ReportingService = { + includeReporting: () => true, +}; diff --git a/x-pack/plugins/canvas/server/collectors/custom_element_collector.ts b/x-pack/plugins/canvas/server/collectors/custom_element_collector.ts index 144d77df064c7..18cfe1a3df56c 100644 --- a/x-pack/plugins/canvas/server/collectors/custom_element_collector.ts +++ b/x-pack/plugins/canvas/server/collectors/custom_element_collector.ts @@ -34,13 +34,41 @@ export interface CustomElementTelemetry { export const customElementSchema: MakeSchemaFrom = { custom_elements: { - count: { type: 'long' }, + count: { + type: 'long', + _meta: { + description: 'The total number of custom Canvas elements', + }, + }, elements: { - min: { type: 'long' }, - max: { type: 'long' }, - avg: { type: 'float' }, + min: { + type: 'long', + _meta: { + description: 'The minimum number of elements used across all Canvas Custom Elements', + }, + }, + max: { + type: 'long', + _meta: { + description: 'The maximum number of elements used across all Canvas Custom Elements', + }, + }, + avg: { + type: 'float', + _meta: { + description: 'The average number of elements used in Canvas Custom Element', + }, + }, + }, + functions_in_use: { + type: 'array', + items: { + type: 'keyword', + _meta: { + description: 'The functions in use by Canvas Custom Elements', + }, + }, }, - functions_in_use: { type: 'array', items: { type: 'keyword' } }, }, }; diff --git a/x-pack/plugins/canvas/server/collectors/workpad_collector.test.ts b/x-pack/plugins/canvas/server/collectors/workpad_collector.test.ts index 0e132047b2bbd..a82a0d45fa896 100644 --- a/x-pack/plugins/canvas/server/collectors/workpad_collector.test.ts +++ b/x-pack/plugins/canvas/server/collectors/workpad_collector.test.ts @@ -8,6 +8,7 @@ import { cloneDeep } from 'lodash'; import { summarizeWorkpads } from './workpad_collector'; import { workpads } from '../../__fixtures__/workpads'; +import moment from 'moment'; describe('usage collector handle es response data', () => { it('should summarize workpads, pages, and elements', () => { @@ -49,6 +50,8 @@ describe('usage collector handle es response data', () => { 'image', 'shape', ], + in_use_30d: [], + in_use_90d: [], }, variables: { total: 7, @@ -71,7 +74,13 @@ describe('usage collector handle es response data', () => { workpads: { total: 1 }, pages: { total: 1, per_workpad: { avg: 1, min: 1, max: 1 } }, elements: { total: 1, per_page: { avg: 1, min: 1, max: 1 } }, - functions: { total: 1, in_use: ['toast'], per_element: { avg: 1, min: 1, max: 1 } }, + functions: { + total: 1, + in_use: ['toast'], + in_use_30d: [], + in_use_90d: [], + per_element: { avg: 1, min: 1, max: 1 }, + }, variables: { total: 1, per_workpad: { avg: 1, min: 1, max: 1 } }, }); }); @@ -116,6 +125,8 @@ describe('usage collector handle es response data', () => { 'plot', 'seriesStyle', ], + in_use_30d: [], + in_use_90d: [], per_element: { avg: 7, min: 7, max: 7 }, }, variables: { total: 0, per_workpad: { avg: 0, min: 0, max: 0 } }, // Variables still possible even with no pages @@ -126,4 +137,42 @@ describe('usage collector handle es response data', () => { const usage = summarizeWorkpads([]); expect(usage).toEqual({}); }); + + describe('functions', () => { + it('collects funtions used in the most recent 30d and 90d', () => { + const thirtyDayFunction = '30d'; + const ninetyDayFunction = '90d'; + const otherFunction = '180d'; + + const workpad30d = cloneDeep(workpads[0]); + const workpad90d = cloneDeep(workpads[0]); + const workpad180d = cloneDeep(workpads[0]); + + const now = moment(); + + workpad30d['@timestamp'] = now.subtract(1, 'day').toDate().toISOString(); + workpad90d['@timestamp'] = now.subtract(80, 'day').toDate().toISOString(); + workpad180d['@timestamp'] = now.subtract(180, 'day').toDate().toISOString(); + + workpad30d.pages[0].elements[0].expression = `${thirtyDayFunction}`; + workpad90d.pages[0].elements[0].expression = `${ninetyDayFunction}`; + workpad180d.pages[0].elements[0].expression = `${otherFunction}`; + + const mockWorkpads = [workpad30d, workpad90d, workpad180d]; + const usage = summarizeWorkpads(mockWorkpads); + + expect(usage.functions?.in_use_30d).toHaveLength(1); + expect(usage.functions?.in_use_30d).toEqual(expect.arrayContaining([thirtyDayFunction])); + + expect(usage.functions?.in_use_90d).toHaveLength(2); + expect(usage.functions?.in_use_90d).toEqual( + expect.arrayContaining([thirtyDayFunction, ninetyDayFunction]) + ); + + expect(usage.functions?.in_use).toHaveLength(3); + expect(usage.functions?.in_use).toEqual( + expect.arrayContaining([thirtyDayFunction, ninetyDayFunction, otherFunction]) + ); + }); + }); }); diff --git a/x-pack/plugins/canvas/server/collectors/workpad_collector.ts b/x-pack/plugins/canvas/server/collectors/workpad_collector.ts index 7342cb5d40357..427c8c8a6571f 100644 --- a/x-pack/plugins/canvas/server/collectors/workpad_collector.ts +++ b/x-pack/plugins/canvas/server/collectors/workpad_collector.ts @@ -6,6 +6,7 @@ */ import { sum as arraySum, min as arrayMin, max as arrayMax, get } from 'lodash'; +import moment from 'moment'; import { MakeSchemaFrom } from 'src/plugins/usage_collection/server'; import { CANVAS_TYPE } from '../../common/lib/constants'; import { collectFns } from './collector_helpers'; @@ -39,6 +40,8 @@ export interface WorkpadTelemetry { functions?: { total: number; in_use: string[]; + in_use_30d: string[]; + in_use_90d: string[]; per_element: { avg: number; min: number; @@ -56,38 +59,156 @@ export interface WorkpadTelemetry { } export const workpadSchema: MakeSchemaFrom = { - workpads: { total: { type: 'long' } }, + workpads: { + total: { + type: 'long', + _meta: { + description: 'The total number of Canvas Workpads in the cluster', + }, + }, + }, pages: { - total: { type: 'long' }, + total: { + type: 'long', + _meta: { + description: 'The total number of pages across all Canvas Workpads', + }, + }, per_workpad: { - avg: { type: 'float' }, - min: { type: 'long' }, - max: { type: 'long' }, + avg: { + type: 'float', + _meta: { + description: 'The average number of pages across all Canvas Workpads', + }, + }, + min: { + type: 'long', + _meta: { + description: 'The minimum number of pages found in a Canvas Workpad', + }, + }, + max: { + type: 'long', + _meta: { + description: 'The maximum number of pages found in a Canvas Workpad', + }, + }, }, }, elements: { - total: { type: 'long' }, + total: { + type: 'long', + _meta: { + description: 'The total number of elements across all Canvas Workpads', + }, + }, per_page: { - avg: { type: 'float' }, - min: { type: 'long' }, - max: { type: 'long' }, + avg: { + type: 'float', + _meta: { + description: 'The average number of elements per page across all Canvas Workpads', + }, + }, + min: { + type: 'long', + _meta: { + description: 'The minimum number of elements on a page across all Canvas Workpads', + }, + }, + max: { + type: 'long', + _meta: { + description: 'The maximum number of elements on a page across all Canvas Workpads', + }, + }, }, }, functions: { - total: { type: 'long' }, - in_use: { type: 'array', items: { type: 'keyword' } }, + total: { + type: 'long', + _meta: { + description: 'The total number of functions in use across all Canvas Workpads', + }, + }, + in_use: { + type: 'array', + items: { + type: 'keyword', + _meta: { + description: 'A function in use in any Canvas Workpad', + }, + }, + }, + in_use_30d: { + type: 'array', + items: { + type: 'keyword', + _meta: { + description: + 'A function in use in a Canvas Workpad that has been modified in the last 30 days', + }, + }, + }, + in_use_90d: { + type: 'array', + items: { + type: 'keyword', + _meta: { + description: + 'A function in use in a Canvas Workpad that has been modified in the last 90 days', + }, + }, + }, per_element: { - avg: { type: 'float' }, - min: { type: 'long' }, - max: { type: 'long' }, + avg: { + type: 'float', + _meta: { + description: 'Average number of functions used per element across all Canvas Workpads', + }, + }, + min: { + type: 'long', + _meta: { + description: + 'The minimum number of functions used in an element across all Canvas Workpads', + }, + }, + max: { + type: 'long', + _meta: { + description: + 'The maximum number of functions used in an element across all Canvas Workpads', + }, + }, }, }, variables: { - total: { type: 'long' }, + total: { + type: 'long', + _meta: { + description: 'The total number of variables defined across all Canvas Workpads', + }, + }, + per_workpad: { - avg: { type: 'float' }, - min: { type: 'long' }, - max: { type: 'long' }, + avg: { + type: 'float', + _meta: { + description: 'The average number of variables set per Canvas Workpad', + }, + }, + min: { + type: 'long', + _meta: { + description: 'The minimum number variables set across all Canvas Workpads', + }, + }, + max: { + type: 'long', + _meta: { + description: 'The maximum number of variables set across all Canvas Workpads', + }, + }, }, }, }; @@ -98,6 +219,11 @@ export const workpadSchema: MakeSchemaFrom = { @returns Workpad Telemetry Data */ export function summarizeWorkpads(workpadDocs: CanvasWorkpad[]): WorkpadTelemetry { + const functionCollection = { + all: new Set(), + '30d': new Set(), + '90d': new Set(), + }; const functionSet = new Set(); if (workpadDocs.length === 0) { @@ -106,6 +232,21 @@ export function summarizeWorkpads(workpadDocs: CanvasWorkpad[]): WorkpadTelemetr // make a summary of info about each workpad const workpadsInfo = workpadDocs.map((workpad) => { + let this30Days = false; + let this90Days = false; + + if (workpad['@timestamp'] !== undefined) { + const lastReadDaysAgo = moment().diff(moment(workpad['@timestamp']), 'days'); + + if (lastReadDaysAgo < 30) { + this30Days = true; + } + + if (lastReadDaysAgo < 90) { + this90Days = true; + } + } + let pages = { count: 0 }; try { pages = { count: workpad.pages.length }; @@ -121,6 +262,16 @@ export function summarizeWorkpads(workpadDocs: CanvasWorkpad[]): WorkpadTelemetr return page.elements.map((element) => { const ast = parseExpression(element.expression); collectFns(ast, (cFunction) => { + functionCollection.all.add(cFunction); + + if (this30Days) { + functionCollection['30d'].add(cFunction); + } + + if (this90Days) { + functionCollection['90d'].add(cFunction); + } + functionSet.add(cFunction); }); return ast.chain.length; // get the number of parts in the expression @@ -203,7 +354,9 @@ export function summarizeWorkpads(workpadDocs: CanvasWorkpad[]): WorkpadTelemetr elementsTotal > 0 ? { total: functionsTotal, - in_use: Array.from(functionSet), + in_use: Array.from(functionCollection.all), + in_use_30d: Array.from(functionCollection['30d']), + in_use_90d: Array.from(functionCollection['90d']), per_element: { avg: functionsTotal / functionCounts.length, min: arrayMin(functionCounts) || 0, diff --git a/x-pack/plugins/canvas/server/feature.test.ts b/x-pack/plugins/canvas/server/feature.test.ts new file mode 100644 index 0000000000000..cd5f0a4b4dc01 --- /dev/null +++ b/x-pack/plugins/canvas/server/feature.test.ts @@ -0,0 +1,193 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import { ReportingStart } from '../../reporting/server/types'; +import { getCanvasFeature } from './feature'; + +let mockReportingPlugin: ReportingStart; +beforeEach(() => { + mockReportingPlugin = { + usesUiCapabilities: () => false, + }; +}); + +it('Provides a feature declaration ', () => { + expect(getCanvasFeature({ reporting: mockReportingPlugin })).toMatchInlineSnapshot(` + Object { + "app": Array [ + "canvas", + "kibana", + ], + "catalogue": Array [ + "canvas", + ], + "category": Object { + "euiIconType": "logoKibana", + "id": "kibana", + "label": "Analytics", + "order": 1000, + }, + "id": "canvas", + "management": Object {}, + "name": "Canvas", + "order": 300, + "privileges": Object { + "all": Object { + "app": Array [ + "canvas", + "kibana", + ], + "catalogue": Array [ + "canvas", + ], + "savedObject": Object { + "all": Array [ + "canvas-workpad", + "canvas-element", + ], + "read": Array [ + "index-pattern", + ], + }, + "ui": Array [ + "save", + "show", + ], + }, + "read": Object { + "app": Array [ + "canvas", + "kibana", + ], + "catalogue": Array [ + "canvas", + ], + "savedObject": Object { + "all": Array [], + "read": Array [ + "index-pattern", + "canvas-workpad", + "canvas-element", + ], + }, + "ui": Array [ + "show", + ], + }, + }, + "subFeatures": Array [], + } + `); +}); + +it(`Calls on Reporting whether to include Generate PDF as a sub-feature`, () => { + mockReportingPlugin = { + usesUiCapabilities: () => true, + }; + expect(getCanvasFeature({ reporting: mockReportingPlugin })).toMatchInlineSnapshot(` + Object { + "app": Array [ + "canvas", + "kibana", + ], + "catalogue": Array [ + "canvas", + ], + "category": Object { + "euiIconType": "logoKibana", + "id": "kibana", + "label": "Analytics", + "order": 1000, + }, + "id": "canvas", + "management": Object { + "insightsAndAlerting": Array [ + "reporting", + ], + }, + "name": "Canvas", + "order": 300, + "privileges": Object { + "all": Object { + "app": Array [ + "canvas", + "kibana", + ], + "catalogue": Array [ + "canvas", + ], + "savedObject": Object { + "all": Array [ + "canvas-workpad", + "canvas-element", + ], + "read": Array [ + "index-pattern", + ], + }, + "ui": Array [ + "save", + "show", + ], + }, + "read": Object { + "app": Array [ + "canvas", + "kibana", + ], + "catalogue": Array [ + "canvas", + ], + "savedObject": Object { + "all": Array [], + "read": Array [ + "index-pattern", + "canvas-workpad", + "canvas-element", + ], + }, + "ui": Array [ + "show", + ], + }, + }, + "subFeatures": Array [ + Object { + "name": "Reporting", + "privilegeGroups": Array [ + Object { + "groupType": "independent", + "privileges": Array [ + Object { + "api": Array [ + "generateReport", + ], + "id": "generate_report", + "includeIn": "all", + "management": Object { + "insightsAndAlerting": Array [ + "reporting", + ], + }, + "minimumLicense": "platinum", + "name": "Generate PDF reports", + "savedObject": Object { + "all": Array [], + "read": Array [], + }, + "ui": Array [ + "generatePdf", + ], + }, + ], + }, + ], + }, + ], + } + `); +}); diff --git a/x-pack/plugins/canvas/server/feature.ts b/x-pack/plugins/canvas/server/feature.ts new file mode 100644 index 0000000000000..33368a8020b1e --- /dev/null +++ b/x-pack/plugins/canvas/server/feature.ts @@ -0,0 +1,81 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import { i18n } from '@kbn/i18n'; +import { DEFAULT_APP_CATEGORIES } from '../../../../src/core/server'; +import { KibanaFeatureConfig } from '../../features/common'; +import { ReportingSetup } from '../../reporting/server'; + +/* + * Register Canvas as a Kibana feature, + * with Reporting sub-feature integration (if enabled) + */ +export function getCanvasFeature(plugins: { reporting?: ReportingSetup }): KibanaFeatureConfig { + const includeReporting = plugins.reporting && plugins.reporting.usesUiCapabilities(); + + return { + id: 'canvas', + name: 'Canvas', + order: 300, + category: DEFAULT_APP_CATEGORIES.kibana, + app: ['canvas', 'kibana'], + management: { + ...(includeReporting ? { insightsAndAlerting: ['reporting'] } : {}), + }, + catalogue: ['canvas'], + privileges: { + all: { + app: ['canvas', 'kibana'], + catalogue: ['canvas'], + savedObject: { + all: ['canvas-workpad', 'canvas-element'], + read: ['index-pattern'], + }, + ui: ['save', 'show'], + }, + read: { + app: ['canvas', 'kibana'], + catalogue: ['canvas'], + savedObject: { + all: [], + read: ['index-pattern', 'canvas-workpad', 'canvas-element'], + }, + ui: ['show'], + }, + }, + subFeatures: [ + ...(includeReporting + ? ([ + { + name: i18n.translate('xpack.canvas.features.reporting.pdfFeatureName', { + defaultMessage: 'Reporting', + }), + privilegeGroups: [ + { + groupType: 'independent', + privileges: [ + { + id: 'generate_report', + name: i18n.translate('xpack.canvas.features.reporting.pdf', { + defaultMessage: 'Generate PDF reports', + }), + includeIn: 'all', + management: { insightsAndAlerting: ['reporting'] }, + minimumLicense: 'platinum', + savedObject: { all: [], read: [] }, + api: ['generateReport'], + ui: ['generatePdf'], + }, + ], + }, + ], + }, + ] as const) + : []), + ], + }; +} diff --git a/x-pack/plugins/canvas/server/plugin.ts b/x-pack/plugins/canvas/server/plugin.ts index 345f6099009fc..c95d825fb9b0b 100644 --- a/x-pack/plugins/canvas/server/plugin.ts +++ b/x-pack/plugins/canvas/server/plugin.ts @@ -10,8 +10,9 @@ import { ExpressionsServerSetup } from 'src/plugins/expressions/server'; import { BfetchServerSetup } from 'src/plugins/bfetch/server'; import { UsageCollectionSetup } from 'src/plugins/usage_collection/server'; import { HomeServerPluginSetup } from 'src/plugins/home/server'; -import { DEFAULT_APP_CATEGORIES } from '../../../../src/core/server'; +import { ReportingSetup } from '../../reporting/server'; import { PluginSetupContract as FeaturesPluginSetup } from '../../features/server'; +import { getCanvasFeature } from './feature'; import { initRoutes } from './routes'; import { registerCanvasUsageCollector } from './collectors'; import { loadSampleData } from './sample_data'; @@ -24,6 +25,7 @@ interface PluginsSetup { features: FeaturesPluginSetup; home: HomeServerPluginSetup; bfetch: BfetchServerSetup; + reporting?: ReportingSetup; usageCollection?: UsageCollectionSetup; } @@ -38,34 +40,7 @@ export class CanvasPlugin implements Plugin { coreSetup.savedObjects.registerType(workpadType); coreSetup.savedObjects.registerType(workpadTemplateType); - plugins.features.registerKibanaFeature({ - id: 'canvas', - name: 'Canvas', - order: 300, - category: DEFAULT_APP_CATEGORIES.kibana, - app: ['canvas', 'kibana'], - catalogue: ['canvas'], - privileges: { - all: { - app: ['canvas', 'kibana'], - catalogue: ['canvas'], - savedObject: { - all: ['canvas-workpad', 'canvas-element'], - read: ['index-pattern'], - }, - ui: ['save', 'show'], - }, - read: { - app: ['canvas', 'kibana'], - catalogue: ['canvas'], - savedObject: { - all: [], - read: ['index-pattern', 'canvas-workpad', 'canvas-element'], - }, - ui: ['show'], - }, - }, - }); + plugins.features.registerKibanaFeature(getCanvasFeature(plugins)); const canvasRouter = coreSetup.http.createRouter(); diff --git a/x-pack/plugins/cases/server/client/configure/utils.test.ts b/x-pack/plugins/cases/server/client/configure/utils.test.ts index 403854693e36c..41d62f5a9b91f 100644 --- a/x-pack/plugins/cases/server/client/configure/utils.test.ts +++ b/x-pack/plugins/cases/server/client/configure/utils.test.ts @@ -11,7 +11,6 @@ export { ServiceNowGetFieldsResponse, } from '../../../../actions/server/types'; import { createDefaultMapping, formatFields } from './utils'; -import { ConnectorTypes } from '../../../common/api/connectors'; import { mappings, formatFieldsTestData } from './mock'; describe('client/configure/utils', () => { @@ -30,16 +29,5 @@ describe('client/configure/utils', () => { expect(result).toEqual(mappings[type]); }); }); - it(`if the preferredField is not required and another field is, use the other field`, () => { - const result = createDefaultMapping( - [ - { id: 'summary', name: 'Summary', required: false, type: 'text' }, - { id: 'title', name: 'Title', required: true, type: 'text' }, - { id: 'description', name: 'Description', required: false, type: 'text' }, - ], - ConnectorTypes.jira - ); - expect(result).toEqual(mappings[`${ConnectorTypes.jira}-alt`]); - }); }); }); diff --git a/x-pack/plugins/cases/server/client/configure/utils.ts b/x-pack/plugins/cases/server/client/configure/utils.ts index 80e6c7a3b886c..10c3e1fd3c1a9 100644 --- a/x-pack/plugins/cases/server/client/configure/utils.ts +++ b/x-pack/plugins/cases/server/client/configure/utils.ts @@ -5,11 +5,7 @@ * 2.0. */ -import { - ConnectorField, - ConnectorMappingsAttributes, - ConnectorTypes, -} from '../../../common/api/connectors'; +import { ConnectorField, ConnectorMappingsAttributes, ConnectorTypes } from '../../../common/api'; import { JiraGetFieldsResponse, ResilientGetFieldsResponse, @@ -78,17 +74,6 @@ export const formatFields = (theData: unknown, theType: string): ConnectorField[ return []; } }; -const findTextField = (fields: ConnectorField[]): string => - ( - fields.find((field: ConnectorField) => field.type === 'text' && field.required) ?? - fields.find((field: ConnectorField) => field.type === 'text') - )?.id ?? ''; -const findTextAreaField = (fields: ConnectorField[]): string => - ( - fields.find((field: ConnectorField) => field.type === 'textarea' && field.required) ?? - fields.find((field: ConnectorField) => field.type === 'textarea') ?? - fields.find((field: ConnectorField) => field.type === 'text') - )?.id ?? ''; const getPreferredFields = (theType: string) => { let title: string = ''; @@ -115,73 +100,25 @@ const getPreferredFields = (theType: string) => { return { title, description, comments }; }; -const getRemainingFields = (fields: ConnectorField[], titleTarget: string) => - fields.filter((field: ConnectorField) => field.id !== titleTarget); - -const getDynamicFields = (fields: ConnectorField[], dynamicTitle = findTextField(fields)) => { - const remainingFields = getRemainingFields(fields, dynamicTitle); - const dynamicDescription = findTextAreaField(remainingFields); - return { - description: dynamicDescription, - title: dynamicTitle, - }; -}; - -const getField = (fields: ConnectorField[], fieldId: string) => - fields.find((field: ConnectorField) => field.id === fieldId); - -// if dynamic title is not required and preferred is, true -const shouldTargetBePreferred = ( - fields: ConnectorField[], - dynamic: string, - preferred: string -): boolean => { - if (dynamic !== preferred) { - const dynamicT = getField(fields, dynamic); - const preferredT = getField(fields, preferred); - return preferredT != null && !(dynamicT?.required && !preferredT.required); - } - return false; -}; export const createDefaultMapping = ( fields: ConnectorField[], theType: string ): ConnectorMappingsAttributes[] => { - const { description: dynamicDescription, title: dynamicTitle } = getDynamicFields(fields); - - const { - description: preferredDescription, - title: preferredTitle, - comments: preferredComments, - } = getPreferredFields(theType); - - let titleTarget = dynamicTitle; - let descriptionTarget = dynamicDescription; - - if (preferredTitle.length > 0 && preferredDescription.length > 0) { - if (shouldTargetBePreferred(fields, dynamicTitle, preferredTitle)) { - const { description: dynamicDescriptionOverwrite } = getDynamicFields(fields, preferredTitle); - titleTarget = preferredTitle; - descriptionTarget = dynamicDescriptionOverwrite; - } - if (shouldTargetBePreferred(fields, descriptionTarget, preferredDescription)) { - descriptionTarget = preferredDescription; - } - } + const { description, title, comments } = getPreferredFields(theType); return [ { source: 'title', - target: titleTarget, + target: title, action_type: 'overwrite', }, { source: 'description', - target: descriptionTarget, + target: description, action_type: 'overwrite', }, { source: 'comments', - target: preferredComments, + target: comments, action_type: 'append', }, ]; diff --git a/x-pack/plugins/data_enhanced/README.md b/x-pack/plugins/data_enhanced/README.md index 8f3ae7ac3cd13..fba484261fea2 100644 --- a/x-pack/plugins/data_enhanced/README.md +++ b/x-pack/plugins/data_enhanced/README.md @@ -1,25 +1,16 @@ # data_enhanced -The `data_enhanced` plugin is the x-pack counterpart to the OSS `data` plugin. +The `data_enhanced` plugin is the x-pack counterpart to the `src/plguins/data` plugin. -It exists to provide Elastic-licensed services, or parts of services, which -enhance existing OSS functionality from `data`. +It exists to provide services, or parts of services, which +enhance existing functionality from `src/plugins/data`. -Currently the `data_enhanced` plugin doesn't return any APIs which you can +Currently, the `data_enhanced` plugin doesn't return any APIs which you can consume directly, however it is possible that you are indirectly relying on the -enhanced functionality that it provides via the OSS `data` plugin. +enhanced functionality that it provides via the `data` plugin from `src/`. Here is the functionality it adds: -## KQL Autocomplete - -The OSS autocomplete service provides suggestions for field names and values -based on suggestion providers which are registered to the service. This plugin -registers the autocomplete provider for KQL to the OSS service. - -## Async, Rollup, and EQL Search Strategies - -This plugin enhances the OSS search service with an ES search strategy that -uses async search (or rollups) behind the scenes. It also registers an EQL -search strategy. +## Search Sessions +Search sessions are handy when you want to enable a user to run something asynchronously (for example, a dashboard over a long period of time), and then quickly restore the results at a later time. The Search Service transparently fetches results from the .async-search index, instead of running each request again. diff --git a/x-pack/plugins/data_enhanced/common/index.ts b/x-pack/plugins/data_enhanced/common/index.ts index 22dd62914b57f..1fec1c76430eb 100644 --- a/x-pack/plugins/data_enhanced/common/index.ts +++ b/x-pack/plugins/data_enhanced/common/index.ts @@ -4,17 +4,3 @@ * 2.0; you may not use this file except in compliance with the Elastic License * 2.0. */ - -export { - SEARCH_SESSION_TYPE, - ENHANCED_ES_SEARCH_STRATEGY, - EQL_SEARCH_STRATEGY, - EqlRequestParams, - EqlSearchStrategyRequest, - EqlSearchStrategyResponse, - IAsyncSearchOptions, - pollSearch, - SearchSessionSavedObjectAttributes, - SearchSessionStatus, - SearchSessionRequestInfo, -} from './search'; diff --git a/x-pack/plugins/data_enhanced/common/search/index.ts b/x-pack/plugins/data_enhanced/common/search/index.ts index f69d66e64dc2f..1fec1c76430eb 100644 --- a/x-pack/plugins/data_enhanced/common/search/index.ts +++ b/x-pack/plugins/data_enhanced/common/search/index.ts @@ -4,7 +4,3 @@ * 2.0; you may not use this file except in compliance with the Elastic License * 2.0. */ - -export * from './types'; -export * from './poll_search'; -export * from './session'; diff --git a/x-pack/plugins/data_enhanced/common/search/session/index.ts b/x-pack/plugins/data_enhanced/common/search/session/index.ts deleted file mode 100644 index bc09a1e0351e3..0000000000000 --- a/x-pack/plugins/data_enhanced/common/search/session/index.ts +++ /dev/null @@ -1,16 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. - */ - -// TODO https://github.com/elastic/kibana/issues/92802 -export { - SEARCH_SESSION_TYPE, - SearchSessionSavedObjectAttributes, - SearchSessionFindOptions, - SearchSessionRequestInfo, - SearchSessionStatus, - SEARCH_SESSIONS_TABLE_ID, -} from '../../../../../../src/plugins/data/common/'; diff --git a/x-pack/plugins/data_enhanced/common/search/session/types.ts b/x-pack/plugins/data_enhanced/common/search/session/types.ts deleted file mode 100644 index 788ab30756e1c..0000000000000 --- a/x-pack/plugins/data_enhanced/common/search/session/types.ts +++ /dev/null @@ -1,93 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. - */ - -import { SearchSessionStatus } from './'; - -export const SEARCH_SESSION_TYPE = 'search-session'; -export interface SearchSessionSavedObjectAttributes { - sessionId: string; - /** - * User-facing session name to be displayed in session management - */ - name?: string; - /** - * App that created the session. e.g 'discover' - */ - appId?: string; - /** - * Creation time of the session - */ - created: string; - /** - * Last touch time of the session - */ - touched: string; - /** - * Expiration time of the session. Expiration itself is managed by Elasticsearch. - */ - expires: string; - /** - * status - */ - status: SearchSessionStatus; - /** - * urlGeneratorId - */ - urlGeneratorId?: string; - /** - * The application state that was used to create the session. - * Should be used, for example, to re-load an expired search session. - */ - initialState?: Record; - /** - * Application state that should be used to restore the session. - * For example, relative dates are conveted to absolute ones. - */ - restoreState?: Record; - /** - * Mapping of search request hashes to their corresponsing info (async search id, etc.) - */ - idMapping: Record; - - /** - * This value is true if the session was actively stored by the user. If it is false, the session may be purged by the system. - */ - persisted: boolean; - /** - * The realm type/name & username uniquely identifies the user who created this search session - */ - realmType?: string; - realmName?: string; - username?: string; -} - -export interface SearchSessionRequestInfo { - /** - * ID of the async search request - */ - id: string; - /** - * Search strategy used to submit the search request - */ - strategy: string; - /** - * status - */ - status: string; - /** - * An optional error. Set if status is set to error. - */ - error?: string; -} - -export interface SearchSessionFindOptions { - page?: number; - perPage?: number; - sortField?: string; - sortOrder?: string; - filter?: string; -} diff --git a/x-pack/plugins/data_enhanced/config.ts b/x-pack/plugins/data_enhanced/config.ts index c895e586a6931..e08381316a29c 100644 --- a/x-pack/plugins/data_enhanced/config.ts +++ b/x-pack/plugins/data_enhanced/config.ts @@ -6,64 +6,11 @@ */ import { schema, TypeOf } from '@kbn/config-schema'; +import { searchSessionsConfigSchema } from '../../../src/plugins/data/config'; export const configSchema = schema.object({ search: schema.object({ - sessions: schema.object({ - /** - * Turns the feature on \ off (incl. removing indicator and management screens) - */ - enabled: schema.boolean({ defaultValue: true }), - /** - * pageSize controls how many search session objects we load at once while monitoring - * session completion - */ - pageSize: schema.number({ defaultValue: 100 }), - /** - * trackingInterval controls how often we track search session objects progress - */ - trackingInterval: schema.duration({ defaultValue: '10s' }), - - /** - * monitoringTaskTimeout controls for how long task manager waits for search session monitoring task to complete before considering it timed out, - * If tasks timeouts it receives cancel signal and next task starts in "trackingInterval" time - */ - monitoringTaskTimeout: schema.duration({ defaultValue: '5m' }), - - /** - * notTouchedTimeout controls how long do we store unpersisted search session results, - * after the last search in the session has completed - */ - notTouchedTimeout: schema.duration({ defaultValue: '5m' }), - /** - * notTouchedInProgressTimeout controls how long do allow a search session to run after - * a user has navigated away without persisting - */ - notTouchedInProgressTimeout: schema.duration({ defaultValue: '1m' }), - /** - * maxUpdateRetries controls how many retries we perform while attempting to save a search session - */ - maxUpdateRetries: schema.number({ defaultValue: 3 }), - /** - * defaultExpiration controls how long search sessions are valid for, until they are expired. - */ - defaultExpiration: schema.duration({ defaultValue: '7d' }), - management: schema.object({ - /** - * maxSessions controls how many saved search sessions we display per page on the management screen. - */ - maxSessions: schema.number({ defaultValue: 10000 }), - /** - * refreshInterval controls how often we refresh the management screen. - */ - refreshInterval: schema.duration({ defaultValue: '10s' }), - /** - * refreshTimeout controls how often we refresh the management screen. - */ - refreshTimeout: schema.duration({ defaultValue: '1m' }), - expiresSoonWarning: schema.duration({ defaultValue: '1d' }), - }), - }), + sessions: searchSessionsConfigSchema, }), }); diff --git a/x-pack/plugins/data_enhanced/public/index.ts b/x-pack/plugins/data_enhanced/public/index.ts index be3a5c7e858e3..c3adf19fabe13 100644 --- a/x-pack/plugins/data_enhanced/public/index.ts +++ b/x-pack/plugins/data_enhanced/public/index.ts @@ -14,4 +14,7 @@ export const plugin = (initializerContext: PluginInitializerContext { @@ -36,31 +30,13 @@ export class EnhancedDataServerPlugin } public setup(core: CoreSetup, deps: SetupDependencies) { - const usage = deps.usageCollection ? usageProvider(core) : undefined; - core.uiSettings.register(getUiSettings()); core.savedObjects.registerType(searchSessionSavedObjectType); - deps.data.search.registerSearchStrategy( - ENHANCED_ES_SEARCH_STRATEGY, - enhancedEsSearchStrategyProvider( - this.config, - this.initializerContext.config.legacy.globalConfig$, - this.logger, - usage - ) - ); - - deps.data.search.registerSearchStrategy( - EQL_SEARCH_STRATEGY, - eqlSearchStrategyProvider(this.logger) - ); - this.sessionService = new SearchSessionService(this.logger, this.config, deps.security); deps.data.__enhance({ search: { - defaultStrategy: ENHANCED_ES_SEARCH_STRATEGY, sessionService: this.sessionService, }, }); diff --git a/x-pack/plugins/data_enhanced/server/saved_objects/search_session.ts b/x-pack/plugins/data_enhanced/server/saved_objects/search_session.ts index 4e53e951a8dc3..9b5af9a6fa9e8 100644 --- a/x-pack/plugins/data_enhanced/server/saved_objects/search_session.ts +++ b/x-pack/plugins/data_enhanced/server/saved_objects/search_session.ts @@ -6,7 +6,7 @@ */ import { SavedObjectsType } from 'kibana/server'; -import { SEARCH_SESSION_TYPE } from '../../common'; +import { SEARCH_SESSION_TYPE } from '../../../../../src/plugins/data/common'; import { searchSessionSavedObjectMigrations } from './search_session_migration'; export const searchSessionSavedObjectType: SavedObjectsType = { diff --git a/x-pack/plugins/data_enhanced/server/saved_objects/search_session_migration.test.ts b/x-pack/plugins/data_enhanced/server/saved_objects/search_session_migration.test.ts index 53b1b7f52b363..6682122c66f9c 100644 --- a/x-pack/plugins/data_enhanced/server/saved_objects/search_session_migration.test.ts +++ b/x-pack/plugins/data_enhanced/server/saved_objects/search_session_migration.test.ts @@ -10,8 +10,7 @@ import { SearchSessionSavedObjectAttributesPre$7$13$0, } from './search_session_migration'; import { SavedObject } from '../../../../../src/core/types'; -import { SEARCH_SESSION_TYPE } from '../../../../../src/plugins/data/common'; -import { SearchSessionStatus } from '../../common/search/session/status'; +import { SEARCH_SESSION_TYPE, SearchSessionStatus } from '../../../../../src/plugins/data/common'; import { SavedObjectMigrationContext } from 'kibana/server'; const mockCompletedSessionSavedObject: SavedObject = { diff --git a/x-pack/plugins/data_enhanced/server/saved_objects/search_session_migration.ts b/x-pack/plugins/data_enhanced/server/saved_objects/search_session_migration.ts index b9ea85a333da2..0ba8858ef525b 100644 --- a/x-pack/plugins/data_enhanced/server/saved_objects/search_session_migration.ts +++ b/x-pack/plugins/data_enhanced/server/saved_objects/search_session_migration.ts @@ -9,7 +9,7 @@ import { SavedObjectMigrationMap, SavedObjectUnsanitizedDoc } from 'kibana/serve import { SearchSessionSavedObjectAttributes as SearchSessionSavedObjectAttributesLatest, SearchSessionStatus, -} from '../../common'; +} from '../../../../../src/plugins/data/common'; /** * Search sessions were released in 7.12.0 diff --git a/x-pack/plugins/data_enhanced/server/search/index.ts b/x-pack/plugins/data_enhanced/server/search/index.ts index 23edd43fd4799..0430d283667d0 100644 --- a/x-pack/plugins/data_enhanced/server/search/index.ts +++ b/x-pack/plugins/data_enhanced/server/search/index.ts @@ -5,6 +5,4 @@ * 2.0. */ -export { enhancedEsSearchStrategyProvider } from './es_search_strategy'; -export { eqlSearchStrategyProvider } from './eql_search_strategy'; export * from './session'; diff --git a/x-pack/plugins/data_enhanced/server/search/session/check_running_sessions.test.ts b/x-pack/plugins/data_enhanced/server/search/session/check_running_sessions.test.ts index eba463662e26d..c0a48d5d44862 100644 --- a/x-pack/plugins/data_enhanced/server/search/session/check_running_sessions.test.ts +++ b/x-pack/plugins/data_enhanced/server/search/session/check_running_sessions.test.ts @@ -14,7 +14,7 @@ import { SearchSessionSavedObjectAttributes, ENHANCED_ES_SEARCH_STRATEGY, EQL_SEARCH_STRATEGY, -} from '../../../common'; +} from '../../../../../../src/plugins/data/common'; import { savedObjectsClientMock } from '../../../../../../src/core/server/mocks'; import { SearchSessionsConfig, SearchStatus } from './types'; import moment from 'moment'; diff --git a/x-pack/plugins/data_enhanced/server/search/session/check_running_sessions.ts b/x-pack/plugins/data_enhanced/server/search/session/check_running_sessions.ts index bb1e9643cd0d5..6787d31ed2b74 100644 --- a/x-pack/plugins/data_enhanced/server/search/session/check_running_sessions.ts +++ b/x-pack/plugins/data_enhanced/server/search/session/check_running_sessions.ts @@ -15,14 +15,14 @@ import { import moment from 'moment'; import { EMPTY, from, Observable } from 'rxjs'; import { catchError, concatMap } from 'rxjs/operators'; -import { nodeBuilder } from '../../../../../../src/plugins/data/common'; import { + nodeBuilder, ENHANCED_ES_SEARCH_STRATEGY, SEARCH_SESSION_TYPE, SearchSessionRequestInfo, SearchSessionSavedObjectAttributes, SearchSessionStatus, -} from '../../../common'; +} from '../../../../../../src/plugins/data/common'; import { getSearchStatus } from './get_search_status'; import { getSessionStatus } from './get_session_status'; import { SearchSessionsConfig, SearchStatus } from './types'; diff --git a/x-pack/plugins/data_enhanced/server/search/session/get_search_status.ts b/x-pack/plugins/data_enhanced/server/search/session/get_search_status.ts index dffccbee9db92..e228ba725489c 100644 --- a/x-pack/plugins/data_enhanced/server/search/session/get_search_status.ts +++ b/x-pack/plugins/data_enhanced/server/search/session/get_search_status.ts @@ -9,8 +9,8 @@ import { i18n } from '@kbn/i18n'; import { ApiResponse } from '@elastic/elasticsearch'; import { ElasticsearchClient } from 'src/core/server'; import { SearchStatus } from './types'; -import { AsyncSearchStatusResponse } from '../types'; -import { SearchSessionRequestInfo } from '../../../common'; +import { SearchSessionRequestInfo } from '../../../../../../src/plugins/data/common'; +import { AsyncSearchStatusResponse } from '../../../../../../src/plugins/data/server'; export async function getSearchStatus( client: ElasticsearchClient, diff --git a/x-pack/plugins/data_enhanced/server/search/session/get_session_status.test.ts b/x-pack/plugins/data_enhanced/server/search/session/get_session_status.test.ts index 19e937374882b..fc86e75297393 100644 --- a/x-pack/plugins/data_enhanced/server/search/session/get_session_status.test.ts +++ b/x-pack/plugins/data_enhanced/server/search/session/get_session_status.test.ts @@ -7,7 +7,7 @@ import { SearchStatus } from './types'; import { getSessionStatus } from './get_session_status'; -import { SearchSessionStatus } from '../../../common'; +import { SearchSessionStatus } from '../../../../../../src/plugins/data/common'; describe('getSessionStatus', () => { test("returns an in_progress status if there's nothing inside the session", () => { diff --git a/x-pack/plugins/data_enhanced/server/search/session/get_session_status.ts b/x-pack/plugins/data_enhanced/server/search/session/get_session_status.ts index 09156ae79cf8b..23e02eedc0004 100644 --- a/x-pack/plugins/data_enhanced/server/search/session/get_session_status.ts +++ b/x-pack/plugins/data_enhanced/server/search/session/get_session_status.ts @@ -5,7 +5,10 @@ * 2.0. */ -import { SearchSessionSavedObjectAttributes, SearchSessionStatus } from '../../../common'; +import { + SearchSessionSavedObjectAttributes, + SearchSessionStatus, +} from '../../../../../../src/plugins/data/common/'; import { SearchStatus } from './types'; export function getSessionStatus(session: SearchSessionSavedObjectAttributes): SearchSessionStatus { diff --git a/x-pack/plugins/data_enhanced/server/search/session/monitoring_task.ts b/x-pack/plugins/data_enhanced/server/search/session/monitoring_task.ts index c0dc69dfc307b..7b7b1412987be 100644 --- a/x-pack/plugins/data_enhanced/server/search/session/monitoring_task.ts +++ b/x-pack/plugins/data_enhanced/server/search/session/monitoring_task.ts @@ -17,7 +17,7 @@ import { import { checkRunningSessions } from './check_running_sessions'; import { CoreSetup, SavedObjectsClient, Logger } from '../../../../../../src/core/server'; import { ConfigSchema } from '../../../config'; -import { SEARCH_SESSION_TYPE } from '../../../common'; +import { SEARCH_SESSION_TYPE } from '../../../../../../src/plugins/data/common'; import { DataEnhancedStartDependencies } from '../../type'; export const SEARCH_SESSIONS_TASK_TYPE = 'search_sessions_monitor'; diff --git a/x-pack/plugins/data_enhanced/server/search/session/session_service.test.ts b/x-pack/plugins/data_enhanced/server/search/session/session_service.test.ts index f1f8805a28884..374dbee2384d5 100644 --- a/x-pack/plugins/data_enhanced/server/search/session/session_service.test.ts +++ b/x-pack/plugins/data_enhanced/server/search/session/session_service.test.ts @@ -11,7 +11,6 @@ import { SavedObjectsErrorHelpers, } from '../../../../../../src/core/server'; import { savedObjectsClientMock } from '../../../../../../src/core/server/mocks'; -import { SearchSessionStatus, SEARCH_SESSION_TYPE } from '../../../common'; import { SearchSessionService } from './session_service'; import { createRequestHash } from './utils'; import moment from 'moment'; @@ -19,7 +18,11 @@ import { coreMock } from '../../../../../../src/core/server/mocks'; import { ConfigSchema } from '../../../config'; import { taskManagerMock } from '../../../../task_manager/server/mocks'; import { AuthenticatedUser } from '../../../../security/common/model'; -import { nodeBuilder } from '../../../../../../src/plugins/data/common'; +import { + nodeBuilder, + SEARCH_SESSION_TYPE, + SearchSessionStatus, +} from '../../../../../../src/plugins/data/common'; import { TaskManagerStartContract } from '../../../../task_manager/server'; const MAX_UPDATE_RETRIES = 3; diff --git a/x-pack/plugins/data_enhanced/server/search/session/session_service.ts b/x-pack/plugins/data_enhanced/server/search/session/session_service.ts index b5f7da594d53b..138f42549a094 100644 --- a/x-pack/plugins/data_enhanced/server/search/session/session_service.ts +++ b/x-pack/plugins/data_enhanced/server/search/session/session_service.ts @@ -21,6 +21,8 @@ import { IKibanaSearchRequest, ISearchOptions, nodeBuilder, + ENHANCED_ES_SEARCH_STRATEGY, + SEARCH_SESSION_TYPE, } from '../../../../../../src/plugins/data/common'; import { esKuery, ISearchSessionService } from '../../../../../../src/plugins/data/server'; import { AuthenticatedUser, SecurityPluginSetup } from '../../../../security/server'; @@ -29,12 +31,10 @@ import { TaskManagerStartContract, } from '../../../../task_manager/server'; import { - ENHANCED_ES_SEARCH_STRATEGY, SearchSessionRequestInfo, SearchSessionSavedObjectAttributes, SearchSessionStatus, - SEARCH_SESSION_TYPE, -} from '../../../common'; +} from '../../../../../../src/plugins/data/common'; import { createRequestHash } from './utils'; import { ConfigSchema } from '../../../config'; import { @@ -461,6 +461,7 @@ export class SearchSessionService extend: this.extend.bind(this, deps, user), cancel: this.cancel.bind(this, deps, user), delete: this.delete.bind(this, deps, user), + getConfig: () => this.config.search.sessions, }; }; }; diff --git a/x-pack/plugins/enterprise_search/public/applications/app_search/components/multi_input_rows/input_row.test.tsx b/x-pack/plugins/enterprise_search/public/applications/app_search/components/multi_input_rows/input_row.test.tsx index 03b0c0e4a0d91..c999881fa9fed 100644 --- a/x-pack/plugins/enterprise_search/public/applications/app_search/components/multi_input_rows/input_row.test.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/app_search/components/multi_input_rows/input_row.test.tsx @@ -17,6 +17,7 @@ describe('InputRow', () => { const props = { value: 'some value', placeholder: 'Enter a value', + autoFocus: false, onChange: jest.fn(), onDelete: jest.fn(), disableDelete: false, @@ -33,6 +34,7 @@ describe('InputRow', () => { expect(wrapper.find(EuiFieldText)).toHaveLength(1); expect(wrapper.find(EuiFieldText).prop('value')).toEqual('some value'); expect(wrapper.find(EuiFieldText).prop('placeholder')).toEqual('Enter a value'); + expect(wrapper.find(EuiFieldText).prop('autoFocus')).toEqual(false); expect(wrapper.find('[data-test-subj="deleteInputRowButton"]').prop('title')).toEqual( 'Delete value' ); diff --git a/x-pack/plugins/enterprise_search/public/applications/app_search/components/multi_input_rows/input_row.tsx b/x-pack/plugins/enterprise_search/public/applications/app_search/components/multi_input_rows/input_row.tsx index 5f2a82ae945ed..55ed5e9d90509 100644 --- a/x-pack/plugins/enterprise_search/public/applications/app_search/components/multi_input_rows/input_row.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/app_search/components/multi_input_rows/input_row.tsx @@ -12,6 +12,7 @@ import { EuiFlexGroup, EuiFlexItem, EuiFieldText, EuiButtonIcon } from '@elastic interface Props { value: string; placeholder: string; + autoFocus: boolean; onChange(newValue: string): void; onDelete(): void; disableDelete: boolean; @@ -23,6 +24,7 @@ import './input_row.scss'; export const InputRow: React.FC = ({ value, placeholder, + autoFocus, onChange, onDelete, disableDelete, @@ -35,7 +37,7 @@ export const InputRow: React.FC = ({ placeholder={placeholder} value={value} onChange={(e) => onChange(e.target.value)} - autoFocus + autoFocus={autoFocus} /> diff --git a/x-pack/plugins/enterprise_search/public/applications/app_search/components/multi_input_rows/multi_input_rows.test.tsx b/x-pack/plugins/enterprise_search/public/applications/app_search/components/multi_input_rows/multi_input_rows.test.tsx index f832ceb8c8842..221495ee2c658 100644 --- a/x-pack/plugins/enterprise_search/public/applications/app_search/components/multi_input_rows/multi_input_rows.test.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/app_search/components/multi_input_rows/multi_input_rows.test.tsx @@ -27,6 +27,7 @@ describe('MultiInputRows', () => { }; const values = { values: ['a', 'b', 'c'], + addedNewRow: false, hasEmptyValues: false, hasOnlyOneValue: false, }; @@ -56,6 +57,20 @@ describe('MultiInputRows', () => { expect(wrapper.find(InputRow).at(2).prop('value')).toEqual('c'); }); + it('focuses the first input row on load, but focuses new input rows on add', () => { + setMockValues({ ...values, addedNewRow: false }); + const wrapper = shallow(); + + expect(wrapper.find(InputRow).first().prop('autoFocus')).toEqual(true); + expect(wrapper.find(InputRow).last().prop('autoFocus')).toEqual(false); + + setMockValues({ ...values, addedNewRow: true }); + rerender(wrapper); + + expect(wrapper.find(InputRow).first().prop('autoFocus')).toEqual(false); + expect(wrapper.find(InputRow).last().prop('autoFocus')).toEqual(true); + }); + it('calls editValue when the InputRow value changes', () => { const wrapper = shallow(); wrapper.find(InputRow).at(0).simulate('change', 'new value'); diff --git a/x-pack/plugins/enterprise_search/public/applications/app_search/components/multi_input_rows/multi_input_rows.tsx b/x-pack/plugins/enterprise_search/public/applications/app_search/components/multi_input_rows/multi_input_rows.tsx index aa2f0977594c4..3c401fbbf953f 100644 --- a/x-pack/plugins/enterprise_search/public/applications/app_search/components/multi_input_rows/multi_input_rows.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/app_search/components/multi_input_rows/multi_input_rows.tsx @@ -44,7 +44,7 @@ export const MultiInputRows: React.FC = ({ inputPlaceholder = INPUT_ROW_PLACEHOLDER, }) => { const logic = MultiInputRowsLogic({ id, values: initialValues }); - const { values, hasEmptyValues, hasOnlyOneValue } = useValues(logic); + const { values, addedNewRow, hasEmptyValues, hasOnlyOneValue } = useValues(logic); const { addValue, editValue, deleteValue } = useActions(logic); useEffect(() => { @@ -55,17 +55,22 @@ export const MultiInputRows: React.FC = ({ return ( <> - {values.map((value: string, index: number) => ( - editValue(index, newValue)} - onDelete={() => deleteValue(index)} - disableDelete={hasOnlyOneValue} - deleteLabel={deleteRowLabel} - /> - ))} + {values.map((value: string, index: number) => { + const firstRow = index === 0; + const lastRow = index === values.length - 1; + return ( + editValue(index, newValue)} + onDelete={() => deleteValue(index)} + disableDelete={hasOnlyOneValue} + deleteLabel={deleteRowLabel} + /> + ); + })} { }; const DEFAULT_VALUES = { values: MOCK_VALUES, + addedNewRow: false, hasEmptyValues: false, hasOnlyOneValue: false, }; @@ -48,11 +49,12 @@ describe('MultiInputRowsLogic', () => { }); describe('addValue', () => { - it('appends an empty string to the values array', () => { + it('appends an empty string to the values array & sets addedNewRow to true', () => { logic.actions.addValue(); expect(logic.values).toEqual({ ...DEFAULT_VALUES, + addedNewRow: true, hasEmptyValues: true, values: ['a', 'b', 'c', ''], }); diff --git a/x-pack/plugins/enterprise_search/public/applications/app_search/components/multi_input_rows/multi_input_rows_logic.ts b/x-pack/plugins/enterprise_search/public/applications/app_search/components/multi_input_rows/multi_input_rows_logic.ts index 6cc392598a61f..d80dd1f3db726 100644 --- a/x-pack/plugins/enterprise_search/public/applications/app_search/components/multi_input_rows/multi_input_rows_logic.ts +++ b/x-pack/plugins/enterprise_search/public/applications/app_search/components/multi_input_rows/multi_input_rows_logic.ts @@ -9,6 +9,7 @@ import { kea, MakeLogicType } from 'kea'; interface MultiInputRowsValues { values: string[]; + addedNewRow: boolean; hasEmptyValues: boolean; hasOnlyOneValue: boolean; } @@ -51,6 +52,12 @@ export const MultiInputRowsLogic = kea< }, }, ], + addedNewRow: [ + false, + { + addValue: () => true, + }, + ], }), selectors: { hasEmptyValues: [(selectors) => [selectors.values], (values) => values.indexOf('') >= 0], diff --git a/x-pack/plugins/enterprise_search/public/applications/app_search/components/result_settings/result_settings.test.tsx b/x-pack/plugins/enterprise_search/public/applications/app_search/components/result_settings/result_settings.test.tsx index e5a901f8d0779..70bc49421a4f1 100644 --- a/x-pack/plugins/enterprise_search/public/applications/app_search/components/result_settings/result_settings.test.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/app_search/components/result_settings/result_settings.test.tsx @@ -15,6 +15,8 @@ import { shallow, ShallowWrapper } from 'enzyme'; import { EuiPageHeader, EuiEmptyPrompt } from '@elastic/eui'; +import { UnsavedChangesPrompt } from '../../../shared/unsaved_changes_prompt'; + import { ResultSettings } from './result_settings'; import { ResultSettingsTable } from './result_settings_table'; import { SampleResponse } from './sample_response'; @@ -110,6 +112,14 @@ describe('ResultSettings', () => { expect(actions.clearAllFields).toHaveBeenCalled(); }); + it('will prevent user from leaving the page if there are unsaved changes', () => { + setMockValues({ + ...values, + stagedUpdates: true, + }); + expect(subject().find(UnsavedChangesPrompt).prop('hasUnsavedChanges')).toBe(true); + }); + describe('when there is no schema yet', () => { let wrapper: ShallowWrapper; beforeAll(() => { diff --git a/x-pack/plugins/enterprise_search/public/applications/app_search/components/result_settings/result_settings.tsx b/x-pack/plugins/enterprise_search/public/applications/app_search/components/result_settings/result_settings.tsx index 285d8fef35770..bea5bcc548fab 100644 --- a/x-pack/plugins/enterprise_search/public/applications/app_search/components/result_settings/result_settings.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/app_search/components/result_settings/result_settings.tsx @@ -25,6 +25,7 @@ import { SAVE_BUTTON_LABEL } from '../../../shared/constants'; import { FlashMessages } from '../../../shared/flash_messages'; import { SetAppSearchChrome as SetPageChrome } from '../../../shared/kibana_chrome'; import { Loading } from '../../../shared/loading'; +import { UnsavedChangesPrompt } from '../../../shared/unsaved_changes_prompt'; import { RESTORE_DEFAULTS_BUTTON_LABEL } from '../../constants'; import { getEngineBreadcrumbs } from '../engine'; @@ -39,6 +40,11 @@ const CLEAR_BUTTON_LABEL = i18n.translate( { defaultMessage: 'Clear all values' } ); +const UNSAVED_MESSAGE = i18n.translate( + 'xpack.enterpriseSearch.appSearch.engine.resultSettings.unsavedChangesMessage', + { defaultMessage: 'Result Settings have not been saved. Are you sure you want to leave?' } +); + export const ResultSettings: React.FC = () => { const { dataLoading, schema, stagedUpdates, resultFieldsAtDefaultSettings } = useValues( ResultSettingsLogic @@ -60,6 +66,7 @@ export const ResultSettings: React.FC = () => { return ( <> + { 'An error occured.' ); }); - - it('does nothing if an empty object is passed for the resultFields parameter', async () => { - mount(); - jest.spyOn(SampleResponseLogic.actions, 'getSearchResultsSuccess'); - - SampleResponseLogic.actions.getSearchResults('foo', {}); - - jest.runAllTimers(); - await nextTick(); - - expect(SampleResponseLogic.actions.getSearchResultsSuccess).not.toHaveBeenCalled(); - }); }); }); }); diff --git a/x-pack/plugins/enterprise_search/public/applications/app_search/components/result_settings/sample_response/sample_response_logic.ts b/x-pack/plugins/enterprise_search/public/applications/app_search/components/result_settings/sample_response/sample_response_logic.ts index 808a7ec9c65dc..c64cb3465b311 100644 --- a/x-pack/plugins/enterprise_search/public/applications/app_search/components/result_settings/sample_response/sample_response_logic.ts +++ b/x-pack/plugins/enterprise_search/public/applications/app_search/components/result_settings/sample_response/sample_response_logic.ts @@ -63,7 +63,6 @@ export const SampleResponseLogic = kea ({ getSearchResults: async ({ query, resultFields }, breakpoint) => { - if (Object.keys(resultFields).length < 1) return; await breakpoint(250); const { http } = HttpLogic.values; diff --git a/x-pack/plugins/enterprise_search/public/applications/workplace_search/components/layout/account_header/account_header.tsx b/x-pack/plugins/enterprise_search/public/applications/workplace_search/components/layout/account_header/account_header.tsx index a878d87af09e4..87ee108f21c73 100644 --- a/x-pack/plugins/enterprise_search/public/applications/workplace_search/components/layout/account_header/account_header.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/workplace_search/components/layout/account_header/account_header.tsx @@ -97,7 +97,7 @@ export const AccountHeader: React.FC = () => { > - + {ACCOUNT_NAV.SEARCH} diff --git a/x-pack/plugins/features/server/__snapshots__/oss_features.test.ts.snap b/x-pack/plugins/features/server/__snapshots__/oss_features.test.ts.snap index 5c259b4c7b72e..88712f2ac14c0 100644 --- a/x-pack/plugins/features/server/__snapshots__/oss_features.test.ts.snap +++ b/x-pack/plugins/features/server/__snapshots__/oss_features.test.ts.snap @@ -1,5 +1,461 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP +exports[`buildOSSFeatures returns features excluding reporting subfeatures 1`] = ` +Array [ + Object { + "id": "discover", + "subFeatures": Array [ + Object { + "name": "Short URLs", + "privilegeGroups": Array [ + Object { + "groupType": "independent", + "privileges": Array [ + Object { + "id": "url_create", + "includeIn": "all", + "name": "Create Short URLs", + "savedObject": Object { + "all": Array [ + "url", + ], + "read": Array [], + }, + "ui": Array [ + "createShortUrl", + ], + }, + ], + }, + ], + }, + Object { + "name": "Store Search Sessions", + "privilegeGroups": Array [ + Object { + "groupType": "independent", + "privileges": Array [ + Object { + "api": Array [ + "store_search_session", + ], + "id": "store_search_session", + "includeIn": "all", + "management": Object { + "kibana": Array [ + "search_sessions", + ], + }, + "name": "Store Search Sessions", + "savedObject": Object { + "all": Array [ + "search-session", + ], + "read": Array [], + }, + "ui": Array [ + "storeSearchSession", + ], + }, + ], + }, + ], + }, + ], + }, + Object { + "id": "visualize", + "subFeatures": Array [ + Object { + "name": "Short URLs", + "privilegeGroups": Array [ + Object { + "groupType": "independent", + "privileges": Array [ + Object { + "id": "url_create", + "includeIn": "all", + "name": "Create Short URLs", + "savedObject": Object { + "all": Array [ + "url", + ], + "read": Array [], + }, + "ui": Array [ + "createShortUrl", + ], + }, + ], + }, + ], + }, + ], + }, + Object { + "id": "dashboard", + "subFeatures": Array [ + Object { + "name": "Short URLs", + "privilegeGroups": Array [ + Object { + "groupType": "independent", + "privileges": Array [ + Object { + "id": "url_create", + "includeIn": "all", + "name": "Create Short URLs", + "savedObject": Object { + "all": Array [ + "url", + ], + "read": Array [], + }, + "ui": Array [ + "createShortUrl", + ], + }, + ], + }, + ], + }, + Object { + "name": "Store Search Sessions", + "privilegeGroups": Array [ + Object { + "groupType": "independent", + "privileges": Array [ + Object { + "api": Array [ + "store_search_session", + ], + "id": "store_search_session", + "includeIn": "all", + "management": Object { + "kibana": Array [ + "search_sessions", + ], + }, + "name": "Store Search Sessions", + "savedObject": Object { + "all": Array [ + "search-session", + ], + "read": Array [], + }, + "ui": Array [ + "storeSearchSession", + ], + }, + ], + }, + ], + }, + ], + }, + Object { + "id": "dev_tools", + "subFeatures": undefined, + }, + Object { + "id": "advancedSettings", + "subFeatures": undefined, + }, + Object { + "id": "indexPatterns", + "subFeatures": undefined, + }, + Object { + "id": "savedObjectsManagement", + "subFeatures": undefined, + }, +] +`; + +exports[`buildOSSFeatures returns features including reporting subfeatures 1`] = ` +Array [ + Object { + "id": "discover", + "subFeatures": Array [ + Object { + "name": "Short URLs", + "privilegeGroups": Array [ + Object { + "groupType": "independent", + "privileges": Array [ + Object { + "id": "url_create", + "includeIn": "all", + "name": "Create Short URLs", + "savedObject": Object { + "all": Array [ + "url", + ], + "read": Array [], + }, + "ui": Array [ + "createShortUrl", + ], + }, + ], + }, + ], + }, + Object { + "name": "Store Search Sessions", + "privilegeGroups": Array [ + Object { + "groupType": "independent", + "privileges": Array [ + Object { + "api": Array [ + "store_search_session", + ], + "id": "store_search_session", + "includeIn": "all", + "management": Object { + "kibana": Array [ + "search_sessions", + ], + }, + "name": "Store Search Sessions", + "savedObject": Object { + "all": Array [ + "search-session", + ], + "read": Array [], + }, + "ui": Array [ + "storeSearchSession", + ], + }, + ], + }, + ], + }, + Object { + "name": "Reporting", + "privilegeGroups": Array [ + Object { + "groupType": "independent", + "privileges": Array [ + Object { + "api": Array [ + "generateReport", + ], + "id": "generate_report", + "includeIn": "all", + "management": Object { + "insightsAndAlerting": Array [ + "reporting", + ], + }, + "name": "Generate CSV reports", + "savedObject": Object { + "all": Array [], + "read": Array [], + }, + "ui": Array [ + "generateCsv", + ], + }, + ], + }, + ], + }, + ], + }, + Object { + "id": "visualize", + "subFeatures": Array [ + Object { + "name": "Short URLs", + "privilegeGroups": Array [ + Object { + "groupType": "independent", + "privileges": Array [ + Object { + "id": "url_create", + "includeIn": "all", + "name": "Create Short URLs", + "savedObject": Object { + "all": Array [ + "url", + ], + "read": Array [], + }, + "ui": Array [ + "createShortUrl", + ], + }, + ], + }, + ], + }, + Object { + "name": "Reporting", + "privilegeGroups": Array [ + Object { + "groupType": "independent", + "privileges": Array [ + Object { + "api": Array [ + "generateReport", + ], + "id": "generate_report", + "includeIn": "all", + "management": Object { + "insightsAndAlerting": Array [ + "reporting", + ], + }, + "minimumLicense": "platinum", + "name": "Generate PDF or PNG reports", + "savedObject": Object { + "all": Array [], + "read": Array [], + }, + "ui": Array [ + "generateScreenshot", + ], + }, + ], + }, + ], + }, + ], + }, + Object { + "id": "dashboard", + "subFeatures": Array [ + Object { + "name": "Short URLs", + "privilegeGroups": Array [ + Object { + "groupType": "independent", + "privileges": Array [ + Object { + "id": "url_create", + "includeIn": "all", + "name": "Create Short URLs", + "savedObject": Object { + "all": Array [ + "url", + ], + "read": Array [], + }, + "ui": Array [ + "createShortUrl", + ], + }, + ], + }, + ], + }, + Object { + "name": "Store Search Sessions", + "privilegeGroups": Array [ + Object { + "groupType": "independent", + "privileges": Array [ + Object { + "api": Array [ + "store_search_session", + ], + "id": "store_search_session", + "includeIn": "all", + "management": Object { + "kibana": Array [ + "search_sessions", + ], + }, + "name": "Store Search Sessions", + "savedObject": Object { + "all": Array [ + "search-session", + ], + "read": Array [], + }, + "ui": Array [ + "storeSearchSession", + ], + }, + ], + }, + ], + }, + Object { + "name": "Reporting", + "privilegeGroups": Array [ + Object { + "groupType": "independent", + "privileges": Array [ + Object { + "api": Array [ + "generateReport", + ], + "id": "generate_report", + "includeIn": "all", + "management": Object { + "insightsAndAlerting": Array [ + "reporting", + ], + }, + "minimumLicense": "platinum", + "name": "Generate PDF or PNG reports", + "savedObject": Object { + "all": Array [], + "read": Array [], + }, + "ui": Array [ + "generateScreenshot", + ], + }, + Object { + "api": Array [ + "downloadCsv", + ], + "id": "download_csv_report", + "includeIn": "all", + "management": Object { + "insightsAndAlerting": Array [ + "reporting", + ], + }, + "name": "Download CSV reports from Saved Search panels", + "savedObject": Object { + "all": Array [], + "read": Array [], + }, + "ui": Array [ + "downloadCsv", + ], + }, + ], + }, + ], + }, + ], + }, + Object { + "id": "dev_tools", + "subFeatures": undefined, + }, + Object { + "id": "advancedSettings", + "subFeatures": undefined, + }, + Object { + "id": "indexPatterns", + "subFeatures": undefined, + }, + Object { + "id": "savedObjectsManagement", + "subFeatures": undefined, + }, +] +`; + exports[`buildOSSFeatures with a basic license returns the advancedSettings feature augmented with appropriate sub feature privileges 1`] = ` Array [ Object { diff --git a/x-pack/plugins/features/server/mocks.ts b/x-pack/plugins/features/server/mocks.ts index aa92694050766..7b10a185dd0db 100644 --- a/x-pack/plugins/features/server/mocks.ts +++ b/x-pack/plugins/features/server/mocks.ts @@ -14,6 +14,7 @@ const createSetup = (): jest.Mocked => { getFeaturesUICapabilities: jest.fn(), registerKibanaFeature: jest.fn(), registerElasticsearchFeature: jest.fn(), + enableReportingUiCapabilities: jest.fn(), }; }; diff --git a/x-pack/plugins/features/server/oss_features.test.ts b/x-pack/plugins/features/server/oss_features.test.ts index b86fa726b3050..86705cae6d5a6 100644 --- a/x-pack/plugins/features/server/oss_features.test.ts +++ b/x-pack/plugins/features/server/oss_features.test.ts @@ -14,7 +14,11 @@ import { LicenseType } from '../../licensing/server'; describe('buildOSSFeatures', () => { it('returns features including timelion', () => { expect( - buildOSSFeatures({ savedObjectTypes: ['foo', 'bar'], includeTimelion: true }).map((f) => f.id) + buildOSSFeatures({ + savedObjectTypes: ['foo', 'bar'], + includeTimelion: true, + includeReporting: false, + }).map((f) => f.id) ).toMatchInlineSnapshot(` Array [ "discover", @@ -31,9 +35,11 @@ Array [ it('returns features excluding timelion', () => { expect( - buildOSSFeatures({ savedObjectTypes: ['foo', 'bar'], includeTimelion: false }).map( - (f) => f.id - ) + buildOSSFeatures({ + savedObjectTypes: ['foo', 'bar'], + includeTimelion: false, + includeReporting: false, + }).map((f) => f.id) ).toMatchInlineSnapshot(` Array [ "discover", @@ -47,7 +53,31 @@ Array [ `); }); - const features = buildOSSFeatures({ savedObjectTypes: ['foo', 'bar'], includeTimelion: true }); + it('returns features including reporting subfeatures', () => { + expect( + buildOSSFeatures({ + savedObjectTypes: ['foo', 'bar'], + includeTimelion: false, + includeReporting: true, + }).map(({ id, subFeatures }) => ({ id, subFeatures })) + ).toMatchSnapshot(); + }); + + it('returns features excluding reporting subfeatures', () => { + expect( + buildOSSFeatures({ + savedObjectTypes: ['foo', 'bar'], + includeTimelion: false, + includeReporting: false, + }).map(({ id, subFeatures }) => ({ id, subFeatures })) + ).toMatchSnapshot(); + }); + + const features = buildOSSFeatures({ + savedObjectTypes: ['foo', 'bar'], + includeTimelion: true, + includeReporting: false, + }); features.forEach((featureConfig) => { (['enterprise', 'basic'] as LicenseType[]).forEach((licenseType) => { describe(`with a ${licenseType} license`, () => { diff --git a/x-pack/plugins/features/server/oss_features.ts b/x-pack/plugins/features/server/oss_features.ts index 91839e511a1ad..d1e96b5a788ec 100644 --- a/x-pack/plugins/features/server/oss_features.ts +++ b/x-pack/plugins/features/server/oss_features.ts @@ -6,15 +6,20 @@ */ import { i18n } from '@kbn/i18n'; -import { KibanaFeatureConfig } from '../common'; import { DEFAULT_APP_CATEGORIES } from '../../../../src/core/server'; +import type { KibanaFeatureConfig, SubFeatureConfig } from '../common'; export interface BuildOSSFeaturesParams { savedObjectTypes: string[]; includeTimelion: boolean; + includeReporting: boolean; } -export const buildOSSFeatures = ({ savedObjectTypes, includeTimelion }: BuildOSSFeaturesParams) => { +export const buildOSSFeatures = ({ + savedObjectTypes, + includeTimelion, + includeReporting, +}: BuildOSSFeaturesParams): KibanaFeatureConfig[] => { return [ { id: 'discover', @@ -23,6 +28,7 @@ export const buildOSSFeatures = ({ savedObjectTypes, includeTimelion }: BuildOSS }), management: { kibana: ['search_sessions'], + ...(includeReporting ? { insightsAndAlerting: ['reporting'] } : {}), }, order: 100, category: DEFAULT_APP_CATEGORIES.kibana, @@ -107,6 +113,7 @@ export const buildOSSFeatures = ({ savedObjectTypes, includeTimelion }: BuildOSS }, ], }, + ...(includeReporting ? [reportingFeatures.discoverReporting] : []), ], }, { @@ -114,6 +121,9 @@ export const buildOSSFeatures = ({ savedObjectTypes, includeTimelion }: BuildOSS name: i18n.translate('xpack.features.visualizeFeatureName', { defaultMessage: 'Visualize Library', }), + management: { + ...(includeReporting ? { insightsAndAlerting: ['reporting'] } : {}), + }, order: 700, category: DEFAULT_APP_CATEGORIES.kibana, app: ['visualize', 'lens', 'kibana'], @@ -166,6 +176,7 @@ export const buildOSSFeatures = ({ savedObjectTypes, includeTimelion }: BuildOSS }, ], }, + ...(includeReporting ? [reportingFeatures.visualizeReporting] : []), ], }, { @@ -175,6 +186,7 @@ export const buildOSSFeatures = ({ savedObjectTypes, includeTimelion }: BuildOSS }), management: { kibana: ['search_sessions'], + ...(includeReporting ? { insightsAndAlerting: ['reporting'] } : {}), }, order: 200, category: DEFAULT_APP_CATEGORIES.kibana, @@ -279,6 +291,7 @@ export const buildOSSFeatures = ({ savedObjectTypes, includeTimelion }: BuildOSS }, ], }, + ...(includeReporting ? [reportingFeatures.dashboardReporting] : []), ], }, { @@ -468,3 +481,99 @@ const timelionFeature: KibanaFeatureConfig = { }, }, }; + +const reportingPrivilegeGroupName = i18n.translate( + 'xpack.features.ossFeatures.reporting.reportingTitle', + { + defaultMessage: 'Reporting', + } +); + +const reportingFeatures: { + discoverReporting: SubFeatureConfig; + dashboardReporting: SubFeatureConfig; + visualizeReporting: SubFeatureConfig; +} = { + discoverReporting: { + name: reportingPrivilegeGroupName, + privilegeGroups: [ + { + groupType: 'independent', + privileges: [ + { + id: 'generate_report', + name: i18n.translate('xpack.features.ossFeatures.reporting.discoverGenerateCSV', { + defaultMessage: 'Generate CSV reports', + }), + includeIn: 'all', + savedObject: { all: [], read: [] }, + management: { insightsAndAlerting: ['reporting'] }, + api: ['generateReport'], + ui: ['generateCsv'], + }, + ], + }, + ], + }, + dashboardReporting: { + name: reportingPrivilegeGroupName, + privilegeGroups: [ + { + groupType: 'independent', + privileges: [ + { + id: 'generate_report', + name: i18n.translate( + 'xpack.features.ossFeatures.reporting.dashboardGenerateScreenshot', + { + defaultMessage: 'Generate PDF or PNG reports', + } + ), + includeIn: 'all', + minimumLicense: 'platinum', + savedObject: { all: [], read: [] }, + management: { insightsAndAlerting: ['reporting'] }, + api: ['generateReport'], + ui: ['generateScreenshot'], + }, + { + id: 'download_csv_report', + name: i18n.translate('xpack.features.ossFeatures.reporting.dashboardDownloadCSV', { + defaultMessage: 'Download CSV reports from Saved Search panels', + }), + includeIn: 'all', + savedObject: { all: [], read: [] }, + management: { insightsAndAlerting: ['reporting'] }, + api: ['downloadCsv'], + ui: ['downloadCsv'], + }, + ], + }, + ], + }, + visualizeReporting: { + name: reportingPrivilegeGroupName, + privilegeGroups: [ + { + groupType: 'independent', + privileges: [ + { + id: 'generate_report', + name: i18n.translate( + 'xpack.features.ossFeatures.reporting.visualizeGenerateScreenshot', + { + defaultMessage: 'Generate PDF or PNG reports', + } + ), + includeIn: 'all', + minimumLicense: 'platinum', + savedObject: { all: [], read: [] }, + management: { insightsAndAlerting: ['reporting'] }, + api: ['generateReport'], + ui: ['generateScreenshot'], + }, + ], + }, + ], + }, +}; diff --git a/x-pack/plugins/features/server/plugin.ts b/x-pack/plugins/features/server/plugin.ts index 6a9fd1da826a6..09a5b78ad868a 100644 --- a/x-pack/plugins/features/server/plugin.ts +++ b/x-pack/plugins/features/server/plugin.ts @@ -46,6 +46,14 @@ export interface PluginSetupContract { * */ getElasticsearchFeatures(): ElasticsearchFeature[]; getFeaturesUICapabilities(): UICapabilities; + + /* + * In the future, OSS features should register their own subfeature + * privileges. This can be done when parts of Reporting are moved to + * src/plugins. For now, this method exists for `reporting` to tell + * `features` to include Reporting when registering OSS features. + */ + enableReportingUiCapabilities(): void; } export interface PluginStartContract { @@ -66,6 +74,7 @@ export class FeaturesPlugin private readonly logger: Logger; private readonly featureRegistry: FeatureRegistry = new FeatureRegistry(); private isTimelionEnabled: boolean = false; + private isReportingEnabled: boolean = false; constructor(private readonly initializerContext: PluginInitializerContext) { this.logger = this.initializerContext.logger.get(); @@ -100,6 +109,7 @@ export class FeaturesPlugin this.featureRegistry ), getFeaturesUICapabilities, + enableReportingUiCapabilities: this.enableReportingUiCapabilities.bind(this), }); } @@ -128,10 +138,18 @@ export class FeaturesPlugin const features = buildOSSFeatures({ savedObjectTypes, includeTimelion: this.isTimelionEnabled, + includeReporting: this.isReportingEnabled, }); for (const feature of features) { this.featureRegistry.registerKibanaFeature(feature); } } + + private enableReportingUiCapabilities() { + this.logger.debug( + `Feature controls for Reporting plugin are enabled. Please assign access to Reporting use Kibana feature controls for applications.` + ); + this.isReportingEnabled = true; + } } diff --git a/x-pack/plugins/file_data_visualizer/common/constants.ts b/x-pack/plugins/file_data_visualizer/common/constants.ts new file mode 100644 index 0000000000000..819549a7eb4e6 --- /dev/null +++ b/x-pack/plugins/file_data_visualizer/common/constants.ts @@ -0,0 +1,31 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +export const UI_SETTING_MAX_FILE_SIZE = 'fileUpload:maxFileSize'; + +export const MB = Math.pow(2, 20); +export const MAX_FILE_SIZE = '100MB'; +export const MAX_FILE_SIZE_BYTES = 104857600; // 100MB + +export const ABSOLUTE_MAX_FILE_SIZE_BYTES = 1073741274; // 1GB +export const FILE_SIZE_DISPLAY_FORMAT = '0,0.[0] b'; + +// Value to use in the Elasticsearch index mapping meta data to identify the +// index as having been created by the File Data Visualizer. +export const INDEX_META_DATA_CREATED_BY = 'file-data-visualizer'; + +export const JOB_FIELD_TYPES = { + BOOLEAN: 'boolean', + DATE: 'date', + GEO_POINT: 'geo_point', + GEO_SHAPE: 'geo_shape', + IP: 'ip', + KEYWORD: 'keyword', + NUMBER: 'number', + TEXT: 'text', + UNKNOWN: 'unknown', +} as const; diff --git a/x-pack/plugins/security_solution/server/graphql/scalar_date/schema.gql.ts b/x-pack/plugins/file_data_visualizer/common/index.ts similarity index 76% rename from x-pack/plugins/security_solution/server/graphql/scalar_date/schema.gql.ts rename to x-pack/plugins/file_data_visualizer/common/index.ts index 3c1ba4fedcf36..f4d74984a7d78 100644 --- a/x-pack/plugins/security_solution/server/graphql/scalar_date/schema.gql.ts +++ b/x-pack/plugins/file_data_visualizer/common/index.ts @@ -5,8 +5,5 @@ * 2.0. */ -import gql from 'graphql-tag'; - -export const dateSchema = gql` - scalar Date -`; +export * from './constants'; +export * from './types'; diff --git a/x-pack/plugins/file_data_visualizer/common/types.ts b/x-pack/plugins/file_data_visualizer/common/types.ts new file mode 100644 index 0000000000000..edfe8b3575c8d --- /dev/null +++ b/x-pack/plugins/file_data_visualizer/common/types.ts @@ -0,0 +1,22 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import { JOB_FIELD_TYPES } from './constants'; + +export type InputData = any[]; + +export type JobFieldType = typeof JOB_FIELD_TYPES[keyof typeof JOB_FIELD_TYPES]; + +export interface DataVisualizerTableState { + pageSize: number; + pageIndex: number; + sortField: string; + sortDirection: string; + visibleFieldTypes: string[]; + visibleFieldNames: string[]; + showDistributions: boolean; +} diff --git a/x-pack/plugins/security_solution/server/graphql/ecs/index.ts b/x-pack/plugins/file_data_visualizer/jest.config.js similarity index 66% rename from x-pack/plugins/security_solution/server/graphql/ecs/index.ts rename to x-pack/plugins/file_data_visualizer/jest.config.js index 2c534d979a925..90d4cfb81f11f 100644 --- a/x-pack/plugins/security_solution/server/graphql/ecs/index.ts +++ b/x-pack/plugins/file_data_visualizer/jest.config.js @@ -5,5 +5,8 @@ * 2.0. */ -export { ecsSchema } from './schema.gql'; -export { createScalarToStringArrayValueResolvers } from './resolvers'; +module.exports = { + preset: '@kbn/test', + rootDir: '../../..', + roots: ['/x-pack/plugins/file_data_visualizer'], +}; diff --git a/x-pack/plugins/file_data_visualizer/kibana.json b/x-pack/plugins/file_data_visualizer/kibana.json new file mode 100644 index 0000000000000..721352cff7c95 --- /dev/null +++ b/x-pack/plugins/file_data_visualizer/kibana.json @@ -0,0 +1,27 @@ +{ + "id": "fileDataVisualizer", + "version": "8.0.0", + "kibanaVersion": "kibana", + "server": true, + "ui": true, + "requiredPlugins": [ + "data", + "usageCollection", + "embeddable", + "share", + "discover", + "fileUpload" + ], + "optionalPlugins": [ + "security", + "maps" + ], + "requiredBundles": [ + "kibanaReact", + "maps", + "esUiShared" + ], + "extraPublicDirs": [ + "common" + ] +} diff --git a/x-pack/plugins/file_data_visualizer/public/api/index.ts b/x-pack/plugins/file_data_visualizer/public/api/index.ts new file mode 100644 index 0000000000000..13efd80133349 --- /dev/null +++ b/x-pack/plugins/file_data_visualizer/public/api/index.ts @@ -0,0 +1,14 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import { lazyLoadModules } from '../lazy_load_bundle'; +import { FileDataVisualizer } from '../application'; + +export async function getFileDataVisualizerComponent(): Promise { + const modules = await lazyLoadModules(); + return modules.FileDataVisualizer; +} diff --git a/x-pack/plugins/ml/public/application/datavisualizer/file_based/_index.scss b/x-pack/plugins/file_data_visualizer/public/application/_index.scss similarity index 100% rename from x-pack/plugins/ml/public/application/datavisualizer/file_based/_index.scss rename to x-pack/plugins/file_data_visualizer/public/application/_index.scss diff --git a/x-pack/plugins/ml/public/application/datavisualizer/file_based/components/_index.scss b/x-pack/plugins/file_data_visualizer/public/application/components/_index.scss similarity index 100% rename from x-pack/plugins/ml/public/application/datavisualizer/file_based/components/_index.scss rename to x-pack/plugins/file_data_visualizer/public/application/components/_index.scss diff --git a/x-pack/plugins/ml/public/application/datavisualizer/file_based/components/about_panel/_about_panel.scss b/x-pack/plugins/file_data_visualizer/public/application/components/about_panel/_about_panel.scss similarity index 100% rename from x-pack/plugins/ml/public/application/datavisualizer/file_based/components/about_panel/_about_panel.scss rename to x-pack/plugins/file_data_visualizer/public/application/components/about_panel/_about_panel.scss diff --git a/x-pack/plugins/ml/public/application/datavisualizer/file_based/components/about_panel/_index.scss b/x-pack/plugins/file_data_visualizer/public/application/components/about_panel/_index.scss similarity index 100% rename from x-pack/plugins/ml/public/application/datavisualizer/file_based/components/about_panel/_index.scss rename to x-pack/plugins/file_data_visualizer/public/application/components/about_panel/_index.scss diff --git a/x-pack/plugins/ml/public/application/datavisualizer/file_based/components/about_panel/about_panel.tsx b/x-pack/plugins/file_data_visualizer/public/application/components/about_panel/about_panel.tsx similarity index 93% rename from x-pack/plugins/ml/public/application/datavisualizer/file_based/components/about_panel/about_panel.tsx rename to x-pack/plugins/file_data_visualizer/public/application/components/about_panel/about_panel.tsx index c768a422cfa5a..e4f59c492fa1c 100644 --- a/x-pack/plugins/ml/public/application/datavisualizer/file_based/components/about_panel/about_panel.tsx +++ b/x-pack/plugins/file_data_visualizer/public/application/components/about_panel/about_panel.tsx @@ -43,7 +43,7 @@ export const AboutPanel: FC = ({ onFilePickerChange }) => { {

diff --git a/x-pack/plugins/ml/public/application/datavisualizer/file_based/components/about_panel/index.ts b/x-pack/plugins/file_data_visualizer/public/application/components/about_panel/index.ts similarity index 100% rename from x-pack/plugins/ml/public/application/datavisualizer/file_based/components/about_panel/index.ts rename to x-pack/plugins/file_data_visualizer/public/application/components/about_panel/index.ts diff --git a/x-pack/plugins/ml/public/application/datavisualizer/file_based/components/about_panel/welcome_content.tsx b/x-pack/plugins/file_data_visualizer/public/application/components/about_panel/welcome_content.tsx similarity index 78% rename from x-pack/plugins/ml/public/application/datavisualizer/file_based/components/about_panel/welcome_content.tsx rename to x-pack/plugins/file_data_visualizer/public/application/components/about_panel/welcome_content.tsx index 2c441e42dea2f..684b6dadcb290 100644 --- a/x-pack/plugins/ml/public/application/datavisualizer/file_based/components/about_panel/welcome_content.tsx +++ b/x-pack/plugins/file_data_visualizer/public/application/components/about_panel/welcome_content.tsx @@ -21,26 +21,22 @@ import { import { ExperimentalBadge } from '../experimental_badge'; -import { useMlKibana } from '../../../../contexts/kibana'; +import { useFileDataVisualizerKibana } from '../../kibana_context'; export const WelcomeContent: FC = () => { const toolTipContent = i18n.translate( - 'xpack.ml.fileDatavisualizer.welcomeContent.experimentalFeatureTooltip', + 'xpack.fileDataVisualizer.welcomeContent.experimentalFeatureTooltip', { defaultMessage: "Experimental feature. We'd love to hear your feedback.", } ); const { - services: { fileUpload }, - } = useMlKibana(); - - if (fileUpload === undefined) { - // eslint-disable-next-line no-console - console.error('File upload plugin not available'); - return null; - } - const maxFileSize = fileUpload.getMaxBytesFormatted(); + services: { + fileUpload: { getMaxBytesFormatted }, + }, + } = useFileDataVisualizerKibana(); + const maxFileSize = getMaxBytesFormatted(); return ( @@ -51,7 +47,7 @@ export const WelcomeContent: FC = () => {

, @@ -63,7 +59,7 @@ export const WelcomeContent: FC = () => {

@@ -73,7 +69,7 @@ export const WelcomeContent: FC = () => {

@@ -87,7 +83,7 @@ export const WelcomeContent: FC = () => {

@@ -103,7 +99,7 @@ export const WelcomeContent: FC = () => {

@@ -119,7 +115,7 @@ export const WelcomeContent: FC = () => {

@@ -130,7 +126,7 @@ export const WelcomeContent: FC = () => {

@@ -140,7 +136,7 @@ export const WelcomeContent: FC = () => {

= ({ results }) => { const items = createDisplayItems(results); @@ -19,7 +19,7 @@ export const AnalysisSummary: FC<{ results: FindFileStructureResponse }> = ({ re

@@ -37,7 +37,7 @@ function createDisplayItems(results: FindFileStructureResponse) { { title: ( ), @@ -53,7 +53,7 @@ function createDisplayItems(results: FindFileStructureResponse) { items.push({ title: ( ), @@ -64,7 +64,7 @@ function createDisplayItems(results: FindFileStructureResponse) { items.push({ title: ( ), @@ -74,7 +74,7 @@ function createDisplayItems(results: FindFileStructureResponse) { items.push({ title: ( ), @@ -87,7 +87,7 @@ function createDisplayItems(results: FindFileStructureResponse) { items.push({ title: ( ), @@ -99,7 +99,7 @@ function createDisplayItems(results: FindFileStructureResponse) { items.push({ title: ( ), @@ -111,7 +111,7 @@ function createDisplayItems(results: FindFileStructureResponse) { items.push({ title: ( = ({ mode, onChangeMode, onCancel, di content={ disableImport ? ( ) : null @@ -52,7 +52,7 @@ export const BottomBar: FC = ({ mode, onChangeMode, onCancel, di data-test-subj="mlFileDataVisOpenImportPageButton" > @@ -61,7 +61,7 @@ export const BottomBar: FC = ({ mode, onChangeMode, onCancel, di onCancel()}> @@ -76,7 +76,7 @@ export const BottomBar: FC = ({ mode, onChangeMode, onCancel, di onChangeMode(DATAVISUALIZER_MODE.READ)}> @@ -84,7 +84,7 @@ export const BottomBar: FC = ({ mode, onChangeMode, onCancel, di onCancel()}> diff --git a/x-pack/plugins/ml/public/application/datavisualizer/file_based/components/bottom_bar/index.ts b/x-pack/plugins/file_data_visualizer/public/application/components/bottom_bar/index.ts similarity index 100% rename from x-pack/plugins/ml/public/application/datavisualizer/file_based/components/bottom_bar/index.ts rename to x-pack/plugins/file_data_visualizer/public/application/components/bottom_bar/index.ts diff --git a/x-pack/plugins/ml/public/application/datavisualizer/file_based/components/combined_fields/combined_field_label.tsx b/x-pack/plugins/file_data_visualizer/public/application/components/combined_fields/combined_field_label.tsx similarity index 100% rename from x-pack/plugins/ml/public/application/datavisualizer/file_based/components/combined_fields/combined_field_label.tsx rename to x-pack/plugins/file_data_visualizer/public/application/components/combined_fields/combined_field_label.tsx diff --git a/x-pack/plugins/ml/public/application/datavisualizer/file_based/components/combined_fields/combined_fields_form.tsx b/x-pack/plugins/file_data_visualizer/public/application/components/combined_fields/combined_fields_form.tsx similarity index 87% rename from x-pack/plugins/ml/public/application/datavisualizer/file_based/components/combined_fields/combined_fields_form.tsx rename to x-pack/plugins/file_data_visualizer/public/application/components/combined_fields/combined_fields_form.tsx index 02ead5c26f959..fddab3edc3ec0 100644 --- a/x-pack/plugins/ml/public/application/datavisualizer/file_based/components/combined_fields/combined_fields_form.tsx +++ b/x-pack/plugins/file_data_visualizer/public/application/components/combined_fields/combined_fields_form.tsx @@ -29,13 +29,13 @@ import { removeCombinedFieldsFromMappings, removeCombinedFieldsFromPipeline, } from './utils'; -import { FindFileStructureResponse } from '../../../../../../../file_upload/common'; +import { FindFileStructureResponse } from '../../../../../file_upload/common'; interface Props { mappingsString: string; pipelineString: string; - onMappingsStringChange(): void; - onPipelineStringChange(): void; + onMappingsStringChange(mappings: string): void; + onPipelineStringChange(pipeline: string): void; combinedFields: CombinedField[]; onCombinedFieldsChange(combinedFields: CombinedField[]): void; results: FindFileStructureResponse; @@ -72,11 +72,9 @@ export class CombinedFieldsForm extends Component { const pipeline = this.parsePipeline(); this.props.onMappingsStringChange( - // @ts-expect-error JSON.stringify(addCombinedFieldsToMappings(mappings, [combinedField]), null, 2) ); this.props.onPipelineStringChange( - // @ts-expect-error JSON.stringify(addCombinedFieldsToPipeline(pipeline, [combinedField]), null, 2) ); this.props.onCombinedFieldsChange([...this.props.combinedFields, combinedField]); @@ -99,11 +97,9 @@ export class CombinedFieldsForm extends Component { const removedCombinedFields = updatedCombinedFields.splice(index, 1); this.props.onMappingsStringChange( - // @ts-expect-error JSON.stringify(removeCombinedFieldsFromMappings(mappings, removedCombinedFields), null, 2) ); this.props.onPipelineStringChange( - // @ts-expect-error JSON.stringify(removeCombinedFieldsFromPipeline(pipeline, removedCombinedFields), null, 2) ); this.props.onCombinedFieldsChange(updatedCombinedFields); @@ -114,7 +110,7 @@ export class CombinedFieldsForm extends Component { return JSON.parse(this.props.mappingsString); } catch (error) { throw new Error( - i18n.translate('xpack.ml.fileDatavisualizer.combinedFieldsForm.mappingsParseError', { + i18n.translate('xpack.fileDataVisualizer.combinedFieldsForm.mappingsParseError', { defaultMessage: 'Error parsing mappings: {error}', values: { error: error.message }, }) @@ -127,7 +123,7 @@ export class CombinedFieldsForm extends Component { return JSON.parse(this.props.pipelineString); } catch (error) { throw new Error( - i18n.translate('xpack.ml.fileDatavisualizer.combinedFieldsForm.pipelineParseError', { + i18n.translate('xpack.fileDataVisualizer.combinedFieldsForm.pipelineParseError', { defaultMessage: 'Error parsing pipeline: {error}', values: { error: error.message }, }) @@ -153,7 +149,7 @@ export class CombinedFieldsForm extends Component { }; render() { - const geoPointLabel = i18n.translate('xpack.ml.fileDatavisualizer.geoPointCombinedFieldLabel', { + const geoPointLabel = i18n.translate('xpack.fileDataVisualizer.geoPointCombinedFieldLabel', { defaultMessage: 'Add geo point field', }); const panels = [ @@ -180,7 +176,7 @@ export class CombinedFieldsForm extends Component { ]; return ( @@ -196,11 +192,11 @@ export class CombinedFieldsForm extends Component { iconType="trash" color="danger" onClick={this.removeCombinedField.bind(null, idx)} - title={i18n.translate('xpack.ml.fileDatavisualizer.removeCombinedFieldsLabel', { + title={i18n.translate('xpack.fileDataVisualizer.removeCombinedFieldsLabel', { defaultMessage: 'Remove combined field', })} aria-label={i18n.translate( - 'xpack.ml.fileDatavisualizer.removeCombinedFieldsLabel', + 'xpack.fileDataVisualizer.removeCombinedFieldsLabel', { defaultMessage: 'Remove combined field', } @@ -220,7 +216,7 @@ export class CombinedFieldsForm extends Component { isDisabled={this.props.isDisabled} > diff --git a/x-pack/plugins/ml/public/application/datavisualizer/file_based/components/combined_fields/combined_fields_read_only_form.tsx b/x-pack/plugins/file_data_visualizer/public/application/components/combined_fields/combined_fields_read_only_form.tsx similarity index 83% rename from x-pack/plugins/ml/public/application/datavisualizer/file_based/components/combined_fields/combined_fields_read_only_form.tsx rename to x-pack/plugins/file_data_visualizer/public/application/components/combined_fields/combined_fields_read_only_form.tsx index dc8e839b7defe..978383f8e5e10 100644 --- a/x-pack/plugins/ml/public/application/datavisualizer/file_based/components/combined_fields/combined_fields_read_only_form.tsx +++ b/x-pack/plugins/file_data_visualizer/public/application/components/combined_fields/combined_fields_read_only_form.tsx @@ -20,10 +20,10 @@ export function CombinedFieldsReadOnlyForm({ }) { return combinedFields.length ? ( diff --git a/x-pack/plugins/ml/public/application/datavisualizer/file_based/components/combined_fields/geo_point.tsx b/x-pack/plugins/file_data_visualizer/public/application/components/combined_fields/geo_point.tsx similarity index 90% rename from x-pack/plugins/ml/public/application/datavisualizer/file_based/components/combined_fields/geo_point.tsx rename to x-pack/plugins/file_data_visualizer/public/application/components/combined_fields/geo_point.tsx index 5ae2e5de681c3..578d22384be33 100644 --- a/x-pack/plugins/ml/public/application/datavisualizer/file_based/components/combined_fields/geo_point.tsx +++ b/x-pack/plugins/file_data_visualizer/public/application/components/combined_fields/geo_point.tsx @@ -29,7 +29,7 @@ import { getFieldNames, getNameCollisionMsg, } from './utils'; -import { FindFileStructureResponse } from '../../../../../../../file_upload/common'; +import { FindFileStructureResponse } from '../../../../../file_upload/common'; interface Props { addCombinedField: (combinedField: CombinedField) => void; @@ -119,7 +119,7 @@ export class GeoPointForm extends Component { return ( @@ -131,7 +131,7 @@ export class GeoPointForm extends Component { @@ -143,7 +143,7 @@ export class GeoPointForm extends Component { { onChange={this.onGeoPointFieldChange} isInvalid={this.state.geoPointFieldError !== ''} aria-label={i18n.translate( - 'xpack.ml.fileDatavisualizer.geoPointForm.geoPointFieldAriaLabel', + 'xpack.fileDataVisualizer.geoPointForm.geoPointFieldAriaLabel', { defaultMessage: 'Geo point field, required field', } @@ -179,7 +179,7 @@ export class GeoPointForm extends Component { onClick={this.onSubmit} > diff --git a/x-pack/plugins/ml/public/application/datavisualizer/file_based/components/combined_fields/index.ts b/x-pack/plugins/file_data_visualizer/public/application/components/combined_fields/index.ts similarity index 100% rename from x-pack/plugins/ml/public/application/datavisualizer/file_based/components/combined_fields/index.ts rename to x-pack/plugins/file_data_visualizer/public/application/components/combined_fields/index.ts diff --git a/x-pack/plugins/ml/public/application/datavisualizer/file_based/components/combined_fields/types.ts b/x-pack/plugins/file_data_visualizer/public/application/components/combined_fields/types.ts similarity index 100% rename from x-pack/plugins/ml/public/application/datavisualizer/file_based/components/combined_fields/types.ts rename to x-pack/plugins/file_data_visualizer/public/application/components/combined_fields/types.ts diff --git a/x-pack/plugins/ml/public/application/datavisualizer/file_based/components/combined_fields/utils.test.ts b/x-pack/plugins/file_data_visualizer/public/application/components/combined_fields/utils.test.ts similarity index 100% rename from x-pack/plugins/ml/public/application/datavisualizer/file_based/components/combined_fields/utils.test.ts rename to x-pack/plugins/file_data_visualizer/public/application/components/combined_fields/utils.test.ts diff --git a/x-pack/plugins/ml/public/application/datavisualizer/file_based/components/combined_fields/utils.ts b/x-pack/plugins/file_data_visualizer/public/application/components/combined_fields/utils.ts similarity index 97% rename from x-pack/plugins/ml/public/application/datavisualizer/file_based/components/combined_fields/utils.ts rename to x-pack/plugins/file_data_visualizer/public/application/components/combined_fields/utils.ts index ab08398fcda02..efd166d4821c5 100644 --- a/x-pack/plugins/ml/public/application/datavisualizer/file_based/components/combined_fields/utils.ts +++ b/x-pack/plugins/file_data_visualizer/public/application/components/combined_fields/utils.ts @@ -13,7 +13,7 @@ import { FindFileStructureResponse, IngestPipeline, Mappings, -} from '../../../../../../../file_upload/common'; +} from '../../../../../file_upload/common'; const COMMON_LAT_NAMES = ['latitude', 'lat']; const COMMON_LON_NAMES = ['longitude', 'long', 'lon']; @@ -127,7 +127,7 @@ export function createGeoPointCombinedField( } export function getNameCollisionMsg(name: string) { - return i18n.translate('xpack.ml.fileDatavisualizer.nameCollisionMsg', { + return i18n.translate('xpack.fileDataVisualizer.nameCollisionMsg', { defaultMessage: '"{name}" already exists, please provide a unique name', values: { name }, }); diff --git a/x-pack/plugins/ml/public/application/datavisualizer/file_based/components/edit_flyout/__snapshots__/overrides.test.js.snap b/x-pack/plugins/file_data_visualizer/public/application/components/edit_flyout/__snapshots__/overrides.test.js.snap similarity index 96% rename from x-pack/plugins/ml/public/application/datavisualizer/file_based/components/edit_flyout/__snapshots__/overrides.test.js.snap rename to x-pack/plugins/file_data_visualizer/public/application/components/edit_flyout/__snapshots__/overrides.test.js.snap index 6ab89fe3e4b2d..00dd652457daf 100644 --- a/x-pack/plugins/ml/public/application/datavisualizer/file_based/components/edit_flyout/__snapshots__/overrides.test.js.snap +++ b/x-pack/plugins/file_data_visualizer/public/application/components/edit_flyout/__snapshots__/overrides.test.js.snap @@ -13,7 +13,7 @@ exports[`Overrides render overrides 1`] = ` label={ } @@ -33,7 +33,7 @@ exports[`Overrides render overrides 1`] = ` label={ } @@ -94,7 +94,7 @@ exports[`Overrides render overrides 1`] = ` label={ } @@ -335,7 +335,7 @@ exports[`Overrides render overrides 1`] = ` label={ } diff --git a/x-pack/plugins/ml/public/application/datavisualizer/file_based/components/edit_flyout/_edit_flyout.scss b/x-pack/plugins/file_data_visualizer/public/application/components/edit_flyout/_edit_flyout.scss similarity index 100% rename from x-pack/plugins/ml/public/application/datavisualizer/file_based/components/edit_flyout/_edit_flyout.scss rename to x-pack/plugins/file_data_visualizer/public/application/components/edit_flyout/_edit_flyout.scss diff --git a/x-pack/plugins/ml/public/application/datavisualizer/file_based/components/edit_flyout/_index.scss b/x-pack/plugins/file_data_visualizer/public/application/components/edit_flyout/_index.scss similarity index 100% rename from x-pack/plugins/ml/public/application/datavisualizer/file_based/components/edit_flyout/_index.scss rename to x-pack/plugins/file_data_visualizer/public/application/components/edit_flyout/_index.scss diff --git a/x-pack/plugins/ml/public/application/datavisualizer/file_based/components/edit_flyout/edit_flyout.js b/x-pack/plugins/file_data_visualizer/public/application/components/edit_flyout/edit_flyout.js similarity index 91% rename from x-pack/plugins/ml/public/application/datavisualizer/file_based/components/edit_flyout/edit_flyout.js rename to x-pack/plugins/file_data_visualizer/public/application/components/edit_flyout/edit_flyout.js index c26e504087b46..7cdee6f823bd6 100644 --- a/x-pack/plugins/ml/public/application/datavisualizer/file_based/components/edit_flyout/edit_flyout.js +++ b/x-pack/plugins/file_data_visualizer/public/application/components/edit_flyout/edit_flyout.js @@ -69,7 +69,7 @@ export class EditFlyout extends Component {

@@ -96,7 +96,7 @@ export class EditFlyout extends Component { @@ -108,7 +108,7 @@ export class EditFlyout extends Component { fill > diff --git a/x-pack/plugins/ml/public/application/datavisualizer/file_based/components/edit_flyout/index.js b/x-pack/plugins/file_data_visualizer/public/application/components/edit_flyout/index.js similarity index 100% rename from x-pack/plugins/ml/public/application/datavisualizer/file_based/components/edit_flyout/index.js rename to x-pack/plugins/file_data_visualizer/public/application/components/edit_flyout/index.js diff --git a/x-pack/plugins/ml/public/application/datavisualizer/file_based/components/edit_flyout/options/index.js b/x-pack/plugins/file_data_visualizer/public/application/components/edit_flyout/options/index.js similarity index 100% rename from x-pack/plugins/ml/public/application/datavisualizer/file_based/components/edit_flyout/options/index.js rename to x-pack/plugins/file_data_visualizer/public/application/components/edit_flyout/options/index.js diff --git a/x-pack/plugins/ml/public/application/datavisualizer/file_based/components/edit_flyout/options/option_lists.js b/x-pack/plugins/file_data_visualizer/public/application/components/edit_flyout/options/option_lists.js similarity index 100% rename from x-pack/plugins/ml/public/application/datavisualizer/file_based/components/edit_flyout/options/option_lists.js rename to x-pack/plugins/file_data_visualizer/public/application/components/edit_flyout/options/option_lists.js diff --git a/x-pack/plugins/ml/public/application/datavisualizer/file_based/components/edit_flyout/options/options.js b/x-pack/plugins/file_data_visualizer/public/application/components/edit_flyout/options/options.js similarity index 100% rename from x-pack/plugins/ml/public/application/datavisualizer/file_based/components/edit_flyout/options/options.js rename to x-pack/plugins/file_data_visualizer/public/application/components/edit_flyout/options/options.js diff --git a/x-pack/plugins/ml/public/application/datavisualizer/file_based/components/edit_flyout/overrides.js b/x-pack/plugins/file_data_visualizer/public/application/components/edit_flyout/overrides.js similarity index 90% rename from x-pack/plugins/ml/public/application/datavisualizer/file_based/components/edit_flyout/overrides.js rename to x-pack/plugins/file_data_visualizer/public/application/components/edit_flyout/overrides.js index 23c7b869f5e6f..cb0839b335a97 100644 --- a/x-pack/plugins/ml/public/application/datavisualizer/file_based/components/edit_flyout/overrides.js +++ b/x-pack/plugins/file_data_visualizer/public/application/components/edit_flyout/overrides.js @@ -31,7 +31,7 @@ import { // getCharsetOptions, } from './options'; import { isTimestampFormatValid } from './overrides_validation'; -import { withKibana } from '../../../../../../../../../src/plugins/kibana_react/public'; +import { withKibana } from '../../../../../../../src/plugins/kibana_react/public'; import { TIMESTAMP_OPTIONS, CUSTOM_DROPDOWN_OPTION } from './options/option_lists'; @@ -52,7 +52,7 @@ class OverridesUI extends Component { } linesToSampleErrors = i18n.translate( - 'xpack.ml.fileDatavisualizer.editFlyout.overrides.linesToSampleErrorMessage', + 'xpack.fileDataVisualizer.editFlyout.overrides.linesToSampleErrorMessage', { defaultMessage: 'Value must be greater than {min} and less than or equal to {max}', values: { @@ -63,7 +63,7 @@ class OverridesUI extends Component { ); customTimestampFormatErrors = i18n.translate( - 'xpack.ml.fileDatavisualizer.editFlyout.overrides.customTimestampFormatErrorMessage', + 'xpack.fileDataVisualizer.editFlyout.overrides.customTimestampFormatErrorMessage', { defaultMessage: `Timestamp format must be a combination of these Java date/time formats: yy, yyyy, M, MM, MMM, MMMM, d, dd, EEE, EEEE, H, HH, h, mm, ss, S through SSSSSSSSS, a, XX, XXX, zzz`, @@ -274,12 +274,9 @@ class OverridesUI extends Component { const timestampFormatHelp = ( - {i18n.translate( - 'xpack.ml.fileDatavisualizer.editFlyout.overrides.timestampFormatHelpText', - { - defaultMessage: 'See more on accepted formats', - } - )} + {i18n.translate('xpack.fileDataVisualizer.editFlyout.overrides.timestampFormatHelpText', { + defaultMessage: 'See more on accepted formats', + })} ); @@ -291,7 +288,7 @@ class OverridesUI extends Component { isInvalid={linesToSampleValid === false} label={ } @@ -306,7 +303,7 @@ class OverridesUI extends Component { } @@ -324,7 +321,7 @@ class OverridesUI extends Component { } @@ -341,7 +338,7 @@ class OverridesUI extends Component { } @@ -353,7 +350,7 @@ class OverridesUI extends Component { } @@ -372,7 +369,7 @@ class OverridesUI extends Component { id={'hasHeaderRow'} label={ } @@ -386,7 +383,7 @@ class OverridesUI extends Component { id={'shouldTrimFields'} label={ } @@ -401,7 +398,7 @@ class OverridesUI extends Component { } @@ -418,7 +415,7 @@ class OverridesUI extends Component { helpText={timestampFormatHelp} label={ } @@ -437,7 +434,7 @@ class OverridesUI extends Component { isInvalid={timestampFormatValid === false} label={ } @@ -453,7 +450,7 @@ class OverridesUI extends Component { } @@ -483,7 +480,7 @@ class OverridesUI extends Component {

diff --git a/x-pack/plugins/ml/public/application/datavisualizer/file_based/components/edit_flyout/overrides.test.js b/x-pack/plugins/file_data_visualizer/public/application/components/edit_flyout/overrides.test.js similarity index 94% rename from x-pack/plugins/ml/public/application/datavisualizer/file_based/components/edit_flyout/overrides.test.js rename to x-pack/plugins/file_data_visualizer/public/application/components/edit_flyout/overrides.test.js index 764ae6fb2b536..8e11d5150359d 100644 --- a/x-pack/plugins/ml/public/application/datavisualizer/file_based/components/edit_flyout/overrides.test.js +++ b/x-pack/plugins/file_data_visualizer/public/application/components/edit_flyout/overrides.test.js @@ -10,7 +10,7 @@ import React from 'react'; import { Overrides } from './overrides'; -jest.mock('../../../../../../../../../src/plugins/kibana_react/public', () => ({ +jest.mock('../../../../../../../src/plugins/kibana_react/public', () => ({ withKibana: (comp) => { return comp; }, diff --git a/x-pack/plugins/ml/public/application/datavisualizer/file_based/components/edit_flyout/overrides_validation.js b/x-pack/plugins/file_data_visualizer/public/application/components/edit_flyout/overrides_validation.js similarity index 84% rename from x-pack/plugins/ml/public/application/datavisualizer/file_based/components/edit_flyout/overrides_validation.js rename to x-pack/plugins/file_data_visualizer/public/application/components/edit_flyout/overrides_validation.js index 79a44bd8b5ac6..c833d55351b6d 100644 --- a/x-pack/plugins/ml/public/application/datavisualizer/file_based/components/edit_flyout/overrides_validation.js +++ b/x-pack/plugins/file_data_visualizer/public/application/components/edit_flyout/overrides_validation.js @@ -41,7 +41,7 @@ export function isTimestampFormatValid(timestampFormat) { if (timestampFormat.indexOf('?') >= 0) { result.isValid = false; result.errorMessage = i18n.translate( - 'xpack.ml.fileDatavisualizer.editFlyout.overrides.timestampQuestionMarkValidationErrorMessage', + 'xpack.fileDataVisualizer.editFlyout.overrides.timestampQuestionMarkValidationErrorMessage', { defaultMessage: 'Timestamp format {timestampFormat} not supported because it contains a question mark character ({fieldPlaceholder})', @@ -86,7 +86,7 @@ export function isTimestampFormatValid(timestampFormat) { result.isValid = false; result.errorMessage = i18n.translate( - 'xpack.ml.fileDatavisualizer.editFlyout.overrides.timestampLetterValidationErrorMessage', + 'xpack.fileDataVisualizer.editFlyout.overrides.timestampLetterValidationErrorMessage', { defaultMessage: 'Letter { length, plural, one { {lg} } other { group {lg} } } in {format} is not supported', @@ -101,9 +101,10 @@ export function isTimestampFormatValid(timestampFormat) { if (curChar === 'S') { // disable exceeds maximum line length error so i18n check passes result.errorMessage = i18n.translate( - 'xpack.ml.fileDatavisualizer.editFlyout.overrides.timestampLetterSValidationErrorMessage', + 'xpack.fileDataVisualizer.editFlyout.overrides.timestampLetterSValidationErrorMessage', { - defaultMessage: 'Letter { length, plural, one { {lg} } other { group {lg} } } in {format} is not supported because it is not preceded by ss and a separator from {sep}', // eslint-disable-line + defaultMessage: + 'Letter { length, plural, one { {lg} } other { group {lg} } } in {format} is not supported because it is not preceded by ss and a separator from {sep}', // eslint-disable-line values: { length, lg: letterGroup, @@ -127,7 +128,7 @@ export function isTimestampFormatValid(timestampFormat) { if (prevLetterGroup == null) { result.isValid = false; result.errorMessage = i18n.translate( - 'xpack.ml.fileDatavisualizer.editFlyout.overrides.timestampEmptyValidationErrorMessage', + 'xpack.fileDataVisualizer.editFlyout.overrides.timestampEmptyValidationErrorMessage', { defaultMessage: 'No time format letter groups in timestamp format {timestampFormat}', values: { diff --git a/x-pack/plugins/file_data_visualizer/public/application/components/embedded_map/_embedded_map.scss b/x-pack/plugins/file_data_visualizer/public/application/components/embedded_map/_embedded_map.scss new file mode 100644 index 0000000000000..99ee60f62bb21 --- /dev/null +++ b/x-pack/plugins/file_data_visualizer/public/application/components/embedded_map/_embedded_map.scss @@ -0,0 +1,8 @@ +.embeddedMapContent { + width: 100%; + height: 100%; + display: flex; + flex: 1 1 100%; + z-index: 1; + min-height: 0; // Absolute must for Firefox to scroll contents +} diff --git a/x-pack/plugins/file_data_visualizer/public/application/components/embedded_map/_index.scss b/x-pack/plugins/file_data_visualizer/public/application/components/embedded_map/_index.scss new file mode 100644 index 0000000000000..5b3c6b4990ff1 --- /dev/null +++ b/x-pack/plugins/file_data_visualizer/public/application/components/embedded_map/_index.scss @@ -0,0 +1 @@ +@import 'embedded_map'; diff --git a/x-pack/plugins/file_data_visualizer/public/application/components/embedded_map/embedded_map.tsx b/x-pack/plugins/file_data_visualizer/public/application/components/embedded_map/embedded_map.tsx new file mode 100644 index 0000000000000..42bc5ebf61227 --- /dev/null +++ b/x-pack/plugins/file_data_visualizer/public/application/components/embedded_map/embedded_map.tsx @@ -0,0 +1,155 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import React, { useEffect, useRef, useState } from 'react'; + +import { htmlIdGenerator } from '@elastic/eui'; +import { LayerDescriptor } from '../../../../../maps/common/descriptor_types'; +import { INITIAL_LOCATION } from '../../../../../maps/common/constants'; +import { + MapEmbeddable, + MapEmbeddableInput, + MapEmbeddableOutput, + // eslint-disable-next-line @kbn/eslint/no-restricted-paths +} from '../../../../../maps/public/embeddable'; +import { MAP_SAVED_OBJECT_TYPE, RenderTooltipContentParams } from '../../../../../maps/public'; +import { + EmbeddableFactory, + ErrorEmbeddable, + isErrorEmbeddable, + ViewMode, +} from '../../../../../../../src/plugins/embeddable/public'; +import { useFileDataVisualizerKibana } from '../../kibana_context'; + +export function EmbeddedMapComponent({ + layerList, + mapEmbeddableInput, + renderTooltipContent, +}: { + layerList: LayerDescriptor[]; + mapEmbeddableInput?: MapEmbeddableInput; + renderTooltipContent?: (params: RenderTooltipContentParams) => JSX.Element; +}) { + const [embeddable, setEmbeddable] = useState(); + + const embeddableRoot: React.RefObject = useRef(null); + const baseLayers = useRef(); + + const { + services: { embeddable: embeddablePlugin, maps: mapsPlugin }, + } = useFileDataVisualizerKibana(); + + const factory: + | EmbeddableFactory + | undefined = embeddablePlugin + ? embeddablePlugin.getEmbeddableFactory(MAP_SAVED_OBJECT_TYPE) + : undefined; + + // Update the layer list with updated geo points upon refresh + useEffect(() => { + async function updateIndexPatternSearchLayer() { + if ( + embeddable && + !isErrorEmbeddable(embeddable) && + Array.isArray(layerList) && + Array.isArray(baseLayers.current) + ) { + embeddable.setLayerList([...baseLayers.current, ...layerList]); + } + } + updateIndexPatternSearchLayer(); + }, [embeddable, layerList]); + + useEffect(() => { + async function setupEmbeddable() { + if (!factory) { + // eslint-disable-next-line no-console + console.error('Map embeddable not found.'); + return; + } + const input: MapEmbeddableInput = { + id: htmlIdGenerator()(), + attributes: { title: '' }, + filters: [], + hidePanelTitles: true, + refreshConfig: { + value: 0, + pause: false, + }, + viewMode: ViewMode.VIEW, + isLayerTOCOpen: false, + hideFilterActions: true, + // can use mapSettings to center map on anomalies + mapSettings: { + disableInteractive: false, + hideToolbarOverlay: false, + hideLayerControl: false, + hideViewControl: false, + initialLocation: INITIAL_LOCATION.AUTO_FIT_TO_BOUNDS, // this will startup based on data-extent + autoFitToDataBounds: true, // this will auto-fit when there are changes to the filter and/or query + }, + }; + + const embeddableObject = await factory.create(input); + + if (embeddableObject && !isErrorEmbeddable(embeddableObject)) { + const basemapLayerDescriptor = mapsPlugin + ? await mapsPlugin.createLayerDescriptors.createBasemapLayerDescriptor() + : null; + + if (basemapLayerDescriptor) { + baseLayers.current = [basemapLayerDescriptor]; + await embeddableObject.setLayerList(baseLayers.current); + } + } + + setEmbeddable(embeddableObject); + } + + setupEmbeddable(); + // we want this effect to execute exactly once after the component mounts + // eslint-disable-next-line + }, []); + + useEffect(() => { + if (embeddable && !isErrorEmbeddable(embeddable) && mapEmbeddableInput !== undefined) { + embeddable.updateInput(mapEmbeddableInput); + } + }, [embeddable, mapEmbeddableInput]); + + useEffect(() => { + if (embeddable && !isErrorEmbeddable(embeddable) && renderTooltipContent !== undefined) { + embeddable.setRenderTooltipContent(renderTooltipContent); + } + }, [embeddable, renderTooltipContent]); + + // We can only render after embeddable has already initialized + useEffect(() => { + if (embeddableRoot.current && embeddable) { + embeddable.render(embeddableRoot.current); + } + }, [embeddable, embeddableRoot]); + + if (!embeddablePlugin) { + // eslint-disable-next-line no-console + console.error('Embeddable start plugin not found'); + return null; + } + if (!mapsPlugin) { + // eslint-disable-next-line no-console + console.error('Maps start plugin not found'); + return null; + } + + return ( +
+ ); +} diff --git a/x-pack/plugins/security_solution/server/graphql/scalar_to_any/schema.gql.ts b/x-pack/plugins/file_data_visualizer/public/application/components/embedded_map/index.ts similarity index 75% rename from x-pack/plugins/security_solution/server/graphql/scalar_to_any/schema.gql.ts rename to x-pack/plugins/file_data_visualizer/public/application/components/embedded_map/index.ts index 79c4a881c10b9..ee11a18345f64 100644 --- a/x-pack/plugins/security_solution/server/graphql/scalar_to_any/schema.gql.ts +++ b/x-pack/plugins/file_data_visualizer/public/application/components/embedded_map/index.ts @@ -5,8 +5,4 @@ * 2.0. */ -import gql from 'graphql-tag'; - -export const toAnySchema = gql` - scalar ToAny -`; +export { EmbeddedMapComponent } from './embedded_map'; diff --git a/x-pack/plugins/file_data_visualizer/public/application/components/examples_list/examples_list.tsx b/x-pack/plugins/file_data_visualizer/public/application/components/examples_list/examples_list.tsx new file mode 100644 index 0000000000000..1c533075af27b --- /dev/null +++ b/x-pack/plugins/file_data_visualizer/public/application/components/examples_list/examples_list.tsx @@ -0,0 +1,59 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import React, { FC } from 'react'; + +import { EuiListGroup, EuiListGroupItem } from '@elastic/eui'; + +import { FormattedMessage } from '@kbn/i18n/react'; +import { ExpandedRowFieldHeader } from '../stats_table/components/expanded_row_field_header'; +interface Props { + examples: Array; +} + +export const ExamplesList: FC = ({ examples }) => { + if (examples === undefined || examples === null || !Array.isArray(examples)) { + return null; + } + let examplesContent; + if (examples.length === 0) { + examplesContent = ( + + ); + } else { + examplesContent = examples.map((example, i) => { + return ( + + ); + }); + } + + return ( +
+ + + + + {examplesContent} + +
+ ); +}; diff --git a/x-pack/plugins/security_solution/common/graphql/root/index.ts b/x-pack/plugins/file_data_visualizer/public/application/components/examples_list/index.ts similarity index 84% rename from x-pack/plugins/security_solution/common/graphql/root/index.ts rename to x-pack/plugins/file_data_visualizer/public/application/components/examples_list/index.ts index 194a6bc1a12c9..966c844987002 100644 --- a/x-pack/plugins/security_solution/common/graphql/root/index.ts +++ b/x-pack/plugins/file_data_visualizer/public/application/components/examples_list/index.ts @@ -5,4 +5,4 @@ * 2.0. */ -export { rootSchema } from './schema.gql'; +export { ExamplesList } from './examples_list'; diff --git a/x-pack/plugins/ml/public/application/datavisualizer/file_based/components/expanded_row/file_based_expanded_row.tsx b/x-pack/plugins/file_data_visualizer/public/application/components/expanded_row/file_based_expanded_row.tsx similarity index 69% rename from x-pack/plugins/ml/public/application/datavisualizer/file_based/components/expanded_row/file_based_expanded_row.tsx rename to x-pack/plugins/file_data_visualizer/public/application/components/expanded_row/file_based_expanded_row.tsx index 01b5da5c42ccc..620bcfef8ff6c 100644 --- a/x-pack/plugins/ml/public/application/datavisualizer/file_based/components/expanded_row/file_based_expanded_row.tsx +++ b/x-pack/plugins/file_data_visualizer/public/application/components/expanded_row/file_based_expanded_row.tsx @@ -14,10 +14,10 @@ import { OtherContent, TextContent, NumberContent, -} from '../../../stats_table/components/field_data_expanded_row'; +} from '../stats_table/components/field_data_expanded_row'; import { GeoPointContent } from './geo_point_content/geo_point_content'; -import { ML_JOB_FIELD_TYPES } from '../../../../../../common/constants/field_types'; -import type { FileBasedFieldVisConfig } from '../../../stats_table/types/field_vis_config'; +import { JOB_FIELD_TYPES } from '../../../../common'; +import type { FileBasedFieldVisConfig } from '../stats_table/types/field_vis_config'; export const FileBasedDataVisualizerExpandedRow = ({ item }: { item: FileBasedFieldVisConfig }) => { const config = item; @@ -25,25 +25,25 @@ export const FileBasedDataVisualizerExpandedRow = ({ item }: { item: FileBasedFi function getCardContent() { switch (type) { - case ML_JOB_FIELD_TYPES.NUMBER: + case JOB_FIELD_TYPES.NUMBER: return ; - case ML_JOB_FIELD_TYPES.BOOLEAN: + case JOB_FIELD_TYPES.BOOLEAN: return ; - case ML_JOB_FIELD_TYPES.DATE: + case JOB_FIELD_TYPES.DATE: return ; - case ML_JOB_FIELD_TYPES.GEO_POINT: + case JOB_FIELD_TYPES.GEO_POINT: return ; - case ML_JOB_FIELD_TYPES.IP: + case JOB_FIELD_TYPES.IP: return ; - case ML_JOB_FIELD_TYPES.KEYWORD: + case JOB_FIELD_TYPES.KEYWORD: return ; - case ML_JOB_FIELD_TYPES.TEXT: + case JOB_FIELD_TYPES.TEXT: return ; default: @@ -53,7 +53,7 @@ export const FileBasedDataVisualizerExpandedRow = ({ item }: { item: FileBasedFi return (
{getCardContent()} diff --git a/x-pack/plugins/ml/public/application/datavisualizer/file_based/components/expanded_row/geo_point_content/format_utils.ts b/x-pack/plugins/file_data_visualizer/public/application/components/expanded_row/geo_point_content/format_utils.ts similarity index 96% rename from x-pack/plugins/ml/public/application/datavisualizer/file_based/components/expanded_row/geo_point_content/format_utils.ts rename to x-pack/plugins/file_data_visualizer/public/application/components/expanded_row/geo_point_content/format_utils.ts index 30e07a6040dab..69e361aba9bca 100644 --- a/x-pack/plugins/ml/public/application/datavisualizer/file_based/components/expanded_row/geo_point_content/format_utils.ts +++ b/x-pack/plugins/file_data_visualizer/public/application/components/expanded_row/geo_point_content/format_utils.ts @@ -8,7 +8,7 @@ import { Feature, Point } from 'geojson'; import { euiPaletteColorBlind } from '@elastic/eui'; import { DEFAULT_GEO_REGEX } from './geo_point_content'; -import { SOURCE_TYPES } from '../../../../../../../../maps/common/constants'; +import { SOURCE_TYPES } from '../../../../../../maps/common/constants'; export const convertWKTGeoToLonLat = ( value: string | number diff --git a/x-pack/plugins/ml/public/application/datavisualizer/file_based/components/expanded_row/geo_point_content/geo_point_content.tsx b/x-pack/plugins/file_data_visualizer/public/application/components/expanded_row/geo_point_content/geo_point_content.tsx similarity index 78% rename from x-pack/plugins/ml/public/application/datavisualizer/file_based/components/expanded_row/geo_point_content/geo_point_content.tsx rename to x-pack/plugins/file_data_visualizer/public/application/components/expanded_row/geo_point_content/geo_point_content.tsx index b420ab43f56f4..c395b06059e8f 100644 --- a/x-pack/plugins/ml/public/application/datavisualizer/file_based/components/expanded_row/geo_point_content/geo_point_content.tsx +++ b/x-pack/plugins/file_data_visualizer/public/application/components/expanded_row/geo_point_content/geo_point_content.tsx @@ -9,12 +9,12 @@ import React, { FC, useMemo } from 'react'; import { EuiFlexItem } from '@elastic/eui'; import { Feature, Point } from 'geojson'; -import type { FieldDataRowProps } from '../../../../stats_table/types/field_data_row'; -import { DocumentStatsTable } from '../../../../stats_table/components/field_data_expanded_row/document_stats'; -import { MlEmbeddedMapComponent } from '../../../../../components/ml_embedded_map'; +import type { FieldDataRowProps } from '../../stats_table/types/field_data_row'; +import { DocumentStatsTable } from '../../stats_table/components/field_data_expanded_row/document_stats'; +import { EmbeddedMapComponent } from '../../embedded_map'; import { convertWKTGeoToLonLat, getGeoPointsLayer } from './format_utils'; -import { ExpandedRowContent } from '../../../../stats_table/components/field_data_expanded_row/expanded_row_content'; -import { ExamplesList } from '../../../../index_based/components/field_data_row/examples_list'; +import { ExpandedRowContent } from '../../stats_table/components/field_data_expanded_row/expanded_row_content'; +import { ExamplesList } from '../../examples_list'; export const DEFAULT_GEO_REGEX = RegExp('(?.+) (?.+)'); @@ -38,7 +38,7 @@ export const GeoPointContent: FC = ({ config }) => { geoPointsFeatures.push({ type: 'Feature', - id: `ml-${config.fieldName}-${i}`, + id: `fileDataVisualizer-${config.fieldName}-${i}`, geometry: { type: 'Point', coordinates: [coordinates.lat, coordinates.lon], @@ -69,10 +69,10 @@ export const GeoPointContent: FC = ({ config }) => { )} {formattedResults && Array.isArray(formattedResults.layerList) && ( - + )} diff --git a/x-pack/plugins/ml/public/application/datavisualizer/file_based/components/expanded_row/geo_point_content/index.ts b/x-pack/plugins/file_data_visualizer/public/application/components/expanded_row/geo_point_content/index.ts similarity index 100% rename from x-pack/plugins/ml/public/application/datavisualizer/file_based/components/expanded_row/geo_point_content/index.ts rename to x-pack/plugins/file_data_visualizer/public/application/components/expanded_row/geo_point_content/index.ts diff --git a/x-pack/plugins/ml/public/application/datavisualizer/file_based/components/expanded_row/index.ts b/x-pack/plugins/file_data_visualizer/public/application/components/expanded_row/index.ts similarity index 100% rename from x-pack/plugins/ml/public/application/datavisualizer/file_based/components/expanded_row/index.ts rename to x-pack/plugins/file_data_visualizer/public/application/components/expanded_row/index.ts diff --git a/x-pack/plugins/ml/public/application/datavisualizer/file_based/components/experimental_badge/_experimental_badge.scss b/x-pack/plugins/file_data_visualizer/public/application/components/experimental_badge/_experimental_badge.scss similarity index 74% rename from x-pack/plugins/ml/public/application/datavisualizer/file_based/components/experimental_badge/_experimental_badge.scss rename to x-pack/plugins/file_data_visualizer/public/application/components/experimental_badge/_experimental_badge.scss index 016d5cd579e3f..8b21620542ff7 100644 --- a/x-pack/plugins/ml/public/application/datavisualizer/file_based/components/experimental_badge/_experimental_badge.scss +++ b/x-pack/plugins/file_data_visualizer/public/application/components/experimental_badge/_experimental_badge.scss @@ -1,4 +1,4 @@ -.ml-experimental-badge.euiBetaBadge { +.experimental-badge.euiBetaBadge { font-size: 10px; vertical-align: middle; margin-bottom: 5px; diff --git a/x-pack/plugins/ml/public/application/datavisualizer/file_based/components/experimental_badge/_index.scss b/x-pack/plugins/file_data_visualizer/public/application/components/experimental_badge/_index.scss similarity index 100% rename from x-pack/plugins/ml/public/application/datavisualizer/file_based/components/experimental_badge/_index.scss rename to x-pack/plugins/file_data_visualizer/public/application/components/experimental_badge/_index.scss diff --git a/x-pack/plugins/ml/public/application/datavisualizer/file_based/components/experimental_badge/experimental_badge.tsx b/x-pack/plugins/file_data_visualizer/public/application/components/experimental_badge/experimental_badge.tsx similarity index 85% rename from x-pack/plugins/ml/public/application/datavisualizer/file_based/components/experimental_badge/experimental_badge.tsx rename to x-pack/plugins/file_data_visualizer/public/application/components/experimental_badge/experimental_badge.tsx index 5eef240429a48..a067cb198914e 100644 --- a/x-pack/plugins/ml/public/application/datavisualizer/file_based/components/experimental_badge/experimental_badge.tsx +++ b/x-pack/plugins/file_data_visualizer/public/application/components/experimental_badge/experimental_badge.tsx @@ -14,10 +14,10 @@ export const ExperimentalBadge: FC<{ tooltipContent: string }> = ({ tooltipConte return ( } diff --git a/x-pack/plugins/ml/public/application/datavisualizer/file_based/components/experimental_badge/index.ts b/x-pack/plugins/file_data_visualizer/public/application/components/experimental_badge/index.ts similarity index 100% rename from x-pack/plugins/ml/public/application/datavisualizer/file_based/components/experimental_badge/index.ts rename to x-pack/plugins/file_data_visualizer/public/application/components/experimental_badge/index.ts diff --git a/x-pack/plugins/ml/public/application/datavisualizer/file_based/components/explanation_flyout/explanation_flyout.tsx b/x-pack/plugins/file_data_visualizer/public/application/components/explanation_flyout/explanation_flyout.tsx similarity index 87% rename from x-pack/plugins/ml/public/application/datavisualizer/file_based/components/explanation_flyout/explanation_flyout.tsx rename to x-pack/plugins/file_data_visualizer/public/application/components/explanation_flyout/explanation_flyout.tsx index 579f2e3340954..606bab514ac9f 100644 --- a/x-pack/plugins/ml/public/application/datavisualizer/file_based/components/explanation_flyout/explanation_flyout.tsx +++ b/x-pack/plugins/file_data_visualizer/public/application/components/explanation_flyout/explanation_flyout.tsx @@ -20,7 +20,7 @@ import { EuiText, EuiSubSteps, } from '@elastic/eui'; -import { FindFileStructureResponse } from '../../../../../../../file_upload/common'; +import { FindFileStructureResponse } from '../../../../../file_upload/common'; interface Props { results: FindFileStructureResponse; @@ -34,7 +34,7 @@ export const ExplanationFlyout: FC = ({ results, closeFlyout }) => {

@@ -48,7 +48,7 @@ export const ExplanationFlyout: FC = ({ results, closeFlyout }) => { @@ -63,7 +63,7 @@ const Content: FC<{ explanation: string[] }> = ({ explanation }) => ( <> diff --git a/x-pack/plugins/ml/public/application/datavisualizer/file_based/components/explanation_flyout/index.ts b/x-pack/plugins/file_data_visualizer/public/application/components/explanation_flyout/index.ts similarity index 100% rename from x-pack/plugins/ml/public/application/datavisualizer/file_based/components/explanation_flyout/index.ts rename to x-pack/plugins/file_data_visualizer/public/application/components/explanation_flyout/index.ts diff --git a/x-pack/plugins/ml/public/application/datavisualizer/file_based/components/field_data_row/index.ts b/x-pack/plugins/file_data_visualizer/public/application/components/field_data_row/index.ts similarity index 100% rename from x-pack/plugins/ml/public/application/datavisualizer/file_based/components/field_data_row/index.ts rename to x-pack/plugins/file_data_visualizer/public/application/components/field_data_row/index.ts diff --git a/x-pack/plugins/ml/public/application/datavisualizer/file_based/components/field_data_row/number_content_preview.tsx b/x-pack/plugins/file_data_visualizer/public/application/components/field_data_row/number_content_preview.tsx similarity index 84% rename from x-pack/plugins/ml/public/application/datavisualizer/file_based/components/field_data_row/number_content_preview.tsx rename to x-pack/plugins/file_data_visualizer/public/application/components/field_data_row/number_content_preview.tsx index dc164b5bf3453..c02976cdb3853 100644 --- a/x-pack/plugins/ml/public/application/datavisualizer/file_based/components/field_data_row/number_content_preview.tsx +++ b/x-pack/plugins/file_data_visualizer/public/application/components/field_data_row/number_content_preview.tsx @@ -8,7 +8,7 @@ import React from 'react'; import { FormattedMessage } from '@kbn/i18n/react'; import { EuiFlexGroup, EuiFlexItem } from '@elastic/eui'; -import { FileBasedFieldVisConfig } from '../../../stats_table/types'; +import { FileBasedFieldVisConfig } from '../stats_table/types'; export const FileBasedNumberContentPreview = ({ config }: { config: FileBasedFieldVisConfig }) => { const stats = config.stats; @@ -25,7 +25,7 @@ export const FileBasedNumberContentPreview = ({ config }: { config: FileBasedFie @@ -33,7 +33,7 @@ export const FileBasedNumberContentPreview = ({ config }: { config: FileBasedFie @@ -41,7 +41,7 @@ export const FileBasedNumberContentPreview = ({ config }: { config: FileBasedFie diff --git a/x-pack/plugins/ml/public/application/datavisualizer/file_based/components/field_names_filter/field_names_filter.tsx b/x-pack/plugins/file_data_visualizer/public/application/components/field_names_filter/field_names_filter.tsx similarity index 84% rename from x-pack/plugins/ml/public/application/datavisualizer/file_based/components/field_names_filter/field_names_filter.tsx rename to x-pack/plugins/file_data_visualizer/public/application/components/field_names_filter/field_names_filter.tsx index 9bd16ff5dbefa..466722adc7179 100644 --- a/x-pack/plugins/ml/public/application/datavisualizer/file_based/components/field_names_filter/field_names_filter.tsx +++ b/x-pack/plugins/file_data_visualizer/public/application/components/field_names_filter/field_names_filter.tsx @@ -7,11 +7,11 @@ import React, { FC, useMemo } from 'react'; import { i18n } from '@kbn/i18n'; -import { MultiSelectPicker } from '../../../../components/multi_select_picker'; +import { MultiSelectPicker } from '../multi_select_picker'; import type { FileBasedFieldVisConfig, FileBasedUnknownFieldVisConfig, -} from '../../../stats_table/types/field_vis_config'; +} from '../stats_table/types/field_vis_config'; interface Props { fields: Array; @@ -26,7 +26,7 @@ export const DataVisualizerFieldNamesFilter: FC = ({ }) => { const fieldNameTitle = useMemo( () => - i18n.translate('xpack.ml.dataVisualizer.fileBased.fieldNameSelect', { + i18n.translate('xpack.fileDataVisualizer.fieldNameSelect', { defaultMessage: 'Field name', }), [] diff --git a/x-pack/plugins/ml/public/application/datavisualizer/file_based/components/field_names_filter/index.ts b/x-pack/plugins/file_data_visualizer/public/application/components/field_names_filter/index.ts similarity index 100% rename from x-pack/plugins/ml/public/application/datavisualizer/file_based/components/field_names_filter/index.ts rename to x-pack/plugins/file_data_visualizer/public/application/components/field_names_filter/index.ts diff --git a/x-pack/plugins/file_data_visualizer/public/application/components/field_type_icon/__snapshots__/field_type_icon.test.tsx.snap b/x-pack/plugins/file_data_visualizer/public/application/components/field_type_icon/__snapshots__/field_type_icon.test.tsx.snap new file mode 100644 index 0000000000000..769ebdeba9955 --- /dev/null +++ b/x-pack/plugins/file_data_visualizer/public/application/components/field_type_icon/__snapshots__/field_type_icon.test.tsx.snap @@ -0,0 +1,16 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`FieldTypeIcon render component when type matches a field type 1`] = ` + + + +`; diff --git a/x-pack/plugins/file_data_visualizer/public/application/components/field_type_icon/field_type_icon.test.tsx b/x-pack/plugins/file_data_visualizer/public/application/components/field_type_icon/field_type_icon.test.tsx new file mode 100644 index 0000000000000..d1321ad8f9f4d --- /dev/null +++ b/x-pack/plugins/file_data_visualizer/public/application/components/field_type_icon/field_type_icon.test.tsx @@ -0,0 +1,52 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import React from 'react'; +import { mount, shallow } from 'enzyme'; + +import { FieldTypeIcon } from './field_type_icon'; +import { JOB_FIELD_TYPES } from '../../../../common'; + +describe('FieldTypeIcon', () => { + test(`render component when type matches a field type`, () => { + const typeIconComponent = shallow( + + ); + expect(typeIconComponent).toMatchSnapshot(); + }); + + test(`render with tooltip and test hovering`, () => { + // Use fake timers so we don't have to wait for the EuiToolTip timeout + jest.useFakeTimers(); + + const typeIconComponent = mount( + + ); + const container = typeIconComponent.find({ 'data-test-subj': 'fieldTypeIcon' }); + + expect(typeIconComponent.find('EuiToolTip').children()).toHaveLength(1); + + container.simulate('mouseover'); + + // Run the timers so the EuiTooltip will be visible + jest.runAllTimers(); + + typeIconComponent.update(); + expect(typeIconComponent.find('EuiToolTip').children()).toHaveLength(2); + + container.simulate('mouseout'); + + // Run the timers so the EuiTooltip will be hidden again + jest.runAllTimers(); + + typeIconComponent.update(); + expect(typeIconComponent.find('EuiToolTip').children()).toHaveLength(1); + + // Clearing all mocks will also reset fake timers. + jest.clearAllMocks(); + }); +}); diff --git a/x-pack/plugins/file_data_visualizer/public/application/components/field_type_icon/field_type_icon.tsx b/x-pack/plugins/file_data_visualizer/public/application/components/field_type_icon/field_type_icon.tsx new file mode 100644 index 0000000000000..2dd7ff635bacd --- /dev/null +++ b/x-pack/plugins/file_data_visualizer/public/application/components/field_type_icon/field_type_icon.tsx @@ -0,0 +1,130 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import React, { FC } from 'react'; + +import { EuiToken, EuiToolTip } from '@elastic/eui'; + +import { i18n } from '@kbn/i18n'; + +import { getJobTypeAriaLabel } from '../../util/field_types_utils'; +import { JOB_FIELD_TYPES } from '../../../../common'; +import type { JobFieldType } from '../../../../common'; + +interface FieldTypeIconProps { + tooltipEnabled: boolean; + type: JobFieldType; + fieldName?: string; + needsAria: boolean; +} + +interface FieldTypeIconContainerProps { + ariaLabel: string | null; + iconType: string; + color: string; + needsAria: boolean; + [key: string]: any; +} + +export const FieldTypeIcon: FC = ({ + tooltipEnabled = false, + type, + fieldName, + needsAria = true, +}) => { + const ariaLabel = getJobTypeAriaLabel(type); + + let iconType = 'questionInCircle'; + let color = 'euiColorVis6'; + + switch (type) { + // Set icon types and colors + case JOB_FIELD_TYPES.BOOLEAN: + iconType = 'tokenBoolean'; + color = 'euiColorVis5'; + break; + case JOB_FIELD_TYPES.DATE: + iconType = 'tokenDate'; + color = 'euiColorVis7'; + break; + case JOB_FIELD_TYPES.GEO_POINT: + case JOB_FIELD_TYPES.GEO_SHAPE: + iconType = 'tokenGeo'; + color = 'euiColorVis8'; + break; + case JOB_FIELD_TYPES.TEXT: + iconType = 'document'; + color = 'euiColorVis9'; + break; + case JOB_FIELD_TYPES.IP: + iconType = 'tokenIP'; + color = 'euiColorVis3'; + break; + case JOB_FIELD_TYPES.KEYWORD: + iconType = 'tokenText'; + color = 'euiColorVis0'; + break; + case JOB_FIELD_TYPES.NUMBER: + iconType = 'tokenNumber'; + color = fieldName !== undefined ? 'euiColorVis1' : 'euiColorVis2'; + break; + case JOB_FIELD_TYPES.UNKNOWN: + // Use defaults + break; + } + + const containerProps = { + ariaLabel, + iconType, + color, + needsAria, + }; + + if (tooltipEnabled === true) { + // wrap the inner component inside because EuiToolTip doesn't seem + // to support having another component directly inside the tooltip anchor + // see https://github.com/elastic/eui/issues/839 + return ( + + + + ); + } + + return ; +}; + +// If the tooltip is used, it will apply its events to its first inner child. +// To pass on its properties we apply `rest` to the outer `span` element. +const FieldTypeIconContainer: FC = ({ + ariaLabel, + iconType, + color, + needsAria, + ...rest +}) => { + const wrapperProps: { className: string; 'aria-label'?: string } = { + className: 'field-type-icon', + }; + if (needsAria && ariaLabel) { + wrapperProps['aria-label'] = ariaLabel; + } + + return ( + + + + + + ); +}; diff --git a/x-pack/plugins/file_data_visualizer/public/application/components/field_type_icon/index.ts b/x-pack/plugins/file_data_visualizer/public/application/components/field_type_icon/index.ts new file mode 100644 index 0000000000000..fa825e447be30 --- /dev/null +++ b/x-pack/plugins/file_data_visualizer/public/application/components/field_type_icon/index.ts @@ -0,0 +1,8 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +export { FieldTypeIcon } from './field_type_icon'; diff --git a/x-pack/plugins/ml/public/application/datavisualizer/file_based/components/field_types_filter/field_types_filter.tsx b/x-pack/plugins/file_data_visualizer/public/application/components/field_types_filter/field_types_filter.tsx similarity index 65% rename from x-pack/plugins/ml/public/application/datavisualizer/file_based/components/field_types_filter/field_types_filter.tsx rename to x-pack/plugins/file_data_visualizer/public/application/components/field_types_filter/field_types_filter.tsx index 6ad6cfc84061d..8c5602bc625f8 100644 --- a/x-pack/plugins/ml/public/application/datavisualizer/file_based/components/field_types_filter/field_types_filter.tsx +++ b/x-pack/plugins/file_data_visualizer/public/application/components/field_types_filter/field_types_filter.tsx @@ -8,13 +8,25 @@ import React, { FC, useMemo } from 'react'; import { i18n } from '@kbn/i18n'; import { EuiFlexGroup, EuiFlexItem } from '@elastic/eui'; -import { MultiSelectPicker, Option } from '../../../../components/multi_select_picker'; +import { MultiSelectPicker, Option } from '../multi_select_picker'; import type { FileBasedFieldVisConfig, FileBasedUnknownFieldVisConfig, -} from '../../../stats_table/types/field_vis_config'; -import { FieldTypeIcon } from '../../../../components/field_type_icon'; -import { ML_JOB_FIELD_TYPES_OPTIONS } from '../../../index_based/components/search_panel/field_type_filter'; +} from '../stats_table/types/field_vis_config'; +import { FieldTypeIcon } from '../field_type_icon'; +import { JOB_FIELD_TYPES } from '../../../../common'; + +const JOB_FIELD_TYPES_OPTIONS = { + [JOB_FIELD_TYPES.BOOLEAN]: { name: 'Boolean', icon: 'tokenBoolean' }, + [JOB_FIELD_TYPES.DATE]: { name: 'Date', icon: 'tokenDate' }, + [JOB_FIELD_TYPES.GEO_POINT]: { name: 'Geo point', icon: 'tokenGeo' }, + [JOB_FIELD_TYPES.GEO_SHAPE]: { name: 'Geo shape', icon: 'tokenGeo' }, + [JOB_FIELD_TYPES.IP]: { name: 'IP address', icon: 'tokenIP' }, + [JOB_FIELD_TYPES.KEYWORD]: { name: 'Keyword', icon: 'tokenKeyword' }, + [JOB_FIELD_TYPES.NUMBER]: { name: 'Number', icon: 'tokenNumber' }, + [JOB_FIELD_TYPES.TEXT]: { name: 'Text', icon: 'tokenString' }, + [JOB_FIELD_TYPES.UNKNOWN]: { name: 'Unknown' }, +}; interface Props { fields: Array; @@ -29,7 +41,7 @@ export const DataVisualizerFieldTypesFilter: FC = ({ }) => { const fieldNameTitle = useMemo( () => - i18n.translate('xpack.ml.dataVisualizer.fileBased.fieldTypeSelect', { + i18n.translate('xpack.fileDataVisualizer.fieldTypeSelect', { defaultMessage: 'Field type', }), [] @@ -42,9 +54,9 @@ export const DataVisualizerFieldTypesFilter: FC = ({ if ( type !== undefined && !fieldTypesTracker.has(type) && - ML_JOB_FIELD_TYPES_OPTIONS[type] !== undefined + JOB_FIELD_TYPES_OPTIONS[type] !== undefined ) { - const item = ML_JOB_FIELD_TYPES_OPTIONS[type]; + const item = JOB_FIELD_TYPES_OPTIONS[type]; fieldTypesTracker.add(type); fieldTypes.push({ diff --git a/x-pack/plugins/ml/public/application/datavisualizer/file_based/components/field_types_filter/index.ts b/x-pack/plugins/file_data_visualizer/public/application/components/field_types_filter/index.ts similarity index 100% rename from x-pack/plugins/ml/public/application/datavisualizer/file_based/components/field_types_filter/index.ts rename to x-pack/plugins/file_data_visualizer/public/application/components/field_types_filter/index.ts diff --git a/x-pack/plugins/ml/public/application/datavisualizer/file_based/components/fields_stats_grid/create_fields.ts b/x-pack/plugins/file_data_visualizer/public/application/components/fields_stats_grid/create_fields.ts similarity index 80% rename from x-pack/plugins/ml/public/application/datavisualizer/file_based/components/fields_stats_grid/create_fields.ts rename to x-pack/plugins/file_data_visualizer/public/application/components/fields_stats_grid/create_fields.ts index fdbb35d27c531..f45071d6e96b5 100644 --- a/x-pack/plugins/ml/public/application/datavisualizer/file_based/components/fields_stats_grid/create_fields.ts +++ b/x-pack/plugins/file_data_visualizer/public/application/components/fields_stats_grid/create_fields.ts @@ -5,11 +5,11 @@ * 2.0. */ -import { FindFileStructureResponse } from '../../../../../../../file_upload/common'; +import { FindFileStructureResponse } from '../../../../../file_upload/common'; import { getFieldNames, getSupportedFieldType } from './get_field_names'; -import { FileBasedFieldVisConfig } from '../../../stats_table/types'; -import { ML_JOB_FIELD_TYPES } from '../../../../../../common/constants/field_types'; -import { roundToDecimalPlace } from '../../../../formatters/round_to_decimal_place'; +import { FileBasedFieldVisConfig } from '../stats_table/types'; +import { JOB_FIELD_TYPES } from '../../../../common'; +import { roundToDecimalPlace } from '../utils'; export function createFields(results: FindFileStructureResponse) { const { @@ -28,20 +28,20 @@ export function createFields(results: FindFileStructureResponse) { if (fieldStats[name] !== undefined) { const field: FileBasedFieldVisConfig = { fieldName: name, - type: ML_JOB_FIELD_TYPES.UNKNOWN, + type: JOB_FIELD_TYPES.UNKNOWN, }; const f = fieldStats[name]; const m = mappings.properties[name]; // sometimes the timestamp field is not in the mappings, and so our // collection of fields will be missing a time field with a type of date - if (name === timestampField && field.type === ML_JOB_FIELD_TYPES.UNKNOWN) { - field.type = ML_JOB_FIELD_TYPES.DATE; + if (name === timestampField && field.type === JOB_FIELD_TYPES.UNKNOWN) { + field.type = JOB_FIELD_TYPES.DATE; } if (m !== undefined) { field.type = getSupportedFieldType(m.type); - if (field.type === ML_JOB_FIELD_TYPES.NUMBER) { + if (field.type === JOB_FIELD_TYPES.NUMBER) { numericFieldsCount += 1; } if (m.format !== undefined) { @@ -71,7 +71,7 @@ export function createFields(results: FindFileStructureResponse) { } if (f.top_hits !== undefined) { - if (field.type === ML_JOB_FIELD_TYPES.TEXT) { + if (field.type === JOB_FIELD_TYPES.TEXT) { _stats = { ..._stats, examples: f.top_hits.map((hit) => hit.value), @@ -84,7 +84,7 @@ export function createFields(results: FindFileStructureResponse) { } } - if (field.type === ML_JOB_FIELD_TYPES.DATE) { + if (field.type === JOB_FIELD_TYPES.DATE) { _stats = { ..._stats, earliest: f.earliest, @@ -99,9 +99,9 @@ export function createFields(results: FindFileStructureResponse) { // this could be the message field for a semi-structured log file or a // field which the endpoint has not been able to work out any information for const type = - mappings.properties[name] && mappings.properties[name].type === ML_JOB_FIELD_TYPES.TEXT - ? ML_JOB_FIELD_TYPES.TEXT - : ML_JOB_FIELD_TYPES.UNKNOWN; + mappings.properties[name] && mappings.properties[name].type === JOB_FIELD_TYPES.TEXT + ? JOB_FIELD_TYPES.TEXT + : JOB_FIELD_TYPES.UNKNOWN; return { fieldName: name, diff --git a/x-pack/plugins/ml/public/application/datavisualizer/file_based/components/fields_stats_grid/fields_stats_grid.tsx b/x-pack/plugins/file_data_visualizer/public/application/components/fields_stats_grid/fields_stats_grid.tsx similarity index 79% rename from x-pack/plugins/ml/public/application/datavisualizer/file_based/components/fields_stats_grid/fields_stats_grid.tsx rename to x-pack/plugins/file_data_visualizer/public/application/components/fields_stats_grid/fields_stats_grid.tsx index 1029d58b4c639..3b5b1bbf81dba 100644 --- a/x-pack/plugins/ml/public/application/datavisualizer/file_based/components/fields_stats_grid/fields_stats_grid.tsx +++ b/x-pack/plugins/file_data_visualizer/public/application/components/fields_stats_grid/fields_stats_grid.tsx @@ -5,29 +5,25 @@ * 2.0. */ -import React, { useMemo, FC } from 'react'; +import React, { useMemo, FC, useState } from 'react'; import { EuiFlexGroup, EuiSpacer } from '@elastic/eui'; -import type { FindFileStructureResponse } from '../../../../../../../file_upload/common'; -import { DataVisualizerTable, ItemIdToExpandedRowMap } from '../../../stats_table'; -import type { FileBasedFieldVisConfig } from '../../../stats_table/types/field_vis_config'; +import type { FindFileStructureResponse } from '../../../../../file_upload/common'; +import type { DataVisualizerTableState } from '../../../../common'; +import { DataVisualizerTable, ItemIdToExpandedRowMap } from '../stats_table'; +import type { FileBasedFieldVisConfig } from '../stats_table/types/field_vis_config'; import { FileBasedDataVisualizerExpandedRow } from '../expanded_row'; import { DataVisualizerFieldNamesFilter } from '../field_names_filter'; import { DataVisualizerFieldTypesFilter } from '../field_types_filter'; import { createFields } from './create_fields'; import { filterFields } from './filter_fields'; -import { usePageUrlState } from '../../../../util/url_state'; -import { ML_PAGES } from '../../../../../../common/constants/ml_url_generator'; -import { - MetricFieldsCount, - TotalFieldsCount, -} from '../../../stats_table/components/field_count_stats'; -import type { DataVisualizerFileBasedAppState } from '../../../../../../common/types/ml_url_generator'; +import { MetricFieldsCount, TotalFieldsCount } from '../stats_table/components/field_count_stats'; interface Props { results: FindFileStructureResponse; } -export const getDefaultDataVisualizerListState = (): Required => ({ + +export const getDefaultDataVisualizerListState = (): DataVisualizerTableState => ({ pageIndex: 0, pageSize: 10, sortField: 'fieldName', @@ -52,13 +48,11 @@ function getItemIdToExpandedRowMap( export const FieldsStatsGrid: FC = ({ results }) => { const restorableDefaults = getDefaultDataVisualizerListState(); - const [ - dataVisualizerListState, - setDataVisualizerListState, - ] = usePageUrlState( - ML_PAGES.DATA_VISUALIZER_FILE, + + const [dataVisualizerListState, setDataVisualizerListState] = useState( restorableDefaults ); + const visibleFieldTypes = dataVisualizerListState.visibleFieldTypes ?? restorableDefaults.visibleFieldTypes; const setVisibleFieldTypes = (values: string[]) => { @@ -73,11 +67,11 @@ export const FieldsStatsGrid: FC = ({ results }) => { const { fields, totalFieldsCount, totalMetricFieldsCount } = useMemo( () => createFields(results), - [results, visibleFieldNames, visibleFieldTypes] + [results] ); const { filteredFields, visibleFieldsCount, visibleMetricsCount } = useMemo( () => filterFields(fields, visibleFieldNames, visibleFieldTypes), - [results, visibleFieldNames, visibleFieldTypes] + [fields, visibleFieldNames, visibleFieldTypes] ); const fieldsCountStats = { visibleFieldsCount, totalFieldsCount }; diff --git a/x-pack/plugins/ml/public/application/datavisualizer/file_based/components/fields_stats_grid/filter_fields.ts b/x-pack/plugins/file_data_visualizer/public/application/components/fields_stats_grid/filter_fields.ts similarity index 81% rename from x-pack/plugins/ml/public/application/datavisualizer/file_based/components/fields_stats_grid/filter_fields.ts rename to x-pack/plugins/file_data_visualizer/public/application/components/fields_stats_grid/filter_fields.ts index 2c43d11c3d447..0120b17452558 100644 --- a/x-pack/plugins/ml/public/application/datavisualizer/file_based/components/fields_stats_grid/filter_fields.ts +++ b/x-pack/plugins/file_data_visualizer/public/application/components/fields_stats_grid/filter_fields.ts @@ -5,11 +5,11 @@ * 2.0. */ -import { ML_JOB_FIELD_TYPES } from '../../../../../../common/constants/field_types'; +import { JOB_FIELD_TYPES } from '../../../../common'; import type { FileBasedFieldVisConfig, FileBasedUnknownFieldVisConfig, -} from '../../../stats_table/types/field_vis_config'; +} from '../stats_table/types/field_vis_config'; export function filterFields( fields: Array, @@ -32,6 +32,6 @@ export function filterFields( return { filteredFields: items, visibleFieldsCount: items.length, - visibleMetricsCount: items.filter((d) => d.type === ML_JOB_FIELD_TYPES.NUMBER).length, + visibleMetricsCount: items.filter((d) => d.type === JOB_FIELD_TYPES.NUMBER).length, }; } diff --git a/x-pack/plugins/ml/public/application/datavisualizer/file_based/components/fields_stats_grid/get_field_names.ts b/x-pack/plugins/file_data_visualizer/public/application/components/fields_stats_grid/get_field_names.ts similarity index 75% rename from x-pack/plugins/ml/public/application/datavisualizer/file_based/components/fields_stats_grid/get_field_names.ts rename to x-pack/plugins/file_data_visualizer/public/application/components/fields_stats_grid/get_field_names.ts index d1cb361a84a72..83c517dfe965e 100644 --- a/x-pack/plugins/ml/public/application/datavisualizer/file_based/components/fields_stats_grid/get_field_names.ts +++ b/x-pack/plugins/file_data_visualizer/public/application/components/fields_stats_grid/get_field_names.ts @@ -6,10 +6,10 @@ */ import { difference } from 'lodash'; -import type { FindFileStructureResponse } from '../../../../../../../file_upload/common'; -import { MlJobFieldType } from '../../../../../../common/types/field_types'; -import { ML_JOB_FIELD_TYPES } from '../../../../../../common/constants/field_types'; -import { ES_FIELD_TYPES } from '../../../../../../../../../src/plugins/data/common'; +import { ES_FIELD_TYPES } from '../../../../../../../src/plugins/data/common'; +import type { FindFileStructureResponse } from '../../../../../file_upload/common'; +import type { JobFieldType } from '../../../../common'; +import { JOB_FIELD_TYPES } from '../../../../common'; export function getFieldNames(results: FindFileStructureResponse) { const { mappings, field_stats: fieldStats, column_names: columnNames } = results; @@ -34,7 +34,7 @@ export function getFieldNames(results: FindFileStructureResponse) { return tempFields; } -export function getSupportedFieldType(type: string): MlJobFieldType { +export function getSupportedFieldType(type: string): JobFieldType { switch (type) { case ES_FIELD_TYPES.FLOAT: case ES_FIELD_TYPES.HALF_FLOAT: @@ -44,13 +44,13 @@ export function getSupportedFieldType(type: string): MlJobFieldType { case ES_FIELD_TYPES.LONG: case ES_FIELD_TYPES.SHORT: case ES_FIELD_TYPES.UNSIGNED_LONG: - return ML_JOB_FIELD_TYPES.NUMBER; + return JOB_FIELD_TYPES.NUMBER; case ES_FIELD_TYPES.DATE: case ES_FIELD_TYPES.DATE_NANOS: - return ML_JOB_FIELD_TYPES.DATE; + return JOB_FIELD_TYPES.DATE; default: - return type as MlJobFieldType; + return type as JobFieldType; } } diff --git a/x-pack/plugins/ml/public/application/datavisualizer/file_based/components/fields_stats_grid/index.ts b/x-pack/plugins/file_data_visualizer/public/application/components/fields_stats_grid/index.ts similarity index 100% rename from x-pack/plugins/ml/public/application/datavisualizer/file_based/components/fields_stats_grid/index.ts rename to x-pack/plugins/file_data_visualizer/public/application/components/fields_stats_grid/index.ts diff --git a/x-pack/plugins/ml/public/application/datavisualizer/file_based/components/file_contents/_file_contents.scss b/x-pack/plugins/file_data_visualizer/public/application/components/file_contents/_file_contents.scss similarity index 100% rename from x-pack/plugins/ml/public/application/datavisualizer/file_based/components/file_contents/_file_contents.scss rename to x-pack/plugins/file_data_visualizer/public/application/components/file_contents/_file_contents.scss diff --git a/x-pack/plugins/ml/public/application/datavisualizer/file_based/components/file_contents/_index.scss b/x-pack/plugins/file_data_visualizer/public/application/components/file_contents/_index.scss similarity index 100% rename from x-pack/plugins/ml/public/application/datavisualizer/file_based/components/file_contents/_index.scss rename to x-pack/plugins/file_data_visualizer/public/application/components/file_contents/_index.scss diff --git a/x-pack/plugins/ml/public/application/datavisualizer/file_based/components/file_contents/file_contents.tsx b/x-pack/plugins/file_data_visualizer/public/application/components/file_contents/file_contents.tsx similarity index 78% rename from x-pack/plugins/ml/public/application/datavisualizer/file_based/components/file_contents/file_contents.tsx rename to x-pack/plugins/file_data_visualizer/public/application/components/file_contents/file_contents.tsx index 3de8e5851183d..fa54cf9cbc05c 100644 --- a/x-pack/plugins/ml/public/application/datavisualizer/file_based/components/file_contents/file_contents.tsx +++ b/x-pack/plugins/file_data_visualizer/public/application/components/file_contents/file_contents.tsx @@ -10,7 +10,7 @@ import React, { FC } from 'react'; import { EuiTitle, EuiSpacer } from '@elastic/eui'; -import { MLJobEditor, ML_EDITOR_MODE } from '../../../../jobs/jobs_list/components/ml_job_editor'; +import { JsonEditor, EDITOR_MODE } from '../json_editor'; interface Props { data: string; @@ -19,9 +19,9 @@ interface Props { } export const FileContents: FC = ({ data, format, numberOfLines }) => { - let mode = ML_EDITOR_MODE.TEXT; - if (format === ML_EDITOR_MODE.JSON) { - mode = ML_EDITOR_MODE.JSON; + let mode = EDITOR_MODE.TEXT; + if (format === EDITOR_MODE.JSON) { + mode = EDITOR_MODE.JSON; } const formattedData = limitByNumberOfLines(data, numberOfLines); @@ -31,7 +31,7 @@ export const FileContents: FC = ({ data, format, numberOfLines }) => {

@@ -39,7 +39,7 @@ export const FileContents: FC = ({ data, format, numberOfLines }) => {
= ({ data, format, numberOfLines }) => { - ), @@ -345,9 +345,10 @@ export class FileDataVisualizerView extends Component { fileContents={fileContents} data={data} indexPatterns={this.props.indexPatterns} - kibanaConfig={this.props.kibanaConfig} showBottomBar={this.showBottomBar} hideBottomBar={this.hideBottomBar} + savedObjectsClient={this.savedObjectsClient} + fileUpload={this.props.fileUpload} /> {bottomBarVisible && ( diff --git a/x-pack/plugins/ml/public/application/datavisualizer/file_based/components/file_datavisualizer_view/file_error_callouts.tsx b/x-pack/plugins/file_data_visualizer/public/application/components/file_datavisualizer_view/file_error_callouts.tsx similarity index 79% rename from x-pack/plugins/ml/public/application/datavisualizer/file_based/components/file_datavisualizer_view/file_error_callouts.tsx rename to x-pack/plugins/file_data_visualizer/public/application/components/file_datavisualizer_view/file_error_callouts.tsx index 0fa7de4732c39..b932dee35ebb8 100644 --- a/x-pack/plugins/ml/public/application/datavisualizer/file_based/components/file_datavisualizer_view/file_error_callouts.tsx +++ b/x-pack/plugins/file_data_visualizer/public/application/components/file_datavisualizer_view/file_error_callouts.tsx @@ -11,8 +11,8 @@ import React, { FC } from 'react'; import { EuiCallOut, EuiSpacer, EuiButtonEmpty, EuiHorizontalRule } from '@elastic/eui'; import numeral from '@elastic/numeral'; -import { ErrorResponse } from '../../../../../../common/types/errors'; -import { FILE_SIZE_DISPLAY_FORMAT } from '../../../../../../../file_upload/public'; +import { FILE_SIZE_DISPLAY_FORMAT } from '../../../../common'; +import { FindFileStructureErrorResponse } from '../../../../../file_upload/common'; interface FileTooLargeProps { fileSize: number; @@ -31,7 +31,7 @@ export const FileTooLarge: FC = ({ fileSize, maxFileSize }) = errorText = (

= ({ fileSize, maxFileSize }) = errorText = (

= ({ fileSize, maxFileSize }) = } @@ -76,7 +76,7 @@ export const FileTooLarge: FC = ({ fileSize, maxFileSize }) = }; interface FileCouldNotBeReadProps { - error: ErrorResponse; + error: FindFileStructureErrorResponse; loaded: boolean; showEditFlyout(): void; } @@ -92,7 +92,7 @@ export const FileCouldNotBeRead: FC = ({ } @@ -103,13 +103,13 @@ export const FileCouldNotBeRead: FC = ({ {loaded === false && ( <>
@@ -122,7 +122,7 @@ export const FileCouldNotBeRead: FC = ({ <> @@ -132,11 +132,11 @@ export const FileCouldNotBeRead: FC = ({ ); }; -export const Explanation: FC<{ error: ErrorResponse }> = ({ error }) => { +export const Explanation: FC<{ error: FindFileStructureErrorResponse }> = ({ error }) => { if (!error?.body?.attributes?.body?.error?.suppressed?.length) { return null; } - const reason: string = error.body.attributes.body.error.suppressed[0].reason; + const reason = error.body.attributes.body.error.suppressed[0].reason; return ( <> diff --git a/x-pack/plugins/ml/public/application/datavisualizer/file_based/components/file_datavisualizer_view/index.js b/x-pack/plugins/file_data_visualizer/public/application/components/file_datavisualizer_view/index.js similarity index 100% rename from x-pack/plugins/ml/public/application/datavisualizer/file_based/components/file_datavisualizer_view/index.js rename to x-pack/plugins/file_data_visualizer/public/application/components/file_datavisualizer_view/index.js diff --git a/x-pack/plugins/ml/public/application/datavisualizer/file_based/components/filebeat_config_flyout/filebeat_config.ts b/x-pack/plugins/file_data_visualizer/public/application/components/filebeat_config_flyout/filebeat_config.ts similarity index 91% rename from x-pack/plugins/ml/public/application/datavisualizer/file_based/components/filebeat_config_flyout/filebeat_config.ts rename to x-pack/plugins/file_data_visualizer/public/application/components/filebeat_config_flyout/filebeat_config.ts index 2254110432bdb..1cbb177c86442 100644 --- a/x-pack/plugins/ml/public/application/datavisualizer/file_based/components/filebeat_config_flyout/filebeat_config.ts +++ b/x-pack/plugins/file_data_visualizer/public/application/components/filebeat_config_flyout/filebeat_config.ts @@ -6,7 +6,7 @@ */ import { i18n } from '@kbn/i18n'; -import { FindFileStructureResponse } from '../../../../../../../file_upload/common'; +import { FindFileStructureResponse } from '../../../../../file_upload/common'; export function createFilebeatConfig( index: string, @@ -36,7 +36,7 @@ export function createFilebeatConfig( } function getPaths() { - const txt = i18n.translate('xpack.ml.fileDatavisualizer.fileBeatConfig.paths', { + const txt = i18n.translate('xpack.fileDataVisualizer.fileBeatConfig.paths', { defaultMessage: 'add path to your files here', }); return [' paths:', ` - '<${txt}>'`]; diff --git a/x-pack/plugins/ml/public/application/datavisualizer/file_based/components/filebeat_config_flyout/filebeat_config_flyout.tsx b/x-pack/plugins/file_data_visualizer/public/application/components/filebeat_config_flyout/filebeat_config_flyout.tsx similarity index 83% rename from x-pack/plugins/ml/public/application/datavisualizer/file_based/components/filebeat_config_flyout/filebeat_config_flyout.tsx rename to x-pack/plugins/file_data_visualizer/public/application/components/filebeat_config_flyout/filebeat_config_flyout.tsx index c3b53d4430087..a5d05bb06f78e 100644 --- a/x-pack/plugins/ml/public/application/datavisualizer/file_based/components/filebeat_config_flyout/filebeat_config_flyout.tsx +++ b/x-pack/plugins/file_data_visualizer/public/application/components/filebeat_config_flyout/filebeat_config_flyout.tsx @@ -22,8 +22,8 @@ import { EuiCopy, } from '@elastic/eui'; import { createFilebeatConfig } from './filebeat_config'; -import { useMlKibana } from '../../../../contexts/kibana'; -import { FindFileStructureResponse } from '../../../../../../../file_upload/common'; +import { useFileDataVisualizerKibana } from '../../kibana_context'; // copy context? +import { FindFileStructureResponse } from '../../../../../file_upload/common'; export enum EDITOR_MODE { HIDDEN, @@ -48,7 +48,7 @@ export const FilebeatConfigFlyout: FC = ({ const [username, setUsername] = useState(null); const { services: { security }, - } = useMlKibana(); + } = useFileDataVisualizerKibana(); useEffect(() => { if (security !== undefined) { @@ -56,12 +56,12 @@ export const FilebeatConfigFlyout: FC = ({ setUsername(user.username === undefined ? null : user.username); }); } - }, []); + }, [security]); useEffect(() => { const config = createFilebeatConfig(index, results, ingestPipelineId, username); setFileBeatConfig(config); - }, [username]); + }, [username, index, ingestPipelineId, results]); return ( @@ -75,7 +75,7 @@ export const FilebeatConfigFlyout: FC = ({ @@ -85,7 +85,7 @@ export const FilebeatConfigFlyout: FC = ({ {(copy) => ( @@ -108,7 +108,7 @@ const Contents: FC<{

@@ -116,14 +116,14 @@ const Contents: FC<{

{index} }} />

filebeat.yml }} /> @@ -137,7 +137,7 @@ const Contents: FC<{

{username === null ? ( {''}, @@ -145,7 +145,7 @@ const Contents: FC<{ /> ) : ( {username}, diff --git a/x-pack/plugins/ml/public/application/datavisualizer/file_based/components/filebeat_config_flyout/index.ts b/x-pack/plugins/file_data_visualizer/public/application/components/filebeat_config_flyout/index.ts similarity index 100% rename from x-pack/plugins/ml/public/application/datavisualizer/file_based/components/filebeat_config_flyout/index.ts rename to x-pack/plugins/file_data_visualizer/public/application/components/filebeat_config_flyout/index.ts diff --git a/x-pack/plugins/ml/public/application/datavisualizer/file_based/components/import_errors/errors.tsx b/x-pack/plugins/file_data_visualizer/public/application/components/import_errors/errors.tsx similarity index 81% rename from x-pack/plugins/ml/public/application/datavisualizer/file_based/components/import_errors/errors.tsx rename to x-pack/plugins/file_data_visualizer/public/application/components/import_errors/errors.tsx index 37e90b5f5753b..5a6f78a1a3068 100644 --- a/x-pack/plugins/ml/public/application/datavisualizer/file_based/components/import_errors/errors.tsx +++ b/x-pack/plugins/file_data_visualizer/public/application/components/import_errors/errors.tsx @@ -38,56 +38,56 @@ function title(statuses: Statuses) { case statuses.readStatus: return ( ); case statuses.parseJSONStatus: return ( ); case statuses.indexCreatedStatus: return ( ); case statuses.ingestPipelineCreatedStatus: return ( ); case statuses.uploadStatus: return ( ); case statuses.indexPatternCreatedStatus: return ( ); case statuses.permissionCheckStatus: return ( ); default: return ( ); @@ -105,7 +105,7 @@ const ImportError: FC<{ error: any }> = ({ error }) => { id="more" buttonContent={ } @@ -151,7 +151,7 @@ function toString(error: any): ImportError { } return { - msg: i18n.translate('xpack.ml.fileDatavisualizer.importErrors.unknownErrorMessage', { + msg: i18n.translate('xpack.fileDataVisualizer.importErrors.unknownErrorMessage', { defaultMessage: 'Unknown error', }), }; diff --git a/x-pack/plugins/ml/public/application/datavisualizer/file_based/components/import_errors/index.ts b/x-pack/plugins/file_data_visualizer/public/application/components/import_errors/index.ts similarity index 100% rename from x-pack/plugins/ml/public/application/datavisualizer/file_based/components/import_errors/index.ts rename to x-pack/plugins/file_data_visualizer/public/application/components/import_errors/index.ts diff --git a/x-pack/plugins/ml/public/application/datavisualizer/file_based/components/import_progress/import_progress.tsx b/x-pack/plugins/file_data_visualizer/public/application/components/import_progress/import_progress.tsx similarity index 81% rename from x-pack/plugins/ml/public/application/datavisualizer/file_based/components/import_progress/import_progress.tsx rename to x-pack/plugins/file_data_visualizer/public/application/components/import_progress/import_progress.tsx index 40577a761cb03..8296a4885bf2c 100644 --- a/x-pack/plugins/ml/public/application/datavisualizer/file_based/components/import_progress/import_progress.tsx +++ b/x-pack/plugins/file_data_visualizer/public/application/components/import_progress/import_progress.tsx @@ -80,31 +80,31 @@ export const ImportProgress: FC<{ statuses: Statuses }> = ({ statuses }) => { } let processFileTitle = i18n.translate( - 'xpack.ml.fileDatavisualizer.importProgress.processFileTitle', + 'xpack.fileDataVisualizer.importProgress.processFileTitle', { defaultMessage: 'Process file', } ); let createIndexTitle = i18n.translate( - 'xpack.ml.fileDatavisualizer.importProgress.createIndexTitle', + 'xpack.fileDataVisualizer.importProgress.createIndexTitle', { defaultMessage: 'Create index', } ); let createIngestPipelineTitle = i18n.translate( - 'xpack.ml.fileDatavisualizer.importProgress.createIngestPipelineTitle', + 'xpack.fileDataVisualizer.importProgress.createIngestPipelineTitle', { defaultMessage: 'Create ingest pipeline', } ); let uploadingDataTitle = i18n.translate( - 'xpack.ml.fileDatavisualizer.importProgress.uploadDataTitle', + 'xpack.fileDataVisualizer.importProgress.uploadDataTitle', { defaultMessage: 'Upload data', } ); let createIndexPatternTitle = i18n.translate( - 'xpack.ml.fileDatavisualizer.importProgress.createIndexPatternTitle', + 'xpack.fileDataVisualizer.importProgress.createIndexPatternTitle', { defaultMessage: 'Create index pattern', } @@ -113,7 +113,7 @@ export const ImportProgress: FC<{ statuses: Statuses }> = ({ statuses }) => { const creatingIndexStatus = (

@@ -122,7 +122,7 @@ export const ImportProgress: FC<{ statuses: Statuses }> = ({ statuses }) => { const creatingIndexAndIngestPipelineStatus = (

@@ -130,7 +130,7 @@ export const ImportProgress: FC<{ statuses: Statuses }> = ({ statuses }) => { if (completedStep >= 0) { processFileTitle = i18n.translate( - 'xpack.ml.fileDatavisualizer.importProgress.processingFileTitle', + 'xpack.fileDataVisualizer.importProgress.processingFileTitle', { defaultMessage: 'Processing file', } @@ -138,7 +138,7 @@ export const ImportProgress: FC<{ statuses: Statuses }> = ({ statuses }) => { statusInfo = (

@@ -146,13 +146,13 @@ export const ImportProgress: FC<{ statuses: Statuses }> = ({ statuses }) => { } if (completedStep >= 1) { processFileTitle = i18n.translate( - 'xpack.ml.fileDatavisualizer.importProgress.fileProcessedTitle', + 'xpack.fileDataVisualizer.importProgress.fileProcessedTitle', { defaultMessage: 'File processed', } ); createIndexTitle = i18n.translate( - 'xpack.ml.fileDatavisualizer.importProgress.creatingIndexTitle', + 'xpack.fileDataVisualizer.importProgress.creatingIndexTitle', { defaultMessage: 'Creating index', } @@ -161,14 +161,11 @@ export const ImportProgress: FC<{ statuses: Statuses }> = ({ statuses }) => { createPipeline === true ? creatingIndexAndIngestPipelineStatus : creatingIndexStatus; } if (completedStep >= 2) { - createIndexTitle = i18n.translate( - 'xpack.ml.fileDatavisualizer.importProgress.indexCreatedTitle', - { - defaultMessage: 'Index created', - } - ); + createIndexTitle = i18n.translate('xpack.fileDataVisualizer.importProgress.indexCreatedTitle', { + defaultMessage: 'Index created', + }); createIngestPipelineTitle = i18n.translate( - 'xpack.ml.fileDatavisualizer.importProgress.creatingIngestPipelineTitle', + 'xpack.fileDataVisualizer.importProgress.creatingIngestPipelineTitle', { defaultMessage: 'Creating ingest pipeline', } @@ -178,13 +175,13 @@ export const ImportProgress: FC<{ statuses: Statuses }> = ({ statuses }) => { } if (completedStep >= 3) { createIngestPipelineTitle = i18n.translate( - 'xpack.ml.fileDatavisualizer.importProgress.ingestPipelineCreatedTitle', + 'xpack.fileDataVisualizer.importProgress.ingestPipelineCreatedTitle', { defaultMessage: 'Ingest pipeline created', } ); uploadingDataTitle = i18n.translate( - 'xpack.ml.fileDatavisualizer.importProgress.uploadingDataTitle', + 'xpack.fileDataVisualizer.importProgress.uploadingDataTitle', { defaultMessage: 'Uploading data', } @@ -193,14 +190,14 @@ export const ImportProgress: FC<{ statuses: Statuses }> = ({ statuses }) => { } if (completedStep >= 4) { uploadingDataTitle = i18n.translate( - 'xpack.ml.fileDatavisualizer.importProgress.dataUploadedTitle', + 'xpack.fileDataVisualizer.importProgress.dataUploadedTitle', { defaultMessage: 'Data uploaded', } ); if (createIndexPattern === true) { createIndexPatternTitle = i18n.translate( - 'xpack.ml.fileDatavisualizer.importProgress.creatingIndexPatternTitle', + 'xpack.fileDataVisualizer.importProgress.creatingIndexPatternTitle', { defaultMessage: 'Creating index pattern', } @@ -208,7 +205,7 @@ export const ImportProgress: FC<{ statuses: Statuses }> = ({ statuses }) => { statusInfo = (

@@ -219,7 +216,7 @@ export const ImportProgress: FC<{ statuses: Statuses }> = ({ statuses }) => { } if (completedStep >= 5) { createIndexPatternTitle = i18n.translate( - 'xpack.ml.fileDatavisualizer.importProgress.indexPatternCreatedTitle', + 'xpack.fileDataVisualizer.importProgress.indexPatternCreatedTitle', { defaultMessage: 'Index pattern created', } @@ -293,7 +290,7 @@ const UploadFunctionProgress: FC<{ progress: number }> = ({ progress }) => {

diff --git a/x-pack/plugins/ml/public/application/datavisualizer/file_based/components/import_progress/index.ts b/x-pack/plugins/file_data_visualizer/public/application/components/import_progress/index.ts similarity index 100% rename from x-pack/plugins/ml/public/application/datavisualizer/file_based/components/import_progress/index.ts rename to x-pack/plugins/file_data_visualizer/public/application/components/import_progress/index.ts diff --git a/x-pack/plugins/ml/public/application/datavisualizer/file_based/components/import_settings/advanced.tsx b/x-pack/plugins/file_data_visualizer/public/application/components/import_settings/advanced.tsx similarity index 83% rename from x-pack/plugins/ml/public/application/datavisualizer/file_based/components/import_settings/advanced.tsx rename to x-pack/plugins/file_data_visualizer/public/application/components/import_settings/advanced.tsx index eb0e09973f0e3..acb6415e93f9b 100644 --- a/x-pack/plugins/ml/public/application/datavisualizer/file_based/components/import_settings/advanced.tsx +++ b/x-pack/plugins/file_data_visualizer/public/application/components/import_settings/advanced.tsx @@ -19,8 +19,8 @@ import { } from '@elastic/eui'; import { CombinedField, CombinedFieldsForm } from '../combined_fields'; -import { MLJobEditor, ML_EDITOR_MODE } from '../../../../jobs/jobs_list/components/ml_job_editor'; -import { FindFileStructureResponse } from '../../../../../../../file_upload/common'; +import { JsonEditor, EDITOR_MODE } from '../json_editor'; +import { FindFileStructureResponse } from '../../../../../file_upload/common'; const EDITOR_HEIGHT = '300px'; interface Props { @@ -35,8 +35,8 @@ interface Props { mappingsString: string; pipelineString: string; onIndexSettingsStringChange(): void; - onMappingsStringChange(): void; - onPipelineStringChange(): void; + onMappingsStringChange(mappings: string): void; + onPipelineStringChange(pipeline: string): void; indexNameError: string; indexPatternNameError: string; combinedFields: CombinedField[]; @@ -69,7 +69,7 @@ export const AdvancedSettings: FC = ({ } @@ -78,7 +78,7 @@ export const AdvancedSettings: FC = ({ > = ({ onChange={onIndexChange} isInvalid={indexNameError !== ''} aria-label={i18n.translate( - 'xpack.ml.fileDatavisualizer.advancedImportSettings.indexNameAriaLabel', + 'xpack.fileDataVisualizer.advancedImportSettings.indexNameAriaLabel', { defaultMessage: 'Index name, required field', } @@ -102,7 +102,7 @@ export const AdvancedSettings: FC = ({ id="createIndexPattern" label={ } @@ -116,7 +116,7 @@ export const AdvancedSettings: FC = ({ } @@ -175,7 +175,7 @@ export const AdvancedSettings: FC = ({ interface JsonEditorProps { initialized: boolean; data: string; - onChange(): void; + onChange(value: string): void; } const IndexSettings: FC = ({ initialized, data, onChange }) => { @@ -184,14 +184,14 @@ const IndexSettings: FC = ({ initialized, data, onChange }) => } fullWidth > - = ({ initialized, data, onChange }) => { } fullWidth > - = ({ initialized, data, onChange }) => } fullWidth > - = ({ const tabs = [ { id: 'simple-settings', - name: i18n.translate('xpack.ml.fileDatavisualizer.importSettings.simpleTabName', { + name: i18n.translate('xpack.fileDataVisualizer.importSettings.simpleTabName', { defaultMessage: 'Simple', }), content: ( @@ -80,7 +80,7 @@ export const ImportSettings: FC = ({ }, { id: 'advanced-settings', - name: i18n.translate('xpack.ml.fileDatavisualizer.importSettings.advancedTabName', { + name: i18n.translate('xpack.fileDataVisualizer.importSettings.advancedTabName', { defaultMessage: 'Advanced', }), content: ( diff --git a/x-pack/plugins/ml/public/application/datavisualizer/file_based/components/import_settings/index.ts b/x-pack/plugins/file_data_visualizer/public/application/components/import_settings/index.ts similarity index 100% rename from x-pack/plugins/ml/public/application/datavisualizer/file_based/components/import_settings/index.ts rename to x-pack/plugins/file_data_visualizer/public/application/components/import_settings/index.ts diff --git a/x-pack/plugins/ml/public/application/datavisualizer/file_based/components/import_settings/simple.tsx b/x-pack/plugins/file_data_visualizer/public/application/components/import_settings/simple.tsx similarity index 86% rename from x-pack/plugins/ml/public/application/datavisualizer/file_based/components/import_settings/simple.tsx rename to x-pack/plugins/file_data_visualizer/public/application/components/import_settings/simple.tsx index daa360f0e1af0..2751b37cd3256 100644 --- a/x-pack/plugins/ml/public/application/datavisualizer/file_based/components/import_settings/simple.tsx +++ b/x-pack/plugins/file_data_visualizer/public/application/components/import_settings/simple.tsx @@ -36,7 +36,7 @@ export const SimpleSettings: FC = ({ } @@ -45,7 +45,7 @@ export const SimpleSettings: FC = ({ > = ({ onChange={onIndexChange} isInvalid={indexNameError !== ''} aria-label={i18n.translate( - 'xpack.ml.fileDatavisualizer.simpleImportSettings.indexNameAriaLabel', + 'xpack.fileDataVisualizer.simpleImportSettings.indexNameAriaLabel', { defaultMessage: 'Index name, required field', } @@ -70,7 +70,7 @@ export const SimpleSettings: FC = ({ id="createIndexPattern" label={ } diff --git a/x-pack/plugins/ml/public/application/datavisualizer/file_based/components/import_summary/_import_sumary.scss b/x-pack/plugins/file_data_visualizer/public/application/components/import_summary/_import_sumary.scss similarity index 100% rename from x-pack/plugins/ml/public/application/datavisualizer/file_based/components/import_summary/_import_sumary.scss rename to x-pack/plugins/file_data_visualizer/public/application/components/import_summary/_import_sumary.scss diff --git a/x-pack/plugins/ml/public/application/datavisualizer/file_based/components/import_summary/_index.scss b/x-pack/plugins/file_data_visualizer/public/application/components/import_summary/_index.scss similarity index 100% rename from x-pack/plugins/ml/public/application/datavisualizer/file_based/components/import_summary/_index.scss rename to x-pack/plugins/file_data_visualizer/public/application/components/import_summary/_index.scss diff --git a/x-pack/plugins/ml/public/application/datavisualizer/file_based/components/import_summary/failures.tsx b/x-pack/plugins/file_data_visualizer/public/application/components/import_summary/failures.tsx similarity index 95% rename from x-pack/plugins/ml/public/application/datavisualizer/file_based/components/import_summary/failures.tsx rename to x-pack/plugins/file_data_visualizer/public/application/components/import_summary/failures.tsx index 498320b1b792d..c8f62021b7bae 100644 --- a/x-pack/plugins/ml/public/application/datavisualizer/file_based/components/import_summary/failures.tsx +++ b/x-pack/plugins/file_data_visualizer/public/application/components/import_summary/failures.tsx @@ -51,7 +51,7 @@ export class Failures extends Component { id="failureList" buttonContent={ } diff --git a/x-pack/plugins/ml/public/application/datavisualizer/file_based/components/import_summary/import_summary.tsx b/x-pack/plugins/file_data_visualizer/public/application/components/import_summary/import_summary.tsx similarity index 84% rename from x-pack/plugins/ml/public/application/datavisualizer/file_based/components/import_summary/import_summary.tsx rename to x-pack/plugins/file_data_visualizer/public/application/components/import_summary/import_summary.tsx index 7fa71193ee516..f981b1fdf9f23 100644 --- a/x-pack/plugins/ml/public/application/datavisualizer/file_based/components/import_summary/import_summary.tsx +++ b/x-pack/plugins/file_data_visualizer/public/application/components/import_summary/import_summary.tsx @@ -45,7 +45,7 @@ export const ImportSummary: FC = ({ } @@ -62,7 +62,7 @@ export const ImportSummary: FC = ({ } @@ -71,7 +71,7 @@ export const ImportSummary: FC = ({ >

), @@ -111,7 +111,7 @@ function createDisplayItems( { title: ( ), @@ -123,7 +123,7 @@ function createDisplayItems( items.splice(1, 0, { title: ( ), @@ -135,7 +135,7 @@ function createDisplayItems( items.splice(1, 0, { title: ( ), @@ -147,7 +147,7 @@ function createDisplayItems( items.push({ title: ( ), diff --git a/x-pack/plugins/ml/public/application/datavisualizer/file_based/components/import_summary/index.ts b/x-pack/plugins/file_data_visualizer/public/application/components/import_summary/index.ts similarity index 100% rename from x-pack/plugins/ml/public/application/datavisualizer/file_based/components/import_summary/index.ts rename to x-pack/plugins/file_data_visualizer/public/application/components/import_summary/index.ts diff --git a/x-pack/plugins/ml/public/application/datavisualizer/file_based/components/import_view/import_view.js b/x-pack/plugins/file_data_visualizer/public/application/components/import_view/import_view.js similarity index 92% rename from x-pack/plugins/ml/public/application/datavisualizer/file_based/components/import_view/import_view.js rename to x-pack/plugins/file_data_visualizer/public/application/components/import_view/import_view.js index 04175f46c9201..0eaba4c033910 100644 --- a/x-pack/plugins/ml/public/application/datavisualizer/file_based/components/import_view/import_view.js +++ b/x-pack/plugins/file_data_visualizer/public/application/components/import_view/import_view.js @@ -20,7 +20,6 @@ import { import { i18n } from '@kbn/i18n'; import { debounce } from 'lodash'; -import { getFileUpload } from '../../../../util/dependency_cache'; import { ResultsLinks } from '../results_links'; import { FilebeatConfigFlyout } from '../filebeat_config_flyout'; import { ImportProgress, IMPORT_STATUS } from '../import_progress'; @@ -33,8 +32,6 @@ import { getDefaultCombinedFields, } from '../combined_fields'; import { ExperimentalBadge } from '../experimental_badge'; -import { getIndexPatternNames, loadIndexPatterns } from '../../../../util/index_utils'; -import { ml } from '../../../../services/ml_api_service'; const DEFAULT_TIME_FIELD = '@timestamp'; const DEFAULT_INDEX_SETTINGS = { number_of_shards: 1 }; @@ -81,6 +78,7 @@ export class ImportView extends Component { super(props); this.state = getDefaultState(DEFAULT_STATE, this.props.results); + this.savedObjectsClient = props.savedObjectsClient; } componentDidMount() { @@ -100,7 +98,7 @@ export class ImportView extends Component { // TODO - sort this function out. it's a mess async import() { - const { data, results, indexPatterns, kibanaConfig, showBottomBar } = this.props; + const { data, results, indexPatterns, showBottomBar, fileUpload } = this.props; const { format } = results; let { timeFieldName } = this.state; @@ -124,14 +122,14 @@ export class ImportView extends Component { async () => { // check to see if the user has permission to create and ingest data into the specified index if ( - (await getFileUpload().hasImportPermission({ + (await fileUpload.hasImportPermission({ checkCreateIndexPattern: createIndexPattern, checkHasManagePipeline: true, indexName: index, })) === false ) { errors.push( - i18n.translate('xpack.ml.fileDatavisualizer.importView.importPermissionError', { + i18n.translate('xpack.fileDataVisualizer.importView.importPermissionError', { defaultMessage: 'You do not have permission to create or import data into index {index}.', values: { @@ -171,7 +169,7 @@ export class ImportView extends Component { } catch (error) { success = false; const parseError = i18n.translate( - 'xpack.ml.fileDatavisualizer.importView.parseSettingsError', + 'xpack.fileDataVisualizer.importView.parseSettingsError', { defaultMessage: 'Error parsing settings:', } @@ -184,7 +182,7 @@ export class ImportView extends Component { } catch (error) { success = false; const parseError = i18n.translate( - 'xpack.ml.fileDatavisualizer.importView.parseMappingsError', + 'xpack.fileDataVisualizer.importView.parseMappingsError', { defaultMessage: 'Error parsing mappings:', } @@ -199,7 +197,7 @@ export class ImportView extends Component { } catch (error) { success = false; const parseError = i18n.translate( - 'xpack.ml.fileDatavisualizer.importView.parsePipelineError', + 'xpack.fileDataVisualizer.importView.parsePipelineError', { defaultMessage: 'Error parsing ingest pipeline:', } @@ -221,7 +219,7 @@ export class ImportView extends Component { } if (success) { - const importer = await getFileUpload().importerFactory(format, { + const importer = await fileUpload.importerFactory(format, { excludeLinesPattern: results.exclude_lines_pattern, multilineStartPattern: results.multiline_start_pattern, }); @@ -294,8 +292,7 @@ export class ImportView extends Component { const indexPatternResp = await createKibanaIndexPattern( indexPatternName, indexPatterns, - timeFieldName, - kibanaConfig + timeFieldName ); success = indexPatternResp.success; this.setState({ @@ -354,16 +351,15 @@ export class ImportView extends Component { return; } - const { exists } = await ml.checkIndexExists({ index }); + const exists = await this.props.fileUpload.checkIndexExists(index); const indexNameError = exists ? ( ) : ( isIndexNameValid(index) ); - this.setState({ checkingValidIndex: false, indexNameError }); }, 500); @@ -427,9 +423,19 @@ export class ImportView extends Component { }; async loadIndexPatternNames() { - await loadIndexPatterns(this.props.indexPatterns); - const indexPatternNames = getIndexPatternNames(); - this.setState({ indexPatternNames }); + try { + const indexPatternNames = ( + await this.savedObjectsClient.find({ + type: 'index-pattern', + fields: ['title'], + perPage: 10000, + }) + ).savedObjects.map(({ attributes }) => attributes && attributes.title); + + this.setState({ indexPatternNames }); + } catch (error) { + console.error('failed to load index patterns', error); + } } render() { @@ -501,14 +507,14 @@ export class ImportView extends Component {

  } @@ -549,7 +555,7 @@ export class ImportView extends Component { data-test-subj="mlFileDataVisImportButton" > @@ -558,7 +564,7 @@ export class ImportView extends Component { {initialized === true && importing === false && ( @@ -690,7 +696,7 @@ function isIndexNameValid(name) { ) { return ( ); @@ -707,7 +713,7 @@ function isIndexPatternNameValid(name, indexPatternNames, index) { if (indexPatternNames.find((i) => i === name)) { return ( ); @@ -723,7 +729,7 @@ function isIndexPatternNameValid(name, indexPatternNames, index) { // name should match index return ( ); diff --git a/x-pack/plugins/ml/public/application/datavisualizer/file_based/components/import_view/index.js b/x-pack/plugins/file_data_visualizer/public/application/components/import_view/index.js similarity index 100% rename from x-pack/plugins/ml/public/application/datavisualizer/file_based/components/import_view/index.js rename to x-pack/plugins/file_data_visualizer/public/application/components/import_view/index.js diff --git a/x-pack/plugins/file_data_visualizer/public/application/components/json_editor/index.ts b/x-pack/plugins/file_data_visualizer/public/application/components/json_editor/index.ts new file mode 100644 index 0000000000000..641587e5ac732 --- /dev/null +++ b/x-pack/plugins/file_data_visualizer/public/application/components/json_editor/index.ts @@ -0,0 +1,8 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +export { EDITOR_MODE, JsonEditor } from './json_editor'; diff --git a/x-pack/plugins/file_data_visualizer/public/application/components/json_editor/json_editor.tsx b/x-pack/plugins/file_data_visualizer/public/application/components/json_editor/json_editor.tsx new file mode 100644 index 0000000000000..d429f8dada6ec --- /dev/null +++ b/x-pack/plugins/file_data_visualizer/public/application/components/json_editor/json_editor.tsx @@ -0,0 +1,58 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import React, { FC } from 'react'; + +import { EuiCodeEditor, EuiCodeEditorProps } from '@elastic/eui'; +import { expandLiteralStrings, XJsonMode } from '../../shared_imports'; + +export const EDITOR_MODE = { TEXT: 'text', JSON: 'json', XJSON: new XJsonMode() }; + +interface JobEditorProps { + value: string; + height?: string; + width?: string; + mode?: typeof EDITOR_MODE[keyof typeof EDITOR_MODE]; + readOnly?: boolean; + syntaxChecking?: boolean; + theme?: string; + onChange?: EuiCodeEditorProps['onChange']; +} +export const JsonEditor: FC = ({ + value, + height = '500px', + width = '100%', + mode = EDITOR_MODE.JSON, + readOnly = false, + syntaxChecking = true, + theme = 'textmate', + onChange = () => {}, +}) => { + if (mode === EDITOR_MODE.XJSON) { + value = expandLiteralStrings(value); + } + + return ( + + ); +}; diff --git a/x-pack/plugins/file_data_visualizer/public/application/components/multi_select_picker/index.ts b/x-pack/plugins/file_data_visualizer/public/application/components/multi_select_picker/index.ts new file mode 100644 index 0000000000000..9d32228e1c4bc --- /dev/null +++ b/x-pack/plugins/file_data_visualizer/public/application/components/multi_select_picker/index.ts @@ -0,0 +1,8 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +export { MultiSelectPicker, Option } from './multi_select_picker'; diff --git a/x-pack/plugins/file_data_visualizer/public/application/components/multi_select_picker/multi_select_picker.tsx b/x-pack/plugins/file_data_visualizer/public/application/components/multi_select_picker/multi_select_picker.tsx new file mode 100644 index 0000000000000..2093b61a7ef4d --- /dev/null +++ b/x-pack/plugins/file_data_visualizer/public/application/components/multi_select_picker/multi_select_picker.tsx @@ -0,0 +1,145 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import { + EuiFieldSearch, + EuiFilterButton, + EuiFilterGroup, + EuiFilterSelectItem, + EuiIcon, + EuiPopover, + EuiPopoverTitle, + EuiSpacer, +} from '@elastic/eui'; +import React, { FC, ReactNode, useEffect, useState } from 'react'; +import { FormattedMessage } from '@kbn/i18n/react'; + +export interface Option { + name?: string | ReactNode; + value: string; + checked?: 'on' | 'off'; +} + +const NoFilterItems = () => { + return ( +
+
+ + +

+ +

+
+
+ ); +}; + +export const MultiSelectPicker: FC<{ + options: Option[]; + onChange?: (items: string[]) => void; + title?: string; + checkedOptions: string[]; + dataTestSubj: string; +}> = ({ options, onChange, title, checkedOptions, dataTestSubj }) => { + const [items, setItems] = useState(options); + const [searchTerm, setSearchTerm] = useState(''); + + useEffect(() => { + if (searchTerm === '') { + setItems(options); + } else { + const filteredOptions = options.filter((o) => o?.value?.includes(searchTerm)); + setItems(filteredOptions); + } + }, [options, searchTerm]); + + const [isPopoverOpen, setIsPopoverOpen] = useState(false); + + const onButtonClick = () => { + setIsPopoverOpen(!isPopoverOpen); + }; + + const closePopover = () => { + setIsPopoverOpen(false); + }; + + const handleOnChange = (index: number) => { + if (!items[index] || !Array.isArray(checkedOptions) || onChange === undefined) { + return; + } + const item = items[index]; + const foundIndex = checkedOptions.findIndex((fieldValue) => fieldValue === item.value); + if (foundIndex > -1) { + onChange(checkedOptions.filter((_, idx) => idx !== foundIndex)); + } else { + onChange([...checkedOptions, item.value]); + } + }; + + const button = ( + 0} + numActiveFilters={checkedOptions && checkedOptions.length} + > + {title} + + ); + + return ( + + + + setSearchTerm(e.target.value)} + data-test-subj={`${dataTestSubj}-searchInput`} + /> + +
+ {Array.isArray(items) && items.length > 0 ? ( + items.map((item, index) => { + const checked = + checkedOptions && + checkedOptions.findIndex((fieldValue) => fieldValue === item.value) > -1; + + return ( + handleOnChange(index)} + style={{ flexDirection: 'row' }} + data-test-subj={`${dataTestSubj}-option-${item.value}${ + checked ? '-checked' : '' + }`} + > + {item.name ?? item.value} + + ); + }) + ) : ( + + )} +
+
+
+ ); +}; diff --git a/x-pack/plugins/ml/public/application/datavisualizer/file_based/components/results_links/index.ts b/x-pack/plugins/file_data_visualizer/public/application/components/results_links/index.ts similarity index 100% rename from x-pack/plugins/ml/public/application/datavisualizer/file_based/components/results_links/index.ts rename to x-pack/plugins/file_data_visualizer/public/application/components/results_links/index.ts diff --git a/x-pack/plugins/ml/public/application/datavisualizer/file_based/components/results_links/results_links.tsx b/x-pack/plugins/file_data_visualizer/public/application/components/results_links/results_links.tsx similarity index 61% rename from x-pack/plugins/ml/public/application/datavisualizer/file_based/components/results_links/results_links.tsx rename to x-pack/plugins/file_data_visualizer/public/application/components/results_links/results_links.tsx index 90b8fb4ac0cbb..03dc06d836bbc 100644 --- a/x-pack/plugins/ml/public/application/datavisualizer/file_based/components/results_links/results_links.tsx +++ b/x-pack/plugins/file_data_visualizer/public/application/components/results_links/results_links.tsx @@ -9,20 +9,14 @@ import React, { FC, useState, useEffect } from 'react'; import moment from 'moment'; import { FormattedMessage } from '@kbn/i18n/react'; import { EuiFlexGroup, EuiFlexItem, EuiCard, EuiIcon } from '@elastic/eui'; -import { ml } from '../../../../services/ml_api_service'; -import { isFullLicense } from '../../../../license'; -import { checkPermission } from '../../../../capabilities/check_capabilities'; -import { mlNodesAvailable } from '../../../../ml_nodes_check/check_ml_nodes'; -import { useMlKibana, useMlUrlGenerator } from '../../../../contexts/kibana'; -import { ML_PAGES } from '../../../../../../common/constants/ml_url_generator'; -import { MlCommonGlobalState } from '../../../../../../common/types/ml_url_generator'; import { DISCOVER_APP_URL_GENERATOR, DiscoverUrlGeneratorState, -} from '../../../../../../../../../src/plugins/discover/public'; -import { FindFileStructureResponse } from '../../../../../../../file_upload/common'; - -const RECHECK_DELAY_MS = 3000; +} from '../../../../../../../src/plugins/discover/public'; +import { TimeRange, RefreshInterval } from '../../../../../../../src/plugins/data/public'; +import { FindFileStructureResponse } from '../../../../../file_upload/common'; +import type { FileUploadPluginStart } from '../../../../../file_upload/public'; +import { useFileDataVisualizerKibana } from '../../kibana_context'; interface Props { fieldStats: FindFileStructureResponse['field_stats']; @@ -33,6 +27,13 @@ interface Props { showFilebeatFlyout(): void; } +interface GlobalState { + time?: TimeRange; + refreshInterval?: RefreshInterval; +} + +const RECHECK_DELAY_MS = 3000; + export const ResultsLinks: FC = ({ fieldStats, index, @@ -41,20 +42,19 @@ export const ResultsLinks: FC = ({ createIndexPattern, showFilebeatFlyout, }) => { + const { + services: { fileUpload }, + } = useFileDataVisualizerKibana(); + const [duration, setDuration] = useState({ from: 'now-30m', to: 'now', }); - const [showCreateJobLink, setShowCreateJobLink] = useState(false); - const [globalState, setGlobalState] = useState(); + const [globalState, setGlobalState] = useState(); const [discoverLink, setDiscoverLink] = useState(''); const [indexManagementLink, setIndexManagementLink] = useState(''); const [indexPatternManagementLink, setIndexPatternManagementLink] = useState(''); - const [dataVisualizerLink, setDataVisualizerLink] = useState(''); - const [createJobsSelectTypePage, setCreateJobsSelectTypePage] = useState(''); - - const mlUrlGenerator = useMlUrlGenerator(); const { services: { @@ -63,7 +63,7 @@ export const ResultsLinks: FC = ({ urlGenerators: { getUrlGenerator }, }, }, - } = useMlKibana(); + } = useFileDataVisualizerKibana(); useEffect(() => { let unmounted = false; @@ -98,34 +98,7 @@ export const ResultsLinks: FC = ({ } }; - const getDataVisualizerLink = async (): Promise => { - const _dataVisualizerLink = await mlUrlGenerator.createUrl({ - page: ML_PAGES.DATA_VISUALIZER_INDEX_VIEWER, - pageState: { - index: indexPatternId, - globalState, - }, - }); - if (!unmounted) { - setDataVisualizerLink(_dataVisualizerLink); - } - }; - const getADCreateJobsSelectTypePage = async (): Promise => { - const _createJobsSelectTypePage = await mlUrlGenerator.createUrl({ - page: ML_PAGES.ANOMALY_DETECTION_CREATE_JOB_SELECT_TYPE, - pageState: { - index: indexPatternId, - globalState, - }, - }); - if (!unmounted) { - setCreateJobsSelectTypePage(_createJobsSelectTypePage); - } - }; - getDiscoverUrl(); - getDataVisualizerLink(); - getADCreateJobsSelectTypePage(); if (!unmounted) { setIndexManagementLink( @@ -141,15 +114,16 @@ export const ResultsLinks: FC = ({ return () => { unmounted = true; }; + // eslint-disable-next-line react-hooks/exhaustive-deps }, [indexPatternId, getUrlGenerator, JSON.stringify(globalState)]); useEffect(() => { - setShowCreateJobLink(checkPermission('canCreateJob') && mlNodesAvailable()); updateTimeValues(); + // eslint-disable-next-line react-hooks/exhaustive-deps }, []); useEffect(() => { - const _globalState: MlCommonGlobalState = { + const _globalState: GlobalState = { time: { from: duration.from, to: duration.to, @@ -176,7 +150,7 @@ export const ResultsLinks: FC = ({ async function updateTimeValues(recheck = true) { if (timeFieldName !== undefined) { - const { from, to } = await getFullTimeRange(index, timeFieldName); + const { from, to } = await getFullTimeRange(index, timeFieldName, fileUpload); setDuration({ from: from === null ? duration.from : from, to: to === null ? duration.to : to, @@ -202,7 +176,7 @@ export const ResultsLinks: FC = ({ icon={} title={ } @@ -212,49 +186,13 @@ export const ResultsLinks: FC = ({ )} - {isFullLicense() === true && - timeFieldName !== undefined && - showCreateJobLink && - createIndexPattern && - createJobsSelectTypePage && ( - - } - title={ - - } - description="" - href={createJobsSelectTypePage} - /> - - )} - - {createIndexPattern && dataVisualizerLink && ( - - } - title={ - - } - description="" - href={dataVisualizerLink} - /> - - )} - {indexManagementLink && ( } title={ } @@ -270,7 +208,7 @@ export const ResultsLinks: FC = ({ icon={} title={ } @@ -284,7 +222,7 @@ export const ResultsLinks: FC = ({ icon={} title={ } @@ -296,13 +234,13 @@ export const ResultsLinks: FC = ({ ); }; -async function getFullTimeRange(index: string, timeFieldName: string) { +async function getFullTimeRange( + index: string, + timeFieldName: string, + { getTimeFieldRange }: FileUploadPluginStart +) { const query = { bool: { must: [{ query_string: { analyze_wildcard: true, query: '*' } }] } }; - const resp = await ml.getTimeFieldRange({ - index, - timeFieldName, - query, - }); + const resp = await getTimeFieldRange(index, query, timeFieldName); return { from: moment(resp.start.epoch).toISOString(), diff --git a/x-pack/plugins/ml/public/application/datavisualizer/file_based/components/results_view/_index.scss b/x-pack/plugins/file_data_visualizer/public/application/components/results_view/_index.scss similarity index 100% rename from x-pack/plugins/ml/public/application/datavisualizer/file_based/components/results_view/_index.scss rename to x-pack/plugins/file_data_visualizer/public/application/components/results_view/_index.scss diff --git a/x-pack/plugins/ml/public/application/datavisualizer/file_based/components/results_view/_results_view.scss b/x-pack/plugins/file_data_visualizer/public/application/components/results_view/_results_view.scss similarity index 100% rename from x-pack/plugins/ml/public/application/datavisualizer/file_based/components/results_view/_results_view.scss rename to x-pack/plugins/file_data_visualizer/public/application/components/results_view/_results_view.scss diff --git a/x-pack/plugins/ml/public/application/datavisualizer/file_based/components/results_view/index.ts b/x-pack/plugins/file_data_visualizer/public/application/components/results_view/index.ts similarity index 100% rename from x-pack/plugins/ml/public/application/datavisualizer/file_based/components/results_view/index.ts rename to x-pack/plugins/file_data_visualizer/public/application/components/results_view/index.ts diff --git a/x-pack/plugins/ml/public/application/datavisualizer/file_based/components/results_view/results_view.tsx b/x-pack/plugins/file_data_visualizer/public/application/components/results_view/results_view.tsx similarity index 89% rename from x-pack/plugins/ml/public/application/datavisualizer/file_based/components/results_view/results_view.tsx rename to x-pack/plugins/file_data_visualizer/public/application/components/results_view/results_view.tsx index 7431bfd4295e4..e2d21f242e4ef 100644 --- a/x-pack/plugins/ml/public/application/datavisualizer/file_based/components/results_view/results_view.tsx +++ b/x-pack/plugins/file_data_visualizer/public/application/components/results_view/results_view.tsx @@ -20,7 +20,7 @@ import { EuiFlexGroup, EuiFlexItem, } from '@elastic/eui'; -import { FindFileStructureResponse } from '../../../../../../../file_upload/common'; +import { FindFileStructureResponse } from '../../../../../file_upload/common'; import { FileContents } from '../file_contents'; import { AnalysisSummary } from '../analysis_summary'; @@ -72,7 +72,7 @@ export const ResultsView: FC = ({ showEditFlyout()} disabled={disableButtons}> @@ -80,7 +80,7 @@ export const ResultsView: FC = ({ showExplanationFlyout()} disabled={disableButtons}> @@ -94,7 +94,7 @@ export const ResultsView: FC = ({

diff --git a/x-pack/plugins/file_data_visualizer/public/application/components/stats_table/_field_data_row.scss b/x-pack/plugins/file_data_visualizer/public/application/components/stats_table/_field_data_row.scss new file mode 100644 index 0000000000000..944c31da8cab7 --- /dev/null +++ b/x-pack/plugins/file_data_visualizer/public/application/components/stats_table/_field_data_row.scss @@ -0,0 +1,86 @@ +.fieldDataCard { + height: 420px; + box-shadow: none; + border-color: $euiBorderColor; + + // Note the names of these styles need to match the type of the field they are displaying. + .boolean { + color: $euiColorVis5; + border-color: $euiColorVis5; + } + + .date { + color: $euiColorVis7; + border-color: $euiColorVis7; + } + + .document_count { + color: $euiColorVis2; + border-color: $euiColorVis2; + } + + .geo_point { + color: $euiColorVis8; + border-color: $euiColorVis8; + } + + .ip { + color: $euiColorVis3; + border-color: $euiColorVis3; + } + + .keyword { + color: $euiColorVis0; + border-color: $euiColorVis0; + } + + .number { + color: $euiColorVis1; + border-color: $euiColorVis1; + } + + .text { + color: $euiColorVis9; + border-color: $euiColorVis9; + } + + .type-other, + .unknown { + color: $euiColorVis6; + border-color: $euiColorVis6; + } + + .fieldDataCard__content { + @include euiFontSizeS; + height: 385px; + overflow: hidden; + } + + .fieldDataCard__codeContent { + @include euiCodeFont; + } + + .fieldDataCard__geoContent { + z-index: auto; + flex: 1; + display: flex; + flex-direction: column; + height: 100%; + position: relative; + .embPanel__content { + display: flex; + flex: 1 1 100%; + z-index: 1; + min-height: 0; // Absolute must for Firefox to scroll contents + } + } + + .fieldDataCard__stats { + padding: $euiSizeS $euiSizeS 0 $euiSizeS; + text-align: center; + } + + .fieldDataCard__valuesTitle { + text-transform: uppercase; + } +} diff --git a/x-pack/plugins/file_data_visualizer/public/application/components/stats_table/_index.scss b/x-pack/plugins/file_data_visualizer/public/application/components/stats_table/_index.scss new file mode 100644 index 0000000000000..d317d324bae90 --- /dev/null +++ b/x-pack/plugins/file_data_visualizer/public/application/components/stats_table/_index.scss @@ -0,0 +1,56 @@ +@import 'components/field_data_expanded_row/index'; +@import 'components/field_count_stats/index'; +@import 'components/field_data_row/index'; + +.dataVisualizerFieldExpandedRow { + padding-left: $euiSize * 4; + width: 100%; + + .fieldDataCard__valuesTitle { + text-transform: uppercase; + text-align: left; + color: $euiColorDarkShade; + font-weight: bold; + padding-bottom: $euiSizeS; + } + + .fieldDataCard__codeContent { + @include euiCodeFont; + } +} + +.dataVisualizer { + .euiTableRow > .euiTableRowCell { + border-bottom: 0; + border-top: $euiBorderThin; + + } + .euiTableRow-isExpandedRow { + + .euiTableRowCell { + background-color: $euiColorEmptyShade !important; + border-top: 0; + border-bottom: $euiBorderThin; + &:hover { + background-color: $euiColorEmptyShade !important; + } + } + } + .dataVisualizerSummaryTable { + max-width: 350px; + min-width: 250px; + .euiTableRow > .euiTableRowCell { + border-bottom: 0; + } + .euiTableHeaderCell { + display: none; + } + } + .dataVisualizerSummaryTableWrapper { + max-width: 300px; + } + .dataVisualizerMapWrapper { + min-height: 300px; + min-width: 600px; + } +} diff --git a/x-pack/plugins/file_data_visualizer/public/application/components/stats_table/components/expanded_row_field_header/expanded_row_field_header.tsx b/x-pack/plugins/file_data_visualizer/public/application/components/stats_table/components/expanded_row_field_header/expanded_row_field_header.tsx new file mode 100644 index 0000000000000..7279bceb8be93 --- /dev/null +++ b/x-pack/plugins/file_data_visualizer/public/application/components/stats_table/components/expanded_row_field_header/expanded_row_field_header.tsx @@ -0,0 +1,15 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import { EuiText } from '@elastic/eui'; +import React from 'react'; + +export const ExpandedRowFieldHeader = ({ children }: { children: React.ReactNode }) => ( + + {children} + +); diff --git a/x-pack/plugins/file_data_visualizer/public/application/components/stats_table/components/expanded_row_field_header/index.ts b/x-pack/plugins/file_data_visualizer/public/application/components/stats_table/components/expanded_row_field_header/index.ts new file mode 100644 index 0000000000000..a92fa7f1e0659 --- /dev/null +++ b/x-pack/plugins/file_data_visualizer/public/application/components/stats_table/components/expanded_row_field_header/index.ts @@ -0,0 +1,8 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +export { ExpandedRowFieldHeader } from './expanded_row_field_header'; diff --git a/x-pack/plugins/file_data_visualizer/public/application/components/stats_table/components/field_count_stats/_index.scss b/x-pack/plugins/file_data_visualizer/public/application/components/stats_table/components/field_count_stats/_index.scss new file mode 100644 index 0000000000000..e44082c90ba32 --- /dev/null +++ b/x-pack/plugins/file_data_visualizer/public/application/components/stats_table/components/field_count_stats/_index.scss @@ -0,0 +1,3 @@ +.dataVisualizerFieldCountContainer { + max-width: 300px; +} diff --git a/x-pack/plugins/file_data_visualizer/public/application/components/stats_table/components/field_count_stats/index.ts b/x-pack/plugins/file_data_visualizer/public/application/components/stats_table/components/field_count_stats/index.ts new file mode 100644 index 0000000000000..d841ee2959f62 --- /dev/null +++ b/x-pack/plugins/file_data_visualizer/public/application/components/stats_table/components/field_count_stats/index.ts @@ -0,0 +1,13 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +export { TotalFieldsCount, TotalFieldsCountProps, TotalFieldsStats } from './total_fields_count'; +export { + MetricFieldsCount, + MetricFieldsCountProps, + MetricFieldsStats, +} from './metric_fields_count'; diff --git a/x-pack/plugins/file_data_visualizer/public/application/components/stats_table/components/field_count_stats/metric_fields_count.tsx b/x-pack/plugins/file_data_visualizer/public/application/components/stats_table/components/field_count_stats/metric_fields_count.tsx new file mode 100644 index 0000000000000..93582a7cef9ed --- /dev/null +++ b/x-pack/plugins/file_data_visualizer/public/application/components/stats_table/components/field_count_stats/metric_fields_count.tsx @@ -0,0 +1,68 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import { EuiFlexGroup, EuiFlexItem, EuiNotificationBadge, EuiText } from '@elastic/eui'; +import { FormattedMessage } from '@kbn/i18n/react'; +import React, { FC } from 'react'; + +export interface MetricFieldsStats { + visibleMetricsCount: number; + totalMetricFieldsCount: number; +} +export interface MetricFieldsCountProps { + metricsStats?: MetricFieldsStats; +} + +export const MetricFieldsCount: FC = ({ metricsStats }) => { + if ( + !metricsStats || + metricsStats.visibleMetricsCount === undefined || + metricsStats.totalMetricFieldsCount === undefined + ) + return null; + return ( + <> + {metricsStats && ( + + + +
+ +
+
+
+ + + {metricsStats.visibleMetricsCount} + + + + + + + +
+ )} + + ); +}; diff --git a/x-pack/plugins/file_data_visualizer/public/application/components/stats_table/components/field_count_stats/total_fields_count.tsx b/x-pack/plugins/file_data_visualizer/public/application/components/stats_table/components/field_count_stats/total_fields_count.tsx new file mode 100644 index 0000000000000..9d554c7025d80 --- /dev/null +++ b/x-pack/plugins/file_data_visualizer/public/application/components/stats_table/components/field_count_stats/total_fields_count.tsx @@ -0,0 +1,67 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import { EuiFlexGroup, EuiFlexItem, EuiNotificationBadge, EuiText } from '@elastic/eui'; +import { FormattedMessage } from '@kbn/i18n/react'; +import React, { FC } from 'react'; + +export interface TotalFieldsStats { + visibleFieldsCount: number; + totalFieldsCount: number; +} + +export interface TotalFieldsCountProps { + fieldsCountStats?: TotalFieldsStats; +} + +export const TotalFieldsCount: FC = ({ fieldsCountStats }) => { + if ( + !fieldsCountStats || + fieldsCountStats.visibleFieldsCount === undefined || + fieldsCountStats.totalFieldsCount === undefined + ) + return null; + + return ( + + + +
+ +
+
+
+ + + + {fieldsCountStats.visibleFieldsCount} + + + + + + + +
+ ); +}; diff --git a/x-pack/plugins/file_data_visualizer/public/application/components/stats_table/components/field_data_expanded_row/_index.scss b/x-pack/plugins/file_data_visualizer/public/application/components/stats_table/components/field_data_expanded_row/_index.scss new file mode 100644 index 0000000000000..b878bf0dcc0f6 --- /dev/null +++ b/x-pack/plugins/file_data_visualizer/public/application/components/stats_table/components/field_data_expanded_row/_index.scss @@ -0,0 +1,7 @@ +@import 'number_content'; + +.dataVisualizerExpandedRow { + @include euiBreakpoint('xs', 's', 'm') { + flex-direction: column; + } +} diff --git a/x-pack/plugins/file_data_visualizer/public/application/components/stats_table/components/field_data_expanded_row/_number_content.scss b/x-pack/plugins/file_data_visualizer/public/application/components/stats_table/components/field_data_expanded_row/_number_content.scss new file mode 100644 index 0000000000000..1f52b0763cdd3 --- /dev/null +++ b/x-pack/plugins/file_data_visualizer/public/application/components/stats_table/components/field_data_expanded_row/_number_content.scss @@ -0,0 +1,4 @@ +.metricDistributionChartContainer { + padding-top: $euiSizeXS; + width: 100%; +} diff --git a/x-pack/plugins/file_data_visualizer/public/application/components/stats_table/components/field_data_expanded_row/boolean_content.tsx b/x-pack/plugins/file_data_visualizer/public/application/components/stats_table/components/field_data_expanded_row/boolean_content.tsx new file mode 100644 index 0000000000000..7c9ddcdab29c8 --- /dev/null +++ b/x-pack/plugins/file_data_visualizer/public/application/components/stats_table/components/field_data_expanded_row/boolean_content.tsx @@ -0,0 +1,145 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import React, { FC, ReactNode, useMemo } from 'react'; +import { EuiBasicTable, EuiFlexItem, EuiSpacer } from '@elastic/eui'; +import { Axis, BarSeries, Chart, Settings } from '@elastic/charts'; + +import { FormattedMessage } from '@kbn/i18n/react'; +import { i18n } from '@kbn/i18n'; +import type { FieldDataRowProps } from '../../types/field_data_row'; +import { ExpandedRowFieldHeader } from '../expanded_row_field_header'; +import { getTFPercentage } from '../../utils'; +import { roundToDecimalPlace } from '../../../utils'; +import { useDataVizChartTheme } from '../../hooks'; +import { DocumentStatsTable } from './document_stats'; +import { ExpandedRowContent } from './expanded_row_content'; + +function getPercentLabel(value: number): string { + if (value === 0) { + return '0%'; + } + if (value >= 0.1) { + return `${roundToDecimalPlace(value)}%`; + } else { + return '< 0.1%'; + } +} + +function getFormattedValue(value: number, totalCount: number): string { + const percentage = (value / totalCount) * 100; + return `${value} (${getPercentLabel(percentage)})`; +} + +const BOOLEAN_DISTRIBUTION_CHART_HEIGHT = 100; + +export const BooleanContent: FC = ({ config }) => { + const fieldFormat = 'fieldFormat' in config ? config.fieldFormat : undefined; + const formattedPercentages = useMemo(() => getTFPercentage(config), [config]); + const theme = useDataVizChartTheme(); + if (!formattedPercentages) return null; + + const { trueCount, falseCount, count } = formattedPercentages; + const summaryTableItems = [ + { + function: 'true', + display: ( + + ), + value: getFormattedValue(trueCount, count), + }, + { + function: 'false', + display: ( + + ), + value: getFormattedValue(falseCount, count), + }, + ]; + const summaryTableColumns = [ + { + name: '', + render: (summaryItem: { display: ReactNode }) => summaryItem.display, + width: '75px', + }, + { + field: 'value', + name: '', + render: (v: string) => {v}, + }, + ]; + + const summaryTableTitle = i18n.translate( + 'xpack.fileDataVisualizer.fieldDataCardExpandedRow.booleanContent.summaryTableTitle', + { + defaultMessage: 'Summary', + } + ); + + return ( + + + + + {summaryTableTitle} + + + + + + + + + + + getFormattedValue(d, count)} + /> + + + + + + + ); +}; diff --git a/x-pack/plugins/file_data_visualizer/public/application/components/stats_table/components/field_data_expanded_row/date_content.tsx b/x-pack/plugins/file_data_visualizer/public/application/components/stats_table/components/field_data_expanded_row/date_content.tsx new file mode 100644 index 0000000000000..cf34417ad9bbd --- /dev/null +++ b/x-pack/plugins/file_data_visualizer/public/application/components/stats_table/components/field_data_expanded_row/date_content.tsx @@ -0,0 +1,90 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import React, { FC, ReactNode } from 'react'; +import { EuiBasicTable, EuiFlexItem } from '@elastic/eui'; +// @ts-ignore +import { formatDate } from '@elastic/eui/lib/services/format'; +import { FormattedMessage } from '@kbn/i18n/react'; + +import { i18n } from '@kbn/i18n'; +import type { FieldDataRowProps } from '../../types/field_data_row'; +import { ExpandedRowFieldHeader } from '../expanded_row_field_header'; +import { DocumentStatsTable } from './document_stats'; +import { ExpandedRowContent } from './expanded_row_content'; +const TIME_FORMAT = 'MMM D YYYY, HH:mm:ss.SSS'; +interface SummaryTableItem { + function: string; + display: ReactNode; + value: number | string | undefined | null; +} + +export const DateContent: FC = ({ config }) => { + const { stats } = config; + if (stats === undefined) return null; + + const { earliest, latest } = stats; + + const summaryTableTitle = i18n.translate( + 'xpack.fileDataVisualizer.fieldDataCard.cardDate.summaryTableTitle', + { + defaultMessage: 'Summary', + } + ); + const summaryTableItems = [ + { + function: 'earliest', + display: ( + + ), + value: typeof earliest === 'string' ? earliest : formatDate(earliest, TIME_FORMAT), + }, + { + function: 'latest', + display: ( + + ), + value: typeof latest === 'string' ? latest : formatDate(latest, TIME_FORMAT), + }, + ]; + const summaryTableColumns = [ + { + name: '', + render: (summaryItem: { display: ReactNode }) => summaryItem.display, + width: '75px', + }, + { + field: 'value', + name: '', + render: (v: string) => {v}, + }, + ]; + + return ( + + + + {summaryTableTitle} + + className={'dataVisualizerSummaryTable'} + data-test-subj={'mlDateSummaryTable'} + compressed + items={summaryTableItems} + columns={summaryTableColumns} + tableCaption={summaryTableTitle} + tableLayout="auto" + /> + + + ); +}; diff --git a/x-pack/plugins/file_data_visualizer/public/application/components/stats_table/components/field_data_expanded_row/document_stats.tsx b/x-pack/plugins/file_data_visualizer/public/application/components/stats_table/components/field_data_expanded_row/document_stats.tsx new file mode 100644 index 0000000000000..f3ac0d94aa255 --- /dev/null +++ b/x-pack/plugins/file_data_visualizer/public/application/components/stats_table/components/field_data_expanded_row/document_stats.tsx @@ -0,0 +1,93 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import { FormattedMessage } from '@kbn/i18n/react'; +import React, { FC, ReactNode } from 'react'; +import { i18n } from '@kbn/i18n'; +import { EuiBasicTable, EuiFlexItem } from '@elastic/eui'; +import { ExpandedRowFieldHeader } from '../expanded_row_field_header'; +import { FieldDataRowProps } from '../../types'; +import { roundToDecimalPlace } from '../../../utils'; + +const metaTableColumns = [ + { + name: '', + render: (metaItem: { display: ReactNode }) => metaItem.display, + width: '75px', + }, + { + field: 'value', + name: '', + render: (v: string) => {v}, + }, +]; + +const metaTableTitle = i18n.translate( + 'xpack.fileDataVisualizer.fieldDataCardExpandedRow.documentStatsTable.metaTableTitle', + { + defaultMessage: 'Documents stats', + } +); + +export const DocumentStatsTable: FC = ({ config }) => { + if ( + config?.stats === undefined || + config.stats.cardinality === undefined || + config.stats.count === undefined || + config.stats.sampleCount === undefined + ) + return null; + const { cardinality, count, sampleCount } = config.stats; + const metaTableItems = [ + { + function: 'count', + display: ( + + ), + value: count, + }, + { + function: 'percentage', + display: ( + + ), + value: `${roundToDecimalPlace((count / sampleCount) * 100)}%`, + }, + { + function: 'distinctValues', + display: ( + + ), + value: cardinality, + }, + ]; + + return ( + + {metaTableTitle} + + + ); +}; diff --git a/x-pack/plugins/file_data_visualizer/public/application/components/stats_table/components/field_data_expanded_row/expanded_row_content.tsx b/x-pack/plugins/file_data_visualizer/public/application/components/stats_table/components/field_data_expanded_row/expanded_row_content.tsx new file mode 100644 index 0000000000000..a9f5dc6eaab1d --- /dev/null +++ b/x-pack/plugins/file_data_visualizer/public/application/components/stats_table/components/field_data_expanded_row/expanded_row_content.tsx @@ -0,0 +1,25 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import React, { FC, ReactNode } from 'react'; +import { EuiFlexGroup } from '@elastic/eui'; + +interface Props { + children: ReactNode; + dataTestSubj: string; +} +export const ExpandedRowContent: FC = ({ children, dataTestSubj }) => { + return ( + + {children} + + ); +}; diff --git a/x-pack/plugins/file_data_visualizer/public/application/components/stats_table/components/field_data_expanded_row/index.ts b/x-pack/plugins/file_data_visualizer/public/application/components/stats_table/components/field_data_expanded_row/index.ts new file mode 100644 index 0000000000000..c8db31146936d --- /dev/null +++ b/x-pack/plugins/file_data_visualizer/public/application/components/stats_table/components/field_data_expanded_row/index.ts @@ -0,0 +1,15 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +export { BooleanContent } from './boolean_content'; +export { DateContent } from './date_content'; +export { GeoPointContent } from '../../../expanded_row/geo_point_content/geo_point_content'; +export { KeywordContent } from './keyword_content'; +export { IpContent } from './ip_content'; +export { NumberContent } from './number_content'; +export { OtherContent } from './other_content'; +export { TextContent } from './text_content'; diff --git a/x-pack/plugins/file_data_visualizer/public/application/components/stats_table/components/field_data_expanded_row/ip_content.tsx b/x-pack/plugins/file_data_visualizer/public/application/components/stats_table/components/field_data_expanded_row/ip_content.tsx new file mode 100644 index 0000000000000..07adf3103b78e --- /dev/null +++ b/x-pack/plugins/file_data_visualizer/public/application/components/stats_table/components/field_data_expanded_row/ip_content.tsx @@ -0,0 +1,27 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import React, { FC } from 'react'; +import type { FieldDataRowProps } from '../../types/field_data_row'; +import { TopValues } from '../../../top_values'; +import { DocumentStatsTable } from './document_stats'; +import { ExpandedRowContent } from './expanded_row_content'; + +export const IpContent: FC = ({ config }) => { + const { stats } = config; + if (stats === undefined) return null; + const { count, sampleCount, cardinality } = stats; + if (count === undefined || sampleCount === undefined || cardinality === undefined) return null; + const fieldFormat = 'fieldFormat' in config ? config.fieldFormat : undefined; + + return ( + + + + + ); +}; diff --git a/x-pack/plugins/file_data_visualizer/public/application/components/stats_table/components/field_data_expanded_row/keyword_content.tsx b/x-pack/plugins/file_data_visualizer/public/application/components/stats_table/components/field_data_expanded_row/keyword_content.tsx new file mode 100644 index 0000000000000..3f1a7aad5463f --- /dev/null +++ b/x-pack/plugins/file_data_visualizer/public/application/components/stats_table/components/field_data_expanded_row/keyword_content.tsx @@ -0,0 +1,25 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import React, { FC } from 'react'; +import type { FieldDataRowProps } from '../../types/field_data_row'; +import { TopValues } from '../../../top_values'; +import { DocumentStatsTable } from './document_stats'; +import { ExpandedRowContent } from './expanded_row_content'; + +export const KeywordContent: FC = ({ config }) => { + const { stats } = config; + const fieldFormat = 'fieldFormat' in config ? config.fieldFormat : undefined; + + return ( + + + + + + ); +}; diff --git a/x-pack/plugins/file_data_visualizer/public/application/components/stats_table/components/field_data_expanded_row/number_content.tsx b/x-pack/plugins/file_data_visualizer/public/application/components/stats_table/components/field_data_expanded_row/number_content.tsx new file mode 100644 index 0000000000000..e83eecb64d02e --- /dev/null +++ b/x-pack/plugins/file_data_visualizer/public/application/components/stats_table/components/field_data_expanded_row/number_content.tsx @@ -0,0 +1,154 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import React, { FC, ReactNode, useEffect, useState } from 'react'; +import { EuiBasicTable, EuiFlexItem, EuiText } from '@elastic/eui'; + +import { FormattedMessage } from '@kbn/i18n/react'; +import { i18n } from '@kbn/i18n'; +import type { FieldDataRowProps } from '../../types/field_data_row'; +import { kibanaFieldFormat, numberAsOrdinal } from '../../../utils'; +import { + MetricDistributionChart, + MetricDistributionChartData, + buildChartDataFromStats, +} from '../metric_distribution_chart'; +import { TopValues } from '../../../top_values'; +import { ExpandedRowFieldHeader } from '../expanded_row_field_header'; +import { DocumentStatsTable } from './document_stats'; +import { ExpandedRowContent } from './expanded_row_content'; + +const METRIC_DISTRIBUTION_CHART_WIDTH = 325; +const METRIC_DISTRIBUTION_CHART_HEIGHT = 200; + +interface SummaryTableItem { + function: string; + display: ReactNode; + value: number | string | undefined | null; +} + +export const NumberContent: FC = ({ config }) => { + const { stats } = config; + + useEffect(() => { + const chartData = buildChartDataFromStats(stats, METRIC_DISTRIBUTION_CHART_WIDTH); + setDistributionChartData(chartData); + // eslint-disable-next-line react-hooks/exhaustive-deps + }, []); + + const defaultChartData: MetricDistributionChartData[] = []; + const [distributionChartData, setDistributionChartData] = useState(defaultChartData); + + if (stats === undefined) return null; + const { min, median, max, distribution } = stats; + const fieldFormat = 'fieldFormat' in config ? config.fieldFormat : undefined; + + const summaryTableItems = [ + { + function: 'min', + display: ( + + ), + value: kibanaFieldFormat(min, fieldFormat), + }, + { + function: 'median', + display: ( + + ), + value: kibanaFieldFormat(median, fieldFormat), + }, + { + function: 'max', + display: ( + + ), + value: kibanaFieldFormat(max, fieldFormat), + }, + ]; + const summaryTableColumns = [ + { + name: '', + render: (summaryItem: { display: ReactNode }) => summaryItem.display, + width: '75px', + }, + { + field: 'value', + name: '', + render: (v: string) => {v}, + }, + ]; + + const summaryTableTitle = i18n.translate( + 'xpack.fileDataVisualizer.fieldDataCardExpandedRow.numberContent.summaryTableTitle', + { + defaultMessage: 'Summary', + } + ); + return ( + + + + {summaryTableTitle} + + className={'dataVisualizerSummaryTable'} + compressed + items={summaryTableItems} + columns={summaryTableColumns} + tableCaption={summaryTableTitle} + data-test-subj={'mlNumberSummaryTable'} + /> + + + {stats && ( + + )} + {distribution && ( + + + + + + + + + + + + + + + + + )} + + ); +}; diff --git a/x-pack/plugins/file_data_visualizer/public/application/components/stats_table/components/field_data_expanded_row/other_content.tsx b/x-pack/plugins/file_data_visualizer/public/application/components/stats_table/components/field_data_expanded_row/other_content.tsx new file mode 100644 index 0000000000000..cb1605331551e --- /dev/null +++ b/x-pack/plugins/file_data_visualizer/public/application/components/stats_table/components/field_data_expanded_row/other_content.tsx @@ -0,0 +1,28 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import React, { FC } from 'react'; +import { EuiFlexItem } from '@elastic/eui'; +import type { FieldDataRowProps } from '../../types/field_data_row'; +import { ExamplesList } from '../../../examples_list'; +import { DocumentStatsTable } from './document_stats'; +import { ExpandedRowContent } from './expanded_row_content'; + +export const OtherContent: FC = ({ config }) => { + const { stats } = config; + if (stats === undefined) return null; + return ( + + + {Array.isArray(stats.examples) && ( + + + + )} + + ); +}; diff --git a/x-pack/plugins/file_data_visualizer/public/application/components/stats_table/components/field_data_expanded_row/text_content.tsx b/x-pack/plugins/file_data_visualizer/public/application/components/stats_table/components/field_data_expanded_row/text_content.tsx new file mode 100644 index 0000000000000..b399f952b4d9d --- /dev/null +++ b/x-pack/plugins/file_data_visualizer/public/application/components/stats_table/components/field_data_expanded_row/text_content.tsx @@ -0,0 +1,69 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import React, { FC, Fragment } from 'react'; +import { EuiCallOut, EuiFlexItem, EuiSpacer } from '@elastic/eui'; + +import { FormattedMessage } from '@kbn/i18n/react'; +import { i18n } from '@kbn/i18n'; + +import type { FieldDataRowProps } from '../../types/field_data_row'; +import { ExamplesList } from '../../../examples_list'; +import { ExpandedRowContent } from './expanded_row_content'; + +export const TextContent: FC = ({ config }) => { + const { stats } = config; + if (stats === undefined) return null; + + const { examples } = stats; + if (examples === undefined) return null; + + const numExamples = examples.length; + + return ( + + + {numExamples > 0 && } + {numExamples === 0 && ( + + + + _source, + }} + /> + + + + copy_to, + sourceParam: _source, + includesParam: includes, + excludesParam: excludes, + }} + /> + + + )} + + + ); +}; diff --git a/x-pack/plugins/file_data_visualizer/public/application/components/stats_table/components/field_data_row/_index.scss b/x-pack/plugins/file_data_visualizer/public/application/components/stats_table/components/field_data_row/_index.scss new file mode 100644 index 0000000000000..3afa182560e1e --- /dev/null +++ b/x-pack/plugins/file_data_visualizer/public/application/components/stats_table/components/field_data_row/_index.scss @@ -0,0 +1,3 @@ +.dataVisualizerColumnHeaderIcon { + max-width: $euiSizeM; +} diff --git a/x-pack/plugins/file_data_visualizer/public/application/components/stats_table/components/field_data_row/boolean_content_preview.tsx b/x-pack/plugins/file_data_visualizer/public/application/components/stats_table/components/field_data_row/boolean_content_preview.tsx new file mode 100644 index 0000000000000..c6c28da0baf04 --- /dev/null +++ b/x-pack/plugins/file_data_visualizer/public/application/components/stats_table/components/field_data_row/boolean_content_preview.tsx @@ -0,0 +1,43 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import React, { FC, useMemo } from 'react'; +// import { EuiDataGridColumn } from '@elastic/eui'; +import { OrdinalChartData } from './field_histograms'; +// import { ColumnChart } from '../../../../../../components/data_grid/column_chart'; // TODO copy component +import { FieldDataRowProps } from '../../types'; +import { getTFPercentage } from '../../utils'; + +export const BooleanContentPreview: FC = ({ config }) => { + const chartData = useMemo(() => { + const results = getTFPercentage(config); + if (results) { + const data = [ + { key: 'true', key_as_string: 'true', doc_count: results.trueCount }, + { key: 'false', key_as_string: 'false', doc_count: results.falseCount }, + ]; + return { id: config.fieldName, cardinality: 2, data, type: 'boolean' } as OrdinalChartData; + } + }, [config]); + if (!chartData || config.fieldName === undefined) return null; + + // const columnType: EuiDataGridColumn = { + // id: config.fieldName, + // schema: undefined, + // }; + // const dataTestSubj = `mlDataGridChart-${config.fieldName}`; + + return ( + <> + // + ); +}; diff --git a/x-pack/plugins/file_data_visualizer/public/application/components/stats_table/components/field_data_row/column_chart.scss b/x-pack/plugins/file_data_visualizer/public/application/components/stats_table/components/field_data_row/column_chart.scss new file mode 100644 index 0000000000000..63603ee9bd2ec --- /dev/null +++ b/x-pack/plugins/file_data_visualizer/public/application/components/stats_table/components/field_data_row/column_chart.scss @@ -0,0 +1,32 @@ +.dataGridChart__histogram { + width: 100%; + height: $euiSizeXL + $euiSizeXXL; +} + +.dataGridChart__legend { + @include euiTextTruncate; + @include euiFontSizeXS; + + color: $euiColorMediumShade; + display: block; + overflow-x: hidden; + margin: $euiSizeXS 0 0 0; + font-style: italic; + font-weight: normal; + text-align: left; +} + +.dataGridChart__legend--numeric { + text-align: right; +} + +.dataGridChart__legendBoolean { + width: 100%; + min-width: $euiButtonMinWidth; + td { text-align: center } +} + +/* Override to align column header to bottom of cell when no chart is available */ +.dataGrid .euiDataGridHeaderCell__content { + margin-top: auto; +} diff --git a/x-pack/plugins/file_data_visualizer/public/application/components/stats_table/components/field_data_row/column_chart.tsx b/x-pack/plugins/file_data_visualizer/public/application/components/stats_table/components/field_data_row/column_chart.tsx new file mode 100644 index 0000000000000..ed4b82005db29 --- /dev/null +++ b/x-pack/plugins/file_data_visualizer/public/application/components/stats_table/components/field_data_row/column_chart.tsx @@ -0,0 +1,84 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import React, { FC } from 'react'; +import classNames from 'classnames'; + +import { BarSeries, Chart, Settings } from '@elastic/charts'; +import { EuiDataGridColumn } from '@elastic/eui'; + +import './column_chart.scss'; + +import { isUnsupportedChartData, ChartData } from './field_histograms'; + +import { useColumnChart } from './use_column_chart'; + +interface Props { + chartData: ChartData; + columnType: EuiDataGridColumn; + dataTestSubj: string; + hideLabel?: boolean; + maxChartColumns?: number; +} + +const columnChartTheme = { + background: { color: 'transparent' }, + chartMargins: { + left: 0, + right: 0, + top: 0, + bottom: 1, + }, + chartPaddings: { + left: 0, + right: 0, + top: 0, + bottom: 0, + }, + scales: { barsPadding: 0.1 }, +}; +export const ColumnChart: FC = ({ + chartData, + columnType, + dataTestSubj, + hideLabel, + maxChartColumns, +}) => { + const { data, legendText, xScaleType } = useColumnChart(chartData, columnType, maxChartColumns); + + return ( +
+ {!isUnsupportedChartData(chartData) && data.length > 0 && ( +
+ + + d.datum.color} + data={data} + /> + +
+ )} +
+ {legendText} +
+ {!hideLabel &&
{columnType.id}
} +
+ ); +}; diff --git a/x-pack/plugins/file_data_visualizer/public/application/components/stats_table/components/field_data_row/distinct_values.tsx b/x-pack/plugins/file_data_visualizer/public/application/components/stats_table/components/field_data_row/distinct_values.tsx new file mode 100644 index 0000000000000..92e0d1a16229f --- /dev/null +++ b/x-pack/plugins/file_data_visualizer/public/application/components/stats_table/components/field_data_row/distinct_values.tsx @@ -0,0 +1,24 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import { EuiFlexGroup, EuiFlexItem, EuiIcon, EuiText } from '@elastic/eui'; + +import React from 'react'; + +export const DistinctValues = ({ cardinality }: { cardinality?: number }) => { + if (cardinality === undefined) return null; + return ( + + + + + + {cardinality} + + + ); +}; diff --git a/x-pack/plugins/file_data_visualizer/public/application/components/stats_table/components/field_data_row/document_stats.tsx b/x-pack/plugins/file_data_visualizer/public/application/components/stats_table/components/field_data_row/document_stats.tsx new file mode 100644 index 0000000000000..7d0bda6ac47ea --- /dev/null +++ b/x-pack/plugins/file_data_visualizer/public/application/components/stats_table/components/field_data_row/document_stats.tsx @@ -0,0 +1,33 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import { EuiFlexGroup, EuiFlexItem, EuiIcon, EuiText } from '@elastic/eui'; + +import React from 'react'; +import type { FieldDataRowProps } from '../../types/field_data_row'; +import { roundToDecimalPlace } from '../../../utils'; + +export const DocumentStat = ({ config }: FieldDataRowProps) => { + const { stats } = config; + if (stats === undefined) return null; + + const { count, sampleCount } = stats; + if (count === undefined || sampleCount === undefined) return null; + + const docsPercent = roundToDecimalPlace((count / sampleCount) * 100); + + return ( + + + + + + {count} ({docsPercent}%) + + + ); +}; diff --git a/x-pack/plugins/file_data_visualizer/public/application/components/stats_table/components/field_data_row/field_histograms.ts b/x-pack/plugins/file_data_visualizer/public/application/components/stats_table/components/field_data_row/field_histograms.ts new file mode 100644 index 0000000000000..22b0195a579ac --- /dev/null +++ b/x-pack/plugins/file_data_visualizer/public/application/components/stats_table/components/field_data_row/field_histograms.ts @@ -0,0 +1,68 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +export interface NumericDataItem { + key: number; + key_as_string?: string | number; + doc_count: number; +} + +export interface NumericChartData { + data: NumericDataItem[]; + id: string; + interval: number; + stats: [number, number]; + type: 'numeric'; +} + +export const isNumericChartData = (arg: any): arg is NumericChartData => { + return ( + typeof arg === 'object' && + arg.hasOwnProperty('data') && + arg.hasOwnProperty('id') && + arg.hasOwnProperty('interval') && + arg.hasOwnProperty('stats') && + arg.hasOwnProperty('type') && + arg.type === 'numeric' + ); +}; + +export interface OrdinalDataItem { + key: string; + key_as_string?: string; + doc_count: number; +} + +export interface OrdinalChartData { + cardinality: number; + data: OrdinalDataItem[]; + id: string; + type: 'ordinal' | 'boolean'; +} + +export const isOrdinalChartData = (arg: any): arg is OrdinalChartData => { + return ( + typeof arg === 'object' && + arg.hasOwnProperty('data') && + arg.hasOwnProperty('cardinality') && + arg.hasOwnProperty('id') && + arg.hasOwnProperty('type') && + (arg.type === 'ordinal' || arg.type === 'boolean') + ); +}; + +export interface UnsupportedChartData { + id: string; + type: 'unsupported'; +} + +export const isUnsupportedChartData = (arg: any): arg is UnsupportedChartData => { + return typeof arg === 'object' && arg.hasOwnProperty('type') && arg.type === 'unsupported'; +}; + +export type ChartDataItem = NumericDataItem | OrdinalDataItem; +export type ChartData = NumericChartData | OrdinalChartData | UnsupportedChartData; diff --git a/x-pack/plugins/file_data_visualizer/public/application/components/stats_table/components/field_data_row/index.ts b/x-pack/plugins/file_data_visualizer/public/application/components/stats_table/components/field_data_row/index.ts new file mode 100644 index 0000000000000..e4c0cc80eeb35 --- /dev/null +++ b/x-pack/plugins/file_data_visualizer/public/application/components/stats_table/components/field_data_row/index.ts @@ -0,0 +1,8 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +export { BooleanContentPreview } from './boolean_content_preview'; diff --git a/x-pack/plugins/file_data_visualizer/public/application/components/stats_table/components/field_data_row/number_content_preview.tsx b/x-pack/plugins/file_data_visualizer/public/application/components/stats_table/components/field_data_row/number_content_preview.tsx new file mode 100644 index 0000000000000..00150bdfe8b7a --- /dev/null +++ b/x-pack/plugins/file_data_visualizer/public/application/components/stats_table/components/field_data_row/number_content_preview.tsx @@ -0,0 +1,78 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import React, { FC, useEffect, useState } from 'react'; +import { EuiFlexGroup, EuiFlexItem, EuiSpacer } from '@elastic/eui'; +import classNames from 'classnames'; +import { + MetricDistributionChart, + MetricDistributionChartData, + buildChartDataFromStats, +} from '../metric_distribution_chart'; +import { FieldVisConfig } from '../../types'; +import { kibanaFieldFormat, formatSingleValue } from '../../../utils'; + +const METRIC_DISTRIBUTION_CHART_WIDTH = 150; +const METRIC_DISTRIBUTION_CHART_HEIGHT = 80; + +export interface NumberContentPreviewProps { + config: FieldVisConfig; +} + +export const IndexBasedNumberContentPreview: FC = ({ config }) => { + const { stats, fieldFormat, fieldName } = config; + const defaultChartData: MetricDistributionChartData[] = []; + const [distributionChartData, setDistributionChartData] = useState(defaultChartData); + const [legendText, setLegendText] = useState<{ min: number; max: number } | undefined>(); + const dataTestSubj = `mlDataGridChart-${fieldName}`; + useEffect(() => { + const chartData = buildChartDataFromStats(stats, METRIC_DISTRIBUTION_CHART_WIDTH); + if ( + Array.isArray(chartData) && + chartData[0].x !== undefined && + chartData[chartData.length - 1].x !== undefined + ) { + setDistributionChartData(chartData); + setLegendText({ + min: formatSingleValue(chartData[0].x), + max: formatSingleValue(chartData[chartData.length - 1].x), + }); + } + // eslint-disable-next-line react-hooks/exhaustive-deps + }, []); + + return ( +
+
+ +
+
+ {legendText && ( + <> + + + + {kibanaFieldFormat(legendText.min, fieldFormat)} + + + {kibanaFieldFormat(legendText.max, fieldFormat)} + + + + )} +
+
+ ); +}; diff --git a/x-pack/plugins/file_data_visualizer/public/application/components/stats_table/components/field_data_row/top_values_preview.tsx b/x-pack/plugins/file_data_visualizer/public/application/components/stats_table/components/field_data_row/top_values_preview.tsx new file mode 100644 index 0000000000000..63b15fdf30b3b --- /dev/null +++ b/x-pack/plugins/file_data_visualizer/public/application/components/stats_table/components/field_data_row/top_values_preview.tsx @@ -0,0 +1,44 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import React, { FC } from 'react'; +import { EuiDataGridColumn } from '@elastic/eui'; +import { ChartData, OrdinalDataItem } from './field_histograms'; +import { ColumnChart } from './column_chart'; +import type { FieldDataRowProps } from '../../types/field_data_row'; + +export const TopValuesPreview: FC = ({ config }) => { + const { stats } = config; + if (stats === undefined) return null; + const { topValues, cardinality } = stats; + if (cardinality === undefined || topValues === undefined || config.fieldName === undefined) + return null; + + const data: OrdinalDataItem[] = topValues.map((d) => ({ + ...d, + key: d.key.toString(), + })); + const chartData: ChartData = { + cardinality, + data, + id: config.fieldName, + type: 'ordinal', + }; + const columnType: EuiDataGridColumn = { + id: config.fieldName, + schema: undefined, + }; + return ( + + ); +}; diff --git a/x-pack/plugins/file_data_visualizer/public/application/components/stats_table/components/field_data_row/use_column_chart.test.tsx b/x-pack/plugins/file_data_visualizer/public/application/components/stats_table/components/field_data_row/use_column_chart.test.tsx new file mode 100644 index 0000000000000..2c92c366b2d73 --- /dev/null +++ b/x-pack/plugins/file_data_visualizer/public/application/components/stats_table/components/field_data_row/use_column_chart.test.tsx @@ -0,0 +1,177 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import React from 'react'; +import { render } from '@testing-library/react'; +import { renderHook } from '@testing-library/react-hooks'; +import '@testing-library/jest-dom/extend-expect'; + +import { KBN_FIELD_TYPES } from '../../../../../../../../../src/plugins/data/public'; + +import { + isNumericChartData, + isOrdinalChartData, + isUnsupportedChartData, + NumericChartData, + OrdinalChartData, + UnsupportedChartData, +} from './field_histograms'; + +import { getFieldType, getLegendText, getXScaleType, useColumnChart } from './use_column_chart'; + +describe('getFieldType()', () => { + it('should return the Kibana field type for a given EUI data grid schema', () => { + expect(getFieldType('text')).toBe('string'); + expect(getFieldType('datetime')).toBe('date'); + expect(getFieldType('numeric')).toBe('number'); + expect(getFieldType('boolean')).toBe('boolean'); + expect(getFieldType('json')).toBe('object'); + expect(getFieldType('non-aggregatable')).toBe(undefined); + }); +}); + +describe('getXScaleType()', () => { + it('should return the corresponding x axis scale type for a Kibana field type', () => { + expect(getXScaleType(KBN_FIELD_TYPES.BOOLEAN)).toBe('ordinal'); + expect(getXScaleType(KBN_FIELD_TYPES.IP)).toBe('ordinal'); + expect(getXScaleType(KBN_FIELD_TYPES.STRING)).toBe('ordinal'); + expect(getXScaleType(KBN_FIELD_TYPES.DATE)).toBe('time'); + expect(getXScaleType(KBN_FIELD_TYPES.NUMBER)).toBe('linear'); + expect(getXScaleType(undefined)).toBe(undefined); + }); +}); + +const validNumericChartData: NumericChartData = { + data: [], + id: 'the-id', + interval: 10, + stats: [0, 0], + type: 'numeric', +}; + +const validOrdinalChartData: OrdinalChartData = { + cardinality: 10, + data: [], + id: 'the-id', + type: 'ordinal', +}; + +const validUnsupportedChartData: UnsupportedChartData = { id: 'the-id', type: 'unsupported' }; + +describe('isNumericChartData()', () => { + it('should return true for valid numeric chart data', () => { + expect(isNumericChartData(validNumericChartData)).toBe(true); + }); + it('should return false for invalid numeric chart data', () => { + expect(isNumericChartData(undefined)).toBe(false); + expect(isNumericChartData({})).toBe(false); + expect(isNumericChartData({ data: [] })).toBe(false); + expect(isNumericChartData(validOrdinalChartData)).toBe(false); + expect(isNumericChartData(validUnsupportedChartData)).toBe(false); + }); +}); + +describe('isOrdinalChartData()', () => { + it('should return true for valid ordinal chart data', () => { + expect(isOrdinalChartData(validOrdinalChartData)).toBe(true); + }); + it('should return false for invalid ordinal chart data', () => { + expect(isOrdinalChartData(undefined)).toBe(false); + expect(isOrdinalChartData({})).toBe(false); + expect(isOrdinalChartData({ data: [] })).toBe(false); + expect(isOrdinalChartData(validNumericChartData)).toBe(false); + expect(isOrdinalChartData(validUnsupportedChartData)).toBe(false); + }); +}); + +describe('isUnsupportedChartData()', () => { + it('should return true for unsupported chart data', () => { + expect(isUnsupportedChartData(validUnsupportedChartData)).toBe(true); + }); + it('should return false for invalid unsupported chart data', () => { + expect(isUnsupportedChartData(undefined)).toBe(false); + expect(isUnsupportedChartData({})).toBe(false); + expect(isUnsupportedChartData({ data: [] })).toBe(false); + expect(isUnsupportedChartData(validNumericChartData)).toBe(false); + expect(isUnsupportedChartData(validOrdinalChartData)).toBe(false); + }); +}); + +describe('getLegendText()', () => { + it('should return the chart legend text for unsupported chart types', () => { + expect(getLegendText(validUnsupportedChartData)).toBe('Chart not supported.'); + }); + it('should return the chart legend text for empty datasets', () => { + expect(getLegendText(validNumericChartData)).toBe('0 documents contain field.'); + }); + it('should return the chart legend text for boolean chart types', () => { + const { getByText } = render( + <> + {getLegendText({ + cardinality: 2, + data: [ + { key: 'true', key_as_string: 'true', doc_count: 10 }, + { key: 'false', key_as_string: 'false', doc_count: 20 }, + ], + id: 'the-id', + type: 'boolean', + })} + + ); + expect(getByText('true')).toBeInTheDocument(); + expect(getByText('false')).toBeInTheDocument(); + }); + it('should return the chart legend text for ordinal chart data with less than max categories', () => { + expect(getLegendText({ ...validOrdinalChartData, data: [{ key: 'cat', doc_count: 10 }] })).toBe( + '10 categories' + ); + }); + it('should return the chart legend text for ordinal chart data with more than max categories', () => { + expect( + getLegendText({ + ...validOrdinalChartData, + cardinality: 30, + data: [{ key: 'cat', doc_count: 10 }], + }) + ).toBe('top 20 of 30 categories'); + }); + it('should return the chart legend text for numeric datasets', () => { + expect( + getLegendText({ + ...validNumericChartData, + data: [{ key: 1, doc_count: 10 }], + stats: [1, 100], + }) + ).toBe('1 - 100'); + expect( + getLegendText({ + ...validNumericChartData, + data: [{ key: 1, doc_count: 10 }], + stats: [100, 100], + }) + ).toBe('100'); + expect( + getLegendText({ + ...validNumericChartData, + data: [{ key: 1, doc_count: 10 }], + stats: [1.2345, 6.3456], + }) + ).toBe('1.23 - 6.35'); + }); +}); + +describe('useColumnChart()', () => { + it('should return the column chart hook data', () => { + const { result } = renderHook(() => + useColumnChart(validNumericChartData, { id: 'the-id', schema: 'numeric' }) + ); + + expect(result.current.data).toStrictEqual([]); + expect(result.current.legendText).toBe('0 documents contain field.'); + expect(result.current.xScaleType).toBe('linear'); + }); +}); diff --git a/x-pack/plugins/file_data_visualizer/public/application/components/stats_table/components/field_data_row/use_column_chart.tsx b/x-pack/plugins/file_data_visualizer/public/application/components/stats_table/components/field_data_row/use_column_chart.tsx new file mode 100644 index 0000000000000..bd1df7f32c375 --- /dev/null +++ b/x-pack/plugins/file_data_visualizer/public/application/components/stats_table/components/field_data_row/use_column_chart.tsx @@ -0,0 +1,206 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import moment from 'moment'; +import { BehaviorSubject } from 'rxjs'; +import React from 'react'; + +import useObservable from 'react-use/lib/useObservable'; + +import { euiPaletteColorBlind, EuiDataGridColumn } from '@elastic/eui'; + +import { i18n } from '@kbn/i18n'; + +import { KBN_FIELD_TYPES } from '../../../../../../../../../src/plugins/data/public'; + +import { + isNumericChartData, + isOrdinalChartData, + ChartData, + ChartDataItem, + NumericDataItem, + OrdinalDataItem, +} from './field_histograms'; + +const NON_AGGREGATABLE = 'non-aggregatable'; + +export const hoveredRow$ = new BehaviorSubject(null); + +export const BAR_COLOR = euiPaletteColorBlind()[0]; +const BAR_COLOR_BLUR = euiPaletteColorBlind({ rotations: 2 })[10]; +const MAX_CHART_COLUMNS = 20; + +type XScaleType = 'ordinal' | 'time' | 'linear' | undefined; +export const getXScaleType = (kbnFieldType: KBN_FIELD_TYPES | undefined): XScaleType => { + switch (kbnFieldType) { + case KBN_FIELD_TYPES.BOOLEAN: + case KBN_FIELD_TYPES.IP: + case KBN_FIELD_TYPES.STRING: + return 'ordinal'; + case KBN_FIELD_TYPES.DATE: + return 'time'; + case KBN_FIELD_TYPES.NUMBER: + return 'linear'; + } +}; + +export const getFieldType = (schema: EuiDataGridColumn['schema']): KBN_FIELD_TYPES | undefined => { + if (schema === NON_AGGREGATABLE) { + return undefined; + } + + let fieldType: KBN_FIELD_TYPES; + + switch (schema) { + case 'datetime': + fieldType = KBN_FIELD_TYPES.DATE; + break; + case 'numeric': + fieldType = KBN_FIELD_TYPES.NUMBER; + break; + case 'boolean': + fieldType = KBN_FIELD_TYPES.BOOLEAN; + break; + case 'json': + fieldType = KBN_FIELD_TYPES.OBJECT; + break; + default: + fieldType = KBN_FIELD_TYPES.STRING; + } + + return fieldType; +}; + +type LegendText = string | JSX.Element; +export const getLegendText = ( + chartData: ChartData, + maxChartColumns = MAX_CHART_COLUMNS +): LegendText => { + if (chartData.type === 'unsupported') { + return i18n.translate('xpack.fileDataVisualizer.dataGridChart.histogramNotAvailable', { + defaultMessage: 'Chart not supported.', + }); + } + + if (chartData.data.length === 0) { + return i18n.translate('xpack.fileDataVisualizer.dataGridChart.notEnoughData', { + defaultMessage: `0 documents contain field.`, + }); + } + + if (chartData.type === 'boolean') { + return ( + + + + {chartData.data[0] !== undefined && } + {chartData.data[1] !== undefined && } + + +
{chartData.data[0].key_as_string}{chartData.data[1].key_as_string}
+ ); + } + + if (isOrdinalChartData(chartData) && chartData.cardinality <= maxChartColumns) { + return i18n.translate('xpack.fileDataVisualizer.dataGridChart.singleCategoryLegend', { + defaultMessage: `{cardinality, plural, one {# category} other {# categories}}`, + values: { cardinality: chartData.cardinality }, + }); + } + + if (isOrdinalChartData(chartData) && chartData.cardinality > maxChartColumns) { + return i18n.translate('xpack.fileDataVisualizer.dataGridChart.topCategoriesLegend', { + defaultMessage: `top {maxChartColumns} of {cardinality} categories`, + values: { cardinality: chartData.cardinality, maxChartColumns }, + }); + } + + if (isNumericChartData(chartData)) { + const fromValue = Math.round(chartData.stats[0] * 100) / 100; + const toValue = Math.round(chartData.stats[1] * 100) / 100; + + return fromValue !== toValue ? `${fromValue} - ${toValue}` : '' + fromValue; + } + + return ''; +}; + +interface ColumnChart { + data: ChartDataItem[]; + legendText: LegendText; + xScaleType: XScaleType; +} + +export const useColumnChart = ( + chartData: ChartData, + columnType: EuiDataGridColumn, + maxChartColumns?: number +): ColumnChart => { + const fieldType = getFieldType(columnType.schema); + + const hoveredRow = useObservable(hoveredRow$); + + const xScaleType = getXScaleType(fieldType); + + const getColor = (d: ChartDataItem) => { + if (hoveredRow === undefined || hoveredRow === null) { + return BAR_COLOR; + } + + if ( + isOrdinalChartData(chartData) && + xScaleType === 'ordinal' && + hoveredRow._source[columnType.id] === d.key + ) { + return BAR_COLOR; + } + + if ( + isNumericChartData(chartData) && + xScaleType === 'linear' && + hoveredRow._source[columnType.id] >= +d.key && + hoveredRow._source[columnType.id] < +d.key + chartData.interval + ) { + return BAR_COLOR; + } + + if ( + isNumericChartData(chartData) && + xScaleType === 'time' && + moment(hoveredRow._source[columnType.id]).unix() * 1000 >= +d.key && + moment(hoveredRow._source[columnType.id]).unix() * 1000 < +d.key + chartData.interval + ) { + return BAR_COLOR; + } + + return BAR_COLOR_BLUR; + }; + + let data: ChartDataItem[] = []; + + // The if/else if/else is a work-around because `.map()` doesn't work with union types. + // See TS Caveats for details: https://www.typescriptlang.org/docs/handbook/release-notes/typescript-3-3.html#caveats + if (isOrdinalChartData(chartData)) { + data = chartData.data.map((d: OrdinalDataItem) => ({ + ...d, + key_as_string: d.key_as_string ?? d.key, + color: getColor(d), + })); + } else if (isNumericChartData(chartData)) { + data = chartData.data.map((d: NumericDataItem) => ({ + ...d, + key_as_string: d.key_as_string || d.key, + color: getColor(d), + })); + } + + return { + data, + legendText: getLegendText(chartData, maxChartColumns), + xScaleType, + }; +}; diff --git a/x-pack/plugins/file_data_visualizer/public/application/components/stats_table/components/metric_distribution_chart/index.ts b/x-pack/plugins/file_data_visualizer/public/application/components/stats_table/components/metric_distribution_chart/index.ts new file mode 100644 index 0000000000000..72947f2953cb8 --- /dev/null +++ b/x-pack/plugins/file_data_visualizer/public/application/components/stats_table/components/metric_distribution_chart/index.ts @@ -0,0 +1,9 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +export { MetricDistributionChart, MetricDistributionChartData } from './metric_distribution_chart'; +export { buildChartDataFromStats } from './metric_distribution_chart_data_builder'; diff --git a/x-pack/plugins/file_data_visualizer/public/application/components/stats_table/components/metric_distribution_chart/metric_distribution_chart.tsx b/x-pack/plugins/file_data_visualizer/public/application/components/stats_table/components/metric_distribution_chart/metric_distribution_chart.tsx new file mode 100644 index 0000000000000..caa560488d499 --- /dev/null +++ b/x-pack/plugins/file_data_visualizer/public/application/components/stats_table/components/metric_distribution_chart/metric_distribution_chart.tsx @@ -0,0 +1,108 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import React, { FC } from 'react'; + +import { i18n } from '@kbn/i18n'; + +import { + AreaSeries, + Axis, + Chart, + CurveType, + Position, + ScaleType, + Settings, + TooltipValue, + TooltipValueFormatter, +} from '@elastic/charts'; + +import { MetricDistributionChartTooltipHeader } from './metric_distribution_chart_tooltip_header'; +import { kibanaFieldFormat } from '../../../utils'; +import { useDataVizChartTheme } from '../../hooks'; + +interface ChartTooltipValue extends TooltipValue { + skipHeader?: boolean; +} + +export interface MetricDistributionChartData { + x: number; + y: number; + dataMin: number; + dataMax: number; + percent: number; +} + +interface Props { + width: number; + height: number; + chartData: MetricDistributionChartData[]; + fieldFormat?: any; // Kibana formatter for field being viewed + hideXAxis?: boolean; +} + +const SPEC_ID = 'metric_distribution'; + +export const MetricDistributionChart: FC = ({ + width, + height, + chartData, + fieldFormat, + hideXAxis, +}) => { + // This value is shown to label the y axis values in the tooltip. + // Ideally we wouldn't show these values at all in the tooltip, + // but this is not yet possible with Elastic charts. + const seriesName = i18n.translate( + 'xpack.fileDataVisualizer.fieldDataCard.metricDistributionChart.seriesName', + { + defaultMessage: 'distribution', + } + ); + + const theme = useDataVizChartTheme(); + + const headerFormatter: TooltipValueFormatter = (tooltipData: ChartTooltipValue) => { + const xValue = tooltipData.value; + const chartPoint: MetricDistributionChartData | undefined = chartData.find( + (data) => data.x === xValue + ); + + return ( + + ); + }; + + return ( +
+ + + kibanaFieldFormat(d, fieldFormat)} + hide={hideXAxis === true} + /> + d.toFixed(3)} hide={true} /> + 0 ? chartData : [{ x: 0, y: 0 }]} + curve={CurveType.CURVE_STEP_AFTER} + /> + +
+ ); +}; diff --git a/x-pack/plugins/file_data_visualizer/public/application/components/stats_table/components/metric_distribution_chart/metric_distribution_chart_data_builder.tsx b/x-pack/plugins/file_data_visualizer/public/application/components/stats_table/components/metric_distribution_chart/metric_distribution_chart_data_builder.tsx new file mode 100644 index 0000000000000..a65b6bdc7458f --- /dev/null +++ b/x-pack/plugins/file_data_visualizer/public/application/components/stats_table/components/metric_distribution_chart/metric_distribution_chart_data_builder.tsx @@ -0,0 +1,156 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +const METRIC_DISTRIBUTION_CHART_MIN_BAR_WIDTH = 3; // Minimum bar width, in pixels. +const METRIC_DISTRIBUTION_CHART_MAX_BAR_HEIGHT_FACTOR = 20; // Max bar height relative to median bar height. + +import { MetricDistributionChartData } from './metric_distribution_chart'; + +interface DistributionPercentile { + minValue: number; + maxValue: number; + percent: number; +} + +interface DistributionChartBar { + x0: number; + x1: number; + y: number; + dataMin: number; + dataMax: number; + percent: number; + isMinWidth: boolean; +} + +export function buildChartDataFromStats( + stats: any, + chartWidth: number +): MetricDistributionChartData[] { + // Process the raw percentiles data so it is in a suitable format for plotting in the metric distribution chart. + let chartData: MetricDistributionChartData[] = []; + + const distribution = stats.distribution; + if (distribution === undefined) { + return chartData; + } + + const percentiles: DistributionPercentile[] = distribution.percentiles; + if (percentiles.length === 0) { + return chartData; + } + + // Adjust x axis min and max if there is a single bar. + const minX = percentiles[0].minValue; + const maxX = percentiles[percentiles.length - 1].maxValue; + + let xAxisMin: number = minX; + let xAxisMax: number = maxX; + if (maxX === minX) { + if (minX !== 0) { + xAxisMin = 0; + xAxisMax = 2 * minX; + } else { + xAxisMax = 1; + } + } + + // Adjust the right hand x coordinates so that each bar is at least METRIC_DISTRIBUTION_CHART_MIN_BAR_WIDTH. + const minBarWidth = + (METRIC_DISTRIBUTION_CHART_MIN_BAR_WIDTH / chartWidth) * (xAxisMax - xAxisMin); + const processedData: DistributionChartBar[] = []; + let lastBar: DistributionChartBar; + percentiles.forEach((data, index) => { + if (index === 0) { + const bar: DistributionChartBar = { + x0: data.minValue, + x1: Math.max(data.minValue + minBarWidth, data.maxValue), + y: 0, // Set below + dataMin: data.minValue, + dataMax: data.maxValue, + percent: data.percent, + isMinWidth: false, + }; + + // Scale the height of the bar according to the range of data values in the bar. + bar.y = + (data.percent / (bar.x1 - bar.x0)) * + Math.max(1, minBarWidth / Math.max(data.maxValue - data.minValue, 0.5 * minBarWidth)); + bar.isMinWidth = data.maxValue <= data.minValue + minBarWidth; + processedData.push(bar); + lastBar = bar; + } else { + if (lastBar.isMinWidth === false || data.maxValue > lastBar.x1) { + const bar = { + x0: lastBar.x1, + x1: Math.max(lastBar.x1 + minBarWidth, data.maxValue), + y: 0, // Set below + dataMin: data.minValue, + dataMax: data.maxValue, + percent: data.percent, + isMinWidth: false, + }; + + // Scale the height of the bar according to the range of data values in the bar. + bar.y = + (data.percent / (bar.x1 - bar.x0)) * + Math.max(1, minBarWidth / Math.max(data.maxValue - data.minValue, 0.5 * minBarWidth)); + bar.isMinWidth = data.maxValue <= lastBar.x1 + minBarWidth; + processedData.push(bar); + lastBar = bar; + } else { + // Combine bars which are less than minBarWidth apart. + lastBar.percent = lastBar.percent + data.percent; + lastBar.y = lastBar.percent / (lastBar.x1 - lastBar.x0); + lastBar.dataMax = data.maxValue; + } + } + }); + + if (maxX !== minX) { + xAxisMax = processedData[processedData.length - 1].x1; + } + + // Adjust the maximum bar height to be (METRIC_DISTRIBUTION_CHART_MAX_BAR_HEIGHT_FACTOR * median bar height). + let barHeights = processedData.map((data) => data.y); + barHeights = barHeights.sort((a, b) => a - b); + + let maxBarHeight = 0; + const processedDataLength = processedData.length; + if (Math.abs(processedDataLength % 2) === 1) { + maxBarHeight = + METRIC_DISTRIBUTION_CHART_MAX_BAR_HEIGHT_FACTOR * + barHeights[Math.floor(processedDataLength / 2)]; + } else { + maxBarHeight = + (METRIC_DISTRIBUTION_CHART_MAX_BAR_HEIGHT_FACTOR * + (barHeights[Math.floor(processedDataLength / 2) - 1] + + barHeights[Math.floor(processedDataLength / 2)])) / + 2; + } + + processedData.forEach((data) => { + data.y = Math.min(data.y, maxBarHeight); + }); + + // Convert the data to the format used by the chart. + chartData = processedData.map((data) => { + const { x0, y, dataMin, dataMax, percent } = data; + return { x: x0, y, dataMin, dataMax, percent }; + }); + + // Add a final point to drop the curve back to the y axis. + const last = processedData[processedData.length - 1]; + chartData.push({ + x: last.x1, + y: 0, + dataMin: last.dataMin, + dataMax: last.dataMax, + percent: last.percent, + }); + + return chartData; +} diff --git a/x-pack/plugins/file_data_visualizer/public/application/components/stats_table/components/metric_distribution_chart/metric_distribution_chart_tooltip_header.tsx b/x-pack/plugins/file_data_visualizer/public/application/components/stats_table/components/metric_distribution_chart/metric_distribution_chart_tooltip_header.tsx new file mode 100644 index 0000000000000..9fd613ac96b8e --- /dev/null +++ b/x-pack/plugins/file_data_visualizer/public/application/components/stats_table/components/metric_distribution_chart/metric_distribution_chart_tooltip_header.tsx @@ -0,0 +1,54 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import React, { FC } from 'react'; + +import { FormattedMessage } from '@kbn/i18n/react'; + +import { MetricDistributionChartData } from './metric_distribution_chart'; +import { kibanaFieldFormat } from '../../../utils'; + +interface Props { + chartPoint: MetricDistributionChartData | undefined; + maxWidth: number; + fieldFormat?: any; // Kibana formatter for field being viewed +} + +export const MetricDistributionChartTooltipHeader: FC = ({ + chartPoint, + maxWidth, + fieldFormat, +}) => { + if (chartPoint === undefined) { + return null; + } + + return ( +
+ {chartPoint.dataMax > chartPoint.dataMin ? ( + + ) : ( + + )} +
+ ); +}; diff --git a/x-pack/plugins/file_data_visualizer/public/application/components/stats_table/data_visualizer_stats_table.tsx b/x-pack/plugins/file_data_visualizer/public/application/components/stats_table/data_visualizer_stats_table.tsx new file mode 100644 index 0000000000000..bfa40c487a2ac --- /dev/null +++ b/x-pack/plugins/file_data_visualizer/public/application/components/stats_table/data_visualizer_stats_table.tsx @@ -0,0 +1,284 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import React, { useMemo, useState } from 'react'; + +import { + CENTER_ALIGNMENT, + EuiBasicTableColumn, + EuiButtonIcon, + EuiFlexItem, + EuiIcon, + EuiInMemoryTable, + EuiText, + HorizontalAlignment, + LEFT_ALIGNMENT, + RIGHT_ALIGNMENT, +} from '@elastic/eui'; +import { i18n } from '@kbn/i18n'; +import { EuiTableComputedColumnType } from '@elastic/eui/src/components/basic_table/table_types'; +import { JOB_FIELD_TYPES, JobFieldType, DataVisualizerTableState } from '../../../../common'; +import { FieldTypeIcon } from '../field_type_icon'; +import { DocumentStat } from './components/field_data_row/document_stats'; +import { DistinctValues } from './components/field_data_row/distinct_values'; +import { IndexBasedNumberContentPreview } from './components/field_data_row/number_content_preview'; + +import { useTableSettings } from './use_table_settings'; +import { TopValuesPreview } from './components/field_data_row/top_values_preview'; +import { + FieldVisConfig, + FileBasedFieldVisConfig, + isIndexBasedFieldVisConfig, +} from './types/field_vis_config'; +import { FileBasedNumberContentPreview } from '../field_data_row'; +import { BooleanContentPreview } from './components/field_data_row'; + +const FIELD_NAME = 'fieldName'; + +export type ItemIdToExpandedRowMap = Record; + +type DataVisualizerTableItem = FieldVisConfig | FileBasedFieldVisConfig; +interface DataVisualizerTableProps { + items: T[]; + pageState: DataVisualizerTableState; + updatePageState: (update: DataVisualizerTableState) => void; + getItemIdToExpandedRowMap: (itemIds: string[], items: T[]) => ItemIdToExpandedRowMap; + extendedColumns?: Array>; +} + +export const DataVisualizerTable = ({ + items, + pageState, + updatePageState, + getItemIdToExpandedRowMap, + extendedColumns, +}: DataVisualizerTableProps) => { + const [expandedRowItemIds, setExpandedRowItemIds] = useState([]); + const [expandAll, toggleExpandAll] = useState(false); + + const { onTableChange, pagination, sorting } = useTableSettings( + items, + pageState, + updatePageState + ); + const showDistributions: boolean = + ('showDistributions' in pageState && pageState.showDistributions) ?? true; + const toggleShowDistribution = () => { + updatePageState({ + ...pageState, + showDistributions: !showDistributions, + }); + }; + + function toggleDetails(item: DataVisualizerTableItem) { + if (item.fieldName === undefined) return; + const index = expandedRowItemIds.indexOf(item.fieldName); + if (index !== -1) { + expandedRowItemIds.splice(index, 1); + } else { + expandedRowItemIds.push(item.fieldName); + } + + // spread to a new array otherwise the component wouldn't re-render + setExpandedRowItemIds([...expandedRowItemIds]); + } + + const columns = useMemo(() => { + const expanderColumn: EuiTableComputedColumnType = { + name: ( + toggleExpandAll(!expandAll)} + aria-label={ + !expandAll + ? i18n.translate( + 'xpack.fileDataVisualizer.datavisualizer.dataGrid.expandDetailsForAllAriaLabel', + { + defaultMessage: 'Expand details for all fields', + } + ) + : i18n.translate( + 'xpack.fileDataVisualizer.datavisualizer.dataGrid.collapseDetailsForAllAriaLabel', + { + defaultMessage: 'Collapse details for all fields', + } + ) + } + iconType={expandAll ? 'arrowUp' : 'arrowDown'} + /> + ), + align: RIGHT_ALIGNMENT, + width: '40px', + isExpander: true, + render: (item: DataVisualizerTableItem) => { + if (item.fieldName === undefined) return null; + const direction = expandedRowItemIds.includes(item.fieldName) ? 'arrowUp' : 'arrowDown'; + return ( + toggleDetails(item)} + aria-label={ + expandedRowItemIds.includes(item.fieldName) + ? i18n.translate('xpack.fileDataVisualizer.datavisualizer.dataGrid.rowCollapse', { + defaultMessage: 'Hide details for {fieldName}', + values: { fieldName: item.fieldName }, + }) + : i18n.translate('xpack.fileDataVisualizer.datavisualizer.dataGrid.rowExpand', { + defaultMessage: 'Show details for {fieldName}', + values: { fieldName: item.fieldName }, + }) + } + iconType={direction} + /> + ); + }, + 'data-test-subj': 'mlDataVisualizerTableColumnDetailsToggle', + }; + + const baseColumns = [ + expanderColumn, + { + field: 'type', + name: i18n.translate('xpack.fileDataVisualizer.datavisualizer.dataGrid.typeColumnName', { + defaultMessage: 'Type', + }), + render: (fieldType: JobFieldType) => { + return ; + }, + width: '75px', + sortable: true, + align: CENTER_ALIGNMENT as HorizontalAlignment, + 'data-test-subj': 'mlDataVisualizerTableColumnType', + }, + { + field: 'fieldName', + name: i18n.translate('xpack.fileDataVisualizer.datavisualizer.dataGrid.nameColumnName', { + defaultMessage: 'Name', + }), + sortable: true, + truncateText: true, + render: (fieldName: string) => ( + + {fieldName} + + ), + align: LEFT_ALIGNMENT as HorizontalAlignment, + 'data-test-subj': 'mlDataVisualizerTableColumnName', + }, + { + field: 'docCount', + name: i18n.translate( + 'xpack.fileDataVisualizer.datavisualizer.dataGrid.documentsCountColumnName', + { + defaultMessage: 'Documents (%)', + } + ), + render: (value: number | undefined, item: DataVisualizerTableItem) => ( + + ), + sortable: (item: DataVisualizerTableItem) => item?.stats?.count, + align: LEFT_ALIGNMENT as HorizontalAlignment, + 'data-test-subj': 'mlDataVisualizerTableColumnDocumentsCount', + }, + { + field: 'stats.cardinality', + name: i18n.translate( + 'xpack.fileDataVisualizer.datavisualizer.dataGrid.distinctValuesColumnName', + { + defaultMessage: 'Distinct values', + } + ), + render: (cardinality?: number) => , + sortable: true, + align: LEFT_ALIGNMENT as HorizontalAlignment, + 'data-test-subj': 'mlDataVisualizerTableColumnDistinctValues', + }, + { + name: ( +
+ + {i18n.translate( + 'xpack.fileDataVisualizer.datavisualizer.dataGrid.distributionsColumnName', + { + defaultMessage: 'Distributions', + } + )} + toggleShowDistribution()} + aria-label={i18n.translate( + 'xpack.fileDataVisualizer.datavisualizer.dataGrid.showDistributionsAriaLabel', + { + defaultMessage: 'Show distributions', + } + )} + /> +
+ ), + render: (item: DataVisualizerTableItem) => { + if (item === undefined || showDistributions === false) return null; + if ( + (item.type === JOB_FIELD_TYPES.KEYWORD || item.type === JOB_FIELD_TYPES.IP) && + item.stats?.topValues !== undefined + ) { + return ; + } + + if (item.type === JOB_FIELD_TYPES.NUMBER) { + if (isIndexBasedFieldVisConfig(item) && item.stats?.distribution !== undefined) { + return ; + } else { + return ; + } + } + + if (item.type === JOB_FIELD_TYPES.BOOLEAN) { + return ; + } + + return null; + }, + align: LEFT_ALIGNMENT as HorizontalAlignment, + 'data-test-subj': 'mlDataVisualizerTableColumnDistribution', + }, + ]; + return extendedColumns ? [...baseColumns, ...extendedColumns] : baseColumns; + // eslint-disable-next-line react-hooks/exhaustive-deps + }, [expandAll, showDistributions, updatePageState, extendedColumns]); + + const itemIdToExpandedRowMap = useMemo(() => { + let itemIds = expandedRowItemIds; + if (expandAll) { + itemIds = items.map((i) => i[FIELD_NAME]).filter((f) => f !== undefined) as string[]; + } + return getItemIdToExpandedRowMap(itemIds, items); + // eslint-disable-next-line react-hooks/exhaustive-deps + }, [expandAll, items, expandedRowItemIds]); + + return ( + + + className={'dataVisualizer'} + items={items} + itemId={FIELD_NAME} + columns={columns} + pagination={pagination} + sorting={sorting} + isExpandable={true} + itemIdToExpandedRowMap={itemIdToExpandedRowMap} + isSelectable={false} + onTableChange={onTableChange} + data-test-subj={'mlDataVisualizerTable'} + rowProps={(item) => ({ + 'data-test-subj': `mlDataVisualizerRow row-${item.fieldName}`, + })} + /> + + ); +}; diff --git a/x-pack/plugins/file_data_visualizer/public/application/components/stats_table/hooks/color_range_legend.tsx b/x-pack/plugins/file_data_visualizer/public/application/components/stats_table/hooks/color_range_legend.tsx new file mode 100644 index 0000000000000..58be31a53e9c5 --- /dev/null +++ b/x-pack/plugins/file_data_visualizer/public/application/components/stats_table/hooks/color_range_legend.tsx @@ -0,0 +1,146 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import React, { useEffect, useRef, FC } from 'react'; +import d3 from 'd3'; + +import { EuiText } from '@elastic/eui'; + +const COLOR_RANGE_RESOLUTION = 10; + +interface ColorRangeLegendProps { + colorRange: (d: number) => string; + justifyTicks?: boolean; + showTicks?: boolean; + title?: string; + width?: number; +} + +/** + * Component to render a legend for color ranges to be used for color coding + * table cells and visualizations. + * + * This current version supports normalized value ranges (0-1) only. + * + * @param props ColorRangeLegendProps + */ +export const ColorRangeLegend: FC = ({ + colorRange, + justifyTicks = false, + showTicks = true, + title, + width = 250, +}) => { + const d3Container = useRef(null); + + const scale = d3.range(COLOR_RANGE_RESOLUTION + 1).map((d) => ({ + offset: (d / COLOR_RANGE_RESOLUTION) * 100, + stopColor: colorRange(d / COLOR_RANGE_RESOLUTION), + })); + + useEffect(() => { + if (d3Container.current === null) { + return; + } + + const wrapperHeight = 32; + const wrapperWidth = width; + + // top: 2 — adjust vertical alignment with title text + // bottom: 20 — room for axis ticks and labels + // left/right: 1 — room for first and last axis tick + // when justifyTicks is enabled, the left margin is increased to not cut off the first tick label + const margin = { top: 2, bottom: 20, left: justifyTicks || !showTicks ? 1 : 4, right: 1 }; + + const legendWidth = wrapperWidth - margin.left - margin.right; + const legendHeight = wrapperHeight - margin.top - margin.bottom; + + // remove, then redraw the legend + d3.select(d3Container.current).selectAll('*').remove(); + + const wrapper = d3 + .select(d3Container.current) + .classed('colorRangeLegend', true) + .attr('width', wrapperWidth) + .attr('height', wrapperHeight) + .append('g') + .attr('transform', 'translate(' + margin.left + ',' + margin.top + ')'); + + // append gradient bar + const gradient = wrapper + .append('defs') + .append('linearGradient') + .attr('id', 'colorRangeGradient') + .attr('x1', '0%') + .attr('y1', '0%') + .attr('x2', '100%') + .attr('y2', '0%') + .attr('spreadMethod', 'pad'); + + scale.forEach(function (d) { + gradient + .append('stop') + .attr('offset', `${d.offset}%`) + .attr('stop-color', d.stopColor) + .attr('stop-opacity', 1); + }); + + wrapper + .append('rect') + .attr('x1', 0) + .attr('y1', 0) + .attr('width', legendWidth) + .attr('height', legendHeight) + .style('fill', 'url(#colorRangeGradient)'); + + const axisScale = d3.scale.linear().domain([0, 1]).range([0, legendWidth]); + + // Using this formatter ensures we get e.g. `0` and not `0.0`, but still `0.1`, `0.2` etc. + const tickFormat = d3.format(''); + const legendAxis = d3.svg + .axis() + .scale(axisScale) + .orient('bottom') + .tickFormat(tickFormat) + .tickSize(legendHeight + 4) + .ticks(legendWidth / 40); + + wrapper + .append('g') + .attr('class', 'legend axis') + .attr('transform', 'translate(0, 0)') + .call(legendAxis); + + // Adjust the alignment of the first and last tick text + // so that the tick labels don't overflow the color range. + if (justifyTicks || !showTicks) { + const text = wrapper.selectAll('text')[0]; + if (text.length > 1) { + d3.select(text[0]).style('text-anchor', 'start'); + d3.select(text[text.length - 1]).style('text-anchor', 'end'); + } + } + + if (!showTicks) { + wrapper.selectAll('.axis line').style('display', 'none'); + } + // eslint-disable-next-line react-hooks/exhaustive-deps + }, [JSON.stringify(scale), d3Container.current]); + + if (title === undefined) { + return ; + } + + return ( + <> + +

{title}

+
+ + + ); +}; diff --git a/x-pack/plugins/file_data_visualizer/public/application/components/stats_table/hooks/index.ts b/x-pack/plugins/file_data_visualizer/public/application/components/stats_table/hooks/index.ts new file mode 100644 index 0000000000000..85d85f51a623f --- /dev/null +++ b/x-pack/plugins/file_data_visualizer/public/application/components/stats_table/hooks/index.ts @@ -0,0 +1,8 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +export { useDataVizChartTheme } from './use_data_viz_chart_theme'; diff --git a/x-pack/plugins/file_data_visualizer/public/application/components/stats_table/hooks/use_color_range.test.ts b/x-pack/plugins/file_data_visualizer/public/application/components/stats_table/hooks/use_color_range.test.ts new file mode 100644 index 0000000000000..55888c607c287 --- /dev/null +++ b/x-pack/plugins/file_data_visualizer/public/application/components/stats_table/hooks/use_color_range.test.ts @@ -0,0 +1,58 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import { influencerColorScaleFactory } from './use_color_range'; + +describe('useColorRange', () => { + test('influencerColorScaleFactory(1)', () => { + const influencerColorScale = influencerColorScaleFactory(1); + + expect(influencerColorScale(0)).toBe(0); + expect(influencerColorScale(0.1)).toBe(0.1); + expect(influencerColorScale(0.2)).toBe(0.2); + expect(influencerColorScale(0.3)).toBe(0.3); + expect(influencerColorScale(0.4)).toBe(0.4); + expect(influencerColorScale(0.5)).toBe(0.5); + expect(influencerColorScale(0.6)).toBe(0.6); + expect(influencerColorScale(0.7)).toBe(0.7); + expect(influencerColorScale(0.8)).toBe(0.8); + expect(influencerColorScale(0.9)).toBe(0.9); + expect(influencerColorScale(1)).toBe(1); + }); + + test('influencerColorScaleFactory(2)', () => { + const influencerColorScale = influencerColorScaleFactory(2); + + expect(influencerColorScale(0)).toBe(0); + expect(influencerColorScale(0.1)).toBe(0); + expect(influencerColorScale(0.2)).toBe(0); + expect(influencerColorScale(0.3)).toBe(0); + expect(influencerColorScale(0.4)).toBe(0); + expect(influencerColorScale(0.5)).toBe(0); + expect(influencerColorScale(0.6)).toBe(0.04999999999999999); + expect(influencerColorScale(0.7)).toBe(0.09999999999999998); + expect(influencerColorScale(0.8)).toBe(0.15000000000000002); + expect(influencerColorScale(0.9)).toBe(0.2); + expect(influencerColorScale(1)).toBe(0.25); + }); + + test('influencerColorScaleFactory(3)', () => { + const influencerColorScale = influencerColorScaleFactory(3); + + expect(influencerColorScale(0)).toBe(0); + expect(influencerColorScale(0.1)).toBe(0); + expect(influencerColorScale(0.2)).toBe(0); + expect(influencerColorScale(0.3)).toBe(0); + expect(influencerColorScale(0.4)).toBe(0.05000000000000003); + expect(influencerColorScale(0.5)).toBe(0.125); + expect(influencerColorScale(0.6)).toBe(0.2); + expect(influencerColorScale(0.7)).toBe(0.27499999999999997); + expect(influencerColorScale(0.8)).toBe(0.35000000000000003); + expect(influencerColorScale(0.9)).toBe(0.425); + expect(influencerColorScale(1)).toBe(0.5); + }); +}); diff --git a/x-pack/plugins/file_data_visualizer/public/application/components/stats_table/hooks/use_color_range.ts b/x-pack/plugins/file_data_visualizer/public/application/components/stats_table/hooks/use_color_range.ts new file mode 100644 index 0000000000000..e24134507e3a9 --- /dev/null +++ b/x-pack/plugins/file_data_visualizer/public/application/components/stats_table/hooks/use_color_range.ts @@ -0,0 +1,219 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import d3 from 'd3'; +import { useMemo } from 'react'; +import euiThemeLight from '@elastic/eui/dist/eui_theme_light.json'; +import euiThemeDark from '@elastic/eui/dist/eui_theme_dark.json'; + +import { i18n } from '@kbn/i18n'; + +import { useFileDataVisualizerKibana } from '../../../kibana_context'; + +/** + * Custom color scale factory that takes the amount of feature influencers + * into account to adjust the contrast of the color range. This is used for + * color coding for outlier detection where the amount of feature influencers + * affects the threshold from which the influencers value can actually be + * considered influential. + * + * @param n number of influencers + * @returns a function suitable as a preprocessor for d3.scale.linear() + */ +export const influencerColorScaleFactory = (n: number) => (t: number) => { + // for 1 influencer or less we fall back to a plain linear scale. + if (n <= 1) { + return t; + } + + if (t < 1 / n) { + return 0; + } + if (t < 3 / n) { + return (n / 4) * (t - 1 / n); + } + return 0.5 + (t - 3 / n); +}; + +export enum COLOR_RANGE_SCALE { + LINEAR = 'linear', + INFLUENCER = 'influencer', + SQRT = 'sqrt', +} + +/** + * Color range scale options in the format for EuiSelect's options prop. + */ +export const colorRangeScaleOptions = [ + { + value: COLOR_RANGE_SCALE.LINEAR, + text: i18n.translate('xpack.fileDataVisualizer.components.colorRangeLegend.linearScaleLabel', { + defaultMessage: 'Linear', + }), + }, + { + value: COLOR_RANGE_SCALE.INFLUENCER, + text: i18n.translate( + 'xpack.fileDataVisualizer.components.colorRangeLegend.influencerScaleLabel', + { + defaultMessage: 'Influencer custom scale', + } + ), + }, + { + value: COLOR_RANGE_SCALE.SQRT, + text: i18n.translate('xpack.fileDataVisualizer.components.colorRangeLegend.sqrtScaleLabel', { + defaultMessage: 'Sqrt', + }), + }, +]; + +export enum COLOR_RANGE { + BLUE = 'blue', + RED = 'red', + RED_GREEN = 'red-green', + GREEN_RED = 'green-red', + YELLOW_GREEN_BLUE = 'yellow-green-blue', +} + +/** + * Color range options in the format for EuiSelect's options prop. + */ +export const colorRangeOptions = [ + { + value: COLOR_RANGE.BLUE, + text: i18n.translate( + 'xpack.fileDataVisualizer.components.colorRangeLegend.blueColorRangeLabel', + { + defaultMessage: 'Blue', + } + ), + }, + { + value: COLOR_RANGE.RED, + text: i18n.translate( + 'xpack.fileDataVisualizer.components.colorRangeLegend.redColorRangeLabel', + { + defaultMessage: 'Red', + } + ), + }, + { + value: COLOR_RANGE.RED_GREEN, + text: i18n.translate( + 'xpack.fileDataVisualizer.components.colorRangeLegend.redGreenColorRangeLabel', + { + defaultMessage: 'Red - Green', + } + ), + }, + { + value: COLOR_RANGE.GREEN_RED, + text: i18n.translate( + 'xpack.fileDataVisualizer.components.colorRangeLegend.greenRedColorRangeLabel', + { + defaultMessage: 'Green - Red', + } + ), + }, + { + value: COLOR_RANGE.YELLOW_GREEN_BLUE, + text: i18n.translate( + 'xpack.fileDataVisualizer.components.colorRangeLegend.yellowGreenBlueColorRangeLabel', + { + defaultMessage: 'Yellow - Green - Blue', + } + ), + }, +]; + +/** + * A custom Yellow-Green-Blue color range to demonstrate the support + * for more complex ranges with more than two colors. + */ +const coloursYGB = [ + '#FFFFDD', + '#AAF191', + '#80D385', + '#61B385', + '#3E9583', + '#217681', + '#285285', + '#1F2D86', + '#000086', +]; +const colourRangeYGB = d3.range(0, 1, 1.0 / (coloursYGB.length - 1)); +colourRangeYGB.push(1); + +const colorDomains = { + [COLOR_RANGE.BLUE]: [0, 1], + [COLOR_RANGE.RED]: [0, 1], + [COLOR_RANGE.RED_GREEN]: [0, 1], + [COLOR_RANGE.GREEN_RED]: [0, 1], + [COLOR_RANGE.YELLOW_GREEN_BLUE]: colourRangeYGB, +}; + +/** + * Custom hook to get a d3 based color range to be used for color coding in table cells. + * + * @param colorRange COLOR_RANGE enum. + * @param colorRangeScale COLOR_RANGE_SCALE enum. + * @param featureCount + */ +export const useColorRange = ( + colorRange = COLOR_RANGE.BLUE, + colorRangeScale = COLOR_RANGE_SCALE.LINEAR, + featureCount = 1 +) => { + const { euiTheme } = useCurrentEuiTheme(); + + const colorRanges: Record = { + [COLOR_RANGE.BLUE]: [ + d3.rgb(euiTheme.euiColorEmptyShade).toString(), + d3.rgb(euiTheme.euiColorVis1).toString(), + ], + [COLOR_RANGE.RED]: [ + d3.rgb(euiTheme.euiColorEmptyShade).toString(), + d3.rgb(euiTheme.euiColorDanger).toString(), + ], + [COLOR_RANGE.RED_GREEN]: ['red', 'green'], + [COLOR_RANGE.GREEN_RED]: ['green', 'red'], + [COLOR_RANGE.YELLOW_GREEN_BLUE]: coloursYGB, + }; + + const linearScale = d3.scale + .linear() + .domain(colorDomains[colorRange]) + .range(colorRanges[colorRange]); + const influencerColorScale = influencerColorScaleFactory(featureCount); + const influencerScaleLinearWrapper = (n: number) => linearScale(influencerColorScale(n)); + + const scaleTypes = { + [COLOR_RANGE_SCALE.LINEAR]: linearScale, + [COLOR_RANGE_SCALE.INFLUENCER]: influencerScaleLinearWrapper, + [COLOR_RANGE_SCALE.SQRT]: d3.scale + .sqrt() + .domain(colorDomains[colorRange]) + // typings for .range() incorrectly don't allow passing in a color extent. + // @ts-ignore + .range(colorRanges[colorRange]), + }; + + return scaleTypes[colorRangeScale]; +}; + +export type EuiThemeType = typeof euiThemeLight | typeof euiThemeDark; + +export function useCurrentEuiTheme() { + const { + services: { uiSettings }, + } = useFileDataVisualizerKibana(); + return useMemo( + () => ({ euiTheme: uiSettings.get('theme:darkMode') ? euiThemeDark : euiThemeLight }), + [uiSettings] + ); +} diff --git a/x-pack/plugins/file_data_visualizer/public/application/components/stats_table/hooks/use_data_viz_chart_theme.ts b/x-pack/plugins/file_data_visualizer/public/application/components/stats_table/hooks/use_data_viz_chart_theme.ts new file mode 100644 index 0000000000000..ad31ca2d09420 --- /dev/null +++ b/x-pack/plugins/file_data_visualizer/public/application/components/stats_table/hooks/use_data_viz_chart_theme.ts @@ -0,0 +1,55 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import type { PartialTheme } from '@elastic/charts'; +import { useMemo } from 'react'; +import { useCurrentEuiTheme } from './use_color_range'; +export const useDataVizChartTheme = (): PartialTheme => { + const { euiTheme } = useCurrentEuiTheme(); + const chartTheme = useMemo(() => { + const AREA_SERIES_COLOR = euiTheme.euiColorVis0; + return { + axes: { + tickLabel: { + fontSize: parseInt(euiTheme.euiFontSizeXS, 10), + fontFamily: euiTheme.euiFontFamily, + fontStyle: 'italic', + }, + }, + background: { color: 'transparent' }, + chartMargins: { + left: 0, + right: 0, + top: 0, + bottom: 0, + }, + chartPaddings: { + left: 0, + right: 0, + top: 4, + bottom: 0, + }, + scales: { barsPadding: 0.1 }, + colors: { + vizColors: [AREA_SERIES_COLOR], + }, + areaSeriesStyle: { + line: { + strokeWidth: 1, + visible: true, + }, + point: { + visible: false, + radius: 0, + opacity: 0, + }, + area: { visible: true, opacity: 1 }, + }, + }; + }, [euiTheme]); + return chartTheme; +}; diff --git a/x-pack/plugins/file_data_visualizer/public/application/components/stats_table/index.ts b/x-pack/plugins/file_data_visualizer/public/application/components/stats_table/index.ts new file mode 100644 index 0000000000000..3009470af4858 --- /dev/null +++ b/x-pack/plugins/file_data_visualizer/public/application/components/stats_table/index.ts @@ -0,0 +1,8 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +export { DataVisualizerTable, ItemIdToExpandedRowMap } from './data_visualizer_stats_table'; diff --git a/x-pack/plugins/data_enhanced/common/search/session/status.ts b/x-pack/plugins/file_data_visualizer/public/application/components/stats_table/types/field_data_row.ts similarity index 59% rename from x-pack/plugins/data_enhanced/common/search/session/status.ts rename to x-pack/plugins/file_data_visualizer/public/application/components/stats_table/types/field_data_row.ts index 97582338646e7..24209af23ceb4 100644 --- a/x-pack/plugins/data_enhanced/common/search/session/status.ts +++ b/x-pack/plugins/file_data_visualizer/public/application/components/stats_table/types/field_data_row.ts @@ -5,10 +5,8 @@ * 2.0. */ -export enum SearchSessionStatus { - IN_PROGRESS = 'in_progress', - ERROR = 'error', - COMPLETE = 'complete', - CANCELLED = 'cancelled', - EXPIRED = 'expired', +import type { FieldVisConfig, FileBasedFieldVisConfig } from './field_vis_config'; + +export interface FieldDataRowProps { + config: FieldVisConfig | FileBasedFieldVisConfig; } diff --git a/x-pack/plugins/file_data_visualizer/public/application/components/stats_table/types/field_vis_config.ts b/x-pack/plugins/file_data_visualizer/public/application/components/stats_table/types/field_vis_config.ts new file mode 100644 index 0000000000000..e9ef0cd75e286 --- /dev/null +++ b/x-pack/plugins/file_data_visualizer/public/application/components/stats_table/types/field_vis_config.ts @@ -0,0 +1,98 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import { JobFieldType } from '../../../../../common'; + +export interface Percentile { + percent: number; + minValue: number; + maxValue: number; +} + +export interface MetricFieldVisStats { + avg?: number; + distribution?: { + percentiles: Percentile[]; + maxPercentile: number; + minPercentile: 0; + }; + max?: number; + median?: number; + min?: number; +} + +interface DocumentCountBuckets { + [key: string]: number; +} + +export interface FieldVisStats { + cardinality?: number; + count?: number; + sampleCount?: number; + trueCount?: number; + falseCount?: number; + earliest?: number; + latest?: number; + documentCounts?: { + buckets?: DocumentCountBuckets; + }; + avg?: number; + distribution?: { + percentiles: Percentile[]; + maxPercentile: number; + minPercentile: 0; + }; + fieldName?: string; + isTopValuesSampled?: boolean; + max?: number; + median?: number; + min?: number; + topValues?: Array<{ key: number | string; doc_count: number }>; + topValuesSampleSize?: number; + topValuesSamplerShardSize?: number; + examples?: Array; + timeRangeEarliest?: number; + timeRangeLatest?: number; +} + +// The internal representation of the configuration used to build the visuals +// which display the field information. +export interface FieldVisConfig { + type: JobFieldType; + fieldName?: string; + existsInDocs: boolean; + aggregatable: boolean; + loading: boolean; + stats?: FieldVisStats; + fieldFormat?: any; + isUnsupportedType?: boolean; +} + +export interface FileBasedFieldVisConfig { + type: JobFieldType; + fieldName?: string; + stats?: FieldVisStats; + format?: string; +} + +export interface FileBasedUnknownFieldVisConfig { + fieldName: string; + type: 'text' | 'unknown'; + stats: { mean: number; count: number; sampleCount: number; cardinality: number }; +} + +export function isFileBasedFieldVisConfig( + field: FieldVisConfig | FileBasedFieldVisConfig +): field is FileBasedFieldVisConfig { + return !field.hasOwnProperty('existsInDocs'); +} + +export function isIndexBasedFieldVisConfig( + field: FieldVisConfig | FileBasedFieldVisConfig +): field is FieldVisConfig { + return field.hasOwnProperty('existsInDocs'); +} diff --git a/x-pack/plugins/file_data_visualizer/public/application/components/stats_table/types/index.ts b/x-pack/plugins/file_data_visualizer/public/application/components/stats_table/types/index.ts new file mode 100644 index 0000000000000..161829461aa26 --- /dev/null +++ b/x-pack/plugins/file_data_visualizer/public/application/components/stats_table/types/index.ts @@ -0,0 +1,16 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +export { FieldDataRowProps } from './field_data_row'; +export { + FieldVisConfig, + FileBasedFieldVisConfig, + FieldVisStats, + MetricFieldVisStats, + isFileBasedFieldVisConfig, + isIndexBasedFieldVisConfig, +} from './field_vis_config'; diff --git a/x-pack/plugins/file_data_visualizer/public/application/components/stats_table/use_table_settings.ts b/x-pack/plugins/file_data_visualizer/public/application/components/stats_table/use_table_settings.ts new file mode 100644 index 0000000000000..e2ff18a8001aa --- /dev/null +++ b/x-pack/plugins/file_data_visualizer/public/application/components/stats_table/use_table_settings.ts @@ -0,0 +1,63 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import { Direction, EuiBasicTableProps, Pagination, PropertySort } from '@elastic/eui'; +import { useCallback, useMemo } from 'react'; + +import { DataVisualizerTableState } from '../../../../common'; + +const PAGE_SIZE_OPTIONS = [10, 25, 50]; + +interface UseTableSettingsReturnValue { + onTableChange: EuiBasicTableProps['onChange']; + pagination: Pagination; + sorting: { sort: PropertySort }; +} + +export function useTableSettings( + items: TypeOfItem[], + pageState: DataVisualizerTableState, + updatePageState: (update: DataVisualizerTableState) => void +): UseTableSettingsReturnValue { + const { pageIndex, pageSize, sortField, sortDirection } = pageState; + + const onTableChange: EuiBasicTableProps['onChange'] = useCallback( + ({ page, sort }) => { + const result = { + ...pageState, + pageIndex: page?.index ?? pageState.pageIndex, + pageSize: page?.size ?? pageState.pageSize, + sortField: (sort?.field as string) ?? pageState.sortField, + sortDirection: sort?.direction ?? pageState.sortDirection, + }; + updatePageState(result); + }, + [pageState, updatePageState] + ); + + const pagination = useMemo( + () => ({ + pageIndex, + pageSize, + totalItemCount: items.length, + pageSizeOptions: PAGE_SIZE_OPTIONS, + }), + [items, pageIndex, pageSize] + ); + + const sorting = useMemo( + () => ({ + sort: { + field: sortField as string, + direction: sortDirection as Direction, + }, + }), + [sortField, sortDirection] + ); + + return { onTableChange, pagination, sorting }; +} diff --git a/x-pack/plugins/file_data_visualizer/public/application/components/stats_table/utils.ts b/x-pack/plugins/file_data_visualizer/public/application/components/stats_table/utils.ts new file mode 100644 index 0000000000000..27da91153b3ba --- /dev/null +++ b/x-pack/plugins/file_data_visualizer/public/application/components/stats_table/utils.ts @@ -0,0 +1,38 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import { FileBasedFieldVisConfig } from './types'; + +export const getTFPercentage = (config: FileBasedFieldVisConfig) => { + const { stats } = config; + if (stats === undefined) return null; + const { count } = stats; + // use stats from index based config + let { trueCount, falseCount } = stats; + + // use stats from file based find structure results + if (stats.trueCount === undefined || stats.falseCount === undefined) { + if (config?.stats?.topValues) { + config.stats.topValues.forEach((doc) => { + if (doc.doc_count !== undefined) { + if (doc.key.toString().toLowerCase() === 'false') { + falseCount = doc.doc_count; + } + if (doc.key.toString().toLowerCase() === 'true') { + trueCount = doc.doc_count; + } + } + }); + } + } + if (count === undefined || trueCount === undefined || falseCount === undefined) return null; + return { + count, + trueCount, + falseCount, + }; +}; diff --git a/x-pack/plugins/file_data_visualizer/public/application/components/top_values/_top_values.scss b/x-pack/plugins/file_data_visualizer/public/application/components/top_values/_top_values.scss new file mode 100644 index 0000000000000..05fa1bfa94b2d --- /dev/null +++ b/x-pack/plugins/file_data_visualizer/public/application/components/top_values/_top_values.scss @@ -0,0 +1,19 @@ +.fieldDataTopValuesContainer { + padding-top: $euiSizeXS; +} + +.topValuesValueLabelContainer { + margin-right: $euiSizeM; + &.topValuesValueLabelContainer--small { + width:70px; + } + + &.topValuesValueLabelContainer--large { + width: 200px; + } +} + +.topValuesPercentLabelContainer { + margin-left: $euiSizeM; + width:70px; +} diff --git a/x-pack/plugins/security_solution/common/graphql/shared/index.ts b/x-pack/plugins/file_data_visualizer/public/application/components/top_values/index.ts similarity index 85% rename from x-pack/plugins/security_solution/common/graphql/shared/index.ts rename to x-pack/plugins/file_data_visualizer/public/application/components/top_values/index.ts index 4cf18cd629d62..c006b37fe2794 100644 --- a/x-pack/plugins/security_solution/common/graphql/shared/index.ts +++ b/x-pack/plugins/file_data_visualizer/public/application/components/top_values/index.ts @@ -5,4 +5,4 @@ * 2.0. */ -export * from './schema.gql'; +export { TopValues } from './top_values'; diff --git a/x-pack/plugins/file_data_visualizer/public/application/components/top_values/top_values.tsx b/x-pack/plugins/file_data_visualizer/public/application/components/top_values/top_values.tsx new file mode 100644 index 0000000000000..c1815fad41de8 --- /dev/null +++ b/x-pack/plugins/file_data_visualizer/public/application/components/top_values/top_values.tsx @@ -0,0 +1,115 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import React, { FC, Fragment } from 'react'; +import { + EuiFlexGroup, + EuiFlexItem, + EuiProgress, + EuiSpacer, + EuiText, + EuiToolTip, +} from '@elastic/eui'; + +import { FormattedMessage } from '@kbn/i18n/react'; + +import classNames from 'classnames'; +import { roundToDecimalPlace, kibanaFieldFormat } from '../utils'; +import { ExpandedRowFieldHeader } from '../stats_table/components/expanded_row_field_header'; +import { FieldVisStats } from '../stats_table/types'; + +interface Props { + stats: FieldVisStats | undefined; + fieldFormat?: any; + barColor?: 'primary' | 'secondary' | 'danger' | 'subdued' | 'accent'; + compressed?: boolean; +} + +function getPercentLabel(docCount: number, topValuesSampleSize: number): string { + const percent = (100 * docCount) / topValuesSampleSize; + if (percent >= 0.1) { + return `${roundToDecimalPlace(percent, 1)}%`; + } else { + return '< 0.1%'; + } +} + +export const TopValues: FC = ({ stats, fieldFormat, barColor, compressed }) => { + if (stats === undefined) return null; + const { + topValues, + topValuesSampleSize, + topValuesSamplerShardSize, + count, + isTopValuesSampled, + } = stats; + const progressBarMax = isTopValuesSampled === true ? topValuesSampleSize : count; + return ( + + + + + +
+ {Array.isArray(topValues) && + topValues.map((value) => ( + + + + + {kibanaFieldFormat(value.key, fieldFormat)} + + + + + + + {progressBarMax !== undefined && ( + + + {getPercentLabel(value.doc_count, progressBarMax)} + + + )} + + ))} + {isTopValuesSampled === true && ( + + + + + + + )} +
+
+ ); +}; diff --git a/x-pack/plugins/file_data_visualizer/public/application/components/utils/format_value.ts b/x-pack/plugins/file_data_visualizer/public/application/components/utils/format_value.ts new file mode 100644 index 0000000000000..5e12302a598ff --- /dev/null +++ b/x-pack/plugins/file_data_visualizer/public/application/components/utils/format_value.ts @@ -0,0 +1,88 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +/* + * Formatter for 'typical' and 'actual' values from machine learning results. + * For detectors which use the time_of_week or time_of_day + * functions, the filter converts the raw number, which is the number of seconds since + * midnight, into a human-readable date/time format. + */ + +import moment from 'moment'; +const SIGFIGS_IF_ROUNDING = 3; // Number of sigfigs to use for values < 10 + +// Formats a single value according to the specified ML function. +// If a Kibana fieldFormat is not supplied, will fall back to default +// formatting depending on the magnitude of the value. +// For time_of_day or time_of_week functions the anomaly record +// containing the timestamp of the anomaly should be supplied in +// order to correctly format the day or week offset to the time of the anomaly. +export function formatSingleValue( + value: number, + func?: string, + fieldFormat?: any, + record?: any // TODO remove record, not needed for file upload +) { + if (value === undefined || value === null) { + return ''; + } + + // If the analysis function is time_of_week/day, format as day/time. + // For time_of_week / day, actual / typical is the UTC offset in seconds from the + // start of the week / day, so need to manipulate to UTC moment of the start of the week / day + // that the anomaly occurred using record timestamp if supplied, add on the offset, and finally + // revert back to configured timezone for formatting. + if (func === 'time_of_week') { + const d = + record !== undefined && record.timestamp !== undefined + ? new Date(record.timestamp) + : new Date(); + const utcMoment = moment.utc(d).startOf('week').add(value, 's'); + return moment(utcMoment.valueOf()).format('ddd HH:mm'); + } else if (func === 'time_of_day') { + const d = + record !== undefined && record.timestamp !== undefined + ? new Date(record.timestamp) + : new Date(); + const utcMoment = moment.utc(d).startOf('day').add(value, 's'); + return moment(utcMoment.valueOf()).format('HH:mm'); + } else { + if (fieldFormat !== undefined) { + return fieldFormat.convert(value, 'text'); + } else { + // If no Kibana FieldFormat object provided, + // format the value depending on its magnitude. + const absValue = Math.abs(value); + if (absValue >= 10000 || absValue === Math.floor(absValue)) { + // Output 0 decimal places if whole numbers or >= 10000 + if (fieldFormat !== undefined) { + return fieldFormat.convert(value, 'text'); + } else { + return Number(value.toFixed(0)); + } + } else if (absValue >= 10) { + // Output to 1 decimal place between 10 and 10000 + return Number(value.toFixed(1)); + } else { + // For values < 10, output to 3 significant figures + let multiple; + if (value > 0) { + multiple = Math.pow( + 10, + SIGFIGS_IF_ROUNDING - Math.floor(Math.log(value) / Math.LN10) - 1 + ); + } else { + multiple = Math.pow( + 10, + SIGFIGS_IF_ROUNDING - Math.floor(Math.log(-1 * value) / Math.LN10) - 1 + ); + } + return Math.round(value * multiple) / multiple; + } + } + } +} diff --git a/x-pack/plugins/ml/public/application/datavisualizer/file_based/components/utils/index.ts b/x-pack/plugins/file_data_visualizer/public/application/components/utils/index.ts similarity index 60% rename from x-pack/plugins/ml/public/application/datavisualizer/file_based/components/utils/index.ts rename to x-pack/plugins/file_data_visualizer/public/application/components/utils/index.ts index cbefc12833d2d..b4c491eee8fd4 100644 --- a/x-pack/plugins/ml/public/application/datavisualizer/file_based/components/utils/index.ts +++ b/x-pack/plugins/file_data_visualizer/public/application/components/utils/index.ts @@ -6,3 +6,7 @@ */ export { createUrlOverrides, processResults, readFile, DEFAULT_LINES_TO_SAMPLE } from './utils'; +export { roundToDecimalPlace } from './round_to_decimal_place'; +export { kibanaFieldFormat } from './kibana_field_format'; +export { numberAsOrdinal } from './number_as_ordinal'; +export { formatSingleValue } from './format_value'; diff --git a/x-pack/plugins/file_data_visualizer/public/application/components/utils/kibana_field_format.ts b/x-pack/plugins/file_data_visualizer/public/application/components/utils/kibana_field_format.ts new file mode 100644 index 0000000000000..0218b7d62655c --- /dev/null +++ b/x-pack/plugins/file_data_visualizer/public/application/components/utils/kibana_field_format.ts @@ -0,0 +1,19 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +/* + * Formatter which uses the fieldFormat object of a Kibana index pattern + * field to format the value of a field. + */ + +export function kibanaFieldFormat(value: any, fieldFormat: any) { + if (fieldFormat !== undefined && fieldFormat !== null) { + return fieldFormat.convert(value, 'text'); + } else { + return value; + } +} diff --git a/x-pack/plugins/file_data_visualizer/public/application/components/utils/number_as_ordinal.test.ts b/x-pack/plugins/file_data_visualizer/public/application/components/utils/number_as_ordinal.test.ts new file mode 100644 index 0000000000000..6990bf0923ac3 --- /dev/null +++ b/x-pack/plugins/file_data_visualizer/public/application/components/utils/number_as_ordinal.test.ts @@ -0,0 +1,29 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import { numberAsOrdinal } from './number_as_ordinal'; + +describe('numberAsOrdinal formatter', () => { + const tests = [ + { number: 0, asOrdinal: '0th' }, + { number: 1, asOrdinal: '1st' }, + { number: 2.2, asOrdinal: '2nd' }, + { number: 3, asOrdinal: '3rd' }, + { number: 5, asOrdinal: '5th' }, + { number: 10, asOrdinal: '10th' }, + { number: 11, asOrdinal: '11th' }, + { number: 22, asOrdinal: '22nd' }, + { number: 33, asOrdinal: '33rd' }, + { number: 44.4, asOrdinal: '44th' }, + { number: 100, asOrdinal: '100th' }, + ]; + test('returns the expected numeral format', () => { + tests.forEach((test) => { + expect(numberAsOrdinal(test.number)).toBe(test.asOrdinal); + }); + }); +}); diff --git a/x-pack/plugins/file_data_visualizer/public/application/components/utils/number_as_ordinal.ts b/x-pack/plugins/file_data_visualizer/public/application/components/utils/number_as_ordinal.ts new file mode 100644 index 0000000000000..3a2707cc47783 --- /dev/null +++ b/x-pack/plugins/file_data_visualizer/public/application/components/utils/number_as_ordinal.ts @@ -0,0 +1,20 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +// @ts-ignore +import numeral from '@elastic/numeral'; + +/** + * Formats the supplied number as ordinal e.g. 15 as 15th. + * Formatting first converts the supplied number to an integer by flooring. + * @param {number} value to format as an ordinal + * @return {string} number formatted as an ordinal e.g. 15th + */ +export function numberAsOrdinal(num: number) { + const int = Math.floor(num); + return `${numeral(int).format('0o')}`; +} diff --git a/x-pack/plugins/file_data_visualizer/public/application/components/utils/round_to_decimal_place.test.ts b/x-pack/plugins/file_data_visualizer/public/application/components/utils/round_to_decimal_place.test.ts new file mode 100644 index 0000000000000..151ae93a93815 --- /dev/null +++ b/x-pack/plugins/file_data_visualizer/public/application/components/utils/round_to_decimal_place.test.ts @@ -0,0 +1,38 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import { roundToDecimalPlace } from './round_to_decimal_place'; + +describe('roundToDecimalPlace formatter', () => { + it('returns the correct format using default decimal place', () => { + expect(roundToDecimalPlace(12)).toBe(12); + expect(roundToDecimalPlace(12.3)).toBe(12.3); + expect(roundToDecimalPlace(12.34)).toBe(12.34); + expect(roundToDecimalPlace(12.345)).toBe(12.35); + expect(roundToDecimalPlace(12.045)).toBe(12.05); + expect(roundToDecimalPlace(12.005)).toBe(12.01); + expect(roundToDecimalPlace(12.0005)).toBe(12); + expect(roundToDecimalPlace(0.05)).toBe(0.05); + expect(roundToDecimalPlace(0.005)).toBe('5.00e-3'); + expect(roundToDecimalPlace(0.0005)).toBe('5.00e-4'); + expect(roundToDecimalPlace(-0.0005)).toBe('-5.00e-4'); + expect(roundToDecimalPlace(-12.045)).toBe(-12.04); + expect(roundToDecimalPlace(0)).toBe(0); + }); + + it('returns the correct format using specified decimal place', () => { + expect(roundToDecimalPlace(12, 4)).toBe(12); + expect(roundToDecimalPlace(12.3, 4)).toBe(12.3); + expect(roundToDecimalPlace(12.3456, 4)).toBe(12.3456); + expect(roundToDecimalPlace(12.345678, 4)).toBe(12.3457); + expect(roundToDecimalPlace(0.05, 4)).toBe(0.05); + expect(roundToDecimalPlace(0.0005, 4)).toBe(0.0005); + expect(roundToDecimalPlace(0.00005, 4)).toBe('5.00e-5'); + expect(roundToDecimalPlace(-0.00005, 4)).toBe('-5.00e-5'); + expect(roundToDecimalPlace(0, 4)).toBe(0); + }); +}); diff --git a/x-pack/plugins/file_data_visualizer/public/application/components/utils/round_to_decimal_place.ts b/x-pack/plugins/file_data_visualizer/public/application/components/utils/round_to_decimal_place.ts new file mode 100644 index 0000000000000..88ab605a95369 --- /dev/null +++ b/x-pack/plugins/file_data_visualizer/public/application/components/utils/round_to_decimal_place.ts @@ -0,0 +1,20 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +export function roundToDecimalPlace(num?: number, dp: number = 2): number | string { + if (num === undefined) return ''; + if (num % 1 === 0) { + // no decimal place + return num; + } + + if (Math.abs(num) < Math.pow(10, -dp)) { + return Number.parseFloat(String(num)).toExponential(2); + } + const m = Math.pow(10, dp); + return Math.round(num * m) / m; +} diff --git a/x-pack/plugins/ml/public/application/datavisualizer/file_based/components/utils/utils.ts b/x-pack/plugins/file_data_visualizer/public/application/components/utils/utils.ts similarity index 96% rename from x-pack/plugins/ml/public/application/datavisualizer/file_based/components/utils/utils.ts rename to x-pack/plugins/file_data_visualizer/public/application/components/utils/utils.ts index 49e5da565b927..1d47e633188c5 100644 --- a/x-pack/plugins/ml/public/application/datavisualizer/file_based/components/utils/utils.ts +++ b/x-pack/plugins/file_data_visualizer/public/application/components/utils/utils.ts @@ -6,8 +6,7 @@ */ import { isEqual } from 'lodash'; -import { AnalysisResult, InputOverrides } from '../../../../../../../file_upload/common'; -import { MB } from '../../../../../../../file_upload/public'; +import { AnalysisResult, InputOverrides, MB } from '../../../../../file_upload/common'; export const DEFAULT_LINES_TO_SAMPLE = 1000; const UPLOAD_SIZE_MB = 5; diff --git a/x-pack/plugins/file_data_visualizer/public/application/file_datavisualizer.tsx b/x-pack/plugins/file_data_visualizer/public/application/file_datavisualizer.tsx new file mode 100644 index 0000000000000..f291076557bb8 --- /dev/null +++ b/x-pack/plugins/file_data_visualizer/public/application/file_datavisualizer.tsx @@ -0,0 +1,30 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ +import './_index.scss'; +import React, { FC } from 'react'; +import { KibanaContextProvider } from '../../../../../src/plugins/kibana_react/public'; +import { getCoreStart, getPluginsStart } from '../kibana_services'; + +// @ts-ignore +import { FileDataVisualizerView } from './components/file_datavisualizer_view/index'; + +export const FileDataVisualizer: FC = () => { + const coreStart = getCoreStart(); + const { data, maps, embeddable, share, security, fileUpload } = getPluginsStart(); + const services = { data, maps, embeddable, share, security, fileUpload, ...coreStart }; + + return ( + + + + ); +}; diff --git a/x-pack/plugins/file_data_visualizer/public/application/index.ts b/x-pack/plugins/file_data_visualizer/public/application/index.ts new file mode 100644 index 0000000000000..dba820519af94 --- /dev/null +++ b/x-pack/plugins/file_data_visualizer/public/application/index.ts @@ -0,0 +1,8 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +export { FileDataVisualizer } from './file_datavisualizer'; diff --git a/x-pack/plugins/file_data_visualizer/public/application/kibana_context.ts b/x-pack/plugins/file_data_visualizer/public/application/kibana_context.ts new file mode 100644 index 0000000000000..6752c322d42e3 --- /dev/null +++ b/x-pack/plugins/file_data_visualizer/public/application/kibana_context.ts @@ -0,0 +1,13 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import { CoreStart } from 'kibana/public'; +import { useKibana } from '../../../../../src/plugins/kibana_react/public'; +import type { FileDataVisualizerStartDependencies } from '../plugin'; + +export type StartServices = CoreStart & FileDataVisualizerStartDependencies; +export const useFileDataVisualizerKibana = () => useKibana(); diff --git a/x-pack/plugins/file_data_visualizer/public/application/shared_imports.ts b/x-pack/plugins/file_data_visualizer/public/application/shared_imports.ts new file mode 100644 index 0000000000000..20481d2fde9be --- /dev/null +++ b/x-pack/plugins/file_data_visualizer/public/application/shared_imports.ts @@ -0,0 +1,12 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import { XJson } from '../../../../../src/plugins/es_ui_shared/public'; +const { collapseLiteralStrings, expandLiteralStrings } = XJson; + +export { XJsonMode } from '@kbn/ace'; +export { collapseLiteralStrings, expandLiteralStrings }; diff --git a/x-pack/plugins/file_data_visualizer/public/application/util/field_types_utils.test.ts b/x-pack/plugins/file_data_visualizer/public/application/util/field_types_utils.test.ts new file mode 100644 index 0000000000000..6f81c0bf4e7d3 --- /dev/null +++ b/x-pack/plugins/file_data_visualizer/public/application/util/field_types_utils.test.ts @@ -0,0 +1,29 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import { JOB_FIELD_TYPES } from '../../../common'; +import { getJobTypeAriaLabel, jobTypeAriaLabels } from './field_types_utils'; + +describe('field type utils', () => { + describe('getJobTypeAriaLabel: Getting a field type aria label by passing what it is stored in constants', () => { + test('should returns all JOB_FIELD_TYPES labels exactly as it is for each correct value', () => { + const keys = Object.keys(JOB_FIELD_TYPES); + const receivedLabels: Record = {}; + const testStorage = jobTypeAriaLabels; + keys.forEach((constant) => { + receivedLabels[constant] = getJobTypeAriaLabel( + JOB_FIELD_TYPES[constant as keyof typeof JOB_FIELD_TYPES] + ); + }); + + expect(receivedLabels).toEqual(testStorage); + }); + test('should returns NULL as JOB_FIELD_TYPES does not contain such a keyword', () => { + expect(getJobTypeAriaLabel('JOB_FIELD_TYPES')).toBe(null); + }); + }); +}); diff --git a/x-pack/plugins/file_data_visualizer/public/application/util/field_types_utils.ts b/x-pack/plugins/file_data_visualizer/public/application/util/field_types_utils.ts new file mode 100644 index 0000000000000..76a5f6ac20117 --- /dev/null +++ b/x-pack/plugins/file_data_visualizer/public/application/util/field_types_utils.ts @@ -0,0 +1,49 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import { i18n } from '@kbn/i18n'; +import { JOB_FIELD_TYPES } from '../../../common'; + +export const jobTypeAriaLabels = { + BOOLEAN: i18n.translate('xpack.fileDataVisualizer.fieldTypeIcon.booleanTypeAriaLabel', { + defaultMessage: 'boolean type', + }), + DATE: i18n.translate('xpack.fileDataVisualizer.fieldTypeIcon.dateTypeAriaLabel', { + defaultMessage: 'date type', + }), + GEO_POINT: i18n.translate('xpack.fileDataVisualizer.fieldTypeIcon.geoPointTypeAriaLabel', { + defaultMessage: '{geoPointParam} type', + values: { + geoPointParam: 'geo point', + }, + }), + IP: i18n.translate('xpack.fileDataVisualizer.fieldTypeIcon.ipTypeAriaLabel', { + defaultMessage: 'ip type', + }), + KEYWORD: i18n.translate('xpack.fileDataVisualizer.fieldTypeIcon.keywordTypeAriaLabel', { + defaultMessage: 'keyword type', + }), + NUMBER: i18n.translate('xpack.fileDataVisualizer.fieldTypeIcon.numberTypeAriaLabel', { + defaultMessage: 'number type', + }), + TEXT: i18n.translate('xpack.fileDataVisualizer.fieldTypeIcon.textTypeAriaLabel', { + defaultMessage: 'text type', + }), + UNKNOWN: i18n.translate('xpack.fileDataVisualizer.fieldTypeIcon.unknownTypeAriaLabel', { + defaultMessage: 'unknown type', + }), +}; + +export const getJobTypeAriaLabel = (type: string) => { + const requestedFieldType = Object.keys(JOB_FIELD_TYPES).find( + (k) => JOB_FIELD_TYPES[k as keyof typeof JOB_FIELD_TYPES] === type + ); + if (requestedFieldType === undefined) { + return null; + } + return jobTypeAriaLabels[requestedFieldType as keyof typeof jobTypeAriaLabels]; +}; diff --git a/x-pack/plugins/file_data_visualizer/public/application/util/get_max_bytes.ts b/x-pack/plugins/file_data_visualizer/public/application/util/get_max_bytes.ts new file mode 100644 index 0000000000000..821a94bf5166d --- /dev/null +++ b/x-pack/plugins/file_data_visualizer/public/application/util/get_max_bytes.ts @@ -0,0 +1,14 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import { getPluginsStart } from '../../kibana_services'; + +// expose the fileUpload plugin's getMaxBytesFormatted for use in ML +// so ML doesn't need to depend on the fileUpload plugin for this one function +export function getMaxBytesFormatted() { + return getPluginsStart().fileUpload.getMaxBytesFormatted(); +} diff --git a/x-pack/plugins/security_solution/common/graphql/root/schema.gql.ts b/x-pack/plugins/file_data_visualizer/public/index.ts similarity index 58% rename from x-pack/plugins/security_solution/common/graphql/root/schema.gql.ts rename to x-pack/plugins/file_data_visualizer/public/index.ts index 16fdeb7ec6c75..64a81936dbbde 100644 --- a/x-pack/plugins/security_solution/common/graphql/root/schema.gql.ts +++ b/x-pack/plugins/file_data_visualizer/public/index.ts @@ -5,15 +5,10 @@ * 2.0. */ -import gql from 'graphql-tag'; +import { FileDataVisualizerPlugin } from './plugin'; -export const rootSchema = gql` - schema { - query: Query - mutation: Mutation - } +export function plugin() { + return new FileDataVisualizerPlugin(); +} - type Query - - type Mutation -`; +export { FileDataVisualizerPluginStart } from './plugin'; diff --git a/x-pack/plugins/file_data_visualizer/public/kibana_services.ts b/x-pack/plugins/file_data_visualizer/public/kibana_services.ts new file mode 100644 index 0000000000000..6a5fe85c72477 --- /dev/null +++ b/x-pack/plugins/file_data_visualizer/public/kibana_services.ts @@ -0,0 +1,19 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import { CoreStart } from 'kibana/public'; +import { FileDataVisualizerStartDependencies } from './plugin'; + +let coreStart: CoreStart; +let pluginsStart: FileDataVisualizerStartDependencies; +export function setStartServices(core: CoreStart, plugins: FileDataVisualizerStartDependencies) { + coreStart = core; + pluginsStart = plugins; +} + +export const getCoreStart = () => coreStart; +export const getPluginsStart = () => pluginsStart; diff --git a/x-pack/plugins/file_data_visualizer/public/lazy_load_bundle/index.ts b/x-pack/plugins/file_data_visualizer/public/lazy_load_bundle/index.ts new file mode 100644 index 0000000000000..99dbb6d3746ce --- /dev/null +++ b/x-pack/plugins/file_data_visualizer/public/lazy_load_bundle/index.ts @@ -0,0 +1,33 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import { HttpSetup } from 'src/core/public'; +import { FileDataVisualizer } from '../application'; +import { getCoreStart } from '../kibana_services'; + +let loadModulesPromise: Promise; + +interface LazyLoadedModules { + FileDataVisualizer: typeof FileDataVisualizer; + getHttp: () => HttpSetup; +} + +export async function lazyLoadModules(): Promise { + if (typeof loadModulesPromise !== 'undefined') { + return loadModulesPromise; + } + + loadModulesPromise = new Promise(async (resolve) => { + const lazyImports = await import('./lazy'); + + resolve({ + ...lazyImports, + getHttp: () => getCoreStart().http, + }); + }); + return loadModulesPromise; +} diff --git a/x-pack/plugins/file_data_visualizer/public/lazy_load_bundle/lazy/index.ts b/x-pack/plugins/file_data_visualizer/public/lazy_load_bundle/lazy/index.ts new file mode 100644 index 0000000000000..4229b95f3aaad --- /dev/null +++ b/x-pack/plugins/file_data_visualizer/public/lazy_load_bundle/lazy/index.ts @@ -0,0 +1,8 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +export { FileDataVisualizer } from '../../application'; diff --git a/x-pack/plugins/file_data_visualizer/public/plugin.ts b/x-pack/plugins/file_data_visualizer/public/plugin.ts new file mode 100644 index 0000000000000..a94c0fce45cd4 --- /dev/null +++ b/x-pack/plugins/file_data_visualizer/public/plugin.ts @@ -0,0 +1,49 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import { CoreStart } from 'kibana/public'; +import type { EmbeddableStart } from '../../../../src/plugins/embeddable/public'; +import type { SharePluginStart } from '../../../../src/plugins/share/public'; +import { Plugin } from '../../../../src/core/public'; + +import { setStartServices } from './kibana_services'; +import { DataPublicPluginStart } from '../../../../src/plugins/data/public'; +import type { FileUploadPluginStart } from '../../file_upload/public'; +import type { MapsStartApi } from '../../maps/public'; +import type { SecurityPluginSetup } from '../../security/public'; +import { getFileDataVisualizerComponent } from './api'; +import { getMaxBytesFormatted } from './application/util/get_max_bytes'; + +// eslint-disable-next-line @typescript-eslint/no-empty-interface +export interface FileDataVisualizerSetupDependencies {} +export interface FileDataVisualizerStartDependencies { + data: DataPublicPluginStart; + fileUpload: FileUploadPluginStart; + maps: MapsStartApi; + embeddable: EmbeddableStart; + security?: SecurityPluginSetup; + share: SharePluginStart; +} + +export type FileDataVisualizerPluginSetup = ReturnType; +export type FileDataVisualizerPluginStart = ReturnType; + +export class FileDataVisualizerPlugin + implements + Plugin< + FileDataVisualizerPluginSetup, + FileDataVisualizerPluginStart, + FileDataVisualizerSetupDependencies, + FileDataVisualizerStartDependencies + > { + public setup() {} + + public start(core: CoreStart, plugins: FileDataVisualizerStartDependencies) { + setStartServices(core, plugins); + return { getFileDataVisualizerComponent, getMaxBytesFormatted }; + } +} diff --git a/x-pack/plugins/security_solution/server/graphql/scalar_to_boolean_array/schema.gql.ts b/x-pack/plugins/file_data_visualizer/server/index.ts similarity index 69% rename from x-pack/plugins/security_solution/server/graphql/scalar_to_boolean_array/schema.gql.ts rename to x-pack/plugins/file_data_visualizer/server/index.ts index d8717ebfdee02..43067dbe99d0d 100644 --- a/x-pack/plugins/security_solution/server/graphql/scalar_to_boolean_array/schema.gql.ts +++ b/x-pack/plugins/file_data_visualizer/server/index.ts @@ -5,8 +5,6 @@ * 2.0. */ -import gql from 'graphql-tag'; +import { FileDataVisualizerPlugin } from './plugin'; -export const toBooleanSchema = gql` - scalar ToBooleanArray -`; +export const plugin = () => new FileDataVisualizerPlugin(); diff --git a/x-pack/plugins/file_data_visualizer/server/plugin.ts b/x-pack/plugins/file_data_visualizer/server/plugin.ts new file mode 100644 index 0000000000000..f6893b7edaa53 --- /dev/null +++ b/x-pack/plugins/file_data_visualizer/server/plugin.ts @@ -0,0 +1,13 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import { Plugin } from 'src/core/server'; + +export class FileDataVisualizerPlugin implements Plugin { + setup() {} + start() {} +} diff --git a/x-pack/plugins/file_data_visualizer/tsconfig.json b/x-pack/plugins/file_data_visualizer/tsconfig.json new file mode 100644 index 0000000000000..2d668bcaa2045 --- /dev/null +++ b/x-pack/plugins/file_data_visualizer/tsconfig.json @@ -0,0 +1,20 @@ +{ + "extends": "../../../tsconfig.base.json", + "compilerOptions": { + "composite": true, + "outDir": "./target/types", + "emitDeclarationOnly": true, + "declaration": true, + "declarationMap": true + }, + "include": ["common/**/*", "public/**/*", "server/**/*"], + "references": [ + { "path": "../../../src/core/tsconfig.json" }, + { "path": "../../../src/plugins/data/tsconfig.json" }, + { "path": "../../../src/plugins/usage_collection/tsconfig.json" }, + { "path": "../security/tsconfig.json" }, + { "path": "../file_upload/tsconfig.json" }, + { "path": "../maps/tsconfig.json" }, + { "path": "../../../src/plugins/embeddable/tsconfig.json" }, + ] +} diff --git a/x-pack/plugins/file_upload/common/constants.ts b/x-pack/plugins/file_upload/common/constants.ts index ea36e51466703..977f969647658 100644 --- a/x-pack/plugins/file_upload/common/constants.ts +++ b/x-pack/plugins/file_upload/common/constants.ts @@ -16,4 +16,4 @@ export const FILE_SIZE_DISPLAY_FORMAT = '0,0.[0] b'; // Value to use in the Elasticsearch index mapping meta data to identify the // index as having been created by the ML File Data Visualizer. -export const INDEX_META_DATA_CREATED_BY = 'ml-file-data-visualizer'; +export const INDEX_META_DATA_CREATED_BY = 'file-data-visualizer'; diff --git a/x-pack/plugins/file_upload/common/types.ts b/x-pack/plugins/file_upload/common/types.ts index 11cf4ac3615bf..e10b9e90a71d8 100644 --- a/x-pack/plugins/file_upload/common/types.ts +++ b/x-pack/plugins/file_upload/common/types.ts @@ -6,11 +6,7 @@ */ import type { estypes } from '@elastic/elasticsearch'; -import { ES_FIELD_TYPES } from '../../../../src/plugins/data/common'; - -export interface HasImportPermission { - hasImportPermission: boolean; -} +import { ES_FIELD_TYPES } from 'src/plugins/data/common'; export interface InputOverrides { [key: string]: string | undefined; @@ -75,6 +71,28 @@ export interface FindFileStructureResponse { should_trim_fields?: boolean; } +export interface FindFileStructureErrorResponse { + body: { + statusCode: number; + error: string; + message: string; + attributes?: ErrorAttribute; + }; + name: string; +} + +interface ErrorAttribute { + body: { + error: { + suppressed: Array<{ reason: string }>; + }; + }; +} + +export interface HasImportPermission { + hasImportPermission: boolean; +} + export type InputData = any[]; export interface ImportResponse { diff --git a/x-pack/plugins/file_upload/kibana.json b/x-pack/plugins/file_upload/kibana.json index a1c585e534333..6f93874cdbcaa 100644 --- a/x-pack/plugins/file_upload/kibana.json +++ b/x-pack/plugins/file_upload/kibana.json @@ -4,7 +4,17 @@ "kibanaVersion": "kibana", "server": true, "ui": true, - "requiredPlugins": ["data", "usageCollection"], - "optionalPlugins": ["security"], - "requiredBundles": ["kibanaReact"] + "requiredPlugins": [ + "data", + "usageCollection" + ], + "optionalPlugins": [ + "security" + ], + "requiredBundles": [ + "kibanaReact" + ], + "extraPublicDirs": [ + "common" + ] } diff --git a/x-pack/plugins/file_upload/public/api/index.ts b/x-pack/plugins/file_upload/public/api/index.ts index 281537cbbde16..23eeb9abde324 100644 --- a/x-pack/plugins/file_upload/public/api/index.ts +++ b/x-pack/plugins/file_upload/public/api/index.ts @@ -6,22 +6,32 @@ */ import React from 'react'; -import { FileUploadComponentProps, lazyLoadFileUploadModules } from '../lazy_load_bundle'; +import { FileUploadComponentProps, lazyLoadModules } from '../lazy_load_bundle'; import type { IImporter, ImportFactoryOptions } from '../importer'; -import { HasImportPermission } from '../../common'; +import type { HasImportPermission, FindFileStructureResponse } from '../../common'; +import type { getMaxBytes, getMaxBytesFormatted } from '../importer/get_max_bytes'; export interface FileUploadStartApi { - getFileUploadComponent(): Promise>; - importerFactory(format: string, options: ImportFactoryOptions): Promise; - getMaxBytes(): number; - getMaxBytesFormatted(): string; - hasImportPermission(params: HasImportPermissionParams): Promise; + getFileUploadComponent(): ReturnType; + importerFactory: typeof importerFactory; + getMaxBytes: typeof getMaxBytes; + getMaxBytesFormatted: typeof getMaxBytesFormatted; + hasImportPermission: typeof hasImportPermission; + checkIndexExists: typeof checkIndexExists; + getTimeFieldRange: typeof getTimeFieldRange; + analyzeFile: typeof analyzeFile; +} + +export interface GetTimeFieldRangeResponse { + success: boolean; + start: { epoch: number; string: string }; + end: { epoch: number; string: string }; } export async function getFileUploadComponent(): Promise< React.ComponentType > { - const fileUploadModules = await lazyLoadFileUploadModules(); + const fileUploadModules = await lazyLoadModules(); return fileUploadModules.JsonUploadAndParse; } @@ -29,7 +39,7 @@ export async function importerFactory( format: string, options: ImportFactoryOptions ): Promise { - const fileUploadModules = await lazyLoadFileUploadModules(); + const fileUploadModules = await lazyLoadModules(); return fileUploadModules.importerFactory(format, options); } @@ -39,8 +49,22 @@ interface HasImportPermissionParams { indexName?: string; } +export async function analyzeFile( + file: string, + params: Record = {} +): Promise { + const { getHttp } = await lazyLoadModules(); + const body = JSON.stringify(file); + return await getHttp().fetch({ + path: `/internal/file_data_visualizer/analyze_file`, + method: 'POST', + body, + query: params, + }); +} + export async function hasImportPermission(params: HasImportPermissionParams): Promise { - const fileUploadModules = await lazyLoadFileUploadModules(); + const fileUploadModules = await lazyLoadModules(); try { const resp = await fileUploadModules.getHttp().fetch({ path: `/internal/file_upload/has_import_permission`, @@ -52,3 +76,29 @@ export async function hasImportPermission(params: HasImportPermissionParams): Pr return false; } } + +export async function checkIndexExists( + index: string, + params: Record = {} +): Promise { + const body = JSON.stringify({ index }); + const fileUploadModules = await lazyLoadModules(); + const { exists } = await fileUploadModules.getHttp().fetch<{ exists: boolean }>({ + path: `/internal/file_upload/index_exists`, + method: 'POST', + body, + query: params, + }); + return exists; +} + +export async function getTimeFieldRange(index: string, query: unknown, timeFieldName?: string) { + const body = JSON.stringify({ index, timeFieldName, query }); + + const fileUploadModules = await lazyLoadModules(); + return await fileUploadModules.getHttp().fetch({ + path: `/internal/file_upload/time_field_range`, + method: 'POST', + body, + }); +} diff --git a/x-pack/plugins/file_upload/public/components/geojson_upload_form/geojson_file_picker.tsx b/x-pack/plugins/file_upload/public/components/geojson_upload_form/geojson_file_picker.tsx index 2f31bc47b899c..6cd55e3a0a74a 100644 --- a/x-pack/plugins/file_upload/public/components/geojson_upload_form/geojson_file_picker.tsx +++ b/x-pack/plugins/file_upload/public/components/geojson_upload_form/geojson_file_picker.tsx @@ -9,7 +9,7 @@ import React, { Component } from 'react'; import { EuiFilePicker, EuiFormRow } from '@elastic/eui'; import { i18n } from '@kbn/i18n'; import { MB } from '../../../common'; -import { getMaxBytesFormatted } from '../../get_max_bytes'; +import { getMaxBytesFormatted } from '../../importer/get_max_bytes'; import { validateFile } from '../../importer'; import { GeoJsonImporter, diff --git a/x-pack/plugins/file_upload/public/get_max_bytes.ts b/x-pack/plugins/file_upload/public/importer/get_max_bytes.ts similarity index 91% rename from x-pack/plugins/file_upload/public/get_max_bytes.ts rename to x-pack/plugins/file_upload/public/importer/get_max_bytes.ts index 2e002e65248c9..f1ca532692e77 100644 --- a/x-pack/plugins/file_upload/public/get_max_bytes.ts +++ b/x-pack/plugins/file_upload/public/importer/get_max_bytes.ts @@ -5,7 +5,6 @@ * 2.0. */ -// @ts-ignore import numeral from '@elastic/numeral'; import { MAX_FILE_SIZE, @@ -13,8 +12,8 @@ import { ABSOLUTE_MAX_FILE_SIZE_BYTES, FILE_SIZE_DISPLAY_FORMAT, UI_SETTING_MAX_FILE_SIZE, -} from '../common'; -import { getUiSettings } from './kibana_services'; +} from '../../common'; +import { getUiSettings } from '../kibana_services'; export function getMaxBytes() { const maxFileSize = getUiSettings().get(UI_SETTING_MAX_FILE_SIZE, MAX_FILE_SIZE); diff --git a/x-pack/plugins/file_upload/public/importer/importer.ts b/x-pack/plugins/file_upload/public/importer/importer.ts index 4a87d67d0616b..49324c8f360ef 100644 --- a/x-pack/plugins/file_upload/public/importer/importer.ts +++ b/x-pack/plugins/file_upload/public/importer/importer.ts @@ -260,7 +260,7 @@ export function callImportRoute({ }); return getHttp().fetch({ - path: `/api/file_upload/import`, + path: `/internal/file_upload/import`, method: 'POST', query, body, diff --git a/x-pack/plugins/file_upload/public/importer/validate_file.ts b/x-pack/plugins/file_upload/public/importer/validate_file.ts index 4c7fe704d8afa..60d93ad552d0d 100644 --- a/x-pack/plugins/file_upload/public/importer/validate_file.ts +++ b/x-pack/plugins/file_upload/public/importer/validate_file.ts @@ -6,7 +6,7 @@ */ import { i18n } from '@kbn/i18n'; -import { getMaxBytes, getMaxBytesFormatted } from '../get_max_bytes'; +import { getMaxBytes, getMaxBytesFormatted } from './get_max_bytes'; export function validateFile(file: File, types: string[]) { if (file.size > getMaxBytes()) { diff --git a/x-pack/plugins/file_upload/public/index.ts b/x-pack/plugins/file_upload/public/index.ts index bb69a1b2efb05..792568e9c11ad 100644 --- a/x-pack/plugins/file_upload/public/index.ts +++ b/x-pack/plugins/file_upload/public/index.ts @@ -11,8 +11,6 @@ export function plugin() { return new FileUploadPlugin(); } -export * from '../common'; - export * from './importer/types'; export { FileUploadPluginStart } from './plugin'; diff --git a/x-pack/plugins/file_upload/public/lazy_load_bundle/index.ts b/x-pack/plugins/file_upload/public/lazy_load_bundle/index.ts index e1e00bee37159..9d89b6b761e25 100644 --- a/x-pack/plugins/file_upload/public/lazy_load_bundle/index.ts +++ b/x-pack/plugins/file_upload/public/lazy_load_bundle/index.ts @@ -36,7 +36,7 @@ interface LazyLoadedFileUploadModules { getHttp: () => HttpStart; } -export async function lazyLoadFileUploadModules(): Promise { +export async function lazyLoadModules(): Promise { if (typeof loadModulesPromise !== 'undefined') { return loadModulesPromise; } diff --git a/x-pack/plugins/file_upload/public/plugin.ts b/x-pack/plugins/file_upload/public/plugin.ts index a4e386b85e182..19306fadfd61c 100644 --- a/x-pack/plugins/file_upload/public/plugin.ts +++ b/x-pack/plugins/file_upload/public/plugin.ts @@ -11,10 +11,13 @@ import { getFileUploadComponent, importerFactory, hasImportPermission, + checkIndexExists, + getTimeFieldRange, + analyzeFile, } from './api'; import { setStartServices } from './kibana_services'; import { DataPublicPluginStart } from '../../../../src/plugins/data/public'; -import { getMaxBytes, getMaxBytesFormatted } from './get_max_bytes'; +import { getMaxBytes, getMaxBytesFormatted } from './importer/get_max_bytes'; // eslint-disable-next-line @typescript-eslint/no-empty-interface export interface FileUploadSetupDependencies {} @@ -43,6 +46,9 @@ export class FileUploadPlugin getMaxBytes, getMaxBytesFormatted, hasImportPermission, + checkIndexExists, + getTimeFieldRange, + analyzeFile, }; } } diff --git a/x-pack/plugins/file_upload/server/get_time_field_range.ts b/x-pack/plugins/file_upload/server/get_time_field_range.ts new file mode 100644 index 0000000000000..66a428128cbe1 --- /dev/null +++ b/x-pack/plugins/file_upload/server/get_time_field_range.ts @@ -0,0 +1,54 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ +import { IScopedClusterClient } from 'kibana/server'; +export async function getTimeFieldRange( + client: IScopedClusterClient, + index: string[] | string, + timeFieldName: string, + query: any +): Promise<{ + success: boolean; + start: { epoch: number; string: string }; + end: { epoch: number; string: string }; +}> { + const obj = { success: true, start: { epoch: 0, string: '' }, end: { epoch: 0, string: '' } }; + + const { + body: { aggregations }, + } = await client.asCurrentUser.search({ + index, + size: 0, + body: { + ...(query ? { query } : {}), + aggs: { + earliest: { + min: { + field: timeFieldName, + }, + }, + latest: { + max: { + field: timeFieldName, + }, + }, + }, + }, + }); + + if (aggregations && aggregations.earliest && aggregations.latest) { + // @ts-expect-error fix search aggregation response + obj.start.epoch = aggregations.earliest.value; + // @ts-expect-error fix search aggregation response + obj.start.string = aggregations.earliest.value_as_string; + + // @ts-expect-error fix search aggregation response + obj.end.epoch = aggregations.latest.value; + // @ts-expect-error fix search aggregation response + obj.end.string = aggregations.latest.value_as_string; + } + return obj; +} diff --git a/x-pack/plugins/file_upload/server/routes.ts b/x-pack/plugins/file_upload/server/routes.ts index 6d7eb77f39069..f2e796ec53ce0 100644 --- a/x-pack/plugins/file_upload/server/routes.ts +++ b/x-pack/plugins/file_upload/server/routes.ts @@ -16,11 +16,12 @@ import { Settings, } from '../common'; import { wrapError } from './error_wrapper'; -import { analyzeFile } from './analyze_file'; import { importDataProvider } from './import_data'; +import { getTimeFieldRange } from './get_time_field_range'; +import { analyzeFile } from './analyze_file'; import { updateTelemetry } from './telemetry'; -import { analyzeFileQuerySchema, importFileBodySchema, importFileQuerySchema } from './schemas'; +import { importFileBodySchema, importFileQuerySchema, analyzeFileQuerySchema } from './schemas'; import { CheckPrivilegesPayload } from '../../security/server'; import { StartDeps } from './types'; @@ -92,7 +93,7 @@ export function fileUploadRoutes(coreSetup: CoreSetup, logge /** * @apiGroup FileDataVisualizer * - * @api {post} /api/file_upload/analyze_file Analyze file data + * @api {post} /internal/file_upload/analyze_file Analyze file data * @apiName AnalyzeFile * @apiDescription Performs analysis of the file data. * @@ -100,7 +101,7 @@ export function fileUploadRoutes(coreSetup: CoreSetup, logge */ router.post( { - path: '/api/file_upload/analyze_file', + path: '/internal/file_data_visualizer/analyze_file', validate: { body: schema.any(), query: analyzeFileQuerySchema, @@ -130,7 +131,7 @@ export function fileUploadRoutes(coreSetup: CoreSetup, logge /** * @apiGroup FileDataVisualizer * - * @api {post} /api/file_upload/import Import file data + * @api {post} /internal/file_upload/import Import file data * @apiName ImportFile * @apiDescription Imports file data into elasticsearch index. * @@ -139,7 +140,7 @@ export function fileUploadRoutes(coreSetup: CoreSetup, logge */ router.post( { - path: '/api/file_upload/import', + path: '/internal/file_upload/import', validate: { query: importFileQuerySchema, body: importFileBodySchema, @@ -180,4 +181,90 @@ export function fileUploadRoutes(coreSetup: CoreSetup, logge } } ); + + /** + * @apiGroup FileDataVisualizer + * + * @api {post} /internal/file_upload/index_exists ES Field caps wrapper checks if index exists + * @apiName IndexExists + */ + router.post( + { + path: '/internal/file_upload/index_exists', + validate: { + body: schema.object({ index: schema.string() }), + }, + options: { + tags: ['access:fileUpload:analyzeFile'], + }, + }, + async (context, request, response) => { + try { + const { index } = request.body; + + const options = { + index: [index], + fields: ['*'], + ignore_unavailable: true, + allow_no_indices: true, + }; + + const { body } = await context.core.elasticsearch.client.asCurrentUser.fieldCaps(options); + const exists = Array.isArray(body.indices) && body.indices.length !== 0; + return response.ok({ + body: { exists }, + }); + } catch (e) { + return response.customError(wrapError(e)); + } + } + ); + + /** + * @apiGroup FileDataVisualizer + * + * @api {post} /internal/file_upload/time_field_range Get time field range + * @apiName GetTimeFieldRange + * @apiDescription Returns the time range for the given index and query using the specified time range. + * + * @apiSchema (body) getTimeFieldRangeSchema + * + * @apiSuccess {Object} start start of time range with epoch and string properties. + * @apiSuccess {Object} end end of time range with epoch and string properties. + */ + router.post( + { + path: '/internal/file_upload/time_field_range', + validate: { + body: schema.object({ + /** Index or indexes for which to return the time range. */ + index: schema.oneOf([schema.string(), schema.arrayOf(schema.string())]), + /** Name of the time field in the index. */ + timeFieldName: schema.string(), + /** Query to match documents in the index(es). */ + query: schema.maybe(schema.any()), + }), + }, + options: { + tags: ['access:fileUpload:analyzeFile'], + }, + }, + async (context, request, response) => { + try { + const { index, timeFieldName, query } = request.body; + const resp = await getTimeFieldRange( + context.core.elasticsearch.client, + index, + timeFieldName, + query + ); + + return response.ok({ + body: resp, + }); + } catch (e) { + return response.customError(wrapError(e)); + } + } + ); } diff --git a/x-pack/plugins/file_upload/tsconfig.json b/x-pack/plugins/file_upload/tsconfig.json index 887a05af31174..3e146d76fbb90 100644 --- a/x-pack/plugins/file_upload/tsconfig.json +++ b/x-pack/plugins/file_upload/tsconfig.json @@ -13,5 +13,6 @@ { "path": "../../../src/plugins/data/tsconfig.json" }, { "path": "../../../src/plugins/usage_collection/tsconfig.json" }, { "path": "../security/tsconfig.json" }, + { "path": "../../../src/plugins/embeddable/tsconfig.json" }, ] } diff --git a/x-pack/plugins/fleet/common/constants/epm.ts b/x-pack/plugins/fleet/common/constants/epm.ts index faa1127cfe1da..7bf3c3e6205ec 100644 --- a/x-pack/plugins/fleet/common/constants/epm.ts +++ b/x-pack/plugins/fleet/common/constants/epm.ts @@ -15,6 +15,7 @@ export const requiredPackages = { System: 'system', Endpoint: 'endpoint', ElasticAgent: 'elastic_agent', + SecurityDetectionEngine: 'security_detection_engine', } as const; // these are currently identical. we can separate if they later diverge diff --git a/x-pack/plugins/fleet/common/constants/routes.ts b/x-pack/plugins/fleet/common/constants/routes.ts index 5aeba4bc3881d..377cb8d8bd871 100644 --- a/x-pack/plugins/fleet/common/constants/routes.ts +++ b/x-pack/plugins/fleet/common/constants/routes.ts @@ -76,6 +76,7 @@ export const SETTINGS_API_ROUTES = { // App API routes export const APP_API_ROUTES = { CHECK_PERMISSIONS_PATTERN: `${API_ROOT}/check-permissions`, + GENERATE_SERVICE_TOKEN_PATTERN: `${API_ROOT}/service-tokens`, }; // Agent API routes diff --git a/x-pack/plugins/fleet/common/openapi/bundled.json b/x-pack/plugins/fleet/common/openapi/bundled.json index 388aebed9a85b..b121095c8b91b 100644 --- a/x-pack/plugins/fleet/common/openapi/bundled.json +++ b/x-pack/plugins/fleet/common/openapi/bundled.json @@ -446,234 +446,6 @@ ] } }, - "/agents/{agentId}/acks": { - "parameters": [ - { - "schema": { - "type": "string" - }, - "name": "agentId", - "in": "path", - "required": true - } - ], - "post": { - "summary": "Fleet - Agent - Acks", - "tags": [], - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "type": "object", - "properties": { - "action": { - "type": "string", - "enum": [ - "acks" - ] - } - }, - "required": [ - "action" - ] - } - } - } - } - }, - "operationId": "post-fleet-agents-agentId-acks", - "parameters": [ - { - "$ref": "#/paths/~1setup/post/parameters/0" - } - ], - "requestBody": { - "content": { - "application/json": { - "schema": { - "type": "object", - "properties": {} - } - } - } - } - } - }, - "/agents/{agentId}/checkin": { - "parameters": [ - { - "schema": { - "type": "string" - }, - "name": "agentId", - "in": "path", - "required": true - } - ], - "post": { - "summary": "Fleet - Agent - Check In", - "tags": [], - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "type": "object", - "properties": { - "action": { - "type": "string", - "enum": [ - "checkin" - ] - }, - "actions": { - "type": "array", - "items": { - "type": "object", - "properties": { - "agent_id": { - "type": "string" - }, - "data": { - "type": "object" - }, - "id": { - "type": "string" - }, - "created_at": { - "type": "string", - "format": "date-time" - }, - "type": { - "type": "string" - } - }, - "required": [ - "agent_id", - "data", - "id", - "created_at", - "type" - ] - } - } - } - } - } - } - } - }, - "operationId": "post-fleet-agents-agentId-checkin", - "parameters": [ - { - "$ref": "#/paths/~1setup/post/parameters/0" - } - ], - "security": [ - { - "Access API Key": [] - } - ], - "requestBody": { - "content": { - "application/json": { - "schema": { - "type": "object", - "properties": { - "local_metadata": { - "title": "AgentMetadata", - "type": "object" - }, - "events": { - "type": "array", - "items": { - "title": "NewAgentEvent", - "type": "object", - "properties": { - "type": { - "type": "string", - "enum": [ - "STATE", - "ERROR", - "ACTION_RESULT", - "ACTION" - ] - }, - "subtype": { - "type": "string", - "enum": [ - "RUNNING", - "STARTING", - "IN_PROGRESS", - "CONFIG", - "FAILED", - "STOPPING", - "STOPPED", - "DEGRADED", - "DATA_DUMP", - "ACKNOWLEDGED", - "UNKNOWN" - ] - }, - "timestamp": { - "type": "string" - }, - "message": { - "type": "string" - }, - "payload": { - "type": "string" - }, - "agent_id": { - "type": "string" - }, - "policy_id": { - "type": "string" - }, - "stream_id": { - "type": "string" - }, - "action_id": { - "type": "string" - } - }, - "required": [ - "type", - "subtype", - "timestamp", - "message", - "agent_id" - ] - } - } - } - } - } - } - } - } - }, - "/agents/{agentId}/events": { - "parameters": [ - { - "schema": { - "type": "string" - }, - "name": "agentId", - "in": "path", - "required": true - } - ], - "get": { - "summary": "Fleet - Agent - Events", - "tags": [], - "responses": {}, - "operationId": "get-fleet-agents-agentId-events" - } - }, "/agents/{agentId}/unenroll": { "parameters": [ { @@ -701,6 +473,9 @@ "schema": { "type": "object", "properties": { + "revoke": { + "type": "boolean" + }, "force": { "type": "boolean" } @@ -895,184 +670,6 @@ } } }, - "/agents/enroll": { - "post": { - "summary": "Fleet - Agent - Enroll", - "tags": [], - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "type": "object", - "properties": { - "action": { - "type": "string" - }, - "item": { - "title": "Agent", - "type": "object", - "properties": { - "type": { - "type": "string", - "title": "AgentType", - "enum": [ - "PERMANENT", - "EPHEMERAL", - "TEMPORARY" - ] - }, - "active": { - "type": "boolean" - }, - "enrolled_at": { - "type": "string" - }, - "unenrolled_at": { - "type": "string" - }, - "unenrollment_started_at": { - "type": "string" - }, - "shared_id": { - "type": "string", - "deprecated": true - }, - "access_api_key_id": { - "type": "string" - }, - "default_api_key_id": { - "type": "string" - }, - "policy_id": { - "type": "string" - }, - "policy_revision": { - "type": "number" - }, - "last_checkin": { - "type": "string" - }, - "user_provided_metadata": { - "$ref": "#/paths/~1agents~1%7BagentId%7D~1checkin/post/requestBody/content/application~1json/schema/properties/local_metadata" - }, - "local_metadata": { - "$ref": "#/paths/~1agents~1%7BagentId%7D~1checkin/post/requestBody/content/application~1json/schema/properties/local_metadata" - }, - "id": { - "type": "string" - }, - "current_error_events": { - "type": "array", - "items": { - "title": "AgentEvent", - "allOf": [ - { - "type": "object", - "properties": { - "id": { - "type": "string" - } - }, - "required": [ - "id" - ] - }, - { - "$ref": "#/paths/~1agents~1%7BagentId%7D~1checkin/post/requestBody/content/application~1json/schema/properties/events/items" - } - ] - } - }, - "access_api_key": { - "type": "string" - }, - "status": { - "type": "string", - "title": "AgentStatus", - "enum": [ - "offline", - "error", - "online", - "inactive", - "warning" - ] - }, - "default_api_key": { - "type": "string" - } - }, - "required": [ - "type", - "active", - "enrolled_at", - "id", - "current_error_events", - "status" - ] - } - } - } - } - } - } - }, - "operationId": "post-fleet-agents-enroll", - "parameters": [ - { - "$ref": "#/paths/~1setup/post/parameters/0" - } - ], - "requestBody": { - "content": { - "application/json": { - "schema": { - "type": "object", - "properties": { - "type": { - "type": "string", - "enum": [ - "PERMANENT", - "EPHEMERAL", - "TEMPORARY" - ] - }, - "shared_id": { - "type": "string", - "deprecated": true - }, - "metadata": { - "type": "object", - "required": [ - "local", - "user_provided" - ], - "properties": { - "local": { - "$ref": "#/paths/~1agents~1%7BagentId%7D~1checkin/post/requestBody/content/application~1json/schema/properties/local_metadata" - }, - "user_provided": { - "$ref": "#/paths/~1agents~1%7BagentId%7D~1checkin/post/requestBody/content/application~1json/schema/properties/local_metadata" - } - } - } - }, - "required": [ - "type", - "metadata" - ] - } - } - } - }, - "security": [ - { - "Enrollment API Key": [] - } - ] - } - }, "/agents/setup": { "get": { "summary": "Agents setup - Info", diff --git a/x-pack/plugins/fleet/common/openapi/bundled.yaml b/x-pack/plugins/fleet/common/openapi/bundled.yaml index 227faffdac489..537ef136c7611 100644 --- a/x-pack/plugins/fleet/common/openapi/bundled.yaml +++ b/x-pack/plugins/fleet/common/openapi/bundled.yaml @@ -277,156 +277,6 @@ paths: operationId: get-fleet-agents security: - basicAuth: [] - '/agents/{agentId}/acks': - parameters: - - schema: - type: string - name: agentId - in: path - required: true - post: - summary: Fleet - Agent - Acks - tags: [] - responses: - '200': - description: OK - content: - application/json: - schema: - type: object - properties: - action: - type: string - enum: - - acks - required: - - action - operationId: post-fleet-agents-agentId-acks - parameters: - - $ref: '#/paths/~1setup/post/parameters/0' - requestBody: - content: - application/json: - schema: - type: object - properties: {} - '/agents/{agentId}/checkin': - parameters: - - schema: - type: string - name: agentId - in: path - required: true - post: - summary: Fleet - Agent - Check In - tags: [] - responses: - '200': - description: OK - content: - application/json: - schema: - type: object - properties: - action: - type: string - enum: - - checkin - actions: - type: array - items: - type: object - properties: - agent_id: - type: string - data: - type: object - id: - type: string - created_at: - type: string - format: date-time - type: - type: string - required: - - agent_id - - data - - id - - created_at - - type - operationId: post-fleet-agents-agentId-checkin - parameters: - - $ref: '#/paths/~1setup/post/parameters/0' - security: - - Access API Key: [] - requestBody: - content: - application/json: - schema: - type: object - properties: - local_metadata: - title: AgentMetadata - type: object - events: - type: array - items: - title: NewAgentEvent - type: object - properties: - type: - type: string - enum: - - STATE - - ERROR - - ACTION_RESULT - - ACTION - subtype: - type: string - enum: - - RUNNING - - STARTING - - IN_PROGRESS - - CONFIG - - FAILED - - STOPPING - - STOPPED - - DEGRADED - - DATA_DUMP - - ACKNOWLEDGED - - UNKNOWN - timestamp: - type: string - message: - type: string - payload: - type: string - agent_id: - type: string - policy_id: - type: string - stream_id: - type: string - action_id: - type: string - required: - - type - - subtype - - timestamp - - message - - agent_id - '/agents/{agentId}/events': - parameters: - - schema: - type: string - name: agentId - in: path - required: true - get: - summary: Fleet - Agent - Events - tags: [] - responses: {} - operationId: get-fleet-agents-agentId-events '/agents/{agentId}/unenroll': parameters: - schema: @@ -447,6 +297,8 @@ paths: schema: type: object properties: + revoke: + type: boolean force: type: boolean '/agents/{agentId}/upgrade': @@ -558,123 +410,6 @@ paths: required: - version - agents - /agents/enroll: - post: - summary: Fleet - Agent - Enroll - tags: [] - responses: - '200': - description: OK - content: - application/json: - schema: - type: object - properties: - action: - type: string - item: - title: Agent - type: object - properties: - type: - type: string - title: AgentType - enum: - - PERMANENT - - EPHEMERAL - - TEMPORARY - active: - type: boolean - enrolled_at: - type: string - unenrolled_at: - type: string - unenrollment_started_at: - type: string - shared_id: - type: string - deprecated: true - access_api_key_id: - type: string - default_api_key_id: - type: string - policy_id: - type: string - policy_revision: - type: number - last_checkin: - type: string - user_provided_metadata: - $ref: '#/paths/~1agents~1%7BagentId%7D~1checkin/post/requestBody/content/application~1json/schema/properties/local_metadata' - local_metadata: - $ref: '#/paths/~1agents~1%7BagentId%7D~1checkin/post/requestBody/content/application~1json/schema/properties/local_metadata' - id: - type: string - current_error_events: - type: array - items: - title: AgentEvent - allOf: - - type: object - properties: - id: - type: string - required: - - id - - $ref: '#/paths/~1agents~1%7BagentId%7D~1checkin/post/requestBody/content/application~1json/schema/properties/events/items' - access_api_key: - type: string - status: - type: string - title: AgentStatus - enum: - - offline - - error - - online - - inactive - - warning - default_api_key: - type: string - required: - - type - - active - - enrolled_at - - id - - current_error_events - - status - operationId: post-fleet-agents-enroll - parameters: - - $ref: '#/paths/~1setup/post/parameters/0' - requestBody: - content: - application/json: - schema: - type: object - properties: - type: - type: string - enum: - - PERMANENT - - EPHEMERAL - - TEMPORARY - shared_id: - type: string - deprecated: true - metadata: - type: object - required: - - local - - user_provided - properties: - local: - $ref: '#/paths/~1agents~1%7BagentId%7D~1checkin/post/requestBody/content/application~1json/schema/properties/local_metadata' - user_provided: - $ref: '#/paths/~1agents~1%7BagentId%7D~1checkin/post/requestBody/content/application~1json/schema/properties/local_metadata' - required: - - type - - metadata - security: - - Enrollment API Key: [] /agents/setup: get: summary: Agents setup - Info diff --git a/x-pack/plugins/fleet/common/openapi/components/schemas/agent_event.yaml b/x-pack/plugins/fleet/common/openapi/components/schemas/agent_event.yaml deleted file mode 100644 index ada709378a9b1..0000000000000 --- a/x-pack/plugins/fleet/common/openapi/components/schemas/agent_event.yaml +++ /dev/null @@ -1,9 +0,0 @@ -title: AgentEvent -allOf: - - type: object - properties: - id: - type: string - required: - - id - - $ref: ./new_agent_event.yaml diff --git a/x-pack/plugins/fleet/common/openapi/components/schemas/new_agent_event.yaml b/x-pack/plugins/fleet/common/openapi/components/schemas/new_agent_event.yaml deleted file mode 100644 index ee4ddfb5f004d..0000000000000 --- a/x-pack/plugins/fleet/common/openapi/components/schemas/new_agent_event.yaml +++ /dev/null @@ -1,44 +0,0 @@ -title: NewAgentEvent -type: object -properties: - type: - type: string - enum: - - STATE - - ERROR - - ACTION_RESULT - - ACTION - subtype: - type: string - enum: - - RUNNING - - STARTING - - IN_PROGRESS - - CONFIG - - FAILED - - STOPPING - - STOPPED - - DEGRADED - - DATA_DUMP - - ACKNOWLEDGED - - UNKNOWN - timestamp: - type: string - message: - type: string - payload: - type: string - agent_id: - type: string - policy_id: - type: string - stream_id: - type: string - action_id: - type: string -required: - - type - - subtype - - timestamp - - message - - agent_id diff --git a/x-pack/plugins/fleet/common/openapi/entrypoint.yaml b/x-pack/plugins/fleet/common/openapi/entrypoint.yaml index 791d3da56783e..6ea8ae966bdca 100644 --- a/x-pack/plugins/fleet/common/openapi/entrypoint.yaml +++ b/x-pack/plugins/fleet/common/openapi/entrypoint.yaml @@ -22,20 +22,12 @@ paths: $ref: paths/agent_status.yaml /agents: $ref: paths/agents.yaml - '/agents/{agentId}/acks': - $ref: 'paths/agents@{agent_id}@acks.yaml' - '/agents/{agentId}/checkin': - $ref: 'paths/agents@{agent_id}@checkin.yaml' - '/agents/{agentId}/events': - $ref: 'paths/agents@{agent_id}@events.yaml' '/agents/{agentId}/unenroll': $ref: 'paths/agents@{agent_id}@unenroll.yaml' '/agents/{agentId}/upgrade': $ref: 'paths/agents@{agent_id}@upgrade.yaml' /agents/bulk_upgrade: $ref: paths/agents@bulk_upgrade.yaml - /agents/enroll: - $ref: paths/agents@enroll.yaml /agents/setup: $ref: paths/agents@setup.yaml /enrollment-api-keys: diff --git a/x-pack/plugins/fleet/common/openapi/paths/README.md b/x-pack/plugins/fleet/common/openapi/paths/README.md index f5003e3e3473b..e5bd80632c7ee 100644 --- a/x-pack/plugins/fleet/common/openapi/paths/README.md +++ b/x-pack/plugins/fleet/common/openapi/paths/README.md @@ -30,9 +30,6 @@ paths/ ├── agents@enroll.yaml ├── agents@setup.yaml ├── agents@{agent_id}.yaml -├── agents@{agent_id}@acks.yaml -├── agents@{agent_id}@checkin.yaml -├── agents@{agent_id}@events.yaml ├── agents@{agent_id}@unenroll.yaml ├── agents@{agent_id}@upgrade.yaml ├── enrollment_api_keys.yaml diff --git a/x-pack/plugins/fleet/common/openapi/paths/agents@{agent_id}@unenroll.yaml b/x-pack/plugins/fleet/common/openapi/paths/agents@{agent_id}@unenroll.yaml index 00c9cdfbcf4ae..eccbbbfc9b8ca 100644 --- a/x-pack/plugins/fleet/common/openapi/paths/agents@{agent_id}@unenroll.yaml +++ b/x-pack/plugins/fleet/common/openapi/paths/agents@{agent_id}@unenroll.yaml @@ -17,5 +17,7 @@ post: schema: type: object properties: + revoke: + type: boolean force: type: boolean diff --git a/x-pack/plugins/fleet/common/services/routes.ts b/x-pack/plugins/fleet/common/services/routes.ts index e1b3791d9cbb5..6156decf8641d 100644 --- a/x-pack/plugins/fleet/common/services/routes.ts +++ b/x-pack/plugins/fleet/common/services/routes.ts @@ -164,6 +164,7 @@ export const settingsRoutesService = { export const appRoutesService = { getCheckPermissionsPath: () => APP_API_ROUTES.CHECK_PERMISSIONS_PATTERN, + getRegenerateServiceTokenPath: () => APP_API_ROUTES.GENERATE_SERVICE_TOKEN_PATTERN, }; export const enrollmentAPIKeyRouteService = { diff --git a/x-pack/plugins/fleet/common/types/models/settings.ts b/x-pack/plugins/fleet/common/types/models/settings.ts index 2d7e90a3424d7..15d7492868797 100644 --- a/x-pack/plugins/fleet/common/types/models/settings.ts +++ b/x-pack/plugins/fleet/common/types/models/settings.ts @@ -9,6 +9,7 @@ import type { SavedObjectAttributes } from 'src/core/public'; export interface BaseSettings { has_seen_add_data_notice?: boolean; + has_seen_fleet_migration_notice?: boolean; fleet_server_hosts: string[]; } diff --git a/x-pack/plugins/fleet/common/types/rest_spec/agent.ts b/x-pack/plugins/fleet/common/types/rest_spec/agent.ts index 4616e92925b3a..47f9112d4ab59 100644 --- a/x-pack/plugins/fleet/common/types/rest_spec/agent.ts +++ b/x-pack/plugins/fleet/common/types/rest_spec/agent.ts @@ -108,6 +108,7 @@ export interface PostAgentUnenrollRequest { }; body: { force?: boolean; + revoke?: boolean; }; } @@ -118,6 +119,7 @@ export interface PostBulkAgentUnenrollRequest { body: { agents: string[] | string; force?: boolean; + revoke?: boolean; }; } diff --git a/x-pack/plugins/fleet/common/types/rest_spec/app.ts b/x-pack/plugins/fleet/common/types/rest_spec/app.ts index 3e54cf04d7533..a742c387c14aa 100644 --- a/x-pack/plugins/fleet/common/types/rest_spec/app.ts +++ b/x-pack/plugins/fleet/common/types/rest_spec/app.ts @@ -9,3 +9,8 @@ export interface CheckPermissionsResponse { error?: 'MISSING_SECURITY' | 'MISSING_SUPERUSER_ROLE'; success: boolean; } + +export interface GenerateServiceTokenResponse { + name: string; + value: string; +} diff --git a/x-pack/plugins/fleet/public/applications/fleet/app.tsx b/x-pack/plugins/fleet/public/applications/fleet/app.tsx index f2eee6228906a..4a47d39b77934 100644 --- a/x-pack/plugins/fleet/public/applications/fleet/app.tsx +++ b/x-pack/plugins/fleet/public/applications/fleet/app.tsx @@ -83,14 +83,14 @@ export const WithPermissionsAndSetup: React.FC = memo(({ children }) => { if (setupResponse.error) { setInitializationError(setupResponse.error); } - if (setupResponse.data.preconfigurationError) { + if (setupResponse.data?.preconfigurationError) { notifications.toasts.addError(setupResponse.data.preconfigurationError, { title: i18n.translate('xpack.fleet.setup.uiPreconfigurationErrorTitle', { defaultMessage: 'Configuration error', }), }); } - if (setupResponse.data.nonFatalPackageUpgradeErrors) { + if (setupResponse.data?.nonFatalPackageUpgradeErrors) { notifications.toasts.addError(setupResponse.data.nonFatalPackageUpgradeErrors, { title: i18n.translate('xpack.fleet.setup.nonFatalPackageErrorsTitle', { defaultMessage: 'One or more packages could not be successfully upgraded', diff --git a/x-pack/plugins/fleet/public/applications/fleet/components/settings_flyout/confirm_modal.tsx b/x-pack/plugins/fleet/public/applications/fleet/components/settings_flyout/confirm_modal.tsx index 8bef32916452f..ae9863e84d605 100644 --- a/x-pack/plugins/fleet/public/applications/fleet/components/settings_flyout/confirm_modal.tsx +++ b/x-pack/plugins/fleet/public/applications/fleet/components/settings_flyout/confirm_modal.tsx @@ -113,7 +113,7 @@ export const SettingsConfirmModal = React.memo( title={ } color="warning" @@ -124,13 +124,13 @@ export const SettingsConfirmModal = React.memo(

), @@ -143,13 +143,13 @@ export const SettingsConfirmModal = React.memo(

), @@ -178,7 +178,7 @@ export const SettingsConfirmModal = React.memo( diff --git a/x-pack/plugins/fleet/public/applications/fleet/components/settings_flyout/index.tsx b/x-pack/plugins/fleet/public/applications/fleet/components/settings_flyout/index.tsx index 30e1aedc3e5a5..f3c353fd75dba 100644 --- a/x-pack/plugins/fleet/public/applications/fleet/components/settings_flyout/index.tsx +++ b/x-pack/plugins/fleet/public/applications/fleet/components/settings_flyout/index.tsx @@ -251,19 +251,10 @@ export const SettingFlyout: React.FunctionComponent = ({ onClose }) => { const body = settings && ( - -

- -

-
- outputs, }} @@ -279,7 +270,7 @@ export const SettingFlyout: React.FunctionComponent = ({ onClose }) => { helpText={ = ({ onClose }) => { defaultMessage: 'Elasticsearch hosts', })} helpText={i18n.translate('xpack.fleet.settings.elasticsearchUrlsHelpTect', { - defaultMessage: 'Specify the Elasticsearch URLs where agents will send data.', + defaultMessage: 'Specify the Elasticsearch URLs where agents send data.', })} {...inputs.elasticsearchUrl.formRowProps} > diff --git a/x-pack/plugins/fleet/public/applications/fleet/hooks/use_link.ts b/x-pack/plugins/fleet/public/applications/fleet/hooks/use_link.ts index 440cd693d7af2..5c31f6fc4158e 100644 --- a/x-pack/plugins/fleet/public/applications/fleet/hooks/use_link.ts +++ b/x-pack/plugins/fleet/public/applications/fleet/hooks/use_link.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { BASE_PATH, pagePathGetters } from '../constants'; +import { BASE_PATH, pagePathGetters, PLUGIN_ID } from '../constants'; import type { StaticPage, DynamicPage, DynamicPagePathValues } from '../constants'; import { useStartServices } from './'; @@ -18,6 +18,8 @@ export const useLink = () => { const core = useStartServices(); return { getPath, + getAssetsPath: (path: string) => + core.http.basePath.prepend(`/plugins/${PLUGIN_ID}/assets/${path}`), getHref: (page: StaticPage | DynamicPage, values?: DynamicPagePathValues) => { const path = getPath(page, values); return core.http.basePath.prepend(`${BASE_PATH}#${path}`); diff --git a/x-pack/plugins/fleet/public/applications/fleet/hooks/use_request/app.ts b/x-pack/plugins/fleet/public/applications/fleet/hooks/use_request/app.ts index bd690a4b53e07..c84dd0fd15b44 100644 --- a/x-pack/plugins/fleet/public/applications/fleet/hooks/use_request/app.ts +++ b/x-pack/plugins/fleet/public/applications/fleet/hooks/use_request/app.ts @@ -6,7 +6,7 @@ */ import { appRoutesService } from '../../services'; -import type { CheckPermissionsResponse } from '../../types'; +import type { CheckPermissionsResponse, GenerateServiceTokenResponse } from '../../types'; import { sendRequest } from './use_request'; @@ -16,3 +16,10 @@ export const sendGetPermissionsCheck = () => { method: 'get', }); }; + +export const sendGenerateServiceToken = () => { + return sendRequest({ + path: appRoutesService.getRegenerateServiceTokenPath(), + method: 'post', + }); +}; diff --git a/x-pack/plugins/fleet/public/applications/fleet/sections/agents/agent_list_page/index.tsx b/x-pack/plugins/fleet/public/applications/fleet/sections/agents/agent_list_page/index.tsx index b3c0cf93c88ef..88249f7f5d5ce 100644 --- a/x-pack/plugins/fleet/public/applications/fleet/sections/agents/agent_list_page/index.tsx +++ b/x-pack/plugins/fleet/public/applications/fleet/sections/agents/agent_list_page/index.tsx @@ -407,7 +407,7 @@ export const AgentListPage: React.FunctionComponent<{}> = () => { {safeMetadata(version)} - {isAgentUpgradeable(agent, kibanaVersion) ? ( + {isAgentSelectable(agent) && isAgentUpgradeable(agent, kibanaVersion) ? ( @@ -593,7 +593,15 @@ export const AgentListPage: React.FunctionComponent<{}> = () => { emptyPrompt ) } - items={totalAgents ? agents : []} + items={ + totalAgents + ? showUpgradeable + ? agents.filter( + (agent) => isAgentSelectable(agent) && isAgentUpgradeable(agent, kibanaVersion) + ) + : agents + : [] + } itemId="id" columns={columns} pagination={{ diff --git a/x-pack/plugins/fleet/public/applications/fleet/sections/agents/agent_requirements_page/fleet_server_requirement_page.tsx b/x-pack/plugins/fleet/public/applications/fleet/sections/agents/agent_requirements_page/fleet_server_requirement_page.tsx index e5f3cdbcfba97..2e37d9efc7857 100644 --- a/x-pack/plugins/fleet/public/applications/fleet/sections/agents/agent_requirements_page/fleet_server_requirement_page.tsx +++ b/x-pack/plugins/fleet/public/applications/fleet/sections/agents/agent_requirements_page/fleet_server_requirement_page.tsx @@ -5,7 +5,7 @@ * 2.0. */ -import React from 'react'; +import React, { useState, useMemo, useCallback } from 'react'; import { EuiButton, EuiFlexGroup, @@ -16,62 +16,283 @@ import { EuiText, EuiLink, EuiEmptyPrompt, + EuiSteps, + EuiCodeBlock, + EuiCallOut, + EuiSelect, } from '@elastic/eui'; +import type { EuiStepProps } from '@elastic/eui/src/components/steps/step'; import styled from 'styled-components'; -import { FormattedMessage } from 'react-intl'; +import { i18n } from '@kbn/i18n'; +import { FormattedMessage } from '@kbn/i18n/react'; -import { useStartServices } from '../../../hooks'; +import { DownloadStep } from '../components/agent_enrollment_flyout/steps'; +import { useStartServices, useGetOutputs, sendGenerateServiceToken } from '../../../hooks'; + +const FlexItemWithMinWidth = styled(EuiFlexItem)` + min-width: 0px; + max-width: 100%; +`; export const ContentWrapper = styled(EuiFlexGroup)` height: 100%; + margin: 0 auto; + max-width: 800px; `; -function renderOnPremInstructions() { +// Otherwise the copy button is over the text +const CommandCode = styled.pre({ + overflow: 'scroll', +}); + +type PLATFORM_TYPE = 'linux-mac' | 'windows' | 'rpm-deb'; +const PLATFORM_OPTIONS: Array<{ text: string; value: PLATFORM_TYPE }> = [ + { text: 'Linux / macOS', value: 'linux-mac' }, + { text: 'Windows', value: 'windows' }, + { text: 'RPM / DEB', value: 'rpm-deb' }, +]; + +export const ServiceTokenStep = ({ + serviceToken, + getServiceToken, + isLoadingServiceToken, +}: { + serviceToken?: string; + getServiceToken: () => void; + isLoadingServiceToken: boolean; +}): EuiStepProps => { + return { + title: i18n.translate('xpack.fleet.fleetServerSetup.stepGenerateServiceTokenTitle', { + defaultMessage: 'Generate a service token', + }), + children: ( + <> + + + + + {!serviceToken ? ( + + + { + getServiceToken(); + }} + > + + + + + ) : ( + <> + + + + + + + + + + + + + {serviceToken} + + + + + )} + + ), + }; +}; + +export const FleetServerCommandStep = ({ + serviceToken, + installCommand, + platform, + setPlatform, +}: { + serviceToken?: string; + installCommand: string; + platform: string; + setPlatform: (platform: PLATFORM_TYPE) => void; +}): EuiStepProps => { + return { + title: i18n.translate('xpack.fleet.fleetServerSetup.stepInstallAgentTitle', { + defaultMessage: 'Start Fleet Server', + }), + status: !serviceToken ? 'disabled' : undefined, + children: serviceToken ? ( + <> + + + + + ), + }} + /> + + + + + + } + options={PLATFORM_OPTIONS} + value={platform} + onChange={(e) => setPlatform(e.target.value as PLATFORM_TYPE)} + aria-label={i18n.translate('xpack.fleet.fleetServerSetup.platformSelectAriaLabel', { + defaultMessage: 'Platform', + })} + /> + + + {installCommand} + + + ) : null, + }; +}; + +export const useFleetServerInstructions = () => { + const outputsRequest = useGetOutputs(); + const { notifications } = useStartServices(); + const [serviceToken, setServiceToken] = useState(); + const [isLoadingServiceToken, setIsLoadingServiceToken] = useState(false); + const [platform, setPlatform] = useState('linux-mac'); + + const output = outputsRequest.data?.items?.[0]; + const esHost = output?.hosts?.[0]; + + const installCommand = useMemo((): string => { + if (!serviceToken || !esHost) { + return ''; + } + switch (platform) { + case 'linux-mac': + return `sudo ./elastic-agent install -f --fleet-server-es=${esHost} --fleet-server-service-token=${serviceToken}`; + case 'windows': + return `.\\elastic-agent.exe install --fleet-server-es=${esHost} --fleet-server-service-token=${serviceToken}`; + case 'rpm-deb': + return `sudo elastic-agent enroll -f --fleet-server-es=${esHost} --fleet-server-service-token=${serviceToken}`; + default: + return ''; + } + }, [serviceToken, esHost, platform]); + + const getServiceToken = useCallback(async () => { + setIsLoadingServiceToken(true); + try { + const { data } = await sendGenerateServiceToken(); + if (data?.value) { + setServiceToken(data?.value); + } + } catch (err) { + notifications.toasts.addError(err, { + title: i18n.translate('xpack.fleet.fleetServerSetup.errorGeneratingTokenTitleText', { + defaultMessage: 'Error generating token', + }), + }); + } + + setIsLoadingServiceToken(false); + }, [notifications]); + + return { + serviceToken, + getServiceToken, + isLoadingServiceToken, + installCommand, + platform, + setPlatform, + }; +}; + +const OnPremInstructions: React.FC = () => { + const { + serviceToken, + getServiceToken, + isLoadingServiceToken, + installCommand, + platform, + setPlatform, + } = useFleetServerInstructions(); + return ( - - - -

- } - body={ + + + +

- } - actions={ - - - - } +

+ + + + + ), + }} + /> +
+ +
); -} +}; -function renderCloudInstructions(deploymentUrl: string) { +const CloudInstructions: React.FC<{ deploymentUrl: string }> = ({ deploymentUrl }) => { return ( ); -} +}; export const FleetServerRequirementPage = () => { const startService = useStartServices(); @@ -134,11 +355,16 @@ export const FleetServerRequirementPage = () => { return ( <> - + + + {deploymentUrl ? ( + + ) : ( + + )} + - {deploymentUrl ? renderCloudInstructions(deploymentUrl) : renderOnPremInstructions()} - - + diff --git a/x-pack/plugins/fleet/public/applications/fleet/sections/agents/agent_requirements_page/index.tsx b/x-pack/plugins/fleet/public/applications/fleet/sections/agents/agent_requirements_page/index.tsx index 9993014f55cdb..9e6505ede4918 100644 --- a/x-pack/plugins/fleet/public/applications/fleet/sections/agents/agent_requirements_page/index.tsx +++ b/x-pack/plugins/fleet/public/applications/fleet/sections/agents/agent_requirements_page/index.tsx @@ -6,4 +6,9 @@ */ export { MissingESRequirementsPage } from './es_requirements_page'; -export { FleetServerRequirementPage } from './fleet_server_requirement_page'; +export { + FleetServerRequirementPage, + ServiceTokenStep, + FleetServerCommandStep, + useFleetServerInstructions, +} from './fleet_server_requirement_page'; diff --git a/x-pack/plugins/fleet/public/applications/fleet/sections/agents/components/agent_enrollment_flyout/index.tsx b/x-pack/plugins/fleet/public/applications/fleet/sections/agents/components/agent_enrollment_flyout/index.tsx index d3c6ec114ee0a..0ad1706e5273f 100644 --- a/x-pack/plugins/fleet/public/applications/fleet/sections/agents/components/agent_enrollment_flyout/index.tsx +++ b/x-pack/plugins/fleet/public/applications/fleet/sections/agents/components/agent_enrollment_flyout/index.tsx @@ -129,12 +129,12 @@ export const AgentEnrollmentFlyout: React.FunctionComponent = ({ ) : undefined } > - {fleetServerHosts.length === 0 ? null : mode === 'managed' ? ( + {fleetServerHosts.length === 0 && mode === 'managed' ? null : mode === 'managed' ? ( ) : ( diff --git a/x-pack/plugins/fleet/public/applications/fleet/sections/agents/components/agent_enrollment_flyout/managed_instructions.tsx b/x-pack/plugins/fleet/public/applications/fleet/sections/agents/components/agent_enrollment_flyout/managed_instructions.tsx index 34b3536ac2810..8f6a2a26a2f6f 100644 --- a/x-pack/plugins/fleet/public/applications/fleet/sections/agents/components/agent_enrollment_flyout/managed_instructions.tsx +++ b/x-pack/plugins/fleet/public/applications/fleet/sections/agents/components/agent_enrollment_flyout/managed_instructions.tsx @@ -5,7 +5,7 @@ * 2.0. */ -import React, { useState } from 'react'; +import React, { useState, useMemo } from 'react'; import { EuiSteps, EuiLink, EuiText, EuiSpacer } from '@elastic/eui'; import type { EuiContainedStepProps } from '@elastic/eui/src/components/steps/steps'; import { i18n } from '@kbn/i18n'; @@ -19,7 +19,12 @@ import { useFleetStatus, } from '../../../../hooks'; import { ManualInstructions } from '../../../../components/enrollment_instructions'; -import { FleetServerRequirementPage } from '../../agent_requirements_page'; +import { + FleetServerRequirementPage, + ServiceTokenStep, + FleetServerCommandStep, + useFleetServerInstructions, +} from '../../agent_requirements_page'; import { DownloadStep, AgentPolicySelectionStep } from './steps'; @@ -58,23 +63,55 @@ export const ManagedInstructions = React.memo(({ agentPolicies }) => { const fleetStatus = useFleetStatus(); const [selectedAPIKeyId, setSelectedAPIKeyId] = useState(); + const [isFleetServerPolicySelected, setIsFleetServerPolicySelected] = useState(false); const apiKey = useGetOneEnrollmentAPIKey(selectedAPIKeyId); const settings = useGetSettings(); - const fleetServerHosts = settings.data?.item?.fleet_server_hosts || []; + const fleetServerInstructions = useFleetServerInstructions(); - const steps: EuiContainedStepProps[] = [ - DownloadStep(), - AgentPolicySelectionStep({ agentPolicies, setSelectedAPIKeyId }), - { - title: i18n.translate('xpack.fleet.agentEnrollment.stepEnrollAndRunAgentTitle', { - defaultMessage: 'Enroll and start the Elastic Agent', + const steps = useMemo(() => { + const { + serviceToken, + getServiceToken, + isLoadingServiceToken, + installCommand, + platform, + setPlatform, + } = fleetServerInstructions; + const fleetServerHosts = settings.data?.item?.fleet_server_hosts || []; + const baseSteps: EuiContainedStepProps[] = [ + DownloadStep(), + AgentPolicySelectionStep({ + agentPolicies, + setSelectedAPIKeyId, + setIsFleetServerPolicySelected, }), - children: apiKey.data && ( - - ), - }, - ]; + ]; + if (isFleetServerPolicySelected) { + baseSteps.push( + ...[ + ServiceTokenStep({ serviceToken, getServiceToken, isLoadingServiceToken }), + FleetServerCommandStep({ serviceToken, installCommand, platform, setPlatform }), + ] + ); + } else { + baseSteps.push({ + title: i18n.translate('xpack.fleet.agentEnrollment.stepEnrollAndRunAgentTitle', { + defaultMessage: 'Enroll and start the Elastic Agent', + }), + children: apiKey.data && ( + + ), + }); + } + return baseSteps; + }, [ + agentPolicies, + apiKey.data, + isFleetServerPolicySelected, + settings.data?.item?.fleet_server_hosts, + fleetServerInstructions, + ]); return ( <> diff --git a/x-pack/plugins/fleet/public/applications/fleet/sections/agents/components/agent_enrollment_flyout/steps.tsx b/x-pack/plugins/fleet/public/applications/fleet/sections/agents/components/agent_enrollment_flyout/steps.tsx index faa0461ed4773..08b1cbdb341d5 100644 --- a/x-pack/plugins/fleet/public/applications/fleet/sections/agents/components/agent_enrollment_flyout/steps.tsx +++ b/x-pack/plugins/fleet/public/applications/fleet/sections/agents/components/agent_enrollment_flyout/steps.tsx @@ -5,12 +5,14 @@ * 2.0. */ -import React from 'react'; +import React, { useCallback } from 'react'; import { EuiText, EuiButton, EuiSpacer } from '@elastic/eui'; import { FormattedMessage } from '@kbn/i18n/react'; import { i18n } from '@kbn/i18n'; -import type { AgentPolicy } from '../../../../types'; +import type { AgentPolicy, PackagePolicy } from '../../../../types'; +import { sendGetOneAgentPolicy } from '../../../../hooks'; +import { FLEET_SERVER_PACKAGE } from '../../../../constants'; import { EnrollmentStepAgentPolicy } from './agent_policy_selection'; @@ -48,14 +50,39 @@ export const AgentPolicySelectionStep = ({ agentPolicies, setSelectedAPIKeyId, setSelectedPolicyId, + setIsFleetServerPolicySelected, }: { agentPolicies?: AgentPolicy[]; setSelectedAPIKeyId?: (key: string) => void; setSelectedPolicyId?: (policyId: string) => void; + setIsFleetServerPolicySelected?: (selected: boolean) => void; }) => { const regularAgentPolicies = Array.isArray(agentPolicies) ? agentPolicies.filter((policy) => policy && !policy.is_managed) : []; + + const onAgentPolicyChange = useCallback( + async (policyId: string) => { + if (setSelectedPolicyId) { + setSelectedPolicyId(policyId); + } + if (setIsFleetServerPolicySelected) { + const agentPolicyRequest = await sendGetOneAgentPolicy(policyId); + if ( + agentPolicyRequest.data?.item && + (agentPolicyRequest.data.item.package_policies as PackagePolicy[]).some( + (packagePolicy) => packagePolicy.package?.name === FLEET_SERVER_PACKAGE + ) + ) { + setIsFleetServerPolicySelected(true); + } else { + setIsFleetServerPolicySelected(false); + } + } + }, + [setIsFleetServerPolicySelected, setSelectedPolicyId] + ); + return { title: i18n.translate('xpack.fleet.agentEnrollment.stepChooseAgentPolicyTitle', { defaultMessage: 'Choose an agent policy', @@ -65,7 +92,7 @@ export const AgentPolicySelectionStep = ({ agentPolicies={regularAgentPolicies} withKeySelection={setSelectedAPIKeyId ? true : false} onKeyChange={setSelectedAPIKeyId} - onAgentPolicyChange={setSelectedPolicyId} + onAgentPolicyChange={onAgentPolicyChange} /> ), }; diff --git a/x-pack/plugins/fleet/public/applications/fleet/sections/agents/components/agent_unenroll_modal/index.tsx b/x-pack/plugins/fleet/public/applications/fleet/sections/agents/components/agent_unenroll_modal/index.tsx index 696acb49abef3..5507fd6395c6f 100644 --- a/x-pack/plugins/fleet/public/applications/fleet/sections/agents/components/agent_unenroll_modal/index.tsx +++ b/x-pack/plugins/fleet/public/applications/fleet/sections/agents/components/agent_unenroll_modal/index.tsx @@ -40,11 +40,11 @@ export const AgentUnenrollAgentModal: React.FunctionComponent = ({ setIsSubmitting(true); const { error } = isSingleAgent ? await sendPostAgentUnenroll((agents[0] as Agent).id, { - force: forceUnenroll, + revoke: forceUnenroll, }) : await sendPostBulkAgentUnenroll({ agents: Array.isArray(agents) ? agents.map((agent) => agent.id) : agents, - force: forceUnenroll, + revoke: forceUnenroll, }); if (error) { throw error; diff --git a/x-pack/plugins/fleet/public/applications/fleet/sections/agents/components/fleet_server_upgrade_modal.tsx b/x-pack/plugins/fleet/public/applications/fleet/sections/agents/components/fleet_server_upgrade_modal.tsx new file mode 100644 index 0000000000000..4d6ac864ee8b5 --- /dev/null +++ b/x-pack/plugins/fleet/public/applications/fleet/sections/agents/components/fleet_server_upgrade_modal.tsx @@ -0,0 +1,167 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import React, { useCallback, useState } from 'react'; +import { + EuiButton, + EuiCheckbox, + EuiFlexGroup, + EuiFlexItem, + EuiImage, + EuiLink, + EuiModal, + EuiModalBody, + EuiModalFooter, + EuiModalHeader, + EuiModalHeaderTitle, + EuiSpacer, + EuiText, +} from '@elastic/eui'; +import { FormattedMessage } from '@kbn/i18n/react'; +import { i18n } from '@kbn/i18n'; + +import { sendPutSettings, useLink, useStartServices } from '../../../hooks'; + +interface Props { + onClose: () => void; +} + +export const FleetServerUpgradeModal: React.FunctionComponent = ({ onClose }) => { + const { getAssetsPath } = useLink(); + const { notifications, cloud } = useStartServices(); + + const isCloud = !!cloud?.cloudId; + + const [checked, setChecked] = useState(false); + const onChange = useCallback(async () => { + try { + setChecked(!checked); + await sendPutSettings({ + has_seen_fleet_migration_notice: !checked, + }); + } catch (error) { + notifications.toasts.addError(error, { + title: i18n.translate('xpack.fleet.fleetServerUpgradeModal.failedUpdateTitle', { + defaultMessage: `Error saving settings`, + }), + }); + } + }, [checked, setChecked, notifications]); + + return ( + + + + + + + + + + + {isCloud ? ( + + + + ), + link: ( + + + + ), + }} + /> + ) : ( + + + + ), + link: ( + + + + ), + }} + /> + )} + + + + + + + ), + }} + /> + + + + + + + + + + + + + + + + ); +}; diff --git a/x-pack/plugins/fleet/public/applications/fleet/sections/agents/index.tsx b/x-pack/plugins/fleet/public/applications/fleet/sections/agents/index.tsx index b8c9ead6773f5..56eb4072c3847 100644 --- a/x-pack/plugins/fleet/public/applications/fleet/sections/agents/index.tsx +++ b/x-pack/plugins/fleet/public/applications/fleet/sections/agents/index.tsx @@ -5,13 +5,19 @@ * 2.0. */ -import React, { useEffect } from 'react'; +import React, { useCallback, useEffect, useState } from 'react'; import { FormattedMessage } from '@kbn/i18n/react'; import { HashRouter as Router, Route, Switch, Redirect } from 'react-router-dom'; import { PAGE_ROUTING_PATHS } from '../../constants'; import { Loading, Error } from '../../components'; -import { useConfig, useFleetStatus, useBreadcrumbs, useCapabilities } from '../../hooks'; +import { + useConfig, + useFleetStatus, + useBreadcrumbs, + useCapabilities, + useGetSettings, +} from '../../hooks'; import { WithoutHeaderLayout } from '../../layouts'; import { AgentListPage } from './agent_list_page'; @@ -20,6 +26,7 @@ import { AgentDetailsPage } from './agent_details_page'; import { NoAccessPage } from './error_pages/no_access'; import { EnrollmentTokenListPage } from './enrollment_token_list_page'; import { ListLayout } from './components/list_layout'; +import { FleetServerUpgradeModal } from './components/fleet_server_upgrade_modal'; const REFRESH_INTERVAL_MS = 30000; @@ -31,6 +38,20 @@ export const FleetApp: React.FunctionComponent = () => { const fleetStatus = useFleetStatus(); + const settings = useGetSettings(); + + const [fleetServerModalVisible, setFleetServerModalVisible] = useState(false); + const onCloseFleetServerModal = useCallback(() => { + setFleetServerModalVisible(false); + }, [setFleetServerModalVisible]); + + useEffect(() => { + // if it's undefined do not show the modal + if (settings.data && settings.data?.item.has_seen_fleet_migration_notice === false) { + setFleetServerModalVisible(true); + } + }, [settings.data]); + useEffect(() => { if ( !agents.enabled || @@ -99,6 +120,9 @@ export const FleetApp: React.FunctionComponent = () => { + {fleetServerModalVisible && ( + + )} {hasOnlyFleetServerMissingRequirement ? ( ) : ( diff --git a/x-pack/plugins/fleet/public/applications/fleet/types/index.ts b/x-pack/plugins/fleet/public/applications/fleet/types/index.ts index 89aa5ad1add35..0d85bfcdb6af6 100644 --- a/x-pack/plugins/fleet/public/applications/fleet/types/index.ts +++ b/x-pack/plugins/fleet/public/applications/fleet/types/index.ts @@ -88,6 +88,7 @@ export { PutSettingsResponse, // API schemas - app CheckPermissionsResponse, + GenerateServiceTokenResponse, // EPM types AssetReference, AssetsGroupedByServiceByType, diff --git a/x-pack/plugins/fleet/public/assets/announcement.jpg b/x-pack/plugins/fleet/public/assets/announcement.jpg new file mode 100644 index 0000000000000..65191f1da6c53 Binary files /dev/null and b/x-pack/plugins/fleet/public/assets/announcement.jpg differ diff --git a/x-pack/plugins/fleet/server/errors/index.ts b/x-pack/plugins/fleet/server/errors/index.ts index 6738e078e8b75..8d75726fbe2de 100644 --- a/x-pack/plugins/fleet/server/errors/index.ts +++ b/x-pack/plugins/fleet/server/errors/index.ts @@ -43,10 +43,16 @@ export class PackageOperationNotSupportedError extends IngestManagerError {} export class FleetAdminUserInvalidError extends IngestManagerError {} export class ConcurrentInstallOperationError extends IngestManagerError {} export class AgentReassignmentError extends IngestManagerError {} -export class AgentUnenrollmentError extends IngestManagerError {} -export class AgentPolicyDeletionError extends IngestManagerError {} +export class HostedAgentPolicyRestrictionRelatedError extends IngestManagerError { + constructor(message = 'Cannot perform that action') { + super( + `${message} in Fleet because the agent policy is managed by an external orchestration solution, such as Elastic Cloud, Kubernetes, etc. Please make changes using your orchestration solution.` + ); + } +} export class FleetSetupError extends IngestManagerError {} +export class GenerateServiceTokenError extends IngestManagerError {} export class ArtifactsClientError extends IngestManagerError {} export class ArtifactsClientAccessDeniedError extends IngestManagerError { diff --git a/x-pack/plugins/fleet/server/routes/app/index.ts b/x-pack/plugins/fleet/server/routes/app/index.ts index ba7c649c4fa54..f2fc6302c8ce5 100644 --- a/x-pack/plugins/fleet/server/routes/app/index.ts +++ b/x-pack/plugins/fleet/server/routes/app/index.ts @@ -7,9 +7,10 @@ import type { IRouter, RequestHandler } from 'src/core/server'; -import { APP_API_ROUTES } from '../../constants'; +import { PLUGIN_ID, APP_API_ROUTES } from '../../constants'; import { appContextService } from '../../services'; -import type { CheckPermissionsResponse } from '../../../common'; +import type { CheckPermissionsResponse, GenerateServiceTokenResponse } from '../../../common'; +import { defaultIngestErrorHandler, GenerateServiceTokenError } from '../../errors'; export const getCheckPermissionsHandler: RequestHandler = async (context, request, response) => { const body: CheckPermissionsResponse = { success: true }; @@ -35,6 +36,29 @@ export const getCheckPermissionsHandler: RequestHandler = async (context, reques } }; +export const generateServiceTokenHandler: RequestHandler = async (context, request, response) => { + const esClient = context.core.elasticsearch.client.asCurrentUser; + try { + const { body: tokenResponse } = await esClient.transport.request({ + method: 'POST', + path: `_security/service/elastic/fleet-server/credential/token/token-${Date.now()}`, + }); + + if (tokenResponse.created && tokenResponse.token) { + const body: GenerateServiceTokenResponse = tokenResponse.token; + return response.ok({ + body, + }); + } else { + const error = new GenerateServiceTokenError('Unable to generate service token'); + return defaultIngestErrorHandler({ error, response }); + } + } catch (e) { + const error = new GenerateServiceTokenError(e); + return defaultIngestErrorHandler({ error, response }); + } +}; + export const registerRoutes = (router: IRouter) => { router.get( { @@ -44,4 +68,13 @@ export const registerRoutes = (router: IRouter) => { }, getCheckPermissionsHandler ); + + router.post( + { + path: APP_API_ROUTES.GENERATE_SERVICE_TOKEN_PATTERN, + validate: {}, + options: { tags: [`access:${PLUGIN_ID}-all`] }, + }, + generateServiceTokenHandler + ); }; diff --git a/x-pack/plugins/fleet/server/routes/data_streams/handlers.ts b/x-pack/plugins/fleet/server/routes/data_streams/handlers.ts index 6d4d107adb796..aa36a3a7562bf 100644 --- a/x-pack/plugins/fleet/server/routes/data_streams/handlers.ts +++ b/x-pack/plugins/fleet/server/routes/data_streams/handlers.ts @@ -14,7 +14,7 @@ import type { GetDataStreamsResponse } from '../../../common'; import { getPackageSavedObjects } from '../../services/epm/packages/get'; import { defaultIngestErrorHandler } from '../../errors'; -const DATA_STREAM_INDEX_PATTERN = 'logs-*-*,metrics-*-*,traces-*-*'; +const DATA_STREAM_INDEX_PATTERN = 'logs-*-*,metrics-*-*,traces-*-*,synthetics-*-*'; interface ESDataStreamInfo { name: string; diff --git a/x-pack/plugins/fleet/server/routes/setup/handlers.ts b/x-pack/plugins/fleet/server/routes/setup/handlers.ts index a6d7acccfb4fe..627f628f7b9fc 100644 --- a/x-pack/plugins/fleet/server/routes/setup/handlers.ts +++ b/x-pack/plugins/fleet/server/routes/setup/handlers.ts @@ -46,13 +46,10 @@ export const fleetSetupHandler: RequestHandler = async (context, request, respon try { const soClient = context.core.savedObjects.client; const esClient = context.core.elasticsearch.client.asCurrentUser; - const setupStatus = await setupIngestManager(soClient, esClient); - const body: PostIngestSetupResponse = { - isInitialized: true, - }; + const body: PostIngestSetupResponse = await setupIngestManager(soClient, esClient); - if (setupStatus.nonFatalPackageUpgradeErrors.length > 0) { - body.nonFatalPackageUpgradeErrors = setupStatus.nonFatalPackageUpgradeErrors; + if (body.nonFatalPackageUpgradeErrors?.length === 0) { + delete body.nonFatalPackageUpgradeErrors; } return response.ok({ diff --git a/x-pack/plugins/fleet/server/saved_objects/index.ts b/x-pack/plugins/fleet/server/saved_objects/index.ts index 27725bfc637ee..f55de4b691999 100644 --- a/x-pack/plugins/fleet/server/saved_objects/index.ts +++ b/x-pack/plugins/fleet/server/saved_objects/index.ts @@ -61,6 +61,7 @@ const getSavedObjectTypes = ( properties: { fleet_server_hosts: { type: 'keyword' }, has_seen_add_data_notice: { type: 'boolean', index: false }, + has_seen_fleet_migration_notice: { type: 'boolean', index: false }, }, }, migrations: { diff --git a/x-pack/plugins/fleet/server/services/agent_policy.ts b/x-pack/plugins/fleet/server/services/agent_policy.ts index 6237951805547..0d1c5c4dd3143 100644 --- a/x-pack/plugins/fleet/server/services/agent_policy.ts +++ b/x-pack/plugins/fleet/server/services/agent_policy.ts @@ -46,11 +46,7 @@ import type { Installation, Output, } from '../../common'; -import { - AgentPolicyNameExistsError, - AgentPolicyDeletionError, - IngestManagerError, -} from '../errors'; +import { AgentPolicyNameExistsError, HostedAgentPolicyRestrictionRelatedError } from '../errors'; import { getPackageInfo } from './epm/packages'; import { getAgentsByKuery } from './agents'; @@ -476,7 +472,9 @@ class AgentPolicyService { } if (oldAgentPolicy.is_managed && !options?.force) { - throw new IngestManagerError(`Cannot update integrations of hosted agent policy ${id}`); + throw new HostedAgentPolicyRestrictionRelatedError( + `Cannot update integrations of hosted agent policy ${id}` + ); } return await this._update( @@ -507,7 +505,9 @@ class AgentPolicyService { } if (oldAgentPolicy.is_managed && !options?.force) { - throw new IngestManagerError(`Cannot remove integrations of hosted agent policy ${id}`); + throw new HostedAgentPolicyRestrictionRelatedError( + `Cannot remove integrations of hosted agent policy ${id}` + ); } return await this._update( @@ -550,7 +550,7 @@ class AgentPolicyService { } if (agentPolicy.is_managed) { - throw new AgentPolicyDeletionError(`Cannot delete hosted agent policy ${id}`); + throw new HostedAgentPolicyRestrictionRelatedError(`Cannot delete hosted agent policy ${id}`); } const { @@ -745,7 +745,13 @@ class AgentPolicyService { cluster: ['monitor'], indices: [ { - names: ['logs-*', 'metrics-*', 'traces-*', '.logs-endpoint.diagnostic.collection-*'], + names: [ + 'logs-*', + 'metrics-*', + 'traces-*', + '.logs-endpoint.diagnostic.collection-*', + 'synthetics-*', + ], privileges: ['auto_configure', 'create_doc'], }, ], diff --git a/x-pack/plugins/fleet/server/services/agents/reassign.test.ts b/x-pack/plugins/fleet/server/services/agents/reassign.test.ts index 4dfc29df8c398..63085b7729c4b 100644 --- a/x-pack/plugins/fleet/server/services/agents/reassign.test.ts +++ b/x-pack/plugins/fleet/server/services/agents/reassign.test.ts @@ -9,7 +9,7 @@ import { elasticsearchServiceMock, savedObjectsClientMock } from 'src/core/serve import type { SavedObject } from 'kibana/server'; import type { AgentPolicy } from '../../types'; -import { AgentReassignmentError } from '../../errors'; +import { HostedAgentPolicyRestrictionRelatedError } from '../../errors'; import { reassignAgent, reassignAgents } from './reassign'; @@ -54,7 +54,7 @@ describe('reassignAgent (singular)', () => { const { soClient, esClient } = createClientsMock(); await expect( reassignAgent(soClient, esClient, agentInRegularDoc._id, hostedAgentPolicySO.id) - ).rejects.toThrowError(AgentReassignmentError); + ).rejects.toThrowError(HostedAgentPolicyRestrictionRelatedError); // does not call ES update expect(esClient.update).toBeCalledTimes(0); @@ -64,13 +64,13 @@ describe('reassignAgent (singular)', () => { const { soClient, esClient } = createClientsMock(); await expect( reassignAgent(soClient, esClient, agentInHostedDoc._id, regularAgentPolicySO.id) - ).rejects.toThrowError(AgentReassignmentError); + ).rejects.toThrowError(HostedAgentPolicyRestrictionRelatedError); // does not call ES update expect(esClient.update).toBeCalledTimes(0); await expect( reassignAgent(soClient, esClient, agentInHostedDoc._id, hostedAgentPolicySO.id) - ).rejects.toThrowError(AgentReassignmentError); + ).rejects.toThrowError(HostedAgentPolicyRestrictionRelatedError); // does not call ES update expect(esClient.update).toBeCalledTimes(0); }); diff --git a/x-pack/plugins/fleet/server/services/agents/reassign.ts b/x-pack/plugins/fleet/server/services/agents/reassign.ts index 4c95d19e2f13a..e72f441afd031 100644 --- a/x-pack/plugins/fleet/server/services/agents/reassign.ts +++ b/x-pack/plugins/fleet/server/services/agents/reassign.ts @@ -10,7 +10,7 @@ import Boom from '@hapi/boom'; import type { Agent, BulkActionResult } from '../../types'; import { agentPolicyService } from '../agent_policy'; -import { AgentReassignmentError } from '../../errors'; +import { AgentReassignmentError, HostedAgentPolicyRestrictionRelatedError } from '../../errors'; import { getAgentDocuments, @@ -56,14 +56,14 @@ export async function reassignAgentIsAllowed( ) { const agentPolicy = await getAgentPolicyForAgent(soClient, esClient, agentId); if (agentPolicy?.is_managed) { - throw new AgentReassignmentError( + throw new HostedAgentPolicyRestrictionRelatedError( `Cannot reassign an agent from hosted agent policy ${agentPolicy.id}` ); } const newAgentPolicy = await agentPolicyService.get(soClient, newAgentPolicyId); if (newAgentPolicy?.is_managed) { - throw new AgentReassignmentError( + throw new HostedAgentPolicyRestrictionRelatedError( `Cannot reassign an agent to hosted agent policy ${newAgentPolicy.id}` ); } diff --git a/x-pack/plugins/fleet/server/services/agents/unenroll.test.ts b/x-pack/plugins/fleet/server/services/agents/unenroll.test.ts index 24a3dea3bcb91..33f12dc52dc00 100644 --- a/x-pack/plugins/fleet/server/services/agents/unenroll.test.ts +++ b/x-pack/plugins/fleet/server/services/agents/unenroll.test.ts @@ -9,7 +9,7 @@ import { elasticsearchServiceMock, savedObjectsClientMock } from 'src/core/serve import type { SavedObject } from 'kibana/server'; import type { AgentPolicy } from '../../types'; -import { AgentUnenrollmentError } from '../../errors'; +import { HostedAgentPolicyRestrictionRelatedError } from '../../errors'; import { unenrollAgent, unenrollAgents } from './unenroll'; @@ -49,7 +49,7 @@ describe('unenrollAgent (singular)', () => { it('cannot unenroll from hosted agent policy by default', async () => { const { soClient, esClient } = createClientMock(); await expect(unenrollAgent(soClient, esClient, agentInHostedDoc._id)).rejects.toThrowError( - AgentUnenrollmentError + HostedAgentPolicyRestrictionRelatedError ); // does not call ES update expect(esClient.update).toBeCalledTimes(0); @@ -59,7 +59,7 @@ describe('unenrollAgent (singular)', () => { const { soClient, esClient } = createClientMock(); await expect( unenrollAgent(soClient, esClient, agentInHostedDoc._id, { revoke: true }) - ).rejects.toThrowError(AgentUnenrollmentError); + ).rejects.toThrowError(HostedAgentPolicyRestrictionRelatedError); // does not call ES update expect(esClient.update).toBeCalledTimes(0); }); diff --git a/x-pack/plugins/fleet/server/services/agents/unenroll.ts b/x-pack/plugins/fleet/server/services/agents/unenroll.ts index fc1f80fe7521b..4d062e8bd5368 100644 --- a/x-pack/plugins/fleet/server/services/agents/unenroll.ts +++ b/x-pack/plugins/fleet/server/services/agents/unenroll.ts @@ -9,7 +9,7 @@ import type { ElasticsearchClient, SavedObjectsClientContract } from 'src/core/s import type { Agent, BulkActionResult } from '../../types'; import * as APIKeyService from '../api_keys'; -import { AgentUnenrollmentError } from '../../errors'; +import { HostedAgentPolicyRestrictionRelatedError } from '../../errors'; import { createAgentAction, bulkCreateAgentActions } from './actions'; import type { GetAgentsOptions } from './crud'; @@ -28,7 +28,7 @@ async function unenrollAgentIsAllowed( ) { const agentPolicy = await getAgentPolicyForAgent(soClient, esClient, agentId); if (agentPolicy?.is_managed) { - throw new AgentUnenrollmentError( + throw new HostedAgentPolicyRestrictionRelatedError( `Cannot unenroll ${agentId} from a hosted agent policy ${agentPolicy.id}` ); } diff --git a/x-pack/plugins/fleet/server/services/agents/upgrade.ts b/x-pack/plugins/fleet/server/services/agents/upgrade.ts index 61e785828bf23..988d3c63223f4 100644 --- a/x-pack/plugins/fleet/server/services/agents/upgrade.ts +++ b/x-pack/plugins/fleet/server/services/agents/upgrade.ts @@ -10,7 +10,11 @@ import type { ElasticsearchClient, SavedObjectsClientContract } from 'src/core/s import type { Agent, AgentAction, AgentActionSOAttributes, BulkActionResult } from '../../types'; import { AGENT_ACTION_SAVED_OBJECT_TYPE } from '../../constants'; import { agentPolicyService } from '../../services'; -import { AgentReassignmentError, IngestManagerError } from '../../errors'; +import { + AgentReassignmentError, + HostedAgentPolicyRestrictionRelatedError, + IngestManagerError, +} from '../../errors'; import { isAgentUpgradeable } from '../../../common/services'; import { appContextService } from '../app_context'; @@ -46,7 +50,7 @@ export async function sendUpgradeAgentAction({ const agentPolicy = await getAgentPolicyForAgent(soClient, esClient, agentId); if (agentPolicy?.is_managed) { - throw new IngestManagerError( + throw new HostedAgentPolicyRestrictionRelatedError( `Cannot upgrade agent ${agentId} in hosted agent policy ${agentPolicy.id}` ); } @@ -142,7 +146,7 @@ export async function sendUpgradeAgentsActions( } if (!options.force && isHostedAgent(agent)) { - throw new IngestManagerError( + throw new HostedAgentPolicyRestrictionRelatedError( `Cannot upgrade agent in hosted agent policy ${agent.policy_id}` ); } diff --git a/x-pack/plugins/fleet/server/services/fleet_server/saved_object_migrations.ts b/x-pack/plugins/fleet/server/services/fleet_server/saved_object_migrations.ts index 7ccee39aa815c..82fd937092477 100644 --- a/x-pack/plugins/fleet/server/services/fleet_server/saved_object_migrations.ts +++ b/x-pack/plugins/fleet/server/services/fleet_server/saved_object_migrations.ts @@ -25,6 +25,7 @@ import { listEnrollmentApiKeys, getEnrollmentAPIKey } from '../api_keys/enrollme import { appContextService } from '../app_context'; import { agentPolicyService } from '../agent_policy'; import { invalidateAPIKeys } from '../api_keys'; +import { settingsService } from '..'; export async function runFleetServerMigration() { await Promise.all([migrateEnrollmentApiKeys(), migrateAgentPolicies(), migrateAgents()]); @@ -54,6 +55,9 @@ async function migrateAgents() { const soClient = getInternalUserSOClient(); const logger = appContextService.getLogger(); let hasMore = true; + + let hasAgents = false; + while (hasMore) { const res = await soClient.find({ type: AGENT_SAVED_OBJECT_TYPE, @@ -63,7 +67,10 @@ async function migrateAgents() { if (res.total === 0) { hasMore = false; + } else { + hasAgents = true; } + for (const so of res.saved_objects) { try { const { @@ -115,6 +122,13 @@ async function migrateAgents() { } } } + + // Update settings to show migration modal + if (hasAgents) { + await settingsService.saveSettings(soClient, { + has_seen_fleet_migration_notice: false, + }); + } } async function migrateEnrollmentApiKeys() { diff --git a/x-pack/plugins/fleet/server/services/package_policy.ts b/x-pack/plugins/fleet/server/services/package_policy.ts index 7c009299a3de3..234fa4df51688 100644 --- a/x-pack/plugins/fleet/server/services/package_policy.ts +++ b/x-pack/plugins/fleet/server/services/package_policy.ts @@ -30,7 +30,11 @@ import type { ListResult, } from '../../common'; import { PACKAGE_POLICY_SAVED_OBJECT_TYPE } from '../constants'; -import { IngestManagerError, ingestErrorToResponseOptions } from '../errors'; +import { + HostedAgentPolicyRestrictionRelatedError, + IngestManagerError, + ingestErrorToResponseOptions, +} from '../errors'; import { NewPackagePolicySchema, UpdatePackagePolicySchema } from '../types'; import type { NewPackagePolicy, @@ -75,7 +79,7 @@ class PackagePolicyService { throw new Error('Agent policy not found'); } if (parentAgentPolicy.is_managed && !options?.force) { - throw new IngestManagerError( + throw new HostedAgentPolicyRestrictionRelatedError( `Cannot add integrations to hosted agent policy ${parentAgentPolicy.id}` ); } diff --git a/x-pack/plugins/fleet/server/types/rest_spec/settings.ts b/x-pack/plugins/fleet/server/types/rest_spec/settings.ts index 551cc37551da2..fbadac2353b02 100644 --- a/x-pack/plugins/fleet/server/types/rest_spec/settings.ts +++ b/x-pack/plugins/fleet/server/types/rest_spec/settings.ts @@ -23,6 +23,7 @@ export const PutSettingsRequestSchema = { }) ), has_seen_add_data_notice: schema.maybe(schema.boolean()), + has_seen_fleet_migration_notice: schema.maybe(schema.boolean()), additional_yaml_config: schema.maybe(schema.string()), // Deprecated not used kibana_urls: schema.maybe( diff --git a/x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/components/phases/hot_phase/components/max_index_size_field.tsx b/x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/components/phases/hot_phase/components/max_index_size_field.tsx index 78f3c74c9cb82..195acf35c1357 100644 --- a/x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/components/phases/hot_phase/components/max_index_size_field.tsx +++ b/x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/components/phases/hot_phase/components/max_index_size_field.tsx @@ -40,7 +40,13 @@ export const MaxIndexSizeField: FunctionComponent = () => { componentProps={{ euiFieldProps: { 'data-test-subj': 'hot-selectedMaxSizeStored', - prepend: , + prepend: ( + + ), min: 1, }, }} diff --git a/x-pack/plugins/infra/common/dependency_mocks/index_patterns.ts b/x-pack/plugins/infra/common/dependency_mocks/index_patterns.ts new file mode 100644 index 0000000000000..14215c1539473 --- /dev/null +++ b/x-pack/plugins/infra/common/dependency_mocks/index_patterns.ts @@ -0,0 +1,100 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import { from, of } from 'rxjs'; +import { delay } from 'rxjs/operators'; +import { + fieldList, + FieldSpec, + IIndexPattern, + IndexPattern, + IndexPatternsContract, + RuntimeField, +} from 'src/plugins/data/common'; + +type IndexPatternMock = Pick< + IndexPattern, + | 'fields' + | 'getComputedFields' + | 'getFieldByName' + | 'getTimeField' + | 'id' + | 'isTimeBased' + | 'title' + | 'type' +>; +type IndexPatternMockSpec = Pick & { + fields: FieldSpec[]; +}; + +export const createIndexPatternMock = ({ + id, + title, + type = undefined, + fields, + timeFieldName, +}: IndexPatternMockSpec): IndexPatternMock => { + const indexPatternFieldList = fieldList(fields); + + return { + id, + title, + type, + fields: indexPatternFieldList, + getTimeField: () => indexPatternFieldList.find(({ name }) => name === timeFieldName), + isTimeBased: () => timeFieldName != null, + getFieldByName: (fieldName) => indexPatternFieldList.find(({ name }) => name === fieldName), + getComputedFields: () => ({ + runtimeFields: indexPatternFieldList.reduce>( + (accumulatedFields, { name, runtimeField }) => ({ + ...accumulatedFields, + ...(runtimeField != null + ? { + [name]: runtimeField, + } + : {}), + }), + {} + ), + scriptFields: {}, + storedFields: [], + docvalueFields: [], + }), + }; +}; + +export const createIndexPatternsMock = ( + asyncDelay: number, + indexPatterns: IndexPatternMock[] +): { + getIdsWithTitle: IndexPatternsContract['getIdsWithTitle']; + get: (...args: Parameters) => Promise; +} => { + return { + async getIdsWithTitle(_refresh?: boolean) { + const indexPatterns$ = of( + indexPatterns.map(({ id = 'unknown_id', title }) => ({ id, title })) + ); + return await indexPatterns$.pipe(delay(asyncDelay)).toPromise(); + }, + async get(indexPatternId: string) { + const indexPatterns$ = from( + indexPatterns.filter((indexPattern) => indexPattern.id === indexPatternId) + ); + return await indexPatterns$.pipe(delay(asyncDelay)).toPromise(); + }, + }; +}; + +export const createIndexPatternsStartMock = ( + asyncDelay: number, + indexPatterns: IndexPatternMock[] +): any => { + return { + indexPatternsServiceFactory: async () => createIndexPatternsMock(asyncDelay, indexPatterns), + }; +}; diff --git a/x-pack/plugins/infra/common/http_api/log_analysis/validation/datasets.ts b/x-pack/plugins/infra/common/http_api/log_analysis/validation/datasets.ts index c349ceab03043..ff4ee4fd328da 100644 --- a/x-pack/plugins/infra/common/http_api/log_analysis/validation/datasets.ts +++ b/x-pack/plugins/infra/common/http_api/log_analysis/validation/datasets.ts @@ -19,6 +19,7 @@ export const validateLogEntryDatasetsRequestPayloadRT = rt.type({ timestampField: rt.string, startTime: rt.number, endTime: rt.number, + runtimeMappings: rt.UnknownRecord, }), }); diff --git a/x-pack/plugins/infra/common/http_api/log_analysis/validation/log_entry_rate_indices.ts b/x-pack/plugins/infra/common/http_api/log_analysis/validation/log_entry_rate_indices.ts index c63a544201749..a6a7a9996d260 100644 --- a/x-pack/plugins/infra/common/http_api/log_analysis/validation/log_entry_rate_indices.ts +++ b/x-pack/plugins/infra/common/http_api/log_analysis/validation/log_entry_rate_indices.ts @@ -26,6 +26,7 @@ export const validationIndicesRequestPayloadRT = rt.type({ data: rt.type({ fields: rt.array(validationIndicesFieldSpecificationRT), indices: rt.array(rt.string), + runtimeMappings: rt.UnknownRecord, }), }); diff --git a/x-pack/plugins/infra/common/log_sources/log_source_configuration.ts b/x-pack/plugins/infra/common/log_sources/log_source_configuration.ts index 83bc8743900eb..ab98ad75b8433 100644 --- a/x-pack/plugins/infra/common/log_sources/log_source_configuration.ts +++ b/x-pack/plugins/infra/common/log_sources/log_source_configuration.ts @@ -53,18 +53,21 @@ export const logSourceColumnConfigurationRT = rt.union([ export type LogSourceColumnConfiguration = rt.TypeOf; // Kibana index pattern -const logIndexPatternReferenceRT = rt.type({ +export const logIndexPatternReferenceRT = rt.type({ type: rt.literal('index_pattern'), indexPatternId: rt.string, }); +export type LogIndexPatternReference = rt.TypeOf; // Legacy support -const logIndexNameReferenceRT = rt.type({ +export const logIndexNameReferenceRT = rt.type({ type: rt.literal('index_name'), indexName: rt.string, }); +export type LogIndexNameReference = rt.TypeOf; export const logIndexReferenceRT = rt.union([logIndexPatternReferenceRT, logIndexNameReferenceRT]); +export type LogIndexReference = rt.TypeOf; export const logSourceConfigurationPropertiesRT = rt.strict({ name: rt.string, diff --git a/x-pack/plugins/infra/common/log_sources/resolved_log_source_configuration.ts b/x-pack/plugins/infra/common/log_sources/resolved_log_source_configuration.ts index 8bc7eee7d4eb6..daac7f6a138eb 100644 --- a/x-pack/plugins/infra/common/log_sources/resolved_log_source_configuration.ts +++ b/x-pack/plugins/infra/common/log_sources/resolved_log_source_configuration.ts @@ -5,11 +5,13 @@ * 2.0. */ +import { estypes } from '@elastic/elasticsearch'; +import { IndexPattern, IndexPatternsContract } from '../../../../../src/plugins/data/common'; +import { ObjectEntries } from '../utility_types'; import { - LogSourceConfigurationProperties, LogSourceColumnConfiguration, + LogSourceConfigurationProperties, } from './log_source_configuration'; -import { IndexPatternsContract, IndexPattern } from '../../../../../src/plugins/data/common'; export interface ResolvedLogSourceConfiguration { name: string; @@ -19,6 +21,7 @@ export interface ResolvedLogSourceConfiguration { tiebreakerField: string; messageField: string[]; fields: IndexPattern['fields']; + runtimeMappings: estypes.RuntimeFields; columns: LogSourceColumnConfiguration[]; } @@ -52,6 +55,7 @@ const resolveLegacyReference = async ( tiebreakerField: sourceConfiguration.fields.tiebreaker, messageField: sourceConfiguration.fields.message, fields, + runtimeMappings: {}, columns: sourceConfiguration.logColumns, name: sourceConfiguration.name, description: sourceConfiguration.description, @@ -76,8 +80,36 @@ const resolveKibanaIndexPatternReference = async ( tiebreakerField: '_doc', messageField: ['message'], fields: indexPattern.fields, + runtimeMappings: resolveRuntimeMappings(indexPattern), columns: sourceConfiguration.logColumns, name: sourceConfiguration.name, description: sourceConfiguration.description, }; }; + +// this might take other sources of runtime fields into account in the future +const resolveRuntimeMappings = (indexPattern: IndexPattern): estypes.RuntimeFields => { + const { runtimeFields } = indexPattern.getComputedFields(); + + const runtimeMappingsFromIndexPattern = (Object.entries(runtimeFields) as ObjectEntries< + typeof runtimeFields + >).reduce( + (accumulatedMappings, [runtimeFieldName, runtimeFieldSpec]) => ({ + ...accumulatedMappings, + [runtimeFieldName]: { + type: runtimeFieldSpec.type, + ...(runtimeFieldSpec.script != null + ? { + script: { + lang: 'painless', // required in the es types + source: runtimeFieldSpec.script.source, + }, + } + : {}), + }, + }), + {} + ); + + return runtimeMappingsFromIndexPattern; +}; diff --git a/x-pack/plugins/infra/common/utility_types.ts b/x-pack/plugins/infra/common/utility_types.ts index a785b4d13e557..1f26309973f0d 100644 --- a/x-pack/plugins/infra/common/utility_types.ts +++ b/x-pack/plugins/infra/common/utility_types.ts @@ -45,5 +45,7 @@ interface DeepPartialArray extends Array> {} type DeepPartialObject = { [P in keyof T]+?: DeepPartial }; +export type ObjectValues = Array; + export type ObjectEntry = [keyof T, T[keyof T]]; export type ObjectEntries = Array>; diff --git a/x-pack/plugins/infra/public/containers/logs/log_analysis/api/ml_get_jobs_summary_api.ts b/x-pack/plugins/infra/public/containers/logs/log_analysis/api/ml_get_jobs_summary_api.ts index 9b827b6cb5331..d4e1f7366dd2a 100644 --- a/x-pack/plugins/infra/public/containers/logs/log_analysis/api/ml_get_jobs_summary_api.ts +++ b/x-pack/plugins/infra/public/containers/logs/log_analysis/api/ml_get_jobs_summary_api.ts @@ -97,6 +97,9 @@ export const jobSummaryRT = rt.intersection([ custom_settings: jobCustomSettingsRT, finished_time: rt.number, model_size_stats: jobModelSizeStatsRT, + datafeed_config: rt.partial({ + runtime_mappings: rt.UnknownRecord, + }), }), }), ]); diff --git a/x-pack/plugins/infra/public/containers/logs/log_analysis/api/validate_datasets.ts b/x-pack/plugins/infra/public/containers/logs/log_analysis/api/validate_datasets.ts index 8fe2d215cef26..9eadc3035588d 100644 --- a/x-pack/plugins/infra/public/containers/logs/log_analysis/api/validate_datasets.ts +++ b/x-pack/plugins/infra/public/containers/logs/log_analysis/api/validate_datasets.ts @@ -5,6 +5,7 @@ * 2.0. */ +import type { estypes } from '@elastic/elasticsearch'; import type { HttpHandler } from 'src/core/public'; import { LOG_ANALYSIS_VALIDATE_DATASETS_PATH, @@ -18,10 +19,11 @@ interface RequestArgs { timestampField: string; startTime: number; endTime: number; + runtimeMappings: estypes.RuntimeFields; } export const callValidateDatasetsAPI = async (requestArgs: RequestArgs, fetch: HttpHandler) => { - const { indices, timestampField, startTime, endTime } = requestArgs; + const { indices, timestampField, startTime, endTime, runtimeMappings } = requestArgs; const response = await fetch(LOG_ANALYSIS_VALIDATE_DATASETS_PATH, { method: 'POST', body: JSON.stringify( @@ -31,6 +33,7 @@ export const callValidateDatasetsAPI = async (requestArgs: RequestArgs, fetch: H indices, startTime, timestampField, + runtimeMappings, }, }) ), diff --git a/x-pack/plugins/infra/public/containers/logs/log_analysis/api/validate_indices.ts b/x-pack/plugins/infra/public/containers/logs/log_analysis/api/validate_indices.ts index 5168736b80f0a..f9eb7609e00f3 100644 --- a/x-pack/plugins/infra/public/containers/logs/log_analysis/api/validate_indices.ts +++ b/x-pack/plugins/infra/public/containers/logs/log_analysis/api/validate_indices.ts @@ -6,6 +6,7 @@ */ import type { HttpHandler } from 'src/core/public'; +import { estypes } from '@elastic/elasticsearch'; import { LOG_ANALYSIS_VALIDATE_INDICES_PATH, @@ -19,13 +20,16 @@ import { decodeOrThrow } from '../../../../../common/runtime_types'; interface RequestArgs { indices: string[]; fields: ValidationIndicesFieldSpecification[]; + runtimeMappings: estypes.RuntimeFields; } export const callValidateIndicesAPI = async (requestArgs: RequestArgs, fetch: HttpHandler) => { - const { indices, fields } = requestArgs; + const { indices, fields, runtimeMappings } = requestArgs; const response = await fetch(LOG_ANALYSIS_VALIDATE_INDICES_PATH, { method: 'POST', - body: JSON.stringify(validationIndicesRequestPayloadRT.encode({ data: { indices, fields } })), + body: JSON.stringify( + validationIndicesRequestPayloadRT.encode({ data: { indices, fields, runtimeMappings } }) + ), }); return decodeOrThrow(validationIndicesResponsePayloadRT)(response); diff --git a/x-pack/plugins/infra/public/containers/logs/log_analysis/log_analysis_module.tsx b/x-pack/plugins/infra/public/containers/logs/log_analysis/log_analysis_module.tsx index 00a6c3c2a72fb..a9ea7e6d6e39a 100644 --- a/x-pack/plugins/infra/public/containers/logs/log_analysis/log_analysis_module.tsx +++ b/x-pack/plugins/infra/public/containers/logs/log_analysis/log_analysis_module.tsx @@ -21,7 +21,7 @@ export const useLogAnalysisModule = ({ moduleDescriptor: ModuleDescriptor; }) => { const { services } = useKibanaContextForPlugin(); - const { spaceId, sourceId, timestampField } = sourceConfiguration; + const { spaceId, sourceId, timestampField, runtimeMappings } = sourceConfiguration; const [moduleStatus, dispatchModuleStatus] = useModuleStatus(moduleDescriptor.jobTypes); const trackMetric = useUiTracker({ app: 'infra_logs' }); @@ -67,6 +67,7 @@ export const useLogAnalysisModule = ({ sourceId, spaceId, timestampField, + runtimeMappings, }, services.http.fetch ); diff --git a/x-pack/plugins/infra/public/containers/logs/log_analysis/log_analysis_module_configuration.ts b/x-pack/plugins/infra/public/containers/logs/log_analysis/log_analysis_module_configuration.ts index 1a1f2862b331b..888c89357929a 100644 --- a/x-pack/plugins/infra/public/containers/logs/log_analysis/log_analysis_module_configuration.ts +++ b/x-pack/plugins/infra/public/containers/logs/log_analysis/log_analysis_module_configuration.ts @@ -6,6 +6,7 @@ */ import { useMemo } from 'react'; +import equal from 'fast-deep-equal'; import { JobSummary } from './api/ml_get_jobs_summary_api'; import { ModuleDescriptor, ModuleSourceConfiguration } from './log_analysis_module_types'; @@ -30,11 +31,16 @@ export const isJobConfigurationOutdated = ( { bucketSpan }: ModuleDescriptor, currentSourceConfiguration: ModuleSourceConfiguration ) => (jobSummary: JobSummary): boolean => { - if (!jobSummary.fullJob || !jobSummary.fullJob.custom_settings) { + if ( + !jobSummary.fullJob || + !jobSummary.fullJob.custom_settings || + !jobSummary.fullJob.datafeed_config + ) { return false; } const jobConfiguration = jobSummary.fullJob.custom_settings.logs_source_config; + const datafeedRuntimeMappings = jobSummary.fullJob.datafeed_config.runtime_mappings; return !( jobConfiguration && @@ -44,7 +50,8 @@ export const isJobConfigurationOutdated = ( new Set(jobConfiguration.indexPattern.split(',')), new Set(currentSourceConfiguration.indices) ) && - jobConfiguration.timestampField === currentSourceConfiguration.timestampField + jobConfiguration.timestampField === currentSourceConfiguration.timestampField && + equal(datafeedRuntimeMappings, currentSourceConfiguration.runtimeMappings) ); }; diff --git a/x-pack/plugins/infra/public/containers/logs/log_analysis/log_analysis_module_types.ts b/x-pack/plugins/infra/public/containers/logs/log_analysis/log_analysis_module_types.ts index e79b75fecc817..36371b080ee45 100644 --- a/x-pack/plugins/infra/public/containers/logs/log_analysis/log_analysis_module_types.ts +++ b/x-pack/plugins/infra/public/containers/logs/log_analysis/log_analysis_module_types.ts @@ -6,6 +6,7 @@ */ import type { HttpHandler } from 'src/core/public'; +import { estypes } from '@elastic/elasticsearch'; import { ValidateLogEntryDatasetsResponsePayload, ValidationIndicesResponsePayload, @@ -46,6 +47,7 @@ export interface ModuleDescriptor { validateSetupIndices: ( indices: string[], timestampField: string, + runtimeMappings: estypes.RuntimeFields, fetch: HttpHandler ) => Promise; validateSetupDatasets: ( @@ -53,6 +55,7 @@ export interface ModuleDescriptor { timestampField: string, startTime: number, endTime: number, + runtimeMappings: estypes.RuntimeFields, fetch: HttpHandler ) => Promise; } @@ -62,4 +65,5 @@ export interface ModuleSourceConfiguration { sourceId: string; spaceId: string; timestampField: string; + runtimeMappings: estypes.RuntimeFields; } diff --git a/x-pack/plugins/infra/public/containers/logs/log_analysis/log_analysis_setup_state.ts b/x-pack/plugins/infra/public/containers/logs/log_analysis/log_analysis_setup_state.ts index 825ac5be747fe..fad6fd56f6251 100644 --- a/x-pack/plugins/infra/public/containers/logs/log_analysis/log_analysis_setup_state.ts +++ b/x-pack/plugins/infra/public/containers/logs/log_analysis/log_analysis_setup_state.ts @@ -162,6 +162,7 @@ export const useAnalysisSetupState = ({ return await validateSetupIndices( sourceConfiguration.indices, sourceConfiguration.timestampField, + sourceConfiguration.runtimeMappings, services.http.fetch ); }, @@ -188,6 +189,7 @@ export const useAnalysisSetupState = ({ sourceConfiguration.timestampField, startTime ?? 0, endTime ?? Date.now(), + sourceConfiguration.runtimeMappings, services.http.fetch ); }, diff --git a/x-pack/plugins/infra/public/containers/logs/log_analysis/modules/log_entry_categories/module_descriptor.ts b/x-pack/plugins/infra/public/containers/logs/log_analysis/modules/log_entry_categories/module_descriptor.ts index bc79dbdf0912a..981b7b496b435 100644 --- a/x-pack/plugins/infra/public/containers/logs/log_analysis/modules/log_entry_categories/module_descriptor.ts +++ b/x-pack/plugins/infra/public/containers/logs/log_analysis/modules/log_entry_categories/module_descriptor.ts @@ -5,6 +5,7 @@ * 2.0. */ +import type { estypes } from '@elastic/elasticsearch'; import { i18n } from '@kbn/i18n'; import type { HttpHandler } from 'src/core/public'; import { @@ -62,7 +63,7 @@ const setUpModule = async ( start: number | undefined, end: number | undefined, datasetFilter: DatasetFilter, - { spaceId, sourceId, indices, timestampField }: ModuleSourceConfiguration, + { spaceId, sourceId, indices, timestampField, runtimeMappings }: ModuleSourceConfiguration, fetch: HttpHandler ) => { const indexNamePattern = indices.join(','); @@ -85,6 +86,12 @@ const setUpModule = async ( }, }, ]; + const datafeedOverrides = [ + { + job_id: 'log-entry-categories-count' as const, + runtime_mappings: runtimeMappings, + }, + ]; const query = { bool: { filter: [ @@ -115,6 +122,7 @@ const setUpModule = async ( sourceId, indexPattern: indexNamePattern, jobOverrides, + datafeedOverrides, query, }, fetch @@ -128,6 +136,7 @@ const cleanUpModule = async (spaceId: string, sourceId: string, fetch: HttpHandl const validateSetupIndices = async ( indices: string[], timestampField: string, + runtimeMappings: estypes.RuntimeFields, fetch: HttpHandler ) => { return await callValidateIndicesAPI( @@ -147,6 +156,7 @@ const validateSetupIndices = async ( validTypes: ['text'], }, ], + runtimeMappings, }, fetch ); @@ -157,9 +167,13 @@ const validateSetupDatasets = async ( timestampField: string, startTime: number, endTime: number, + runtimeMappings: estypes.RuntimeFields, fetch: HttpHandler ) => { - return await callValidateDatasetsAPI({ indices, timestampField, startTime, endTime }, fetch); + return await callValidateDatasetsAPI( + { indices, timestampField, startTime, endTime, runtimeMappings }, + fetch + ); }; export const logEntryCategoriesModule: ModuleDescriptor = { diff --git a/x-pack/plugins/infra/public/containers/logs/log_analysis/modules/log_entry_categories/use_log_entry_categories_module.tsx b/x-pack/plugins/infra/public/containers/logs/log_analysis/modules/log_entry_categories/use_log_entry_categories_module.tsx index eaa82dd18c984..a2ad5cd4f56c4 100644 --- a/x-pack/plugins/infra/public/containers/logs/log_analysis/modules/log_entry_categories/use_log_entry_categories_module.tsx +++ b/x-pack/plugins/infra/public/containers/logs/log_analysis/modules/log_entry_categories/use_log_entry_categories_module.tsx @@ -6,6 +6,7 @@ */ import createContainer from 'constate'; +import { estypes } from '@elastic/elasticsearch'; import { useMemo } from 'react'; import { useLogAnalysisModule } from '../../log_analysis_module'; import { useLogAnalysisModuleConfiguration } from '../../log_analysis_module_configuration'; @@ -19,11 +20,13 @@ export const useLogEntryCategoriesModule = ({ sourceId, spaceId, timestampField, + runtimeMappings, }: { indexPattern: string; sourceId: string; spaceId: string; timestampField: string; + runtimeMappings: estypes.RuntimeFields; }) => { const sourceConfiguration: ModuleSourceConfiguration = useMemo( () => ({ @@ -31,8 +34,9 @@ export const useLogEntryCategoriesModule = ({ sourceId, spaceId, timestampField, + runtimeMappings, }), - [indexPattern, sourceId, spaceId, timestampField] + [indexPattern, sourceId, spaceId, timestampField, runtimeMappings] ); const logAnalysisModule = useLogAnalysisModule({ diff --git a/x-pack/plugins/infra/public/containers/logs/log_analysis/modules/log_entry_rate/module_descriptor.ts b/x-pack/plugins/infra/public/containers/logs/log_analysis/modules/log_entry_rate/module_descriptor.ts index f7c866c8e4e67..345f221f11c1f 100644 --- a/x-pack/plugins/infra/public/containers/logs/log_analysis/modules/log_entry_rate/module_descriptor.ts +++ b/x-pack/plugins/infra/public/containers/logs/log_analysis/modules/log_entry_rate/module_descriptor.ts @@ -6,6 +6,7 @@ */ import { i18n } from '@kbn/i18n'; +import type { estypes } from '@elastic/elasticsearch'; import type { HttpHandler } from 'src/core/public'; import { bucketSpan, @@ -61,7 +62,7 @@ const setUpModule = async ( start: number | undefined, end: number | undefined, datasetFilter: DatasetFilter, - { spaceId, sourceId, indices, timestampField }: ModuleSourceConfiguration, + { spaceId, sourceId, indices, timestampField, runtimeMappings }: ModuleSourceConfiguration, fetch: HttpHandler ) => { const indexNamePattern = indices.join(','); @@ -83,6 +84,12 @@ const setUpModule = async ( }, }, ]; + const datafeedOverrides = [ + { + job_id: 'log-entry-rate' as const, + runtime_mappings: runtimeMappings, + }, + ]; const query = datasetFilter.type === 'includeSome' ? { @@ -107,6 +114,7 @@ const setUpModule = async ( sourceId, indexPattern: indexNamePattern, jobOverrides, + datafeedOverrides, query, }, fetch @@ -120,6 +128,7 @@ const cleanUpModule = async (spaceId: string, sourceId: string, fetch: HttpHandl const validateSetupIndices = async ( indices: string[], timestampField: string, + runtimeMappings: estypes.RuntimeFields, fetch: HttpHandler ) => { return await callValidateIndicesAPI( @@ -135,6 +144,7 @@ const validateSetupIndices = async ( validTypes: ['keyword'], }, ], + runtimeMappings, }, fetch ); @@ -145,9 +155,13 @@ const validateSetupDatasets = async ( timestampField: string, startTime: number, endTime: number, + runtimeMappings: estypes.RuntimeFields, fetch: HttpHandler ) => { - return await callValidateDatasetsAPI({ indices, timestampField, startTime, endTime }, fetch); + return await callValidateDatasetsAPI( + { indices, timestampField, startTime, endTime, runtimeMappings }, + fetch + ); }; export const logEntryRateModule: ModuleDescriptor = { diff --git a/x-pack/plugins/infra/public/containers/logs/log_analysis/modules/log_entry_rate/use_log_entry_rate_module.tsx b/x-pack/plugins/infra/public/containers/logs/log_analysis/modules/log_entry_rate/use_log_entry_rate_module.tsx index 02eeb66f44590..b451cad1c8753 100644 --- a/x-pack/plugins/infra/public/containers/logs/log_analysis/modules/log_entry_rate/use_log_entry_rate_module.tsx +++ b/x-pack/plugins/infra/public/containers/logs/log_analysis/modules/log_entry_rate/use_log_entry_rate_module.tsx @@ -5,6 +5,7 @@ * 2.0. */ +import { estypes } from '@elastic/elasticsearch'; import createContainer from 'constate'; import { useMemo } from 'react'; import { ModuleSourceConfiguration } from '../../log_analysis_module_types'; @@ -18,11 +19,13 @@ export const useLogEntryRateModule = ({ sourceId, spaceId, timestampField, + runtimeMappings, }: { indexPattern: string; sourceId: string; spaceId: string; timestampField: string; + runtimeMappings: estypes.RuntimeFields; }) => { const sourceConfiguration: ModuleSourceConfiguration = useMemo( () => ({ @@ -30,8 +33,9 @@ export const useLogEntryRateModule = ({ sourceId, spaceId, timestampField, + runtimeMappings, }), - [indexPattern, sourceId, spaceId, timestampField] + [indexPattern, sourceId, spaceId, timestampField, runtimeMappings] ); const logAnalysisModule = useLogAnalysisModule({ diff --git a/x-pack/plugins/infra/public/hooks/use_kibana_index_patterns.mock.tsx b/x-pack/plugins/infra/public/hooks/use_kibana_index_patterns.mock.tsx new file mode 100644 index 0000000000000..dbf032415cb99 --- /dev/null +++ b/x-pack/plugins/infra/public/hooks/use_kibana_index_patterns.mock.tsx @@ -0,0 +1,95 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import React, { useMemo } from 'react'; +import { from, of } from 'rxjs'; +import { delay } from 'rxjs/operators'; +import { CoreStart } from '../../../../../src/core/public'; +import { FieldSpec } from '../../../../../src/plugins/data/common'; +import { + IIndexPattern, + IndexPattern, + IndexPatternField, + IndexPatternsContract, +} from '../../../../../src/plugins/data/public'; +import { KibanaContextProvider } from '../../../../../src/plugins/kibana_react/public'; +import { Pick2 } from '../../common/utility_types'; + +type MockIndexPattern = Pick< + IndexPattern, + 'id' | 'title' | 'type' | 'getTimeField' | 'isTimeBased' | 'getFieldByName' +>; +export type MockIndexPatternSpec = Pick< + IIndexPattern, + 'id' | 'title' | 'type' | 'timeFieldName' +> & { + fields: FieldSpec[]; +}; + +export const MockIndexPatternsKibanaContextProvider: React.FC<{ + asyncDelay: number; + mockIndexPatterns: MockIndexPatternSpec[]; +}> = ({ asyncDelay, children, mockIndexPatterns }) => { + const indexPatterns = useMemo( + () => + createIndexPatternsMock( + asyncDelay, + mockIndexPatterns.map(({ id, title, type = undefined, fields, timeFieldName }) => { + const indexPatternFields = fields.map((fieldSpec) => new IndexPatternField(fieldSpec)); + + return { + id, + title, + type, + getTimeField: () => indexPatternFields.find(({ name }) => name === timeFieldName), + isTimeBased: () => timeFieldName != null, + getFieldByName: (fieldName) => + indexPatternFields.find(({ name }) => name === fieldName), + }; + }) + ), + [asyncDelay, mockIndexPatterns] + ); + + const core = useMemo>( + () => ({ + application: { + getUrlForApp: () => '', + }, + }), + [] + ); + + return ( + + {children} + + ); +}; + +const createIndexPatternsMock = ( + asyncDelay: number, + indexPatterns: MockIndexPattern[] +): { + getIdsWithTitle: IndexPatternsContract['getIdsWithTitle']; + get: (...args: Parameters) => Promise; +} => { + return { + async getIdsWithTitle(_refresh?: boolean) { + const indexPatterns$ = of( + indexPatterns.map(({ id = 'unknown_id', title }) => ({ id, title })) + ); + return await indexPatterns$.pipe(delay(asyncDelay)).toPromise(); + }, + async get(indexPatternId: string) { + const indexPatterns$ = from( + indexPatterns.filter((indexPattern) => indexPattern.id === indexPatternId) + ); + return await indexPatterns$.pipe(delay(asyncDelay)).toPromise(); + }, + }; +}; diff --git a/x-pack/plugins/infra/public/hooks/use_kibana_index_patterns.ts b/x-pack/plugins/infra/public/hooks/use_kibana_index_patterns.ts new file mode 100644 index 0000000000000..a53cbcc170433 --- /dev/null +++ b/x-pack/plugins/infra/public/hooks/use_kibana_index_patterns.ts @@ -0,0 +1,45 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import { useState } from 'react'; +import { useTrackedPromise } from '../utils/use_tracked_promise'; +import { useKibanaContextForPlugin } from './use_kibana'; + +export const useKibanaIndexPatternService = () => { + const { + services: { + data: { indexPatterns }, + }, + } = useKibanaContextForPlugin(); + + return indexPatterns; +}; + +interface IndexPatternDescriptor { + id: string; + title: string; +} + +export const useKibanaIndexPatternTitles = () => { + const indexPatterns = useKibanaIndexPatternService(); + + const [indexPatternTitles, setIndexPatternTitles] = useState([]); + + const [indexPatternTitlesRequest, fetchIndexPatternTitles] = useTrackedPromise( + { + createPromise: () => indexPatterns.getIdsWithTitle(true), + onResolve: setIndexPatternTitles, + }, + [indexPatterns] + ); + + return { + fetchIndexPatternTitles, + indexPatternTitles, + latestIndexPatternTitlesRequest: indexPatternTitlesRequest, + }; +}; diff --git a/x-pack/plugins/infra/public/pages/logs/log_entry_categories/page_providers.tsx b/x-pack/plugins/infra/public/pages/logs/log_entry_categories/page_providers.tsx index 68b5a133550b0..ab409d661fe0a 100644 --- a/x-pack/plugins/infra/public/pages/logs/log_entry_categories/page_providers.tsx +++ b/x-pack/plugins/infra/public/pages/logs/log_entry_categories/page_providers.tsx @@ -28,6 +28,7 @@ export const LogEntryCategoriesPageProviders: React.FunctionComponent = ({ child sourceId={sourceId} spaceId={space.id} timestampField={resolvedSourceConfiguration.timestampField} + runtimeMappings={resolvedSourceConfiguration.runtimeMappings} > {children} diff --git a/x-pack/plugins/infra/public/pages/logs/log_entry_rate/page_providers.tsx b/x-pack/plugins/infra/public/pages/logs/log_entry_rate/page_providers.tsx index cb52dfd713578..628e2fb74d830 100644 --- a/x-pack/plugins/infra/public/pages/logs/log_entry_rate/page_providers.tsx +++ b/x-pack/plugins/infra/public/pages/logs/log_entry_rate/page_providers.tsx @@ -31,12 +31,14 @@ export const LogEntryRatePageProviders: React.FunctionComponent = ({ children }) sourceId={sourceId} spaceId={space.id} timestampField={resolvedSourceConfiguration.timestampField ?? ''} + runtimeMappings={resolvedSourceConfiguration.runtimeMappings} > {children} diff --git a/x-pack/plugins/infra/public/pages/logs/page_content.tsx b/x-pack/plugins/infra/public/pages/logs/page_content.tsx index 648915ad4075c..d43fe198c5077 100644 --- a/x-pack/plugins/infra/public/pages/logs/page_content.tsx +++ b/x-pack/plugins/infra/public/pages/logs/page_content.tsx @@ -40,6 +40,7 @@ export const LogsPageContent: React.FunctionComponent = () => { initialize(); }); + // !! Need to be kept in sync with the searchDeepLinks in x-pack/plugins/infra/public/plugin.ts const streamTab = { app: 'logs', title: streamTabTitle, diff --git a/x-pack/plugins/infra/public/pages/logs/settings/fields_configuration_panel.tsx b/x-pack/plugins/infra/public/pages/logs/settings/fields_configuration_panel.tsx index 236817ce3890f..3f8922b1871c9 100644 --- a/x-pack/plugins/infra/public/pages/logs/settings/fields_configuration_panel.tsx +++ b/x-pack/plugins/infra/public/pages/logs/settings/fields_configuration_panel.tsx @@ -10,7 +10,6 @@ import { EuiCode, EuiDescribedFormGroup, EuiFieldText, - EuiForm, EuiFormRow, EuiLink, EuiSpacer, @@ -18,27 +17,29 @@ import { } from '@elastic/eui'; import { i18n } from '@kbn/i18n'; import { FormattedMessage } from '@kbn/i18n/react'; -import React from 'react'; -import { InputFieldProps } from '../../../components/source_configuration/input_fields'; +import React, { useMemo } from 'react'; +import { FormElement } from './form_elements'; +import { getFormRowProps, getStringInputFieldProps } from './form_field_props'; +import { FormValidationError } from './validation_errors'; interface FieldsConfigurationPanelProps { isLoading: boolean; - readOnly: boolean; - tiebreakerFieldProps: InputFieldProps; - timestampFieldProps: InputFieldProps; + isReadOnly: boolean; + tiebreakerFieldFormElement: FormElement; + timestampFieldFormElement: FormElement; } export const FieldsConfigurationPanel = ({ isLoading, - readOnly, - tiebreakerFieldProps, - timestampFieldProps, + isReadOnly, + tiebreakerFieldFormElement, + timestampFieldFormElement, }: FieldsConfigurationPanelProps) => { - const isTimestampValueDefault = timestampFieldProps.value === '@timestamp'; - const isTiebreakerValueDefault = tiebreakerFieldProps.value === '_doc'; + const isTimestampValueDefault = timestampFieldFormElement.value === '@timestamp'; + const isTiebreakerValueDefault = tiebreakerFieldFormElement.value === '_doc'; return ( - + <>

} - isInvalid={timestampFieldProps.isInvalid} label={ } + {...useMemo(() => getFormRowProps(timestampFieldFormElement), [ + timestampFieldFormElement, + ])} > getStringInputFieldProps(timestampFieldFormElement), [ + timestampFieldFormElement, + ])} /> @@ -146,7 +150,6 @@ export const FieldsConfigurationPanel = ({ } > } - isInvalid={tiebreakerFieldProps.isInvalid} label={ } + {...useMemo(() => getFormRowProps(tiebreakerFieldFormElement), [ + tiebreakerFieldFormElement, + ])} > getStringInputFieldProps(tiebreakerFieldFormElement), [ + tiebreakerFieldFormElement, + ])} /> - + ); }; diff --git a/x-pack/plugins/infra/public/pages/logs/settings/form_elements.tsx b/x-pack/plugins/infra/public/pages/logs/settings/form_elements.tsx new file mode 100644 index 0000000000000..751d9762b937a --- /dev/null +++ b/x-pack/plugins/infra/public/pages/logs/settings/form_elements.tsx @@ -0,0 +1,243 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import equal from 'fast-deep-equal'; +import { useCallback, useMemo, useState } from 'react'; +import { useAsync } from 'react-use'; +import { ObjectEntries } from '../../../../common/utility_types'; +import { ChildFormValidationError, GenericValidationError } from './validation_errors'; + +const unsetValue = Symbol('unset form value'); + +type ValueUpdater = (updater: (previousValue: Value) => Value) => void; + +export interface FormElement { + initialValue: Value; + isDirty: boolean; + resetValue: () => void; + updateValue: ValueUpdater; + validity: FormElementValidity; + value: Value; +} + +type FormElementMap = { + [formElementName in keyof FormValues]: FormElement; +}; + +export interface CompositeFormElement + extends FormElement { + childFormElements: FormElementMap; +} + +export type FormElementValidity = + | { validity: 'valid' } + | { validity: 'invalid'; reasons: InvalidReason[] } + | { validity: 'pending' }; + +export const useFormElement = ({ + initialValue, + validate, +}: { + initialValue: Value; + validate?: (value: Value) => Promise; +}): FormElement => { + const [changedValue, setChangedValue] = useState(unsetValue); + + const value = changedValue !== unsetValue ? changedValue : initialValue; + + const updateValue = useCallback>( + (updater) => + setChangedValue((previousValue) => + previousValue === unsetValue ? updater(initialValue) : updater(previousValue) + ), + [initialValue] + ); + + const resetValue = useCallback(() => setChangedValue(unsetValue), []); + + const isDirty = useMemo(() => !equal(value, initialValue), [value, initialValue]); + + const validity = useValidity(value, validate); + + return useMemo( + () => ({ + initialValue, + isDirty, + resetValue, + updateValue, + validity, + value, + }), + [initialValue, isDirty, resetValue, updateValue, validity, value] + ); +}; + +export const useCompositeFormElement = ({ + childFormElements, + validate, +}: { + childFormElements: FormElementMap; + validate?: (values: FormValues) => Promise; +}): CompositeFormElement => { + const childFormElementEntries = useMemo( + () => Object.entries(childFormElements) as ObjectEntries, + // eslint-disable-next-line react-hooks/exhaustive-deps + Object.entries(childFormElements).flat() + ); + + const value = useMemo( + () => + childFormElementEntries.reduce( + (accumulatedFormValues, [formElementName, formElement]) => ({ + ...accumulatedFormValues, + [formElementName]: formElement.value, + }), + {} as FormValues + ), + [childFormElementEntries] + ); + + const updateValue = useCallback( + (updater: (previousValues: FormValues) => FormValues) => { + const newValues = updater(value); + + childFormElementEntries.forEach(([formElementName, formElement]) => + formElement.updateValue(() => newValues[formElementName]) + ); + }, + [childFormElementEntries, value] + ); + + const isDirty = useMemo( + () => childFormElementEntries.some(([, formElement]) => formElement.isDirty), + [childFormElementEntries] + ); + + const formValidity = useValidity(value, validate); + const childFormElementsValidity = useMemo< + FormElementValidity + >(() => { + if ( + childFormElementEntries.some(([, formElement]) => formElement.validity.validity === 'invalid') + ) { + return { + validity: 'invalid', + reasons: [{ type: 'child' }], + }; + } else if ( + childFormElementEntries.some(([, formElement]) => formElement.validity.validity === 'pending') + ) { + return { + validity: 'pending', + }; + } else { + return { + validity: 'valid', + }; + } + }, [childFormElementEntries]); + + const validity = useMemo(() => getCombinedValidity(formValidity, childFormElementsValidity), [ + formValidity, + childFormElementsValidity, + ]); + + const resetValue = useCallback(() => { + childFormElementEntries.forEach(([, formElement]) => formElement.resetValue()); + }, [childFormElementEntries]); + + const initialValue = useMemo( + () => + childFormElementEntries.reduce( + (accumulatedFormValues, [formElementName, formElement]) => ({ + ...accumulatedFormValues, + [formElementName]: formElement.initialValue, + }), + {} as FormValues + ), + [childFormElementEntries] + ); + + return useMemo( + () => ({ + childFormElements, + initialValue, + isDirty, + resetValue, + updateValue, + validity, + value, + }), + [childFormElements, initialValue, isDirty, resetValue, updateValue, validity, value] + ); +}; + +const useValidity = ( + value: Value, + validate?: (value: Value) => Promise +) => { + const validationState = useAsync(() => validate?.(value) ?? Promise.resolve([]), [ + validate, + value, + ]); + + const validity = useMemo>(() => { + if (validationState.loading) { + return { validity: 'pending' as const }; + } else if (validationState.error != null) { + return { + validity: 'invalid' as const, + reasons: [ + { + type: 'generic' as const, + message: `${validationState.error}`, + }, + ], + }; + } else if (validationState.value && validationState.value.length > 0) { + return { + validity: 'invalid' as const, + reasons: validationState.value, + }; + } else { + return { + validity: 'valid' as const, + }; + } + }, [validationState.error, validationState.loading, validationState.value]); + + return validity; +}; + +export const getCombinedValidity = ( + first: FormElementValidity, + second: FormElementValidity +): FormElementValidity => { + if (first.validity === 'invalid' || second.validity === 'invalid') { + return { + validity: 'invalid', + reasons: [ + ...(first.validity === 'invalid' ? first.reasons : []), + ...(second.validity === 'invalid' ? second.reasons : []), + ], + }; + } else if (first.validity === 'pending' || second.validity === 'pending') { + return { + validity: 'pending', + }; + } else { + return { + validity: 'valid', + }; + } +}; + +export const isFormElementForType = ( + isValue: (value: any) => value is Value +) => ( + formElement: FormElement +): formElement is FormElement => isValue(formElement.value); diff --git a/x-pack/plugins/infra/public/pages/logs/settings/form_field_props.tsx b/x-pack/plugins/infra/public/pages/logs/settings/form_field_props.tsx new file mode 100644 index 0000000000000..4a3927157b136 --- /dev/null +++ b/x-pack/plugins/infra/public/pages/logs/settings/form_field_props.tsx @@ -0,0 +1,37 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ +import React from 'react'; +import { FormElement } from './form_elements'; +import { LogSourceConfigurationFormError } from './source_configuration_form_errors'; +import { FormValidationError } from './validation_errors'; + +export const getFormRowProps = (formElement: FormElement) => ({ + error: + formElement.validity.validity === 'invalid' + ? formElement.validity.reasons.map((error) => ( + + )) + : [], + isInvalid: formElement.validity.validity === 'invalid', +}); + +export const getInputFieldProps = ( + decodeInputValue: (value: string) => Value, + encodeInputValue: (value: Value) => string +) => (formElement: FormElement) => ({ + isInvalid: formElement.validity.validity === 'invalid', + onChange: (evt: React.ChangeEvent) => { + const newValue = evt.currentTarget.value; + formElement.updateValue(() => decodeInputValue(newValue)); + }, + value: encodeInputValue(formElement.value), +}); + +export const getStringInputFieldProps = getInputFieldProps( + (value) => `${value}`, + (value) => value +); diff --git a/x-pack/plugins/infra/public/pages/logs/settings/index_names_configuration_panel.tsx b/x-pack/plugins/infra/public/pages/logs/settings/index_names_configuration_panel.tsx new file mode 100644 index 0000000000000..2d2909f42bae6 --- /dev/null +++ b/x-pack/plugins/infra/public/pages/logs/settings/index_names_configuration_panel.tsx @@ -0,0 +1,127 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import { + EuiButton, + EuiCallOut, + EuiCode, + EuiDescribedFormGroup, + EuiFieldText, + EuiFormRow, + EuiSpacer, + EuiTitle, +} from '@elastic/eui'; +import { i18n } from '@kbn/i18n'; +import { FormattedMessage } from '@kbn/i18n/react'; +import React from 'react'; +import { useTrackPageview } from '../../../../../observability/public'; +import { LogIndexNameReference } from '../../../../common/log_sources'; +import { FormElement } from './form_elements'; +import { getFormRowProps, getInputFieldProps } from './form_field_props'; +import { FormValidationError } from './validation_errors'; + +export const IndexNamesConfigurationPanel: React.FC<{ + isLoading: boolean; + isReadOnly: boolean; + indexNamesFormElement: FormElement; + onSwitchToIndexPatternReference: () => void; +}> = ({ isLoading, isReadOnly, indexNamesFormElement, onSwitchToIndexPatternReference }) => { + useTrackPageview({ app: 'infra_logs', path: 'log_source_configuration_index_name' }); + useTrackPageview({ + app: 'infra_logs', + path: 'log_source_configuration_index_name', + delay: 15000, + }); + + return ( + <> + +

+ +

+
+ + + + + + + + + + +

+ } + description={ + + } + > + logs-*,filebeat-*, + }} + /> + } + label={ + + } + {...getFormRowProps(indexNamesFormElement)} + > + + + + + ); +}; + +const getIndexNamesInputFieldProps = getInputFieldProps( + (value) => ({ + type: 'index_name', + indexName: value, + }), + ({ indexName }) => indexName +); + +const deprecationCalloutTitle = i18n.translate( + 'xpack.infra.logSourceConfiguration.indexNameReferenceDeprecationTitle', + { + defaultMessage: 'Deprecated configuration option', + } +); diff --git a/x-pack/plugins/infra/public/pages/logs/settings/index_pattern_configuration_panel.tsx b/x-pack/plugins/infra/public/pages/logs/settings/index_pattern_configuration_panel.tsx new file mode 100644 index 0000000000000..a16f15505bc30 --- /dev/null +++ b/x-pack/plugins/infra/public/pages/logs/settings/index_pattern_configuration_panel.tsx @@ -0,0 +1,121 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import { EuiDescribedFormGroup, EuiFormRow, EuiLink, EuiSpacer, EuiTitle } from '@elastic/eui'; +import { FormattedMessage } from '@kbn/i18n/react'; +import React, { useCallback, useMemo } from 'react'; +import { useTrackPageview } from '../../../../../observability/public'; +import { LogIndexPatternReference } from '../../../../common/log_sources'; +import { useLinkProps } from '../../../hooks/use_link_props'; +import { FormElement } from './form_elements'; +import { getFormRowProps } from './form_field_props'; +import { IndexPatternSelector } from './index_pattern_selector'; +import { FormValidationError } from './validation_errors'; + +export const IndexPatternConfigurationPanel: React.FC<{ + isLoading: boolean; + isReadOnly: boolean; + indexPatternFormElement: FormElement; +}> = ({ isLoading, isReadOnly, indexPatternFormElement }) => { + useTrackPageview({ app: 'infra_logs', path: 'log_source_configuration_index_pattern' }); + useTrackPageview({ + app: 'infra_logs', + path: 'log_source_configuration_index_pattern', + delay: 15000, + }); + + const changeIndexPatternId = useCallback( + (indexPatternId: string | undefined) => { + if (indexPatternId != null) { + indexPatternFormElement.updateValue(() => ({ + type: 'index_pattern', + indexPatternId, + })); + } else { + indexPatternFormElement.updateValue(() => undefined); + } + }, + [indexPatternFormElement] + ); + + return ( + <> + +

+ +

+
+ + + + + +

+ } + description={ + + } + > + + } + {...useMemo(() => (isLoading ? {} : getFormRowProps(indexPatternFormElement)), [ + isLoading, + indexPatternFormElement, + ])} + > + + + + + ); +}; + +const IndexPatternInlineHelpMessage = React.memo(() => { + const indexPatternManagementLinkProps = useLinkProps({ + app: 'management', + pathname: '/kibana/indexPatterns', + }); + + return ( + + + + ), + }} + /> + ); +}); diff --git a/x-pack/plugins/infra/public/pages/logs/settings/index_pattern_selector.tsx b/x-pack/plugins/infra/public/pages/logs/settings/index_pattern_selector.tsx new file mode 100644 index 0000000000000..9e110db53a27f --- /dev/null +++ b/x-pack/plugins/infra/public/pages/logs/settings/index_pattern_selector.tsx @@ -0,0 +1,73 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import { EuiComboBox, EuiComboBoxOptionOption } from '@elastic/eui'; +import { i18n } from '@kbn/i18n'; +import React, { useCallback, useEffect, useMemo } from 'react'; +import { useKibanaIndexPatternTitles } from '../../../hooks/use_kibana_index_patterns'; + +type IndexPatternOption = EuiComboBoxOptionOption; + +export const IndexPatternSelector: React.FC<{ + indexPatternId: string | undefined; + isLoading: boolean; + isReadOnly: boolean; + onChangeIndexPatternId: (indexPatternId: string | undefined) => void; +}> = ({ indexPatternId, isLoading, isReadOnly, onChangeIndexPatternId }) => { + const { + indexPatternTitles: availableIndexPatterns, + latestIndexPatternTitlesRequest, + fetchIndexPatternTitles, + } = useKibanaIndexPatternTitles(); + + useEffect(() => { + fetchIndexPatternTitles(); + }, [fetchIndexPatternTitles]); + + const availableOptions = useMemo( + () => + availableIndexPatterns.map(({ id, title }) => ({ + key: id, + label: title, + value: id, + })), + [availableIndexPatterns] + ); + + const selectedOptions = useMemo( + () => availableOptions.filter(({ key }) => key === indexPatternId), + [availableOptions, indexPatternId] + ); + + const changeSelectedIndexPatterns = useCallback( + ([newlySelectedOption]: IndexPatternOption[]) => { + if (typeof newlySelectedOption?.key === 'string') { + return onChangeIndexPatternId(newlySelectedOption.key); + } + + return onChangeIndexPatternId(undefined); + }, + [onChangeIndexPatternId] + ); + + return ( + + isLoading={isLoading || latestIndexPatternTitlesRequest.state === 'pending'} + isDisabled={isReadOnly} + options={availableOptions} + placeholder={indexPatternSelectorPlaceholder} + selectedOptions={selectedOptions} + singleSelection={true} + onChange={changeSelectedIndexPatterns} + /> + ); +}; + +const indexPatternSelectorPlaceholder = i18n.translate( + 'xpack.infra.logSourceConfiguration.indexPatternSelectorPlaceholder', + { defaultMessage: 'Choose an index pattern' } +); diff --git a/x-pack/plugins/infra/public/pages/logs/settings/indices_configuration_form_state.ts b/x-pack/plugins/infra/public/pages/logs/settings/indices_configuration_form_state.ts index b7656e6499006..49d14e04ca328 100644 --- a/x-pack/plugins/infra/public/pages/logs/settings/indices_configuration_form_state.ts +++ b/x-pack/plugins/infra/public/pages/logs/settings/indices_configuration_form_state.ts @@ -5,120 +5,107 @@ * 2.0. */ -import { ReactNode, useCallback, useMemo, useState } from 'react'; +import { useMemo } from 'react'; +import { useUiTracker } from '../../../../../observability/public'; import { - createInputFieldProps, - validateInputFieldNotEmpty, -} from '../../../components/source_configuration/input_fields'; + LogIndexNameReference, + logIndexNameReferenceRT, + LogIndexPatternReference, +} from '../../../../common/log_sources'; +import { useKibanaIndexPatternService } from '../../../hooks/use_kibana_index_patterns'; +import { useCompositeFormElement, useFormElement } from './form_elements'; +import { + FormValidationError, + validateIndexPattern, + validateStringNotEmpty, +} from './validation_errors'; -interface FormState { - name: string; - description: string; - logAlias: string; - tiebreakerField: string; - timestampField: string; -} +export type LogIndicesFormState = LogIndexNameReference | LogIndexPatternReference | undefined; -type FormStateChanges = Partial; +export const useLogIndicesFormElement = (initialValue: LogIndicesFormState) => { + const indexPatternService = useKibanaIndexPatternService(); -export const useLogIndicesConfigurationFormState = ({ - initialFormState = defaultFormState, -}: { - initialFormState?: FormState; -}) => { - const [formStateChanges, setFormStateChanges] = useState({}); + const trackIndexPatternValidationError = useUiTracker({ app: 'infra_logs' }); - const resetForm = useCallback(() => setFormStateChanges({}), []); + const logIndicesFormElement = useFormElement({ + initialValue, + validate: useMemo( + () => async (logIndices) => { + if (logIndices == null) { + return validateStringNotEmpty('log index pattern', ''); + } else if (logIndexNameReferenceRT.is(logIndices)) { + return validateStringNotEmpty('log indices', logIndices.indexName); + } else { + const emptyStringErrors = validateStringNotEmpty( + 'log index pattern', + logIndices.indexPatternId + ); - const formState = useMemo( - () => ({ - ...initialFormState, - ...formStateChanges, - }), - [initialFormState, formStateChanges] - ); + if (emptyStringErrors.length > 0) { + return emptyStringErrors; + } - const nameFieldProps = useMemo( - () => - createInputFieldProps({ - errors: validateInputFieldNotEmpty(formState.name), - name: 'name', - onChange: (name) => setFormStateChanges((changes) => ({ ...changes, name })), - value: formState.name, - }), - [formState.name] - ); - const logAliasFieldProps = useMemo( - () => - createInputFieldProps({ - errors: validateInputFieldNotEmpty(formState.logAlias), - name: 'logAlias', - onChange: (logAlias) => setFormStateChanges((changes) => ({ ...changes, logAlias })), - value: formState.logAlias, - }), - [formState.logAlias] - ); - const tiebreakerFieldFieldProps = useMemo( - () => - createInputFieldProps({ - errors: validateInputFieldNotEmpty(formState.tiebreakerField), - name: `tiebreakerField`, - onChange: (tiebreakerField) => - setFormStateChanges((changes) => ({ ...changes, tiebreakerField })), - value: formState.tiebreakerField, - }), - [formState.tiebreakerField] - ); - const timestampFieldFieldProps = useMemo( - () => - createInputFieldProps({ - errors: validateInputFieldNotEmpty(formState.timestampField), - name: `timestampField`, - onChange: (timestampField) => - setFormStateChanges((changes) => ({ ...changes, timestampField })), - value: formState.timestampField, - }), - [formState.timestampField] - ); + const indexPatternErrors = validateIndexPattern( + await indexPatternService.get(logIndices.indexPatternId) + ); - const fieldProps = useMemo( - () => ({ - name: nameFieldProps, - logAlias: logAliasFieldProps, - tiebreakerField: tiebreakerFieldFieldProps, - timestampField: timestampFieldFieldProps, - }), - [nameFieldProps, logAliasFieldProps, tiebreakerFieldFieldProps, timestampFieldFieldProps] - ); + if (indexPatternErrors.length > 0) { + trackIndexPatternValidationError({ + metric: 'configuration_index_pattern_validation_failed', + }); + } else { + trackIndexPatternValidationError({ + metric: 'configuration_index_pattern_validation_succeeded', + }); + } - const errors = useMemo( - () => - Object.values(fieldProps).reduce( - (accumulatedErrors, { error }) => [...accumulatedErrors, ...error], - [] - ), - [fieldProps] - ); + return indexPatternErrors; + } + }, + [indexPatternService, trackIndexPatternValidationError] + ), + }); + + return logIndicesFormElement; +}; - const isFormValid = useMemo(() => errors.length <= 0, [errors]); +export interface FieldsFormState { + tiebreakerField: string; + timestampField: string; +} - const isFormDirty = useMemo(() => Object.keys(formStateChanges).length > 0, [formStateChanges]); +export const useFieldsFormElement = (initialValues: FieldsFormState) => { + const tiebreakerFieldFormElement = useFormElement({ + initialValue: initialValues.tiebreakerField, + validate: useMemo( + () => async (tiebreakerField) => validateStringNotEmpty('tiebreaker', tiebreakerField), + [] + ), + }); + + const timestampFieldFormElement = useFormElement({ + initialValue: initialValues.timestampField, + validate: useMemo( + () => async (timestampField) => validateStringNotEmpty('timestamp', timestampField), + [] + ), + }); + + const fieldsFormElement = useCompositeFormElement( + useMemo( + () => ({ + childFormElements: { + tiebreaker: tiebreakerFieldFormElement, + timestamp: timestampFieldFormElement, + }, + }), + [tiebreakerFieldFormElement, timestampFieldFormElement] + ) + ); return { - errors, - fieldProps, - formState, - formStateChanges, - isFormDirty, - isFormValid, - resetForm, + fieldsFormElement, + tiebreakerFieldFormElement, + timestampFieldFormElement, }; }; - -const defaultFormState: FormState = { - name: '', - description: '', - logAlias: '', - tiebreakerField: '', - timestampField: '', -}; diff --git a/x-pack/plugins/infra/public/pages/logs/settings/indices_configuration_panel.stories.tsx b/x-pack/plugins/infra/public/pages/logs/settings/indices_configuration_panel.stories.tsx new file mode 100644 index 0000000000000..8cc9f5b4357ef --- /dev/null +++ b/x-pack/plugins/infra/public/pages/logs/settings/indices_configuration_panel.stories.tsx @@ -0,0 +1,168 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import { EuiCodeBlock, EuiPage, EuiPageBody, EuiPageContent, PropsOf } from '@elastic/eui'; +import { I18nProvider } from '@kbn/i18n/react'; +import { Meta, Story } from '@storybook/react/types-6-0'; +import React from 'react'; +import { KBN_FIELD_TYPES } from '../../../../../../../src/plugins/data/public'; +import { EuiThemeProvider } from '../../../../../../../src/plugins/kibana_react/common'; +import { + MockIndexPatternsKibanaContextProvider, + MockIndexPatternSpec, +} from '../../../hooks/use_kibana_index_patterns.mock'; +import { + FieldsFormState, + LogIndicesFormState, + useFieldsFormElement, + useLogIndicesFormElement, +} from './indices_configuration_form_state'; +import { IndicesConfigurationPanel } from './indices_configuration_panel'; + +export default { + title: 'infra/logsSettings/indicesConfiguration', + decorators: [ + (WrappedStory, { args }) => { + return ( + + + + + + + + + + + + + + ); + }, + ], + argTypes: { + logIndices: { + control: { + type: 'object', + }, + }, + availableIndexPatterns: { + control: { + type: 'object', + }, + }, + }, +} as Meta; + +type IndicesConfigurationPanelProps = PropsOf; + +type IndicesConfigurationPanelStoryArgs = Pick< + IndicesConfigurationPanelProps, + 'isLoading' | 'isReadOnly' +> & { + availableIndexPatterns: MockIndexPatternSpec[]; + logIndices: LogIndicesFormState; + fields: FieldsFormState; +}; + +const IndicesConfigurationPanelTemplate: Story = ({ + isLoading, + isReadOnly, + logIndices, + fields, +}) => { + const logIndicesFormElement = useLogIndicesFormElement(logIndices); + const { tiebreakerFieldFormElement, timestampFieldFormElement } = useFieldsFormElement(fields); + + return ( + <> + + + // field states{'\n'} + {JSON.stringify( + { + logIndices: { + value: logIndicesFormElement.value, + validity: logIndicesFormElement.validity, + }, + tiebreakerField: { + value: tiebreakerFieldFormElement.value, + validity: tiebreakerFieldFormElement.validity, + }, + timestampField: { + value: timestampFieldFormElement.value, + validity: timestampFieldFormElement.validity, + }, + }, + null, + 2 + )} + + + ); +}; + +const defaultArgs: IndicesConfigurationPanelStoryArgs = { + isLoading: false, + isReadOnly: false, + logIndices: { + type: 'index_name' as const, + indexName: 'logs-*', + }, + fields: { + tiebreakerField: '_doc', + timestampField: '@timestamp', + }, + availableIndexPatterns: [ + { + id: 'INDEX_PATTERN_A', + title: 'pattern-a-*', + timeFieldName: '@timestamp', + fields: [ + { + name: '@timestamp', + type: KBN_FIELD_TYPES.DATE, + searchable: true, + aggregatable: true, + }, + { + name: 'message', + type: KBN_FIELD_TYPES.STRING, + searchable: true, + aggregatable: true, + }, + ], + }, + { + id: 'INDEX_PATTERN_B', + title: 'pattern-b-*', + fields: [], + }, + ], +}; + +export const IndexNameWithDefaultFields = IndicesConfigurationPanelTemplate.bind({}); + +IndexNameWithDefaultFields.args = { + ...defaultArgs, +}; + +export const IndexPattern = IndicesConfigurationPanelTemplate.bind({}); + +IndexPattern.args = { + ...defaultArgs, + logIndices: undefined, +}; diff --git a/x-pack/plugins/infra/public/pages/logs/settings/indices_configuration_panel.tsx b/x-pack/plugins/infra/public/pages/logs/settings/indices_configuration_panel.tsx index e6f03e76255a2..6f762afd79244 100644 --- a/x-pack/plugins/infra/public/pages/logs/settings/indices_configuration_panel.tsx +++ b/x-pack/plugins/infra/public/pages/logs/settings/indices_configuration_panel.tsx @@ -5,85 +5,77 @@ * 2.0. */ +import React, { useCallback } from 'react'; +import { useUiTracker } from '../../../../../observability/public'; import { - EuiCode, - EuiDescribedFormGroup, - EuiFieldText, - EuiForm, - EuiFormRow, - EuiSpacer, - EuiTitle, -} from '@elastic/eui'; -import { FormattedMessage } from '@kbn/i18n/react'; -import React from 'react'; -import { InputFieldProps } from '../../../components/source_configuration/input_fields'; + logIndexNameReferenceRT, + LogIndexPatternReference, + logIndexPatternReferenceRT, + LogIndexReference, +} from '../../../../common/log_sources'; +import { FieldsConfigurationPanel } from './fields_configuration_panel'; +import { FormElement, isFormElementForType } from './form_elements'; +import { IndexNamesConfigurationPanel } from './index_names_configuration_panel'; +import { IndexPatternConfigurationPanel } from './index_pattern_configuration_panel'; +import { FormValidationError } from './validation_errors'; -interface IndicesConfigurationPanelProps { +export const IndicesConfigurationPanel = React.memo<{ isLoading: boolean; - readOnly: boolean; - logAliasFieldProps: InputFieldProps; -} + isReadOnly: boolean; + indicesFormElement: FormElement; + tiebreakerFieldFormElement: FormElement; + timestampFieldFormElement: FormElement; +}>( + ({ + isLoading, + isReadOnly, + indicesFormElement, + tiebreakerFieldFormElement, + timestampFieldFormElement, + }) => { + const trackSwitchToIndexPatternReference = useUiTracker({ app: 'infra_logs' }); -export const IndicesConfigurationPanel = ({ - isLoading, - readOnly, - logAliasFieldProps, -}: IndicesConfigurationPanelProps) => ( - - -

- -

-
- - - - - } - description={ - { + indicesFormElement.updateValue(() => undefined); + trackSwitchToIndexPatternReference({ + metric: 'configuration_switch_to_index_pattern_reference', + }); + }, [indicesFormElement, trackSwitchToIndexPatternReference]); + + if (isIndexPatternFormElement(indicesFormElement)) { + return ( + - } - > - logs-*,filebeat-*, - }} + ); + } else if (isIndexNamesFormElement(indicesFormElement)) { + return ( + <> + - } - isInvalid={logAliasFieldProps.isInvalid} - label={ - - } - > - - - -
+ + ); + } else { + return null; + } + } +); + +const isIndexPatternFormElement = isFormElementForType( + (value): value is LogIndexPatternReference | undefined => + value == null || logIndexPatternReferenceRT.is(value) ); + +const isIndexNamesFormElement = isFormElementForType(logIndexNameReferenceRT.is); diff --git a/x-pack/plugins/infra/public/pages/logs/settings/log_columns_configuration_form_state.tsx b/x-pack/plugins/infra/public/pages/logs/settings/log_columns_configuration_form_state.tsx index 011fbf8a9d9a6..80eb44de9da9d 100644 --- a/x-pack/plugins/infra/public/pages/logs/settings/log_columns_configuration_form_state.tsx +++ b/x-pack/plugins/infra/public/pages/logs/settings/log_columns_configuration_form_state.tsx @@ -5,150 +5,16 @@ * 2.0. */ -import { FormattedMessage } from '@kbn/i18n/react'; -import React, { useCallback, useMemo, useState } from 'react'; -import { - FieldLogColumnConfiguration, - isMessageLogColumnConfiguration, - isTimestampLogColumnConfiguration, - LogColumnConfiguration, - MessageLogColumnConfiguration, - TimestampLogColumnConfiguration, -} from '../../../utils/source_configuration'; - -export interface TimestampLogColumnConfigurationProps { - logColumnConfiguration: TimestampLogColumnConfiguration['timestampColumn']; - remove: () => void; - type: 'timestamp'; -} - -export interface MessageLogColumnConfigurationProps { - logColumnConfiguration: MessageLogColumnConfiguration['messageColumn']; - remove: () => void; - type: 'message'; -} - -export interface FieldLogColumnConfigurationProps { - logColumnConfiguration: FieldLogColumnConfiguration['fieldColumn']; - remove: () => void; - type: 'field'; -} - -export type LogColumnConfigurationProps = - | TimestampLogColumnConfigurationProps - | MessageLogColumnConfigurationProps - | FieldLogColumnConfigurationProps; - -interface FormState { - logColumns: LogColumnConfiguration[]; -} - -type FormStateChanges = Partial; - -export const useLogColumnsConfigurationFormState = ({ - initialFormState = defaultFormState, -}: { - initialFormState?: FormState; -}) => { - const [formStateChanges, setFormStateChanges] = useState({}); - - const resetForm = useCallback(() => setFormStateChanges({}), []); - - const formState = useMemo( - () => ({ - ...initialFormState, - ...formStateChanges, - }), - [initialFormState, formStateChanges] - ); - - const logColumnConfigurationProps = useMemo( - () => - formState.logColumns.map( - (logColumn): LogColumnConfigurationProps => { - const remove = () => - setFormStateChanges((changes) => ({ - ...changes, - logColumns: formState.logColumns.filter((item) => item !== logColumn), - })); - - if (isTimestampLogColumnConfiguration(logColumn)) { - return { - logColumnConfiguration: logColumn.timestampColumn, - remove, - type: 'timestamp', - }; - } else if (isMessageLogColumnConfiguration(logColumn)) { - return { - logColumnConfiguration: logColumn.messageColumn, - remove, - type: 'message', - }; - } else { - return { - logColumnConfiguration: logColumn.fieldColumn, - remove, - type: 'field', - }; - } - } - ), - [formState.logColumns] - ); - - const addLogColumn = useCallback( - (logColumnConfiguration: LogColumnConfiguration) => - setFormStateChanges((changes) => ({ - ...changes, - logColumns: [...formState.logColumns, logColumnConfiguration], - })), - [formState.logColumns] - ); - - const moveLogColumn = useCallback( - (sourceIndex, destinationIndex) => { - if (destinationIndex >= 0 && sourceIndex <= formState.logColumns.length - 1) { - const newLogColumns = [...formState.logColumns]; - newLogColumns.splice(destinationIndex, 0, newLogColumns.splice(sourceIndex, 1)[0]); - setFormStateChanges((changes) => ({ - ...changes, - logColumns: newLogColumns, - })); - } - }, - [formState.logColumns] - ); - - const errors = useMemo( - () => - logColumnConfigurationProps.length <= 0 - ? [ - , - ] - : [], - [logColumnConfigurationProps] - ); - - const isFormValid = useMemo(() => (errors.length <= 0 ? true : false), [errors]); - - const isFormDirty = useMemo(() => Object.keys(formStateChanges).length > 0, [formStateChanges]); - - return { - addLogColumn, - moveLogColumn, - errors, - logColumnConfigurationProps, - formState, - formStateChanges, - isFormDirty, - isFormValid, - resetForm, - }; -}; - -const defaultFormState: FormState = { - logColumns: [], +import { useMemo } from 'react'; +import { LogColumnConfiguration } from '../../../utils/source_configuration'; +import { useFormElement } from './form_elements'; +import { FormValidationError, validateColumnListNotEmpty } from './validation_errors'; + +export const useLogColumnsFormElement = (initialValue: LogColumnConfiguration[]) => { + const logColumnsFormElement = useFormElement({ + initialValue, + validate: useMemo(() => async (logColumns) => validateColumnListNotEmpty(logColumns), []), + }); + + return logColumnsFormElement; }; diff --git a/x-pack/plugins/infra/public/pages/logs/settings/log_columns_configuration_panel.tsx b/x-pack/plugins/infra/public/pages/logs/settings/log_columns_configuration_panel.tsx index fb17f8bee3464..70db7837b8ae5 100644 --- a/x-pack/plugins/infra/public/pages/logs/settings/log_columns_configuration_panel.tsx +++ b/x-pack/plugins/infra/public/pages/logs/settings/log_columns_configuration_panel.tsx @@ -13,7 +13,6 @@ import { EuiEmptyPrompt, EuiFlexGroup, EuiFlexItem, - EuiForm, EuiIcon, EuiPanel, EuiSpacer, @@ -24,28 +23,54 @@ import { i18n } from '@kbn/i18n'; import { FormattedMessage } from '@kbn/i18n/react'; import React, { useCallback } from 'react'; import { DragHandleProps, DropResult } from '../../../../../observability/public'; -import { LogColumnConfiguration } from '../../../utils/source_configuration'; -import { AddLogColumnButtonAndPopover } from './add_log_column_popover'; import { - FieldLogColumnConfigurationProps, - LogColumnConfigurationProps, -} from './log_columns_configuration_form_state'; + FieldLogColumnConfiguration, + getLogColumnConfigurationId, + isMessageLogColumnConfiguration, + isTimestampLogColumnConfiguration, + LogColumnConfiguration, + MessageLogColumnConfiguration, + TimestampLogColumnConfiguration, +} from '../../../utils/source_configuration'; +import { AddLogColumnButtonAndPopover } from './add_log_column_popover'; +import { FormElement } from './form_elements'; +import { LogSourceConfigurationFormError } from './source_configuration_form_errors'; +import { FormValidationError } from './validation_errors'; -interface LogColumnsConfigurationPanelProps { +export const LogColumnsConfigurationPanel = React.memo<{ availableFields: string[]; isLoading: boolean; - logColumnConfiguration: LogColumnConfigurationProps[]; - addLogColumn: (logColumn: LogColumnConfiguration) => void; - moveLogColumn: (sourceIndex: number, destinationIndex: number) => void; -} + logColumnsFormElement: FormElement; +}>(({ availableFields, isLoading, logColumnsFormElement }) => { + const addLogColumn = useCallback( + (logColumnConfiguration: LogColumnConfiguration) => + logColumnsFormElement.updateValue((logColumns) => [...logColumns, logColumnConfiguration]), + [logColumnsFormElement] + ); + + const removeLogColumn = useCallback( + (logColumn: LogColumnConfiguration) => + logColumnsFormElement.updateValue((logColumns) => + logColumns.filter((item) => item !== logColumn) + ), + [logColumnsFormElement] + ); + + const moveLogColumn = useCallback( + (sourceIndex, destinationIndex) => { + logColumnsFormElement.updateValue((logColumns) => { + if (destinationIndex >= 0 && sourceIndex <= logColumnsFormElement.value.length - 1) { + const newLogColumns = [...logColumnsFormElement.value]; + newLogColumns.splice(destinationIndex, 0, newLogColumns.splice(sourceIndex, 1)[0]); + return newLogColumns; + } else { + return logColumns; + } + }); + }, + [logColumnsFormElement] + ); -export const LogColumnsConfigurationPanel: React.FunctionComponent = ({ - addLogColumn, - moveLogColumn, - availableFields, - isLoading, - logColumnConfiguration, -}) => { const onDragEnd = useCallback( ({ source, destination }: DropResult) => destination && moveLogColumn(source.index, destination.index), @@ -53,7 +78,7 @@ export const LogColumnsConfigurationPanel: React.FunctionComponent + <> @@ -73,63 +98,89 @@ export const LogColumnsConfigurationPanel: React.FunctionComponent - {logColumnConfiguration.length > 0 ? ( + {logColumnsFormElement.value.length > 0 ? ( - <> - {/* Fragment here necessary for typechecking */} - {logColumnConfiguration.map((column, index) => ( + {logColumnsFormElement.value.map((logColumnConfiguration, index) => { + const columnId = getLogColumnConfigurationId(logColumnConfiguration); + return ( {(provided) => ( )} - ))} - + ); + })} ) : ( )} - + {logColumnsFormElement.validity.validity === 'invalid' + ? logColumnsFormElement.validity.reasons.map((error) => ( + + + + )) + : null} + + ); +}); + +const LogColumnConfigurationPanel: React.FunctionComponent<{ + logColumnConfiguration: LogColumnConfiguration; + dragHandleProps: DragHandleProps; + onRemove: (logColumnConfiguration: LogColumnConfiguration) => void; +}> = ({ logColumnConfiguration, dragHandleProps, onRemove }) => { + const removeColumn = useCallback(() => onRemove(logColumnConfiguration), [ + logColumnConfiguration, + onRemove, + ]); + + return ( + <> + + {isTimestampLogColumnConfiguration(logColumnConfiguration) ? ( + + ) : isMessageLogColumnConfiguration(logColumnConfiguration) ? ( + + ) : ( + + )} + ); }; -interface LogColumnConfigurationPanelProps { - logColumnConfigurationProps: LogColumnConfigurationProps; +interface LogColumnConfigurationPanelProps { + logColumnConfiguration: LogColumnConfigurationType; dragHandleProps: DragHandleProps; + onRemove: () => void; } -const LogColumnConfigurationPanel: React.FunctionComponent = ( - props -) => ( - <> - - {props.logColumnConfigurationProps.type === 'timestamp' ? ( - - ) : props.logColumnConfigurationProps.type === 'message' ? ( - - ) : ( - - )} - -); - -const TimestampLogColumnConfigurationPanel: React.FunctionComponent = ({ - logColumnConfigurationProps, - dragHandleProps, -}) => ( +const TimestampLogColumnConfigurationPanel: React.FunctionComponent< + LogColumnConfigurationPanelProps +> = ({ dragHandleProps, onRemove }) => ( } - removeColumn={logColumnConfigurationProps.remove} + onRemove={onRemove} dragHandleProps={dragHandleProps} /> ); -const MessageLogColumnConfigurationPanel: React.FunctionComponent = ({ - logColumnConfigurationProps, - dragHandleProps, -}) => ( +const MessageLogColumnConfigurationPanel: React.FunctionComponent< + LogColumnConfigurationPanelProps +> = ({ dragHandleProps, onRemove }) => ( } - removeColumn={logColumnConfigurationProps.remove} + onRemove={onRemove} dragHandleProps={dragHandleProps} /> ); -const FieldLogColumnConfigurationPanel: React.FunctionComponent<{ - logColumnConfigurationProps: FieldLogColumnConfigurationProps; - dragHandleProps: DragHandleProps; -}> = ({ - logColumnConfigurationProps: { - logColumnConfiguration: { field }, - remove, - }, +const FieldLogColumnConfigurationPanel: React.FunctionComponent< + LogColumnConfigurationPanelProps +> = ({ dragHandleProps, + logColumnConfiguration: { + fieldColumn: { field }, + }, + onRemove, }) => { - const fieldLogColumnTitle = i18n.translate( - 'xpack.infra.sourceConfiguration.fieldLogColumnTitle', - { - defaultMessage: 'Field', - } - ); return ( - +
@@ -195,7 +242,7 @@ const FieldLogColumnConfigurationPanel: React.FunctionComponent<{ @@ -207,11 +254,13 @@ const FieldLogColumnConfigurationPanel: React.FunctionComponent<{ const ExplainedLogColumnConfigurationPanel: React.FunctionComponent<{ fieldName: React.ReactNode; helpText: React.ReactNode; - removeColumn: () => void; + onRemove: () => void; dragHandleProps: DragHandleProps; -}> = ({ fieldName, helpText, removeColumn, dragHandleProps }) => ( +}> = ({ fieldName, helpText, onRemove, dragHandleProps }) => ( @@ -226,7 +275,7 @@ const ExplainedLogColumnConfigurationPanel: React.FunctionComponent<{ - + @@ -277,3 +326,7 @@ const LogColumnConfigurationEmptyPrompt: React.FunctionComponent = () => ( } /> ); + +const fieldLogColumnTitle = i18n.translate('xpack.infra.sourceConfiguration.fieldLogColumnTitle', { + defaultMessage: 'Field', +}); diff --git a/x-pack/plugins/infra/public/pages/logs/settings/name_configuration_form_state.tsx b/x-pack/plugins/infra/public/pages/logs/settings/name_configuration_form_state.tsx new file mode 100644 index 0000000000000..f97ece074c4a3 --- /dev/null +++ b/x-pack/plugins/infra/public/pages/logs/settings/name_configuration_form_state.tsx @@ -0,0 +1,19 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import { useMemo } from 'react'; +import { useFormElement } from './form_elements'; +import { FormValidationError, validateStringNotEmpty } from './validation_errors'; + +export const useNameFormElement = (initialValue: string) => { + const nameFormElement = useFormElement({ + initialValue, + validate: useMemo(() => async (name) => validateStringNotEmpty('name', name), []), + }); + + return nameFormElement; +}; diff --git a/x-pack/plugins/infra/public/pages/logs/settings/name_configuration_panel.tsx b/x-pack/plugins/infra/public/pages/logs/settings/name_configuration_panel.tsx new file mode 100644 index 0000000000000..54158b654fee3 --- /dev/null +++ b/x-pack/plugins/infra/public/pages/logs/settings/name_configuration_panel.tsx @@ -0,0 +1,69 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import { + EuiDescribedFormGroup, + EuiFieldText, + EuiForm, + EuiFormRow, + EuiSpacer, + EuiTitle, +} from '@elastic/eui'; +import { FormattedMessage } from '@kbn/i18n/react'; +import React, { useMemo } from 'react'; +import { FormElement } from './form_elements'; +import { getFormRowProps, getStringInputFieldProps } from './form_field_props'; +import { FormValidationError } from './validation_errors'; + +export const NameConfigurationPanel = React.memo<{ + isLoading: boolean; + isReadOnly: boolean; + nameFormElement: FormElement; +}>(({ isLoading, isReadOnly, nameFormElement }) => ( + + +

+ +

+
+ + + + + } + description={ + + } + > + + } + {...useMemo(() => getFormRowProps(nameFormElement), [nameFormElement])} + > + getStringInputFieldProps(nameFormElement), [nameFormElement])} + /> + + +
+)); diff --git a/x-pack/plugins/infra/public/pages/logs/settings/source_configuration_form_errors.tsx b/x-pack/plugins/infra/public/pages/logs/settings/source_configuration_form_errors.tsx new file mode 100644 index 0000000000000..af36a9dc0090b --- /dev/null +++ b/x-pack/plugins/infra/public/pages/logs/settings/source_configuration_form_errors.tsx @@ -0,0 +1,101 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import { EuiCallOut, EuiCode } from '@elastic/eui'; +import { i18n } from '@kbn/i18n'; +import { FormattedMessage } from '@kbn/i18n/react'; +import React from 'react'; +import { FormValidationError } from './validation_errors'; + +export const LogSourceConfigurationFormErrors: React.FC<{ errors: FormValidationError[] }> = ({ + errors, +}) => ( + +
    + {errors.map((error, errorIndex) => ( +
  • + +
  • + ))} +
+
+); + +export const LogSourceConfigurationFormError: React.FC<{ error: FormValidationError }> = ({ + error, +}) => { + if (error.type === 'generic') { + return <>{error.message}; + } else if (error.type === 'empty_field') { + return ( + + ); + } else if (error.type === 'empty_column_list') { + return ( + + ); + } else if (error.type === 'child') { + return ( + + ); + } else if (error.type === 'missing_timestamp_field') { + return ( + + ); + } else if (error.type === 'missing_message_field') { + return ( + message, + }} + /> + ); + } else if (error.type === 'invalid_message_field_type') { + return ( + message, + }} + /> + ); + } else if (error.type === 'rollup_index_pattern') { + return ( + + ); + } else { + return null; + } +}; + +const logSourceConfigurationFormErrorsCalloutTitle = i18n.translate( + 'xpack.infra.logSourceConfiguration.logSourceConfigurationFormErrorsCalloutTitle', + { + defaultMessage: 'Inconsistent source configuration', + } +); diff --git a/x-pack/plugins/infra/public/pages/logs/settings/source_configuration_form_state.tsx b/x-pack/plugins/infra/public/pages/logs/settings/source_configuration_form_state.tsx index 95c55b556ab86..67e790a98f518 100644 --- a/x-pack/plugins/infra/public/pages/logs/settings/source_configuration_form_state.tsx +++ b/x-pack/plugins/infra/public/pages/logs/settings/source_configuration_form_state.tsx @@ -5,103 +5,69 @@ * 2.0. */ -import { useCallback, useMemo } from 'react'; -import { ResolvedLogSourceConfiguration } from '../../../../common/log_sources'; -import { useLogIndicesConfigurationFormState } from './indices_configuration_form_state'; -import { useLogColumnsConfigurationFormState } from './log_columns_configuration_form_state'; +import { useMemo } from 'react'; +import { LogSourceConfigurationProperties } from '../../../containers/logs/log_source'; +import { useCompositeFormElement } from './form_elements'; +import { useFieldsFormElement, useLogIndicesFormElement } from './indices_configuration_form_state'; +import { useLogColumnsFormElement } from './log_columns_configuration_form_state'; +import { useNameFormElement } from './name_configuration_form_state'; export const useLogSourceConfigurationFormState = ( - configuration?: ResolvedLogSourceConfiguration + configuration?: LogSourceConfigurationProperties ) => { - const indicesConfigurationFormState = useLogIndicesConfigurationFormState({ - initialFormState: useMemo( - () => - configuration - ? { - name: configuration.name, - description: configuration.description, - logAlias: configuration.indices, - tiebreakerField: configuration.tiebreakerField, - timestampField: configuration.timestampField, - } - : undefined, - [configuration] - ), - }); + const nameFormElement = useNameFormElement(configuration?.name ?? ''); - const logColumnsConfigurationFormState = useLogColumnsConfigurationFormState({ - initialFormState: useMemo( + const logIndicesFormElement = useLogIndicesFormElement( + useMemo( () => - configuration - ? { - logColumns: configuration.columns, - } - : undefined, + configuration?.logIndices ?? { + type: 'index_name', + indexName: '', + }, [configuration] - ), - }); - - const errors = useMemo( - () => [...indicesConfigurationFormState.errors, ...logColumnsConfigurationFormState.errors], - [indicesConfigurationFormState.errors, logColumnsConfigurationFormState.errors] + ) ); - const resetForm = useCallback(() => { - indicesConfigurationFormState.resetForm(); - logColumnsConfigurationFormState.resetForm(); - }, [indicesConfigurationFormState, logColumnsConfigurationFormState]); - - const isFormDirty = useMemo( - () => indicesConfigurationFormState.isFormDirty || logColumnsConfigurationFormState.isFormDirty, - [indicesConfigurationFormState.isFormDirty, logColumnsConfigurationFormState.isFormDirty] - ); - - const isFormValid = useMemo( - () => indicesConfigurationFormState.isFormValid && logColumnsConfigurationFormState.isFormValid, - [indicesConfigurationFormState.isFormValid, logColumnsConfigurationFormState.isFormValid] + const { + fieldsFormElement, + tiebreakerFieldFormElement, + timestampFieldFormElement, + } = useFieldsFormElement( + useMemo( + () => ({ + tiebreakerField: configuration?.fields?.tiebreaker ?? '_doc', + timestampField: configuration?.fields?.timestamp ?? '@timestamp', + }), + [configuration] + ) ); - const formState = useMemo( - () => ({ - name: indicesConfigurationFormState.formState.name, - description: indicesConfigurationFormState.formState.description, - logAlias: indicesConfigurationFormState.formState.logAlias, - fields: { - tiebreaker: indicesConfigurationFormState.formState.tiebreakerField, - timestamp: indicesConfigurationFormState.formState.timestampField, - }, - logColumns: logColumnsConfigurationFormState.formState.logColumns, - }), - [indicesConfigurationFormState.formState, logColumnsConfigurationFormState.formState] + const logColumnsFormElement = useLogColumnsFormElement( + useMemo(() => configuration?.logColumns ?? [], [configuration]) ); - const formStateChanges = useMemo( - () => ({ - name: indicesConfigurationFormState.formStateChanges.name, - description: indicesConfigurationFormState.formStateChanges.description, - logAlias: indicesConfigurationFormState.formStateChanges.logAlias, - fields: { - tiebreaker: indicesConfigurationFormState.formStateChanges.tiebreakerField, - timestamp: indicesConfigurationFormState.formStateChanges.timestampField, - }, - logColumns: logColumnsConfigurationFormState.formStateChanges.logColumns, - }), - [ - indicesConfigurationFormState.formStateChanges, - logColumnsConfigurationFormState.formStateChanges, - ] + const sourceConfigurationFormElement = useCompositeFormElement( + useMemo( + () => ({ + childFormElements: { + name: nameFormElement, + logIndices: logIndicesFormElement, + fields: fieldsFormElement, + logColumns: logColumnsFormElement, + }, + validate: async () => [], + }), + [nameFormElement, logIndicesFormElement, fieldsFormElement, logColumnsFormElement] + ) ); return { - addLogColumn: logColumnsConfigurationFormState.addLogColumn, - moveLogColumn: logColumnsConfigurationFormState.moveLogColumn, - errors, - formState, - formStateChanges, - isFormDirty, - isFormValid, - indicesConfigurationProps: indicesConfigurationFormState.fieldProps, - logColumnConfigurationProps: logColumnsConfigurationFormState.logColumnConfigurationProps, - resetForm, + formState: sourceConfigurationFormElement.value, + logIndicesFormElement, + logColumnsFormElement, + nameFormElement, + sourceConfigurationFormElement, + tiebreakerFieldFormElement, + timestampFieldFormElement, }; }; diff --git a/x-pack/plugins/infra/public/pages/logs/settings/source_configuration_settings.tsx b/x-pack/plugins/infra/public/pages/logs/settings/source_configuration_settings.tsx index 2eaf4f61409a8..9ab7d38e6c838 100644 --- a/x-pack/plugins/infra/public/pages/logs/settings/source_configuration_settings.tsx +++ b/x-pack/plugins/infra/public/pages/logs/settings/source_configuration_settings.tsx @@ -7,33 +7,40 @@ import { EuiButton, - EuiCallOut, EuiErrorBoundary, EuiFlexGroup, EuiFlexItem, - EuiPanel, - EuiSpacer, EuiPage, EuiPageBody, + EuiPageContentBody, + EuiPanel, + EuiSpacer, } from '@elastic/eui'; import { i18n } from '@kbn/i18n'; import { FormattedMessage } from '@kbn/i18n/react'; import React, { useCallback, useMemo } from 'react'; import { useKibana } from '../../../../../../../src/plugins/kibana_react/public'; -import { FieldsConfigurationPanel } from './fields_configuration_panel'; +import { useTrackPageview } from '../../../../../observability/public'; +import { SourceLoadingPage } from '../../../components/source_loading_page'; +import { useLogSourceContext } from '../../../containers/logs/log_source'; +import { Prompt } from '../../../utils/navigation_warning_prompt'; import { IndicesConfigurationPanel } from './indices_configuration_panel'; -import { NameConfigurationPanel } from '../../../components/source_configuration/name_configuration_panel'; import { LogColumnsConfigurationPanel } from './log_columns_configuration_panel'; +import { NameConfigurationPanel } from './name_configuration_panel'; +import { LogSourceConfigurationFormErrors } from './source_configuration_form_errors'; import { useLogSourceConfigurationFormState } from './source_configuration_form_state'; -import { useLogSourceContext } from '../../../containers/logs/log_source'; -import { SourceLoadingPage } from '../../../components/source_loading_page'; -import { Prompt } from '../../../utils/navigation_warning_prompt'; -import { LogSourceConfigurationPropertiesPatch } from '../../../../common/http_api/log_sources'; export const LogsSettingsPage = () => { const uiCapabilities = useKibana().services.application?.capabilities; const shouldAllowEdit = uiCapabilities?.logs?.configureSource === true; + useTrackPageview({ app: 'infra_logs', path: 'log_source_configuration' }); + useTrackPageview({ + app: 'infra_logs', + path: 'log_source_configuration', + delay: 15000, + }); + const { sourceConfiguration: source, isLoading, @@ -48,35 +55,19 @@ export const LogsSettingsPage = () => { ); const { - addLogColumn, - moveLogColumn, - indicesConfigurationProps, - logColumnConfigurationProps, - errors, - resetForm, - isFormDirty, - isFormValid, - formStateChanges, - } = useLogSourceConfigurationFormState(resolvedSourceConfiguration); + sourceConfigurationFormElement, + formState, + logIndicesFormElement, + logColumnsFormElement, + nameFormElement, + tiebreakerFieldFormElement, + timestampFieldFormElement, + } = useLogSourceConfigurationFormState(source?.configuration); const persistUpdates = useCallback(async () => { - // NOTE / TODO: This is just a temporary workaround until this work is merged with the corresponding UI branch. - // Otherwise we would be duplicating work changing the logAlias etc references twice. - const patchedProperties: LogSourceConfigurationPropertiesPatch & { logAlias?: string } = { - ...formStateChanges, - ...(formStateChanges.logAlias - ? { - logIndices: { - type: 'index_name', - indexName: formStateChanges.logAlias, - }, - } - : {}), - }; - delete patchedProperties.logAlias; - await updateSourceConfiguration(patchedProperties); - resetForm(); - }, [updateSourceConfiguration, resetForm, formStateChanges]); + await updateSourceConfiguration(formState); + sourceConfigurationFormElement.resetValue(); + }, [updateSourceConfiguration, sourceConfigurationFormElement, formState]); const isWriteable = useMemo(() => shouldAllowEdit && source && source.origin !== 'internal', [ shouldAllowEdit, @@ -92,110 +83,100 @@ export const LogsSettingsPage = () => { return ( - - - - - - - - - - - - - + + + - - - - - - {errors.length > 0 ? ( - <> - -
    - {errors.map((error, errorIndex) => ( -
  • {error}
  • - ))} -
-
- - - ) : null} - - - {isWriteable && ( - - {isLoading ? ( - - - - Loading - - - - ) : ( - <> + + + + + + + + + + + + + {sourceConfigurationFormElement.validity.validity === 'invalid' ? ( + <> + + + + ) : null} + + {isWriteable && ( + + {isLoading ? ( - { - resetForm(); - }} - > - - - - - - + + Loading - - )} - - )} - + ) : ( + <> + + + { + sourceConfigurationFormElement.resetValue(); + }} + > + + + + + + + + + + + )} + + )} + +
diff --git a/x-pack/plugins/infra/public/pages/logs/settings/validation_errors.ts b/x-pack/plugins/infra/public/pages/logs/settings/validation_errors.ts new file mode 100644 index 0000000000000..b6e5a387590ed --- /dev/null +++ b/x-pack/plugins/infra/public/pages/logs/settings/validation_errors.ts @@ -0,0 +1,116 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import { IndexPattern, KBN_FIELD_TYPES } from '../../../../../../../src/plugins/data/public'; + +export interface GenericValidationError { + type: 'generic'; + message: string; +} + +export interface ChildFormValidationError { + type: 'child'; +} + +export interface EmptyFieldValidationError { + type: 'empty_field'; + fieldName: string; +} + +export interface EmptyColumnListValidationError { + type: 'empty_column_list'; +} + +export interface MissingTimestampFieldValidationError { + type: 'missing_timestamp_field'; + indexPatternTitle: string; +} + +export interface MissingMessageFieldValidationError { + type: 'missing_message_field'; + indexPatternTitle: string; +} + +export interface InvalidMessageFieldTypeValidationError { + type: 'invalid_message_field_type'; + indexPatternTitle: string; +} + +export interface RollupIndexPatternValidationError { + type: 'rollup_index_pattern'; + indexPatternTitle: string; +} + +export type FormValidationError = + | GenericValidationError + | ChildFormValidationError + | EmptyFieldValidationError + | EmptyColumnListValidationError + | MissingTimestampFieldValidationError + | MissingMessageFieldValidationError + | InvalidMessageFieldTypeValidationError + | RollupIndexPatternValidationError; + +export const validateStringNotEmpty = (fieldName: string, value: string): FormValidationError[] => + value === '' ? [{ type: 'empty_field', fieldName }] : []; + +export const validateColumnListNotEmpty = (columns: unknown[]): FormValidationError[] => + columns.length <= 0 ? [{ type: 'empty_column_list' }] : []; + +export const validateIndexPattern = (indexPattern: IndexPattern): FormValidationError[] => { + return [ + ...validateIndexPatternIsTimeBased(indexPattern), + ...validateIndexPatternHasStringMessageField(indexPattern), + ...validateIndexPatternIsntRollup(indexPattern), + ]; +}; + +export const validateIndexPatternIsTimeBased = ( + indexPattern: IndexPattern +): FormValidationError[] => + indexPattern.isTimeBased() + ? [] + : [ + { + type: 'missing_timestamp_field' as const, + indexPatternTitle: indexPattern.title, + }, + ]; + +export const validateIndexPatternHasStringMessageField = ( + indexPattern: IndexPattern +): FormValidationError[] => { + const messageField = indexPattern.getFieldByName('message'); + + if (messageField == null) { + return [ + { + type: 'missing_message_field' as const, + indexPatternTitle: indexPattern.title, + }, + ]; + } else if (messageField.type !== KBN_FIELD_TYPES.STRING) { + return [ + { + type: 'invalid_message_field_type' as const, + indexPatternTitle: indexPattern.title, + }, + ]; + } else { + return []; + } +}; + +export const validateIndexPatternIsntRollup = (indexPattern: IndexPattern): FormValidationError[] => + indexPattern.type != null + ? [ + { + type: 'rollup_index_pattern' as const, + indexPatternTitle: indexPattern.title, + }, + ] + : []; diff --git a/x-pack/plugins/infra/public/pages/metrics/index.tsx b/x-pack/plugins/infra/public/pages/metrics/index.tsx index 51cc4ca098483..b43d7640f6390 100644 --- a/x-pack/plugins/infra/public/pages/metrics/index.tsx +++ b/x-pack/plugins/infra/public/pages/metrics/index.tsx @@ -120,6 +120,7 @@ export const InfrastructurePage = ({ match }: RouteComponentProps) => { > + {/** !! Need to be kept in sync with the searchDeepLinks in x-pack/plugins/infra/public/plugin.ts */} { // mount callback should not use setup dependencies, get start dependencies instead @@ -82,6 +115,32 @@ export class Plugin implements InfraClientPluginClass { order: 8200, appRoute: '/app/metrics', category: DEFAULT_APP_CATEGORIES.observability, + meta: { + // !! Need to be kept in sync with the routes in x-pack/plugins/infra/public/pages/metrics/index.tsx + searchDeepLinks: [ + { + id: 'inventory', + title: i18n.translate('xpack.infra.homePage.inventoryTabTitle', { + defaultMessage: 'Inventory', + }), + path: '/inventory', + }, + { + id: 'metrics-explorer', + title: i18n.translate('xpack.infra.homePage.metricsExplorerTabTitle', { + defaultMessage: 'Metrics Explorer', + }), + path: '/explorer', + }, + { + id: 'settings', + title: i18n.translate('xpack.infra.homePage.settingsTabTitle', { + defaultMessage: 'Settings', + }), + path: '/settings', + }, + ], + }, mount: async (params: AppMountParameters) => { // mount callback should not use setup dependencies, get start dependencies instead const [coreStart, pluginsStart] = await core.getStartServices(); diff --git a/x-pack/plugins/infra/public/utils/logs_overview_fetches.test.ts b/x-pack/plugins/infra/public/utils/logs_overview_fetches.test.ts index 3d08d4fc270bc..8d51f54e3f55a 100644 --- a/x-pack/plugins/infra/public/utils/logs_overview_fetches.test.ts +++ b/x-pack/plugins/infra/public/utils/logs_overview_fetches.test.ts @@ -8,11 +8,12 @@ import { CoreStart } from 'kibana/public'; import { coreMock } from 'src/core/public/mocks'; import { dataPluginMock } from 'src/plugins/data/public/mocks'; -import { callFetchLogSourceStatusAPI } from '../containers/logs/log_source/api/fetch_log_source_status'; +import { createIndexPatternMock } from '../../common/dependency_mocks/index_patterns'; +import { GetLogSourceConfigurationSuccessResponsePayload } from '../../common/http_api/log_sources/get_log_source_configuration'; import { callFetchLogSourceConfigurationAPI } from '../containers/logs/log_source/api/fetch_log_source_configuration'; +import { callFetchLogSourceStatusAPI } from '../containers/logs/log_source/api/fetch_log_source_status'; import { InfraClientStartDeps, InfraClientStartExports } from '../types'; import { getLogsHasDataFetcher, getLogsOverviewDataFetcher } from './logs_overview_fetchers'; -import { GetLogSourceConfigurationSuccessResponsePayload } from '../../common/http_api/log_sources/get_log_source_configuration'; jest.mock('../containers/logs/log_source/api/fetch_log_source_status'); const mockedCallFetchLogSourceStatusAPI = callFetchLogSourceStatusAPI as jest.MockedFunction< @@ -41,6 +42,36 @@ function setup() { // const dataResponder = jest.fn(); + (data.indexPatterns.get as jest.Mock).mockResolvedValue( + createIndexPatternMock({ + id: 'test-index-pattern', + title: 'log-indices-*', + timeFieldName: '@timestamp', + fields: [ + { + name: 'event.dataset', + type: 'string', + esTypes: ['keyword'], + aggregatable: true, + searchable: true, + }, + { + name: 'runtime_field', + type: 'string', + runtimeField: { + type: 'keyword', + script: { + source: 'emit("runtime value")', + }, + }, + esTypes: ['keyword'], + aggregatable: true, + searchable: true, + }, + ], + }) + ); + (data.search.search as jest.Mock).mockReturnValue({ subscribe: (progress: Function, error: Function, finish: Function) => { progress(dataResponder()); @@ -114,7 +145,7 @@ describe('Logs UI Observability Homepage Functions', () => { configuration: { logIndices: { type: 'index_pattern', - indexPatternId: 'some-test-id', + indexPatternId: 'test-index-pattern', }, fields: { timestamp: '@timestamp', tiebreaker: '_doc' }, }, diff --git a/x-pack/plugins/infra/public/utils/source_configuration.ts b/x-pack/plugins/infra/public/utils/source_configuration.ts index a3e1741c7590b..ac8a331e86952 100644 --- a/x-pack/plugins/infra/public/utils/source_configuration.ts +++ b/x-pack/plugins/infra/public/utils/source_configuration.ts @@ -31,3 +31,15 @@ export const isTimestampLogColumnConfiguration = ( logColumnConfiguration: LogColumnConfiguration ): logColumnConfiguration is TimestampLogColumnConfiguration => logColumnConfiguration != null && 'timestampColumn' in logColumnConfiguration; + +export const getLogColumnConfigurationId = ( + logColumnConfiguration: LogColumnConfiguration +): string => { + if (isTimestampLogColumnConfiguration(logColumnConfiguration)) { + return logColumnConfiguration.timestampColumn.id; + } else if (isMessageLogColumnConfiguration(logColumnConfiguration)) { + return logColumnConfiguration.messageColumn.id; + } else { + return logColumnConfiguration.fieldColumn.id; + } +}; diff --git a/x-pack/plugins/infra/server/lib/adapters/log_entries/kibana_log_entries_adapter.ts b/x-pack/plugins/infra/server/lib/adapters/log_entries/kibana_log_entries_adapter.ts index 33df2b4d55d22..3aaa747b945a8 100644 --- a/x-pack/plugins/infra/server/lib/adapters/log_entries/kibana_log_entries_adapter.ts +++ b/x-pack/plugins/infra/server/lib/adapters/log_entries/kibana_log_entries_adapter.ts @@ -93,6 +93,7 @@ export class InfraKibanaLogEntriesAdapter implements LogEntriesAdapter { ], }, }, + runtime_mappings: resolvedLogSourceConfiguration.runtimeMappings, sort, ...highlightClause, ...searchAfterClause, @@ -182,6 +183,7 @@ export class InfraKibanaLogEntriesAdapter implements LogEntriesAdapter { ], }, }, + runtime_mappings: resolvedLogSourceConfiguration.runtimeMappings, size: 0, track_total_hits: false, }, diff --git a/x-pack/plugins/infra/server/lib/alerting/log_threshold/log_threshold_chart_preview.ts b/x-pack/plugins/infra/server/lib/alerting/log_threshold/log_threshold_chart_preview.ts index 0914fab00dbe2..321273c656216 100644 --- a/x-pack/plugins/infra/server/lib/alerting/log_threshold/log_threshold_chart_preview.ts +++ b/x-pack/plugins/infra/server/lib/alerting/log_threshold/log_threshold_chart_preview.ts @@ -36,9 +36,7 @@ export async function getChartPreviewData( alertParams: GetLogAlertsChartPreviewDataAlertParamsSubset, buckets: number ) { - const indexPattern = resolvedLogSourceConfiguration.indices; - const timestampField = resolvedLogSourceConfiguration.timestampField; - + const { indices, timestampField, runtimeMappings } = resolvedLogSourceConfiguration; const { groupBy, timeSize, timeUnit } = alertParams; const isGrouped = groupBy && groupBy.length > 0 ? true : false; @@ -51,8 +49,8 @@ export async function getChartPreviewData( const { rangeFilter } = buildFiltersFromCriteria(expandedAlertParams, timestampField); const query = isGrouped - ? getGroupedESQuery(expandedAlertParams, timestampField, indexPattern) - : getUngroupedESQuery(expandedAlertParams, timestampField, indexPattern); + ? getGroupedESQuery(expandedAlertParams, timestampField, indices, runtimeMappings) + : getUngroupedESQuery(expandedAlertParams, timestampField, indices, runtimeMappings); if (!query) { throw new Error('ES query could not be built from the provided alert params'); diff --git a/x-pack/plugins/infra/server/lib/alerting/log_threshold/log_threshold_executor.test.ts b/x-pack/plugins/infra/server/lib/alerting/log_threshold/log_threshold_executor.test.ts index d2533fb4d79bc..1c1edb3ea8328 100644 --- a/x-pack/plugins/infra/server/lib/alerting/log_threshold/log_threshold_executor.test.ts +++ b/x-pack/plugins/infra/server/lib/alerting/log_threshold/log_threshold_executor.test.ts @@ -24,6 +24,7 @@ import { GroupedSearchQueryResponse, } from '../../../../common/alerting/logs/log_threshold/types'; import { alertsMock } from '../../../../../alerting/server/mocks'; +import { estypes } from '@elastic/elasticsearch'; // Mocks // const numericField = { @@ -69,6 +70,16 @@ const baseAlertParams: Pick = { const TIMESTAMP_FIELD = '@timestamp'; const FILEBEAT_INDEX = 'filebeat-*'; +const runtimeMappings: estypes.RuntimeFields = { + runtime_field: { + type: 'keyword', + script: { + lang: 'painless', + source: 'emit("a runtime value")', + }, + }, +}; + describe('Log threshold executor', () => { describe('Comparators', () => { test('Correctly categorises positive comparators', () => { @@ -188,11 +199,16 @@ describe('Log threshold executor', () => { ...baseAlertParams, criteria: [...positiveCriteria, ...negativeCriteria], }; - const query = getUngroupedESQuery(alertParams, TIMESTAMP_FIELD, FILEBEAT_INDEX); + const query = getUngroupedESQuery( + alertParams, + TIMESTAMP_FIELD, + FILEBEAT_INDEX, + runtimeMappings + ); expect(query).toEqual({ index: 'filebeat-*', - allowNoIndices: true, - ignoreUnavailable: true, + allow_no_indices: true, + ignore_unavailable: true, body: { track_total_hits: true, query: { @@ -274,6 +290,15 @@ describe('Log threshold executor', () => { ], }, }, + runtime_mappings: { + runtime_field: { + type: 'keyword', + script: { + lang: 'painless', + source: 'emit("a runtime value")', + }, + }, + }, size: 0, }, }); @@ -285,11 +310,16 @@ describe('Log threshold executor', () => { groupBy: ['host.name'], criteria: [...positiveCriteria, ...negativeCriteria], }; - const query = getGroupedESQuery(alertParams, TIMESTAMP_FIELD, FILEBEAT_INDEX); + const query = getGroupedESQuery( + alertParams, + TIMESTAMP_FIELD, + FILEBEAT_INDEX, + runtimeMappings + ); expect(query).toEqual({ index: 'filebeat-*', - allowNoIndices: true, - ignoreUnavailable: true, + allow_no_indices: true, + ignore_unavailable: true, body: { query: { bool: { @@ -405,6 +435,15 @@ describe('Log threshold executor', () => { }, }, }, + runtime_mappings: { + runtime_field: { + type: 'keyword', + script: { + lang: 'painless', + source: 'emit("a runtime value")', + }, + }, + }, size: 0, }, }); diff --git a/x-pack/plugins/infra/server/lib/alerting/log_threshold/log_threshold_executor.ts b/x-pack/plugins/infra/server/lib/alerting/log_threshold/log_threshold_executor.ts index b81219b1afda2..3e910e5dfbf46 100644 --- a/x-pack/plugins/infra/server/lib/alerting/log_threshold/log_threshold_executor.ts +++ b/x-pack/plugins/infra/server/lib/alerting/log_threshold/log_threshold_executor.ts @@ -7,6 +7,7 @@ import { i18n } from '@kbn/i18n'; import { ElasticsearchClient } from 'kibana/server'; +import { estypes } from '@elastic/elasticsearch'; import { AlertExecutorOptions, AlertServices, @@ -73,15 +74,13 @@ export const createLogThresholdExecutor = (libs: InfraBackendLibs) => const { sources } = libs; const sourceConfiguration = await sources.getSourceConfiguration(savedObjectsClient, 'default'); - const resolvedLogSourceConfiguration = await resolveLogSourceConfiguration( + const { indices, timestampField, runtimeMappings } = await resolveLogSourceConfiguration( sourceConfiguration.configuration, await libs.framework.getIndexPatternsService( savedObjectsClient, scopedClusterClient.asCurrentUser ) ); - const indexPattern = resolvedLogSourceConfiguration.indices; - const timestampField = resolvedLogSourceConfiguration.timestampField; try { const validatedParams = decodeOrThrow(alertParamsRT)(params); @@ -90,7 +89,8 @@ export const createLogThresholdExecutor = (libs: InfraBackendLibs) => await executeAlert( validatedParams, timestampField, - indexPattern, + indices, + runtimeMappings, scopedClusterClient.asCurrentUser, alertInstanceFactory ); @@ -98,7 +98,8 @@ export const createLogThresholdExecutor = (libs: InfraBackendLibs) => await executeRatioAlert( validatedParams, timestampField, - indexPattern, + indices, + runtimeMappings, scopedClusterClient.asCurrentUser, alertInstanceFactory ); @@ -112,10 +113,11 @@ async function executeAlert( alertParams: CountAlertParams, timestampField: string, indexPattern: string, + runtimeMappings: estypes.RuntimeFields, esClient: ElasticsearchClient, alertInstanceFactory: LogThresholdAlertServices['alertInstanceFactory'] ) { - const query = getESQuery(alertParams, timestampField, indexPattern); + const query = getESQuery(alertParams, timestampField, indexPattern, runtimeMappings); if (!query) { throw new Error('ES query could not be built from the provided alert params'); @@ -142,6 +144,7 @@ async function executeRatioAlert( alertParams: RatioAlertParams, timestampField: string, indexPattern: string, + runtimeMappings: estypes.RuntimeFields, esClient: ElasticsearchClient, alertInstanceFactory: LogThresholdAlertServices['alertInstanceFactory'] ) { @@ -156,8 +159,13 @@ async function executeRatioAlert( criteria: getDenominator(alertParams.criteria), }; - const numeratorQuery = getESQuery(numeratorParams, timestampField, indexPattern); - const denominatorQuery = getESQuery(denominatorParams, timestampField, indexPattern); + const numeratorQuery = getESQuery(numeratorParams, timestampField, indexPattern, runtimeMappings); + const denominatorQuery = getESQuery( + denominatorParams, + timestampField, + indexPattern, + runtimeMappings + ); if (!numeratorQuery || !denominatorQuery) { throw new Error('ES query could not be built from the provided ratio alert params'); @@ -189,11 +197,12 @@ async function executeRatioAlert( const getESQuery = ( alertParams: Omit & { criteria: CountCriteria }, timestampField: string, - indexPattern: string + indexPattern: string, + runtimeMappings: estypes.RuntimeFields ) => { return hasGroupBy(alertParams) - ? getGroupedESQuery(alertParams, timestampField, indexPattern) - : getUngroupedESQuery(alertParams, timestampField, indexPattern); + ? getGroupedESQuery(alertParams, timestampField, indexPattern, runtimeMappings) + : getUngroupedESQuery(alertParams, timestampField, indexPattern, runtimeMappings); }; export const processUngroupedResults = ( @@ -423,8 +432,9 @@ export const buildFiltersFromCriteria = ( export const getGroupedESQuery = ( params: Pick & { criteria: CountCriteria }, timestampField: string, - index: string -): object | undefined => { + index: string, + runtimeMappings: estypes.RuntimeFields +): estypes.SearchRequest | undefined => { const { groupBy } = params; if (!groupBy || !groupBy.length) { @@ -460,20 +470,21 @@ export const getGroupedESQuery = ( }, }; - const body = { + const body: estypes.SearchRequest['body'] = { query: { bool: { filter: [groupedRangeFilter], }, }, aggregations, + runtime_mappings: runtimeMappings, size: 0, }; return { index, - allowNoIndices: true, - ignoreUnavailable: true, + allow_no_indices: true, + ignore_unavailable: true, body, }; }; @@ -481,14 +492,15 @@ export const getGroupedESQuery = ( export const getUngroupedESQuery = ( params: Pick & { criteria: CountCriteria }, timestampField: string, - index: string + index: string, + runtimeMappings: estypes.RuntimeFields ): object => { const { rangeFilter, mustFilters, mustNotFilters } = buildFiltersFromCriteria( params, timestampField ); - const body = { + const body: estypes.SearchRequest['body'] = { // Ensure we accurately track the hit count for the ungrouped case, otherwise we can only ensure accuracy up to 10,000. track_total_hits: true, query: { @@ -497,13 +509,14 @@ export const getUngroupedESQuery = ( ...(mustNotFilters.length > 0 && { must_not: mustNotFilters }), }, }, + runtime_mappings: runtimeMappings, size: 0, }; return { index, - allowNoIndices: true, - ignoreUnavailable: true, + allow_no_indices: true, + ignore_unavailable: true, body, }; }; diff --git a/x-pack/plugins/infra/server/lib/domains/log_entries_domain/log_entries_domain.ts b/x-pack/plugins/infra/server/lib/domains/log_entries_domain/log_entries_domain.ts index ea57885bcdfbb..387143ef9f9c4 100644 --- a/x-pack/plugins/infra/server/lib/domains/log_entries_domain/log_entries_domain.ts +++ b/x-pack/plugins/infra/server/lib/domains/log_entries_domain/log_entries_domain.ts @@ -5,6 +5,7 @@ * 2.0. */ +import type { estypes } from '@elastic/elasticsearch'; import { JsonObject } from '../../../../../../../src/plugins/kibana_utils/common'; import type { InfraPluginRequestHandlerContext } from '../../../types'; @@ -38,7 +39,6 @@ import { CompositeDatasetKey, createLogEntryDatasetsQuery, } from './queries/log_entry_datasets'; - export interface LogEntriesParams { startTimestamp: number; endTimestamp: number; @@ -276,7 +276,8 @@ export class InfraLogEntriesDomain { timestampField: string, indexName: string, startTime: number, - endTime: number + endTime: number, + runtimeMappings: estypes.RuntimeFields ) { let datasetBuckets: LogEntryDatasetBucket[] = []; let afterLatestBatchKey: CompositeDatasetKey | undefined; @@ -290,6 +291,7 @@ export class InfraLogEntriesDomain { timestampField, startTime, endTime, + runtimeMappings, COMPOSITE_AGGREGATION_BATCH_SIZE, afterLatestBatchKey ) diff --git a/x-pack/plugins/infra/server/lib/domains/log_entries_domain/queries/log_entry_datasets.ts b/x-pack/plugins/infra/server/lib/domains/log_entries_domain/queries/log_entry_datasets.ts index 172c30780202c..18e04aaf063d4 100644 --- a/x-pack/plugins/infra/server/lib/domains/log_entries_domain/queries/log_entry_datasets.ts +++ b/x-pack/plugins/infra/server/lib/domains/log_entries_domain/queries/log_entry_datasets.ts @@ -6,6 +6,7 @@ */ import * as rt from 'io-ts'; +import { estypes } from '@elastic/elasticsearch'; import { commonSearchSuccessResponseFieldsRT } from '../../../../utils/elasticsearch_runtime_types'; @@ -14,6 +15,7 @@ export const createLogEntryDatasetsQuery = ( timestampField: string, startTime: number, endTime: number, + runtimeMappings: estypes.RuntimeFields, size: number, afterKey?: CompositeDatasetKey ) => ({ @@ -38,6 +40,7 @@ export const createLogEntryDatasetsQuery = ( ], }, }, + runtime_mappings: runtimeMappings, aggs: { dataset_buckets: { composite: { diff --git a/x-pack/plugins/infra/server/lib/log_analysis/log_entry_anomalies.ts b/x-pack/plugins/infra/server/lib/log_analysis/log_entry_anomalies.ts index f5465a967f2a5..716ab400c0123 100644 --- a/x-pack/plugins/infra/server/lib/log_analysis/log_entry_anomalies.ts +++ b/x-pack/plugins/infra/server/lib/log_analysis/log_entry_anomalies.ts @@ -5,6 +5,7 @@ * 2.0. */ +import type { estypes } from '@elastic/elasticsearch'; import type { InfraPluginRequestHandlerContext, InfraRequestHandlerContext } from '../../types'; import { TracingSpan, startTracingSpan } from '../../../common/performance_tracing'; import { fetchMlJob, getLogEntryDatasets } from './common'; @@ -18,6 +19,7 @@ import { Pagination, isCategoryAnomaly, } from '../../../common/log_analysis'; +import type { ResolvedLogSourceConfiguration } from '../../../common/log_sources'; import type { MlSystem, MlAnomalyDetectors } from '../../types'; import { createLogEntryAnomaliesQuery, logEntryAnomaliesResponseRT } from './queries'; import { @@ -31,7 +33,6 @@ import { createLogEntryExamplesQuery, logEntryExamplesResponseRT, } from './queries/log_entry_examples'; -import { InfraSource } from '../sources'; import { KibanaFramework } from '../adapters/framework/kibana_framework_adapter'; import { fetchLogEntryCategories } from './log_entry_categories_analysis'; @@ -326,7 +327,7 @@ export async function getLogEntryExamples( endTime: number, dataset: string, exampleCount: number, - sourceConfiguration: InfraSource, + resolvedSourceConfiguration: ResolvedLogSourceConfiguration, callWithRequest: KibanaFramework['callWithRequest'], categoryId?: string ) { @@ -346,7 +347,7 @@ export async function getLogEntryExamples( const customSettings = decodeOrThrow(jobCustomSettingsRT)(mlJob.custom_settings); const indices = customSettings?.logs_source_config?.indexPattern; const timestampField = customSettings?.logs_source_config?.timestampField; - const tiebreakerField = sourceConfiguration.configuration.fields.tiebreaker; + const { tiebreakerField, runtimeMappings } = resolvedSourceConfiguration; if (indices == null || timestampField == null) { throw new InsufficientLogAnalysisMlJobConfigurationError( @@ -361,6 +362,7 @@ export async function getLogEntryExamples( context, sourceId, indices, + runtimeMappings, timestampField, tiebreakerField, startTime, @@ -385,6 +387,7 @@ export async function fetchLogEntryExamples( context: InfraPluginRequestHandlerContext & { infra: Required }, sourceId: string, indices: string, + runtimeMappings: estypes.RuntimeFields, timestampField: string, tiebreakerField: string, startTime: number, @@ -431,6 +434,7 @@ export async function fetchLogEntryExamples( 'search', createLogEntryExamplesQuery( indices, + runtimeMappings, timestampField, tiebreakerField, startTime, diff --git a/x-pack/plugins/infra/server/lib/log_analysis/log_entry_categories_analysis.ts b/x-pack/plugins/infra/server/lib/log_analysis/log_entry_categories_analysis.ts index 80061dac0a144..aea946ae87e74 100644 --- a/x-pack/plugins/infra/server/lib/log_analysis/log_entry_categories_analysis.ts +++ b/x-pack/plugins/infra/server/lib/log_analysis/log_entry_categories_analysis.ts @@ -5,6 +5,7 @@ * 2.0. */ +import type { estypes } from '@elastic/elasticsearch'; import type { ILegacyScopedClusterClient } from 'src/core/server'; import { compareDatasetsByMaximumAnomalyScore, @@ -14,6 +15,7 @@ import { CategoriesSort, } from '../../../common/log_analysis'; import { LogEntryContext } from '../../../common/log_entry'; +import type { ResolvedLogSourceConfiguration } from '../../../common/log_sources'; import { startTracingSpan } from '../../../common/performance_tracing'; import { decodeOrThrow } from '../../../common/runtime_types'; import type { MlAnomalyDetectors, MlSystem } from '../../types'; @@ -36,7 +38,6 @@ import { createTopLogEntryCategoriesQuery, topLogEntryCategoriesResponseRT, } from './queries/top_log_entry_categories'; -import { InfraSource } from '../sources'; import { fetchMlJob, getLogEntryDatasets } from './common'; export async function getTopLogEntryCategories( @@ -147,7 +148,7 @@ export async function getLogEntryCategoryExamples( endTime: number, categoryId: number, exampleCount: number, - sourceConfiguration: InfraSource + resolvedSourceConfiguration: ResolvedLogSourceConfiguration ) { const finalizeLogEntryCategoryExamplesSpan = startTracingSpan('get category example log entries'); @@ -165,7 +166,7 @@ export async function getLogEntryCategoryExamples( const customSettings = decodeOrThrow(jobCustomSettingsRT)(mlJob.custom_settings); const indices = customSettings?.logs_source_config?.indexPattern; const timestampField = customSettings?.logs_source_config?.timestampField; - const tiebreakerField = sourceConfiguration.configuration.fields.tiebreaker; + const { tiebreakerField, runtimeMappings } = resolvedSourceConfiguration; if (indices == null || timestampField == null) { throw new InsufficientLogAnalysisMlJobConfigurationError( @@ -189,6 +190,7 @@ export async function getLogEntryCategoryExamples( } = await fetchLogEntryCategoryExamples( context, indices, + runtimeMappings, timestampField, tiebreakerField, startTime, @@ -402,6 +404,7 @@ async function fetchTopLogEntryCategoryHistograms( async function fetchLogEntryCategoryExamples( requestContext: { core: { elasticsearch: { legacy: { client: ILegacyScopedClusterClient } } } }, indices: string, + runtimeMappings: estypes.RuntimeFields, timestampField: string, tiebreakerField: string, startTime: number, @@ -418,6 +421,7 @@ async function fetchLogEntryCategoryExamples( 'search', createLogEntryCategoryExamplesQuery( indices, + runtimeMappings, timestampField, tiebreakerField, startTime, diff --git a/x-pack/plugins/infra/server/lib/log_analysis/queries/log_entry_category_examples.ts b/x-pack/plugins/infra/server/lib/log_analysis/queries/log_entry_category_examples.ts index cbaad4be7ee18..f06dcd43a9156 100644 --- a/x-pack/plugins/infra/server/lib/log_analysis/queries/log_entry_category_examples.ts +++ b/x-pack/plugins/infra/server/lib/log_analysis/queries/log_entry_category_examples.ts @@ -5,20 +5,21 @@ * 2.0. */ +import type { estypes } from '@elastic/elasticsearch'; import * as rt from 'io-ts'; - import { commonSearchSuccessResponseFieldsRT } from '../../../utils/elasticsearch_runtime_types'; import { defaultRequestParameters } from './common'; export const createLogEntryCategoryExamplesQuery = ( indices: string, + runtimeMappings: estypes.RuntimeFields, timestampField: string, tiebreakerField: string, startTime: number, endTime: number, categoryQuery: string, exampleCount: number -) => ({ +): estypes.SearchRequest => ({ ...defaultRequestParameters, body: { query: { @@ -43,6 +44,7 @@ export const createLogEntryCategoryExamplesQuery = ( ], }, }, + runtime_mappings: runtimeMappings, sort: [{ [timestampField]: 'asc' }, { [tiebreakerField]: 'asc' }], _source: false, fields: ['event.dataset', 'message', 'container.id', 'host.name', 'log.file.path'], diff --git a/x-pack/plugins/infra/server/lib/log_analysis/queries/log_entry_examples.ts b/x-pack/plugins/infra/server/lib/log_analysis/queries/log_entry_examples.ts index fca9c470f510f..1e8cbe247dd50 100644 --- a/x-pack/plugins/infra/server/lib/log_analysis/queries/log_entry_examples.ts +++ b/x-pack/plugins/infra/server/lib/log_analysis/queries/log_entry_examples.ts @@ -5,14 +5,15 @@ * 2.0. */ +import type { estypes } from '@elastic/elasticsearch'; import * as rt from 'io-ts'; - +import { partitionField } from '../../../../common/log_analysis'; import { commonSearchSuccessResponseFieldsRT } from '../../../utils/elasticsearch_runtime_types'; import { defaultRequestParameters } from './common'; -import { partitionField } from '../../../../common/log_analysis'; export const createLogEntryExamplesQuery = ( indices: string, + runtimeMappings: estypes.RuntimeFields, timestampField: string, tiebreakerField: string, startTime: number, @@ -20,7 +21,7 @@ export const createLogEntryExamplesQuery = ( dataset: string, exampleCount: number, categoryQuery?: string -) => ({ +): estypes.SearchRequest => ({ ...defaultRequestParameters, body: { query: { @@ -61,7 +62,7 @@ export const createLogEntryExamplesQuery = ( match: { message: { query: categoryQuery, - operator: 'AND', + operator: 'AND' as const, }, }, }, @@ -70,6 +71,7 @@ export const createLogEntryExamplesQuery = ( ], }, }, + runtime_mappings: runtimeMappings, sort: [{ [timestampField]: 'asc' }, { [tiebreakerField]: 'asc' }], _source: false, fields: ['event.dataset', 'message'], diff --git a/x-pack/plugins/infra/server/routes/log_analysis/results/log_entry_category_examples.ts b/x-pack/plugins/infra/server/routes/log_analysis/results/log_entry_category_examples.ts index d53ef3f3acdad..71558f97cf2bc 100644 --- a/x-pack/plugins/infra/server/routes/log_analysis/results/log_entry_category_examples.ts +++ b/x-pack/plugins/infra/server/routes/log_analysis/results/log_entry_category_examples.ts @@ -16,6 +16,7 @@ import type { InfraBackendLibs } from '../../../lib/infra_types'; import { getLogEntryCategoryExamples } from '../../../lib/log_analysis'; import { assertHasInfraMlPlugins } from '../../../utils/request_context'; import { isMlPrivilegesError } from '../../../lib/log_analysis/errors'; +import { resolveLogSourceConfiguration } from '../../../../common/log_sources'; export const initGetLogEntryCategoryExamplesRoute = ({ framework, sources }: InfraBackendLibs) => { framework.registerRoute( @@ -40,6 +41,10 @@ export const initGetLogEntryCategoryExamplesRoute = ({ framework, sources }: Inf requestContext.core.savedObjects.client, sourceId ); + const resolvedSourceConfiguration = await resolveLogSourceConfiguration( + sourceConfiguration.configuration, + await framework.getIndexPatternsServiceWithRequestContext(requestContext) + ); try { assertHasInfraMlPlugins(requestContext); @@ -51,7 +56,7 @@ export const initGetLogEntryCategoryExamplesRoute = ({ framework, sources }: Inf endTime, categoryId, exampleCount, - sourceConfiguration + resolvedSourceConfiguration ); return response.ok({ diff --git a/x-pack/plugins/infra/server/routes/log_analysis/results/log_entry_examples.ts b/x-pack/plugins/infra/server/routes/log_analysis/results/log_entry_examples.ts index f4d50f242686e..83e6934d1b7a4 100644 --- a/x-pack/plugins/infra/server/routes/log_analysis/results/log_entry_examples.ts +++ b/x-pack/plugins/infra/server/routes/log_analysis/results/log_entry_examples.ts @@ -16,6 +16,7 @@ import { LOG_ANALYSIS_GET_LOG_ENTRY_RATE_EXAMPLES_PATH, } from '../../../../common/http_api/log_analysis'; import { isMlPrivilegesError } from '../../../lib/log_analysis/errors'; +import { resolveLogSourceConfiguration } from '../../../../common/log_sources'; export const initGetLogEntryExamplesRoute = ({ framework, sources }: InfraBackendLibs) => { framework.registerRoute( @@ -41,6 +42,10 @@ export const initGetLogEntryExamplesRoute = ({ framework, sources }: InfraBacken requestContext.core.savedObjects.client, sourceId ); + const resolvedSourceConfiguration = await resolveLogSourceConfiguration( + sourceConfiguration.configuration, + await framework.getIndexPatternsServiceWithRequestContext(requestContext) + ); try { assertHasInfraMlPlugins(requestContext); @@ -52,7 +57,7 @@ export const initGetLogEntryExamplesRoute = ({ framework, sources }: InfraBacken endTime, dataset, exampleCount, - sourceConfiguration, + resolvedSourceConfiguration, framework.callWithRequest, categoryId ); diff --git a/x-pack/plugins/infra/server/routes/log_analysis/validation/datasets.ts b/x-pack/plugins/infra/server/routes/log_analysis/validation/datasets.ts index 61a426ab40f0a..950ecc98619ee 100644 --- a/x-pack/plugins/infra/server/routes/log_analysis/validation/datasets.ts +++ b/x-pack/plugins/infra/server/routes/log_analysis/validation/datasets.ts @@ -6,6 +6,7 @@ */ import Boom from '@hapi/boom'; +import type { estypes } from '@elastic/elasticsearch'; import { InfraBackendLibs } from '../../../lib/infra_types'; import { @@ -31,7 +32,7 @@ export const initValidateLogAnalysisDatasetsRoute = ({ framework.router.handleLegacyErrors(async (requestContext, request, response) => { try { const { - data: { indices, timestampField, startTime, endTime }, + data: { indices, timestampField, startTime, endTime, runtimeMappings }, } = request.body; const datasets = await Promise.all( @@ -41,7 +42,8 @@ export const initValidateLogAnalysisDatasetsRoute = ({ timestampField, indexName, startTime, - endTime + endTime, + runtimeMappings as estypes.RuntimeFields ); return { diff --git a/x-pack/plugins/infra/server/routes/log_analysis/validation/indices.ts b/x-pack/plugins/infra/server/routes/log_analysis/validation/indices.ts index 463ac77891263..4fd7096db06eb 100644 --- a/x-pack/plugins/infra/server/routes/log_analysis/validation/indices.ts +++ b/x-pack/plugins/infra/server/routes/log_analysis/validation/indices.ts @@ -36,7 +36,7 @@ export const initValidateLogAnalysisIndicesRoute = ({ framework }: InfraBackendL fold(throwErrors(Boom.badRequest), identity) ); - const { fields, indices } = payload.data; + const { fields, indices, runtimeMappings } = payload.data; const errors: ValidationIndicesError[] = []; // Query each pattern individually, to map correctly the errors @@ -47,6 +47,9 @@ export const initValidateLogAnalysisIndicesRoute = ({ framework }: InfraBackendL fields: fields.map((field) => field.name), ignore_unavailable: true, index, + body: { + runtime_mappings: runtimeMappings, + }, }); if (fieldCaps.indices.length === 0) { diff --git a/x-pack/plugins/infra/server/services/log_entries/log_entries_search_strategy.test.ts b/x-pack/plugins/infra/server/services/log_entries/log_entries_search_strategy.test.ts index 7c7417d038e2e..3cda019359caf 100644 --- a/x-pack/plugins/infra/server/services/log_entries/log_entries_search_strategy.test.ts +++ b/x-pack/plugins/infra/server/services/log_entries/log_entries_search_strategy.test.ts @@ -19,13 +19,16 @@ import { SearchStrategyDependencies, } from 'src/plugins/data/server'; import { createSearchSessionsClientMock } from '../../../../../../src/plugins/data/server/search/mocks'; +import { + createIndexPatternMock, + createIndexPatternsStartMock, +} from '../../../common/dependency_mocks/index_patterns'; import { InfraSource } from '../../lib/sources'; import { createInfraSourcesMock } from '../../lib/sources/mocks'; import { logEntriesSearchRequestStateRT, logEntriesSearchStrategyProvider, } from './log_entries_search_strategy'; -import { getIndexPatternsMock } from './mocks'; describe('LogEntries search strategy', () => { it('handles initial search requests', async () => { @@ -72,6 +75,15 @@ describe('LogEntries search strategy', () => { index: 'log-indices-*', body: expect.objectContaining({ fields: expect.arrayContaining(['event.dataset', 'message']), + runtime_mappings: { + runtime_field: { + type: 'keyword', + script: { + lang: 'painless', + source: 'emit("runtime value")', + }, + }, + }, }), }), }), @@ -258,7 +270,7 @@ const createSourceConfigurationMock = (): InfraSource => ({ description: 'SOURCE_DESCRIPTION', logIndices: { type: 'index_pattern', - indexPatternId: 'some-test-id', + indexPatternId: 'test-index-pattern', }, metricAlias: 'metric-indices-*', inventoryDefaultView: 'DEFAULT_VIEW', @@ -323,5 +335,33 @@ const createDataPluginMock = (esSearchStrategyMock: ISearchStrategy): any => ({ search: { getSearchStrategy: jest.fn().mockReturnValue(esSearchStrategyMock), }, - indexPatterns: getIndexPatternsMock(), + indexPatterns: createIndexPatternsStartMock(0, [ + createIndexPatternMock({ + id: 'test-index-pattern', + title: 'log-indices-*', + timeFieldName: '@timestamp', + fields: [ + { + name: 'event.dataset', + type: 'string', + esTypes: ['keyword'], + aggregatable: true, + searchable: true, + }, + { + name: 'runtime_field', + type: 'string', + runtimeField: { + type: 'keyword', + script: { + source: 'emit("runtime value")', + }, + }, + esTypes: ['keyword'], + aggregatable: true, + searchable: true, + }, + ], + }), + ]), }); diff --git a/x-pack/plugins/infra/server/services/log_entries/log_entries_search_strategy.ts b/x-pack/plugins/infra/server/services/log_entries/log_entries_search_strategy.ts index fc5dab9006df6..c47a1c163f9ec 100644 --- a/x-pack/plugins/infra/server/services/log_entries/log_entries_search_strategy.ts +++ b/x-pack/plugins/infra/server/services/log_entries/log_entries_search_strategy.ts @@ -109,7 +109,7 @@ export const logEntriesSearchStrategyProvider = ({ forkJoin([resolvedSourceConfiguration$, messageFormattingRules$]).pipe( map( ([ - { indices, timestampField, tiebreakerField, columns }, + { indices, timestampField, tiebreakerField, columns, runtimeMappings }, messageFormattingRules, ]): IEsSearchRequest => { return { @@ -123,6 +123,7 @@ export const logEntriesSearchStrategyProvider = ({ timestampField, tiebreakerField, getRequiredFields(params.columns ?? columns, messageFormattingRules), + runtimeMappings, params.query, params.highlightPhrase ), diff --git a/x-pack/plugins/infra/server/services/log_entries/log_entry_search_strategy.test.ts b/x-pack/plugins/infra/server/services/log_entries/log_entry_search_strategy.test.ts index 785a4414a984c..f220c8913a2e6 100644 --- a/x-pack/plugins/infra/server/services/log_entries/log_entry_search_strategy.test.ts +++ b/x-pack/plugins/infra/server/services/log_entries/log_entry_search_strategy.test.ts @@ -18,14 +18,17 @@ import { ISearchStrategy, SearchStrategyDependencies, } from 'src/plugins/data/server'; -import { getIndexPatternsMock } from './mocks'; +import { createSearchSessionsClientMock } from '../../../../../../src/plugins/data/server/search/mocks'; +import { + createIndexPatternMock, + createIndexPatternsStartMock, +} from '../../../common/dependency_mocks/index_patterns'; +import { InfraSource } from '../../../common/source_configuration/source_configuration'; import { createInfraSourcesMock } from '../../lib/sources/mocks'; import { logEntrySearchRequestStateRT, logEntrySearchStrategyProvider, } from './log_entry_search_strategy'; -import { createSearchSessionsClientMock } from '../../../../../../src/plugins/data/server/search/mocks'; -import { InfraSource } from '../../../common/source_configuration/source_configuration'; describe('LogEntry search strategy', () => { it('handles initial search requests', async () => { @@ -61,7 +64,33 @@ describe('LogEntry search strategy', () => { .toPromise(); expect(sourcesMock.getSourceConfiguration).toHaveBeenCalled(); - expect(esSearchStrategyMock.search).toHaveBeenCalled(); + expect(esSearchStrategyMock.search).toHaveBeenCalledWith( + { + params: expect.objectContaining({ + index: 'log-indices-*', + body: expect.objectContaining({ + query: { + ids: { + values: ['LOG_ENTRY_ID'], + }, + }, + runtime_mappings: { + runtime_field: { + type: 'keyword', + script: { + lang: 'painless', + source: 'emit("runtime value")', + }, + }, + }, + }), + terminate_after: 1, + track_total_hits: false, + }), + }, + expect.anything(), + expect.anything() + ); expect(response.id).toEqual(expect.any(String)); expect(response.isRunning).toBe(true); }); @@ -207,7 +236,7 @@ const createSourceConfigurationMock = (): InfraSource => ({ description: 'SOURCE_DESCRIPTION', logIndices: { type: 'index_pattern', - indexPatternId: 'some-test-id', + indexPatternId: 'test-index-pattern', }, metricAlias: 'metric-indices-*', inventoryDefaultView: 'DEFAULT_VIEW', @@ -261,5 +290,33 @@ const createDataPluginMock = (esSearchStrategyMock: ISearchStrategy): any => ({ search: { getSearchStrategy: jest.fn().mockReturnValue(esSearchStrategyMock), }, - indexPatterns: getIndexPatternsMock(), + indexPatterns: createIndexPatternsStartMock(0, [ + createIndexPatternMock({ + id: 'test-index-pattern', + title: 'log-indices-*', + timeFieldName: '@timestamp', + fields: [ + { + name: 'event.dataset', + type: 'string', + esTypes: ['keyword'], + aggregatable: true, + searchable: true, + }, + { + name: 'runtime_field', + type: 'string', + runtimeField: { + type: 'keyword', + script: { + source: 'emit("runtime value")', + }, + }, + esTypes: ['keyword'], + aggregatable: true, + searchable: true, + }, + ], + }), + ]), }); diff --git a/x-pack/plugins/infra/server/services/log_entries/log_entry_search_strategy.ts b/x-pack/plugins/infra/server/services/log_entries/log_entry_search_strategy.ts index c35c05d947da0..aa34204b9fb44 100644 --- a/x-pack/plugins/infra/server/services/log_entries/log_entry_search_strategy.ts +++ b/x-pack/plugins/infra/server/services/log_entries/log_entry_search_strategy.ts @@ -78,13 +78,19 @@ export const logEntrySearchStrategyProvider = ({ concatMap(({ params }) => resolvedSourceConfiguration$.pipe( map( - ({ indices, timestampField, tiebreakerField }): IEsSearchRequest => ({ + ({ + indices, + timestampField, + tiebreakerField, + runtimeMappings, + }): IEsSearchRequest => ({ // @ts-expect-error @elastic/elasticsearch declares indices_boost as Record params: createGetLogEntryQuery( indices, params.logEntryId, timestampField, - tiebreakerField + tiebreakerField, + runtimeMappings ), }) ) diff --git a/x-pack/plugins/infra/server/services/log_entries/mocks.ts b/x-pack/plugins/infra/server/services/log_entries/mocks.ts deleted file mode 100644 index 7c508b98554ec..0000000000000 --- a/x-pack/plugins/infra/server/services/log_entries/mocks.ts +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. - */ - -import { IIndexPattern, IFieldType, IndexPatternsContract } from 'src/plugins/data/common'; - -const indexPatternFields: IFieldType[] = [ - { - name: 'event.dataset', - type: 'string', - esTypes: ['keyword'], - aggregatable: true, - filterable: true, - searchable: true, - }, -]; - -const indexPattern: IIndexPattern = { - id: '1234', - title: 'log-indices-*', - timeFieldName: '@timestamp', - fields: indexPatternFields, -}; - -export const getIndexPatternsMock = (): any => { - return { - indexPatternsServiceFactory: async () => { - return { - get: async (id) => indexPattern, - getFieldsForWildcard: async (options) => indexPatternFields, - } as Pick; - }, - }; -}; diff --git a/x-pack/plugins/infra/server/services/log_entries/queries/log_entries.ts b/x-pack/plugins/infra/server/services/log_entries/queries/log_entries.ts index 6ae7232d77a17..6df17dbfd7bfd 100644 --- a/x-pack/plugins/infra/server/services/log_entries/queries/log_entries.ts +++ b/x-pack/plugins/infra/server/services/log_entries/queries/log_entries.ts @@ -29,6 +29,7 @@ export const createGetLogEntriesQuery = ( timestampField: string, tiebreakerField: string, fields: string[], + runtimeMappings?: estypes.RuntimeFields, query?: JsonObject, highlightTerm?: string ): estypes.AsyncSearchSubmitRequest => { @@ -53,6 +54,7 @@ export const createGetLogEntriesQuery = ( }, // @ts-expect-error @elastic/elasticsearch doesn't declare body.fields on AsyncSearchSubmitRequest fields, + runtime_mappings: runtimeMappings, _source: false, ...createSortClause(sortDirection, timestampField, tiebreakerField), ...createSearchAfterClause(cursor), diff --git a/x-pack/plugins/infra/server/services/log_entries/queries/log_entry.ts b/x-pack/plugins/infra/server/services/log_entries/queries/log_entry.ts index 85af8b92fe080..6bef317d96ada 100644 --- a/x-pack/plugins/infra/server/services/log_entries/queries/log_entry.ts +++ b/x-pack/plugins/infra/server/services/log_entries/queries/log_entry.ts @@ -17,7 +17,8 @@ export const createGetLogEntryQuery = ( logEntryIndex: string, logEntryId: string, timestampField: string, - tiebreakerField: string + tiebreakerField: string, + runtimeMappings?: estypes.RuntimeFields ): estypes.AsyncSearchSubmitRequest => ({ index: logEntryIndex, terminate_after: 1, @@ -32,6 +33,7 @@ export const createGetLogEntryQuery = ( }, // @ts-expect-error @elastic/elasticsearch doesn't declare body.fields on AsyncSearchSubmitRequest fields: ['*'], + runtime_mappings: runtimeMappings, sort: [{ [timestampField]: 'desc' }, { [tiebreakerField]: 'desc' }], _source: false, }, diff --git a/x-pack/plugins/lens/jest.config.js b/x-pack/plugins/lens/jest.config.js index 9a3f12e1ead32..615e540eaedce 100644 --- a/x-pack/plugins/lens/jest.config.js +++ b/x-pack/plugins/lens/jest.config.js @@ -9,7 +9,4 @@ module.exports = { preset: '@kbn/test', rootDir: '../../..', roots: ['/x-pack/plugins/lens'], - - // TODO: migrate to "jest-environment-jsdom" https://github.com/elastic/kibana/issues/95202 - testEnvironment: 'jest-environment-jsdom-thirteen', }; diff --git a/x-pack/plugins/lens/public/editor_frame_service/editor_frame/config_panel/config_panel.scss b/x-pack/plugins/lens/public/editor_frame_service/editor_frame/config_panel/config_panel.scss index a58b5c21e7724..6629b44075831 100644 --- a/x-pack/plugins/lens/public/editor_frame_service/editor_frame/config_panel/config_panel.scss +++ b/x-pack/plugins/lens/public/editor_frame_service/editor_frame/config_panel/config_panel.scss @@ -1,7 +1,14 @@ +.lnsConfigPanel__addLayerBtnWrapper { + padding-bottom: $euiSize; +} + .lnsConfigPanel__addLayerBtn { - color: transparentize($euiColorMediumShade, .3); - // Remove EuiButton's default shadow to make button more subtle - // sass-lint:disable-block no-important - box-shadow: none !important; - border-color: $euiColorLightShade; + @include kbnThemeStyle('v7') { + // sass-lint:disable-block no-important + background-color: transparent !important; + color: transparentize($euiColorMediumShade, .3) !important; + border-color: $euiColorLightShade !important; + box-shadow: none !important; + } + } diff --git a/x-pack/plugins/lens/public/editor_frame_service/editor_frame/config_panel/config_panel.tsx b/x-pack/plugins/lens/public/editor_frame_service/editor_frame/config_panel/config_panel.tsx index 393c7363dc03f..d52fd29e7233a 100644 --- a/x-pack/plugins/lens/public/editor_frame_service/editor_frame/config_panel/config_panel.tsx +++ b/x-pack/plugins/lens/public/editor_frame_service/editor_frame/config_panel/config_panel.tsx @@ -134,7 +134,7 @@ export function LayerPanels( ) : null )} {activeVisualization.appendLayer && visualizationState && ( - + { const id = generateId(); dispatch({ diff --git a/x-pack/plugins/lens/public/editor_frame_service/editor_frame/suggestion_panel.scss b/x-pack/plugins/lens/public/editor_frame_service/editor_frame/suggestion_panel.scss index b3e6f68b0a68c..b9f233d2b2950 100644 --- a/x-pack/plugins/lens/public/editor_frame_service/editor_frame/suggestion_panel.scss +++ b/x-pack/plugins/lens/public/editor_frame_service/editor_frame/suggestion_panel.scss @@ -27,6 +27,7 @@ margin-right: $euiSizeS; margin-left: $euiSizeXS / 2; margin-bottom: $euiSizeXS / 2; + box-shadow: none !important; // sass-lint:disable-line no-important &:focus { @include euiFocusRing; @@ -40,7 +41,7 @@ .lnsSuggestionPanel__button-isSelected { background-color: $euiColorLightestShade !important; // sass-lint:disable-line no-important - border-color: $euiColorMediumShade; + border-color: $euiColorMediumShade !important; // sass-lint:disable-line no-important &:not(:focus) { box-shadow: none !important; // sass-lint:disable-line no-important diff --git a/x-pack/plugins/lens/public/editor_frame_service/editor_frame/suggestion_panel.tsx b/x-pack/plugins/lens/public/editor_frame_service/editor_frame/suggestion_panel.tsx index 9284b1dcc273d..e5acd2a2f47fd 100644 --- a/x-pack/plugins/lens/public/editor_frame_service/editor_frame/suggestion_panel.tsx +++ b/x-pack/plugins/lens/public/editor_frame_service/editor_frame/suggestion_panel.tsx @@ -130,6 +130,8 @@ const SuggestionPreview = ({
(

{longMessage} @@ -465,7 +465,7 @@ export const InnerVisualizationWrapper = ({ actions={showExtraErrorsAction} body={ <> -

+

{localState.configurationValidationError[0].longMessage}

@@ -507,7 +507,7 @@ export const InnerVisualizationWrapper = ({ } body={ <> -

+

{ - const visibleErrorMessage = getOriginalRequestErrorMessage(error) || errorMessage; + const visibleErrorMessages = getOriginalRequestErrorMessages(error) || [errorMessage]; return ( { setLocalState((prevState: WorkspaceState) => ({ @@ -594,9 +594,13 @@ export const InnerVisualizationWrapper = ({ />

- {localState.expandError ? ( -

{visibleErrorMessage}

- ) : null} + {localState.expandError + ? visibleErrorMessages.map((visibleErrorMessage) => ( +

+ {visibleErrorMessage} +

+ )) + : null} } iconColor="danger" diff --git a/x-pack/plugins/lens/public/editor_frame_service/editor_frame/workspace_panel/workspace_panel_wrapper.scss b/x-pack/plugins/lens/public/editor_frame_service/editor_frame/workspace_panel/workspace_panel_wrapper.scss index 167c17ee6ae9c..e687e478cd368 100644 --- a/x-pack/plugins/lens/public/editor_frame_service/editor_frame/workspace_panel/workspace_panel_wrapper.scss +++ b/x-pack/plugins/lens/public/editor_frame_service/editor_frame/workspace_panel/workspace_panel_wrapper.scss @@ -12,6 +12,9 @@ overflow: visible; border: none; height: 100%; + @include kbnThemeStyle('v7') { + border: none !important; // sass-lint:disable-line no-important + } .lnsWorkspacePanelWrapper__pageContentBody { @include euiScrollBar; @@ -34,7 +37,7 @@ width: 100%; height: 100%; border: $euiBorderThin; - border-radius: $euiBorderRadius; + border-radius: $euiBorderRadiusSmall; &.lnsDragDrop-isDropTarget { @include lnsDroppable; diff --git a/x-pack/plugins/lens/public/editor_frame_service/embeddable/expression_wrapper.tsx b/x-pack/plugins/lens/public/editor_frame_service/embeddable/expression_wrapper.tsx index c749ded2af31e..f4d0c85ecbbce 100644 --- a/x-pack/plugins/lens/public/editor_frame_service/embeddable/expression_wrapper.tsx +++ b/x-pack/plugins/lens/public/editor_frame_service/embeddable/expression_wrapper.tsx @@ -17,7 +17,7 @@ import { import { ExecutionContextSearch } from 'src/plugins/data/public'; import { DefaultInspectorAdapters, RenderMode } from 'src/plugins/expressions'; import classNames from 'classnames'; -import { getOriginalRequestErrorMessage } from '../error_helper'; +import { getOriginalRequestErrorMessages } from '../error_helper'; import { ErrorMessage } from '../types'; export interface ExpressionWrapperProps { @@ -130,9 +130,9 @@ export function ExpressionWrapper({ - - {getOriginalRequestErrorMessage(error) || errorMessage} - + {(getOriginalRequestErrorMessages(error) || [errorMessage]).map((message) => ( + {message} + ))}
diff --git a/x-pack/plugins/lens/public/editor_frame_service/error_helper.test.ts b/x-pack/plugins/lens/public/editor_frame_service/error_helper.test.ts new file mode 100644 index 0000000000000..41974149b9c03 --- /dev/null +++ b/x-pack/plugins/lens/public/editor_frame_service/error_helper.test.ts @@ -0,0 +1,179 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import { getOriginalRequestErrorMessages } from './error_helper'; + +const runtimeFieldError = { + stack: 'Error: EsError\n...', + message: '[lens_merge_tables] > [esaggs] > EsError', + name: 'Error', + original: { + name: 'Error', + message: 'Something', + err: { + message: 'status_exception', + statusCode: 400, + attributes: { + type: 'status_exception', + reason: 'error while executing search', + caused_by: { + type: 'search_phase_execution_exception', + reason: 'all shards failed', + phase: 'query', + grouped: true, + failed_shards: [ + { + shard: 0, + index: 'indexpattern_source', + node: 'jtqB1-UhQluyjeXIpQFqAA', + reason: { + type: 'script_exception', + reason: 'runtime error', + script_stack: [ + 'java.base/java.lang.NumberFormatException.forInputString(NumberFormatException.java:68)', + 'java.base/java.lang.Integer.parseInt(Integer.java:652)', + 'java.base/java.lang.Integer.parseInt(Integer.java:770)', + "emit(Integer.parseInt('hello'))", + ' ^---- HERE', + ], + script: "emit(Integer.parseInt('hello'))", + lang: 'painless', + position: { offset: 12, start: 0, end: 31 }, + caused_by: { type: 'number_format_exception', reason: 'For input string: "hello"' }, + }, + }, + ], + }, + }, + }, + attributes: { + type: 'status_exception', + reason: 'error while executing search', + caused_by: { + type: 'search_phase_execution_exception', + reason: 'all shards failed', + phase: 'query', + grouped: true, + failed_shards: [ + { + shard: 0, + index: 'indexpattern_source', + node: 'jtqB1-UhQluyjeXIpQFqAA', + reason: { + type: 'script_exception', + reason: 'runtime error', + script_stack: [ + 'java.base/java.lang.NumberFormatException.forInputString(NumberFormatException.java:68)', + 'java.base/java.lang.Integer.parseInt(Integer.java:652)', + 'java.base/java.lang.Integer.parseInt(Integer.java:770)', + "emit(Integer.parseInt('hello'))", + ' ^---- HERE', + ], + script: "emit(Integer.parseInt('hello'))", + lang: 'painless', + position: { offset: 12, start: 0, end: 31 }, + caused_by: { type: 'number_format_exception', reason: 'For input string: "hello"' }, + }, + }, + ], + }, + }, + }, +}; + +const scriptedFieldError = { + stack: 'Error: EsError\n...', + message: '[lens_merge_tables] > [esaggs] > EsError', + name: 'Error', + original: { + name: 'Error', + message: 'Some description', + err: { + message: 'status_exception', + statusCode: 500, + attributes: { + type: 'status_exception', + reason: 'error while executing search', + caused_by: { + type: 'search_phase_execution_exception', + reason: 'all shards failed', + phase: 'query', + grouped: true, + failed_shards: [ + { + shard: 0, + index: 'indexpattern_source', + node: 'jtqB1-UhQluyjeXIpQFqAA', + reason: { + type: 'aggregation_execution_exception', + reason: 'Unsupported script value [hello], expected a number, date, or boolean', + }, + }, + ], + }, + }, + }, + attributes: { + type: 'status_exception', + reason: 'error while executing search', + caused_by: { + type: 'search_phase_execution_exception', + reason: 'all shards failed', + phase: 'query', + grouped: true, + failed_shards: [ + { + shard: 0, + index: 'indexpattern_source', + node: 'jtqB1-UhQluyjeXIpQFqAA', + reason: { + type: 'aggregation_execution_exception', + reason: 'Unsupported script value [hello], expected a number, date, or boolean', + }, + }, + ], + }, + }, + }, +}; + +// EsAggs will report an internal error when user attempts to use a runtime field on an indexpattern he has no access to +const indexpatternAccessError = { + stack: "TypeError: Cannot read property 'values' of undefined\n", + message: "[lens_merge_tables] > [esaggs] > Cannot read property 'values' of undefined", + name: 'TypeError', + original: { + message: "[lens_merge_tables] > [esaggs] > Cannot read property 'values' of undefined", + stack: "[lens_merge_tables] > [esaggs] > Cannot read property 'values' of undefined", + }, +}; + +describe('lens_error_helpers', () => { + describe('getOriginalRequestErrorMessages', () => { + it('should report no errors if not parsable', () => { + expect(getOriginalRequestErrorMessages(null)).toEqual([]); + }); + + it('should report an error for a runtime field error', () => { + expect(getOriginalRequestErrorMessages(runtimeFieldError)).toEqual([ + 'Request error: number_format_exception, For input string: "hello" in "emit(Integer.parseInt(\'hello\'))" (Painless script)', + ]); + }); + + it('should report an error for a scripted field error', () => { + expect(getOriginalRequestErrorMessages(scriptedFieldError)).toEqual([ + 'Request error: aggregation_execution_exception, Unsupported script value [hello], expected a number, date, or boolean in Painless script', + ]); + }); + + it('should report the original es aggs error for runtime fields for indexpattern not accessible', () => { + expect(getOriginalRequestErrorMessages(indexpatternAccessError as Error)).toEqual([ + indexpatternAccessError.message, + ]); + }); + }); +}); diff --git a/x-pack/plugins/lens/public/editor_frame_service/error_helper.ts b/x-pack/plugins/lens/public/editor_frame_service/error_helper.ts index 67ebd6355de41..42470e5cb6162 100644 --- a/x-pack/plugins/lens/public/editor_frame_service/error_helper.ts +++ b/x-pack/plugins/lens/public/editor_frame_service/error_helper.ts @@ -6,17 +6,26 @@ */ import { i18n } from '@kbn/i18n'; +import { isEqual, uniqWith } from 'lodash'; +import { ExpressionRenderError } from '../../../../../src/plugins/expressions/public'; +import { isEsError } from '../../../../../src/plugins/data/public'; +import type { IEsError, Reason } from '../../../../../src/plugins/data/public'; -import { ExpressionRenderError } from 'src/plugins/expressions/public'; +type ErrorCause = Required['attributes']; -interface ElasticsearchErrorClause { +interface RequestError extends Error { + body?: { attributes?: { error: { caused_by: ErrorCause } } }; +} + +interface ReasonDescription { type: string; reason: string; - caused_by?: ElasticsearchErrorClause; + context?: ReasonDescription; } -interface RequestError extends Error { - body?: { attributes?: { error: ElasticsearchErrorClause } }; +interface EsAggError { + message: string; + stack: string; } const isRequestError = (e: Error | RequestError): e is RequestError => { @@ -26,54 +35,104 @@ const isRequestError = (e: Error | RequestError): e is RequestError => { return false; }; -interface ESError extends Error { - attributes?: { caused_by?: ElasticsearchErrorClause }; -} - -const isEsError = (e: Error | ESError): e is ESError => { - if ('attributes' in e) { - return e.attributes?.caused_by?.caused_by !== undefined; - } - return false; +// what happens for runtime field used on indexpatterns not accessible to the user? +// they will throw on the kibana side as data will be undefined +const isEsAggError = (e: Error | EsAggError): e is EsAggError => { + return 'message' in e && 'stack' in e && !isRequestError(e as Error) && !isEsError(e); }; -function getNestedErrorClause({ +function getNestedErrorClauseWithContext({ type, reason, caused_by: causedBy, -}: ElasticsearchErrorClause): { type: string; reason: string } { + lang, + script, +}: Reason): ReasonDescription[] { + if (!causedBy) { + // scripted fields error has changed with no particular hint about painless in it, + // so it tries to lookup in the message for the script word + if (/script/.test(reason)) { + return [{ type, reason, context: { type: 'Painless script', reason: '' } }]; + } + return [{ type, reason }]; + } + const [payload] = getNestedErrorClause(causedBy); + if (lang === 'painless') { + return [ + { + ...payload, + context: { type: 'Painless script', reason: `"${script}"` || reason }, + }, + ]; + } + return [{ ...payload, context: { type, reason } }]; +} + +function getNestedErrorClause(e: ErrorCause | Reason): ReasonDescription[] { + const { type, reason, caused_by: causedBy } = e; + // Painless scripts errors are nested within the failed_shards property + if ('failed_shards' in e) { + if (e.failed_shards) { + return e.failed_shards.flatMap((shardCause) => + getNestedErrorClauseWithContext(shardCause.reason) + ); + } + } if (causedBy) { return getNestedErrorClause(causedBy); } - return { type, reason }; + return [{ type, reason }]; } -function getErrorSource(e: Error | RequestError | ESError) { +function getErrorSources(e: Error) { if (isRequestError(e)) { - return e.body!.attributes!.error; + return getNestedErrorClause(e.body!.attributes!.error as ErrorCause); } if (isEsError(e)) { - return e.attributes!.caused_by; + if (e.attributes?.reason) { + return getNestedErrorClause(e.attributes); + } + return getNestedErrorClause(e.attributes?.caused_by as ErrorCause); } + return []; } -export function getOriginalRequestErrorMessage(error?: ExpressionRenderError | null) { +export function getOriginalRequestErrorMessages(error?: ExpressionRenderError | null): string[] { + const errorMessages = []; if (error && 'original' in error && error.original) { - const errorSource = getErrorSource(error.original); - if (errorSource == null) { - return; - } - const rootError = getNestedErrorClause(errorSource); - if (rootError.reason && rootError.type) { - return i18n.translate('xpack.lens.editorFrame.expressionFailureMessage', { - defaultMessage: 'Request error: {type}, {reason}', - values: { - reason: rootError.reason, - type: rootError.type, - }, - }); + if (isEsAggError(error.original)) { + errorMessages.push(error.message); + } else { + const rootErrors = uniqWith(getErrorSources(error.original), isEqual); + for (const rootError of rootErrors) { + if (rootError.context) { + errorMessages.push( + i18n.translate('xpack.lens.editorFrame.expressionFailureMessageWithContext', { + defaultMessage: 'Request error: {type}, {reason} in {context}', + values: { + reason: rootError.reason, + type: rootError.type, + context: rootError.context.reason + ? `${rootError.context.reason} (${rootError.context.type})` + : rootError.context.type, + }, + }) + ); + } else { + errorMessages.push( + i18n.translate('xpack.lens.editorFrame.expressionFailureMessage', { + defaultMessage: 'Request error: {type}, {reason}', + values: { + reason: rootError.reason, + type: rootError.type, + }, + }) + ); + } + } } } + return errorMessages; } export function getMissingVisualizationTypeError() { diff --git a/x-pack/plugins/lens/public/indexpattern_datasource/datapanel.test.tsx b/x-pack/plugins/lens/public/indexpattern_datasource/datapanel.test.tsx index e6a38ce2bb713..6c5116436dddb 100644 --- a/x-pack/plugins/lens/public/indexpattern_datasource/datapanel.test.tsx +++ b/x-pack/plugins/lens/public/indexpattern_datasource/datapanel.test.tsx @@ -9,6 +9,7 @@ import React, { ChangeEvent, ReactElement } from 'react'; import { createMockedDragDropContext } from './mocks'; import { dataPluginMock } from '../../../../../src/plugins/data/public/mocks'; import { InnerIndexPatternDataPanel, IndexPatternDataPanel, MemoizedDataPanel } from './datapanel'; +import { FieldList } from './field_list'; import { FieldItem } from './field_item'; import { NoFieldsCallout } from './no_fields_callout'; import { act } from 'react-dom/test-utils'; @@ -713,6 +714,30 @@ describe('IndexPattern Data Panel', () => { expect(wrapper.find(NoFieldsCallout).length).toEqual(2); }); + it('should not allow field details when error', () => { + const wrapper = mountWithIntl( + + ); + + expect(wrapper.find(FieldList).prop('fieldGroups')).toEqual( + expect.objectContaining({ + AvailableFields: expect.objectContaining({ hideDetails: true }), + }) + ); + }); + + it('should allow field details when timeout', () => { + const wrapper = mountWithIntl( + + ); + + expect(wrapper.find(FieldList).prop('fieldGroups')).toEqual( + expect.objectContaining({ + AvailableFields: expect.objectContaining({ hideDetails: false }), + }) + ); + }); + it('should filter down by name', () => { const wrapper = mountWithIntl(); act(() => { diff --git a/x-pack/plugins/lens/public/indexpattern_datasource/datapanel.tsx b/x-pack/plugins/lens/public/indexpattern_datasource/datapanel.tsx index 1b7c8d64de36e..9fd389d4e65d3 100644 --- a/x-pack/plugins/lens/public/indexpattern_datasource/datapanel.tsx +++ b/x-pack/plugins/lens/public/indexpattern_datasource/datapanel.tsx @@ -230,6 +230,7 @@ export function IndexPatternDataPanel({ onUpdateIndexPattern={onUpdateIndexPattern} existingFields={state.existingFields} existenceFetchFailed={state.existenceFetchFailed} + existenceFetchTimeout={state.existenceFetchTimeout} dropOntoWorkspace={dropOntoWorkspace} hasSuggestionForField={hasSuggestionForField} /> @@ -271,6 +272,7 @@ export const InnerIndexPatternDataPanel = function InnerIndexPatternDataPanel({ indexPatternRefs, indexPatterns, existenceFetchFailed, + existenceFetchTimeout, query, dateRange, filters, @@ -297,6 +299,7 @@ export const InnerIndexPatternDataPanel = function InnerIndexPatternDataPanel({ charts: ChartsPluginSetup; indexPatternFieldEditor: IndexPatternFieldEditorStart; existenceFetchFailed?: boolean; + existenceFetchTimeout?: boolean; }) { const [localState, setLocalState] = useState({ nameFilter: '', @@ -314,7 +317,8 @@ export const InnerIndexPatternDataPanel = function InnerIndexPatternDataPanel({ (type) => type in fieldTypeNames ); - const fieldInfoUnavailable = existenceFetchFailed || currentIndexPattern.hasRestrictions; + const fieldInfoUnavailable = + existenceFetchFailed || existenceFetchTimeout || currentIndexPattern.hasRestrictions; const editPermission = indexPatternFieldEditor.userPermissions.editIndexPattern(); @@ -389,7 +393,8 @@ export const InnerIndexPatternDataPanel = function InnerIndexPatternDataPanel({ }), isAffectedByGlobalFilter: !!filters.length, isAffectedByTimeFilter: true, - hideDetails: fieldInfoUnavailable, + // Show details on timeout but not failure + hideDetails: fieldInfoUnavailable && !existenceFetchTimeout, defaultNoFieldsMessage: i18n.translate('xpack.lens.indexPatterns.noAvailableDataLabel', { defaultMessage: `There are no available fields that contain data.`, }), @@ -438,11 +443,12 @@ export const InnerIndexPatternDataPanel = function InnerIndexPatternDataPanel({ return fieldGroupDefinitions; }, [ allFields, - existingFields, - currentIndexPattern, hasSyncedExistingFields, fieldInfoUnavailable, filters.length, + existenceFetchTimeout, + currentIndexPattern, + existingFields, ]); const fieldGroups: FieldGroups = useMemo(() => { @@ -794,6 +800,7 @@ export const InnerIndexPatternDataPanel = function InnerIndexPatternDataPanel({ filter={filter} currentIndexPatternId={currentIndexPatternId} existenceFetchFailed={existenceFetchFailed} + existenceFetchTimeout={existenceFetchTimeout} existFieldsInIndex={!!allFields.length} dropOntoWorkspace={dropOntoWorkspace} hasSuggestionForField={hasSuggestionForField} diff --git a/x-pack/plugins/lens/public/indexpattern_datasource/dimension_panel/droppable/on_drop_handler.ts b/x-pack/plugins/lens/public/indexpattern_datasource/dimension_panel/droppable/on_drop_handler.ts index 17b5cbc661ca3..f0ad797a81b9f 100644 --- a/x-pack/plugins/lens/public/indexpattern_datasource/dimension_panel/droppable/on_drop_handler.ts +++ b/x-pack/plugins/lens/public/indexpattern_datasource/dimension_panel/droppable/on_drop_handler.ts @@ -238,6 +238,7 @@ function onMoveIncompatible( field: sourceField, visualizationGroups: dimensionGroups, targetGroup: groupId, + shouldResetLabel: true, }); trackUiEvent('drop_onto_dimension'); @@ -289,6 +290,7 @@ function onSwapIncompatible({ op: newOperationForSource, field: sourceField, visualizationGroups: dimensionGroups, + shouldResetLabel: true, }), columnId: droppedItem.columnId, indexPattern, @@ -296,6 +298,7 @@ function onSwapIncompatible({ field: targetField, visualizationGroups: dimensionGroups, targetGroup: droppedItem.groupId, + shouldResetLabel: true, }); trackUiEvent('drop_onto_dimension'); diff --git a/x-pack/plugins/lens/public/indexpattern_datasource/dimension_panel/filtering.tsx b/x-pack/plugins/lens/public/indexpattern_datasource/dimension_panel/filtering.tsx index ae7406e42746a..65bc23b4eb1ca 100644 --- a/x-pack/plugins/lens/public/indexpattern_datasource/dimension_panel/filtering.tsx +++ b/x-pack/plugins/lens/public/indexpattern_datasource/dimension_panel/filtering.tsx @@ -75,10 +75,10 @@ export function Filtering({ anchorClassName="eui-fullWidth" panelClassName="lnsIndexPatternDimensionEditor__filtersEditor" button={ - + {/* Empty for spacing */} - + + + { + updateLayer(setFilter(columnId, layer, undefined)); + }} + iconType="cross" + /> + } @@ -112,19 +125,6 @@ export function Filtering({ />
- - { - updateLayer(setFilter(columnId, layer, undefined)); - }} - iconType="cross" - /> -
); diff --git a/x-pack/plugins/lens/public/indexpattern_datasource/field_item.scss b/x-pack/plugins/lens/public/indexpattern_datasource/field_item.scss index 19f5b91975202..a652a18752949 100644 --- a/x-pack/plugins/lens/public/indexpattern_datasource/field_item.scss +++ b/x-pack/plugins/lens/public/indexpattern_datasource/field_item.scss @@ -17,8 +17,14 @@ &:focus, &:focus-within, + .kbnFieldButton__button:focus:focus-visible, &.kbnFieldButton-isActive { - animation: none !important; // sass-lint:disable-line no-important + @include kbnThemeStyle('v7') { + animation: none !important; // sass-lint:disable-line no-important + } + @include kbnThemeStyle('v8') { + outline: none !important; // sass-lint:disable-line no-important + } } &:focus .kbnFieldButton__name span, diff --git a/x-pack/plugins/lens/public/indexpattern_datasource/field_list.tsx b/x-pack/plugins/lens/public/indexpattern_datasource/field_list.tsx index ceeb1f5b1caf3..ee0011ad0390c 100644 --- a/x-pack/plugins/lens/public/indexpattern_datasource/field_list.tsx +++ b/x-pack/plugins/lens/public/indexpattern_datasource/field_list.tsx @@ -45,6 +45,7 @@ export const FieldList = React.memo(function FieldList({ exists, fieldGroups, existenceFetchFailed, + existenceFetchTimeout, fieldProps, hasSyncedExistingFields, filter, @@ -60,6 +61,7 @@ export const FieldList = React.memo(function FieldList({ fieldProps: FieldItemSharedProps; hasSyncedExistingFields: boolean; existenceFetchFailed?: boolean; + existenceFetchTimeout?: boolean; filter: { nameFilter: string; typeFilter: string[]; @@ -194,6 +196,7 @@ export const FieldList = React.memo(function FieldList({ ); }} showExistenceFetchError={existenceFetchFailed} + showExistenceFetchTimeout={existenceFetchTimeout} renderCallout={ boolean; showExistenceFetchError?: boolean; + showExistenceFetchTimeout?: boolean; hideDetails?: boolean; groupIndex: number; dropOntoWorkspace: DatasourceDataPanelProps['dropOntoWorkspace']; @@ -73,6 +74,7 @@ export const FieldsAccordion = memo(function InnerFieldsAccordion({ exists, hideDetails, showExistenceFetchError, + showExistenceFetchTimeout, groupIndex, dropOntoWorkspace, hasSuggestionForField, @@ -133,25 +135,44 @@ export const FieldsAccordion = memo(function InnerFieldsAccordion({ }, [label, helpTooltip]); const extraAction = useMemo(() => { - return showExistenceFetchError ? ( - - ) : hasLoaded ? ( - - {fieldsCount} - - ) : ( - - ); - }, [showExistenceFetchError, hasLoaded, isFiltered, fieldsCount]); + if (showExistenceFetchError) { + return ( + + ); + } + if (showExistenceFetchTimeout) { + return ( + + ); + } + if (hasLoaded) { + return ( + + {fieldsCount} + + ); + } + + return ; + }, [showExistenceFetchError, showExistenceFetchTimeout, hasLoaded, isFiltered, fieldsCount]); return ( { foo: 'bar', isFirstExistenceFetch: false, existenceFetchFailed: false, + existenceFetchTimeout: false, existingFields: { '1': { ip1_field_1: true, ip1_field_2: true }, '2': { ip2_field_1: true, ip2_field_2: true }, @@ -957,6 +959,56 @@ describe('loader', () => { }) as IndexPatternPrivateState; expect(newState.existenceFetchFailed).toEqual(true); + expect(newState.existenceFetchTimeout).toEqual(false); + expect(newState.existingFields['1']).toEqual({ + field1: true, + field2: true, + }); + }); + + it('should set all fields to available and existence error flag if the request times out', async () => { + const setState = jest.fn(); + const fetchJson = (jest.fn((path: string) => { + return new Promise((resolve, reject) => { + reject( + new HttpFetchError( + 'timeout', + 'name', + ({} as unknown) as Request, + ({ status: 408 } as unknown) as Response + ) + ); + }); + }) as unknown) as HttpHandler; + + const args = { + dateRange: { fromDate: '1900-01-01', toDate: '2000-01-01' }, + fetchJson, + indexPatterns: [ + { + id: '1', + title: '1', + hasRestrictions: false, + fields: [{ name: 'field1' }, { name: 'field2' }] as IndexPatternField[], + }, + ], + setState, + dslQuery, + showNoDataPopover: jest.fn(), + currentIndexPatternTitle: 'abc', + isFirstExistenceFetch: false, + }; + + await syncExistingFields(args); + + const [fn] = setState.mock.calls[0]; + const newState = fn({ + foo: 'bar', + existingFields: {}, + }) as IndexPatternPrivateState; + + expect(newState.existenceFetchFailed).toEqual(false); + expect(newState.existenceFetchTimeout).toEqual(true); expect(newState.existingFields['1']).toEqual({ field1: true, field2: true, diff --git a/x-pack/plugins/lens/public/indexpattern_datasource/loader.ts b/x-pack/plugins/lens/public/indexpattern_datasource/loader.ts index ec7ef6a37a27a..0eb661e92bb1d 100644 --- a/x-pack/plugins/lens/public/indexpattern_datasource/loader.ts +++ b/x-pack/plugins/lens/public/indexpattern_datasource/loader.ts @@ -445,16 +445,18 @@ export async function syncExistingFields({ ...state, isFirstExistenceFetch: false, existenceFetchFailed: false, + existenceFetchTimeout: false, existingFields: emptinessInfo.reduce((acc, info) => { acc[info.indexPatternTitle] = booleanMap(info.existingFieldNames); return acc; }, state.existingFields), })); } catch (e) { - // show all fields as available if fetch failed + // show all fields as available if fetch failed or timed out setState((state) => ({ ...state, - existenceFetchFailed: true, + existenceFetchFailed: e.res?.status !== 408, + existenceFetchTimeout: e.res?.status === 408, existingFields: indexPatterns.reduce((acc, pattern) => { acc[pattern.title] = booleanMap(pattern.fields.map((field) => field.name)); return acc; diff --git a/x-pack/plugins/lens/public/indexpattern_datasource/operations/definitions/shared_components/buckets.tsx b/x-pack/plugins/lens/public/indexpattern_datasource/operations/definitions/shared_components/buckets.tsx index 38666185eda0e..b2cfc0e5a7c2c 100644 --- a/x-pack/plugins/lens/public/indexpattern_datasource/operations/definitions/shared_components/buckets.tsx +++ b/x-pack/plugins/lens/public/indexpattern_datasource/operations/definitions/shared_components/buckets.tsx @@ -51,7 +51,7 @@ const BucketContainer = ({ isNotRemovable, }: BucketContainerProps) => { return ( - + {/* Empty for spacing */} diff --git a/x-pack/plugins/lens/public/indexpattern_datasource/operations/layer_helpers.test.ts b/x-pack/plugins/lens/public/indexpattern_datasource/operations/layer_helpers.test.ts index d3ca70c086cb5..c506e800d6d01 100644 --- a/x-pack/plugins/lens/public/indexpattern_datasource/operations/layer_helpers.test.ts +++ b/x-pack/plugins/lens/public/indexpattern_datasource/operations/layer_helpers.test.ts @@ -538,6 +538,41 @@ describe('state_helpers', () => { ); }); }); + + it('should not carry over a label if shouldResetLabel is set', () => { + expect( + insertNewColumn({ + layer: { + indexPatternId: '1', + columnOrder: ['col1'], + columns: { + col1: { + label: 'Date histogram of timestamp', + dataType: 'date', + isBucketed: true, + + // Private + operationType: 'date_histogram', + sourceField: 'timestamp', + params: { + interval: 'h', + }, + }, + }, + }, + columnId: 'col2', + indexPattern, + op: 'terms', + field: indexPattern.fields[2], + visualizationGroups: [], + shouldResetLabel: true, + }).columns.col2 + ).toEqual( + expect.objectContaining({ + label: 'Top values of bytes', + }) + ); + }); }); describe('replaceColumn', () => { @@ -779,76 +814,109 @@ describe('state_helpers', () => { ); }); - it('should carry over label on field switch when customLabel flag is set', () => { - expect( - replaceColumn({ - layer: { - indexPatternId: '1', - columnOrder: ['col1'], - columns: { - col1: { - label: 'My custom label', - customLabel: true, - dataType: 'date', - isBucketed: true, - - // Private - operationType: 'date_histogram', - sourceField: 'timestamp', - params: { - interval: 'h', + describe('labels', () => { + it('should carry over label on field switch when customLabel flag on previousColumn is set', () => { + expect( + replaceColumn({ + layer: { + indexPatternId: '1', + columnOrder: ['col1'], + columns: { + col1: { + label: 'My custom label', + customLabel: true, + dataType: 'date', + isBucketed: true, + + // Private + operationType: 'date_histogram', + sourceField: 'timestamp', + params: { + interval: 'h', + }, }, }, }, - }, - indexPattern, - columnId: 'col1', - op: 'date_histogram', - field: indexPattern.fields[1], - visualizationGroups: [], - }).columns.col1 - ).toEqual( - expect.objectContaining({ - label: 'My custom label', - customLabel: true, - }) - ); - }); + indexPattern, + columnId: 'col1', + op: 'date_histogram', + field: indexPattern.fields[1], + visualizationGroups: [], + }).columns.col1 + ).toEqual( + expect.objectContaining({ + label: 'My custom label', + customLabel: true, + }) + ); + }); - it('should carry over label on operation switch when customLabel flag is set', () => { - expect( - replaceColumn({ - layer: { - indexPatternId: '1', - columnOrder: ['col1'], - columns: { - col1: { - label: 'My custom label', - customLabel: true, - dataType: 'date', - isBucketed: true, + it('should carry over label on operation switch when customLabel flag on previousColumn is set', () => { + expect( + replaceColumn({ + layer: { + indexPatternId: '1', + columnOrder: ['col1'], + columns: { + col1: { + label: 'My custom label', + customLabel: true, + dataType: 'date', + isBucketed: true, + + // Private + operationType: 'date_histogram', + sourceField: 'timestamp', + params: { + interval: 'h', + }, + }, + }, + }, + indexPattern, + columnId: 'col1', + op: 'terms', + field: indexPattern.fields[0], + visualizationGroups: [], + }).columns.col1 + ).toEqual( + expect.objectContaining({ + label: 'My custom label', + customLabel: true, + }) + ); + }); - // Private - operationType: 'date_histogram', - sourceField: 'timestamp', - params: { - interval: 'h', + it('should not carry over a label if shouldResetLabel is set', () => { + expect( + replaceColumn({ + layer: { + indexPatternId: '1', + columnOrder: ['col1', 'col2'], + columns: { + col1: { + label: 'Top values of source', + dataType: 'string', + isBucketed: true, + operationType: 'terms', + sourceField: 'source', + params: { + orderBy: { type: 'alphabetical' }, + orderDirection: 'asc', + size: 5, + }, }, }, }, - }, - indexPattern, - columnId: 'col1', - op: 'terms', - field: indexPattern.fields[0], - visualizationGroups: [], - }).columns.col1 - ).toEqual( - expect.objectContaining({ - label: 'My custom label', - customLabel: true, - }) - ); + indexPattern, + columnId: 'col1', + op: 'average', + field: indexPattern.fields[2], // bytes field + visualizationGroups: [], + shouldResetLabel: true, + }).columns.col1 + ).toEqual(expect.objectContaining({ label: 'Average of bytes' })); + }); }); it('should execute adjustments for other columns', () => { diff --git a/x-pack/plugins/lens/public/indexpattern_datasource/operations/layer_helpers.ts b/x-pack/plugins/lens/public/indexpattern_datasource/operations/layer_helpers.ts index bbe2ca4cd3d61..35f334d5bd743 100644 --- a/x-pack/plugins/lens/public/indexpattern_datasource/operations/layer_helpers.ts +++ b/x-pack/plugins/lens/public/indexpattern_datasource/operations/layer_helpers.ts @@ -27,6 +27,7 @@ interface ColumnChange { field?: IndexPatternField; visualizationGroups: VisualizationDimensionGroupConfig[]; targetGroup?: string; + shouldResetLabel?: boolean; } export function insertOrReplaceColumn(args: ColumnChange): IndexPatternLayer { @@ -46,6 +47,7 @@ export function insertNewColumn({ indexPattern, visualizationGroups, targetGroup, + shouldResetLabel, }: ColumnChange): IndexPatternLayer { const operationDefinition = operationDefinitionMap[op]; @@ -208,16 +210,12 @@ export function insertNewColumn({ }, }; } + + const newColumn = operationDefinition.buildColumn({ ...baseOptions, layer, field }); const isBucketed = Boolean(possibleOperation.isBucketed); const addOperationFn = isBucketed ? addBucket : addMetric; return updateDefaultLabels( - addOperationFn( - layer, - operationDefinition.buildColumn({ ...baseOptions, layer, field }), - columnId, - visualizationGroups, - targetGroup - ), + addOperationFn(layer, newColumn, columnId, visualizationGroups, targetGroup), indexPattern ); } @@ -229,6 +227,7 @@ export function replaceColumn({ op, field, visualizationGroups, + shouldResetLabel, }: ColumnChange): IndexPatternLayer { const previousColumn = layer.columns[columnId]; if (!previousColumn) { @@ -366,9 +365,11 @@ export function replaceColumn({ }, }; } - let newColumn = operationDefinition.buildColumn({ ...baseOptions, layer: tempLayer, field }); - newColumn = copyCustomLabel(newColumn, previousColumn); + let newColumn = operationDefinition.buildColumn({ ...baseOptions, layer: tempLayer, field }); + if (!shouldResetLabel) { + newColumn = copyCustomLabel(newColumn, previousColumn); + } const newLayer = { ...tempLayer, columns: { ...tempLayer.columns, [columnId]: newColumn } }; return updateDefaultLabels( { @@ -385,10 +386,10 @@ export function replaceColumn({ previousColumn.sourceField !== field.name ) { // Same operation, new field - const newColumn = copyCustomLabel( - operationDefinition.onFieldChange(previousColumn, field), - previousColumn - ); + let newColumn = operationDefinition.onFieldChange(previousColumn, field); + if (!shouldResetLabel) { + newColumn = copyCustomLabel(newColumn, previousColumn); + } const newLayer = resetIncomplete( { ...layer, columns: { ...layer.columns, [columnId]: newColumn } }, @@ -671,11 +672,14 @@ function applyReferenceTransition({ ); } -function copyCustomLabel(newColumn: IndexPatternColumn, previousColumn: IndexPatternColumn) { +function copyCustomLabel( + newColumn: IndexPatternColumn, + previousOptions: { customLabel?: boolean; label: string } +) { const adjustedColumn = { ...newColumn }; - if (previousColumn.customLabel) { + if (previousOptions.customLabel) { adjustedColumn.customLabel = true; - adjustedColumn.label = previousColumn.label; + adjustedColumn.label = previousOptions.label; } return adjustedColumn; } diff --git a/x-pack/plugins/lens/public/indexpattern_datasource/types.ts b/x-pack/plugins/lens/public/indexpattern_datasource/types.ts index 18f653c588ee8..98dc767c44c7d 100644 --- a/x-pack/plugins/lens/public/indexpattern_datasource/types.ts +++ b/x-pack/plugins/lens/public/indexpattern_datasource/types.ts @@ -87,6 +87,7 @@ export interface IndexPatternPrivateState { existingFields: Record>; isFirstExistenceFetch: boolean; existenceFetchFailed?: boolean; + existenceFetchTimeout?: boolean; } export interface IndexPatternRef { diff --git a/x-pack/plugins/lens/server/routes/existing_fields.ts b/x-pack/plugins/lens/server/routes/existing_fields.ts index 2e6d612835231..d775113d83ff7 100644 --- a/x-pack/plugins/lens/server/routes/existing_fields.ts +++ b/x-pack/plugins/lens/server/routes/existing_fields.ts @@ -68,8 +68,15 @@ export async function existingFieldsRoute(setup: CoreSetup, }), }); } catch (e) { + if (e instanceof errors.TimeoutError) { + logger.info(`Field existence check timed out on ${req.params.indexPatternId}`); + // 408 is Request Timeout + return res.customError({ statusCode: 408, body: e.message }); + } logger.info( - `Field existence check failed: ${isBoomError(e) ? e.output.payload.message : e.message}` + `Field existence check failed on ${req.params.indexPatternId}: ${ + isBoomError(e) ? e.output.payload.message : e.message + }` ); if (e instanceof errors.ResponseError && e.statusCode === 404) { return res.notFound({ body: e.message }); @@ -182,31 +189,44 @@ async function fetchIndexPatternStats({ const scriptedFields = fields.filter((f) => f.isScript); const runtimeFields = fields.filter((f) => f.runtimeField); - const { body: result } = await client.search({ - index, - body: { - size: SAMPLE_SIZE, - query, - sort: timeFieldName && fromDate && toDate ? [{ [timeFieldName]: 'desc' }] : [], - fields: ['*'], - _source: false, - runtime_mappings: runtimeFields.reduce((acc, field) => { - if (!field.runtimeField) return acc; - // @ts-expect-error @elastic/elasticsearch StoredScript.language is required - acc[field.name] = field.runtimeField; - return acc; - }, {} as Record), - script_fields: scriptedFields.reduce((acc, field) => { - acc[field.name] = { - script: { - lang: field.lang!, - source: field.script!, - }, - }; - return acc; - }, {} as Record), + const { body: result } = await client.search( + { + index, + body: { + size: SAMPLE_SIZE, + query, + // Sorted queries are usually able to skip entire shards that don't match + sort: timeFieldName && fromDate && toDate ? [{ [timeFieldName]: 'desc' }] : [], + fields: ['*'], + _source: false, + runtime_mappings: runtimeFields.reduce((acc, field) => { + if (!field.runtimeField) return acc; + // @ts-expect-error @elastic/elasticsearch StoredScript.language is required + acc[field.name] = field.runtimeField; + return acc; + }, {} as Record), + script_fields: scriptedFields.reduce((acc, field) => { + acc[field.name] = { + script: { + lang: field.lang!, + source: field.script!, + }, + }; + return acc; + }, {} as Record), + // Small improvement because there is overhead in counting + track_total_hits: false, + // Per-shard timeout, must be lower than overall. Shards return partial results on timeout + timeout: '4500ms', + }, }, - }); + { + // Global request timeout. Will cancel the request if exceeded. Overrides the elasticsearch.requestTimeout + requestTimeout: '5000ms', + // Fails fast instead of retrying- default is to retry + maxRetries: 0, + } + ); return result.hits.hits; } diff --git a/x-pack/plugins/maps/common/constants.ts b/x-pack/plugins/maps/common/constants.ts index 7152d76afbdbe..44e5f9d445c3d 100644 --- a/x-pack/plugins/maps/common/constants.ts +++ b/x-pack/plugins/maps/common/constants.ts @@ -82,7 +82,7 @@ export enum SOURCE_TYPES { ES_SEARCH = 'ES_SEARCH', ES_PEW_PEW = 'ES_PEW_PEW', ES_TERM_SOURCE = 'ES_TERM_SOURCE', - EMS_XYZ = 'EMS_XYZ', // identifies a custom TMS source. Name is a little unfortunate. + EMS_XYZ = 'EMS_XYZ', // identifies a custom TMS source. EMS-prefix in the name is a little unfortunate :( WMS = 'WMS', KIBANA_TILEMAP = 'KIBANA_TILEMAP', REGIONMAP_FILE = 'REGIONMAP_FILE', diff --git a/x-pack/plugins/maps/kibana.json b/x-pack/plugins/maps/kibana.json index ffedf855c6d9c..aa643b431721c 100644 --- a/x-pack/plugins/maps/kibana.json +++ b/x-pack/plugins/maps/kibana.json @@ -36,6 +36,7 @@ "requiredBundles": [ "kibanaReact", "kibanaUtils", - "home" + "home", + "mapsEms" ] } diff --git a/x-pack/plugins/maps/public/classes/layers/layer.tsx b/x-pack/plugins/maps/public/classes/layers/layer.tsx index a73449b0fa718..5786b5fb194b8 100644 --- a/x-pack/plugins/maps/public/classes/layers/layer.tsx +++ b/x-pack/plugins/maps/public/classes/layers/layer.tsx @@ -10,7 +10,7 @@ import { Map as MbMap } from 'mapbox-gl'; import { Query } from 'src/plugins/data/public'; import _ from 'lodash'; -import React, { ReactElement } from 'react'; +import React, { ReactElement, ReactNode } from 'react'; import { EuiIcon } from '@elastic/eui'; import uuid from 'uuid/v4'; import { FeatureCollection } from 'geojson'; @@ -54,6 +54,7 @@ export interface ILayer { supportsFitToBounds(): Promise; getAttributions(): Promise; getLabel(): string; + hasLegendDetails(): Promise; renderLegendDetails(): ReactElement | null; showAtZoomLevel(zoom: number): boolean; getMinZoom(): number; @@ -100,7 +101,7 @@ export interface ILayer { } export type CustomIconAndTooltipContent = { - icon: ReactElement | null; + icon: ReactNode; tooltipContent?: string | null; areResultsTrimmed?: boolean; }; diff --git a/x-pack/plugins/maps/public/connected_components/mb_map/features_tooltip/__snapshots__/tooltip_header.test.js.snap b/x-pack/plugins/maps/public/connected_components/mb_map/features_tooltip/__snapshots__/footer.test.js.snap similarity index 63% rename from x-pack/plugins/maps/public/connected_components/mb_map/features_tooltip/__snapshots__/tooltip_header.test.js.snap rename to x-pack/plugins/maps/public/connected_components/mb_map/features_tooltip/__snapshots__/footer.test.js.snap index b5fe334f8415e..6840456741e03 100644 --- a/x-pack/plugins/maps/public/connected_components/mb_map/features_tooltip/__snapshots__/tooltip_header.test.js.snap +++ b/x-pack/plugins/maps/public/connected_components/mb_map/features_tooltip/__snapshots__/footer.test.js.snap @@ -1,7 +1,10 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`TooltipHeader multiple features, multiple layers: locked should show pagination controls, features count, layer select, and close button 1`] = ` +exports[`Footer multiple features, multiple layers: locked should show pagination controls, features count, and layer select 1`] = ` + - - - - `; -exports[`TooltipHeader multiple features, multiple layers: mouseover (unlocked) should only show features count 1`] = ` +exports[`Footer multiple features, multiple layers: mouseover (unlocked) should only show features count 1`] = ` + - `; -exports[`TooltipHeader multiple features, single layer: locked should show pagination controls, features count, and close button 1`] = ` +exports[`Footer multiple features, single layer: locked should show pagination controls and features count 1`] = ` + - - - - `; -exports[`TooltipHeader multiple features, single layer: mouseover (unlocked) should only show features count 1`] = ` +exports[`Footer multiple features, single layer: mouseover (unlocked) should only show features count 1`] = ` + - - -`; - -exports[`TooltipHeader single feature: locked should show close button when locked 1`] = ` - - - - - - - - `; -exports[`TooltipHeader single feature: mouseover (unlocked) should not render header 1`] = `""`; +exports[`Footer single feature: mouseover (unlocked) should not render header 1`] = `""`; diff --git a/x-pack/plugins/maps/public/connected_components/mb_map/features_tooltip/__snapshots__/header.test.tsx.snap b/x-pack/plugins/maps/public/connected_components/mb_map/features_tooltip/__snapshots__/header.test.tsx.snap new file mode 100644 index 0000000000000..db4a2640357bf --- /dev/null +++ b/x-pack/plugins/maps/public/connected_components/mb_map/features_tooltip/__snapshots__/header.test.tsx.snap @@ -0,0 +1,111 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`isLocked 1`] = ` + + + + + mockIcon + + + + +

+ myLayerName +

+
+
+ + + +
+ +
+`; + +exports[`render 1`] = ` + + + + + mockIcon + + + + +

+ myLayerName +

+
+
+
+ +
+`; + +exports[`should only show close button when layer name is not yet loaded 1`] = ` + + + + + + + + + +`; diff --git a/x-pack/plugins/maps/public/connected_components/mb_map/features_tooltip/_index.scss b/x-pack/plugins/maps/public/connected_components/mb_map/features_tooltip/_index.scss index abd747c8fa47a..92df0ffbaad92 100644 --- a/x-pack/plugins/maps/public/connected_components/mb_map/features_tooltip/_index.scss +++ b/x-pack/plugins/maps/public/connected_components/mb_map/features_tooltip/_index.scss @@ -30,3 +30,9 @@ justify-content: flex-end; } } + +.mapFeatureTooltip_layerIcon { + img { + margin-bottom: 0; + } +} diff --git a/x-pack/plugins/maps/public/connected_components/mb_map/features_tooltip/features_tooltip.js b/x-pack/plugins/maps/public/connected_components/mb_map/features_tooltip/features_tooltip.js index 48534f8bcd3ac..be8e960471efa 100644 --- a/x-pack/plugins/maps/public/connected_components/mb_map/features_tooltip/features_tooltip.js +++ b/x-pack/plugins/maps/public/connected_components/mb_map/features_tooltip/features_tooltip.js @@ -10,7 +10,8 @@ import { EuiIcon, EuiLink } from '@elastic/eui'; import { FeatureProperties } from './feature_properties'; import { GEO_JSON_TYPE, ES_GEO_FIELD_TYPE } from '../../../../common/constants'; import { FeatureGeometryFilterForm } from './feature_geometry_filter_form'; -import { TooltipHeader } from './tooltip_header'; +import { Footer } from './footer'; +import { Header } from './header'; import { i18n } from '@kbn/i18n'; import { FormattedMessage } from '@kbn/i18n/react'; @@ -167,12 +168,12 @@ export class FeaturesTooltip extends Component { return ( - {this._renderActions(geoFields)} +
); } diff --git a/x-pack/plugins/maps/public/connected_components/mb_map/features_tooltip/tooltip_header.js b/x-pack/plugins/maps/public/connected_components/mb_map/features_tooltip/footer.js similarity index 84% rename from x-pack/plugins/maps/public/connected_components/mb_map/features_tooltip/tooltip_header.js rename to x-pack/plugins/maps/public/connected_components/mb_map/features_tooltip/footer.js index f9a6ecfc06cd4..559e3fb18c182 100644 --- a/x-pack/plugins/maps/public/connected_components/mb_map/features_tooltip/tooltip_header.js +++ b/x-pack/plugins/maps/public/connected_components/mb_map/features_tooltip/footer.js @@ -7,7 +7,6 @@ import React, { Component, Fragment } from 'react'; import { - EuiButtonIcon, EuiPagination, EuiSelect, EuiHorizontalRule, @@ -22,7 +21,7 @@ import { FormattedMessage } from '@kbn/i18n/react'; const ALL_LAYERS = '_ALL_LAYERS_'; const DEFAULT_PAGE_NUMBER = 0; -export class TooltipHeader extends Component { +export class Footer extends Component { state = { filteredFeatures: this.props.features, pageNumber: DEFAULT_PAGE_NUMBER, @@ -121,11 +120,11 @@ export class TooltipHeader extends Component { const { filteredFeatures, pageNumber, selectedLayerId, layerOptions } = this.state; const isLayerSelectVisible = isLocked && layerOptions.length > 1; - const headerItems = []; + const items = []; // Pagination controls if (isLocked && filteredFeatures.length > 1) { - headerItems.push( + items.push( 1) { - headerItems.push( + items.push( ); - } - - headerItems.push( - - - - ); - } - - if (headerItems.length === 0) { - return null; - } - - return ( + return items.length ? ( + + - {headerItems} + {items} - - - ); + ) : null; } } diff --git a/x-pack/plugins/maps/public/connected_components/mb_map/features_tooltip/tooltip_header.test.js b/x-pack/plugins/maps/public/connected_components/mb_map/features_tooltip/footer.test.js similarity index 72% rename from x-pack/plugins/maps/public/connected_components/mb_map/features_tooltip/tooltip_header.test.js rename to x-pack/plugins/maps/public/connected_components/mb_map/features_tooltip/footer.test.js index 8ab8fdbc9eabf..e794588cff435 100644 --- a/x-pack/plugins/maps/public/connected_components/mb_map/features_tooltip/tooltip_header.test.js +++ b/x-pack/plugins/maps/public/connected_components/mb_map/features_tooltip/footer.test.js @@ -7,7 +7,7 @@ import React from 'react'; import { shallow } from 'enzyme'; -import { TooltipHeader } from './tooltip_header'; +import { Footer } from './footer'; class MockLayer { constructor(id) { @@ -22,7 +22,6 @@ class MockLayer { } const defaultProps = { - onClose: () => {}, isLocked: false, findLayerById: (id) => { return new MockLayer(id); @@ -30,7 +29,7 @@ const defaultProps = { setCurrentFeature: () => {}, }; -describe('TooltipHeader', () => { +describe('Footer', () => { describe('single feature:', () => { const SINGLE_FEATURE = [ { @@ -40,21 +39,7 @@ describe('TooltipHeader', () => { ]; describe('mouseover (unlocked)', () => { test('should not render header', async () => { - const component = shallow(); - - // Ensure all promises resolve - await new Promise((resolve) => process.nextTick(resolve)); - // Ensure the state changes are reflected - component.update(); - - expect(component).toMatchSnapshot(); - }); - }); - describe('locked', () => { - test('should show close button when locked', async () => { - const component = shallow( - - ); + const component = shallow(
); // Ensure all promises resolve await new Promise((resolve) => process.nextTick(resolve)); @@ -80,7 +65,7 @@ describe('TooltipHeader', () => { describe('mouseover (unlocked)', () => { test('should only show features count', async () => { const component = shallow( - +
); // Ensure all promises resolve @@ -92,9 +77,9 @@ describe('TooltipHeader', () => { }); }); describe('locked', () => { - test('should show pagination controls, features count, and close button', async () => { + test('should show pagination controls and features count', async () => { const component = shallow( - +
); // Ensure all promises resolve @@ -125,7 +110,7 @@ describe('TooltipHeader', () => { describe('mouseover (unlocked)', () => { test('should only show features count', async () => { const component = shallow( - +
); // Ensure all promises resolve @@ -137,9 +122,9 @@ describe('TooltipHeader', () => { }); }); describe('locked', () => { - test('should show pagination controls, features count, layer select, and close button', async () => { + test('should show pagination controls, features count, and layer select', async () => { const component = shallow( - +
); // Ensure all promises resolve diff --git a/x-pack/plugins/maps/public/connected_components/mb_map/features_tooltip/header.test.tsx b/x-pack/plugins/maps/public/connected_components/mb_map/features_tooltip/header.test.tsx new file mode 100644 index 0000000000000..a52ee48d38b97 --- /dev/null +++ b/x-pack/plugins/maps/public/connected_components/mb_map/features_tooltip/header.test.tsx @@ -0,0 +1,61 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import React from 'react'; +import { shallow } from 'enzyme'; +import { Header } from './header'; +import { ILayer } from '../../../classes/layers/layer'; + +const layerMock = ({ + getDisplayName: async () => { + return 'myLayerName'; + }, + getCustomIconAndTooltipContent: () => { + return { + icon: mockIcon, + }; + }, +} as unknown) as ILayer; + +const defaultProps = { + findLayerById: (layerId: string) => { + return layerMock; + }, + isLocked: false, + layerId: 'myLayerId', + onClose: () => { + return; + }, +}; + +test('render', async () => { + const component = shallow(
); + + // Ensure all promises resolve + await new Promise((resolve) => process.nextTick(resolve)); + // Ensure the state changes are reflected + component.update(); + + expect(component).toMatchSnapshot(); +}); + +test('isLocked', async () => { + const component = shallow(
); + + // Ensure all promises resolve + await new Promise((resolve) => process.nextTick(resolve)); + // Ensure the state changes are reflected + component.update(); + + expect(component).toMatchSnapshot(); +}); + +// Test is sync to show render before async state is set. +test('should only show close button when layer name is not yet loaded', () => { + const component = shallow(
); + expect(component).toMatchSnapshot(); +}); diff --git a/x-pack/plugins/maps/public/connected_components/mb_map/features_tooltip/header.tsx b/x-pack/plugins/maps/public/connected_components/mb_map/features_tooltip/header.tsx new file mode 100644 index 0000000000000..4fe9c3b4e8550 --- /dev/null +++ b/x-pack/plugins/maps/public/connected_components/mb_map/features_tooltip/header.tsx @@ -0,0 +1,110 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import React, { Component, Fragment, ReactNode } from 'react'; +import { i18n } from '@kbn/i18n'; +import { + EuiButtonIcon, + EuiHorizontalRule, + EuiFlexGroup, + EuiFlexItem, + EuiTextColor, +} from '@elastic/eui'; +import { ILayer } from '../../../classes/layers/layer'; + +interface Props { + findLayerById: (layerId: string) => ILayer | undefined; + isLocked: boolean; + layerId: string; + onClose: () => void; +} + +interface State { + layerIcon: ReactNode; + layerName: string | null; +} + +export class Header extends Component { + private _isMounted = false; + state: State = { + layerIcon: null, + layerName: null, + }; + + componentDidMount() { + this._isMounted = true; + this._loadLayerState(); + } + + componentWillUnmount() { + this._isMounted = false; + } + + async _loadLayerState() { + const layer = this.props.findLayerById(this.props.layerId); + if (!layer) { + return; + } + const layerName = await layer.getDisplayName(); + const customIconAndTooltipContent = layer.getCustomIconAndTooltipContent(); + if (this._isMounted) { + this.setState({ layerIcon: customIconAndTooltipContent.icon, layerName }); + } + } + + render() { + const items: ReactNode[] = []; + if (this.state.layerIcon) { + items.push( + + {this.state.layerIcon} + + ); + } + + if (this.state.layerName) { + items.push( + + +

+ {this.state.layerName} +

+
+
+ ); + } + + if (this.props.isLocked) { + // When close button is the only item, add empty FlexItem to push close button to right + if (items.length === 0) { + items.push(); + } + + items.push( + + + + ); + } + + return items.length ? ( + + + {items} + + + + ) : null; + } +} diff --git a/x-pack/plugins/maps/public/connected_components/widget_overlay/layer_control/__snapshots__/view.test.js.snap b/x-pack/plugins/maps/public/connected_components/widget_overlay/layer_control/__snapshots__/layer_control.test.tsx.snap similarity index 100% rename from x-pack/plugins/maps/public/connected_components/widget_overlay/layer_control/__snapshots__/view.test.js.snap rename to x-pack/plugins/maps/public/connected_components/widget_overlay/layer_control/__snapshots__/layer_control.test.tsx.snap diff --git a/x-pack/plugins/maps/public/connected_components/widget_overlay/layer_control/index.js b/x-pack/plugins/maps/public/connected_components/widget_overlay/layer_control/index.ts similarity index 72% rename from x-pack/plugins/maps/public/connected_components/widget_overlay/layer_control/index.js rename to x-pack/plugins/maps/public/connected_components/widget_overlay/layer_control/index.ts index 7ed2fa006cc83..5f293dba05d9d 100644 --- a/x-pack/plugins/maps/public/connected_components/widget_overlay/layer_control/index.js +++ b/x-pack/plugins/maps/public/connected_components/widget_overlay/layer_control/index.ts @@ -5,8 +5,10 @@ * 2.0. */ +import { AnyAction } from 'redux'; +import { ThunkDispatch } from 'redux-thunk'; import { connect } from 'react-redux'; -import { LayerControl } from './view'; +import { LayerControl } from './layer_control'; import { FLYOUT_STATE } from '../../../reducers/ui'; import { setSelectedLayer, updateFlyout, setIsLayerTOCOpen } from '../../../actions'; @@ -16,8 +18,9 @@ import { getFlyoutDisplay, } from '../../../selectors/ui_selectors'; import { getLayerList } from '../../../selectors/map_selectors'; +import { MapStoreState } from '../../../reducers/store'; -function mapStateToProps(state = {}) { +function mapStateToProps(state: MapStoreState) { return { isReadOnly: getIsReadOnly(state), isLayerTOCOpen: getIsLayerTOCOpen(state), @@ -26,7 +29,7 @@ function mapStateToProps(state = {}) { }; } -function mapDispatchToProps(dispatch) { +function mapDispatchToProps(dispatch: ThunkDispatch) { return { showAddLayerWizard: async () => { await dispatch(setSelectedLayer(null)); @@ -41,5 +44,5 @@ function mapDispatchToProps(dispatch) { }; } -const connectedLayerControl = connect(mapStateToProps, mapDispatchToProps)(LayerControl); -export { connectedLayerControl as LayerControl }; +const connected = connect(mapStateToProps, mapDispatchToProps)(LayerControl); +export { connected as LayerControl }; diff --git a/x-pack/plugins/maps/public/connected_components/widget_overlay/layer_control/view.test.js b/x-pack/plugins/maps/public/connected_components/widget_overlay/layer_control/layer_control.test.tsx similarity index 90% rename from x-pack/plugins/maps/public/connected_components/widget_overlay/layer_control/view.test.js rename to x-pack/plugins/maps/public/connected_components/widget_overlay/layer_control/layer_control.test.tsx index e4af1ad4f46ca..cde42f42362e0 100644 --- a/x-pack/plugins/maps/public/connected_components/widget_overlay/layer_control/view.test.js +++ b/x-pack/plugins/maps/public/connected_components/widget_overlay/layer_control/layer_control.test.tsx @@ -14,10 +14,12 @@ jest.mock('./layer_toc', () => ({ import React from 'react'; import { shallow } from 'enzyme'; -import { LayerControl } from './view'; +import { LayerControl } from './layer_control'; +import { ILayer } from '../../../classes/layers/layer'; const defaultProps = { - showAddLayerWizard: () => {}, + isReadOnly: false, + showAddLayerWizard: async () => {}, closeLayerTOC: () => {}, openLayerTOC: () => {}, isLayerTOCOpen: true, @@ -53,7 +55,7 @@ describe('LayerControl', () => { describe('spinner icon', () => { const isLayerLoading = true; let isVisible = true; - const mockLayerThatIsLoading = { + const mockLayerThatIsLoading = ({ hasErrors: () => { return false; }, @@ -63,7 +65,7 @@ describe('LayerControl', () => { isVisible: () => { return isVisible; }, - }; + } as unknown) as ILayer; test('Should render expand button with loading icon when layer is loading', () => { const component = shallow( { }); test('Should render expand button with error icon when layer has error', () => { - const mockLayerThatHasError = { + const mockLayerThatHasError = ({ hasErrors: () => { return true; }, isLayerLoading: () => { return false; }, - }; + } as unknown) as ILayer; const component = shallow( Promise; + closeLayerTOC: () => void; + openLayerTOC: () => void; +} -function renderExpandButton({ hasErrors, isLoading, onClick }) { +function renderExpandButton({ + hasErrors, + isLoading, + onClick, +}: { + hasErrors: boolean; + isLoading: boolean; + onClick: () => void; +}) { const expandLabel = i18n.translate('xpack.maps.layerControl.openLayerTOCButtonAriaLabel', { defaultMessage: 'Expand layers panel', }); @@ -59,7 +78,7 @@ export function LayerControl({ openLayerTOC, layerList, isFlyoutOpen, -}) { +}: Props) { if (!isLayerTOCOpen) { const hasErrors = layerList.some((layer) => { return layer.hasErrors(); diff --git a/x-pack/plugins/maps/public/connected_components/widget_overlay/layer_control/layer_toc/__snapshots__/view.test.js.snap b/x-pack/plugins/maps/public/connected_components/widget_overlay/layer_control/layer_toc/__snapshots__/layer_toc.test.tsx.snap similarity index 100% rename from x-pack/plugins/maps/public/connected_components/widget_overlay/layer_control/layer_toc/__snapshots__/view.test.js.snap rename to x-pack/plugins/maps/public/connected_components/widget_overlay/layer_control/layer_toc/__snapshots__/layer_toc.test.tsx.snap diff --git a/x-pack/plugins/maps/public/connected_components/widget_overlay/layer_control/layer_toc/index.js b/x-pack/plugins/maps/public/connected_components/widget_overlay/layer_control/layer_toc/index.ts similarity index 52% rename from x-pack/plugins/maps/public/connected_components/widget_overlay/layer_control/layer_toc/index.js rename to x-pack/plugins/maps/public/connected_components/widget_overlay/layer_control/layer_toc/index.ts index 311765da8b6f3..ab9b043b18d8b 100644 --- a/x-pack/plugins/maps/public/connected_components/widget_overlay/layer_control/layer_toc/index.js +++ b/x-pack/plugins/maps/public/connected_components/widget_overlay/layer_control/layer_toc/index.ts @@ -5,24 +5,27 @@ * 2.0. */ +import { AnyAction } from 'redux'; +import { ThunkDispatch } from 'redux-thunk'; import { connect } from 'react-redux'; -import { LayerTOC } from './view'; +import { LayerTOC } from './layer_toc'; import { updateLayerOrder } from '../../../../actions'; import { getLayerList } from '../../../../selectors/map_selectors'; import { getIsReadOnly } from '../../../../selectors/ui_selectors'; +import { MapStoreState } from '../../../../reducers/store'; -const mapDispatchToProps = { - updateLayerOrder: (newOrder) => updateLayerOrder(newOrder), -}; - -function mapStateToProps(state = {}) { +function mapStateToProps(state: MapStoreState) { return { isReadOnly: getIsReadOnly(state), layerList: getLayerList(state), }; } -const connectedLayerTOC = connect(mapStateToProps, mapDispatchToProps, null, { forwardRef: true })( - LayerTOC -); -export { connectedLayerTOC as LayerTOC }; +function mapDispatchToProps(dispatch: ThunkDispatch) { + return { + updateLayerOrder: (newOrder: number[]) => dispatch(updateLayerOrder(newOrder)), + }; +} + +const connected = connect(mapStateToProps, mapDispatchToProps)(LayerTOC); +export { connected as LayerTOC }; diff --git a/x-pack/plugins/maps/public/connected_components/widget_overlay/layer_control/layer_toc/view.test.js b/x-pack/plugins/maps/public/connected_components/widget_overlay/layer_control/layer_toc/layer_toc.test.tsx similarity index 68% rename from x-pack/plugins/maps/public/connected_components/widget_overlay/layer_control/layer_toc/view.test.js rename to x-pack/plugins/maps/public/connected_components/widget_overlay/layer_control/layer_toc/layer_toc.test.tsx index 4a036d8d70c8f..8f0b62efbffac 100644 --- a/x-pack/plugins/maps/public/connected_components/widget_overlay/layer_control/layer_toc/view.test.js +++ b/x-pack/plugins/maps/public/connected_components/widget_overlay/layer_control/layer_toc/layer_toc.test.tsx @@ -13,38 +13,45 @@ jest.mock('./toc_entry', () => ({ import React from 'react'; import { shallow } from 'enzyme'; +import { ILayer } from '../../../../classes/layers/layer'; -import { LayerTOC } from './view'; +import { LayerTOC } from './layer_toc'; const mockLayers = [ - { + ({ getId: () => { return '1'; }, supportsFitToBounds: () => { return true; }, - }, - { + } as unknown) as ILayer, + ({ getId: () => { return '2'; }, supportsFitToBounds: () => { return false; }, - }, + } as unknown) as ILayer, ]; +const defaultProps = { + layerList: mockLayers, + isReadOnly: false, + updateLayerOrder: () => {}, +}; + describe('LayerTOC', () => { test('is rendered', () => { - const component = shallow(); + const component = shallow(); expect(component).toMatchSnapshot(); }); describe('props', () => { test('isReadOnly', () => { - const component = shallow(); + const component = shallow(); expect(component).toMatchSnapshot(); }); diff --git a/x-pack/plugins/maps/public/connected_components/widget_overlay/layer_control/layer_toc/view.js b/x-pack/plugins/maps/public/connected_components/widget_overlay/layer_control/layer_toc/layer_toc.tsx similarity index 78% rename from x-pack/plugins/maps/public/connected_components/widget_overlay/layer_control/layer_toc/view.js rename to x-pack/plugins/maps/public/connected_components/widget_overlay/layer_control/layer_toc/layer_toc.tsx index 1ef718c0650e4..1800f2dc33618 100644 --- a/x-pack/plugins/maps/public/connected_components/widget_overlay/layer_control/layer_toc/view.js +++ b/x-pack/plugins/maps/public/connected_components/widget_overlay/layer_control/layer_toc/layer_toc.tsx @@ -6,11 +6,18 @@ */ import _ from 'lodash'; -import React from 'react'; -import { EuiDragDropContext, EuiDroppable, EuiDraggable } from '@elastic/eui'; +import React, { Component } from 'react'; +import { DropResult, EuiDragDropContext, EuiDroppable, EuiDraggable } from '@elastic/eui'; import { TOCEntry } from './toc_entry'; +import { ILayer } from '../../../../classes/layers/layer'; -export class LayerTOC extends React.Component { +export interface Props { + isReadOnly: boolean; + layerList: ILayer[]; + updateLayerOrder: (newOrder: number[]) => void; +} + +export class LayerTOC extends Component { componentWillUnmount() { this._updateDebounced.cancel(); } @@ -22,14 +29,14 @@ export class LayerTOC extends React.Component { _updateDebounced = _.debounce(this.forceUpdate, 100); - _onDragEnd = ({ source, destination }) => { + _onDragEnd = ({ source, destination }: DropResult) => { // Dragging item out of EuiDroppable results in destination of null if (!destination) { return; } // Layer list is displayed in reverse order so index needs to reversed to get back to original reference. - const reverseIndex = (index) => { + const reverseIndex = (index: number) => { return this.props.layerList.length - index - 1; }; @@ -58,8 +65,8 @@ export class LayerTOC extends React.Component { return ( - {(provided, snapshot) => - reverseLayerList.map((layer, idx) => ( + {(droppableProvided, snapshot) => { + const tocEntries = reverseLayerList.map((layer, idx: number) => ( )} - )) - } + )); + return
{tocEntries}
; + }}
); diff --git a/x-pack/plugins/maps/public/connected_components/widget_overlay/layer_control/layer_toc/toc_entry/__snapshots__/view.test.js.snap b/x-pack/plugins/maps/public/connected_components/widget_overlay/layer_control/layer_toc/toc_entry/__snapshots__/toc_entry.test.tsx.snap similarity index 92% rename from x-pack/plugins/maps/public/connected_components/widget_overlay/layer_control/layer_toc/toc_entry/__snapshots__/view.test.js.snap rename to x-pack/plugins/maps/public/connected_components/widget_overlay/layer_control/layer_toc/toc_entry/__snapshots__/toc_entry.test.tsx.snap index b43d740e72907..3abc6801122fb 100644 --- a/x-pack/plugins/maps/public/connected_components/widget_overlay/layer_control/layer_toc/toc_entry/__snapshots__/view.test.js.snap +++ b/x-pack/plugins/maps/public/connected_components/widget_overlay/layer_control/layer_toc/toc_entry/__snapshots__/toc_entry.test.tsx.snap @@ -13,6 +13,7 @@ exports[`TOCEntry is rendered 1`] = ` displayName="layer 1" editLayer={[Function]} escapedDisplayName="layer_1" + isEditButtonDisabled={false} layer={ Object { "getDisplayName": [Function], @@ -33,12 +34,15 @@ exports[`TOCEntry is rendered 1`] = ` @@ -46,6 +50,7 @@ exports[`TOCEntry is rendered 1`] = ` aria-label="Reorder layer" className="mapTocEntry__grab" iconType="grab" + key="reorder" title="Reorder layer" />
@@ -82,6 +87,7 @@ exports[`TOCEntry props Should shade background when not selected layer 1`] = ` displayName="layer 1" editLayer={[Function]} escapedDisplayName="layer_1" + isEditButtonDisabled={false} layer={ Object { "getDisplayName": [Function], @@ -102,12 +108,15 @@ exports[`TOCEntry props Should shade background when not selected layer 1`] = ` @@ -115,6 +124,7 @@ exports[`TOCEntry props Should shade background when not selected layer 1`] = ` aria-label="Reorder layer" className="mapTocEntry__grab" iconType="grab" + key="reorder" title="Reorder layer" />
@@ -151,6 +161,7 @@ exports[`TOCEntry props Should shade background when selected layer 1`] = ` displayName="layer 1" editLayer={[Function]} escapedDisplayName="layer_1" + isEditButtonDisabled={false} layer={ Object { "getDisplayName": [Function], @@ -171,12 +182,15 @@ exports[`TOCEntry props Should shade background when selected layer 1`] = ` @@ -184,6 +198,7 @@ exports[`TOCEntry props Should shade background when selected layer 1`] = ` aria-label="Reorder layer" className="mapTocEntry__grab" iconType="grab" + key="reorder" title="Reorder layer" />
@@ -220,6 +235,7 @@ exports[`TOCEntry props isReadOnly 1`] = ` displayName="layer 1" editLayer={[Function]} escapedDisplayName="layer_1" + isEditButtonDisabled={false} layer={ Object { "getDisplayName": [Function], @@ -240,6 +256,7 @@ exports[`TOCEntry props isReadOnly 1`] = ` @@ -277,6 +294,7 @@ exports[`TOCEntry props should display layer details when isLegendDetailsOpen is displayName="layer 1" editLayer={[Function]} escapedDisplayName="layer_1" + isEditButtonDisabled={false} layer={ Object { "getDisplayName": [Function], @@ -297,12 +315,15 @@ exports[`TOCEntry props should display layer details when isLegendDetailsOpen is @@ -310,6 +331,7 @@ exports[`TOCEntry props should display layer details when isLegendDetailsOpen is aria-label="Reorder layer" className="mapTocEntry__grab" iconType="grab" + key="reorder" title="Reorder layer" />
diff --git a/x-pack/plugins/maps/public/connected_components/widget_overlay/layer_control/layer_toc/toc_entry/index.js b/x-pack/plugins/maps/public/connected_components/widget_overlay/layer_control/layer_toc/toc_entry/index.ts similarity index 65% rename from x-pack/plugins/maps/public/connected_components/widget_overlay/layer_control/layer_toc/toc_entry/index.js rename to x-pack/plugins/maps/public/connected_components/widget_overlay/layer_control/layer_toc/toc_entry/index.ts index ee7922a579c34..eaebc9099ada1 100644 --- a/x-pack/plugins/maps/public/connected_components/widget_overlay/layer_control/layer_toc/toc_entry/index.js +++ b/x-pack/plugins/maps/public/connected_components/widget_overlay/layer_control/layer_toc/toc_entry/index.ts @@ -5,8 +5,11 @@ * 2.0. */ +import { AnyAction } from 'redux'; +import { ThunkDispatch } from 'redux-thunk'; import { connect } from 'react-redux'; -import { TOCEntry } from './view'; +import { TOCEntry, OwnProps, ReduxDispatchProps, ReduxStateProps } from './toc_entry'; +import { MapStoreState } from '../../../../../reducers/store'; import { FLYOUT_STATE } from '../../../../../reducers/ui'; import { getMapZoom, @@ -27,7 +30,7 @@ import { toggleLayerVisible, } from '../../../../../actions'; -function mapStateToProps(state = {}, ownProps) { +function mapStateToProps(state: MapStoreState, ownProps: OwnProps): ReduxStateProps { const flyoutDisplay = getFlyoutDisplay(state); return { isReadOnly: getIsReadOnly(state), @@ -40,26 +43,29 @@ function mapStateToProps(state = {}, ownProps) { }; } -function mapDispatchToProps(dispatch) { +function mapDispatchToProps(dispatch: ThunkDispatch) { return { - fitToBounds: (layerId) => { + fitToBounds: (layerId: string) => { dispatch(fitToLayerExtent(layerId)); }, - openLayerPanel: async (layerId) => { + openLayerPanel: async (layerId: string) => { await dispatch(setSelectedLayer(layerId)); dispatch(updateFlyout(FLYOUT_STATE.LAYER_PANEL)); }, - hideTOCDetails: (layerId) => { + hideTOCDetails: (layerId: string) => { dispatch(hideTOCDetails(layerId)); }, - showTOCDetails: (layerId) => { + showTOCDetails: (layerId: string) => { dispatch(showTOCDetails(layerId)); }, - toggleVisible: (layerId) => { + toggleVisible: (layerId: string) => { dispatch(toggleLayerVisible(layerId)); }, }; } -const connectedTOCEntry = connect(mapStateToProps, mapDispatchToProps)(TOCEntry); -export { connectedTOCEntry as TOCEntry }; +const connected = connect( + mapStateToProps, + mapDispatchToProps +)(TOCEntry); +export { connected as TOCEntry }; diff --git a/x-pack/plugins/maps/public/connected_components/widget_overlay/layer_control/layer_toc/toc_entry/view.test.js b/x-pack/plugins/maps/public/connected_components/widget_overlay/layer_control/layer_toc/toc_entry/toc_entry.test.tsx similarity index 74% rename from x-pack/plugins/maps/public/connected_components/widget_overlay/layer_control/layer_toc/toc_entry/view.test.js rename to x-pack/plugins/maps/public/connected_components/widget_overlay/layer_control/layer_toc/toc_entry/toc_entry.test.tsx index ea7afd8480d10..4d80f762b6a82 100644 --- a/x-pack/plugins/maps/public/connected_components/widget_overlay/layer_control/layer_toc/toc_entry/view.test.js +++ b/x-pack/plugins/maps/public/connected_components/widget_overlay/layer_control/layer_toc/toc_entry/toc_entry.test.tsx @@ -6,7 +6,8 @@ */ import React from 'react'; -import { shallowWithIntl } from '@kbn/test/jest'; +import { shallow } from 'enzyme'; +import { ILayer } from '../../../../../classes/layers/layer'; jest.mock('../../../../../kibana_services', () => { return { @@ -16,11 +17,11 @@ jest.mock('../../../../../kibana_services', () => { }; }); -import { TOCEntry } from './view'; +import { TOCEntry } from './toc_entry'; const LAYER_ID = '1'; -const mockLayer = { +const mockLayer = ({ getId: () => { return LAYER_ID; }, @@ -45,22 +46,27 @@ const mockLayer = { hasLegendDetails: () => { return true; }, -}; +} as unknown) as ILayer; const defaultProps = { layer: mockLayer, - openLayerPanel: () => {}, + selectedLayer: undefined, + openLayerPanel: async () => {}, toggleVisible: () => {}, fitToBounds: () => {}, getSelectedLayerSelector: () => {}, - hasDirtyStateSelector: () => {}, + hasDirtyStateSelector: false, zoom: 0, isLegendDetailsOpen: false, + isReadOnly: false, + isEditButtonDisabled: false, + hideTOCDetails: () => {}, + showTOCDetails: () => {}, }; describe('TOCEntry', () => { test('is rendered', async () => { - const component = shallowWithIntl(); + const component = shallow(); // Ensure all promises resolve await new Promise((resolve) => process.nextTick(resolve)); @@ -72,7 +78,7 @@ describe('TOCEntry', () => { describe('props', () => { test('isReadOnly', async () => { - const component = shallowWithIntl(); + const component = shallow(); // Ensure all promises resolve await new Promise((resolve) => process.nextTick(resolve)); @@ -83,7 +89,7 @@ describe('TOCEntry', () => { }); test('should display layer details when isLegendDetailsOpen is true', async () => { - const component = shallowWithIntl(); + const component = shallow(); // Ensure all promises resolve await new Promise((resolve) => process.nextTick(resolve)); @@ -94,7 +100,7 @@ describe('TOCEntry', () => { }); test('Should shade background when selected layer', async () => { - const component = shallowWithIntl(); + const component = shallow(); // Ensure all promises resolve await new Promise((resolve) => process.nextTick(resolve)); @@ -105,13 +111,11 @@ describe('TOCEntry', () => { }); test('Should shade background when not selected layer', async () => { - const differentLayer = Object.create(mockLayer); + const differentLayer = (Object.create(mockLayer) as unknown) as ILayer; differentLayer.getId = () => { return 'foobar'; }; - const component = shallowWithIntl( - - ); + const component = shallow(); // Ensure all promises resolve await new Promise((resolve) => process.nextTick(resolve)); diff --git a/x-pack/plugins/maps/public/connected_components/widget_overlay/layer_control/layer_toc/toc_entry/view.js b/x-pack/plugins/maps/public/connected_components/widget_overlay/layer_control/layer_toc/toc_entry/toc_entry.tsx similarity index 83% rename from x-pack/plugins/maps/public/connected_components/widget_overlay/layer_control/layer_toc/toc_entry/view.js rename to x-pack/plugins/maps/public/connected_components/widget_overlay/layer_control/layer_toc/toc_entry/toc_entry.tsx index b886dd21030ba..553d7b94006f4 100644 --- a/x-pack/plugins/maps/public/connected_components/widget_overlay/layer_control/layer_toc/toc_entry/view.js +++ b/x-pack/plugins/maps/public/connected_components/widget_overlay/layer_control/layer_toc/toc_entry/toc_entry.tsx @@ -5,26 +5,62 @@ * 2.0. */ -import React from 'react'; +import React, { Component } from 'react'; import classNames from 'classnames'; +import type { DraggableProvidedDragHandleProps } from 'react-beautiful-dnd'; import { EuiIcon, EuiButtonIcon, EuiConfirmModal } from '@elastic/eui'; -import { TOCEntryActionsPopover } from './toc_entry_actions_popover'; import { i18n } from '@kbn/i18n'; +import { TOCEntryActionsPopover } from './toc_entry_actions_popover'; import { getVisibilityToggleIcon, getVisibilityToggleLabel, EDIT_LAYER_LABEL, FIT_TO_DATA_LABEL, } from './action_labels'; +import { ILayer } from '../../../../../classes/layers/layer'; + +function escapeLayerName(name: string) { + return name.split(' ').join('_'); +} + +export interface ReduxStateProps { + isReadOnly: boolean; + zoom: number; + selectedLayer: ILayer | undefined; + hasDirtyStateSelector: boolean; + isLegendDetailsOpen: boolean; + isEditButtonDisabled: boolean; +} -function escapeLayerName(name) { - return name ? name.split(' ').join('_') : ''; +export interface ReduxDispatchProps { + fitToBounds: (layerId: string) => void; + openLayerPanel: (layerId: string) => Promise; + hideTOCDetails: (layerId: string) => void; + showTOCDetails: (layerId: string) => void; + toggleVisible: (layerId: string) => void; } -export class TOCEntry extends React.Component { - state = { - displayName: null, +export interface OwnProps { + layer: ILayer; + dragHandleProps?: DraggableProvidedDragHandleProps; + isDragging?: boolean; + isDraggingOver?: boolean; +} + +type Props = ReduxStateProps & ReduxDispatchProps & OwnProps; + +interface State { + displayName: string; + hasLegendDetails: boolean; + shouldShowModal: boolean; + supportsFitToBounds: boolean; +} + +export class TOCEntry extends Component { + private _isMounted = false; + state: State = { + displayName: '', hasLegendDetails: false, shouldShowModal: false, supportsFitToBounds: false, @@ -72,13 +108,9 @@ export class TOCEntry extends React.Component { } async _updateDisplayName() { - const label = await this.props.layer.getDisplayName(); - if (this._isMounted) { - if (label !== this.state.displayName) { - this.setState({ - displayName: label, - }); - } + const displayName = await this.props.layer.getDisplayName(); + if (this._isMounted && displayName !== this.state.displayName) { + this.setState({ displayName }); } } @@ -141,6 +173,7 @@ export class TOCEntry extends React.Component { _renderQuickActions() { const quickActions = [ (mapStateToProps)(TOCEntryButton); +const connected = connect(mapStateToProps)( + TOCEntryButton +); export { connected as TOCEntryButton }; diff --git a/x-pack/plugins/maps/public/connected_components/widget_overlay/layer_control/layer_toc/toc_entry/toc_entry_button/toc_entry_button.tsx b/x-pack/plugins/maps/public/connected_components/widget_overlay/layer_control/layer_toc/toc_entry/toc_entry_button/toc_entry_button.tsx index 385fac4b2021b..41c2992c77d88 100644 --- a/x-pack/plugins/maps/public/connected_components/widget_overlay/layer_control/layer_toc/toc_entry/toc_entry_button/toc_entry_button.tsx +++ b/x-pack/plugins/maps/public/connected_components/widget_overlay/layer_control/layer_toc/toc_entry/toc_entry_button/toc_entry_button.tsx @@ -5,24 +5,24 @@ * 2.0. */ -import React, { Component, Fragment, ReactElement } from 'react'; +import React, { Component, Fragment, ReactNode } from 'react'; import { EuiButtonEmpty, EuiIcon, EuiToolTip, EuiLoadingSpinner } from '@elastic/eui'; import { i18n } from '@kbn/i18n'; import { ILayer } from '../../../../../../classes/layers/layer'; interface Footnote { - icon: ReactElement; + icon: ReactNode; message?: string | null; } interface IconAndTooltipContent { - icon?: ReactElement | null; + icon?: ReactNode; tooltipContent?: string | null; footnotes: Footnote[]; } -export interface StateProps { +export interface ReduxStateProps { isUsingSearch: boolean; zoom: number; } @@ -34,7 +34,7 @@ export interface OwnProps { onClick: () => void; } -type Props = StateProps & OwnProps; +type Props = ReduxStateProps & OwnProps; interface State { isFilteredByGlobalTime: boolean; diff --git a/x-pack/plugins/maps/public/util.ts b/x-pack/plugins/maps/public/util.ts index 2745f9274f119..7cae3d4d5e936 100644 --- a/x-pack/plugins/maps/public/util.ts +++ b/x-pack/plugins/maps/public/util.ts @@ -8,8 +8,8 @@ import { i18n } from '@kbn/i18n'; import { EMSClient, FileLayer, TMSService } from '@elastic/ems-client'; import { FeatureCollection } from 'geojson'; -// @ts-expect-error import * as topojson from 'topojson-client'; +import { GeometryCollection } from 'topojson-specification'; import _ from 'lodash'; import fetch from 'node-fetch'; @@ -145,7 +145,7 @@ export async function fetchGeoJson( } if (format === FORMAT_TYPE.TOPOJSON) { - const features = _.get(fetchedJson, `objects.${featureCollectionPath}`); + const features = _.get(fetchedJson, `objects.${featureCollectionPath}`) as GeometryCollection; return topojson.feature(fetchedJson, features); } diff --git a/x-pack/plugins/maps/server/maps_telemetry/collectors/register.ts b/x-pack/plugins/maps/server/maps_telemetry/collectors/register.ts index 8ad12b0ba8307..ded96266ee75f 100644 --- a/x-pack/plugins/maps/server/maps_telemetry/collectors/register.ts +++ b/x-pack/plugins/maps/server/maps_telemetry/collectors/register.ts @@ -31,6 +31,360 @@ export function registerMapsUsageCollector( geoShapeAggLayersCount: { type: 'long' }, mapsTotalCount: { type: 'long' }, timeCaptured: { type: 'date' }, + layerTypes: { + ems_basemap: { + min: { type: 'long', _meta: { description: 'min number of ems basemap layers per map' } }, + max: { type: 'long', _meta: { description: 'max number of ems basemap layers per map' } }, + avg: { + type: 'float', + _meta: { description: 'avg number of ems basemap layers per map' }, + }, + total: { + type: 'long', + _meta: { description: 'total number of ems basemap layers in cluster' }, + }, + }, + ems_region: { + min: { type: 'long', _meta: { description: 'min number of ems file layers per map' } }, + max: { type: 'long', _meta: { description: 'max number of ems file layers per map' } }, + avg: { type: 'float', _meta: { description: 'avg number of ems file layers per map' } }, + total: { + type: 'long', + _meta: { description: 'total number of file layers in cluster' }, + }, + }, + es_agg_clusters: { + min: { type: 'long', _meta: { description: 'min number of es cluster layers per map' } }, + max: { type: 'long', _meta: { description: 'max number of es cluster layers per map' } }, + avg: { type: 'float', _meta: { description: 'avg number of es cluster layers per map' } }, + total: { + type: 'long', + _meta: { description: 'total number of es cluster layers in cluster' }, + }, + }, + es_agg_grids: { + min: { type: 'long', _meta: { description: 'min number of es grid layers per map' } }, + max: { type: 'long', _meta: { description: 'max number of es grid layers per map' } }, + avg: { type: 'float', _meta: { description: 'avg number of es grid layers per map' } }, + total: { + type: 'long', + _meta: { description: 'total number of es grid layers in cluster' }, + }, + }, + es_agg_heatmap: { + min: { type: 'long', _meta: { description: 'min number of es heatmap layers per map' } }, + max: { type: 'long', _meta: { description: 'max number of es heatmap layers per map' } }, + avg: { type: 'float', _meta: { description: 'avg number of es heatmap layers per map' } }, + total: { + type: 'long', + _meta: { description: 'total number of es heatmap layers in cluster' }, + }, + }, + es_top_hits: { + min: { type: 'long', _meta: { description: 'min number of es top hits layers per map' } }, + max: { type: 'long', _meta: { description: 'max number of es top hits layers per map' } }, + avg: { + type: 'float', + _meta: { description: 'avg number of es top hits layers per map' }, + }, + total: { + type: 'long', + _meta: { description: 'total number of es top hits layers in cluster' }, + }, + }, + es_docs: { + min: { type: 'long', _meta: { description: 'min number of es document layers per map' } }, + max: { type: 'long', _meta: { description: 'max number of es document layers per map' } }, + avg: { + type: 'float', + _meta: { description: 'avg number of es document layers per map' }, + }, + total: { + type: 'long', + _meta: { description: 'total number of es document layers in cluster' }, + }, + }, + es_point_to_point: { + min: { + type: 'long', + _meta: { description: 'min number of es point-to-point layers per map' }, + }, + max: { + type: 'long', + _meta: { description: 'max number of es point-to-point layers per map' }, + }, + avg: { + type: 'float', + _meta: { description: 'avg number of es point-to-point layers per map' }, + }, + total: { + type: 'long', + _meta: { description: 'total number of es point-to-point layers in cluster' }, + }, + }, + es_tracks: { + min: { type: 'long', _meta: { description: 'min number of es track layers per map' } }, + max: { type: 'long', _meta: { description: 'max number of es track layers per map' } }, + avg: { + type: 'float', + _meta: { description: 'avg number of es track layers per map' }, + }, + total: { + type: 'long', + _meta: { description: 'total number of es track layers in cluster' }, + }, + }, + kbn_region: { + min: { type: 'long', _meta: { description: 'min number of kbn region layers per map' } }, + max: { type: 'long', _meta: { description: 'max number of kbn region layers per map' } }, + avg: { + type: 'float', + _meta: { description: 'avg number of kbn region layers per map' }, + }, + total: { + type: 'long', + _meta: { description: 'total number of kbn region layers in cluster' }, + }, + }, + kbn_tms_raster: { + min: { type: 'long', _meta: { description: 'min number of kbn tms layers per map' } }, + max: { type: 'long', _meta: { description: 'max number of kbn tms layers per map' } }, + avg: { + type: 'float', + _meta: { description: 'avg number of kbn tms layers per map' }, + }, + total: { + type: 'long', + _meta: { description: 'total number of kbn tms layers in cluster' }, + }, + }, + ux_tms_mvt: { + min: { type: 'long', _meta: { description: 'min number of ux tms-mvt layers per map' } }, + max: { type: 'long', _meta: { description: 'max number of ux tms-mvt layers per map' } }, + avg: { + type: 'float', + _meta: { description: 'avg number of ux tms-mvt layers per map' }, + }, + total: { + type: 'long', + _meta: { description: 'total number of ux tms-mvt layers in cluster' }, + }, + }, + ux_tms_raster: { + min: { + type: 'long', + _meta: { description: 'min number of ux tms-raster layers per map' }, + }, + max: { + type: 'long', + _meta: { description: 'max number of ux tms-raster layers per map' }, + }, + avg: { + type: 'float', + _meta: { description: 'avg number of ux tms-raster layers per map' }, + }, + total: { + type: 'long', + _meta: { description: 'total number of ux-tms raster layers in cluster' }, + }, + }, + ux_wms: { + min: { + type: 'long', + _meta: { description: 'min number of ux wms layers per map' }, + }, + max: { + type: 'long', + _meta: { description: 'max number of ux wms layers per map' }, + }, + avg: { + type: 'float', + _meta: { description: 'avg number of ux wms layers per map' }, + }, + total: { + type: 'long', + _meta: { description: 'total number of ux wms layers in cluster' }, + }, + }, + }, + scalingOptions: { + limit: { + min: { + type: 'long', + _meta: { description: 'min number of es doc layers with limit scaling option per map' }, + }, + max: { + type: 'long', + _meta: { description: 'max number of es doc layers with limit scaling option per map' }, + }, + avg: { + type: 'float', + _meta: { description: 'avg number of es doc layers with limit scaling option per map' }, + }, + total: { + type: 'long', + _meta: { + description: 'total number of es doc layers with limit scaling option in cluster', + }, + }, + }, + clusters: { + min: { + type: 'long', + _meta: { + description: 'min number of es doc layers with blended scaling option per map', + }, + }, + max: { + type: 'long', + _meta: { + description: 'max number of es doc layers with blended scaling option per map', + }, + }, + avg: { + type: 'float', + _meta: { + description: 'avg number of es doc layers with blended scaling option per map', + }, + }, + total: { + type: 'long', + _meta: { + description: 'total number of es doc layers with blended scaling option in cluster', + }, + }, + }, + mvt: { + min: { + type: 'long', + _meta: { description: 'min number of es doc layers with mvt scaling option per map' }, + }, + max: { + type: 'long', + _meta: { description: 'max number of es doc layers with mvt scaling option per map' }, + }, + avg: { + type: 'float', + _meta: { description: 'avg number of es doc layers with mvt scaling option per map' }, + }, + total: { + type: 'long', + _meta: { + description: 'total number of es doc layers with mvt scaling option in cluster', + }, + }, + }, + }, + joins: { + term: { + min: { + type: 'long', + _meta: { description: 'min number of layers with term joins per map' }, + }, + max: { + type: 'long', + _meta: { description: 'max number of layers with term joins per map' }, + }, + avg: { + type: 'float', + _meta: { description: 'avg number of layers with term joins per map' }, + }, + total: { + type: 'long', + _meta: { + description: 'total number of layers with term joins in cluster', + }, + }, + }, + }, + basemaps: { + auto: { + min: { + type: 'long', + _meta: { description: 'min number of ems basemap layers with auto-style per map' }, + }, + max: { + type: 'long', + _meta: { description: 'max number of ems basemap layers with auto-style per map' }, + }, + avg: { + type: 'float', + _meta: { description: 'avg number of ems basemap layers with auto-style per map' }, + }, + total: { + type: 'long', + _meta: { + description: 'total number of ems basemap layers with auto-style in cluster', + }, + }, + }, + dark: { + min: { + type: 'long', + _meta: { description: 'min number of ems basemap layers with dark-style per map' }, + }, + max: { + type: 'long', + _meta: { description: 'max number of ems basemap layers with dark-style per map' }, + }, + avg: { + type: 'float', + _meta: { description: 'avg number of ems basemap layers with dark-style per map' }, + }, + total: { + type: 'long', + _meta: { + description: 'total number of ems basemap layers with dark-style in cluster', + }, + }, + }, + roadmap: { + min: { + type: 'long', + _meta: { description: 'min number of ems basemap layers with roadmap-style per map' }, + }, + max: { + type: 'long', + _meta: { description: 'max number of ems basemap layers with roadmap-style per map' }, + }, + avg: { + type: 'float', + _meta: { description: 'avg number of ems basemap layers with roadmap-style per map' }, + }, + total: { + type: 'long', + _meta: { + description: 'total number of ems basemap layers with roadmap-style in cluster', + }, + }, + }, + roadmap_desaturated: { + min: { + type: 'long', + _meta: { + description: 'min number of ems basemap layers with desaturated-style per map', + }, + }, + max: { + type: 'long', + _meta: { + description: 'max number of ems basemap layers with desaturated-style per map', + }, + }, + avg: { + type: 'float', + _meta: { + description: 'avg number of ems basemap layers with desaturated-style per map', + }, + }, + total: { + type: 'long', + _meta: { + description: 'total number of ems basemap layers with desaturated-style in cluster', + }, + }, + }, + }, attributesPerMap: { dataSourcesCount: { min: { type: 'long' }, diff --git a/x-pack/plugins/maps/server/maps_telemetry/maps_telemetry.test.js b/x-pack/plugins/maps/server/maps_telemetry/maps_telemetry.test.js index 8725e672ec368..c9720063290b0 100644 --- a/x-pack/plugins/maps/server/maps_telemetry/maps_telemetry.test.js +++ b/x-pack/plugins/maps/server/maps_telemetry/maps_telemetry.test.js @@ -74,73 +74,136 @@ describe('buildMapsSavedObjectsTelemetry', () => { test('returns zeroed telemetry data when there are no saved objects', async () => { const result = buildMapsSavedObjectsTelemetry([]); - expect(result).toMatchObject({ - attributesPerMap: { - dataSourcesCount: { - avg: 0, - max: 0, - min: 0, - }, - emsVectorLayersCount: {}, - layerTypesCount: {}, - layersCount: { - avg: 0, - max: 0, - min: 0, - }, + expect(result.layerTypes).toEqual({}); + expect(result.scalingOptions).toEqual({}); + expect(result.joins).toEqual({}); + expect(result.basemaps).toEqual({}); + expect(result.attributesPerMap).toEqual({ + dataSourcesCount: { + avg: 0, + max: 0, + min: 0, + }, + emsVectorLayersCount: {}, + layerTypesCount: {}, + layersCount: { + avg: 0, + max: 0, + min: 0, }, - mapsTotalCount: 0, }); + expect(result.mapsTotalCount).toEqual(0); + expect(new Date(Date.parse(result.timeCaptured)).toISOString()).toEqual(result.timeCaptured); }); test('returns expected telemetry data from saved objects', async () => { const layerLists = getLayerLists(mapSavedObjects); const result = buildMapsSavedObjectsTelemetry(layerLists); - expect(result).toMatchObject({ - attributesPerMap: { - dataSourcesCount: { - avg: 2, - max: 3, + expect(result.layerTypes).toEqual({ + ems_basemap: { + avg: 0.6, + max: 1, + min: 1, + total: 3, + }, + ems_region: { + avg: 0.6, + max: 1, + min: 1, + total: 3, + }, + es_agg_clusters: { + avg: 0.4, + max: 1, + min: 1, + total: 2, + }, + es_agg_heatmap: { + avg: 0.2, + max: 1, + min: 1, + total: 1, + }, + es_docs: { + avg: 0.2, + max: 1, + min: 1, + total: 1, + }, + }); + expect(result.scalingOptions).toEqual({ + limit: { + avg: 0.2, + max: 1, + min: 1, + total: 1, + }, + }); + expect(result.joins).toEqual({ + term: { + avg: 0.2, + max: 1, + min: 1, + total: 1, + }, + }); + expect(result.basemaps).toEqual({ + roadmap: { + avg: 0.6, + max: 1, + min: 1, + total: 3, + }, + }); + expect(result.attributesPerMap).toEqual({ + dataSourcesCount: { + avg: 2, + max: 3, + min: 1, + }, + emsVectorLayersCount: { + canada_provinces: { + avg: 0.2, + max: 1, min: 1, }, - emsVectorLayersCount: { - canada_provinces: { - avg: 0.2, - max: 1, - min: 1, - }, - france_departments: { - avg: 0.2, - max: 1, - min: 1, - }, - italy_provinces: { - avg: 0.2, - max: 1, - min: 1, - }, + france_departments: { + avg: 0.2, + max: 1, + min: 1, }, - layerTypesCount: { - TILE: { - avg: 0.6, - max: 1, - min: 1, - }, - VECTOR: { - avg: 1.2, - max: 2, - min: 1, - }, + italy_provinces: { + avg: 0.2, + max: 1, + min: 1, }, - layersCount: { - avg: 2, - max: 3, + }, + layerTypesCount: { + HEATMAP: { + avg: 0.2, + max: 1, + min: 1, + }, + TILE: { + avg: 0.6, + max: 1, min: 1, }, + VECTOR: { + avg: 1.2, + max: 2, + min: 1, + }, + }, + layersCount: { + avg: 2, + max: 3, + min: 1, }, - mapsTotalCount: 5, }); + expect(result.mapsTotalCount).toEqual(5); + expect(new Date(Date.parse(result.timeCaptured)).toISOString()).toEqual(result.timeCaptured); }); test('returns expected telemetry data from index patterns', async () => { diff --git a/x-pack/plugins/maps/server/maps_telemetry/maps_telemetry.ts b/x-pack/plugins/maps/server/maps_telemetry/maps_telemetry.ts index 569f7e17896f2..d7a4bcf33ea3b 100644 --- a/x-pack/plugins/maps/server/maps_telemetry/maps_telemetry.ts +++ b/x-pack/plugins/maps/server/maps_telemetry/maps_telemetry.ts @@ -25,6 +25,16 @@ import { MapSavedObject, MapSavedObjectAttributes } from '../../common/map_saved import { getIndexPatternsService, getInternalRepository } from '../kibana_server_services'; import { MapsConfigType } from '../../config'; import { injectReferences } from '././../../common/migrations/references'; +import { + getBaseMapsPerCluster, + getScalingOptionsPerCluster, + getTelemetryLayerTypesPerCluster, + getTermJoinsPerCluster, + TELEMETRY_BASEMAP_COUNTS_PER_CLUSTER, + TELEMETRY_LAYER_TYPE_COUNTS_PER_CLUSTER, + TELEMETRY_SCALING_OPTION_COUNTS_PER_CLUSTER, + TELEMETRY_TERM_JOIN_COUNTS_PER_CLUSTER, +} from './util'; interface Settings { showMapVisualizationTypes: boolean; @@ -52,6 +62,10 @@ export interface GeoIndexPatternsUsage { export interface LayersStatsUsage { mapsTotalCount: number; timeCaptured: string; + layerTypes: TELEMETRY_LAYER_TYPE_COUNTS_PER_CLUSTER; + scalingOptions: TELEMETRY_SCALING_OPTION_COUNTS_PER_CLUSTER; + joins: TELEMETRY_TERM_JOIN_COUNTS_PER_CLUSTER; + basemaps: TELEMETRY_BASEMAP_COUNTS_PER_CLUSTER; attributesPerMap: { dataSourcesCount: { min: number; @@ -246,11 +260,20 @@ export function buildMapsSavedObjectsTelemetry(layerLists: LayerDescriptor[][]): const dataSourcesCountSum = _.sum(dataSourcesCount); const layersCountSum = _.sum(layersCount); + const telemetryLayerTypeCounts = getTelemetryLayerTypesPerCluster(layerLists); + const scalingOptions = getScalingOptionsPerCluster(layerLists); + const joins = getTermJoinsPerCluster(layerLists); + const basemaps = getBaseMapsPerCluster(layerLists); + return { // Total count of maps mapsTotalCount: mapsCount, // Time of capture timeCaptured: new Date().toISOString(), + layerTypes: telemetryLayerTypeCounts, + scalingOptions, + joins, + basemaps, attributesPerMap: { // Count of data sources per map dataSourcesCount: { diff --git a/x-pack/plugins/maps/server/maps_telemetry/test_resources/sample_map_saved_objects.json b/x-pack/plugins/maps/server/maps_telemetry/test_resources/sample_map_saved_objects.json index 82a8035c77dc7..3adaaaf091e08 100644 --- a/x-pack/plugins/maps/server/maps_telemetry/test_resources/sample_map_saved_objects.json +++ b/x-pack/plugins/maps/server/maps_telemetry/test_resources/sample_map_saved_objects.json @@ -21,7 +21,7 @@ "title": "France Map", "description": "", "mapStateJSON": "{\"zoom\":3.43,\"center\":{\"lon\":-16.30411,\"lat\":42.88411},\"timeFilters\":{\"from\":\"now-15w\",\"to\":\"now\"},\"refreshConfig\":{\"isPaused\":false,\"interval\":0},\"query\":{\"query\":\"\",\"language\":\"lucene\"}}", - "layerListJSON": "[{\"sourceDescriptor\":{\"type\":\"EMS_TMS\",\"id\":\"road_map\"},\"id\":\"csq5v\",\"label\":null,\"minZoom\":0,\"maxZoom\":24,\"alpha\":0.65,\"visible\":true,\"style\":{\"type\":\"TILE\",\"properties\":{}},\"type\":\"TILE\"},{\"sourceDescriptor\":{\"type\":\"EMS_FILE\",\"id\":\"france_departments\"},\"id\":\"65xbw\",\"label\":null,\"minZoom\":0,\"maxZoom\":24,\"alpha\":0.25,\"visible\":true,\"style\":{\"type\":\"VECTOR\",\"properties\":{\"fillColor\":{\"type\":\"STATIC\",\"options\":{\"color\":\"#19c1e6\"}},\"lineColor\":{\"type\":\"STATIC\",\"options\":{\"color\":\"#FFFFFF\"}},\"lineWidth\":{\"type\":\"STATIC\",\"options\":{\"size\":1}},\"iconSize\":{\"type\":\"STATIC\",\"options\":{\"size\":10}}}},\"type\":\"VECTOR\"},{\"sourceDescriptor\":{\"id\":\"240125db-e612-4001-b853-50107e55d984\",\"type\":\"ES_SEARCH\",\"indexPatternId\":\"ff959d40-b880-11e8-a6d9-e546fe2bba5f\",\"geoField\":\"geoip.location\",\"limit\":2048,\"filterByMapBounds\":true,\"tooltipProperties\":[]},\"id\":\"mdae9\",\"label\":null,\"minZoom\":0,\"maxZoom\":24,\"alpha\":0.75,\"visible\":true,\"style\":{\"type\":\"VECTOR\",\"properties\":{\"fillColor\":{\"type\":\"STATIC\",\"options\":{\"color\":\"#1ce619\"}},\"lineColor\":{\"type\":\"STATIC\",\"options\":{\"color\":\"#FFFFFF\"}},\"lineWidth\":{\"type\":\"STATIC\",\"options\":{\"size\":1}},\"iconSize\":{\"type\":\"STATIC\",\"options\":{\"size\":10}}}},\"type\":\"VECTOR\"}]", + "layerListJSON": "[{\"sourceDescriptor\":{\"type\":\"EMS_TMS\",\"id\":\"road_map\"},\"id\":\"csq5v\",\"label\":null,\"minZoom\":0,\"maxZoom\":24,\"alpha\":0.65,\"visible\":true,\"style\":{\"type\":\"TILE\",\"properties\":{}},\"type\":\"TILE\"},{\"sourceDescriptor\":{\"type\":\"EMS_FILE\",\"id\":\"france_departments\"},\"id\":\"65xbw\",\"label\":null,\"minZoom\":0,\"maxZoom\":24,\"alpha\":0.25,\"visible\":true,\"joins\":[{\"leftField\":\"iso_3166_2\",\"right\":{\"id\":\"6a263f96-7a96-4f5a-a00e-c89178c1d017\"}}],\"style\":{\"type\":\"VECTOR\",\"properties\":{\"fillColor\":{\"type\":\"STATIC\",\"options\":{\"color\":\"#19c1e6\"}},\"lineColor\":{\"type\":\"STATIC\",\"options\":{\"color\":\"#FFFFFF\"}},\"lineWidth\":{\"type\":\"STATIC\",\"options\":{\"size\":1}},\"iconSize\":{\"type\":\"STATIC\",\"options\":{\"size\":10}}}},\"type\":\"VECTOR\"},{\"sourceDescriptor\":{\"id\":\"240125db-e612-4001-b853-50107e55d984\",\"type\":\"ES_SEARCH\",\"scalingType\":\"LIMIT\",\"indexPatternId\":\"ff959d40-b880-11e8-a6d9-e546fe2bba5f\",\"geoField\":\"geoip.location\",\"limit\":2048,\"filterByMapBounds\":true,\"tooltipProperties\":[]},\"id\":\"mdae9\",\"label\":null,\"minZoom\":0,\"maxZoom\":24,\"alpha\":0.75,\"visible\":true,\"style\":{\"type\":\"VECTOR\",\"properties\":{\"fillColor\":{\"type\":\"STATIC\",\"options\":{\"color\":\"#1ce619\"}},\"lineColor\":{\"type\":\"STATIC\",\"options\":{\"color\":\"#FFFFFF\"}},\"lineWidth\":{\"type\":\"STATIC\",\"options\":{\"size\":1}},\"iconSize\":{\"type\":\"STATIC\",\"options\":{\"size\":10}}}},\"type\":\"VECTOR\"}]", "uiStateJSON": "{}" }, "references": [ diff --git a/x-pack/plugins/maps/server/maps_telemetry/util.ts b/x-pack/plugins/maps/server/maps_telemetry/util.ts new file mode 100644 index 0000000000000..c739f4a539e1e --- /dev/null +++ b/x-pack/plugins/maps/server/maps_telemetry/util.ts @@ -0,0 +1,296 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import { + EMSTMSSourceDescriptor, + ESGeoGridSourceDescriptor, + ESSearchSourceDescriptor, + LayerDescriptor, +} from '../../common/descriptor_types'; +import { LAYER_TYPE, RENDER_AS, SCALING_TYPES, SOURCE_TYPES } from '../../common'; +import { + DEFAULT_EMS_DARKMAP_ID, + DEFAULT_EMS_ROADMAP_DESATURATED_ID, + DEFAULT_EMS_ROADMAP_ID, +} from '../../../../../src/plugins/maps_ems/common/'; + +// lowercase is on purpose, so it matches lowercase es-field-names of the maps-telemetry schema +export enum TELEMETRY_LAYER_TYPE { + ES_DOCS = 'es_docs', + ES_TOP_HITS = 'es_top_hits', + ES_TRACKS = 'es_tracks', + ES_POINT_TO_POINT = 'es_point_to_point', + ES_AGG_CLUSTERS = 'es_agg_clusters', + ES_AGG_GRIDS = 'es_agg_grids', + ES_AGG_HEATMAP = 'es_agg_heatmap', + EMS_REGION = 'ems_region', + EMS_BASEMAP = 'ems_basemap', + KBN_REGION = 'kbn_region', + KBN_TMS_RASTER = 'kbn_tms_raster', + UX_TMS_RASTER = 'ux_tms_raster', // configured in the UX layer wizard of Maps + UX_TMS_MVT = 'ux_tms_mvt', // configured in the UX layer wizard of Maps + UX_WMS = 'ux_wms', // configured in the UX layer wizard of Maps +} + +interface ClusterCountStats { + min: number; + max: number; + total: number; + avg: number; +} + +export type TELEMETRY_LAYER_TYPE_COUNTS_PER_CLUSTER = { + [key in TELEMETRY_LAYER_TYPE]?: ClusterCountStats; +}; + +export enum TELEMETRY_EMS_BASEMAP_TYPES { + ROADMAP_DESATURATED = 'roadmap_desaturated', + ROADMAP = 'roadmap', + AUTO = 'auto', + DARK = 'dark', +} + +export type TELEMETRY_BASEMAP_COUNTS_PER_CLUSTER = { + [key in TELEMETRY_EMS_BASEMAP_TYPES]?: ClusterCountStats; +}; + +export enum TELEMETRY_SCALING_OPTIONS { + LIMIT = 'limit', + MVT = 'mvt', + CLUSTERS = 'clusters', +} + +export type TELEMETRY_SCALING_OPTION_COUNTS_PER_CLUSTER = { + [key in TELEMETRY_SCALING_OPTIONS]?: ClusterCountStats; +}; + +const TELEMETRY_TERM_JOIN = 'term'; +export interface TELEMETRY_TERM_JOIN_COUNTS_PER_CLUSTER { + [TELEMETRY_TERM_JOIN]?: ClusterCountStats; +} + +// These capture a particular "combo" of source and layer-settings. +// They are mutually exclusive (ie. a layerDescriptor can only be a single telemetry_layer_type) +// They are more useful from a telemetry-perspective than: +// - an actual SourceType (which does not say enough about how it looks on a map) +// - an actual LayerType (which is too coarse and does not say much about what kind of data) +export function getTelemetryLayerType( + layerDescriptor: LayerDescriptor +): TELEMETRY_LAYER_TYPE | null { + if (!layerDescriptor.sourceDescriptor) { + return null; + } + + if (layerDescriptor.type === LAYER_TYPE.HEATMAP) { + return TELEMETRY_LAYER_TYPE.ES_AGG_HEATMAP; + } + + if (layerDescriptor.sourceDescriptor.type === SOURCE_TYPES.EMS_FILE) { + return TELEMETRY_LAYER_TYPE.EMS_REGION; + } + + if (layerDescriptor.sourceDescriptor.type === SOURCE_TYPES.EMS_TMS) { + return TELEMETRY_LAYER_TYPE.EMS_BASEMAP; + } + + if (layerDescriptor.sourceDescriptor.type === SOURCE_TYPES.KIBANA_TILEMAP) { + return TELEMETRY_LAYER_TYPE.KBN_TMS_RASTER; + } + + if (layerDescriptor.sourceDescriptor.type === SOURCE_TYPES.REGIONMAP_FILE) { + return TELEMETRY_LAYER_TYPE.KBN_REGION; + } + + if (layerDescriptor.sourceDescriptor.type === SOURCE_TYPES.EMS_XYZ) { + return TELEMETRY_LAYER_TYPE.UX_TMS_RASTER; + } + + if (layerDescriptor.sourceDescriptor.type === SOURCE_TYPES.WMS) { + return TELEMETRY_LAYER_TYPE.UX_WMS; + } + + if (layerDescriptor.sourceDescriptor.type === SOURCE_TYPES.MVT_SINGLE_LAYER) { + return TELEMETRY_LAYER_TYPE.UX_TMS_MVT; + } + + if (layerDescriptor.sourceDescriptor.type === SOURCE_TYPES.ES_GEO_LINE) { + return TELEMETRY_LAYER_TYPE.ES_TRACKS; + } + + if (layerDescriptor.sourceDescriptor.type === SOURCE_TYPES.ES_PEW_PEW) { + return TELEMETRY_LAYER_TYPE.ES_POINT_TO_POINT; + } + + if (layerDescriptor.sourceDescriptor.type === SOURCE_TYPES.ES_SEARCH) { + const sourceDescriptor = layerDescriptor.sourceDescriptor as ESSearchSourceDescriptor; + + if (sourceDescriptor.scalingType === SCALING_TYPES.TOP_HITS) { + return TELEMETRY_LAYER_TYPE.ES_TOP_HITS; + } else { + return TELEMETRY_LAYER_TYPE.ES_DOCS; + } + } + + if (layerDescriptor.sourceDescriptor.type === SOURCE_TYPES.ES_GEO_GRID) { + const sourceDescriptor = layerDescriptor.sourceDescriptor as ESGeoGridSourceDescriptor; + if (sourceDescriptor.requestType === RENDER_AS.POINT) { + return TELEMETRY_LAYER_TYPE.ES_AGG_CLUSTERS; + } else if (sourceDescriptor.requestType === RENDER_AS.GRID) { + return TELEMETRY_LAYER_TYPE.ES_AGG_GRIDS; + } + } + + return null; +} + +function getScalingOption(layerDescriptor: LayerDescriptor): TELEMETRY_SCALING_OPTIONS | null { + if ( + !layerDescriptor.sourceDescriptor || + layerDescriptor.sourceDescriptor.type !== SOURCE_TYPES.ES_SEARCH || + !(layerDescriptor.sourceDescriptor as ESSearchSourceDescriptor).scalingType + ) { + return null; + } + + const descriptor = layerDescriptor.sourceDescriptor as ESSearchSourceDescriptor; + + if (descriptor.scalingType === SCALING_TYPES.CLUSTERS) { + return TELEMETRY_SCALING_OPTIONS.CLUSTERS; + } + + if (descriptor.scalingType === SCALING_TYPES.MVT) { + return TELEMETRY_SCALING_OPTIONS.MVT; + } + + if (descriptor.scalingType === SCALING_TYPES.LIMIT) { + return TELEMETRY_SCALING_OPTIONS.LIMIT; + } + + return null; +} + +export function getCountsByMap( + layerDescriptors: LayerDescriptor[], + mapToKey: (layerDescriptor: LayerDescriptor) => string | null +): { [key: string]: number } { + const counts: { [key: string]: number } = {}; + layerDescriptors.forEach((layerDescriptor: LayerDescriptor) => { + const scalingOption = mapToKey(layerDescriptor); + if (!scalingOption) { + return; + } + + if (!counts[scalingOption]) { + counts[scalingOption] = 1; + } else { + (counts[scalingOption] as number) += 1; + } + }); + return counts; +} + +export function getCountsByCluster( + layerLists: LayerDescriptor[][], + mapToKey: (layerDescriptor: LayerDescriptor) => string | null +): { [key: string]: ClusterCountStats } { + const counts = layerLists.map((layerDescriptors: LayerDescriptor[]) => { + return getCountsByMap(layerDescriptors, mapToKey); + }); + const clusterCounts: { [key: string]: ClusterCountStats } = {}; + + counts.forEach((count) => { + for (const key in count) { + if (!count.hasOwnProperty(key)) { + continue; + } + + if (!clusterCounts[key]) { + clusterCounts[key] = { + min: count[key] as number, + max: count[key] as number, + total: count[key] as number, + avg: count[key] as number, + }; + } else { + (clusterCounts[key] as ClusterCountStats).min = Math.min( + count[key] as number, + (clusterCounts[key] as ClusterCountStats).min + ); + (clusterCounts[key] as ClusterCountStats).max = Math.max( + count[key] as number, + (clusterCounts[key] as ClusterCountStats).max + ); + (clusterCounts[key] as ClusterCountStats).total = + (count[key] as number) + (clusterCounts[key] as ClusterCountStats).total; + } + } + }); + + for (const key in clusterCounts) { + if (clusterCounts.hasOwnProperty(key)) { + clusterCounts[key].avg = clusterCounts[key].total / layerLists.length; + } + } + + return clusterCounts; +} + +export function getScalingOptionsPerCluster(layerLists: LayerDescriptor[][]) { + return getCountsByCluster(layerLists, getScalingOption); +} + +export function getTelemetryLayerTypesPerCluster( + layerLists: LayerDescriptor[][] +): TELEMETRY_LAYER_TYPE_COUNTS_PER_CLUSTER { + return getCountsByCluster(layerLists, getTelemetryLayerType); +} + +export function getTermJoinsPerCluster( + layerLists: LayerDescriptor[][] +): TELEMETRY_TERM_JOIN_COUNTS_PER_CLUSTER { + return getCountsByCluster(layerLists, (layerDescriptor: LayerDescriptor) => { + return layerDescriptor.type === LAYER_TYPE.VECTOR && + layerDescriptor.joins && + layerDescriptor.joins.length + ? TELEMETRY_TERM_JOIN + : null; + }); +} + +export function getBaseMapsPerCluster( + layerLists: LayerDescriptor[][] +): TELEMETRY_BASEMAP_COUNTS_PER_CLUSTER { + return getCountsByCluster(layerLists, (layerDescriptor: LayerDescriptor) => { + if ( + !layerDescriptor.sourceDescriptor || + layerDescriptor.sourceDescriptor.type !== SOURCE_TYPES.EMS_TMS + ) { + return null; + } + + const descriptor = layerDescriptor.sourceDescriptor as EMSTMSSourceDescriptor; + + if (descriptor.isAutoSelect) { + return TELEMETRY_EMS_BASEMAP_TYPES.AUTO; + } + + // This needs to be hardcoded. + if (descriptor.id === DEFAULT_EMS_ROADMAP_ID) { + return TELEMETRY_EMS_BASEMAP_TYPES.ROADMAP; + } + + if (descriptor.id === DEFAULT_EMS_ROADMAP_DESATURATED_ID) { + return TELEMETRY_EMS_BASEMAP_TYPES.ROADMAP_DESATURATED; + } + + if (descriptor.id === DEFAULT_EMS_DARKMAP_ID) { + return TELEMETRY_EMS_BASEMAP_TYPES.DARK; + } + + return TELEMETRY_EMS_BASEMAP_TYPES.ROADMAP; + }); +} diff --git a/x-pack/plugins/ml/common/constants/alerts.ts b/x-pack/plugins/ml/common/constants/alerts.ts index 53b8fa7d5fea7..30daf0d45c3ac 100644 --- a/x-pack/plugins/ml/common/constants/alerts.ts +++ b/x-pack/plugins/ml/common/constants/alerts.ts @@ -47,3 +47,5 @@ export const ML_ALERT_TYPES_CONFIG: Record< }; export const ALERT_PREVIEW_SAMPLE_SIZE = 5; + +export const TOP_N_BUCKETS_COUNT = 1; diff --git a/x-pack/plugins/ml/common/types/alerts.ts b/x-pack/plugins/ml/common/types/alerts.ts index bbbb260409bd0..1677a766544a1 100644 --- a/x-pack/plugins/ml/common/types/alerts.ts +++ b/x-pack/plugins/ml/common/types/alerts.ts @@ -7,7 +7,7 @@ import { AnomalyResultType } from './anomalies'; import { ANOMALY_RESULT_TYPE } from '../constants/anomalies'; -import { AlertTypeParams } from '../../../alerting/common'; +import type { AlertTypeParams, Alert } from '../../../alerting/common'; export type PreviewResultsKeys = 'record_results' | 'bucket_results' | 'influencer_results'; export type TopHitsResultsKeys = 'top_record_hits' | 'top_bucket_hits' | 'top_influencer_hits'; @@ -25,6 +25,7 @@ export interface AlertExecutionResult { bucketRange: { start: string; end: string }; topRecords: RecordAnomalyAlertDoc[]; topInfluencers?: InfluencerAnomalyAlertDoc[]; + message: string; } export interface PreviewResponse { @@ -93,4 +94,17 @@ export type MlAnomalyDetectionAlertParams = { severity: number; resultType: AnomalyResultType; includeInterim: boolean; + lookbackInterval: string | null | undefined; + topNBuckets: number | null | undefined; } & AlertTypeParams; + +export type MlAnomalyDetectionAlertAdvancedSettings = Pick< + MlAnomalyDetectionAlertParams, + 'lookbackInterval' | 'topNBuckets' +>; + +export type MlAnomalyDetectionAlertRule = Omit, 'apiKey'>; + +export interface JobAlertingRuleStats { + alerting_rules?: MlAnomalyDetectionAlertRule[]; +} diff --git a/x-pack/plugins/ml/common/types/anomaly_detection_jobs/combined_job.ts b/x-pack/plugins/ml/common/types/anomaly_detection_jobs/combined_job.ts index 783d9f7c923bb..31f01679c4cd8 100644 --- a/x-pack/plugins/ml/common/types/anomaly_detection_jobs/combined_job.ts +++ b/x-pack/plugins/ml/common/types/anomaly_detection_jobs/combined_job.ts @@ -9,8 +9,9 @@ import { Datafeed } from './datafeed'; import { DatafeedStats } from './datafeed_stats'; import { Job } from './job'; import { JobStats } from './job_stats'; +import type { JobAlertingRuleStats } from '../alerts'; -export type JobWithStats = Job & JobStats; +export type JobWithStats = Job & JobStats & JobAlertingRuleStats; export type DatafeedWithStats = Datafeed & DatafeedStats; // in older implementations of the job config, the datafeed was placed inside the job diff --git a/x-pack/plugins/ml/common/types/anomaly_detection_jobs/datafeed.ts b/x-pack/plugins/ml/common/types/anomaly_detection_jobs/datafeed.ts index 5d7f3f934700b..2eb4242b7931e 100644 --- a/x-pack/plugins/ml/common/types/anomaly_detection_jobs/datafeed.ts +++ b/x-pack/plugins/ml/common/types/anomaly_detection_jobs/datafeed.ts @@ -5,48 +5,14 @@ * 2.0. */ -import type { estypes } from '@elastic/elasticsearch'; -// import { IndexPatternTitle } from '../kibana'; -// import { RuntimeMappings } from '../fields'; -// import { JobId } from './job'; +import { estypes } from '@elastic/elasticsearch'; + export type DatafeedId = string; export type Datafeed = estypes.Datafeed; -// export interface Datafeed extends estypes.DatafeedConfig { -// runtime_mappings?: RuntimeMappings; -// aggs?: Aggregation; -// } -// export interface Datafeed { -// datafeed_id: DatafeedId; -// aggregations?: Aggregation; -// aggs?: Aggregation; -// chunking_config?: ChunkingConfig; -// frequency?: string; -// indices: IndexPatternTitle[]; -// indexes?: IndexPatternTitle[]; // The datafeed can contain indexes and indices -// job_id: JobId; -// query: object; -// query_delay?: string; -// script_fields?: Record; -// runtime_mappings?: RuntimeMappings; -// scroll_size?: number; -// delayed_data_check_config?: object; -// indices_options?: IndicesOptions; -// } export type ChunkingConfig = estypes.ChunkingConfig; -// export interface ChunkingConfig { -// mode: 'auto' | 'manual' | 'off'; -// time_span?: string; -// } - export type Aggregation = Record; export type IndicesOptions = estypes.IndicesOptions; -// export interface IndicesOptions { -// expand_wildcards?: 'all' | 'open' | 'closed' | 'hidden' | 'none'; -// ignore_unavailable?: boolean; -// allow_no_indices?: boolean; -// ignore_throttled?: boolean; -// } diff --git a/x-pack/plugins/ml/common/types/anomaly_detection_jobs/datafeed_stats.ts b/x-pack/plugins/ml/common/types/anomaly_detection_jobs/datafeed_stats.ts index f13aa1843660e..dd0d3a5001f84 100644 --- a/x-pack/plugins/ml/common/types/anomaly_detection_jobs/datafeed_stats.ts +++ b/x-pack/plugins/ml/common/types/anomaly_detection_jobs/datafeed_stats.ts @@ -5,22 +5,6 @@ * 2.0. */ -import { Node } from './job_stats'; -import { DATAFEED_STATE } from '../../constants/states'; +import { estypes } from '@elastic/elasticsearch'; -export interface DatafeedStats { - datafeed_id: string; - state: DATAFEED_STATE; - node: Node; - assignment_explanation: string; - timing_stats: TimingStats; -} - -interface TimingStats { - job_id: string; - search_count: number; - bucket_count: number; - total_search_time_ms: number; - average_search_time_per_bucket_ms: number; - exponential_average_search_time_per_hour_ms: number; -} +export type DatafeedStats = estypes.DatafeedStats; diff --git a/x-pack/plugins/ml/common/types/anomaly_detection_jobs/job.ts b/x-pack/plugins/ml/common/types/anomaly_detection_jobs/job.ts index 5e1d5e009a764..68544e7cb828f 100644 --- a/x-pack/plugins/ml/common/types/anomaly_detection_jobs/job.ts +++ b/x-pack/plugins/ml/common/types/anomaly_detection_jobs/job.ts @@ -6,103 +6,27 @@ */ import { estypes } from '@elastic/elasticsearch'; -import { UrlConfig } from '../custom_urls'; -import { CREATED_BY_LABEL } from '../../constants/new_job'; export type JobId = string; export type BucketSpan = string; -export interface CustomSettings { - custom_urls?: UrlConfig[]; - created_by?: CREATED_BY_LABEL; - job_tags?: { - [tag: string]: string; - }; -} - export type Job = estypes.Job; -// export interface Job { -// job_id: JobId; -// analysis_config: AnalysisConfig; -// analysis_limits?: AnalysisLimits; -// background_persist_interval?: string; -// custom_settings?: CustomSettings; -// data_description: DataDescription; -// description: string; -// groups: string[]; -// model_plot_config?: ModelPlotConfig; -// model_snapshot_retention_days?: number; -// daily_model_snapshot_retention_after_days?: number; -// renormalization_window_days?: number; -// results_index_name?: string; -// results_retention_days?: number; - -// // optional properties added when the job has been created -// create_time?: number; -// finished_time?: number; -// job_type?: 'anomaly_detector'; -// job_version?: string; -// model_snapshot_id?: string; -// deleting?: boolean; -// } export type AnalysisConfig = estypes.AnalysisConfig; -// export interface AnalysisConfig { -// bucket_span: BucketSpan; -// categorization_field_name?: string; -// categorization_filters?: string[]; -// categorization_analyzer?: object | string; -// detectors: Detector[]; -// influencers: string[]; -// latency?: number; -// multivariate_by_fields?: boolean; -// summary_count_field_name?: string; -// per_partition_categorization?: PerPartitionCategorization; -// } export type Detector = estypes.Detector; -// export interface Detector { -// by_field_name?: string; -// detector_description?: string; -// detector_index?: number; -// exclude_frequent?: string; -// field_name?: string; -// function: string; -// over_field_name?: string; -// partition_field_name?: string; -// use_null?: boolean; -// custom_rules?: CustomRule[]; -// } export type AnalysisLimits = estypes.AnalysisLimits; -// export interface AnalysisLimits { -// categorization_examples_limit?: number; -// model_memory_limit: string; -// } export type DataDescription = estypes.DataDescription; -// export interface DataDescription { -// format?: string; -// time_field: string; -// time_format?: string; -// } export type ModelPlotConfig = estypes.ModelPlotConfig; -// export interface ModelPlotConfig { -// enabled?: boolean; -// annotations_enabled?: boolean; -// terms?: string; -// } export type CustomRule = estypes.DetectionRule; -// TODO, finish this when it's needed -// export interface CustomRule { -// actions: string[]; -// scope?: object; -// conditions: any[]; -// } export interface PerPartitionCategorization { enabled?: boolean; stop_on_warn?: boolean; } + +export type CustomSettings = estypes.CustomSettings; diff --git a/x-pack/plugins/ml/common/types/anomaly_detection_jobs/job_stats.ts b/x-pack/plugins/ml/common/types/anomaly_detection_jobs/job_stats.ts index 1fd69d0c5f0b1..a53f1f2486699 100644 --- a/x-pack/plugins/ml/common/types/anomaly_detection_jobs/job_stats.ts +++ b/x-pack/plugins/ml/common/types/anomaly_detection_jobs/job_stats.ts @@ -5,93 +5,25 @@ * 2.0. */ -import { JOB_STATE } from '../../constants/states'; +import { estypes } from '@elastic/elasticsearch'; -export interface JobStats { - job_id: string; - data_counts: DataCounts; +export type JobStats = estypes.JobStats & { model_size_stats: ModelSizeStats; - forecasts_stats: ForecastsStats; - state: JOB_STATE; - node: Node; - assignment_explanation: string; - open_time: string; timing_stats: TimingStats; -} +}; -export interface DataCounts { - job_id: string; - processed_record_count: number; - processed_field_count: number; - input_bytes: number; - input_field_count: number; - invalid_date_count: number; - missing_field_count: number; - out_of_order_timestamp_count: number; - empty_bucket_count: number; - sparse_bucket_count: number; - bucket_count: number; - earliest_record_timestamp: number; - latest_record_timestamp: number; - last_data_time: number; - input_record_count: number; - latest_empty_bucket_timestamp: number; - latest_sparse_bucket_timestamp: number; - latest_bucket_timestamp?: number; // stat added by the UI -} +export type DataCounts = estypes.DataCounts; -export interface ModelSizeStats { - job_id: string; - result_type: string; - model_bytes: number; +export type ModelSizeStats = estypes.ModelSizeStats & { model_bytes_exceeded: number; model_bytes_memory_limit: number; peak_model_bytes?: number; - total_by_field_count: number; - total_over_field_count: number; - total_partition_field_count: number; - bucket_allocation_failures_count: number; - memory_status: 'ok' | 'soft_limit' | 'hard_limit'; - categorized_doc_count: number; - total_category_count: number; - frequent_category_count: number; - rare_category_count: number; - dead_category_count: number; - categorization_status: 'ok' | 'warn'; - log_time: number; - timestamp: number; -} +}; -export interface ForecastsStats { - total: number; - forecasted_jobs: number; - memory_bytes?: any; - records?: any; - processing_time_ms?: any; - status?: any; -} +export type TimingStats = estypes.TimingStats & { + total_bucket_processing_time_ms: number; +}; -export interface Node { - id: string; - name: string; - ephemeral_id: string; - transport_address: string; - attributes: { - 'transform.remote_connect'?: boolean; - 'ml.machine_memory'?: number; - 'xpack.installed'?: boolean; - 'transform.node'?: boolean; - 'ml.max_open_jobs'?: number; - }; -} +export type ForecastsStats = estypes.JobForecastStatistics; -interface TimingStats { - job_id: string; - bucket_count: number; - total_bucket_processing_time_ms: number; - minimum_bucket_processing_time_ms: number; - maximum_bucket_processing_time_ms: number; - average_bucket_processing_time_ms: number; - exponential_average_bucket_processing_time_ms: number; - exponential_average_bucket_processing_time_per_hour_ms: number; -} +export type Node = estypes.DiscoveryNode; diff --git a/x-pack/plugins/ml/common/types/anomaly_detection_jobs/summary_job.ts b/x-pack/plugins/ml/common/types/anomaly_detection_jobs/summary_job.ts index 09f5c37ac9aea..624056fdf3b82 100644 --- a/x-pack/plugins/ml/common/types/anomaly_detection_jobs/summary_job.ts +++ b/x-pack/plugins/ml/common/types/anomaly_detection_jobs/summary_job.ts @@ -8,6 +8,7 @@ import { Moment } from 'moment'; import { CombinedJob, CombinedJobWithStats } from './combined_job'; +import { MlAnomalyDetectionAlertRule } from '../alerts'; export { Datafeed } from './datafeed'; export { DatafeedStats } from './datafeed_stats'; @@ -34,6 +35,7 @@ export interface MlSummaryJob { latestTimestampSortValue?: number; earliestStartTimestampMs?: number; awaitingNodeAssignment: boolean; + alertingRules?: MlAnomalyDetectionAlertRule[]; } export interface AuditMessage { diff --git a/x-pack/plugins/ml/common/types/capabilities.ts b/x-pack/plugins/ml/common/types/capabilities.ts index 129b496c00149..1e6a76caf70e9 100644 --- a/x-pack/plugins/ml/common/types/capabilities.ts +++ b/x-pack/plugins/ml/common/types/capabilities.ts @@ -30,6 +30,8 @@ export const userMlCapabilities = { canGetAnnotations: false, canCreateAnnotation: false, canDeleteAnnotation: false, + // Alerts + canUseMlAlerts: false, }; export const adminMlCapabilities = { @@ -59,6 +61,7 @@ export const adminMlCapabilities = { canStartStopDataFrameAnalytics: false, // Alerts canCreateMlAlerts: false, + canUseMlAlerts: false, }; export type UserMlCapabilities = typeof userMlCapabilities; diff --git a/x-pack/plugins/ml/common/types/storage.ts b/x-pack/plugins/ml/common/types/storage.ts index f8ffc4aec122e..2750acf981ca8 100644 --- a/x-pack/plugins/ml/common/types/storage.ts +++ b/x-pack/plugins/ml/common/types/storage.ts @@ -9,6 +9,8 @@ import { EntityFieldType } from './anomalies'; export const ML_ENTITY_FIELDS_CONFIG = 'ml.singleMetricViewer.partitionFields'; +export const ML_APPLY_TIME_RANGE_CONFIG = 'ml.jobSelectorFlyout.applyTimeRange'; + export type PartitionFieldConfig = | { /** @@ -34,6 +36,9 @@ export type PartitionFieldsConfig = | Partial> | undefined; +export type ApplyTimeRangeConfig = boolean | undefined; + export type MlStorage = Partial<{ [ML_ENTITY_FIELDS_CONFIG]: PartitionFieldsConfig; + [ML_APPLY_TIME_RANGE_CONFIG]: ApplyTimeRangeConfig; }> | null; diff --git a/x-pack/plugins/ml/common/util/alerts.test.ts b/x-pack/plugins/ml/common/util/alerts.test.ts new file mode 100644 index 0000000000000..d9896c967165b --- /dev/null +++ b/x-pack/plugins/ml/common/util/alerts.test.ts @@ -0,0 +1,78 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import { getLookbackInterval, resolveLookbackInterval } from './alerts'; +import type { CombinedJobWithStats, Datafeed, Job } from '../types/anomaly_detection_jobs'; + +describe('resolveLookbackInterval', () => { + test('resolves interval for bucket spans bigger than 1m', () => { + const testJobs = [ + { + analysis_config: { + bucket_span: '15m', + }, + }, + ] as Job[]; + + const testDatafeeds = [ + { + query_delay: '65630ms', + }, + ] as Datafeed[]; + + expect(resolveLookbackInterval(testJobs, testDatafeeds)).toBe('32m'); + }); + + test('resolves interval for bucket spans smaller than 1m', () => { + const testJobs = [ + { + analysis_config: { + bucket_span: '50s', + }, + }, + ] as Job[]; + + const testDatafeeds = [ + { + query_delay: '20s', + }, + ] as Datafeed[]; + + expect(resolveLookbackInterval(testJobs, testDatafeeds)).toBe('3m'); + }); + + test('resolves interval for bucket spans smaller than 1m without query dealay', () => { + const testJobs = [ + { + analysis_config: { + bucket_span: '59s', + }, + }, + ] as Job[]; + + const testDatafeeds = [{}] as Datafeed[]; + + expect(resolveLookbackInterval(testJobs, testDatafeeds)).toBe('3m'); + }); +}); + +describe('getLookbackInterval', () => { + test('resolves interval for bucket spans bigger than 1m', () => { + const testJobs = [ + { + analysis_config: { + bucket_span: '15m', + }, + datafeed_config: { + query_delay: '65630ms', + }, + }, + ] as CombinedJobWithStats[]; + + expect(getLookbackInterval(testJobs)).toBe('32m'); + }); +}); diff --git a/x-pack/plugins/ml/common/util/alerts.ts b/x-pack/plugins/ml/common/util/alerts.ts new file mode 100644 index 0000000000000..5d68677d4fb97 --- /dev/null +++ b/x-pack/plugins/ml/common/util/alerts.ts @@ -0,0 +1,53 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import { CombinedJobWithStats, Datafeed, Job } from '../types/anomaly_detection_jobs'; +import { resolveMaxTimeInterval } from './job_utils'; +import { isDefined } from '../types/guards'; +import { parseInterval } from './parse_interval'; + +const narrowBucketLength = 60; + +/** + * Resolves the lookback interval for the rule + * using the formula max(2m, 2 * bucket_span) + query_delay + 1s. + * and rounds up to a whole number of minutes. + */ +export function resolveLookbackInterval(jobs: Job[], datafeeds: Datafeed[]): string { + const bucketSpanInSeconds = Math.ceil( + resolveMaxTimeInterval(jobs.map((v) => v.analysis_config.bucket_span)) ?? 0 + ); + const queryDelayInSeconds = Math.ceil( + resolveMaxTimeInterval(datafeeds.map((v) => v.query_delay).filter(isDefined)) ?? 0 + ); + + const result = + Math.max(2 * narrowBucketLength, 2 * bucketSpanInSeconds) + queryDelayInSeconds + 1; + + return `${Math.ceil(result / 60)}m`; +} + +/** + * @deprecated We should avoid using {@link CombinedJobWithStats}. Replace usages with {@link resolveLookbackInterval} when + * Kibana API returns mapped job and the datafeed configs. + */ +export function getLookbackInterval(jobs: CombinedJobWithStats[]): string { + return resolveLookbackInterval( + jobs, + jobs.map((v) => v.datafeed_config) + ); +} + +export function getTopNBuckets(job: Job): number { + const bucketSpan = parseInterval(job.analysis_config.bucket_span); + + if (bucketSpan === null) { + throw new Error('Unable to resolve a bucket span length'); + } + + return Math.ceil(narrowBucketLength / bucketSpan.asSeconds()); +} diff --git a/x-pack/plugins/ml/common/util/job_utils.test.ts b/x-pack/plugins/ml/common/util/job_utils.test.ts index 59f8c8a4dae3a..4f5877703b8e3 100644 --- a/x-pack/plugins/ml/common/util/job_utils.test.ts +++ b/x-pack/plugins/ml/common/util/job_utils.test.ts @@ -20,7 +20,7 @@ import { getSafeAggregationName, getLatestDataOrBucketTimestamp, getEarliestDatafeedStartTime, - resolveBucketSpanInSeconds, + resolveMaxTimeInterval, } from './job_utils'; import { CombinedJob, Job } from '../types/anomaly_detection_jobs'; import moment from 'moment'; @@ -606,7 +606,10 @@ describe('ML - job utils', () => { describe('resolveBucketSpanInSeconds', () => { test('should resolve maximum bucket interval', () => { - expect(resolveBucketSpanInSeconds(['15m', '1h', '6h', '90s'])).toBe(21600); + expect(resolveMaxTimeInterval(['15m', '1h', '6h', '90s'])).toBe(21600); + }); + test('returns undefined for an empty array', () => { + expect(resolveMaxTimeInterval([])).toBe(undefined); }); }); }); diff --git a/x-pack/plugins/ml/common/util/job_utils.ts b/x-pack/plugins/ml/common/util/job_utils.ts index da340d4413849..7e6d84f9efed7 100644 --- a/x-pack/plugins/ml/common/util/job_utils.ts +++ b/x-pack/plugins/ml/common/util/job_utils.ts @@ -8,7 +8,7 @@ import { each, isEmpty, isEqual, pick } from 'lodash'; import semverGte from 'semver/functions/gte'; import moment, { Duration } from 'moment'; -import type { estypes } from '@elastic/elasticsearch'; +import { estypes } from '@elastic/elasticsearch'; // @ts-ignore import numeral from '@elastic/numeral'; import { i18n } from '@kbn/i18n'; @@ -819,7 +819,7 @@ export function getLatestDataOrBucketTimestamp( * in the job wizards and so would be lost in a clone. */ export function processCreatedBy(customSettings: CustomSettings) { - if (Object.values(CREATED_BY_LABEL).includes(customSettings.created_by!)) { + if (Object.values(CREATED_BY_LABEL).includes(customSettings.created_by as CREATED_BY_LABEL)) { delete customSettings.created_by; } } @@ -831,14 +831,16 @@ export function splitIndexPatternNames(indexPatternName: string): string[] { } /** - * Resolves the longest bucket span from the list. - * @param bucketSpans Collection of bucket spans + * Resolves the longest time interval from the list. + * @param timeIntervals Collection of the strings representing time intervals, e.g. ['15m', '1h', '2d'] */ -export function resolveBucketSpanInSeconds(bucketSpans: string[]): number { - return Math.max( - ...bucketSpans +export function resolveMaxTimeInterval(timeIntervals: string[]): number | undefined { + const result = Math.max( + ...timeIntervals .map((b) => parseInterval(b)) .filter(isDefined) .map((v) => v.asSeconds()) ); + + return Number.isFinite(result) ? result : undefined; } diff --git a/x-pack/plugins/ml/common/util/runtime_field_utils.test.ts b/x-pack/plugins/ml/common/util/runtime_field_utils.test.ts index 1b5e3e18b14f6..e7f9230666898 100644 --- a/x-pack/plugins/ml/common/util/runtime_field_utils.test.ts +++ b/x-pack/plugins/ml/common/util/runtime_field_utils.test.ts @@ -77,15 +77,15 @@ describe('ML runtime field utils', () => { ).toBe(false); }); - it('allows object with most basic runtime mapping', () => { + it('allows object with most basic runtime field', () => { expect(isRuntimeMappings({ fieldName: { type: 'keyword' } })).toBe(true); }); - it('allows object with multiple most basic runtime mappings', () => { + it('allows object with multiple most basic runtime fields', () => { expect( isRuntimeMappings({ fieldName1: { type: 'keyword' }, fieldName2: { type: 'keyword' } }) ).toBe(true); }); - it('allows object with runtime mappings including scripts', () => { + it('allows object with runtime fields including scripts', () => { expect( isRuntimeMappings({ fieldName1: { type: 'keyword' }, diff --git a/x-pack/plugins/ml/common/util/validators.ts b/x-pack/plugins/ml/common/util/validators.ts index b52e82495a76c..0936efbcb00fc 100644 --- a/x-pack/plugins/ml/common/util/validators.ts +++ b/x-pack/plugins/ml/common/util/validators.ts @@ -7,6 +7,7 @@ import { ALLOWED_DATA_UNITS } from '../constants/validation'; import { parseInterval } from './parse_interval'; +import { isPopulatedObject } from './object_utils'; /** * Provides a validator function for maximum allowed input length. @@ -85,6 +86,10 @@ export function memoryInputValidator(allowedUnits = ALLOWED_DATA_UNITS) { export function timeIntervalInputValidator() { return (value: string) => { + if (value === '') { + return null; + } + const r = parseInterval(value); if (r === null) { return { @@ -95,3 +100,32 @@ export function timeIntervalInputValidator() { return null; }; } + +export interface NumberValidationResult { + min: boolean; + max: boolean; +} + +export function numberValidator(conditions?: { min?: number; max?: number }) { + if ( + conditions?.min !== undefined && + conditions.max !== undefined && + conditions.min > conditions.max + ) { + throw new Error('Invalid validator conditions'); + } + + return (value: number): NumberValidationResult | null => { + const result = {} as NumberValidationResult; + if (conditions?.min !== undefined && value < conditions.min) { + result.min = true; + } + if (conditions?.max !== undefined && value > conditions.max) { + result.max = true; + } + if (isPopulatedObject(result)) { + return result; + } + return null; + }; +} diff --git a/x-pack/plugins/ml/kibana.json b/x-pack/plugins/ml/kibana.json index 4955c1af5674d..6804b3f52b52a 100644 --- a/x-pack/plugins/ml/kibana.json +++ b/x-pack/plugins/ml/kibana.json @@ -10,7 +10,7 @@ "data", "cloud", "features", - "fileUpload", + "fileDataVisualizer", "licensing", "share", "embeddable", @@ -28,7 +28,8 @@ "management", "licenseManagement", "maps", - "lens" + "lens", + "usageCollection" ], "server": true, "ui": true, diff --git a/x-pack/plugins/ml/public/__mocks__/ml_start_deps.ts b/x-pack/plugins/ml/public/__mocks__/ml_start_deps.ts index 77381c8728a48..ad47e84319e4a 100644 --- a/x-pack/plugins/ml/public/__mocks__/ml_start_deps.ts +++ b/x-pack/plugins/ml/public/__mocks__/ml_start_deps.ts @@ -24,5 +24,5 @@ export const createMlStartDepsMock = () => ({ maps: jest.fn(), lens: lensPluginMock.createStartContract(), triggersActionsUi: triggersActionsUiMock.createStart(), - fileUpload: jest.fn(), + fileDataVisualizer: jest.fn(), }); diff --git a/x-pack/plugins/ml/public/alerting/advanced_settings.tsx b/x-pack/plugins/ml/public/alerting/advanced_settings.tsx new file mode 100644 index 0000000000000..05ce3c13215b3 --- /dev/null +++ b/x-pack/plugins/ml/public/alerting/advanced_settings.tsx @@ -0,0 +1,117 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import React, { FC } from 'react'; +import { FormattedMessage } from '@kbn/i18n/react'; +import { + EuiAccordion, + EuiDescribedFormGroup, + EuiFieldNumber, + EuiFormRow, + EuiHorizontalRule, + EuiSpacer, + EuiText, +} from '@elastic/eui'; +import { MlAnomalyDetectionAlertAdvancedSettings } from '../../common/types/alerts'; +import { TimeIntervalControl } from './time_interval_control'; +import { TOP_N_BUCKETS_COUNT } from '../../common/constants/alerts'; + +interface AdvancedSettingsProps { + value: MlAnomalyDetectionAlertAdvancedSettings; + onChange: (update: Partial) => void; +} + +export const AdvancedSettings: FC = React.memo(({ value, onChange }) => { + return ( + + } + data-test-subj={'mlAnomalyAlertAdvancedSettingsTrigger'} + > + + + + + } + description={ + + + + } + > + + } + onChange={(update) => { + onChange({ lookbackInterval: update }); + }} + data-test-subj={'mlAnomalyAlertLookbackInterval'} + /> + + + + + + } + description={ + + + + } + > + + } + > + { + onChange({ topNBuckets: Number(e.target.value) }); + }} + data-test-subj={'mlAnomalyAlertTopNBuckets'} + /> + + + + + ); +}); diff --git a/x-pack/plugins/ml/public/alerting/config_validator.tsx b/x-pack/plugins/ml/public/alerting/config_validator.tsx index 5881a3b36dcbd..5a834ab14dd35 100644 --- a/x-pack/plugins/ml/public/alerting/config_validator.tsx +++ b/x-pack/plugins/ml/public/alerting/config_validator.tsx @@ -5,40 +5,35 @@ * 2.0. */ -import React, { FC, useMemo } from 'react'; +import React, { FC } from 'react'; import { FormattedMessage } from '@kbn/i18n/react'; import { EuiCallOut, EuiSpacer } from '@elastic/eui'; import { parseInterval } from '../../common/util/parse_interval'; import { CombinedJobWithStats } from '../../common/types/anomaly_detection_jobs'; import { DATAFEED_STATE } from '../../common/constants/states'; -import { resolveBucketSpanInSeconds } from '../../common/util/job_utils'; +import { MlAnomalyDetectionAlertParams } from '../../common/types/alerts'; interface ConfigValidatorProps { alertInterval: string; jobConfigs: CombinedJobWithStats[]; + alertParams: MlAnomalyDetectionAlertParams; } /** * Validated alert configuration */ export const ConfigValidator: FC = React.memo( - ({ jobConfigs = [], alertInterval }) => { - const resultBucketSpanInSeconds = useMemo( - () => resolveBucketSpanInSeconds(jobConfigs.map((v) => v.analysis_config.bucket_span)), - [jobConfigs] - ); - - const resultBucketSpanString = - resultBucketSpanInSeconds % 60 === 0 - ? `${resultBucketSpanInSeconds / 60}m` - : `${resultBucketSpanInSeconds}s`; - + ({ jobConfigs = [], alertInterval, alertParams }) => { if (jobConfigs.length === 0) return null; const alertIntervalInSeconds = parseInterval(alertInterval)!.asSeconds(); - const isAlertIntervalTooHigh = resultBucketSpanInSeconds < alertIntervalInSeconds; + const lookbackIntervalInSeconds = + !!alertParams.lookbackInterval && parseInterval(alertParams.lookbackInterval)?.asSeconds(); + + const isAlertIntervalTooHigh = + lookbackIntervalInSeconds && lookbackIntervalInSeconds < alertIntervalInSeconds; const jobWithoutStartedDatafeed = jobConfigs .filter((job) => job.datafeed_config.state !== DATAFEED_STATE.STARTED) @@ -66,9 +61,9 @@ export const ConfigValidator: FC = React.memo(
  • diff --git a/x-pack/plugins/ml/public/alerting/index.ts b/x-pack/plugins/ml/public/alerting/index.ts new file mode 100644 index 0000000000000..584110ff39c9e --- /dev/null +++ b/x-pack/plugins/ml/public/alerting/index.ts @@ -0,0 +1,8 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +export { registerMlAlerts } from './register_ml_alerts'; diff --git a/x-pack/plugins/ml/public/alerting/job_selector.tsx b/x-pack/plugins/ml/public/alerting/job_selector.tsx index 11dd8362fd443..da353b52ef1c0 100644 --- a/x-pack/plugins/ml/public/alerting/job_selector.tsx +++ b/x-pack/plugins/ml/public/alerting/job_selector.tsx @@ -66,12 +66,6 @@ export const JobSelectorControl: FC = ({ }), options: jobIdOptions.map((v) => ({ label: v })), }, - { - label: i18n.translate('xpack.ml.jobSelector.groupOptionsLabel', { - defaultMessage: 'Groups', - }), - options: groupIdOptions.map((v) => ({ label: v })), - }, ]); } catch (e) { // TODO add error handling @@ -114,6 +108,7 @@ export const JobSelectorControl: FC = ({ error={errors} > + singleSelection selectedOptions={selectedOptions} options={options} onChange={onSelectionChange} diff --git a/x-pack/plugins/ml/public/alerting/ml_alerting_flyout.tsx b/x-pack/plugins/ml/public/alerting/ml_alerting_flyout.tsx index 989cecf1da19c..dac1fad72255c 100644 --- a/x-pack/plugins/ml/public/alerting/ml_alerting_flyout.tsx +++ b/x-pack/plugins/ml/public/alerting/ml_alerting_flyout.tsx @@ -6,24 +6,30 @@ */ import React, { FC, useCallback, useEffect, useMemo, useState } from 'react'; +import { EuiButtonEmpty } from '@elastic/eui'; import { JobId } from '../../common/types/anomaly_detection_jobs'; import { useMlKibana } from '../application/contexts/kibana'; import { ML_ALERT_TYPES } from '../../common/constants/alerts'; import { PLUGIN_ID } from '../../common/constants/app'; +import { MlAnomalyDetectionAlertRule } from '../../common/types/alerts'; interface MlAnomalyAlertFlyoutProps { - jobIds: JobId[]; + initialAlert?: MlAnomalyDetectionAlertRule; + jobIds?: JobId[]; onSave?: () => void; onCloseFlyout: () => void; } /** * Invoke alerting flyout from the ML plugin context. + * @param initialAlert * @param jobIds * @param onCloseFlyout + * @param onSave * @constructor */ export const MlAnomalyAlertFlyout: FC = ({ + initialAlert, jobIds, onCloseFlyout, onSave, @@ -32,35 +38,45 @@ export const MlAnomalyAlertFlyout: FC = ({ services: { triggersActionsUi }, } = useMlKibana(); - const AddAlertFlyout = useMemo( - () => - triggersActionsUi && - triggersActionsUi.getAddAlertFlyout({ - consumer: PLUGIN_ID, - onClose: () => { - onCloseFlyout(); - }, - // Callback for successful save - onSave: async () => { - if (onSave) { - onSave(); - } - }, - canChangeTrigger: false, - alertTypeId: ML_ALERT_TYPES.ANOMALY_DETECTION, - metadata: {}, - initialValues: { - params: { - jobSelection: { - jobIds, - }, + const AlertFlyout = useMemo(() => { + if (!triggersActionsUi) return; + + const commonProps = { + onClose: () => { + onCloseFlyout(); + }, + onSave: async () => { + if (onSave) { + onSave(); + } + }, + }; + + if (initialAlert) { + return triggersActionsUi.getEditAlertFlyout({ + ...commonProps, + initialAlert, + }); + } + + return triggersActionsUi.getAddAlertFlyout({ + ...commonProps, + consumer: PLUGIN_ID, + canChangeTrigger: false, + alertTypeId: ML_ALERT_TYPES.ANOMALY_DETECTION, + metadata: {}, + initialValues: { + params: { + jobSelection: { + jobIds, }, }, - }), - [triggersActionsUi] - ); + }, + }); + // deps on id to avoid re-rendering on auto-refresh + }, [triggersActionsUi, initialAlert?.id, jobIds]); - return <>{AddAlertFlyout}; + return <>{AlertFlyout}; }; interface JobListMlAnomalyAlertFlyoutProps { @@ -103,3 +119,26 @@ export const JobListMlAnomalyAlertFlyout: FC = /> ) : null; }; + +interface EditRuleFlyoutProps { + initialAlert: MlAnomalyDetectionAlertRule; +} + +export const EditAlertRule: FC = ({ initialAlert }) => { + const [isVisible, setIsVisible] = useState(false); + return ( + <> + + {initialAlert.name} + + + {isVisible ? ( + + ) : null} + + ); +}; diff --git a/x-pack/plugins/ml/public/alerting/ml_anomaly_alert_trigger.tsx b/x-pack/plugins/ml/public/alerting/ml_anomaly_alert_trigger.tsx index 89804813a4eda..3c8ee6bf4899f 100644 --- a/x-pack/plugins/ml/public/alerting/ml_anomaly_alert_trigger.tsx +++ b/x-pack/plugins/ml/public/alerting/ml_anomaly_alert_trigger.tsx @@ -18,11 +18,17 @@ import { ResultTypeSelector } from './result_type_selector'; import { alertingApiProvider } from '../application/services/ml_api_service/alerting'; import { PreviewAlertCondition } from './preview_alert_condition'; import { ANOMALY_THRESHOLD } from '../../common'; -import { MlAnomalyDetectionAlertParams } from '../../common/types/alerts'; +import { + MlAnomalyDetectionAlertAdvancedSettings, + MlAnomalyDetectionAlertParams, +} from '../../common/types/alerts'; import { ANOMALY_RESULT_TYPE } from '../../common/constants/anomalies'; import { InterimResultsControl } from './interim_results_control'; import { ConfigValidator } from './config_validator'; import { CombinedJobWithStats } from '../../common/types/anomaly_detection_jobs'; +import { AdvancedSettings } from './advanced_settings'; +import { getLookbackInterval, getTopNBuckets } from '../../common/util/alerts'; +import { isDefined } from '../../common/types/guards'; interface MlAnomalyAlertTriggerProps { alertParams: MlAnomalyDetectionAlertParams; @@ -114,6 +120,28 @@ const MlAnomalyAlertTrigger: FC = ({ } }); + const advancedSettings = useMemo(() => { + let { lookbackInterval, topNBuckets } = alertParams; + + if (!isDefined(lookbackInterval) && jobConfigs.length > 0) { + lookbackInterval = getLookbackInterval(jobConfigs); + } + if (!isDefined(topNBuckets) && jobConfigs.length > 0) { + topNBuckets = getTopNBuckets(jobConfigs[0]); + } + return { + lookbackInterval, + topNBuckets, + }; + }, [alertParams.lookbackInterval, alertParams.topNBuckets, jobConfigs]); + + const resultParams = useMemo(() => { + return { + ...alertParams, + ...advancedSettings, + }; + }, [alertParams, advancedSettings]); + return ( @@ -139,7 +167,11 @@ const MlAnomalyAlertTrigger: FC = ({ errors={errors.jobSelection} /> - + = ({ /> + { + Object.keys(update).forEach((k) => { + setAlertParams(k, update[k as keyof MlAnomalyDetectionAlertAdvancedSettings]); + }); + }, [])} + /> + + + diff --git a/x-pack/plugins/ml/public/alerting/register_ml_alerts.ts b/x-pack/plugins/ml/public/alerting/register_ml_alerts.ts index 5bb9df74b6f61..5454f4da31922 100644 --- a/x-pack/plugins/ml/public/alerting/register_ml_alerts.ts +++ b/x-pack/plugins/ml/public/alerting/register_ml_alerts.ts @@ -8,10 +8,17 @@ import { i18n } from '@kbn/i18n'; import { lazy } from 'react'; import { ML_ALERT_TYPES } from '../../common/constants/alerts'; -import { MlAnomalyDetectionAlertParams } from '../../common/types/alerts'; -import { TriggersAndActionsUIPublicPluginSetup } from '../../../triggers_actions_ui/public'; +import type { MlAnomalyDetectionAlertParams } from '../../common/types/alerts'; +import type { TriggersAndActionsUIPublicPluginSetup } from '../../../triggers_actions_ui/public'; +import type { PluginSetupContract as AlertingSetup } from '../../../alerting/public'; +import { PLUGIN_ID } from '../../common/constants/app'; +import { createExplorerUrl } from '../ml_url_generator/anomaly_detection_urls_generator'; +import { validateLookbackInterval, validateTopNBucket } from './validators'; -export function registerMlAlerts(triggersActionsUi: TriggersAndActionsUIPublicPluginSetup) { +export function registerMlAlerts( + triggersActionsUi: TriggersAndActionsUIPublicPluginSetup, + alerting?: AlertingSetup +) { triggersActionsUi.alertTypeRegistry.register({ id: ML_ALERT_TYPES.ANOMALY_DETECTION, description: i18n.translate('xpack.ml.alertTypes.anomalyDetection.description', { @@ -28,7 +35,9 @@ export function registerMlAlerts(triggersActionsUi: TriggersAndActionsUIPublicPl jobSelection: new Array(), severity: new Array(), resultType: new Array(), - }, + topNBuckets: new Array(), + lookbackInterval: new Array(), + } as Record, }; if ( @@ -42,6 +51,20 @@ export function registerMlAlerts(triggersActionsUi: TriggersAndActionsUIPublicPl ); } + // Since 7.13 we support single job selection only + if ( + (Array.isArray(alertParams.jobSelection?.groupIds) && + alertParams.jobSelection?.groupIds.length > 0) || + (Array.isArray(alertParams.jobSelection?.jobIds) && + alertParams.jobSelection?.jobIds.length > 1) + ) { + validationResult.errors.jobSelection.push( + i18n.translate('xpack.ml.alertTypes.anomalyDetection.singleJobSelection.errorMessage', { + defaultMessage: 'Only one job per rule is allowed', + }) + ); + } + if (alertParams.severity === undefined) { validationResult.errors.severity.push( i18n.translate('xpack.ml.alertTypes.anomalyDetection.severity.errorMessage', { @@ -58,6 +81,28 @@ export function registerMlAlerts(triggersActionsUi: TriggersAndActionsUIPublicPl ); } + if ( + !!alertParams.lookbackInterval && + validateLookbackInterval(alertParams.lookbackInterval) + ) { + validationResult.errors.lookbackInterval.push( + i18n.translate('xpack.ml.alertTypes.anomalyDetection.lookbackInterval.errorMessage', { + defaultMessage: 'Lookback interval is invalid', + }) + ); + } + + if ( + typeof alertParams.topNBuckets === 'number' && + validateTopNBucket(alertParams.topNBuckets) + ) { + validationResult.errors.topNBuckets.push( + i18n.translate('xpack.ml.alertTypes.anomalyDetection.topNBuckets.errorMessage', { + defaultMessage: 'Number of buckets is invalid', + }) + ); + } + return validationResult; }, requiresAppContext: false, @@ -69,7 +114,7 @@ export function registerMlAlerts(triggersActionsUi: TriggersAndActionsUIPublicPl - Time: \\{\\{context.timestampIso8601\\}\\} - Anomaly score: \\{\\{context.score\\}\\} -Alerts are raised based on real-time scores. Remember that scores may be adjusted over time as data continues to be analyzed. +\\{\\{context.message\\}\\} \\{\\{#context.topInfluencers.length\\}\\} Top influencers: @@ -91,4 +136,22 @@ Alerts are raised based on real-time scores. Remember that scores may be adjuste } ), }); + + if (alerting) { + registerNavigation(alerting); + } +} + +export function registerNavigation(alerting: AlertingSetup) { + alerting.registerNavigation(PLUGIN_ID, ML_ALERT_TYPES.ANOMALY_DETECTION, (alert) => { + const alertParams = alert.params as MlAnomalyDetectionAlertParams; + const jobIds = [ + ...new Set([ + ...(alertParams.jobSelection.jobIds ?? []), + ...(alertParams.jobSelection.groupIds ?? []), + ]), + ]; + + return createExplorerUrl('', { jobIds }); + }); } diff --git a/x-pack/plugins/ml/public/alerting/severity_control/severity_control.tsx b/x-pack/plugins/ml/public/alerting/severity_control/severity_control.tsx index 26a53882535b6..b1cd808643ca2 100644 --- a/x-pack/plugins/ml/public/alerting/severity_control/severity_control.tsx +++ b/x-pack/plugins/ml/public/alerting/severity_control/severity_control.tsx @@ -67,7 +67,7 @@ export const SeverityControl: FC = React.memo(({ value, o value={value ?? ANOMALY_THRESHOLD.LOW} onChange={(e) => { // @ts-ignore Property 'value' does not exist on type 'EventTarget' | (EventTarget & HTMLInputElement) - onChange(e.target.value); + onChange(Number(e.target.value)); }} showLabels showValue diff --git a/x-pack/plugins/ml/public/alerting/time_interval_control.tsx b/x-pack/plugins/ml/public/alerting/time_interval_control.tsx new file mode 100644 index 0000000000000..8030d340a3774 --- /dev/null +++ b/x-pack/plugins/ml/public/alerting/time_interval_control.tsx @@ -0,0 +1,49 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import { EuiFieldText, EuiFormRow, EuiFieldTextProps } from '@elastic/eui'; +import React, { FC, ReactNode, useMemo } from 'react'; +import { invalidTimeIntervalMessage } from '../application/jobs/new_job/common/job_validator/util'; +import { composeValidators } from '../../common'; +import { timeIntervalInputValidator } from '../../common/util/validators'; + +type TimeIntervalControlProps = Omit & { + label: string | ReactNode; + value: string | null | undefined; + onChange: (update: string) => void; +}; + +export const TimeIntervalControl: FC = ({ + value, + onChange, + label, + ...fieldTextProps +}) => { + const validators = useMemo(() => composeValidators(timeIntervalInputValidator()), []); + + const validationErrors = useMemo(() => validators(value), [value]); + + const isInvalid = value !== undefined && !!validationErrors; + + return ( + + { + onChange(e.target.value); + }} + isInvalid={isInvalid} + /> + + ); +}; diff --git a/x-pack/plugins/security_solution/public/timelines/containers/delete/persist.gql_query.ts b/x-pack/plugins/ml/public/alerting/validators.ts similarity index 53% rename from x-pack/plugins/security_solution/public/timelines/containers/delete/persist.gql_query.ts rename to x-pack/plugins/ml/public/alerting/validators.ts index 8312988d61e33..0c76e049b6da9 100644 --- a/x-pack/plugins/security_solution/public/timelines/containers/delete/persist.gql_query.ts +++ b/x-pack/plugins/ml/public/alerting/validators.ts @@ -5,10 +5,7 @@ * 2.0. */ -import gql from 'graphql-tag'; +import { numberValidator, timeIntervalInputValidator } from '../../common/util/validators'; -export const deleteTimelineMutation = gql` - mutation DeleteTimelineMutation($id: [ID!]!) { - deleteTimeline(id: $id) - } -`; +export const validateLookbackInterval = timeIntervalInputValidator(); +export const validateTopNBucket = numberValidator({ min: 1 }); diff --git a/x-pack/plugins/ml/public/application/app.tsx b/x-pack/plugins/ml/public/application/app.tsx index 5f72d49e4672e..e2fbcc77f2767 100644 --- a/x-pack/plugins/ml/public/application/app.tsx +++ b/x-pack/plugins/ml/public/application/app.tsx @@ -82,7 +82,7 @@ const App: FC = ({ coreStart, deps, appMountParams }) => { embeddable: deps.embeddable, maps: deps.maps, triggersActionsUi: deps.triggersActionsUi, - fileUpload: deps.fileUpload, + fileDataVisualizer: deps.fileDataVisualizer, ...coreStart, }; @@ -125,7 +125,7 @@ export const renderApp = ( security: deps.security, urlGenerators: deps.share.urlGenerators, maps: deps.maps, - fileUpload: deps.fileUpload, + fileDataVisualizer: deps.fileDataVisualizer, }); appMountParams.onAppLeave((actions) => actions.default()); diff --git a/x-pack/plugins/ml/public/application/components/anomalies_table/anomalies_table.test.js b/x-pack/plugins/ml/public/application/components/anomalies_table/anomalies_table.test.js index 7f1ac9243e853..d474969475d64 100644 --- a/x-pack/plugins/ml/public/application/components/anomalies_table/anomalies_table.test.js +++ b/x-pack/plugins/ml/public/application/components/anomalies_table/anomalies_table.test.js @@ -65,32 +65,32 @@ describe('AnomaliesTable', () => { expect(columns).toEqual( expect.arrayContaining([ expect.objectContaining({ - name: 'time', + name: 'Time', }), expect.objectContaining({ - name: 'severity', + field: 'severity', }), expect.objectContaining({ - name: 'detector', + name: 'Detector', }), expect.objectContaining({ field: 'entityValue', - name: 'found for', + name: 'Found for', }), expect.objectContaining({ - name: 'influenced by', + name: 'Influenced by', }), expect.objectContaining({ - name: 'actual', + field: 'actualSort', }), expect.objectContaining({ - name: 'typical', + field: 'typicalSort', }), expect.objectContaining({ - name: 'description', + name: 'Description', }), expect.objectContaining({ - name: 'category examples', + name: 'Category examples', }), ]) ); @@ -120,7 +120,7 @@ describe('AnomaliesTable', () => { expect(columns).toEqual( expect.not.arrayContaining([ expect.objectContaining({ - name: 'found for', + name: 'Found for', }), ]) ); @@ -150,7 +150,7 @@ describe('AnomaliesTable', () => { expect(columns).toEqual( expect.not.arrayContaining([ expect.objectContaining({ - name: 'influenced by', + name: 'Influenced by', }), ]) ); @@ -180,7 +180,7 @@ describe('AnomaliesTable', () => { expect(columns).toEqual( expect.not.arrayContaining([ expect.objectContaining({ - name: 'actual', + name: 'Actual', }), ]) ); @@ -210,7 +210,7 @@ describe('AnomaliesTable', () => { expect(columns).toEqual( expect.not.arrayContaining([ expect.objectContaining({ - name: 'typical', + name: 'Typical', }), ]) ); @@ -240,7 +240,7 @@ describe('AnomaliesTable', () => { expect(columns).toEqual( expect.arrayContaining([ expect.objectContaining({ - name: 'job ID', + name: 'Job ID', }), ]) ); diff --git a/x-pack/plugins/ml/public/application/components/anomalies_table/anomalies_table_columns.js b/x-pack/plugins/ml/public/application/components/anomalies_table/anomalies_table_columns.js index f1093fd0b16a1..1f3979e6efe29 100644 --- a/x-pack/plugins/ml/public/application/components/anomalies_table/anomalies_table_columns.js +++ b/x-pack/plugins/ml/public/application/components/anomalies_table/anomalies_table_columns.js @@ -5,7 +5,7 @@ * 2.0. */ -import { EuiButtonIcon, EuiLink, EuiScreenReaderOnly } from '@elastic/eui'; +import { EuiButtonIcon, EuiLink, EuiScreenReaderOnly, EuiToolTip, EuiIcon } from '@elastic/eui'; import React from 'react'; import { get } from 'lodash'; @@ -99,7 +99,7 @@ export function getColumns( field: 'time', 'data-test-subj': 'mlAnomaliesListColumnTime', name: i18n.translate('xpack.ml.anomaliesTable.timeColumnName', { - defaultMessage: 'time', + defaultMessage: 'Time', }), dataType: 'date', scope: 'row', @@ -110,9 +110,21 @@ export function getColumns( { field: 'severity', 'data-test-subj': 'mlAnomaliesListColumnSeverity', - name: i18n.translate('xpack.ml.anomaliesTable.severityColumnName', { - defaultMessage: 'severity', - }), + name: ( + + + {i18n.translate('xpack.ml.anomaliesTable.severityColumnName', { + defaultMessage: 'Severity', + })} + + + + ), render: (score, item) => ( ), @@ -122,7 +134,7 @@ export function getColumns( field: 'detector', 'data-test-subj': 'mlAnomaliesListColumnDetector', name: i18n.translate('xpack.ml.anomaliesTable.detectorColumnName', { - defaultMessage: 'detector', + defaultMessage: 'Detector', }), render: (detectorDescription, item) => ( @@ -137,7 +149,7 @@ export function getColumns( field: 'entityValue', 'data-test-subj': 'mlAnomaliesListColumnFoundFor', name: i18n.translate('xpack.ml.anomaliesTable.entityValueColumnName', { - defaultMessage: 'found for', + defaultMessage: 'Found for', }), render: (entityValue, item) => ( ( + + {i18n.translate('xpack.ml.anomaliesTable.actualSortColumnName', { + defaultMessage: 'Actual', + })} + + + + ), render: (actual, item) => { const fieldFormat = mlFieldFormatService.getFieldFormat( item.jobId, @@ -196,9 +219,20 @@ export function getColumns( columns.push({ field: 'typicalSort', 'data-test-subj': 'mlAnomaliesListColumnTypical', - name: i18n.translate('xpack.ml.anomaliesTable.typicalSortColumnName', { - defaultMessage: 'typical', - }), + name: ( + + + {i18n.translate('xpack.ml.anomaliesTable.typicalSortColumnName', { + defaultMessage: 'Typical', + })} + + + + ), render: (typical, item) => { const fieldFormat = mlFieldFormatService.getFieldFormat( item.jobId, @@ -220,7 +254,7 @@ export function getColumns( field: 'metricDescriptionSort', 'data-test-subj': 'mlAnomaliesListColumnDescription', name: i18n.translate('xpack.ml.anomaliesTable.metricDescriptionSortColumnName', { - defaultMessage: 'description', + defaultMessage: 'Description', }), render: (metricDescriptionSort, item) => ( @@ -236,7 +270,7 @@ export function getColumns( field: 'jobId', 'data-test-subj': 'mlAnomaliesListColumnJobID', name: i18n.translate('xpack.ml.anomaliesTable.jobIdColumnName', { - defaultMessage: 'job ID', + defaultMessage: 'Job ID', }), sortable: true, }); @@ -247,7 +281,7 @@ export function getColumns( columns.push({ 'data-test-subj': 'mlAnomaliesListColumnCategoryExamples', name: i18n.translate('xpack.ml.anomaliesTable.categoryExamplesColumnName', { - defaultMessage: 'category examples', + defaultMessage: 'Category examples', }), truncateText: true, render: (item) => { @@ -277,7 +311,7 @@ export function getColumns( columns.push({ 'data-test-subj': 'mlAnomaliesListColumnAction', name: i18n.translate('xpack.ml.anomaliesTable.actionsColumnName', { - defaultMessage: 'actions', + defaultMessage: 'Actions', }), render: (item) => { if (showLinksMenuForItem(item, showViewSeriesLink) === true) { diff --git a/x-pack/plugins/ml/public/application/components/anomalies_table/anomaly_details.js b/x-pack/plugins/ml/public/application/components/anomalies_table/anomaly_details.js index 8efa5f9e5909d..20e426ac37997 100644 --- a/x-pack/plugins/ml/public/application/components/anomalies_table/anomaly_details.js +++ b/x-pack/plugins/ml/public/application/components/anomalies_table/anomaly_details.js @@ -123,14 +123,14 @@ function getDetailsItems(anomaly, examples, filter) { } items.push({ title: i18n.translate('xpack.ml.anomaliesTable.anomalyDetails.timeTitle', { - defaultMessage: 'time', + defaultMessage: 'Time', }), description: timeDesc, }); items.push({ title: i18n.translate('xpack.ml.anomaliesTable.anomalyDetails.functionTitle', { - defaultMessage: 'function', + defaultMessage: 'Function', }), description: source.function !== ML_JOB_AGGREGATION.METRIC ? source.function : source.function_description, @@ -139,7 +139,7 @@ function getDetailsItems(anomaly, examples, filter) { if (source.field_name !== undefined) { items.push({ title: i18n.translate('xpack.ml.anomaliesTable.anomalyDetails.fieldNameTitle', { - defaultMessage: 'fieldName', + defaultMessage: 'Field name', }), description: source.field_name, }); @@ -149,7 +149,7 @@ function getDetailsItems(anomaly, examples, filter) { if (anomaly.actual !== undefined && showActualForFunction(functionDescription) === true) { items.push({ title: i18n.translate('xpack.ml.anomaliesTable.anomalyDetails.actualTitle', { - defaultMessage: 'actual', + defaultMessage: 'Actual', }), description: formatValue(anomaly.actual, source.function, undefined, source), }); @@ -158,7 +158,7 @@ function getDetailsItems(anomaly, examples, filter) { if (anomaly.typical !== undefined && showTypicalForFunction(functionDescription) === true) { items.push({ title: i18n.translate('xpack.ml.anomaliesTable.anomalyDetails.typicalTitle', { - defaultMessage: 'typical', + defaultMessage: 'Typical', }), description: formatValue(anomaly.typical, source.function, undefined, source), }); @@ -166,7 +166,7 @@ function getDetailsItems(anomaly, examples, filter) { items.push({ title: i18n.translate('xpack.ml.anomaliesTable.anomalyDetails.jobIdTitle', { - defaultMessage: 'job ID', + defaultMessage: 'Job ID', }), description: anomaly.jobId, }); @@ -177,7 +177,7 @@ function getDetailsItems(anomaly, examples, filter) { ) { items.push({ title: i18n.translate('xpack.ml.anomaliesTable.anomalyDetails.multiBucketImpactTitle', { - defaultMessage: 'multi-bucket impact', + defaultMessage: 'Multi-bucket impact', }), description: getMultiBucketImpactLabel(source.multi_bucket_impact), }); @@ -185,7 +185,7 @@ function getDetailsItems(anomaly, examples, filter) { items.push({ title: i18n.translate('xpack.ml.anomaliesTable.anomalyDetails.probabilityTitle', { - defaultMessage: 'probability', + defaultMessage: 'Probability', }), description: source.probability, }); @@ -565,7 +565,7 @@ export class AnomalyDetails extends Component { this.toggleAllInfluencers()}> )} diff --git a/x-pack/plugins/ml/public/application/components/data_grid/common.ts b/x-pack/plugins/ml/public/application/components/data_grid/common.ts index b897ca3dccc51..24a3cfb70d18d 100644 --- a/x-pack/plugins/ml/public/application/components/data_grid/common.ts +++ b/x-pack/plugins/ml/public/application/components/data_grid/common.ts @@ -6,6 +6,7 @@ */ import moment from 'moment-timezone'; +import { estypes } from '@elastic/elasticsearch'; import { useEffect, useMemo } from 'react'; import { @@ -18,7 +19,6 @@ import { i18n } from '@kbn/i18n'; import { CoreSetup } from 'src/core/public'; -import type { estypes } from '@elastic/elasticsearch'; import { IndexPattern, IFieldType, diff --git a/x-pack/plugins/ml/public/application/components/job_selector/job_selector.tsx b/x-pack/plugins/ml/public/application/components/job_selector/job_selector.tsx index 3758fb6c42081..f67a9df4a4a85 100644 --- a/x-pack/plugins/ml/public/application/components/job_selector/job_selector.tsx +++ b/x-pack/plugins/ml/public/application/components/job_selector/job_selector.tsx @@ -20,6 +20,8 @@ import { JobSelectorFlyoutProps, } from './job_selector_flyout'; import { MlJobWithTimeRange } from '../../../../common/types/anomaly_detection_jobs'; +import { useStorage } from '../../contexts/ml/use_storage'; +import { ApplyTimeRangeConfig, ML_APPLY_TIME_RANGE_CONFIG } from '../../../../common/types/storage'; interface GroupObj { groupId: string; @@ -79,6 +81,10 @@ export interface JobSelectionMaps { export function JobSelector({ dateFormatTz, singleSelection, timeseriesOnly }: JobSelectorProps) { const [globalState, setGlobalState] = useUrlState('_g'); + const [applyTimeRangeConfig, setApplyTimeRangeConfig] = useStorage( + ML_APPLY_TIME_RANGE_CONFIG, + true + ); const selectedJobIds = globalState?.ml?.jobIds ?? []; const selectedGroups = globalState?.ml?.groups ?? []; @@ -180,6 +186,8 @@ export function JobSelector({ dateFormatTz, singleSelection, timeseriesOnly }: J onJobsFetched={setMaps} onFlyoutClose={closeFlyout} maps={maps} + applyTimeRangeConfig={applyTimeRangeConfig} + onTimeRangeConfigChange={setApplyTimeRangeConfig} /> ); diff --git a/x-pack/plugins/ml/public/application/components/job_selector/job_selector_flyout.tsx b/x-pack/plugins/ml/public/application/components/job_selector/job_selector_flyout.tsx index 31f2714259aa0..d64e85e70f2eb 100644 --- a/x-pack/plugins/ml/public/application/components/job_selector/job_selector_flyout.tsx +++ b/x-pack/plugins/ml/public/application/components/job_selector/job_selector_flyout.tsx @@ -51,6 +51,8 @@ export interface JobSelectorFlyoutProps { timeseriesOnly: boolean; maps: JobSelectionMaps; withTimeRangeSelector?: boolean; + applyTimeRangeConfig?: boolean; + onTimeRangeConfigChange?: (v: boolean) => void; } export const JobSelectorFlyoutContent: FC = ({ @@ -62,6 +64,8 @@ export const JobSelectorFlyoutContent: FC = ({ onSelectionConfirmed, onFlyoutClose, maps, + applyTimeRangeConfig, + onTimeRangeConfigChange, withTimeRangeSelector = true, }) => { const { @@ -75,7 +79,6 @@ export const JobSelectorFlyoutContent: FC = ({ const [isLoading, setIsLoading] = useState(true); const [showAllBadges, setShowAllBadges] = useState(false); - const [applyTimeRange, setApplyTimeRange] = useState(true); const [jobs, setJobs] = useState([]); const [groups, setGroups] = useState([]); const [ganttBarWidth, setGanttBarWidth] = useState(DEFAULT_GANTT_BAR_WIDTH); @@ -101,7 +104,7 @@ export const JobSelectorFlyoutContent: FC = ({ // create a Set to remove duplicate values const allNewSelectionUnique = Array.from(new Set(allNewSelection)); - const time = applyTimeRange + const time = applyTimeRangeConfig ? getTimeRangeFromSelection(jobs, allNewSelectionUnique) : undefined; @@ -111,14 +114,16 @@ export const JobSelectorFlyoutContent: FC = ({ groups: groupSelection, time, }); - }, [onSelectionConfirmed, newSelection, jobGroupsMaps, applyTimeRange]); + }, [onSelectionConfirmed, newSelection, jobGroupsMaps, applyTimeRangeConfig]); function removeId(id: string) { setNewSelection(newSelection.filter((item) => item !== id)); } function toggleTimerangeSwitch() { - setApplyTimeRange(!applyTimeRange); + if (onTimeRangeConfigChange) { + onTimeRangeConfigChange(!applyTimeRangeConfig); + } } function clearSelection() { @@ -233,7 +238,7 @@ export const JobSelectorFlyoutContent: FC = ({ )} - {withTimeRangeSelector && ( + {withTimeRangeSelector && applyTimeRangeConfig !== undefined && ( = ({ defaultMessage: 'Apply time range', } )} - checked={applyTimeRange} + checked={applyTimeRangeConfig} onChange={toggleTimerangeSwitch} data-test-subj="mlFlyoutJobSelectorSwitchApplyTimeRange" /> diff --git a/x-pack/plugins/ml/public/application/components/navigation_menu/main_tabs.tsx b/x-pack/plugins/ml/public/application/components/navigation_menu/main_tabs.tsx index 3a6979d021c8b..0f381fb7acee9 100644 --- a/x-pack/plugins/ml/public/application/components/navigation_menu/main_tabs.tsx +++ b/x-pack/plugins/ml/public/application/components/navigation_menu/main_tabs.tsx @@ -161,14 +161,16 @@ export const MainTabs: FC = ({ tabId, disableLinks }) => { const defaultPathId = (TAB_DATA[id].pathId || id) as MlUrlGeneratorState['page']; return disabled ? ( - - {tab.name} - +
    + + {tab.name} + +
    ) : (
    { test('getAnalysisType()', () => { @@ -35,4 +35,22 @@ describe('Data Frame Analytics: Analytics utils', () => { const unknownAnalysis = { outlier_detection: {}, regression: {} }; expect(isOutlierAnalysis(unknownAnalysis)).toBe(false); }); + + test('getValuesFromResponse()', () => { + const evalResponse: any = { + regression: { + huber: { value: 'NaN' }, + mse: { value: 7.514953437693147 }, + msle: { value: 'Infinity' }, + r_squared: { value: 0.9837343227799651 }, + }, + }; + const expectedResponse = { + mse: 7.51, + msle: 'Infinity', + huber: 'NaN', + r_squared: 0.984, + }; + expect(getValuesFromResponse(evalResponse)).toEqual(expectedResponse); + }); }); diff --git a/x-pack/plugins/ml/public/application/data_frame_analytics/common/analytics.ts b/x-pack/plugins/ml/public/application/data_frame_analytics/common/analytics.ts index 61abf8476c632..669b95cbaeb8c 100644 --- a/x-pack/plugins/ml/public/application/data_frame_analytics/common/analytics.ts +++ b/x-pack/plugins/ml/public/application/data_frame_analytics/common/analytics.ts @@ -366,7 +366,7 @@ export function getValuesFromResponse(response: RegressionEvaluateResponse) { if (response.regression.hasOwnProperty(statType)) { let currentStatValue = response.regression[statType as keyof RegressionEvaluateResponse['regression']]?.value; - if (currentStatValue && !isNaN(currentStatValue)) { + if (currentStatValue && Number.isFinite(currentStatValue)) { currentStatValue = Number(currentStatValue.toPrecision(DEFAULT_SIG_FIGS)); } results[statType as keyof RegressionEvaluateExtractedResponse] = currentStatValue; diff --git a/x-pack/plugins/ml/public/application/data_frame_analytics/pages/analytics_creation/components/configuration_step/configuration_step_form.tsx b/x-pack/plugins/ml/public/application/data_frame_analytics/pages/analytics_creation/components/configuration_step/configuration_step_form.tsx index 810f59d904696..930c32ce7e4da 100644 --- a/x-pack/plugins/ml/public/application/data_frame_analytics/pages/analytics_creation/components/configuration_step/configuration_step_form.tsx +++ b/x-pack/plugins/ml/public/application/data_frame_analytics/pages/analytics_creation/components/configuration_step/configuration_step_form.tsx @@ -364,7 +364,7 @@ export const ConfigurationStepForm: FC = ({ } return !option.key?.includes(runtimeMappingKey); }); - // Runtime mappings have been removed + // Runtime fields have been removed if (runtimeMappings === undefined && runtimeMappingsUpdated === true) { setDependentVariableOptions(filteredOptions); } else if (runtimeMappings) { @@ -374,7 +374,7 @@ export const ConfigurationStepForm: FC = ({ } } - // Update includes - remove previous runtime mappings then add supported runtime fields to includes + // Update includes - remove previous runtime fields then add supported runtime fields to includes const updatedIncludes = includes.filter((field) => { const isRemovedRuntimeField = previousRuntimeMapping && previousRuntimeMapping[field]; return !isRemovedRuntimeField; diff --git a/x-pack/plugins/ml/public/application/data_frame_analytics/pages/analytics_creation/components/runtime_mappings/runtime_mappings.tsx b/x-pack/plugins/ml/public/application/data_frame_analytics/pages/analytics_creation/components/runtime_mappings/runtime_mappings.tsx index 5b8fc82ef587b..ec85cc97ac6a6 100644 --- a/x-pack/plugins/ml/public/application/data_frame_analytics/pages/analytics_creation/components/runtime_mappings/runtime_mappings.tsx +++ b/x-pack/plugins/ml/public/application/data_frame_analytics/pages/analytics_creation/components/runtime_mappings/runtime_mappings.tsx @@ -20,19 +20,48 @@ import { import { i18n } from '@kbn/i18n'; import { FormattedMessage } from '@kbn/i18n/react'; import { XJsonMode } from '@kbn/ace'; -import { RuntimeField } from '../../../../../../../../../../src/plugins/data/common/index_patterns'; import { useMlContext } from '../../../../../contexts/ml'; import { CreateAnalyticsFormProps } from '../../../analytics_management/hooks/use_create_analytics_form'; import { XJson } from '../../../../../../../../../../src/plugins/es_ui_shared/public'; import { getCombinedRuntimeMappings } from '../../../../../components/data_grid/common'; import { isPopulatedObject } from '../../../../../../../common/util/object_utils'; import { RuntimeMappingsEditor } from './runtime_mappings_editor'; +import { isRuntimeMappings } from '../../../../../../../common'; +import { SwitchModal } from './switch_modal'; const advancedEditorsSidebarWidth = '220px'; -const COPY_TO_CLIPBOARD_RUNTIME_MAPPINGS = i18n.translate( +const COPY_RUNTIME_FIELDS_TO_CLIPBOARD_TEXT = i18n.translate( 'xpack.ml.dataframe.analytics.createWizard.indexPreview.copyRuntimeMappingsClipboardTooltip', { - defaultMessage: 'Copy Dev Console statement of the runtime mappings to the clipboard.', + defaultMessage: 'Copy Dev Console statement of the runtime fields to the clipboard.', + } +); + +const APPLY_CHANGES_TEXT = i18n.translate( + 'xpack.ml.dataframe.analytics.createWizard.advancedSourceEditorApplyButtonText', + { + defaultMessage: 'Apply changes', + } +); + +const RUNTIME_FIELDS_EDITOR_HELP_TEXT = i18n.translate( + 'xpack.ml.dataframe.analytics.createWizard.advancedRuntimeFieldsEditorHelpText', + { + defaultMessage: 'The advanced editor allows you to edit the runtime fields of the source.', + } +); + +const EDIT_SWITCH_LABEL_TEXT = i18n.translate( + 'xpack.ml.dataframe.analytics.createWizard.advancedEditorRuntimeFieldsSwitchLabel', + { + defaultMessage: 'Edit runtime fields', + } +); + +const RUNTIME_FIELDS_LABEL_TEXT = i18n.translate( + 'xpack.ml.dataframe.analytics.createWizard.runtimeFieldsLabel', + { + defaultMessage: 'Runtime fields', } ); @@ -45,12 +74,15 @@ interface Props { state: CreateAnalyticsFormProps['state']; } -type RuntimeMappings = Record; - export const RuntimeMappings: FC = ({ actions, state }) => { const [isRuntimeMappingsEditorEnabled, setIsRuntimeMappingsEditorEnabled] = useState( false ); + const [ + isRuntimeMappingsEditorSwitchModalVisible, + setRuntimeMappingsEditorSwitchModalVisible, + ] = useState(false); + const [ isRuntimeMappingsEditorApplyButtonEnabled, setIsRuntimeMappingsEditorApplyButtonEnabled, @@ -59,7 +91,6 @@ export const RuntimeMappings: FC = ({ actions, state }) => { advancedEditorRuntimeMappingsLastApplied, setAdvancedEditorRuntimeMappingsLastApplied, ] = useState(); - const [advancedEditorRuntimeMappings, setAdvancedEditorRuntimeMappings] = useState(); const { setFormState } = actions; const { jobType, previousRuntimeMapping, runtimeMappings } = state.form; @@ -90,22 +121,22 @@ export const RuntimeMappings: FC = ({ actions, state }) => { runtimeMappingsUpdated: true, previousRuntimeMapping: previous, }); - setAdvancedEditorRuntimeMappings(prettySourceConfig); + setAdvancedRuntimeMappingsConfig(prettySourceConfig); setAdvancedEditorRuntimeMappingsLastApplied(prettySourceConfig); setIsRuntimeMappingsEditorApplyButtonEnabled(false); }; - // If switching to KQL after updating via editor - reset search const toggleEditorHandler = (reset = false) => { if (reset === true) { - setFormState({ runtimeMappingsUpdated: false }); - } - if (isRuntimeMappingsEditorEnabled === false) { - setAdvancedEditorRuntimeMappingsLastApplied(advancedEditorRuntimeMappings); + setFormState({ + runtimeMappingsUpdated: false, + }); + + setAdvancedRuntimeMappingsConfig(advancedEditorRuntimeMappingsLastApplied ?? ''); } setIsRuntimeMappingsEditorEnabled(!isRuntimeMappingsEditorEnabled); - setIsRuntimeMappingsEditorApplyButtonEnabled(false); + setIsRuntimeMappingsEditorApplyButtonEnabled(isRuntimeMappings(runtimeMappings)); }; useEffect(function getInitialRuntimeMappings() { @@ -114,8 +145,11 @@ export const RuntimeMappings: FC = ({ actions, state }) => { runtimeMappings ); + const prettySourceConfig = JSON.stringify(combinedRuntimeMappings, null, 2); + if (combinedRuntimeMappings) { - setAdvancedRuntimeMappingsConfig(JSON.stringify(combinedRuntimeMappings, null, 2)); + setAdvancedRuntimeMappingsConfig(prettySourceConfig); + setAdvancedEditorRuntimeMappingsLastApplied(prettySourceConfig); setFormState({ runtimeMappings: combinedRuntimeMappings, }); @@ -125,12 +159,7 @@ export const RuntimeMappings: FC = ({ actions, state }) => { return ( <> - + {isPopulatedObject(runtimeMappings) ? ( @@ -139,8 +168,8 @@ export const RuntimeMappings: FC = ({ actions, state }) => { ) : ( )} @@ -170,27 +199,41 @@ export const RuntimeMappings: FC = ({ actions, state }) => { toggleEditorHandler()} + onChange={() => { + if ( + isRuntimeMappingsEditorEnabled && + advancedRuntimeMappingsConfig !== advancedEditorRuntimeMappingsLastApplied + ) { + setRuntimeMappingsEditorSwitchModalVisible(true); + return; + } + + toggleEditorHandler(); + }} data-test-subj="mlDataFrameAnalyticsRuntimeMappingsEditorSwitch" /> + {isRuntimeMappingsEditorSwitchModalVisible && ( + setRuntimeMappingsEditorSwitchModalVisible(false)} + onConfirm={() => { + setRuntimeMappingsEditorSwitchModalVisible(false); + toggleEditorHandler(true); + }} + /> + )} {(copy: () => void) => ( )} @@ -201,15 +244,7 @@ export const RuntimeMappings: FC = ({ actions, state }) => { {isRuntimeMappingsEditorEnabled && ( - - {i18n.translate( - 'xpack.ml.dataframe.analytics.createWizard.advancedRuntimeMappingsEditorHelpText', - { - defaultMessage: - 'The advanced editor allows you to edit the runtime mappings of the source.', - } - )} - + {RUNTIME_FIELDS_EDITOR_HELP_TEXT} = ({ actions, state }) => { disabled={!isRuntimeMappingsEditorApplyButtonEnabled} data-test-subj="mlDataFrameAnalyticsRuntimeMappingsApplyButton" > - {i18n.translate( - 'xpack.ml.dataframe.analytics.createWizard.advancedSourceEditorApplyButtonText', - { - defaultMessage: 'Apply changes', - } - )} + {APPLY_CHANGES_TEXT} )} diff --git a/x-pack/plugins/ml/public/application/data_frame_analytics/pages/analytics_creation/components/runtime_mappings/switch_modal.tsx b/x-pack/plugins/ml/public/application/data_frame_analytics/pages/analytics_creation/components/runtime_mappings/switch_modal.tsx new file mode 100644 index 0000000000000..21a1c18dbea13 --- /dev/null +++ b/x-pack/plugins/ml/public/application/data_frame_analytics/pages/analytics_creation/components/runtime_mappings/switch_modal.tsx @@ -0,0 +1,56 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import React, { FC } from 'react'; +import { EuiConfirmModal } from '@elastic/eui'; +import { i18n } from '@kbn/i18n'; + +interface Props { + onCancel: () => void; + onConfirm: () => void; +} + +const modalTitle = i18n.translate( + 'xpack.ml.dataframe.analytics.createWizard.runtimeEditorSwitchModalTitle', + { + defaultMessage: 'Edits will be lost', + } +); + +const cancelButtonText = i18n.translate( + 'xpack.ml.dataframe.analytics.createWizard.runtimeEditorSwitchModalCancelButtonText', + { + defaultMessage: 'Cancel', + } +); + +const applyChangesText = i18n.translate( + 'xpack.ml.dataframe.analytics.createWizard.runtimeEditorSwitchModalConfirmButtonText', + { + defaultMessage: 'Close editor', + } +); +const modalMessage = i18n.translate( + 'xpack.ml.dataframe.analytics.createWizard.runtimeEditorSwitchModalBodyText', + { + defaultMessage: `The changes in the editor haven't been applied yet. By closing the editor you will lose your edits.`, + } +); + +export const SwitchModal: FC = ({ onCancel, onConfirm }) => ( + +

    {modalMessage}

    +
    +); diff --git a/x-pack/plugins/ml/public/application/data_frame_analytics/pages/analytics_creation/page.tsx b/x-pack/plugins/ml/public/application/data_frame_analytics/pages/analytics_creation/page.tsx index 830870cf1ca74..41bdc5b8ecf45 100644 --- a/x-pack/plugins/ml/public/application/data_frame_analytics/pages/analytics_creation/page.tsx +++ b/x-pack/plugins/ml/public/application/data_frame_analytics/pages/analytics_creation/page.tsx @@ -61,7 +61,7 @@ export const Page: FC = ({ jobId }) => { const createAnalyticsForm = useCreateAnalyticsForm(); const { state } = createAnalyticsForm; - const { isAdvancedEditorEnabled, disableSwitchToForm } = state; + const { isAdvancedEditorEnabled, disableSwitchToForm, isJobCreated } = state; const { jobType } = state.form; const { initiateWizard, @@ -217,7 +217,7 @@ export const Page: FC = ({ jobId }) => { } > { licenseManagement, http: { basePath }, docLinks, - fileUpload, + fileDataVisualizer, }, } = useMlKibana(); @@ -68,12 +68,12 @@ export const DatavisualizerSelector: FC = () => { licenseManagement.enabled === true && isFullLicense() === false; - if (fileUpload === undefined) { + if (fileDataVisualizer === undefined) { // eslint-disable-next-line no-console - console.error('File upload plugin not available'); + console.error('File data visualizer plugin not available'); return null; } - const maxFileSize = fileUpload.getMaxBytesFormatted(); + const maxFileSize = fileDataVisualizer.getMaxBytesFormatted(); return ( diff --git a/x-pack/plugins/ml/public/application/datavisualizer/file_based/components/fields_stats/_field_stats_card.scss b/x-pack/plugins/ml/public/application/datavisualizer/file_based/components/fields_stats/_field_stats_card.scss deleted file mode 100644 index d0af6d3f01d2f..0000000000000 --- a/x-pack/plugins/ml/public/application/datavisualizer/file_based/components/fields_stats/_field_stats_card.scss +++ /dev/null @@ -1,150 +0,0 @@ -.card-container { - display: inline-grid; - display: -ms-inline-grid; - padding: 0 10px 10px 0; -} - -.ml-field-data-card { - // These styles should all be removed once the file data visualizer is using - // the same field_data_card component as the index based data visualizer. - height: 408px; - box-shadow: none; - border-color: $euiBorderColor; - - // Note the names of these styles need to match the type of the field they are displaying. - .boolean { - color: $euiColorVis5; - border-color: $euiColorVis5; - } - - .date { - color: $euiColorVis7; - border-color: $euiColorVis7; - } - - .document_count { - color: $euiColorVis2; - border-color: $euiColorVis2; - } - - .geo_point { - color: $euiColorVis8; - border-color: $euiColorVis8; - } - - .ip { - color: $euiColorVis3; - border-color: $euiColorVis3; - } - - .keyword { - color: $euiColorVis0; - border-color: $euiColorVis0; - } - - .number { - color: $euiColorVis1; - border-color: $euiColorVis1; - } - - .text { - color: $euiColorVis9; - border-color: $euiColorVis9; - } - - .type-other, - .unknown { - color: $euiColorVis6; - border-color: $euiColorVis6; - } - - // Use euiPanel styling - @include euiPanel($selector: '.card-contents'); - - .stats { - text-align: center; - } - - .stat { - padding-bottom: 6px; - } - - .stat.heading { - padding-bottom: 0; - } - - .stat.min, - .stat.max, - .stat.median { - width: 30%; - display: inline-block; - } - - .stat.min.value, - .stat.max.value, - .stat.median.value { - font-size: $euiFontSizeS; - @include euiTextTruncate; - } - - .valueWrapper { - display: inline; - } - - .not-exist-message { - padding: 50px 30px 0 30px; - text-align: center; - } - - .sampled-message { - font-size: 11px; - color: #555555; - text-align: center; - padding-top: 3px; - } - - .text-code { - font-family: $euiCodeFontFamily; - } - - .details-select { - text-align: center; - margin-top: 5px; - margin-bottom: 5px; - } - - .details-container { - padding-top: 5px; - } - - .top-value { - height: 21px; - font-size: 13px; - - .field-label { - @include euiTextTruncate; - - display: inline-block; - width: 100px; - text-align: right; - } - - .count-label { - display: inline-block; - width: 70px; - text-align: left; - overflow: hidden; - text-overflow: ellipsis; - } - - .top-value-bar-holder { - display: inline-block; - width: 160px; - } - - .top-value-bar { - height: 15px; - min-width: 3px; - } - } -} diff --git a/x-pack/plugins/ml/public/application/datavisualizer/file_based/components/fields_stats/_fields_stats.scss b/x-pack/plugins/ml/public/application/datavisualizer/file_based/components/fields_stats/_fields_stats.scss deleted file mode 100644 index 5decacfe1b7b8..0000000000000 --- a/x-pack/plugins/ml/public/application/datavisualizer/file_based/components/fields_stats/_fields_stats.scss +++ /dev/null @@ -1,6 +0,0 @@ -.fields-stats { - padding: 10px; -} -.field { - margin-bottom: 10px; -} diff --git a/x-pack/plugins/ml/public/application/datavisualizer/file_based/file_datavisualizer.tsx b/x-pack/plugins/ml/public/application/datavisualizer/file_based/file_datavisualizer.tsx index a05677918da72..3b4cfbf33fbfc 100644 --- a/x-pack/plugins/ml/public/application/datavisualizer/file_based/file_datavisualizer.tsx +++ b/x-pack/plugins/ml/public/application/datavisualizer/file_based/file_datavisualizer.tsx @@ -5,34 +5,32 @@ * 2.0. */ -import React, { FC, Fragment } from 'react'; -import { IUiSettingsClient } from 'kibana/public'; +import React, { FC, Fragment, useState, useEffect } from 'react'; import { useTimefilter } from '../../contexts/kibana'; import { NavigationMenu } from '../../components/navigation_menu'; -import { getIndexPatternsContract } from '../../util/index_utils'; import { HelpMenu } from '../../components/help_menu'; import { useMlKibana } from '../../contexts/kibana'; -// @ts-ignore -import { FileDataVisualizerView } from './components/file_datavisualizer_view/index'; - -export interface FileDataVisualizerPageProps { - kibanaConfig: IUiSettingsClient; -} - -export const FileDataVisualizerPage: FC = ({ kibanaConfig }) => { +export const FileDataVisualizerPage: FC = () => { useTimefilter({ timeRangeSelector: false, autoRefreshSelector: false }); - const indexPatterns = getIndexPatternsContract(); const { - services: { docLinks }, + services: { docLinks, fileDataVisualizer }, } = useMlKibana(); - const helpLink = docLinks.links.ml.guide; + const [FileDataVisualizer, setFileDataVisualizer] = useState | null>(null); + + useEffect(() => { + if (fileDataVisualizer !== undefined) { + const { getFileDataVisualizerComponent } = fileDataVisualizer; + getFileDataVisualizerComponent().then(setFileDataVisualizer); + } + }, []); + return ( - - + {FileDataVisualizer} + ); }; diff --git a/x-pack/plugins/ml/public/application/datavisualizer/file_based/index.ts b/x-pack/plugins/ml/public/application/datavisualizer/file_based/index.tsx similarity index 100% rename from x-pack/plugins/ml/public/application/datavisualizer/file_based/index.ts rename to x-pack/plugins/ml/public/application/datavisualizer/file_based/index.tsx diff --git a/x-pack/plugins/ml/public/application/datavisualizer/index_based/components/search_panel/field_type_filter.tsx b/x-pack/plugins/ml/public/application/datavisualizer/index_based/components/search_panel/field_type_filter.tsx index 7bc7260acf544..15ddf00c4e1d3 100644 --- a/x-pack/plugins/ml/public/application/datavisualizer/index_based/components/search_panel/field_type_filter.tsx +++ b/x-pack/plugins/ml/public/application/datavisualizer/index_based/components/search_panel/field_type_filter.tsx @@ -13,7 +13,7 @@ import { FieldTypeIcon } from '../../../../components/field_type_icon'; import { ML_JOB_FIELD_TYPES } from '../../../../../../common/constants/field_types'; import type { MlJobFieldType } from '../../../../../../common/types/field_types'; -export const ML_JOB_FIELD_TYPES_OPTIONS = { +const ML_JOB_FIELD_TYPES_OPTIONS = { [ML_JOB_FIELD_TYPES.BOOLEAN]: { name: 'Boolean', icon: 'tokenBoolean' }, [ML_JOB_FIELD_TYPES.DATE]: { name: 'Date', icon: 'tokenDate' }, [ML_JOB_FIELD_TYPES.GEO_POINT]: { name: 'Geo point', icon: 'tokenGeo' }, diff --git a/x-pack/plugins/ml/public/application/datavisualizer/stats_table/components/field_data_expanded_row/index.ts b/x-pack/plugins/ml/public/application/datavisualizer/stats_table/components/field_data_expanded_row/index.ts index e0944711033a7..d35b0ae9688cf 100644 --- a/x-pack/plugins/ml/public/application/datavisualizer/stats_table/components/field_data_expanded_row/index.ts +++ b/x-pack/plugins/ml/public/application/datavisualizer/stats_table/components/field_data_expanded_row/index.ts @@ -7,7 +7,6 @@ export { BooleanContent } from './boolean_content'; export { DateContent } from './date_content'; -export { GeoPointContent } from '../../../file_based/components/expanded_row/geo_point_content/geo_point_content'; export { KeywordContent } from './keyword_content'; export { IpContent } from './ip_content'; export { NumberContent } from './number_content'; diff --git a/x-pack/plugins/ml/public/application/datavisualizer/stats_table/data_visualizer_stats_table.tsx b/x-pack/plugins/ml/public/application/datavisualizer/stats_table/data_visualizer_stats_table.tsx index 2a6a681c63210..2003d07efca82 100644 --- a/x-pack/plugins/ml/public/application/datavisualizer/stats_table/data_visualizer_stats_table.tsx +++ b/x-pack/plugins/ml/public/application/datavisualizer/stats_table/data_visualizer_stats_table.tsx @@ -38,7 +38,6 @@ import { FileBasedFieldVisConfig, isIndexBasedFieldVisConfig, } from './types/field_vis_config'; -import { FileBasedNumberContentPreview } from '../file_based/components/field_data_row'; import { BooleanContentPreview } from './components/field_data_row'; const FIELD_NAME = 'fieldName'; @@ -224,8 +223,6 @@ export const DataVisualizerTable = ({ if (item.type === ML_JOB_FIELD_TYPES.NUMBER) { if (isIndexBasedFieldVisConfig(item) && item.stats?.distribution !== undefined) { return ; - } else { - return ; } } diff --git a/x-pack/plugins/ml/public/application/explorer/actions/load_explorer_data.ts b/x-pack/plugins/ml/public/application/explorer/actions/load_explorer_data.ts index 1871e8925cb75..6d70566af1a64 100644 --- a/x-pack/plugins/ml/public/application/explorer/actions/load_explorer_data.ts +++ b/x-pack/plugins/ml/public/application/explorer/actions/load_explorer_data.ts @@ -23,6 +23,7 @@ import { loadAnomaliesTableData, loadFilteredTopInfluencers, loadTopInfluencers, + loadOverallAnnotations, AppStateSelectedCells, ExplorerJob, } from '../explorer_utils'; @@ -55,6 +56,10 @@ const memoize = any>(func: T, context?: any) => { return memoizeOne(wrapWithLastRefreshArg(func, context) as any, memoizeIsEqual); }; +const memoizedLoadOverallAnnotations = memoize( + loadOverallAnnotations +); + const memoizedLoadAnnotationsTableData = memoize( loadAnnotationsTableData ); @@ -149,9 +154,17 @@ const loadExplorerDataProvider = ( const dateFormatTz = getDateFormatTz(); + const interval = swimlaneBucketInterval.asSeconds(); + // First get the data where we have all necessary args at hand using forkJoin: // annotationsData, anomalyChartRecords, influencers, overallState, tableData, topFieldValues return forkJoin({ + overallAnnotations: memoizedLoadOverallAnnotations( + lastRefresh, + selectedJobs, + interval, + bounds + ), annotationsData: memoizedLoadAnnotationsTableData( lastRefresh, selectedCells, @@ -214,6 +227,7 @@ const loadExplorerDataProvider = ( tap(explorerService.setChartsDataLoading), mergeMap( ({ + overallAnnotations, anomalyChartRecords, influencers, overallState, @@ -271,6 +285,7 @@ const loadExplorerDataProvider = ( }), map(({ viewBySwimlaneState, filteredTopInfluencers }) => { return { + overallAnnotations, annotations: annotationsData, influencers: filteredTopInfluencers as any, loading: false, diff --git a/x-pack/plugins/ml/public/application/explorer/anomaly_timeline.tsx b/x-pack/plugins/ml/public/application/explorer/anomaly_timeline.tsx index 37967d18dbbd9..38cb556aaf0d2 100644 --- a/x-pack/plugins/ml/public/application/explorer/anomaly_timeline.tsx +++ b/x-pack/plugins/ml/public/application/explorer/anomaly_timeline.tsx @@ -87,6 +87,7 @@ export const AnomalyTimeline: FC = React.memo( viewByPerPage, swimlaneLimit, loading, + overallAnnotations, } = explorerState; const menuItems = useMemo(() => { @@ -240,6 +241,7 @@ export const AnomalyTimeline: FC = React.memo( isLoading={loading} noDataWarning={} showTimeline={false} + annotationsData={overallAnnotations.annotationsData} /> @@ -257,6 +259,7 @@ export const AnomalyTimeline: FC = React.memo( }) } timeBuckets={timeBuckets} + showLegend={false} swimlaneData={viewBySwimlaneData as ViewBySwimLaneData} swimlaneType={SWIMLANE_TYPE.VIEW_BY} selection={selectedCells} diff --git a/x-pack/plugins/ml/public/application/explorer/explorer_utils.d.ts b/x-pack/plugins/ml/public/application/explorer/explorer_utils.d.ts index b410449218d02..ebab308b86027 100644 --- a/x-pack/plugins/ml/public/application/explorer/explorer_utils.d.ts +++ b/x-pack/plugins/ml/public/application/explorer/explorer_utils.d.ts @@ -110,6 +110,12 @@ declare interface SwimlaneBounds { latest: number; } +export declare const loadOverallAnnotations: ( + selectedJobs: ExplorerJob[], + interval: number, + bounds: TimeRangeBounds +) => Promise; + export declare const loadAnnotationsTableData: ( selectedCells: AppStateSelectedCells | undefined, selectedJobs: ExplorerJob[], diff --git a/x-pack/plugins/ml/public/application/explorer/explorer_utils.js b/x-pack/plugins/ml/public/application/explorer/explorer_utils.js index 69bdac060a2dc..ecf347e6b142f 100644 --- a/x-pack/plugins/ml/public/application/explorer/explorer_utils.js +++ b/x-pack/plugins/ml/public/application/explorer/explorer_utils.js @@ -385,6 +385,57 @@ export function getViewBySwimlaneOptions({ }; } +export function loadOverallAnnotations(selectedJobs, interval, bounds) { + const jobIds = selectedJobs.map((d) => d.id); + const timeRange = getSelectionTimeRange(undefined, interval, bounds); + + return new Promise((resolve) => { + ml.annotations + .getAnnotations$({ + jobIds, + earliestMs: timeRange.earliestMs, + latestMs: timeRange.latestMs, + maxAnnotations: ANNOTATIONS_TABLE_DEFAULT_QUERY_SIZE, + }) + .toPromise() + .then((resp) => { + if (resp.error !== undefined || resp.annotations === undefined) { + const errorMessage = extractErrorMessage(resp.error); + return resolve({ + annotationsData: [], + error: errorMessage !== '' ? errorMessage : undefined, + }); + } + + const annotationsData = []; + jobIds.forEach((jobId) => { + const jobAnnotations = resp.annotations[jobId]; + if (jobAnnotations !== undefined) { + annotationsData.push(...jobAnnotations); + } + }); + + return resolve({ + annotationsData: annotationsData + .sort((a, b) => { + return a.timestamp - b.timestamp; + }) + .map((d, i) => { + d.key = (i + 1).toString(); + return d; + }), + }); + }) + .catch((resp) => { + const errorMessage = extractErrorMessage(resp); + return resolve({ + annotationsData: [], + error: errorMessage !== '' ? errorMessage : undefined, + }); + }); + }); +} + export function loadAnnotationsTableData(selectedCells, selectedJobs, interval, bounds) { const jobIds = selectedCells !== undefined && selectedCells.viewByFieldName === VIEW_BY_JOB_LABEL diff --git a/x-pack/plugins/ml/public/application/explorer/reducers/explorer_reducer/state.ts b/x-pack/plugins/ml/public/application/explorer/reducers/explorer_reducer/state.ts index e9527b7c232e5..faab658740a70 100644 --- a/x-pack/plugins/ml/public/application/explorer/reducers/explorer_reducer/state.ts +++ b/x-pack/plugins/ml/public/application/explorer/reducers/explorer_reducer/state.ts @@ -27,6 +27,7 @@ import { SWIM_LANE_DEFAULT_PAGE_SIZE } from '../../explorer_constants'; import { InfluencersFilterQuery } from '../../../../../common/types/es_client'; export interface ExplorerState { + overallAnnotations: AnnotationsTable; annotations: AnnotationsTable; anomalyChartsDataLoading: boolean; chartsData: ExplorerChartsData; @@ -65,6 +66,11 @@ function getDefaultIndexPattern() { export function getExplorerDefaultState(): ExplorerState { return { + overallAnnotations: { + error: undefined, + annotationsData: [], + aggregations: {}, + }, annotations: { error: undefined, annotationsData: [], diff --git a/x-pack/plugins/ml/public/application/explorer/swimlane_annotation_container.tsx b/x-pack/plugins/ml/public/application/explorer/swimlane_annotation_container.tsx new file mode 100644 index 0000000000000..686413ff0188b --- /dev/null +++ b/x-pack/plugins/ml/public/application/explorer/swimlane_annotation_container.tsx @@ -0,0 +1,149 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import React, { FC, useEffect } from 'react'; +import d3 from 'd3'; +import { scaleTime } from 'd3-scale'; +import { i18n } from '@kbn/i18n'; +import { formatHumanReadableDateTimeSeconds } from '../../../common/util/date_utils'; +import { AnnotationsTable } from '../../../common/types/annotations'; +import { ChartTooltipService } from '../components/chart_tooltip'; + +export const Y_AXIS_LABEL_WIDTH = 170; +export const Y_AXIS_LABEL_PADDING = 8; +export const Y_AXIS_LABEL_FONT_COLOR = '#6a717d'; +const ANNOTATION_CONTAINER_HEIGHT = 12; +const ANNOTATION_MARGIN = 2; +const ANNOTATION_MIN_WIDTH = 5; +const ANNOTATION_HEIGHT = ANNOTATION_CONTAINER_HEIGHT - 2 * ANNOTATION_MARGIN; + +interface SwimlaneAnnotationContainerProps { + chartWidth: number; + domain: { + min: number; + max: number; + }; + annotationsData?: AnnotationsTable['annotationsData']; + tooltipService: ChartTooltipService; +} + +export const SwimlaneAnnotationContainer: FC = ({ + chartWidth, + domain, + annotationsData, + tooltipService, +}) => { + const canvasRef = React.useRef(null); + + useEffect(() => { + if (canvasRef.current !== null && Array.isArray(annotationsData)) { + const chartElement = d3.select(canvasRef.current); + chartElement.selectAll('*').remove(); + + const dimensions = canvasRef.current.getBoundingClientRect(); + + const startingXPos = Y_AXIS_LABEL_WIDTH + 2 * Y_AXIS_LABEL_PADDING; + const endingXPos = dimensions.width - 2 * Y_AXIS_LABEL_PADDING - 4; + + const svg = chartElement + .append('svg') + .attr('width', '100%') + .attr('height', ANNOTATION_CONTAINER_HEIGHT); + + const xScale = scaleTime().domain([domain.min, domain.max]).range([startingXPos, endingXPos]); + + // Add Annotation y axis label + svg + .append('text') + .attr('text-anchor', 'end') + .attr('class', 'swimlaneAnnotationLabel') + .text( + i18n.translate('xpack.ml.explorer.swimlaneAnnotationLabel', { + defaultMessage: 'Annotations', + }) + ) + .attr('x', Y_AXIS_LABEL_WIDTH + Y_AXIS_LABEL_PADDING) + .attr('y', ANNOTATION_CONTAINER_HEIGHT) + .style('fill', Y_AXIS_LABEL_FONT_COLOR) + .style('font-size', '12px'); + + // Add border + svg + .append('rect') + .attr('x', startingXPos) + .attr('y', 0) + .attr('height', ANNOTATION_CONTAINER_HEIGHT) + .attr('width', endingXPos - startingXPos) + .style('stroke', '#cccccc') + .style('fill', 'none') + .style('stroke-width', 1); + + // Add annotation marker + annotationsData.forEach((d) => { + const annotationWidth = d.end_timestamp + ? xScale(Math.min(d.end_timestamp, domain.max)) - + Math.max(xScale(d.timestamp), startingXPos) + : 0; + + svg + .append('rect') + .classed('mlAnnotationRect', true) + .attr('x', d.timestamp >= domain.min ? xScale(d.timestamp) : startingXPos) + .attr('y', ANNOTATION_MARGIN) + .attr('height', ANNOTATION_HEIGHT) + .attr('width', Math.max(annotationWidth, ANNOTATION_MIN_WIDTH)) + .attr('rx', ANNOTATION_MARGIN) + .attr('ry', ANNOTATION_MARGIN) + .on('mouseover', function () { + const startingTime = formatHumanReadableDateTimeSeconds(d.timestamp); + const endingTime = + d.end_timestamp !== undefined + ? formatHumanReadableDateTimeSeconds(d.end_timestamp) + : undefined; + + const timeLabel = endingTime ? `${startingTime} - ${endingTime}` : startingTime; + + const tooltipData = [ + { + label: `${d.annotation}`, + seriesIdentifier: { + key: 'anomaly_timeline', + specId: d._id ?? `${d.annotation}-${d.timestamp}-label`, + }, + valueAccessor: 'label', + }, + { + label: `${timeLabel}`, + seriesIdentifier: { + key: 'anomaly_timeline', + specId: d._id ?? `${d.annotation}-${d.timestamp}-ts`, + }, + valueAccessor: 'time', + }, + ]; + if (d.partition_field_name !== undefined && d.partition_field_value !== undefined) { + tooltipData.push({ + label: `${d.partition_field_name}: ${d.partition_field_value}`, + seriesIdentifier: { + key: 'anomaly_timeline', + specId: d._id + ? `${d._id}-partition` + : `${d.partition_field_name}-${d.partition_field_value}-label`, + }, + valueAccessor: 'partition', + }); + } + // @ts-ignore we don't need all the fields for tooltip to show + tooltipService.show(tooltipData, this); + }) + .on('mouseout', () => tooltipService.hide()); + }); + } + }, [chartWidth, domain, annotationsData]); + + return
    ; +}; diff --git a/x-pack/plugins/ml/public/application/explorer/swimlane_container.tsx b/x-pack/plugins/ml/public/application/explorer/swimlane_container.tsx index c108257094b6a..0f445a4872417 100644 --- a/x-pack/plugins/ml/public/application/explorer/swimlane_container.tsx +++ b/x-pack/plugins/ml/public/application/explorer/swimlane_container.tsx @@ -38,13 +38,20 @@ import { ANOMALY_THRESHOLD, SEVERITY_COLORS } from '../../../common'; import { TimeBuckets as TimeBucketsClass } from '../util/time_buckets'; import { SWIMLANE_TYPE, SwimlaneType } from './explorer_constants'; import { mlEscape } from '../util/string_utils'; -import { FormattedTooltip } from '../components/chart_tooltip/chart_tooltip'; +import { FormattedTooltip, MlTooltipComponent } from '../components/chart_tooltip/chart_tooltip'; import { formatHumanReadableDateTime } from '../../../common/util/date_utils'; import { getFormattedSeverityScore } from '../../../common/util/anomaly_utils'; import './_explorer.scss'; import { EMPTY_FIELD_VALUE_LABEL } from '../timeseriesexplorer/components/entity_control/entity_control'; import { useUiSettings } from '../contexts/kibana'; +import { + SwimlaneAnnotationContainer, + Y_AXIS_LABEL_WIDTH, + Y_AXIS_LABEL_PADDING, + Y_AXIS_LABEL_FONT_COLOR, +} from './swimlane_annotation_container'; +import { AnnotationsTable } from '../../../common/types/annotations'; declare global { interface Window { @@ -61,8 +68,10 @@ declare global { const RESIZE_THROTTLE_TIME_MS = 500; const CELL_HEIGHT = 30; const LEGEND_HEIGHT = 34; + const Y_AXIS_HEIGHT = 24; -export const SWIM_LANE_LABEL_WIDTH = 200; + +export const SWIM_LANE_LABEL_WIDTH = Y_AXIS_LABEL_WIDTH + 2 * Y_AXIS_LABEL_PADDING; export function isViewBySwimLaneData(arg: any): arg is ViewBySwimLaneData { return arg && arg.hasOwnProperty('cardinality'); @@ -125,6 +134,7 @@ export interface SwimlaneProps { filterActive?: boolean; maskAll?: boolean; timeBuckets: InstanceType; + showLegend?: boolean; swimlaneData: OverallSwimlaneData | ViewBySwimLaneData; swimlaneType: SwimlaneType; selection?: AppStateSelectedCells; @@ -145,6 +155,7 @@ export interface SwimlaneProps { * Enables/disables timeline on the X-axis. */ showTimeline?: boolean; + annotationsData?: AnnotationsTable['annotationsData']; } /** @@ -168,6 +179,8 @@ export const SwimlaneContainer: FC = ({ timeBuckets, maskAll, showTimeline = true, + showLegend = true, + annotationsData, 'data-test-subj': dataTestSubj, }) => { const [chartWidth, setChartWidth] = useState(0); @@ -292,13 +305,14 @@ export const SwimlaneContainer: FC = ({ }, yAxisLabel: { visible: true, - width: 170, + width: Y_AXIS_LABEL_WIDTH, // eui color subdued - fill: `#6a717d`, - padding: 8, + fill: Y_AXIS_LABEL_FONT_COLOR, + padding: Y_AXIS_LABEL_PADDING, formatter: (laneLabel: string) => { return laneLabel === '' ? EMPTY_FIELD_VALUE_LABEL : laneLabel; }, + fontSize: 12, }, xAxisLabel: { visible: true, @@ -309,6 +323,7 @@ export const SwimlaneContainer: FC = ({ const scaledDateFormat = timeBuckets.getScaledDateFormat(); return moment(v).format(scaledDateFormat); }, + fontSize: 12, }, brushMask: { fill: isDarkTheme ? 'rgb(30,31,35,80%)' : 'rgb(247,247,247,50%)', @@ -354,6 +369,14 @@ export const SwimlaneContainer: FC = ({ [swimlaneData?.fieldName] ); + const xDomain = swimlaneData + ? { + min: swimlaneData.earliest * 1000, + max: swimlaneData.latest * 1000, + minInterval: swimlaneData.interval * 1000, + } + : undefined; + // A resize observer is required to compute the bucket span based on the chart width to fetch the data accordingly return ( @@ -372,77 +395,95 @@ export const SwimlaneContainer: FC = ({ }} grow={false} > -
    - {showSwimlane && !isLoading && ( - - +
    + {showSwimlane && !isLoading && ( + + + + + + )} + + {isLoading && ( + - - - )} - - {isLoading && ( - - + + + )} + {!isLoading && !showSwimlane && ( + {noDataWarning}} /> - - )} - {!isLoading && !showSwimlane && ( - {noDataWarning}} - /> - )} -
    + )} +
    + {swimlaneType === SWIMLANE_TYPE.OVERALL && + showSwimlane && + xDomain !== undefined && + !isLoading && ( + + {(tooltipService) => ( + + )} + + )} + {isPaginationVisible && ( diff --git a/x-pack/plugins/ml/public/application/jobs/jobs_list/components/edit_job_flyout/edit_job_flyout.js b/x-pack/plugins/ml/public/application/jobs/jobs_list/components/edit_job_flyout/edit_job_flyout.js index b23bbedb7413a..758e3fa472a0b 100644 --- a/x-pack/plugins/ml/public/application/jobs/jobs_list/components/edit_job_flyout/edit_job_flyout.js +++ b/x-pack/plugins/ml/public/application/jobs/jobs_list/components/edit_job_flyout/edit_job_flyout.js @@ -32,7 +32,7 @@ import { toastNotificationServiceProvider } from '../../../../services/toast_not import { ml } from '../../../../services/ml_api_service'; import { withKibana } from '../../../../../../../../../src/plugins/kibana_react/public'; import { collapseLiteralStrings } from '../../../../../../shared_imports'; -import { DATAFEED_STATE } from '../../../../../../common/constants/states'; +import { DATAFEED_STATE, JOB_STATE } from '../../../../../../common/constants/states'; export class EditJobFlyoutUI extends Component { _initialJobFormState = null; @@ -176,11 +176,13 @@ export class EditJobFlyoutUI extends Component { extractJob(job, hasDatafeed) { this.extractInitialJobFormState(job, hasDatafeed); const datafeedRunning = hasDatafeed && job.datafeed_config.state !== DATAFEED_STATE.STOPPED; + const jobClosed = job.state === JOB_STATE.CLOSED; this.setState({ job, hasDatafeed, datafeedRunning, + jobClosed, jobModelMemoryLimitValidationError: '', jobGroupsValidationError: '', ...cloneDeep(this._initialJobFormState), @@ -318,6 +320,7 @@ export class EditJobFlyoutUI extends Component { isValidJobDetails, isValidJobCustomUrls, datafeedRunning, + jobClosed, } = this.state; const tabs = [ @@ -328,6 +331,7 @@ export class EditJobFlyoutUI extends Component { }), content: ( ({ label: g, color: tabColor(g) })) : []; + const { datafeedRunning, jobClosed } = props; + + let mmlHelpText = null; + if (!jobClosed) { + mmlHelpText = ( + + ); + } + + if (datafeedRunning) { + mmlHelpText = ( + + ); + } + return { description: props.jobDescription, selectedGroups, mml: props.jobModelMemoryLimit, + mmlHelpText, mmlValidationError: props.jobModelMemoryLimitValidationError, groupsValidationError: props.jobGroupsValidationError, modelSnapshotRetentionDays: props.jobModelSnapshotRetentionDays, @@ -139,8 +161,11 @@ export class JobDetails extends Component { groupsValidationError, modelSnapshotRetentionDays, dailyModelSnapshotRetentionAfterDays, + mmlHelpText, } = this.state; - const { datafeedRunning } = this.props; + + const { datafeedRunning, jobClosed } = this.props; + return ( @@ -188,14 +213,7 @@ export class JobDetails extends Component { defaultMessage="Model memory limit" /> } - helpText={ - datafeedRunning ? ( - - ) : null - } + helpText={mmlHelpText} isInvalid={mmlValidationError !== ''} error={mmlValidationError} > @@ -204,7 +222,7 @@ export class JobDetails extends Component { onChange={this.onMmlChange} isInvalid={mmlValidationError !== ''} error={mmlValidationError} - disabled={datafeedRunning} + disabled={datafeedRunning || !jobClosed} /> item.deleting !== true, diff --git a/x-pack/plugins/ml/public/application/jobs/jobs_list/components/job_details/extract_job_details.js b/x-pack/plugins/ml/public/application/jobs/jobs_list/components/job_details/extract_job_details.js index 6e6b4df6dd452..5b7a41e572dab 100644 --- a/x-pack/plugins/ml/public/application/jobs/jobs_list/components/job_details/extract_job_details.js +++ b/x-pack/plugins/ml/public/application/jobs/jobs_list/components/job_details/extract_job_details.js @@ -10,6 +10,7 @@ import { detectorToString } from '../../../../util/string_utils'; import { formatValues, filterObjects } from './format_values'; import { i18n } from '@kbn/i18n'; import { EuiLink } from '@elastic/eui'; +import { EditAlertRule } from '../../../../../alerting/ml_alerting_flyout'; export function extractJobDetails(job, basePath) { if (Object.keys(job).length === 0) { @@ -74,6 +75,17 @@ export function extractJobDetails(job, basePath) { } } + const alertRules = { + id: 'alertRules', + title: i18n.translate('xpack.ml.jobsList.jobDetails.alertRulesTitle', { + defaultMessage: 'Alert rules', + }), + position: 'right', + items: (job.alerting_rules ?? []).map((v) => { + return ['', ]; + }), + }; + const detectors = { id: 'detectors', title: i18n.translate('xpack.ml.jobsList.jobDetails.detectorsTitle', { @@ -206,5 +218,6 @@ export function extractJobDetails(job, basePath) { modelSizeStats, jobTimingStats, datafeedTimingStats, + alertRules, }; } diff --git a/x-pack/plugins/ml/public/application/jobs/jobs_list/components/job_details/job_details.js b/x-pack/plugins/ml/public/application/jobs/jobs_list/components/job_details/job_details.js index 99581fb3c7e95..c8412a2a83d8a 100644 --- a/x-pack/plugins/ml/public/application/jobs/jobs_list/components/job_details/job_details.js +++ b/x-pack/plugins/ml/public/application/jobs/jobs_list/components/job_details/job_details.js @@ -70,6 +70,7 @@ export class JobDetailsUI extends Component { modelSizeStats, jobTimingStats, datafeedTimingStats, + alertRules, } = extractJobDetails(job, basePath); const { showFullDetails, refreshJobList } = this.props; @@ -83,7 +84,7 @@ export class JobDetailsUI extends Component { content: ( ), time: job.open_time, diff --git a/x-pack/plugins/ml/public/application/jobs/jobs_list/components/jobs_list/jobs_list.js b/x-pack/plugins/ml/public/application/jobs/jobs_list/components/jobs_list/jobs_list.js index 4674342990df4..abd0794ff2c35 100644 --- a/x-pack/plugins/ml/public/application/jobs/jobs_list/components/jobs_list/jobs_list.js +++ b/x-pack/plugins/ml/public/application/jobs/jobs_list/components/jobs_list/jobs_list.js @@ -18,7 +18,13 @@ import { JobIcon } from '../../../../components/job_message_icon'; import { JobSpacesList } from '../../../../components/job_spaces_list'; import { TIME_FORMAT } from '../../../../../../common/constants/time_format'; -import { EuiBasicTable, EuiButtonIcon, EuiScreenReaderOnly } from '@elastic/eui'; +import { + EuiBasicTable, + EuiButtonIcon, + EuiScreenReaderOnly, + EuiIcon, + EuiToolTip, +} from '@elastic/eui'; import { i18n } from '@kbn/i18n'; import { FormattedMessage } from '@kbn/i18n/react'; import { AnomalyDetectionJobIdLink } from './job_id_link'; @@ -161,7 +167,7 @@ export class JobsList extends Component { }), sortable: true, truncateText: false, - width: '20%', + width: '15%', scope: 'row', render: isManagementTable ? (id) => this.getJobIdLink(id) : undefined, }, @@ -172,13 +178,45 @@ export class JobsList extends Component {

    ), render: (item) => , }, + { + field: 'alertingRules', + name: ( + +

    + +

    +
    + ), + width: '30px', + render: (item) => { + return Array.isArray(item) ? ( + + } + > + + + ) : ( + + ); + }, + }, { name: i18n.translate('xpack.ml.jobsList.descriptionLabel', { defaultMessage: 'Description', diff --git a/x-pack/plugins/ml/public/application/jobs/jobs_list/components/multi_job_actions/actions_menu.js b/x-pack/plugins/ml/public/application/jobs/jobs_list/components/multi_job_actions/actions_menu.js index e1314eb718836..6b3d6bc8971f5 100644 --- a/x-pack/plugins/ml/public/application/jobs/jobs_list/components/multi_job_actions/actions_menu.js +++ b/x-pack/plugins/ml/public/application/jobs/jobs_list/components/multi_job_actions/actions_menu.js @@ -159,7 +159,7 @@ class MultiJobActionsMenuUI extends Component { > ); diff --git a/x-pack/plugins/ml/public/application/jobs/jobs_list/components/start_datafeed_modal/start_datafeed_modal.js b/x-pack/plugins/ml/public/application/jobs/jobs_list/components/start_datafeed_modal/start_datafeed_modal.js index 361e8956c714e..12ca42feec6da 100644 --- a/x-pack/plugins/ml/public/application/jobs/jobs_list/components/start_datafeed_modal/start_datafeed_modal.js +++ b/x-pack/plugins/ml/public/application/jobs/jobs_list/components/start_datafeed_modal/start_datafeed_modal.js @@ -173,7 +173,7 @@ export class StartDatafeedModal extends Component { label={ } checked={createAlert} diff --git a/x-pack/plugins/ml/public/application/jobs/new_job/common/job_creator/job_creator.ts b/x-pack/plugins/ml/public/application/jobs/new_job/common/job_creator/job_creator.ts index 6693d1cd6de74..fe0329851758c 100644 --- a/x-pack/plugins/ml/public/application/jobs/new_job/common/job_creator/job_creator.ts +++ b/x-pack/plugins/ml/public/application/jobs/new_job/common/job_creator/job_creator.ts @@ -642,7 +642,6 @@ export class JobCreator { this._job_config.custom_settings !== undefined && this._job_config.custom_settings[setting] !== undefined ) { - // @ts-expect-error return this._job_config.custom_settings[setting]; } return null; @@ -711,13 +710,14 @@ export class JobCreator { } private _extractRuntimeMappings() { - const runtimeFieldMap = this._indexPattern.toSpec().runtimeFieldMap; + const runtimeFieldMap = this._indexPattern.toSpec().runtimeFieldMap as + | RuntimeMappings + | undefined; if (runtimeFieldMap !== undefined) { if (this._datafeed_config.runtime_mappings === undefined) { this._datafeed_config.runtime_mappings = {}; } Object.entries(runtimeFieldMap).forEach(([key, val]) => { - // @ts-expect-error this._datafeed_config.runtime_mappings![key] = val; }); } diff --git a/x-pack/plugins/ml/public/application/jobs/new_job/common/job_creator/util/default_configs.ts b/x-pack/plugins/ml/public/application/jobs/new_job/common/job_creator/util/default_configs.ts index bf354b8ad984f..68476bb928121 100644 --- a/x-pack/plugins/ml/public/application/jobs/new_job/common/job_creator/util/default_configs.ts +++ b/x-pack/plugins/ml/public/application/jobs/new_job/common/job_creator/util/default_configs.ts @@ -11,7 +11,7 @@ import { Job, Datafeed, Detector } from '../../../../../../../common/types/anoma import { splitIndexPatternNames } from '../../../../../../../common/util/job_utils'; export function createEmptyJob(): Job { - // @ts-expect-error + // @ts-expect-error incomplete job return { job_id: '', description: '', @@ -28,7 +28,7 @@ export function createEmptyJob(): Job { } export function createEmptyDatafeed(indexPatternTitle: IndexPatternTitle): Datafeed { - // @ts-expect-error + // @ts-expect-error incomplete datafeed return { datafeed_id: '', job_id: '', diff --git a/x-pack/plugins/ml/public/application/jobs/new_job/common/job_creator/util/filter_runtime_mappings.test.ts b/x-pack/plugins/ml/public/application/jobs/new_job/common/job_creator/util/filter_runtime_mappings.test.ts index c67a93c5e0626..7f1ee2349c2c1 100644 --- a/x-pack/plugins/ml/public/application/jobs/new_job/common/job_creator/util/filter_runtime_mappings.test.ts +++ b/x-pack/plugins/ml/public/application/jobs/new_job/common/job_creator/util/filter_runtime_mappings.test.ts @@ -9,7 +9,7 @@ import { Job, Datafeed } from '../../../../../../../common/types/anomaly_detecti import { filterRuntimeMappings } from './filter_runtime_mappings'; function getJob(): Job { - // @ts-expect-error + // @ts-expect-error incomplete job type for test return { job_id: 'test', description: '', @@ -102,7 +102,7 @@ describe('filter_runtime_mappings', () => { datafeed = getDatafeed(); }); - test('returns no runtime mappings, no mappings in aggs', () => { + test('returns no runtime fields, no mappings in aggs', () => { const resp = filterRuntimeMappings(job, datafeed); expect(Object.keys(resp.runtime_mappings).length).toEqual(0); @@ -111,7 +111,7 @@ describe('filter_runtime_mappings', () => { expect(resp.discarded_mappings.airline_lower).not.toEqual(undefined); }); - test('returns no runtime mappings, no runtime mappings in datafeed', () => { + test('returns no runtime fields, no runtime fields in datafeed', () => { datafeed.runtime_mappings = undefined; const resp = filterRuntimeMappings(job, datafeed); expect(Object.keys(resp.runtime_mappings).length).toEqual(0); @@ -131,7 +131,7 @@ describe('filter_runtime_mappings', () => { expect(resp.discarded_mappings.airline_lower).not.toEqual(undefined); }); - test('return no runtime mappings, no mappings in aggs', () => { + test('return no runtime fields, no mappings in aggs', () => { datafeed.aggregations = getAggs(); datafeed.aggregations!.buckets!.aggregations!.responsetime!.avg!.field! = 'responsetime'; @@ -154,7 +154,7 @@ describe('filter_runtime_mappings', () => { expect(resp.discarded_mappings.airline_lower).not.toEqual(undefined); }); - test('return two runtime mappings, no mappings in aggs', () => { + test('return two runtime fields, no mappings in aggs', () => { // set the detector field to be a runtime mapping job.analysis_config.detectors[0].field_name = 'responsetime_big'; // set the detector by field to be a runtime mapping @@ -167,7 +167,7 @@ describe('filter_runtime_mappings', () => { expect(Object.keys(resp.discarded_mappings).length).toEqual(0); }); - test('return two runtime mappings, no mappings in aggs, categorization job', () => { + test('return two runtime fields, no mappings in aggs, categorization job', () => { job.analysis_config.detectors[0].function = 'count'; // set the detector field to be a runtime mapping job.analysis_config.detectors[0].field_name = undefined; diff --git a/x-pack/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/components/advanced_detector_modal/advanced_detector_modal.tsx b/x-pack/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/components/advanced_detector_modal/advanced_detector_modal.tsx index 10c160f58ff77..d3108eef04983 100644 --- a/x-pack/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/components/advanced_detector_modal/advanced_detector_modal.tsx +++ b/x-pack/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/components/advanced_detector_modal/advanced_detector_modal.tsx @@ -171,8 +171,10 @@ export const AdvancedDetectorModal: FC = ({ byField, overField, partitionField, - // @ts-expect-error - excludeFrequent: excludeFrequentOption.label !== '' ? excludeFrequentOption.label : null, + excludeFrequent: + excludeFrequentOption.label !== '' + ? (excludeFrequentOption.label as estypes.ExcludeFrequent) + : null, description: descriptionOption !== '' ? descriptionOption : null, customRules: null, }; diff --git a/x-pack/plugins/ml/public/application/jobs/new_job/pages/components/summary_step/components/post_save_options/post_save_options.tsx b/x-pack/plugins/ml/public/application/jobs/new_job/pages/components/summary_step/components/post_save_options/post_save_options.tsx index 6cefc239905c7..472654c4b3c85 100644 --- a/x-pack/plugins/ml/public/application/jobs/new_job/pages/components/summary_step/components/post_save_options/post_save_options.tsx +++ b/x-pack/plugins/ml/public/application/jobs/new_job/pages/components/summary_step/components/post_save_options/post_save_options.tsx @@ -87,7 +87,7 @@ export const PostSaveOptions: FC = ({ jobRunner }) => { > diff --git a/x-pack/plugins/ml/public/application/overview/components/analytics_panel/analytics_panel.tsx b/x-pack/plugins/ml/public/application/overview/components/analytics_panel/analytics_panel.tsx index 630e8c16629cb..3a67b413dbdf6 100644 --- a/x-pack/plugins/ml/public/application/overview/components/analytics_panel/analytics_panel.tsx +++ b/x-pack/plugins/ml/public/application/overview/components/analytics_panel/analytics_panel.tsx @@ -26,6 +26,7 @@ import { DataFrameAnalyticsListRow } from '../../../data_frame_analytics/pages/a import { AnalyticStatsBarStats, StatsBar } from '../../../components/stats_bar'; import { useMlUrlGenerator, useNavigateToPath } from '../../../contexts/kibana'; import { ML_PAGES } from '../../../../../common/constants/ml_url_generator'; +import { SourceSelection } from '../../../data_frame_analytics/pages/analytics_management/components/source_selection'; interface Props { jobCreationDisabled: boolean; @@ -38,6 +39,7 @@ export const AnalyticsPanel: FC = ({ jobCreationDisabled, setLazyJobCount ); const [errorMessage, setErrorMessage] = useState(undefined); const [isInitialized, setIsInitialized] = useState(false); + const [isSourceIndexModalVisible, setIsSourceIndexModalVisible] = useState(false); const mlUrlGenerator = useMlUrlGenerator(); const navigateToPath = useNavigateToPath(); @@ -110,7 +112,7 @@ export const AnalyticsPanel: FC = ({ jobCreationDisabled, setLazyJobCount } actions={ setIsSourceIndexModalVisible(true)} color="primary" fill iconType="plusInCircle" @@ -160,6 +162,9 @@ export const AnalyticsPanel: FC = ({ jobCreationDisabled, setLazyJobCount
    )} + {isSourceIndexModalVisible === true && ( + setIsSourceIndexModalVisible(false)} /> + )} ); }; diff --git a/x-pack/plugins/ml/public/application/routing/routes/datavisualizer/file_based.tsx b/x-pack/plugins/ml/public/application/routing/routes/datavisualizer/file_based.tsx index ae3b35bbb2b91..5b16bf8352b27 100644 --- a/x-pack/plugins/ml/public/application/routing/routes/datavisualizer/file_based.tsx +++ b/x-pack/plugins/ml/public/application/routing/routes/datavisualizer/file_based.tsx @@ -38,7 +38,7 @@ export const fileBasedRouteFactory = ( ], }); -const PageWrapper: FC = ({ location, deps }) => { +const PageWrapper: FC = ({ deps }) => { const { redirectToMlAccessDeniedPage } = deps; const { context } = useResolver(undefined, undefined, deps.config, { @@ -47,9 +47,10 @@ const PageWrapper: FC = ({ location, deps }) => { checkFindFileStructurePrivilege: () => checkFindFileStructurePrivilegeResolver(redirectToMlAccessDeniedPage), }); + return ( - + ); }; diff --git a/x-pack/plugins/ml/public/application/services/ml_api_service/annotations.ts b/x-pack/plugins/ml/public/application/services/ml_api_service/annotations.ts index 88c98b888f5e6..f3f9e935a92c7 100644 --- a/x-pack/plugins/ml/public/application/services/ml_api_service/annotations.ts +++ b/x-pack/plugins/ml/public/application/services/ml_api_service/annotations.ts @@ -19,9 +19,9 @@ export const annotations = { earliestMs: number; latestMs: number; maxAnnotations: number; - fields: FieldToBucket[]; - detectorIndex: number; - entities: any[]; + fields?: FieldToBucket[]; + detectorIndex?: number; + entities?: any[]; }) { const body = JSON.stringify(obj); return http$({ diff --git a/x-pack/plugins/ml/public/application/services/results_service/results_service.js b/x-pack/plugins/ml/public/application/services/results_service/results_service.js index c258d07cab484..71be7bcd2b7eb 100644 --- a/x-pack/plugins/ml/public/application/services/results_service/results_service.js +++ b/x-pack/plugins/ml/public/application/services/results_service/results_service.js @@ -970,7 +970,7 @@ export function resultsServiceProvider(mlApiServices) { }, }, }, - // Runtime mappings only needed to support when query includes a runtime field + // Runtime fields only needed to support when query includes a runtime field // even though the default timeField can be a search time runtime field // because currently Kibana doesn't support that ...(isPopulatedObject(runtimeMappings) && query diff --git a/x-pack/plugins/ml/public/application/timeseriesexplorer/components/timeseries_chart/timeseries_chart.js b/x-pack/plugins/ml/public/application/timeseriesexplorer/components/timeseries_chart/timeseries_chart.js index 3725f57eab026..9eb2390b4bf99 100644 --- a/x-pack/plugins/ml/public/application/timeseriesexplorer/components/timeseries_chart/timeseries_chart.js +++ b/x-pack/plugins/ml/public/application/timeseriesexplorer/components/timeseries_chart/timeseries_chart.js @@ -1135,7 +1135,7 @@ class TimeseriesChartIntl extends Component { .attr('y', cxtChartHeight + swlHeight + 2) .attr('height', ANNOTATION_SYMBOL_HEIGHT) .attr('width', (d) => { - const start = this.contextXScale(moment(d.timestamp)) + 1; + const start = Math.max(this.contextXScale(moment(d.timestamp)) + 1, contextXRangeStart); const end = typeof d.end_timestamp !== 'undefined' ? this.contextXScale(moment(d.end_timestamp)) - 1 diff --git a/x-pack/plugins/ml/public/application/util/dependency_cache.ts b/x-pack/plugins/ml/public/application/util/dependency_cache.ts index 215f087020d6f..759d0dcc68741 100644 --- a/x-pack/plugins/ml/public/application/util/dependency_cache.ts +++ b/x-pack/plugins/ml/public/application/util/dependency_cache.ts @@ -23,7 +23,7 @@ import type { IndexPatternsContract, DataPublicPluginStart } from 'src/plugins/d import type { SharePluginStart } from 'src/plugins/share/public'; import type { SecurityPluginSetup } from '../../../../security/public'; import type { MapsStartApi } from '../../../../maps/public'; -import type { FileUploadPluginStart } from '../../../../file_upload/public'; +import type { FileDataVisualizerPluginStart } from '../../../../file_data_visualizer/public'; export interface DependencyCache { timefilter: DataPublicPluginSetup['query']['timefilter'] | null; @@ -44,7 +44,7 @@ export interface DependencyCache { i18n: I18nStart | null; urlGenerators: SharePluginStart['urlGenerators'] | null; maps: MapsStartApi | null; - fileUpload: FileUploadPluginStart | null; + fileDataVisualizer: FileDataVisualizerPluginStart | null; } const cache: DependencyCache = { @@ -66,7 +66,7 @@ const cache: DependencyCache = { i18n: null, urlGenerators: null, maps: null, - fileUpload: null, + fileDataVisualizer: null, }; export function setDependencyCache(deps: Partial) { @@ -87,7 +87,7 @@ export function setDependencyCache(deps: Partial) { cache.security = deps.security || null; cache.i18n = deps.i18n || null; cache.urlGenerators = deps.urlGenerators || null; - cache.fileUpload = deps.fileUpload || null; + cache.fileDataVisualizer = deps.fileDataVisualizer || null; } export function getTimefilter() { @@ -214,9 +214,9 @@ export function clearCache() { }); } -export function getFileUpload() { - if (cache.fileUpload === null) { - throw new Error("fileUpload hasn't been initialized"); +export function getFileDataVisualizer() { + if (cache.fileDataVisualizer === null) { + throw new Error("fileDataVisualizer hasn't been initialized"); } - return cache.fileUpload; + return cache.fileDataVisualizer; } diff --git a/x-pack/plugins/ml/public/embeddables/common/components/job_selector_flyout.tsx b/x-pack/plugins/ml/public/embeddables/common/components/job_selector_flyout.tsx new file mode 100644 index 0000000000000..23c057e6b7f33 --- /dev/null +++ b/x-pack/plugins/ml/public/embeddables/common/components/job_selector_flyout.tsx @@ -0,0 +1,40 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import React, { FC, useState } from 'react'; +import { + JobSelectorFlyoutContent, + JobSelectorFlyoutProps, +} from '../../../application/components/job_selector/job_selector_flyout'; + +export const JobSelectorFlyout: FC = ({ + selectedIds, + withTimeRangeSelector, + dateFormatTz, + singleSelection, + timeseriesOnly, + onFlyoutClose, + onSelectionConfirmed, + maps, +}) => { + const [applyTimeRangeState, setApplyTimeRangeState] = useState(true); + + return ( + + ); +}; diff --git a/x-pack/plugins/ml/public/embeddables/common/resolve_job_selection.tsx b/x-pack/plugins/ml/public/embeddables/common/resolve_job_selection.tsx index 8499ab624f790..1833883447859 100644 --- a/x-pack/plugins/ml/public/embeddables/common/resolve_job_selection.tsx +++ b/x-pack/plugins/ml/public/embeddables/common/resolve_job_selection.tsx @@ -4,7 +4,6 @@ * 2.0; you may not use this file except in compliance with the Elastic License * 2.0. */ - import { CoreStart } from 'kibana/public'; import moment from 'moment'; import { takeUntil } from 'rxjs/operators'; @@ -16,9 +15,9 @@ import { toMountPoint, } from '../../../../../../src/plugins/kibana_react/public'; import { getMlGlobalServices } from '../../application/app'; -import { JobSelectorFlyoutContent } from '../../application/components/job_selector/job_selector_flyout'; import { DashboardConstants } from '../../../../../../src/plugins/dashboard/public'; import { JobId } from '../../../common/types/anomaly_detection_jobs'; +import { JobSelectorFlyout } from './components/job_selector_flyout'; /** * Handles Anomaly detection jobs selection by a user. @@ -47,23 +46,32 @@ export async function resolveJobSelection( const tzConfig = uiSettings.get('dateFormat:tz'); const dateFormatTz = tzConfig !== 'Browser' ? tzConfig : moment.tz.guess(); + const onFlyoutClose = () => { + flyoutSession.close(); + reject(); + }; + + const onSelectionConfirmed = async ({ + jobIds, + groups, + }: { + jobIds: string[]; + groups: Array<{ groupId: string; jobIds: string[] }>; + }) => { + await flyoutSession.close(); + resolve({ jobIds, groups }); + }; const flyoutSession = coreStart.overlays.openFlyout( toMountPoint( - { - flyoutSession.close(); - reject(); - }} - onSelectionConfirmed={async ({ jobIds, groups }) => { - await flyoutSession.close(); - resolve({ jobIds, groups }); - }} + onFlyoutClose={onFlyoutClose} + onSelectionConfirmed={onSelectionConfirmed} maps={maps} /> diff --git a/x-pack/plugins/ml/public/plugin.ts b/x-pack/plugins/ml/public/plugin.ts index f6d5da92f5e71..c9fde252fc26d 100644 --- a/x-pack/plugins/ml/public/plugin.ts +++ b/x-pack/plugins/ml/public/plugin.ts @@ -51,8 +51,8 @@ import { TriggersAndActionsUIPublicPluginSetup, TriggersAndActionsUIPublicPluginStart, } from '../../triggers_actions_ui/public'; -import { registerMlAlerts } from './alerting/register_ml_alerts'; -import { FileUploadPluginStart } from '../../file_upload/public'; +import { FileDataVisualizerPluginStart } from '../../file_data_visualizer/public'; +import { PluginSetupContract as AlertingSetup } from '../../alerting/public'; export interface MlStartDependencies { data: DataPublicPluginStart; @@ -64,7 +64,7 @@ export interface MlStartDependencies { maps?: MapsStartApi; lens?: LensPublicStart; triggersActionsUi?: TriggersAndActionsUIPublicPluginStart; - fileUpload: FileUploadPluginStart; + fileDataVisualizer: FileDataVisualizerPluginStart; } export interface MlSetupDependencies { @@ -79,6 +79,7 @@ export interface MlSetupDependencies { share: SharePluginSetup; indexPatternManagement: IndexPatternManagementSetup; triggersActionsUi?: TriggersAndActionsUIPublicPluginSetup; + alerting?: AlertingSetup; } export type MlCoreSetup = CoreSetup; @@ -121,7 +122,7 @@ export class MlPlugin implements Plugin { lens: pluginsStart.lens, kibanaVersion, triggersActionsUi: pluginsStart.triggersActionsUi, - fileUpload: pluginsStart.fileUpload, + fileDataVisualizer: pluginsStart.fileDataVisualizer, }, params ); @@ -132,10 +133,6 @@ export class MlPlugin implements Plugin { this.urlGenerator = registerUrlGenerator(pluginsSetup.share, core); } - if (pluginsSetup.triggersActionsUi) { - registerMlAlerts(pluginsSetup.triggersActionsUi); - } - const licensing = pluginsSetup.licensing.license$.pipe(take(1)); licensing.subscribe(async (license) => { const [coreStart] = await core.getStartServices(); @@ -166,6 +163,7 @@ export class MlPlugin implements Plugin { registerManagementSection, registerMlUiActions, registerSearchLinks, + registerMlAlerts, } = await import('./register_helper'); const mlEnabled = isMlEnabled(license); @@ -181,6 +179,11 @@ export class MlPlugin implements Plugin { } registerEmbeddables(pluginsSetup.embeddable, core); registerMlUiActions(pluginsSetup.uiActions, core); + + const canUseMlAlerts = capabilities.ml?.canUseMlAlerts; + if (pluginsSetup.triggersActionsUi && canUseMlAlerts) { + registerMlAlerts(pluginsSetup.triggersActionsUi, pluginsSetup.alerting); + } } } }); diff --git a/x-pack/plugins/ml/public/register_helper/index.ts b/x-pack/plugins/ml/public/register_helper/index.ts index 2525340026950..278f32f683053 100644 --- a/x-pack/plugins/ml/public/register_helper/index.ts +++ b/x-pack/plugins/ml/public/register_helper/index.ts @@ -9,3 +9,4 @@ export { registerEmbeddables } from '../embeddables'; export { registerManagementSection } from '../application/management'; export { registerMlUiActions } from '../ui_actions'; export { registerSearchLinks } from './register_search_links'; +export { registerMlAlerts } from '../alerting'; diff --git a/x-pack/plugins/ml/server/lib/alerts/alerting_service.ts b/x-pack/plugins/ml/server/lib/alerts/alerting_service.ts index 81529669749bc..dc8d019125d2b 100644 --- a/x-pack/plugins/ml/server/lib/alerts/alerting_service.ts +++ b/x-pack/plugins/ml/server/lib/alerts/alerting_service.ts @@ -7,8 +7,6 @@ import Boom from '@hapi/boom'; import rison from 'rison-node'; -import { ElasticsearchClient } from 'kibana/server'; -import moment from 'moment'; import { Duration } from 'moment/moment'; import { MlClient } from '../ml_client'; import { @@ -27,8 +25,10 @@ import { } from '../../../common/types/alerts'; import { AnomalyDetectionAlertContext } from './register_anomaly_detection_alert_type'; import { MlJobsResponse } from '../../../common/types/job_service'; -import { resolveBucketSpanInSeconds } from '../../../common/util/job_utils'; +import { resolveMaxTimeInterval } from '../../../common/util/job_utils'; import { isDefined } from '../../../common/types/guards'; +import { getTopNBuckets, resolveLookbackInterval } from '../../../common/util/alerts'; +import type { DatafeedsService } from '../../models/job_service/datafeeds'; type AggResultsResponse = { key?: number } & { [key in PreviewResultsKeys]: { @@ -40,12 +40,21 @@ type AggResultsResponse = { key?: number } & { }; }; +/** + * Mapping for result types and corresponding score fields. + */ +const resultTypeScoreMapping = { + [ANOMALY_RESULT_TYPE.BUCKET]: 'anomaly_score', + [ANOMALY_RESULT_TYPE.RECORD]: 'record_score', + [ANOMALY_RESULT_TYPE.INFLUENCER]: 'influencer_score', +}; + /** * Alerting related server-side methods * @param mlClient - * @param esClient + * @param datafeedsService */ -export function alertingServiceProvider(mlClient: MlClient, esClient: ElasticsearchClient) { +export function alertingServiceProvider(mlClient: MlClient, datafeedsService: DatafeedsService) { const getAggResultsLabel = (resultType: AnomalyResultType) => { return { aggGroupLabel: `${resultType}_results` as PreviewResultsKeys, @@ -280,6 +289,8 @@ export function alertingServiceProvider(mlClient: MlClient, esClient: Elasticsea return { count: aggTypeResults.doc_count, key: v.key, + message: + 'Alerts are raised based on real-time scores. Remember that scores may be adjusted over time as data continues to be analyzed.', alertInstanceKey, jobIds: [...new Set(requestedAnomalies.map((h) => h._source.job_id))], isInterim: requestedAnomalies.some((h) => h._source.is_interim), @@ -332,7 +343,16 @@ export function alertingServiceProvider(mlClient: MlClient, esClient: Elasticsea if (jobsResponse.length === 0) { // Probably assigned groups don't contain any jobs anymore. - return; + throw new Error("Couldn't find the job with provided id"); + } + + const maxBucket = resolveMaxTimeInterval( + jobsResponse.map((v) => v.analysis_config.bucket_span) + ); + + if (maxBucket === undefined) { + // Technically it's not possible, just in case. + throw new Error('Unable to resolve a valid bucket length'); } /** @@ -341,9 +361,7 @@ export function alertingServiceProvider(mlClient: MlClient, esClient: Elasticsea */ const lookBackTimeInterval = `${Math.max( // Double the max bucket span - Math.round( - resolveBucketSpanInSeconds(jobsResponse.map((v) => v.analysis_config.bucket_span)) * 2 - ), + Math.round(maxBucket * 2), checkIntervalGap ? Math.round(checkIntervalGap.asSeconds()) : 0 )}s`; @@ -368,7 +386,7 @@ export function alertingServiceProvider(mlClient: MlClient, esClient: Elasticsea }, { terms: { - result_type: Object.values(ANOMALY_RESULT_TYPE), + result_type: Object.values(ANOMALY_RESULT_TYPE) as string[], }, }, ...(params.includeInterim @@ -431,6 +449,139 @@ export function alertingServiceProvider(mlClient: MlClient, esClient: Elasticsea ).filter(isDefined); }; + /** + * Fetches the most recent anomaly according the top N buckets within the lookback interval + * that satisfies a rule criteria. + * + * @param params - Alert params + */ + const fetchResult = async ( + params: MlAnomalyDetectionAlertParams + ): Promise => { + const jobAndGroupIds = [ + ...(params.jobSelection.jobIds ?? []), + ...(params.jobSelection.groupIds ?? []), + ]; + + // Extract jobs from group ids and make sure provided jobs assigned to a current space + const jobsResponse = ( + await mlClient.getJobs({ job_id: jobAndGroupIds.join(',') }) + ).body.jobs; + + if (jobsResponse.length === 0) { + // Probably assigned groups don't contain any jobs anymore. + return; + } + + const jobIds = jobsResponse.map((v) => v.job_id); + + const dataFeeds = await datafeedsService.getDatafeedByJobId(jobIds); + + const maxBucketInSeconds = resolveMaxTimeInterval( + jobsResponse.map((v) => v.analysis_config.bucket_span) + ); + + if (maxBucketInSeconds === undefined) { + // Technically it's not possible, just in case. + throw new Error('Unable to resolve a valid bucket length'); + } + + const lookBackTimeInterval: string = + params.lookbackInterval ?? resolveLookbackInterval(jobsResponse, dataFeeds ?? []); + + const topNBuckets: number = params.topNBuckets ?? getTopNBuckets(jobsResponse[0]); + + const requestBody = { + size: 0, + query: { + bool: { + filter: [ + { + terms: { job_id: jobIds }, + }, + { + terms: { + result_type: Object.values(ANOMALY_RESULT_TYPE) as string[], + }, + }, + { + range: { + timestamp: { + gte: `now-${lookBackTimeInterval}`, + }, + }, + }, + ...(params.includeInterim + ? [] + : [ + { + term: { is_interim: false }, + }, + ]), + ], + }, + }, + aggs: { + alerts_over_time: { + date_histogram: { + field: 'timestamp', + fixed_interval: `${maxBucketInSeconds}s`, + order: { + _key: 'desc' as const, + }, + }, + aggs: { + max_score: { + max: { + field: resultTypeScoreMapping[params.resultType], + }, + }, + ...getResultTypeAggRequest(params.resultType, params.severity), + truncate: { + bucket_sort: { + size: topNBuckets, + }, + }, + }, + }, + }, + }; + + const response = await mlClient.anomalySearch( + { + // @ts-expect-error + body: requestBody, + }, + jobIds + ); + + const result = response.body.aggregations as { + alerts_over_time: { + buckets: Array< + { + doc_count: number; + key: number; + key_as_string: string; + max_score: { + value: number; + }; + } & AggResultsResponse + >; + }; + }; + + if (result.alerts_over_time.buckets.length === 0) { + return; + } + + // Find the most anomalous result from the top N buckets + const topResult = result.alerts_over_time.buckets.reduce((prev, current) => + prev.max_score.value > current.max_score.value ? prev : current + ); + + return getResultsFormatter(params.resultType)(topResult); + }; + /** * TODO Replace with URL generator when https://github.com/elastic/kibana/issues/59453 is resolved * @param r @@ -520,17 +671,8 @@ export function alertingServiceProvider(mlClient: MlClient, esClient: Elasticsea startedAt: Date, previousStartedAt: Date | null ): Promise => { - const checkIntervalGap = previousStartedAt - ? moment.duration(moment(startedAt).diff(previousStartedAt)) - : undefined; - - const res = await fetchAnomalies(params, undefined, checkIntervalGap); - - if (!res) { - throw new Error('No results found'); - } + const result = await fetchResult(params); - const result = res[0]; if (!result) return; const anomalyExplorerUrl = buildExplorerUrl(result, params.resultType); diff --git a/x-pack/plugins/ml/server/lib/alerts/register_anomaly_detection_alert_type.ts b/x-pack/plugins/ml/server/lib/alerts/register_anomaly_detection_alert_type.ts index 442e46d2c7335..f39b3850b71b1 100644 --- a/x-pack/plugins/ml/server/lib/alerts/register_anomaly_detection_alert_type.ts +++ b/x-pack/plugins/ml/server/lib/alerts/register_anomaly_detection_alert_type.ts @@ -78,6 +78,12 @@ export function registerAnomalyDetectionAlertType({ defaultMessage: 'List of job IDs that triggered the alert instance', }), }, + { + name: 'message', + description: i18n.translate('xpack.ml.alertContext.messageDescription', { + defaultMessage: 'Alert info message', + }), + }, { name: 'isInterim', description: i18n.translate('xpack.ml.alertContext.isInterimDescription', { diff --git a/x-pack/plugins/ml/server/lib/capabilities/check_capabilities.test.ts b/x-pack/plugins/ml/server/lib/capabilities/check_capabilities.test.ts index 49a63d2796969..93c2124eae8d1 100644 --- a/x-pack/plugins/ml/server/lib/capabilities/check_capabilities.test.ts +++ b/x-pack/plugins/ml/server/lib/capabilities/check_capabilities.test.ts @@ -51,7 +51,7 @@ describe('check_capabilities', () => { ); const { capabilities } = await getCapabilities(); const count = Object.keys(capabilities).length; - expect(count).toBe(29); + expect(count).toBe(30); }); }); @@ -82,6 +82,7 @@ describe('check_capabilities', () => { expect(capabilities.canGetAnnotations).toBe(true); expect(capabilities.canCreateAnnotation).toBe(true); expect(capabilities.canDeleteAnnotation).toBe(true); + expect(capabilities.canUseMlAlerts).toBe(true); expect(capabilities.canCreateJob).toBe(false); expect(capabilities.canDeleteJob).toBe(false); diff --git a/x-pack/plugins/ml/server/lib/route_guard.ts b/x-pack/plugins/ml/server/lib/route_guard.ts index 8f2c855a7cb01..d0a3c59e4d7e5 100644 --- a/x-pack/plugins/ml/server/lib/route_guard.ts +++ b/x-pack/plugins/ml/server/lib/route_guard.ts @@ -20,12 +20,17 @@ import { jobSavedObjectServiceFactory, JobSavedObjectService } from '../saved_ob import { MlLicense } from '../../common/license'; import { MlClient, getMlClient } from '../lib/ml_client'; +import type { AlertingApiRequestHandlerContext } from '../../../alerting/server'; + +type MLRequestHandlerContext = RequestHandlerContext & { + alerting?: AlertingApiRequestHandlerContext; +}; type Handler = (handlerParams: { client: IScopedClusterClient; request: KibanaRequest; response: KibanaResponseFactory; - context: RequestHandlerContext; + context: MLRequestHandlerContext; jobSavedObjectService: JobSavedObjectService; mlClient: MlClient; }) => ReturnType; @@ -66,7 +71,7 @@ export class RouteGuard { private _guard(check: () => boolean, handler: Handler) { return ( - context: RequestHandlerContext, + context: MLRequestHandlerContext, request: KibanaRequest, response: KibanaResponseFactory ) => { diff --git a/x-pack/plugins/ml/server/models/calculate_model_memory_limit/calculate_model_memory_limit.ts b/x-pack/plugins/ml/server/models/calculate_model_memory_limit/calculate_model_memory_limit.ts index 1f5bbe8ac0fd4..1cefa48cf6c8c 100644 --- a/x-pack/plugins/ml/server/models/calculate_model_memory_limit/calculate_model_memory_limit.ts +++ b/x-pack/plugins/ml/server/models/calculate_model_memory_limit/calculate_model_memory_limit.ts @@ -180,13 +180,13 @@ export function calculateModelMemoryLimitProvider( // if max_model_memory_limit has been set, // make sure the estimated value is not greater than it. if (allowMMLGreaterThanMax === false) { - // @ts-expect-error + // @ts-expect-error numeral missing value const mmlBytes = numeral(estimatedModelMemoryLimit).value(); if (maxModelMemoryLimit !== undefined) { - // @ts-expect-error + // @ts-expect-error numeral missing value const maxBytes = numeral(maxModelMemoryLimit).value(); if (mmlBytes > maxBytes) { - // @ts-expect-error + // @ts-expect-error numeral missing value modelMemoryLimit = `${Math.floor(maxBytes / numeral('1MB').value())}MB`; mmlCappedAtMax = true; } @@ -195,10 +195,10 @@ export function calculateModelMemoryLimitProvider( // if we've not already capped the estimated mml at the hard max server setting // ensure that the estimated mml isn't greater than the effective max mml if (mmlCappedAtMax === false && effectiveMaxModelMemoryLimit !== undefined) { - // @ts-expect-error + // @ts-expect-error numeral missing value const effectiveMaxMmlBytes = numeral(effectiveMaxModelMemoryLimit).value(); if (mmlBytes > effectiveMaxMmlBytes) { - // @ts-expect-error + // @ts-expect-error numeral missing value modelMemoryLimit = `${Math.floor(effectiveMaxMmlBytes / numeral('1MB').value())}MB`; } } diff --git a/x-pack/plugins/ml/server/models/calendar/calendar_manager.ts b/x-pack/plugins/ml/server/models/calendar/calendar_manager.ts index 96bd74b9880a6..d08263f786354 100644 --- a/x-pack/plugins/ml/server/models/calendar/calendar_manager.ts +++ b/x-pack/plugins/ml/server/models/calendar/calendar_manager.ts @@ -47,8 +47,7 @@ export class CalendarManager { } async getAllCalendars() { - // @ts-expect-error missing size argument - const { body } = await this._mlClient.getCalendars({ size: 1000 }); + const { body } = await this._mlClient.getCalendars({ body: { page: { from: 0, size: 1000 } } }); const events: ScheduledEvent[] = await this._eventManager.getAllEvents(); const calendars: Calendar[] = body.calendars as Calendar[]; diff --git a/x-pack/plugins/ml/server/models/data_frame_analytics/validation.ts b/x-pack/plugins/ml/server/models/data_frame_analytics/validation.ts index bbfc304958f9a..216a4379c7c89 100644 --- a/x-pack/plugins/ml/server/models/data_frame_analytics/validation.ts +++ b/x-pack/plugins/ml/server/models/data_frame_analytics/validation.ts @@ -9,6 +9,7 @@ import { i18n } from '@kbn/i18n'; import type { estypes } from '@elastic/elasticsearch'; import { IScopedClusterClient } from 'kibana/server'; import { getAnalysisType } from '../../../common/util/analytics_utils'; +import { ANALYSIS_CONFIG_TYPE } from '../../../common/constants/data_frame_analytics'; import { ALL_CATEGORIES, FRACTION_EMPTY_LIMIT, @@ -59,6 +60,12 @@ const analysisFieldsHeading = i18n.translate( defaultMessage: 'Analysis fields', } ); +const lowFieldCountHeading = i18n.translate( + 'xpack.ml.models.dfaValidation.messages.lowFieldCountHeading', + { + defaultMessage: 'Insufficient fields', + } +); const dependentVarHeading = i18n.translate( 'xpack.ml.models.dfaValidation.messages.dependentVarHeading', { @@ -77,6 +84,12 @@ const analysisFieldsWarningMessage = { status: VALIDATION_STATUS.WARNING, heading: analysisFieldsHeading, }; +const lowFieldCountWarningMessage = { + id: 'analysis_fields_count', + text: '', + status: VALIDATION_STATUS.WARNING, + heading: lowFieldCountHeading, +}; function getRegressionAndClassificationMessage( analysisConfig: AnalysisConfig, @@ -94,7 +107,7 @@ function getRegressionAndClassificationMessage( if (trainingPercent) { const trainingDocs = totalDocs * (trainingPercent / 100); - const trainingPercentMessage = getTrainingPercentMessage(trainingDocs); + const trainingPercentMessage = getTrainingPercentMessage(trainingPercent, trainingDocs); if (trainingPercentMessage) { messages.push(trainingPercentMessage); } @@ -128,7 +141,7 @@ function getRegressionAndClassificationMessage( id: 'num_top_classes', text: i18n.translate('xpack.ml.models.dfaValidation.messages.topClassesWarningMessage', { defaultMessage: - 'Probabilities will be reported for {numCategories, plural, one {# category} other {# categories}}. There could be a significant effect on the size of your destination index.', + 'Predicted probabilities will be reported for {numCategories, plural, one {# category} other {# categories}}. If you have a large number of categories, there could be a significant effect on the size of your destination index.', values: { numCategories: topClasses === ALL_CATEGORIES ? depVarCardinality : topClasses, }, @@ -143,7 +156,7 @@ function getRegressionAndClassificationMessage( id: 'num_top_classes', text: i18n.translate('xpack.ml.models.dfaValidation.messages.topClassesSuccessMessage', { defaultMessage: - 'Probabilities will be reported for {numCategories, plural, one {# category} other {# categories}}.', + 'Predicted probabilities will be reported for {numCategories, plural, one {# category} other {# categories}}.', values: { numCategories: topClasses === ALL_CATEGORIES ? depVarCardinality : topClasses, }, @@ -159,7 +172,21 @@ function getRegressionAndClassificationMessage( return messages; } -function getTrainingPercentMessage(trainingDocs: number) { +function getTrainingPercentMessage(trainingPercent: number, trainingDocs: number) { + if (trainingPercent === 100) { + return { + id: 'training_percent_hundred', + text: i18n.translate( + 'xpack.ml.models.dfaValidation.messages.noTestingDataTrainingPercentWarning', + { + defaultMessage: + 'All eligible documents will be used for training the model. In order to evaluate the model, provide testing data by reducing the training percent.', + } + ), + status: VALIDATION_STATUS.WARNING, + heading: trainingPercentHeading, + }; + } if (trainingDocs >= TRAINING_DOCS_UPPER) { return { id: 'training_percent_high', @@ -243,11 +270,11 @@ async function getValidationCheckMessages( }, }); - // @ts-expect-error + // @ts-expect-error incorrect search response type const totalDocs = body.hits.total.value; if (body.aggregations) { - // @ts-expect-error + // @ts-expect-error incorrect search response type Object.entries(body.aggregations).forEach(([aggName, { doc_count: docCount, value }]) => { if (docCount !== undefined) { const empty = docCount / totalDocs; @@ -281,14 +308,27 @@ async function getValidationCheckMessages( ); } if (depVarValid === true) { - messages.push({ - id: 'dep_var_check', - text: i18n.translate('xpack.ml.models.dfaValidation.messages.depVarSuccess', { - defaultMessage: 'The dependent variable field contains useful values for analysis.', - }), - status: VALIDATION_STATUS.SUCCESS, - heading: dependentVarHeading, - }); + if (analysisType === ANALYSIS_CONFIG_TYPE.REGRESSION) { + messages.push({ + id: 'dep_var_check', + text: i18n.translate('xpack.ml.models.dfaValidation.messages.depVarRegSuccess', { + defaultMessage: + 'The dependent variable field contains continuous values suitable for regression analysis.', + }), + status: VALIDATION_STATUS.SUCCESS, + heading: dependentVarHeading, + }); + } else { + messages.push({ + id: 'dep_var_check', + text: i18n.translate('xpack.ml.models.dfaValidation.messages.depVarClassSuccess', { + defaultMessage: + 'The dependent variable field contains discrete values suitable for classification.', + }), + status: VALIDATION_STATUS.SUCCESS, + heading: dependentVarHeading, + }); + } } else { messages.push(dependentVarWarningMessage); } @@ -306,6 +346,33 @@ async function getValidationCheckMessages( if (analyzedFields.length && analyzedFields.length > INCLUDED_FIELDS_THRESHOLD) { analysisFieldsNumHigh = true; + } else { + if (analysisType === ANALYSIS_CONFIG_TYPE.OUTLIER_DETECTION && analyzedFields.length < 1) { + lowFieldCountWarningMessage.text = i18n.translate( + 'xpack.ml.models.dfaValidation.messages.lowFieldCountOutlierWarningText', + { + defaultMessage: + 'Outlier detection requires that at least one field is included in the analysis.', + } + ); + messages.push(lowFieldCountWarningMessage); + } else if ( + analysisType !== ANALYSIS_CONFIG_TYPE.OUTLIER_DETECTION && + analyzedFields.length < 2 + ) { + lowFieldCountWarningMessage.text = i18n.translate( + 'xpack.ml.models.dfaValidation.messages.lowFieldCountWarningText', + { + defaultMessage: + '{analysisType} requires that at least two fields are included in the analysis.', + values: { + analysisType: + analysisType === ANALYSIS_CONFIG_TYPE.REGRESSION ? 'Regression' : 'Classification', + }, + } + ); + messages.push(lowFieldCountWarningMessage); + } } if (emptyFields.length) { @@ -318,8 +385,11 @@ async function getValidationCheckMessages( 'xpack.ml.models.dfaValidation.messages.analysisFieldsWarningText', { defaultMessage: - 'Some fields included for analysis have at least {percentEmpty}% empty values. The number of selected fields is high and may result in increased resource usage and long-running jobs.', - values: { percentEmpty: percentEmptyLimit }, + 'Some fields included for analysis have at least {percentEmpty}% empty values. There are more than {includedFieldsThreshold} fields selected for analysis. This may result in increased resource usage and long-running jobs.', + values: { + percentEmpty: percentEmptyLimit, + includedFieldsThreshold: INCLUDED_FIELDS_THRESHOLD, + }, } ); } else if (analysisFieldsEmpty && !analysisFieldsNumHigh) { @@ -336,7 +406,8 @@ async function getValidationCheckMessages( 'xpack.ml.models.dfaValidation.messages.analysisFieldsHighWarningText', { defaultMessage: - 'The number of selected fields is high and may result in increased resource usage and long-running jobs.', + 'There are more than {includedFieldsThreshold} fields selected for analysis. This may result in increased resource usage and long-running jobs.', + values: { includedFieldsThreshold: INCLUDED_FIELDS_THRESHOLD }, } ); } @@ -346,7 +417,8 @@ async function getValidationCheckMessages( id: 'analysis_fields', text: i18n.translate('xpack.ml.models.dfaValidation.messages.analysisFieldsSuccessText', { defaultMessage: - 'The selected analysis fields are sufficiently populated and contain useful data for analysis.', + 'The selected analysis fields are at least {percentPopulated}% populated.', + values: { percentPopulated: (1 - FRACTION_EMPTY_LIMIT) * 100 }, }), status: VALIDATION_STATUS.SUCCESS, heading: analysisFieldsHeading, diff --git a/x-pack/plugins/ml/server/models/data_recognizer/data_recognizer.ts b/x-pack/plugins/ml/server/models/data_recognizer/data_recognizer.ts index 21ed258a0b764..81db7ca15b258 100644 --- a/x-pack/plugins/ml/server/models/data_recognizer/data_recognizer.ts +++ b/x-pack/plugins/ml/server/models/data_recognizer/data_recognizer.ts @@ -288,7 +288,7 @@ export class DataRecognizer { body: searchBody, }); - // @ts-expect-error fix search response + // @ts-expect-error incorrect search response type return body.hits.total.value > 0; } @@ -1181,13 +1181,13 @@ export class DataRecognizer { return; } - // @ts-expect-error + // @ts-expect-error numeral missing value const maxBytes: number = numeral(maxMml.toUpperCase()).value(); for (const job of moduleConfig.jobs) { const mml = job.config?.analysis_limits?.model_memory_limit; if (mml !== undefined) { - // @ts-expect-error + // @ts-expect-error numeral missing value const mmlBytes: number = numeral(mml.toUpperCase()).value(); if (mmlBytes > maxBytes) { // if the job's mml is over the max, @@ -1306,7 +1306,7 @@ export class DataRecognizer { const job = jobs.find((j) => j.id === `${jobPrefix}${jobSpecificOverride.job_id}`); if (job !== undefined) { // delete the job_id in the override as this shouldn't be overridden - // @ts-expect-error + // @ts-expect-error missing job_id delete jobSpecificOverride.job_id; merge(job.config, jobSpecificOverride); processArrayValues(job.config, jobSpecificOverride); diff --git a/x-pack/plugins/ml/server/models/data_recognizer/modules/security_network/manifest.json b/x-pack/plugins/ml/server/models/data_recognizer/modules/security_network/manifest.json index 2a2c0c202f66b..384ea006b5b42 100755 --- a/x-pack/plugins/ml/server/models/data_recognizer/modules/security_network/manifest.json +++ b/x-pack/plugins/ml/server/models/data_recognizer/modules/security_network/manifest.json @@ -36,22 +36,22 @@ ], "datafeeds": [ { - "id": "datafeed_high_count_by_destination_country", + "id": "datafeed-high_count_by_destination_country", "file": "datafeed_high_count_by_destination_country.json", "job_id": "high_count_by_destination_country" }, { - "id": "datafeed_high_count_network_denies", + "id": "datafeed-high_count_network_denies", "file": "datafeed_high_count_network_denies.json", "job_id": "high_count_network_denies" }, { - "id": "datafeed_high_count_network_events", + "id": "datafeed-high_count_network_events", "file": "datafeed_high_count_network_events.json", "job_id": "high_count_network_events" }, { - "id": "datafeed_rare_destination_country", + "id": "datafeed-rare_destination_country", "file": "datafeed_rare_destination_country.json", "job_id": "rare_destination_country" } diff --git a/x-pack/plugins/ml/server/models/data_visualizer/data_visualizer.ts b/x-pack/plugins/ml/server/models/data_visualizer/data_visualizer.ts index 64ee18c688046..54173d75938d8 100644 --- a/x-pack/plugins/ml/server/models/data_visualizer/data_visualizer.ts +++ b/x-pack/plugins/ml/server/models/data_visualizer/data_visualizer.ts @@ -627,7 +627,7 @@ export class DataVisualizer { // filter aggregation with exists query. const aggs: Aggs = datafeedAggregations !== undefined ? { ...datafeedAggregations } : {}; - // Combine runtime mappings from the index pattern as well as the datafeed + // Combine runtime fields from the index pattern as well as the datafeed const combinedRuntimeMappings: RuntimeMappings = { ...(isPopulatedObject(runtimeMappings) ? runtimeMappings : {}), ...(isPopulatedObject(datafeedConfig) && isPopulatedObject(datafeedConfig.runtime_mappings) @@ -674,7 +674,7 @@ export class DataVisualizer { }); const aggregations = body.aggregations; - // @ts-expect-error fix search response + // @ts-expect-error incorrect search response type const totalCount = body.hits.total.value; const stats = { totalCount, @@ -762,7 +762,7 @@ export class DataVisualizer { size, body: searchBody, }); - // @ts-expect-error fix search response + // @ts-expect-error incorrect search response type return body.hits.total.value > 0; } @@ -1249,7 +1249,7 @@ export class DataVisualizer { fieldName: field, examples: [] as any[], }; - // @ts-expect-error fix search response + // @ts-expect-error incorrect search response type if (body.hits.total.value > 0) { const hits = body.hits.hits; for (let i = 0; i < hits.length; i++) { diff --git a/x-pack/plugins/ml/server/models/fields_service/fields_service.ts b/x-pack/plugins/ml/server/models/fields_service/fields_service.ts index eb4c32e1a1cc4..cfe0bcc532630 100644 --- a/x-pack/plugins/ml/server/models/fields_service/fields_service.ts +++ b/x-pack/plugins/ml/server/models/fields_service/fields_service.ts @@ -194,7 +194,7 @@ export function fieldsServiceProvider({ asCurrentUser }: IScopedClusterClient) { } const aggResult = fieldsToAgg.reduce((obj, field) => { - // @ts-expect-error fix search aggregation response + // @ts-expect-error incorrect search response type obj[field] = (aggregations[field] || { value: 0 }).value; return obj; }, {} as { [field: string]: number }); @@ -250,14 +250,14 @@ export function fieldsServiceProvider({ asCurrentUser }: IScopedClusterClient) { }); if (aggregations && aggregations.earliest && aggregations.latest) { - // @ts-expect-error fix search aggregation response + // @ts-expect-error incorrect search response type obj.start.epoch = aggregations.earliest.value; - // @ts-expect-error fix search aggregation response + // @ts-expect-error incorrect search response type obj.start.string = aggregations.earliest.value_as_string; - // @ts-expect-error fix search aggregation response + // @ts-expect-error incorrect search response type obj.end.epoch = aggregations.latest.value; - // @ts-expect-error fix search aggregation response + // @ts-expect-error incorrect search response type obj.end.string = aggregations.latest.value_as_string; } return obj; @@ -416,7 +416,7 @@ export function fieldsServiceProvider({ asCurrentUser }: IScopedClusterClient) { } const aggResult = fieldsToAgg.reduce((obj, field) => { - // @ts-expect-error fix search aggregation response + // @ts-expect-error incorrect search response type obj[field] = (aggregations[getMaxBucketAggKey(field)] || { value: 0 }).value ?? 0; return obj; }, {} as { [field: string]: number }); diff --git a/x-pack/plugins/ml/server/models/job_service/datafeeds.ts b/x-pack/plugins/ml/server/models/job_service/datafeeds.ts index 8279571adbae2..72255e168249a 100644 --- a/x-pack/plugins/ml/server/models/job_service/datafeeds.ts +++ b/x-pack/plugins/ml/server/models/job_service/datafeeds.ts @@ -34,6 +34,8 @@ interface Results { }; } +export type DatafeedsService = ReturnType; + export function datafeedsProvider(client: IScopedClusterClient, mlClient: MlClient) { async function forceStartDatafeeds(datafeedIds: string[], start?: number, end?: number) { const jobIds = await getJobIdsByDatafeedId(); @@ -168,25 +170,39 @@ export function datafeedsProvider(client: IScopedClusterClient, mlClient: MlClie }, {} as { [id: string]: string }); } + async function getDatafeedByJobId( + jobId: string[], + excludeGenerated?: boolean + ): Promise; + async function getDatafeedByJobId( jobId: string, excludeGenerated?: boolean - ): Promise { + ): Promise; + + async function getDatafeedByJobId( + jobId: string | string[], + excludeGenerated?: boolean + ): Promise { + const jobIds = Array.isArray(jobId) ? jobId : [jobId]; + async function findDatafeed() { // if the job was doesn't use the standard datafeedId format // get all the datafeeds and match it with the jobId const { body: { datafeeds }, - } = await mlClient.getDatafeeds(excludeGenerated ? { exclude_generated: true } : {}); // - for (const result of datafeeds) { - if (result.job_id === jobId) { - return result; - } + } = await mlClient.getDatafeeds(excludeGenerated ? { exclude_generated: true } : {}); + if (typeof jobId === 'string') { + return datafeeds.find((v) => v.job_id === jobId); + } + + if (Array.isArray(jobId)) { + return datafeeds.filter((v) => jobIds.includes(v.job_id)); } } // if the job was created by the wizard, // then we can assume it uses the standard format of the datafeedId - const assumedDefaultDatafeedId = `datafeed-${jobId}`; + const assumedDefaultDatafeedId = jobIds.map((v) => `datafeed-${v}`).join(','); try { const { body: { datafeeds: datafeedsResults }, @@ -194,12 +210,22 @@ export function datafeedsProvider(client: IScopedClusterClient, mlClient: MlClie datafeed_id: assumedDefaultDatafeedId, ...(excludeGenerated ? { exclude_generated: true } : {}), }); - if ( - Array.isArray(datafeedsResults) && - datafeedsResults.length === 1 && - datafeedsResults[0].job_id === jobId - ) { - return datafeedsResults[0]; + if (Array.isArray(datafeedsResults)) { + const result = datafeedsResults.filter((d) => jobIds.includes(d.job_id)); + + if (typeof jobId === 'string') { + if (datafeedsResults.length === 1 && datafeedsResults[0].job_id === jobId) { + return datafeedsResults[0]; + } else { + return await findDatafeed(); + } + } + + if (result.length === jobIds.length) { + return datafeedsResults; + } else { + return await findDatafeed(); + } } else { return await findDatafeed(); } diff --git a/x-pack/plugins/ml/server/models/job_service/index.ts b/x-pack/plugins/ml/server/models/job_service/index.ts index d36ec822c1314..94dc669bfd946 100644 --- a/x-pack/plugins/ml/server/models/job_service/index.ts +++ b/x-pack/plugins/ml/server/models/job_service/index.ts @@ -13,11 +13,16 @@ import { newJobCapsProvider } from './new_job_caps'; import { newJobChartsProvider, topCategoriesProvider } from './new_job'; import { modelSnapshotProvider } from './model_snapshots'; import type { MlClient } from '../../lib/ml_client'; +import type { AlertsClient } from '../../../../alerting/server'; -export function jobServiceProvider(client: IScopedClusterClient, mlClient: MlClient) { +export function jobServiceProvider( + client: IScopedClusterClient, + mlClient: MlClient, + alertsClient?: AlertsClient +) { return { ...datafeedsProvider(client, mlClient), - ...jobsProvider(client, mlClient), + ...jobsProvider(client, mlClient, alertsClient), ...groupsProvider(mlClient), ...newJobCapsProvider(client), ...newJobChartsProvider(client), diff --git a/x-pack/plugins/ml/server/models/job_service/jobs.ts b/x-pack/plugins/ml/server/models/job_service/jobs.ts index d0d824a88f5a9..a838db443bebc 100644 --- a/x-pack/plugins/ml/server/models/job_service/jobs.ts +++ b/x-pack/plugins/ml/server/models/job_service/jobs.ts @@ -40,6 +40,9 @@ import { import { groupsProvider } from './groups'; import type { MlClient } from '../../lib/ml_client'; import { isPopulatedObject } from '../../../common/util/object_utils'; +import type { AlertsClient } from '../../../../alerting/server'; +import { ML_ALERT_TYPES } from '../../../common/constants/alerts'; +import { MlAnomalyDetectionAlertParams } from '../../routes/schemas/alerting_schema'; interface Results { [id: string]: { @@ -48,7 +51,11 @@ interface Results { }; } -export function jobsProvider(client: IScopedClusterClient, mlClient: MlClient) { +export function jobsProvider( + client: IScopedClusterClient, + mlClient: MlClient, + alertsClient?: AlertsClient +) { const { asInternalUser } = client; const { forceDeleteDatafeed, getDatafeedIdsByJobId, getDatafeedByJobId } = datafeedsProvider( @@ -188,6 +195,7 @@ export function jobsProvider(client: IScopedClusterClient, mlClient: MlClient) { processed_record_count: job.data_counts?.processed_record_count, earliestStartTimestampMs: getEarliestDatafeedStartTime( dataCounts?.latest_record_timestamp, + // @ts-expect-error @elastic/elasticsearch data counts missing is missing latest_bucket_timestamp dataCounts?.latest_bucket_timestamp, parseTimeIntervalForJob(job.analysis_config?.bucket_span) ), @@ -203,6 +211,7 @@ export function jobsProvider(client: IScopedClusterClient, mlClient: MlClient) { earliestTimestampMs: dataCounts?.earliest_record_timestamp, latestResultsTimestampMs: getLatestDataOrBucketTimestamp( dataCounts?.latest_record_timestamp, + // @ts-expect-error @elastic/elasticsearch data counts missing is missing latest_bucket_timestamp dataCounts?.latest_bucket_timestamp ), isSingleMetricViewerJob: errorMessage === undefined, @@ -210,6 +219,7 @@ export function jobsProvider(client: IScopedClusterClient, mlClient: MlClient) { nodeName: job.node ? job.node.name : undefined, deleting: job.deleting || undefined, awaitingNodeAssignment: isJobAwaitingNodeAssignment(job), + alertingRules: job.alerting_rules, }; if (jobIds.find((j) => j === tempJob.id)) { tempJob.fullJob = job; @@ -244,6 +254,7 @@ export function jobsProvider(client: IScopedClusterClient, mlClient: MlClient) { if (dataCounts !== undefined) { timeRange.to = getLatestDataOrBucketTimestamp( dataCounts.latest_record_timestamp as number, + // @ts-expect-error @elastic/elasticsearch data counts missing is missing latest_bucket_timestamp dataCounts.latest_bucket_timestamp as number ); timeRange.from = dataCounts.earliest_record_timestamp; @@ -319,7 +330,6 @@ export function jobsProvider(client: IScopedClusterClient, mlClient: MlClient) { (ds) => ds.datafeed_id === datafeed.datafeed_id ); if (datafeedStats) { - // @ts-expect-error datafeeds[datafeed.job_id] = { ...datafeed, ...datafeedStats }; } } @@ -388,7 +398,7 @@ export function jobsProvider(client: IScopedClusterClient, mlClient: MlClient) { if (jobStatsResults && jobStatsResults.jobs) { const jobStats = jobStatsResults.jobs.find((js) => js.job_id === tempJob.job_id); if (jobStats !== undefined) { - // @ts-expect-error + // @ts-expect-error @elastic-elasticsearch JobStats type is incomplete tempJob = { ...tempJob, ...jobStats }; if (jobStats.node) { tempJob.node = jobStats.node; @@ -401,6 +411,7 @@ export function jobsProvider(client: IScopedClusterClient, mlClient: MlClient) { const latestBucketTimestamp = latestBucketTimestampByJob && latestBucketTimestampByJob[tempJob.job_id]; if (latestBucketTimestamp) { + // @ts-expect-error @elastic/elasticsearch data counts missing is missing latest_bucket_timestamp tempJob.data_counts.latest_bucket_timestamp = latestBucketTimestamp; } } @@ -413,6 +424,39 @@ export function jobsProvider(client: IScopedClusterClient, mlClient: MlClient) { jobs.push(tempJob); }); + + if (alertsClient) { + const mlAlertingRules = await alertsClient.find({ + options: { + filter: `alert.attributes.alertTypeId:${ML_ALERT_TYPES.ANOMALY_DETECTION}`, + perPage: 1000, + }, + }); + + mlAlertingRules.data.forEach((curr) => { + const { + params: { + jobSelection: { jobIds: ruleJobIds, groupIds: ruleGroupIds }, + }, + } = curr; + + jobs.forEach((j) => { + const isIncluded = + (Array.isArray(ruleJobIds) && ruleJobIds.includes(j.job_id)) || + (Array.isArray(ruleGroupIds) && + Array.isArray(j.groups) && + j.groups.some((g) => ruleGroupIds.includes(g))); + + if (isIncluded) { + if (Array.isArray(j.alerting_rules)) { + j.alerting_rules.push(curr); + } else { + j.alerting_rules = [curr]; + } + } + }); + }); + } } return jobs; } diff --git a/x-pack/plugins/ml/server/models/job_service/new_job/categorization/top_categories.ts b/x-pack/plugins/ml/server/models/job_service/new_job/categorization/top_categories.ts index 82d6f6ca3e103..87715d9d85dbf 100644 --- a/x-pack/plugins/ml/server/models/job_service/new_job/categorization/top_categories.ts +++ b/x-pack/plugins/ml/server/models/job_service/new_job/categorization/top_categories.ts @@ -81,7 +81,7 @@ export function topCategoriesProvider(mlClient: MlClient) { const catCounts: Array<{ id: CategoryId; count: number; - // @ts-expect-error + // @ts-expect-error incorrect search response type }> = body.aggregations?.cat_count?.buckets.map((c: any) => ({ id: c.key, count: c.doc_count, @@ -126,7 +126,7 @@ export function topCategoriesProvider(mlClient: MlClient) { [] ); - // @ts-expect-error + // @ts-expect-error incorrect search response type return body.hits.hits?.map((c: { _source: Category }) => c._source) || []; } diff --git a/x-pack/plugins/ml/server/models/job_validation/job_validation.test.ts b/x-pack/plugins/ml/server/models/job_validation/job_validation.test.ts index 64dfb84be8668..a5483491f1357 100644 --- a/x-pack/plugins/ml/server/models/job_validation/job_validation.test.ts +++ b/x-pack/plugins/ml/server/models/job_validation/job_validation.test.ts @@ -161,7 +161,7 @@ describe('ML - validateJob', () => { function: '', }); payload.job.analysis_config.detectors.push({ - // @ts-expect-error + // @ts-expect-error incorrect type on purpose for test function: undefined, }); diff --git a/x-pack/plugins/ml/server/models/job_validation/job_validation.ts b/x-pack/plugins/ml/server/models/job_validation/job_validation.ts index 94e9a8dc7bffb..00a51d1e4e153 100644 --- a/x-pack/plugins/ml/server/models/job_validation/job_validation.ts +++ b/x-pack/plugins/ml/server/models/job_validation/job_validation.ts @@ -13,7 +13,7 @@ import { getMessages, MessageId, JobValidationMessage } from '../../../common/co import { VALIDATION_STATUS } from '../../../common/constants/validation'; import { basicJobValidation, uniqWithIsEqual } from '../../../common/util/job_utils'; -// @ts-expect-error +// @ts-expect-error importing js file import { validateBucketSpan } from './validate_bucket_span'; import { validateCardinality } from './validate_cardinality'; import { validateInfluencers } from './validate_influencers'; diff --git a/x-pack/plugins/ml/server/models/job_validation/validate_cardinality.ts b/x-pack/plugins/ml/server/models/job_validation/validate_cardinality.ts index 18dc6d3dc73c6..403d6738a4ce6 100644 --- a/x-pack/plugins/ml/server/models/job_validation/validate_cardinality.ts +++ b/x-pack/plugins/ml/server/models/job_validation/validate_cardinality.ts @@ -166,7 +166,7 @@ const validateFactory = (client: IScopedClusterClient, job: CombinedJob): Valida } } else { // only report uniqueFieldName as not aggregatable if it's not part - // of a valid categorization configuration and if it's not a scripted field or runtime mapping. + // of a valid categorization configuration and if it's not a scripted field or runtime field. if ( !isValidCategorizationConfig(job, uniqueFieldName) && !isScriptField(job, uniqueFieldName) && diff --git a/x-pack/plugins/ml/server/models/job_validation/validate_model_memory_limit.test.ts b/x-pack/plugins/ml/server/models/job_validation/validate_model_memory_limit.test.ts index 44c5e3cabb18f..823d4c0adda49 100644 --- a/x-pack/plugins/ml/server/models/job_validation/validate_model_memory_limit.test.ts +++ b/x-pack/plugins/ml/server/models/job_validation/validate_model_memory_limit.test.ts @@ -216,7 +216,7 @@ describe('ML - validateModelMemoryLimit', () => { const dtrs = createDetectors(2); const job = getJobConfig(['instance'], dtrs); const duration = { start: 0, end: 1 }; - // @ts-expect-error + // @ts-expect-error incorrect type on purpose for test delete mlInfoResponse.limits.max_model_memory_limit; job.analysis_limits!.model_memory_limit = '10mb'; diff --git a/x-pack/plugins/ml/server/models/job_validation/validate_model_memory_limit.ts b/x-pack/plugins/ml/server/models/job_validation/validate_model_memory_limit.ts index 47e34626062d1..3c8a965333789 100644 --- a/x-pack/plugins/ml/server/models/job_validation/validate_model_memory_limit.ts +++ b/x-pack/plugins/ml/server/models/job_validation/validate_model_memory_limit.ts @@ -69,14 +69,14 @@ export async function validateModelMemoryLimit( true, job.datafeed_config ); - // @ts-expect-error + // @ts-expect-error numeral missing value const mmlEstimateBytes: number = numeral(modelMemoryLimit).value(); let runEstimateGreaterThenMml = true; // if max_model_memory_limit has been set, // make sure the estimated value is not greater than it. if (typeof maxModelMemoryLimit !== 'undefined') { - // @ts-expect-error + // @ts-expect-error numeral missing value const maxMmlBytes: number = numeral(maxModelMemoryLimit).value(); if (mmlEstimateBytes > maxMmlBytes) { runEstimateGreaterThenMml = false; @@ -93,7 +93,7 @@ export async function validateModelMemoryLimit( // do not run this if we've already found that it's larger than // the max mml if (runEstimateGreaterThenMml && mml !== null) { - // @ts-expect-error + // @ts-expect-error numeral missing value const mmlBytes: number = numeral(mml).value(); if (mmlBytes < MODEL_MEMORY_LIMIT_MINIMUM_BYTES) { messages.push({ @@ -120,11 +120,11 @@ export async function validateModelMemoryLimit( // make sure the user defined MML is not greater than it if (mml !== null) { let maxMmlExceeded = false; - // @ts-expect-error + // @ts-expect-error numeral missing value const mmlBytes = numeral(mml).value(); if (maxModelMemoryLimit !== undefined) { - // @ts-expect-error + // @ts-expect-error numeral missing value const maxMmlBytes = numeral(maxModelMemoryLimit).value(); if (mmlBytes > maxMmlBytes) { maxMmlExceeded = true; @@ -137,7 +137,7 @@ export async function validateModelMemoryLimit( } if (effectiveMaxModelMemoryLimit !== undefined && maxMmlExceeded === false) { - // @ts-expect-error + // @ts-expect-error numeral missing value const effectiveMaxMmlBytes = numeral(effectiveMaxModelMemoryLimit).value(); if (mmlBytes > effectiveMaxMmlBytes) { messages.push({ diff --git a/x-pack/plugins/ml/server/models/results_service/results_service.ts b/x-pack/plugins/ml/server/models/results_service/results_service.ts index 1996acd2cdb06..225a988298b1c 100644 --- a/x-pack/plugins/ml/server/models/results_service/results_service.ts +++ b/x-pack/plugins/ml/server/models/results_service/results_service.ts @@ -183,7 +183,7 @@ export function resultsServiceProvider(mlClient: MlClient) { anomalies: [], interval: 'second', }; - // @ts-expect-error update to correct search response + // @ts-expect-error incorrect search response type if (body.hits.total.value > 0) { let records: AnomalyRecordDoc[] = []; body.hits.hits.forEach((hit: any) => { @@ -402,7 +402,7 @@ export function resultsServiceProvider(mlClient: MlClient) { ); const examplesByCategoryId: { [key: string]: any } = {}; - // @ts-expect-error update to correct search response + // @ts-expect-error incorrect search response type if (body.hits.total.value > 0) { body.hits.hits.forEach((hit: any) => { if (maxExamples) { @@ -439,7 +439,7 @@ export function resultsServiceProvider(mlClient: MlClient) { ); const definition = { categoryId, terms: null, regex: null, examples: [] }; - // @ts-expect-error update to correct search response + // @ts-expect-error incorrect search response type if (body.hits.total.value > 0) { const source = body.hits.hits[0]._source; definition.categoryId = source.category_id; @@ -579,7 +579,7 @@ export function resultsServiceProvider(mlClient: MlClient) { ); if (fieldToBucket === JOB_ID) { finalResults = { - // @ts-expect-error update search response + // @ts-expect-error incorrect search response type jobs: results.aggregations?.unique_terms?.buckets.map( (b: { key: string; doc_count: number }) => b.key ), @@ -592,7 +592,7 @@ export function resultsServiceProvider(mlClient: MlClient) { }, {} ); - // @ts-expect-error update search response + // @ts-expect-error incorrect search response type results.aggregations.jobs.buckets.forEach( (bucket: { key: string | number; unique_stopped_partitions: { buckets: any[] } }) => { jobs[bucket.key] = bucket.unique_stopped_partitions.buckets.map((b) => b.key); diff --git a/x-pack/plugins/ml/server/plugin.ts b/x-pack/plugins/ml/server/plugin.ts index 173b30716c6b6..746d290950704 100644 --- a/x-pack/plugins/ml/server/plugin.ts +++ b/x-pack/plugins/ml/server/plugin.ts @@ -16,6 +16,7 @@ import { CapabilitiesStart, IClusterClient, SavedObjectsServiceStart, + SharedGlobalConfig, } from 'kibana/server'; import type { SecurityPluginSetup } from '../../security/server'; import { DEFAULT_APP_CATEGORIES } from '../../../../src/core/server'; @@ -59,6 +60,7 @@ import { RouteGuard } from './lib/route_guard'; import { registerMlAlerts } from './lib/alerts/register_ml_alerts'; import { ML_ALERT_TYPES } from '../common/constants/alerts'; import { alertingRoutes } from './routes/alerting'; +import { registerCollector } from './usage'; export type MlPluginSetup = SharedServices; export type MlPluginStart = void; @@ -74,11 +76,14 @@ export class MlServerPlugin private security: SecurityPluginSetup | undefined; private isMlReady: Promise; private setMlReady: () => void = () => {}; + private readonly kibanaIndexConfig: SharedGlobalConfig; constructor(ctx: PluginInitializerContext) { this.log = ctx.logger.get(); this.mlLicense = new MlLicense(); this.isMlReady = new Promise((resolve) => (this.setMlReady = resolve)); + + this.kibanaIndexConfig = ctx.config.legacy.get(); } public setup(coreSetup: CoreSetup, plugins: PluginsSetup): MlPluginSetup { @@ -212,6 +217,10 @@ export class MlServerPlugin }); } + if (plugins.usageCollection) { + registerCollector(plugins.usageCollection, this.kibanaIndexConfig.kibana.index); + } + return { ...sharedServices }; } diff --git a/x-pack/plugins/ml/server/routes/alerting.ts b/x-pack/plugins/ml/server/routes/alerting.ts index a268a5200b35e..15b7fb6fb4e96 100644 --- a/x-pack/plugins/ml/server/routes/alerting.ts +++ b/x-pack/plugins/ml/server/routes/alerting.ts @@ -9,6 +9,7 @@ import { RouteInitialization } from '../types'; import { wrapError } from '../client/error_wrapper'; import { alertingServiceProvider } from '../lib/alerts/alerting_service'; import { mlAnomalyDetectionAlertPreviewRequest } from './schemas/alerting_schema'; +import { datafeedsProvider } from '../models/job_service/datafeeds'; export function alertingRoutes({ router, routeGuard }: RouteInitialization) { /** @@ -32,7 +33,10 @@ export function alertingRoutes({ router, routeGuard }: RouteInitialization) { }, routeGuard.fullLicenseAPIGuard(async ({ mlClient, request, response, client }) => { try { - const alertingService = alertingServiceProvider(mlClient, client.asInternalUser); + const alertingService = alertingServiceProvider( + mlClient, + datafeedsProvider(client, mlClient) + ); const result = await alertingService.preview(request.body); diff --git a/x-pack/plugins/ml/server/routes/job_service.ts b/x-pack/plugins/ml/server/routes/job_service.ts index 1f755c27db871..39336f192a7f8 100644 --- a/x-pack/plugins/ml/server/routes/job_service.ts +++ b/x-pack/plugins/ml/server/routes/job_service.ts @@ -227,9 +227,13 @@ export function jobServiceRoutes({ router, routeGuard }: RouteInitialization) { tags: ['access:ml:canGetJobs'], }, }, - routeGuard.fullLicenseAPIGuard(async ({ client, mlClient, request, response }) => { + routeGuard.fullLicenseAPIGuard(async ({ client, mlClient, request, response, context }) => { try { - const { jobsSummary } = jobServiceProvider(client, mlClient); + const { jobsSummary } = jobServiceProvider( + client, + mlClient, + context.alerting?.getAlertsClient() + ); const { jobIds } = request.body; const resp = await jobsSummary(jobIds); @@ -328,9 +332,13 @@ export function jobServiceRoutes({ router, routeGuard }: RouteInitialization) { tags: ['access:ml:canGetJobs'], }, }, - routeGuard.fullLicenseAPIGuard(async ({ client, mlClient, request, response }) => { + routeGuard.fullLicenseAPIGuard(async ({ client, mlClient, request, response, context }) => { try { - const { createFullJobsList } = jobServiceProvider(client, mlClient); + const { createFullJobsList } = jobServiceProvider( + client, + mlClient, + context.alerting?.getAlertsClient() + ); const { jobIds } = request.body; const resp = await createFullJobsList(jobIds); diff --git a/x-pack/plugins/ml/server/routes/schemas/alerting_schema.ts b/x-pack/plugins/ml/server/routes/schemas/alerting_schema.ts index faf70f42e427e..df22ccfe20821 100644 --- a/x-pack/plugins/ml/server/routes/schemas/alerting_schema.ts +++ b/x-pack/plugins/ml/server/routes/schemas/alerting_schema.ts @@ -26,13 +26,19 @@ export const mlAnomalyDetectionAlertParams = schema.object({ }, } ), - severity: schema.number(), + /** Anomaly score threshold */ + severity: schema.number({ min: 0, max: 100 }), + /** Result type to alert upon */ resultType: schema.oneOf([ schema.literal(ANOMALY_RESULT_TYPE.RECORD), schema.literal(ANOMALY_RESULT_TYPE.BUCKET), schema.literal(ANOMALY_RESULT_TYPE.INFLUENCER), ]), includeInterim: schema.boolean({ defaultValue: true }), + /** User's override for the lookback interval */ + lookbackInterval: schema.nullable(schema.string()), + /** User's override for the top N buckets */ + topNBuckets: schema.nullable(schema.number({ min: 1 })), }); export const mlAnomalyDetectionAlertPreviewRequest = schema.object({ diff --git a/x-pack/plugins/ml/server/routes/schemas/data_visualizer_schema.ts b/x-pack/plugins/ml/server/routes/schemas/data_visualizer_schema.ts index 0d7e55d29b1c5..50b48aad9cee4 100644 --- a/x-pack/plugins/ml/server/routes/schemas/data_visualizer_schema.ts +++ b/x-pack/plugins/ml/server/routes/schemas/data_visualizer_schema.ts @@ -20,7 +20,7 @@ export const dataVisualizerFieldHistogramsSchema = schema.object({ fields: schema.arrayOf(schema.any()), /** Number of documents to be collected in the sample processed on each shard, or -1 for no sampling. */ samplerShardSize: schema.number(), - /** Optional search time runtime mappings */ + /** Optional search time runtime fields */ runtimeMappings: runtimeMappingsSchema, }); @@ -40,7 +40,7 @@ export const dataVisualizerFieldStatsSchema = schema.object({ interval: schema.maybe(schema.number()), /** Maximum number of examples to return for text type fields. */ maxExamples: schema.number(), - /** Optional search time runtime mappings */ + /** Optional search time runtime fields */ runtimeMappings: runtimeMappingsSchema, }); @@ -59,6 +59,6 @@ export const dataVisualizerOverallStatsSchema = schema.object({ earliest: schema.maybe(schema.number()), /** Latest timestamp for search, as epoch ms (optional). */ latest: schema.maybe(schema.number()), - /** Optional search time runtime mappings */ + /** Optional search time runtime fields */ runtimeMappings: runtimeMappingsSchema, }); diff --git a/x-pack/plugins/ml/server/shared_services/providers/alerting_service.ts b/x-pack/plugins/ml/server/shared_services/providers/alerting_service.ts index cbe22478e12d6..fa08cdf81fe1c 100644 --- a/x-pack/plugins/ml/server/shared_services/providers/alerting_service.ts +++ b/x-pack/plugins/ml/server/shared_services/providers/alerting_service.ts @@ -8,6 +8,7 @@ import { KibanaRequest, SavedObjectsClientContract } from 'kibana/server'; import { GetGuards } from '../shared_services'; import { alertingServiceProvider, MlAlertingService } from '../../lib/alerts/alerting_service'; +import { datafeedsProvider } from '../../models/job_service/datafeeds'; export function getAlertingServiceProvider(getGuards: GetGuards) { return { @@ -21,7 +22,9 @@ export function getAlertingServiceProvider(getGuards: GetGuards) { .isFullLicense() .hasMlCapabilities(['canGetJobs']) .ok(({ mlClient, scopedClient }) => - alertingServiceProvider(mlClient, scopedClient.asInternalUser).preview(...args) + alertingServiceProvider(mlClient, datafeedsProvider(scopedClient, mlClient)).preview( + ...args + ) ); }, execute: async ( @@ -31,7 +34,9 @@ export function getAlertingServiceProvider(getGuards: GetGuards) { .isFullLicense() .hasMlCapabilities(['canGetJobs']) .ok(({ mlClient, scopedClient }) => - alertingServiceProvider(mlClient, scopedClient.asInternalUser).execute(...args) + alertingServiceProvider(mlClient, datafeedsProvider(scopedClient, mlClient)).execute( + ...args + ) ); }, }; diff --git a/x-pack/plugins/ml/server/types.ts b/x-pack/plugins/ml/server/types.ts index 2109685f5dcc2..013feb568ca53 100644 --- a/x-pack/plugins/ml/server/types.ts +++ b/x-pack/plugins/ml/server/types.ts @@ -17,6 +17,7 @@ import type { ResolveMlCapabilities } from '../common/types/capabilities'; import type { RouteGuard } from './lib/route_guard'; import type { AlertingPlugin } from '../../alerting/server'; import type { ActionsPlugin } from '../../actions/server'; +import type { UsageCollectionSetup } from '../../../../src/plugins/usage_collection/server'; export interface LicenseCheckResult { isAvailable: boolean; @@ -47,6 +48,7 @@ export interface PluginsSetup { spaces?: SpacesPluginSetup; alerting?: AlertingPlugin['setup']; actions?: ActionsPlugin['setup']; + usageCollection?: UsageCollectionSetup; } export interface PluginsStart { diff --git a/x-pack/plugins/ml/server/usage/collector.ts b/x-pack/plugins/ml/server/usage/collector.ts new file mode 100644 index 0000000000000..91fa72e3a04cc --- /dev/null +++ b/x-pack/plugins/ml/server/usage/collector.ts @@ -0,0 +1,100 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import type { UsageCollectionSetup } from '../../../../../src/plugins/usage_collection/server'; +import { ML_ALERT_TYPES } from '../../common/constants/alerts'; +import { AnomalyResultType } from '../../common/types/anomalies'; + +export interface MlUsageData { + alertRules: { + 'xpack.ml.anomaly_detection_alert': { + count_by_result_type: { + record: number; + bucket: number; + influencer: number; + }; + }; + }; +} + +export function registerCollector(usageCollection: UsageCollectionSetup, kibanaIndex: string) { + const collector = usageCollection.makeUsageCollector({ + type: 'ml', + schema: { + alertRules: { + 'xpack.ml.anomaly_detection_alert': { + count_by_result_type: { + record: { + type: 'long', + _meta: { description: 'total number of alerting rules using record result type' }, + }, + influencer: { + type: 'long', + _meta: { description: 'total number of alerting rules using influencer result type' }, + }, + bucket: { + type: 'long', + _meta: { description: 'total number of alerting rules using bucket result type' }, + }, + }, + }, + }, + }, + isReady: () => !!kibanaIndex, + fetch: async ({ esClient }) => { + const result = await esClient.search({ + index: kibanaIndex, + size: 0, + body: { + query: { + bool: { + filter: [ + { term: { type: 'alert' } }, + { + term: { + 'alert.alertTypeId': ML_ALERT_TYPES.ANOMALY_DETECTION, + }, + }, + ], + }, + }, + aggs: { + count_by_result_type: { + terms: { + field: 'alert.params.resultType', + size: 3, + }, + }, + }, + }, + }); + + const aggResponse = result.body.aggregations as { + count_by_result_type: { + buckets: Array<{ + key: AnomalyResultType; + doc_count: number; + }>; + }; + }; + const countByResultType = aggResponse.count_by_result_type.buckets.reduce((acc, curr) => { + acc[curr.key] = curr.doc_count; + return acc; + }, {} as MlUsageData['alertRules'][typeof ML_ALERT_TYPES.ANOMALY_DETECTION]['count_by_result_type']); + + return { + alertRules: { + [ML_ALERT_TYPES.ANOMALY_DETECTION]: { + count_by_result_type: countByResultType, + }, + }, + }; + }, + }); + + usageCollection.registerCollector(collector); +} diff --git a/x-pack/plugins/ml/server/usage/index.ts b/x-pack/plugins/ml/server/usage/index.ts new file mode 100644 index 0000000000000..adadedd200fe9 --- /dev/null +++ b/x-pack/plugins/ml/server/usage/index.ts @@ -0,0 +1,8 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +export { registerCollector } from './collector'; diff --git a/x-pack/plugins/ml/tsconfig.json b/x-pack/plugins/ml/tsconfig.json index 6b396b1c59642..d887cfc885253 100644 --- a/x-pack/plugins/ml/tsconfig.json +++ b/x-pack/plugins/ml/tsconfig.json @@ -24,7 +24,7 @@ { "path": "../../../src/plugins/index_pattern_management/tsconfig.json" }, { "path": "../cloud/tsconfig.json" }, { "path": "../features/tsconfig.json" }, - { "path": "../file_upload/tsconfig.json" }, + { "path": "../file_data_visualizer/tsconfig.json" }, { "path": "../license_management/tsconfig.json" }, { "path": "../licensing/tsconfig.json" }, { "path": "../maps/tsconfig.json" }, diff --git a/x-pack/plugins/monitoring/public/components/apm/apm_metrics.tsx b/x-pack/plugins/monitoring/public/components/apm/apm_metrics.tsx index 7efddcfe66b0b..2f09b20efd8a1 100644 --- a/x-pack/plugins/monitoring/public/components/apm/apm_metrics.tsx +++ b/x-pack/plugins/monitoring/public/components/apm/apm_metrics.tsx @@ -30,6 +30,11 @@ interface Props { metrics: { [key: string]: unknown }; seriesToShow: unknown[]; title: string; + summary: { + config: { + container: boolean; + }; + }; } const createCharts = (series: unknown[], props: Partial) => { @@ -42,8 +47,13 @@ const createCharts = (series: unknown[], props: Partial) => { }); }; -export const ApmMetrics = ({ stats, metrics, seriesToShow, title, ...props }: Props) => { - const topSeries = [metrics.apm_cpu, metrics.apm_memory, metrics.apm_os_load]; +export const ApmMetrics = ({ stats, metrics, seriesToShow, title, summary, ...props }: Props) => { + if (!metrics) { + return null; + } + const topSeries = [metrics.apm_cpu, metrics.apm_os_load]; + const { config } = summary || stats; + topSeries.push(config.container ? metrics.apm_memory_cgroup : metrics.apm_memory); return ( diff --git a/x-pack/plugins/monitoring/public/components/cluster/overview/elasticsearch_panel.js b/x-pack/plugins/monitoring/public/components/cluster/overview/elasticsearch_panel.js index aa414d79c82de..8f64656339083 100644 --- a/x-pack/plugins/monitoring/public/components/cluster/overview/elasticsearch_panel.js +++ b/x-pack/plugins/monitoring/public/components/cluster/overview/elasticsearch_panel.js @@ -356,7 +356,7 @@ export function ElasticsearchPanel(props) { - + diff --git a/x-pack/plugins/monitoring/public/components/cluster/overview/helpers.js b/x-pack/plugins/monitoring/public/components/cluster/overview/helpers.js index 3380784b46f4b..9fe22a6a4f85b 100644 --- a/x-pack/plugins/monitoring/public/components/cluster/overview/helpers.js +++ b/x-pack/plugins/monitoring/public/components/cluster/overview/helpers.js @@ -27,16 +27,32 @@ export function HealthLabel(props) { }); } - if (props.status === 'yellow') { - return i18n.translate('xpack.monitoring.cluster.health.replicaShards', { - defaultMessage: 'Missing replica shards', - }); + const { product, status } = props; + if (product === 'es') { + if (props.status === 'yellow') { + return i18n.translate('xpack.monitoring.cluster.health.replicaShards', { + defaultMessage: 'Missing replica shards', + }); + } + + if (props.status === 'red') { + return i18n.translate('xpack.monitoring.cluster.health.primaryShards', { + defaultMessage: 'Missing primary shards', + }); + } } - if (props.status === 'red') { - return i18n.translate('xpack.monitoring.cluster.health.primaryShards', { - defaultMessage: 'Missing primary shards', - }); + if (product === 'kb' && status === 'red') { + return ( + + {i18n.translate('xpack.monitoring.cluster.health.pluginIssues', { + defaultMessage: 'Some plugins are experiencing issues. Check ', + })} + + status + + + ); } return 'N/A'; @@ -55,7 +71,7 @@ export function HealthStatusIndicator(props) { - + diff --git a/x-pack/plugins/monitoring/public/components/cluster/overview/kibana_panel.js b/x-pack/plugins/monitoring/public/components/cluster/overview/kibana_panel.js index 1e9b7ed1eade7..ce09621b61df3 100644 --- a/x-pack/plugins/monitoring/public/components/cluster/overview/kibana_panel.js +++ b/x-pack/plugins/monitoring/public/components/cluster/overview/kibana_panel.js @@ -49,7 +49,7 @@ export function KibanaPanel(props) { return null; } - const statusIndicator = ; + const statusIndicator = ; const goToKibana = () => getSafeForExternalLink('#/kibana'); const goToInstances = () => getSafeForExternalLink('#/kibana/instances'); diff --git a/x-pack/plugins/monitoring/server/config.test.ts b/x-pack/plugins/monitoring/server/config.test.ts index c285ff27c5a63..8ea37d04c146c 100644 --- a/x-pack/plugins/monitoring/server/config.test.ts +++ b/x-pack/plugins/monitoring/server/config.test.ts @@ -19,7 +19,9 @@ const MOCKED_PATHS = [ beforeEach(() => { const spy = jest.spyOn(fs, 'readFileSync').mockImplementation(); - MOCKED_PATHS.forEach((file) => when(spy).calledWith(file).mockReturnValue(`contents-of-${file}`)); + MOCKED_PATHS.forEach((file) => + when(spy).calledWith(file, 'utf8').mockReturnValue(`contents-of-${file}`) + ); }); describe('config schema', () => { diff --git a/x-pack/plugins/monitoring/server/lib/metrics/__snapshots__/metrics.test.js.snap b/x-pack/plugins/monitoring/server/lib/metrics/__snapshots__/metrics.test.js.snap index c894cd4ee588d..674e826b579e5 100644 --- a/x-pack/plugins/monitoring/server/lib/metrics/__snapshots__/metrics.test.js.snap +++ b/x-pack/plugins/monitoring/server/lib/metrics/__snapshots__/metrics.test.js.snap @@ -461,6 +461,32 @@ Object { "usageField": "cpuacct.total.ns", "uuidField": "beats_stats.beat.uuid", }, + "apm_cgroup_memory_limit": ApmMetric { + "app": "apm", + "derivative": false, + "description": "Memory limit of the container", + "field": "beats_stats.metrics.beat.cgroup.memory.mem.limit.bytes", + "format": "0,0.0 b", + "label": "Memory Limit", + "metricAgg": "max", + "timestampField": "beats_stats.timestamp", + "title": "Memory", + "units": "B", + "uuidField": "beats_stats.beat.uuid", + }, + "apm_cgroup_memory_usage": ApmMetric { + "app": "apm", + "derivative": false, + "description": "Memory usage of the container", + "field": "beats_stats.metrics.beat.cgroup.memory.mem.usage.bytes", + "format": "0,0.0 b", + "label": "Memory Utilization (cgroup)", + "metricAgg": "max", + "timestampField": "beats_stats.timestamp", + "title": "Memory", + "units": "B", + "uuidField": "beats_stats.beat.uuid", + }, "apm_cpu_total": ApmCpuUtilizationMetric { "app": "apm", "calculation": [Function], diff --git a/x-pack/plugins/monitoring/server/lib/metrics/apm/metrics.js b/x-pack/plugins/monitoring/server/lib/metrics/apm/metrics.js index ecbd4c4204be0..7c779f31c684b 100644 --- a/x-pack/plugins/monitoring/server/lib/metrics/apm/metrics.js +++ b/x-pack/plugins/monitoring/server/lib/metrics/apm/metrics.js @@ -615,4 +615,37 @@ export const metrics = { defaultMessage: 'HTTP Requests received by agent configuration managemen', }), }), + apm_cgroup_memory_usage: new ApmMetric({ + field: 'beats_stats.metrics.beat.cgroup.memory.mem.usage.bytes', + label: i18n.translate('xpack.monitoring.metrics.apmInstance.memory.memoryUsageLabel', { + defaultMessage: 'Memory Utilization (cgroup)', + }), + title: instanceMemoryTitle, + description: i18n.translate( + 'xpack.monitoring.metrics.apmInstance.memory.memoryUsageDescription', + { + defaultMessage: 'Memory usage of the container', + } + ), + format: LARGE_BYTES, + metricAgg: 'max', + units: 'B', + }), + + apm_cgroup_memory_limit: new ApmMetric({ + field: 'beats_stats.metrics.beat.cgroup.memory.mem.limit.bytes', + label: i18n.translate('xpack.monitoring.metrics.apmInstance.memory.memoryLimitLabel', { + defaultMessage: 'Memory Limit', + }), + title: instanceMemoryTitle, + description: i18n.translate( + 'xpack.monitoring.metrics.apmInstance.memory.memoryLimitDescription', + { + defaultMessage: 'Memory limit of the container', + } + ), + format: LARGE_BYTES, + metricAgg: 'max', + units: 'B', + }), }; diff --git a/x-pack/plugins/monitoring/server/routes/api/v1/apm/metric_set_instance.js b/x-pack/plugins/monitoring/server/routes/api/v1/apm/metric_set_instance.js index 69d6cb418f1f6..d6fc7cbd2c076 100644 --- a/x-pack/plugins/monitoring/server/routes/api/v1/apm/metric_set_instance.js +++ b/x-pack/plugins/monitoring/server/routes/api/v1/apm/metric_set_instance.js @@ -18,6 +18,10 @@ export const metricSet = [ keys: ['apm_mem_alloc', 'apm_mem_rss', 'apm_mem_gc_next'], name: 'apm_memory', }, + { + keys: ['apm_cgroup_memory_usage', 'apm_cgroup_memory_limit', 'apm_mem_gc_next'], + name: 'apm_memory_cgroup', + }, { keys: ['apm_output_events_total', 'apm_output_events_active', 'apm_output_events_acked'], name: 'apm_output_events_rate_success', diff --git a/x-pack/plugins/monitoring/server/routes/api/v1/apm/metric_set_overview.js b/x-pack/plugins/monitoring/server/routes/api/v1/apm/metric_set_overview.js index bb1543477d7d7..b0dccb8dd34df 100644 --- a/x-pack/plugins/monitoring/server/routes/api/v1/apm/metric_set_overview.js +++ b/x-pack/plugins/monitoring/server/routes/api/v1/apm/metric_set_overview.js @@ -18,6 +18,10 @@ export const metricSet = [ keys: ['apm_mem_alloc', 'apm_mem_rss', 'apm_mem_gc_next'], name: 'apm_memory', }, + { + keys: ['apm_cgroup_memory_usage', 'apm_cgroup_memory_limit', 'apm_mem_gc_next'], + name: 'apm_memory_cgroup', + }, { keys: ['apm_output_events_total', 'apm_output_events_active', 'apm_output_events_acked'], name: 'apm_output_events_rate_success', diff --git a/x-pack/plugins/observability/README.md b/x-pack/plugins/observability/README.md index 0ef0543c2922e..b882891921cde 100644 --- a/x-pack/plugins/observability/README.md +++ b/x-pack/plugins/observability/README.md @@ -2,6 +2,28 @@ This plugin provides shared components and services for use across observability solutions, as well as the observability landing page UI. +## Rules, Alerts, and Cases + +The Observability plugin contains experimental support for improved alerting and +case management. + +If you have: + +```yaml +xpack.observability.unsafe.alertingExperience.enabled: true +``` + +In your Kibana configuration, the Alerts and Cases pages will be available. + +This will only enable the UI for these pages. In order to have alert data indexed +you'll need to enable writing in the [Rule Registry plugin](../rule_registry/README.md): + +```yaml +xpack.ruleRegistry.unsafe.write.enabled: true +``` + +When both of the these are set to `true`, your alerts should show on the alerts page. + ## Unit testing Note: Run the following commands from `kibana/x-pack/plugins/observability`. diff --git a/x-pack/plugins/observability/common/ui_settings_keys.ts b/x-pack/plugins/observability/common/ui_settings_keys.ts index cb6ea799078a2..bd53647488256 100644 --- a/x-pack/plugins/observability/common/ui_settings_keys.ts +++ b/x-pack/plugins/observability/common/ui_settings_keys.ts @@ -5,5 +5,4 @@ * 2.0. */ -export const enableAlertingExperience = 'observability:enableAlertingExperience'; export const enableInspectEsQueries = 'observability:enableInspectEsQueries'; diff --git a/x-pack/plugins/observability/public/application/application.test.tsx b/x-pack/plugins/observability/public/application/application.test.tsx index 34ee22e89e66b..c0b51652a7d0e 100644 --- a/x-pack/plugins/observability/public/application/application.test.tsx +++ b/x-pack/plugins/observability/public/application/application.test.tsx @@ -45,6 +45,7 @@ describe('renderApp', () => { uiSettings: { get: () => false }, http: { basePath: { prepend: (path: string) => path } }, } as unknown) as CoreStart; + const config = { unsafe: { alertingExperience: { enabled: true } } }; const params = ({ element: window.document.createElement('div'), history: createMemoryHistory(), @@ -53,6 +54,7 @@ describe('renderApp', () => { expect(() => { const unmount = renderApp({ + config, core, plugins, appMountParameters: params, diff --git a/x-pack/plugins/observability/public/application/index.tsx b/x-pack/plugins/observability/public/application/index.tsx index aa7d1d037d7b7..8607b57b42666 100644 --- a/x-pack/plugins/observability/public/application/index.tsx +++ b/x-pack/plugins/observability/public/application/index.tsx @@ -22,6 +22,7 @@ import { ObservabilityPublicPluginsStart, ObservabilityRuleRegistry } from '../p import { HasDataContextProvider } from '../context/has_data_context'; import { Breadcrumbs, routes } from '../routes'; import { Storage } from '../../../../../src/plugins/kibana_utils/public'; +import { ConfigSchema } from '..'; function getTitleFromBreadCrumbs(breadcrumbs: Breadcrumbs) { return breadcrumbs.map(({ text }) => text).reverse(); @@ -67,11 +68,13 @@ function App() { } export const renderApp = ({ + config, core, plugins, appMountParameters, observabilityRuleRegistry, }: { + config: ConfigSchema; core: CoreStart; plugins: ObservabilityPublicPluginsStart; observabilityRuleRegistry: ObservabilityRuleRegistry; @@ -91,7 +94,7 @@ export const renderApp = ({ ReactDOM.render( diff --git a/x-pack/plugins/observability/public/components/app/section/alerts/index.tsx b/x-pack/plugins/observability/public/components/app/section/alerts/index.tsx index adc6a0208dc42..0adb9ceb6e9f8 100644 --- a/x-pack/plugins/observability/public/components/app/section/alerts/index.tsx +++ b/x-pack/plugins/observability/public/components/app/section/alerts/index.tsx @@ -21,7 +21,6 @@ import React, { useState } from 'react'; import { EuiSelect } from '@elastic/eui'; import { uniqBy } from 'lodash'; import { Alert } from '../../../../../../alerting/common'; -import { enableAlertingExperience } from '../../../../../common/ui_settings_keys'; import { usePluginContext } from '../../../../hooks/use_plugin_context'; import { SectionContainer } from '..'; @@ -38,10 +37,9 @@ interface Props { } export function AlertsSection({ alerts }: Props) { - const { core } = usePluginContext(); + const { config, core } = usePluginContext(); const [filter, setFilter] = useState(ALL_TYPES); - - const href = core.uiSettings.get(enableAlertingExperience) + const href = config.unsafe.alertingExperience.enabled ? '/app/observability/alerts' : '/app/management/insightsAndAlerting/triggersActions/alerts'; diff --git a/x-pack/plugins/observability/public/components/app/section/apm/index.test.tsx b/x-pack/plugins/observability/public/components/app/section/apm/index.test.tsx index 8ff68a0466054..d41f131ef521b 100644 --- a/x-pack/plugins/observability/public/components/app/section/apm/index.test.tsx +++ b/x-pack/plugins/observability/public/components/app/section/apm/index.test.tsx @@ -40,6 +40,7 @@ describe('APMSection', () => { http: { basePath: { prepend: jest.fn() } }, } as unknown) as CoreStart, appMountParameters: {} as AppMountParameters, + config: { unsafe: { alertingExperience: { enabled: true } } }, observabilityRuleRegistry: ({ registerType: jest.fn(), getTypeByRuleId: jest.fn(), diff --git a/x-pack/plugins/observability/public/components/app/section/uptime/index.tsx b/x-pack/plugins/observability/public/components/app/section/uptime/index.tsx index b81e5b5616d7b..1dbcdeaee800a 100644 --- a/x-pack/plugins/observability/public/components/app/section/uptime/index.tsx +++ b/x-pack/plugins/observability/public/components/app/section/uptime/index.tsx @@ -46,7 +46,7 @@ export function UptimeSection({ bucketSize }: Props) { const { data, status } = useFetcher( () => { if (bucketSize) { - return getDataHandler('uptime')?.fetchData({ + return getDataHandler('synthetics')?.fetchData({ absoluteTime: { start: absoluteStart, end: absoluteEnd }, relativeTime: { start: relativeStart, end: relativeEnd }, bucketSize, @@ -58,7 +58,7 @@ export function UptimeSection({ bucketSize }: Props) { [bucketSize, relativeStart, relativeEnd, forceUpdate] ); - if (!hasData.uptime?.hasData) { + if (!hasData.synthetics?.hasData) { return null; } diff --git a/x-pack/plugins/observability/public/components/app/section/ux/index.test.tsx b/x-pack/plugins/observability/public/components/app/section/ux/index.test.tsx index 290990a5c05a5..fa4d1a744e3ea 100644 --- a/x-pack/plugins/observability/public/components/app/section/ux/index.test.tsx +++ b/x-pack/plugins/observability/public/components/app/section/ux/index.test.tsx @@ -40,6 +40,7 @@ describe('UXSection', () => { http: { basePath: { prepend: jest.fn() } }, } as unknown) as CoreStart, appMountParameters: {} as AppMountParameters, + config: { unsafe: { alertingExperience: { enabled: true } } }, plugins: ({ data: { query: { diff --git a/x-pack/plugins/observability/public/components/shared/exploratory_view/configurations/apm/service_latency_config.ts b/x-pack/plugins/observability/public/components/shared/exploratory_view/configurations/apm/service_latency_config.ts index 3959860b9c53c..1c2627dac30e7 100644 --- a/x-pack/plugins/observability/public/components/shared/exploratory_view/configurations/apm/service_latency_config.ts +++ b/x-pack/plugins/observability/public/components/shared/exploratory_view/configurations/apm/service_latency_config.ts @@ -19,11 +19,13 @@ export function getServiceLatencyLensConfig({ seriesId, indexPattern }: ConfigPr xAxisColumn: { sourceField: '@timestamp', }, - yAxisColumn: { - operationType: 'average', - sourceField: 'transaction.duration.us', - label: 'Latency', - }, + yAxisColumns: [ + { + operationType: 'average', + sourceField: 'transaction.duration.us', + label: 'Latency', + }, + ], hasOperationType: true, defaultFilters: [ 'user_agent.name', diff --git a/x-pack/plugins/observability/public/components/shared/exploratory_view/configurations/apm/service_throughput_config.ts b/x-pack/plugins/observability/public/components/shared/exploratory_view/configurations/apm/service_throughput_config.ts index d4a44a5c95a0b..2de2cbdfd75a6 100644 --- a/x-pack/plugins/observability/public/components/shared/exploratory_view/configurations/apm/service_throughput_config.ts +++ b/x-pack/plugins/observability/public/components/shared/exploratory_view/configurations/apm/service_throughput_config.ts @@ -22,11 +22,13 @@ export function getServiceThroughputLensConfig({ xAxisColumn: { sourceField: '@timestamp', }, - yAxisColumn: { - operationType: 'average', - sourceField: 'transaction.duration.us', - label: 'Throughput', - }, + yAxisColumns: [ + { + operationType: 'average', + sourceField: 'transaction.duration.us', + label: 'Throughput', + }, + ], hasOperationType: true, defaultFilters: [ 'user_agent.name', diff --git a/x-pack/plugins/observability/public/components/shared/exploratory_view/configurations/default_configs.ts b/x-pack/plugins/observability/public/components/shared/exploratory_view/configurations/default_configs.ts index 2c5b4ebea0ab3..f9637dc653d2c 100644 --- a/x-pack/plugins/observability/public/components/shared/exploratory_view/configurations/default_configs.ts +++ b/x-pack/plugins/observability/public/components/shared/exploratory_view/configurations/default_configs.ts @@ -33,7 +33,7 @@ export const getDefaultConfigs = ({ reportType, seriesId, indexPattern }: Props) case 'uptime-duration': return getMonitorDurationConfig({ seriesId }); case 'uptime-pings': - return getMonitorPingsConfig({ seriesId }); + return getMonitorPingsConfig({ seriesId, indexPattern }); case 'service-latency': return getServiceLatencyLensConfig({ seriesId, indexPattern }); case 'service-throughput': diff --git a/x-pack/plugins/observability/public/components/shared/exploratory_view/configurations/lens_attributes.ts b/x-pack/plugins/observability/public/components/shared/exploratory_view/configurations/lens_attributes.ts index 01d74dc2ac36b..146f488450f3a 100644 --- a/x-pack/plugins/observability/public/components/shared/exploratory_view/configurations/lens_attributes.ts +++ b/x-pack/plugins/observability/public/components/shared/exploratory_view/configurations/lens_attributes.ts @@ -23,6 +23,7 @@ import { DataType, OperationMetadata, FieldBasedIndexPatternColumn, + SumIndexPatternColumn, } from '../../../../../../lens/public'; import { buildPhraseFilter, @@ -95,8 +96,12 @@ export class LensAttributes { this.filters = filters ?? []; this.reportDefinitions = reportDefinitions ?? {}; - if (typeof reportViewConfig.yAxisColumn.operationType !== undefined && operationType) { - reportViewConfig.yAxisColumn.operationType = operationType as FieldBasedIndexPatternColumn['operationType']; + if (operationType) { + reportViewConfig.yAxisColumns.forEach((yAxisColumn) => { + if (typeof yAxisColumn.operationType !== undefined) { + yAxisColumn.operationType = operationType as FieldBasedIndexPatternColumn['operationType']; + } + }); } this.seriesType = seriesType ?? reportViewConfig.defaultSeriesType; this.reportViewConfig = reportViewConfig; @@ -123,7 +128,12 @@ export class LensAttributes { }, }; - this.layers.layer1.columnOrder = ['x-axis-column', 'break-down-column', 'y-axis-column']; + this.layers.layer1.columnOrder = [ + 'x-axis-column', + 'break-down-column', + 'y-axis-column', + ...Object.keys(this.getChildYAxises()), + ]; this.visualization.layers[0].splitAccessor = 'break-down-column'; } @@ -152,10 +162,15 @@ export class LensAttributes { }; } - getNumberColumn(sourceField: string, columnType?: string, operationType?: string) { + getNumberColumn( + sourceField: string, + columnType?: string, + operationType?: string, + label?: string + ) { if (columnType === 'operation' || operationType) { - if (operationType === 'median' || operationType === 'average') { - return this.getNumberOperationColumn(sourceField, operationType); + if (operationType === 'median' || operationType === 'average' || operationType === 'sum') { + return this.getNumberOperationColumn(sourceField, operationType, label); } if (operationType?.includes('th')) { return this.getPercentileNumberColumn(sourceField, operationType); @@ -166,17 +181,20 @@ export class LensAttributes { getNumberOperationColumn( sourceField: string, - operationType: 'average' | 'median' - ): AvgIndexPatternColumn | MedianIndexPatternColumn { + operationType: 'average' | 'median' | 'sum', + label?: string + ): AvgIndexPatternColumn | MedianIndexPatternColumn | SumIndexPatternColumn { return { ...buildNumberColumn(sourceField), - label: i18n.translate('xpack.observability.expView.columns.operation.label', { - defaultMessage: '{operationType} of {sourceField}', - values: { - sourceField: this.reportViewConfig.labels[sourceField], - operationType: capitalize(operationType), - }, - }), + label: + label || + i18n.translate('xpack.observability.expView.columns.operation.label', { + defaultMessage: '{operationType} of {sourceField}', + values: { + sourceField: this.reportViewConfig.labels[sourceField], + operationType: capitalize(operationType), + }, + }), operationType, }; } @@ -211,10 +229,10 @@ export class LensAttributes { getXAxis() { const { xAxisColumn } = this.reportViewConfig; - return this.getColumnBasedOnType(xAxisColumn.sourceField!); + return this.getColumnBasedOnType(xAxisColumn.sourceField!, undefined, xAxisColumn.label); } - getColumnBasedOnType(sourceField: string, operationType?: OperationType) { + getColumnBasedOnType(sourceField: string, operationType?: OperationType, label?: string) { const { fieldMeta, columnType, fieldName } = this.getFieldMeta(sourceField); const { type: fieldType } = fieldMeta ?? {}; @@ -226,7 +244,7 @@ export class LensAttributes { return this.getDateHistogramColumn(fieldName); } if (fieldType === 'number') { - return this.getNumberColumn(fieldName, columnType, operationType); + return this.getNumberColumn(fieldName, columnType, operationType, label); } // FIXME review my approach again @@ -246,13 +264,32 @@ export class LensAttributes { } getMainYAxis() { - const { sourceField, operationType, label } = this.reportViewConfig.yAxisColumn; + const { sourceField, operationType, label } = this.reportViewConfig.yAxisColumns[0]; if (sourceField === 'Records' || !sourceField) { return this.getRecordsColumn(label); } - return this.getColumnBasedOnType(sourceField!, operationType); + return this.getColumnBasedOnType(sourceField!, operationType, label); + } + + getChildYAxises() { + const lensColumns: Record = {}; + const yAxisColumns = this.reportViewConfig.yAxisColumns; + // 1 means there is only main y axis + if (yAxisColumns.length === 1) { + return lensColumns; + } + for (let i = 1; i < yAxisColumns.length; i++) { + const { sourceField, operationType, label } = yAxisColumns[i]; + + lensColumns[`y-axis-column-${i}`] = this.getColumnBasedOnType( + sourceField!, + operationType, + label + ); + } + return lensColumns; } getRecordsColumn(label?: string): CountIndexPatternColumn { @@ -268,10 +305,11 @@ export class LensAttributes { getLayer() { return { - columnOrder: ['x-axis-column', 'y-axis-column'], + columnOrder: ['x-axis-column', 'y-axis-column', ...Object.keys(this.getChildYAxises())], columns: { 'x-axis-column': this.getXAxis(), 'y-axis-column': this.getMainYAxis(), + ...this.getChildYAxises(), }, incompleteColumns: {}, }; @@ -289,7 +327,7 @@ export class LensAttributes { preferredSeriesType: 'line', layers: [ { - accessors: ['y-axis-column'], + accessors: ['y-axis-column', ...Object.keys(this.getChildYAxises())], layerId: 'layer1', seriesType: this.seriesType ?? 'line', palette: this.reportViewConfig.palette, @@ -297,6 +335,7 @@ export class LensAttributes { xAccessor: 'x-axis-column', }, ], + ...(this.reportViewConfig.yTitle ? { yTitle: this.reportViewConfig.yTitle } : {}), }; } diff --git a/x-pack/plugins/observability/public/components/shared/exploratory_view/configurations/logs/logs_frequency_config.ts b/x-pack/plugins/observability/public/components/shared/exploratory_view/configurations/logs/logs_frequency_config.ts index 9f8a336b59d34..97d915ede01a9 100644 --- a/x-pack/plugins/observability/public/components/shared/exploratory_view/configurations/logs/logs_frequency_config.ts +++ b/x-pack/plugins/observability/public/components/shared/exploratory_view/configurations/logs/logs_frequency_config.ts @@ -21,9 +21,11 @@ export function getLogsFrequencyLensConfig({ seriesId }: Props): DataSeries { xAxisColumn: { sourceField: '@timestamp', }, - yAxisColumn: { - operationType: 'count', - }, + yAxisColumns: [ + { + operationType: 'count', + }, + ], hasOperationType: false, defaultFilters: [], breakdowns: ['agent.hostname'], diff --git a/x-pack/plugins/observability/public/components/shared/exploratory_view/configurations/metrics/cpu_usage_config.ts b/x-pack/plugins/observability/public/components/shared/exploratory_view/configurations/metrics/cpu_usage_config.ts index d4b807de11f4e..28b381bd12473 100644 --- a/x-pack/plugins/observability/public/components/shared/exploratory_view/configurations/metrics/cpu_usage_config.ts +++ b/x-pack/plugins/observability/public/components/shared/exploratory_view/configurations/metrics/cpu_usage_config.ts @@ -21,11 +21,13 @@ export function getCPUUsageLensConfig({ seriesId }: Props): DataSeries { xAxisColumn: { sourceField: '@timestamp', }, - yAxisColumn: { - operationType: 'average', - sourceField: 'system.cpu.user.pct', - label: 'CPU Usage %', - }, + yAxisColumns: [ + { + operationType: 'average', + sourceField: 'system.cpu.user.pct', + label: 'CPU Usage %', + }, + ], hasOperationType: true, defaultFilters: [], breakdowns: ['host.hostname'], diff --git a/x-pack/plugins/observability/public/components/shared/exploratory_view/configurations/metrics/memory_usage_config.ts b/x-pack/plugins/observability/public/components/shared/exploratory_view/configurations/metrics/memory_usage_config.ts index 38d1c425fc09a..2bd0e4b032778 100644 --- a/x-pack/plugins/observability/public/components/shared/exploratory_view/configurations/metrics/memory_usage_config.ts +++ b/x-pack/plugins/observability/public/components/shared/exploratory_view/configurations/metrics/memory_usage_config.ts @@ -21,11 +21,13 @@ export function getMemoryUsageLensConfig({ seriesId }: Props): DataSeries { xAxisColumn: { sourceField: '@timestamp', }, - yAxisColumn: { - operationType: 'average', - sourceField: 'system.memory.used.pct', - label: 'Memory Usage %', - }, + yAxisColumns: [ + { + operationType: 'average', + sourceField: 'system.memory.used.pct', + label: 'Memory Usage %', + }, + ], hasOperationType: true, defaultFilters: [], breakdowns: ['host.hostname'], diff --git a/x-pack/plugins/observability/public/components/shared/exploratory_view/configurations/metrics/network_activity_config.ts b/x-pack/plugins/observability/public/components/shared/exploratory_view/configurations/metrics/network_activity_config.ts index 07a521225b38d..924701bc13490 100644 --- a/x-pack/plugins/observability/public/components/shared/exploratory_view/configurations/metrics/network_activity_config.ts +++ b/x-pack/plugins/observability/public/components/shared/exploratory_view/configurations/metrics/network_activity_config.ts @@ -21,10 +21,12 @@ export function getNetworkActivityLensConfig({ seriesId }: Props): DataSeries { xAxisColumn: { sourceField: '@timestamp', }, - yAxisColumn: { - operationType: 'average', - sourceField: 'system.memory.used.pct', - }, + yAxisColumns: [ + { + operationType: 'average', + sourceField: 'system.memory.used.pct', + }, + ], hasOperationType: true, defaultFilters: [], breakdowns: ['host.hostname'], diff --git a/x-pack/plugins/observability/public/components/shared/exploratory_view/configurations/rum/kpi_trends_config.ts b/x-pack/plugins/observability/public/components/shared/exploratory_view/configurations/rum/kpi_trends_config.ts index 6e8413b342ce5..f656bd764e8b0 100644 --- a/x-pack/plugins/observability/public/components/shared/exploratory_view/configurations/rum/kpi_trends_config.ts +++ b/x-pack/plugins/observability/public/components/shared/exploratory_view/configurations/rum/kpi_trends_config.ts @@ -37,10 +37,12 @@ export function getKPITrendsLensConfig({ seriesId, indexPattern }: ConfigProps): xAxisColumn: { sourceField: '@timestamp', }, - yAxisColumn: { - sourceField: 'business.kpi', - operationType: 'median', - }, + yAxisColumns: [ + { + sourceField: 'business.kpi', + operationType: 'median', + }, + ], hasOperationType: false, defaultFilters: [ { diff --git a/x-pack/plugins/observability/public/components/shared/exploratory_view/configurations/rum/performance_dist_config.ts b/x-pack/plugins/observability/public/components/shared/exploratory_view/configurations/rum/performance_dist_config.ts index 847e7db18757f..85380241b63b2 100644 --- a/x-pack/plugins/observability/public/components/shared/exploratory_view/configurations/rum/performance_dist_config.ts +++ b/x-pack/plugins/observability/public/components/shared/exploratory_view/configurations/rum/performance_dist_config.ts @@ -37,10 +37,12 @@ export function getPerformanceDistLensConfig({ seriesId, indexPattern }: ConfigP xAxisColumn: { sourceField: 'performance.metric', }, - yAxisColumn: { - sourceField: 'Records', - label: 'Pages loaded', - }, + yAxisColumns: [ + { + sourceField: 'Records', + label: 'Pages loaded', + }, + ], hasOperationType: false, defaultFilters: [ { diff --git a/x-pack/plugins/observability/public/components/shared/exploratory_view/configurations/synthetics/monitor_duration_config.ts b/x-pack/plugins/observability/public/components/shared/exploratory_view/configurations/synthetics/monitor_duration_config.ts index 3b55f5b8eabc9..f27fd4476bfe0 100644 --- a/x-pack/plugins/observability/public/components/shared/exploratory_view/configurations/synthetics/monitor_duration_config.ts +++ b/x-pack/plugins/observability/public/components/shared/exploratory_view/configurations/synthetics/monitor_duration_config.ts @@ -21,13 +21,15 @@ export function getMonitorDurationConfig({ seriesId }: Props): DataSeries { xAxisColumn: { sourceField: '@timestamp', }, - yAxisColumn: { - operationType: 'average', - sourceField: 'monitor.duration.us', - label: 'Monitor duration (ms)', - }, + yAxisColumns: [ + { + operationType: 'average', + sourceField: 'monitor.duration.us', + label: 'Monitor duration (ms)', + }, + ], hasOperationType: true, - defaultFilters: ['monitor.type', 'observer.geo.name', 'tags'], + defaultFilters: ['monitor.type', 'observer.geo.name', 'tags', 'monitor.name', 'monitor.id'], breakdowns: [ 'observer.geo.name', 'monitor.name', @@ -41,6 +43,12 @@ export function getMonitorDurationConfig({ seriesId }: Props): DataSeries { { field: 'monitor.id', }, + { + field: 'monitor.name', + }, + { + field: 'url.full', + }, ], labels: { ...FieldLabels, 'monitor.duration.us': 'Monitor duration' }, }; diff --git a/x-pack/plugins/observability/public/components/shared/exploratory_view/configurations/synthetics/monitor_pings_config.ts b/x-pack/plugins/observability/public/components/shared/exploratory_view/configurations/synthetics/monitor_pings_config.ts index 68a36dcdcaf85..6ffc400394812 100644 --- a/x-pack/plugins/observability/public/components/shared/exploratory_view/configurations/synthetics/monitor_pings_config.ts +++ b/x-pack/plugins/observability/public/components/shared/exploratory_view/configurations/synthetics/monitor_pings_config.ts @@ -5,14 +5,10 @@ * 2.0. */ -import { DataSeries } from '../../types'; +import { ConfigProps, DataSeries } from '../../types'; import { FieldLabels } from '../constants'; -interface Props { - seriesId: string; -} - -export function getMonitorPingsConfig({ seriesId }: Props): DataSeries { +export function getMonitorPingsConfig({ seriesId }: ConfigProps): DataSeries { return { id: seriesId, reportType: 'uptime-pings', @@ -21,16 +17,28 @@ export function getMonitorPingsConfig({ seriesId }: Props): DataSeries { xAxisColumn: { sourceField: '@timestamp', }, - yAxisColumn: { - operationType: 'count', - label: 'Monitor pings', - }, + yAxisColumns: [ + { + operationType: 'sum', + sourceField: 'summary.up', + label: 'Up', + }, + { + operationType: 'sum', + sourceField: 'summary.down', + label: 'Down', + }, + ], + yTitle: 'Pings', hasOperationType: false, - defaultFilters: ['observer.geo.name'], - breakdowns: ['monitor.status', 'observer.geo.name', 'monitor.type'], + defaultFilters: ['observer.geo.name', 'monitor.type', 'monitor.name', 'monitor.id'], + breakdowns: ['observer.geo.name', 'monitor.type'], filters: [], palette: { type: 'palette', name: 'status' }, reportDefinitions: [ + { + field: 'monitor.name', + }, { field: 'monitor.id', }, diff --git a/x-pack/plugins/observability/public/components/shared/exploratory_view/configurations/utils.ts b/x-pack/plugins/observability/public/components/shared/exploratory_view/configurations/utils.ts index c6b7b5d92d5f8..5d5cdb23d3520 100644 --- a/x-pack/plugins/observability/public/components/shared/exploratory_view/configurations/utils.ts +++ b/x-pack/plugins/observability/public/components/shared/exploratory_view/configurations/utils.ts @@ -55,3 +55,11 @@ export function buildPhraseFilter(field: string, value: any, indexPattern: IInde } return []; } + +export function buildExistsFilter(field: string, indexPattern: IIndexPattern) { + const fieldMeta = indexPattern.fields.find((fieldT) => fieldT.name === field); + if (fieldMeta) { + return [esFilters.buildExistsFilter(fieldMeta, indexPattern)]; + } + return []; +} diff --git a/x-pack/plugins/observability/public/components/shared/exploratory_view/hooks/use_app_index_pattern.tsx b/x-pack/plugins/observability/public/components/shared/exploratory_view/hooks/use_app_index_pattern.tsx index 77d0d54ec5a7a..4f13cf6a1f9ca 100644 --- a/x-pack/plugins/observability/public/components/shared/exploratory_view/hooks/use_app_index_pattern.tsx +++ b/x-pack/plugins/observability/public/components/shared/exploratory_view/hooks/use_app_index_pattern.tsx @@ -12,7 +12,7 @@ import { useKibana } from '../../../../../../../../src/plugins/kibana_react/publ import { ObservabilityPublicPluginsStart } from '../../../../plugin'; import { ObservabilityIndexPatterns } from '../utils/observability_index_patterns'; import { getDataHandler } from '../../../../data_handler'; -import { UXHasDataResponse } from '../../../../typings/fetch_overview_data'; +import { HasDataResponse } from '../../../../typings/fetch_overview_data'; export interface IIndexPatternContext { loading: boolean; @@ -48,7 +48,7 @@ export function IndexPatternContextProvider({ children }: ProviderProps) { } = useKibana(); const checkIfAppHasData = async (dataType: AppDataType) => { - const handler = getDataHandler(dataType === 'synthetics' ? 'uptime' : dataType); + const handler = getDataHandler(dataType); return handler?.hasData(); }; @@ -59,17 +59,15 @@ export function IndexPatternContextProvider({ children }: ProviderProps) { if (hasAppData[dataType] === null) { setLoading(true); try { - let hasDataT = await checkIfAppHasData(dataType); + const hasDataResponse = (await checkIfAppHasData(dataType)) as HasDataResponse; - if (dataType === 'ux') { - hasDataT = (hasDataT as UXHasDataResponse).hasData as boolean; - } + const hasDataT = hasDataResponse.hasData; setHasAppData((prevState) => ({ ...prevState, [dataType]: hasDataT })); if (hasDataT || hasAppData?.[dataType]) { const obsvIndexP = new ObservabilityIndexPatterns(data); - const indPattern = await obsvIndexP.getIndexPattern(dataType); + const indPattern = await obsvIndexP.getIndexPattern(dataType, hasDataResponse.indices); setIndexPatterns((prevState) => ({ ...prevState, [dataType]: indPattern })); } diff --git a/x-pack/plugins/observability/public/components/shared/exploratory_view/series_builder/columns/report_definition_col.tsx b/x-pack/plugins/observability/public/components/shared/exploratory_view/series_builder/columns/report_definition_col.tsx index 0c4aef46406fd..0351508ebb59e 100644 --- a/x-pack/plugins/observability/public/components/shared/exploratory_view/series_builder/columns/report_definition_col.tsx +++ b/x-pack/plugins/observability/public/components/shared/exploratory_view/series_builder/columns/report_definition_col.tsx @@ -44,7 +44,7 @@ export function ReportDefinitionCol({ dataViewSeries }: { dataViewSeries: DataSe filters, defaultSeriesType, hasOperationType, - yAxisColumn, + yAxisColumns, } = dataViewSeries; const onChange = (field: string, value?: string) => { @@ -125,7 +125,7 @@ export function ReportDefinitionCol({ dataViewSeries }: { dataViewSeries: DataSe )} diff --git a/x-pack/plugins/observability/public/components/shared/exploratory_view/types.ts b/x-pack/plugins/observability/public/components/shared/exploratory_view/types.ts index bd908661365c0..3878c1cde7aa5 100644 --- a/x-pack/plugins/observability/public/components/shared/exploratory_view/types.ts +++ b/x-pack/plugins/observability/public/components/shared/exploratory_view/types.ts @@ -53,7 +53,7 @@ export interface DataSeries { reportType: ReportViewType; id: string; xAxisColumn: Partial | Partial; - yAxisColumn: Partial; + yAxisColumns: Array>; breakdowns: string[]; defaultSeriesType: SeriesType; @@ -64,6 +64,7 @@ export interface DataSeries { labels: Record; hasOperationType: boolean; palette?: PaletteOutput; + yTitle?: string; } export interface SeriesUrl { diff --git a/x-pack/plugins/observability/public/components/shared/exploratory_view/utils/observability_index_patterns.test.ts b/x-pack/plugins/observability/public/components/shared/exploratory_view/utils/observability_index_patterns.test.ts index f1347e1d21cc3..ade74e7c6744e 100644 --- a/x-pack/plugins/observability/public/components/shared/exploratory_view/utils/observability_index_patterns.test.ts +++ b/x-pack/plugins/observability/public/components/shared/exploratory_view/utils/observability_index_patterns.test.ts @@ -46,11 +46,13 @@ describe('ObservabilityIndexPatterns', function () { it('should return index pattern for app', async function () { const obsv = new ObservabilityIndexPatterns(data!); - const indexP = await obsv.getIndexPattern('ux'); + const indexP = await obsv.getIndexPattern('ux', 'heartbeat-8*,synthetics-*'); - expect(indexP).toEqual({ title: 'index-*' }); + expect(indexP).toEqual({ id: 'rum_static_index_pattern_id' }); - expect(data?.indexPatterns.get).toHaveBeenCalledWith(indexPatternList.ux); + expect(data?.indexPatterns.get).toHaveBeenCalledWith( + 'rum_static_index_pattern_id_heartbeat_8_synthetics_' + ); expect(data?.indexPatterns.get).toHaveBeenCalledTimes(1); }); @@ -59,18 +61,21 @@ describe('ObservabilityIndexPatterns', function () { throw new SavedObjectNotFound('index_pattern'); }); + data!.indexPatterns.createAndSave = jest.fn().mockReturnValue({ id: indexPatternList.ux }); + const obsv = new ObservabilityIndexPatterns(data!); - const indexP = await obsv.getIndexPattern('ux'); + const indexP = await obsv.getIndexPattern('ux', 'trace-*,apm-*'); expect(indexP).toEqual({ id: indexPatternList.ux }); expect(data?.indexPatterns.createAndSave).toHaveBeenCalledWith({ fieldFormats, - id: 'rum_static_index_pattern_id', + id: 'rum_static_index_pattern_id_trace_apm_', timeFieldName: '@timestamp', - title: '(rum-data-view)*,apm-*', + title: '(rum-data-view)*,trace-*,apm-*', }); + expect(data?.indexPatterns.createAndSave).toHaveBeenCalledTimes(1); }); diff --git a/x-pack/plugins/observability/public/components/shared/exploratory_view/utils/observability_index_patterns.ts b/x-pack/plugins/observability/public/components/shared/exploratory_view/utils/observability_index_patterns.ts index b890df69d9936..c265bad56e864 100644 --- a/x-pack/plugins/observability/public/components/shared/exploratory_view/utils/observability_index_patterns.ts +++ b/x-pack/plugins/observability/public/components/shared/exploratory_view/utils/observability_index_patterns.ts @@ -38,11 +38,22 @@ export const indexPatternList: Record = { }; const appToPatternMap: Record = { - synthetics: '(synthetics-data-view)*,heartbeat-*,synthetics-*', + synthetics: '(synthetics-data-view)*', apm: 'apm-*', - ux: '(rum-data-view)*,apm-*', - infra_logs: 'logs-*,filebeat-*', - infra_metrics: 'metrics-*,metricbeat-*', + ux: '(rum-data-view)*', + infra_logs: '', + infra_metrics: '', +}; + +const getAppIndicesWithPattern = (app: AppDataType, indices: string) => { + return `${appToPatternMap[app]},${indices}`; +}; + +const getAppIndexPatternId = (app: AppDataType, indices: string) => { + // Replace characters / ? , " < > | * with _ + const postfix = indices.replace(/[^A-Z0-9]+/gi, '_').toLowerCase(); + + return `${indexPatternList[app]}_${postfix}`; }; export function isParamsSame(param1: IFieldFormat['_params'], param2: FieldFormatParams) { @@ -65,16 +76,16 @@ export class ObservabilityIndexPatterns { this.data = data; } - async createIndexPattern(app: AppDataType) { + async createIndexPattern(app: AppDataType, indices: string) { if (!this.data) { throw new Error('data is not defined'); } - const pattern = appToPatternMap[app]; + const appIndicesPattern = getAppIndicesWithPattern(app, indices); return await this.data.indexPatterns.createAndSave({ - title: pattern, - id: indexPatternList[app], + title: appIndicesPattern, + id: getAppIndexPatternId(app, indices), timeFieldName: '@timestamp', fieldFormats: this.getFieldFormats(app), }); @@ -108,19 +119,27 @@ export class ObservabilityIndexPatterns { return fieldFormatMap; } - async getIndexPattern(app: AppDataType): Promise { + async getIndexPattern(app: AppDataType, indices: string): Promise { if (!this.data) { throw new Error('data is not defined'); } try { - const indexPattern = await this.data?.indexPatterns.get(indexPatternList[app]); + const indexPatternId = getAppIndexPatternId(app, indices); + const indexPatternTitle = getAppIndicesWithPattern(app, indices); + // we will get index pattern by id + const indexPattern = await this.data?.indexPatterns.get(indexPatternId); + + // and make sure title matches, otherwise, we will need to create it + if (indexPattern.title !== indexPatternTitle) { + return await this.createIndexPattern(app, indices); + } // this is intentional a non blocking call, so no await clause this.validateFieldFormats(app, indexPattern); return indexPattern; } catch (e: unknown) { if (e instanceof SavedObjectNotFound) { - return await this.createIndexPattern(app || 'apm'); + return await this.createIndexPattern(app, indices); } } } diff --git a/x-pack/plugins/observability/public/context/has_data_context.test.tsx b/x-pack/plugins/observability/public/context/has_data_context.test.tsx index 01655c0d7b2d7..b5a0806306461 100644 --- a/x-pack/plugins/observability/public/context/has_data_context.test.tsx +++ b/x-pack/plugins/observability/public/context/has_data_context.test.tsx @@ -36,7 +36,7 @@ function unregisterAll() { unregisterDataHandler({ appName: 'apm' }); unregisterDataHandler({ appName: 'infra_logs' }); unregisterDataHandler({ appName: 'infra_metrics' }); - unregisterDataHandler({ appName: 'uptime' }); + unregisterDataHandler({ appName: 'synthetics' }); unregisterDataHandler({ appName: 'ux' }); } @@ -88,7 +88,7 @@ describe('HasDataContextProvider', () => { expect(result.current).toEqual({ hasData: { apm: { hasData: undefined, status: 'success' }, - uptime: { hasData: undefined, status: 'success' }, + synthetics: { hasData: undefined, status: 'success' }, infra_logs: { hasData: undefined, status: 'success' }, infra_metrics: { hasData: undefined, status: 'success' }, ux: { hasData: undefined, status: 'success' }, @@ -108,8 +108,14 @@ describe('HasDataContextProvider', () => { { appName: 'apm', hasData: async () => false }, { appName: 'infra_logs', hasData: async () => false }, { appName: 'infra_metrics', hasData: async () => false }, - { appName: 'uptime', hasData: async () => false }, - { appName: 'ux', hasData: async () => ({ hasData: false, serviceName: undefined }) }, + { + appName: 'synthetics', + hasData: async () => ({ hasData: false, indices: 'heartbeat-*, synthetics-*' }), + }, + { + appName: 'ux', + hasData: async () => ({ hasData: false, serviceName: undefined, indices: 'apm-*' }), + }, ]); }); @@ -130,10 +136,19 @@ describe('HasDataContextProvider', () => { expect(result.current).toEqual({ hasData: { apm: { hasData: false, status: 'success' }, - uptime: { hasData: false, status: 'success' }, + synthetics: { + hasData: { + hasData: false, + indices: 'heartbeat-*, synthetics-*', + }, + status: 'success', + }, infra_logs: { hasData: false, status: 'success' }, infra_metrics: { hasData: false, status: 'success' }, - ux: { hasData: { hasData: false, serviceName: undefined }, status: 'success' }, + ux: { + hasData: { hasData: false, serviceName: undefined, indices: 'apm-*' }, + status: 'success', + }, alert: { hasData: [], status: 'success' }, }, hasAnyData: false, @@ -150,8 +165,14 @@ describe('HasDataContextProvider', () => { { appName: 'apm', hasData: async () => true }, { appName: 'infra_logs', hasData: async () => false }, { appName: 'infra_metrics', hasData: async () => false }, - { appName: 'uptime', hasData: async () => false }, - { appName: 'ux', hasData: async () => ({ hasData: false, serviceName: undefined }) }, + { + appName: 'synthetics', + hasData: async () => ({ hasData: false, indices: 'heartbeat-*, synthetics-*' }), + }, + { + appName: 'ux', + hasData: async () => ({ hasData: false, serviceName: undefined, indices: 'apm-*' }), + }, ]); }); @@ -172,10 +193,19 @@ describe('HasDataContextProvider', () => { expect(result.current).toEqual({ hasData: { apm: { hasData: true, status: 'success' }, - uptime: { hasData: false, status: 'success' }, + synthetics: { + hasData: { + hasData: false, + indices: 'heartbeat-*, synthetics-*', + }, + status: 'success', + }, infra_logs: { hasData: false, status: 'success' }, infra_metrics: { hasData: false, status: 'success' }, - ux: { hasData: { hasData: false, serviceName: undefined }, status: 'success' }, + ux: { + hasData: { hasData: false, serviceName: undefined, indices: 'apm-*' }, + status: 'success', + }, alert: { hasData: [], status: 'success' }, }, hasAnyData: true, @@ -192,8 +222,14 @@ describe('HasDataContextProvider', () => { { appName: 'apm', hasData: async () => true }, { appName: 'infra_logs', hasData: async () => true }, { appName: 'infra_metrics', hasData: async () => true }, - { appName: 'uptime', hasData: async () => true }, - { appName: 'ux', hasData: async () => ({ hasData: true, serviceName: 'ux' }) }, + { + appName: 'synthetics', + hasData: async () => ({ hasData: true, indices: 'heartbeat-*, synthetics-*' }), + }, + { + appName: 'ux', + hasData: async () => ({ hasData: true, serviceName: 'ux', indices: 'apm-*' }), + }, ]); }); @@ -213,11 +249,23 @@ describe('HasDataContextProvider', () => { expect(result.current).toEqual({ hasData: { - apm: { hasData: true, status: 'success' }, - uptime: { hasData: true, status: 'success' }, + apm: { + hasData: true, + status: 'success', + }, + synthetics: { + hasData: { + hasData: true, + indices: 'heartbeat-*, synthetics-*', + }, + status: 'success', + }, infra_logs: { hasData: true, status: 'success' }, infra_metrics: { hasData: true, status: 'success' }, - ux: { hasData: { hasData: true, serviceName: 'ux' }, status: 'success' }, + ux: { + hasData: { hasData: true, serviceName: 'ux', indices: 'apm-*' }, + status: 'success', + }, alert: { hasData: [], status: 'success' }, }, hasAnyData: true, @@ -253,7 +301,7 @@ describe('HasDataContextProvider', () => { expect(result.current).toEqual({ hasData: { apm: { hasData: true, status: 'success' }, - uptime: { hasData: undefined, status: 'success' }, + synthetics: { hasData: undefined, status: 'success' }, infra_logs: { hasData: undefined, status: 'success' }, infra_metrics: { hasData: undefined, status: 'success' }, ux: { hasData: undefined, status: 'success' }, @@ -291,7 +339,7 @@ describe('HasDataContextProvider', () => { expect(result.current).toEqual({ hasData: { apm: { hasData: false, status: 'success' }, - uptime: { hasData: undefined, status: 'success' }, + synthetics: { hasData: undefined, status: 'success' }, infra_logs: { hasData: undefined, status: 'success' }, infra_metrics: { hasData: undefined, status: 'success' }, ux: { hasData: undefined, status: 'success' }, @@ -317,8 +365,14 @@ describe('HasDataContextProvider', () => { }, { appName: 'infra_logs', hasData: async () => true }, { appName: 'infra_metrics', hasData: async () => true }, - { appName: 'uptime', hasData: async () => true }, - { appName: 'ux', hasData: async () => ({ hasData: true, serviceName: 'ux' }) }, + { + appName: 'synthetics', + hasData: async () => ({ hasData: true, indices: 'heartbeat-*, synthetics-*' }), + }, + { + appName: 'ux', + hasData: async () => ({ hasData: true, serviceName: 'ux', indices: 'apm-*' }), + }, ]); }); @@ -339,10 +393,19 @@ describe('HasDataContextProvider', () => { expect(result.current).toEqual({ hasData: { apm: { hasData: undefined, status: 'failure' }, - uptime: { hasData: true, status: 'success' }, + synthetics: { + hasData: { + hasData: true, + indices: 'heartbeat-*, synthetics-*', + }, + status: 'success', + }, infra_logs: { hasData: true, status: 'success' }, infra_metrics: { hasData: true, status: 'success' }, - ux: { hasData: { hasData: true, serviceName: 'ux' }, status: 'success' }, + ux: { + hasData: { hasData: true, serviceName: 'ux', indices: 'apm-*' }, + status: 'success', + }, alert: { hasData: [], status: 'success' }, }, hasAnyData: true, @@ -375,7 +438,7 @@ describe('HasDataContextProvider', () => { }, }, { - appName: 'uptime', + appName: 'synthetics', hasData: async () => { throw new Error('BOOMMMMM'); }, @@ -406,7 +469,7 @@ describe('HasDataContextProvider', () => { expect(result.current).toEqual({ hasData: { apm: { hasData: undefined, status: 'failure' }, - uptime: { hasData: undefined, status: 'failure' }, + synthetics: { hasData: undefined, status: 'failure' }, infra_logs: { hasData: undefined, status: 'failure' }, infra_metrics: { hasData: undefined, status: 'failure' }, ux: { hasData: undefined, status: 'failure' }, @@ -454,7 +517,7 @@ describe('HasDataContextProvider', () => { expect(result.current).toEqual({ hasData: { apm: { hasData: undefined, status: 'success' }, - uptime: { hasData: undefined, status: 'success' }, + synthetics: { hasData: undefined, status: 'success' }, infra_logs: { hasData: undefined, status: 'success' }, infra_metrics: { hasData: undefined, status: 'success' }, ux: { hasData: undefined, status: 'success' }, diff --git a/x-pack/plugins/observability/public/context/has_data_context.tsx b/x-pack/plugins/observability/public/context/has_data_context.tsx index a2628d37828a4..0b8b2b5d80a17 100644 --- a/x-pack/plugins/observability/public/context/has_data_context.tsx +++ b/x-pack/plugins/observability/public/context/has_data_context.tsx @@ -33,7 +33,7 @@ export interface HasDataContextValue { export const HasDataContext = createContext({} as HasDataContextValue); -const apps: DataContextApps[] = ['apm', 'uptime', 'infra_logs', 'infra_metrics', 'ux', 'alert']; +const apps: DataContextApps[] = ['apm', 'synthetics', 'infra_logs', 'infra_metrics', 'ux', 'alert']; export function HasDataContextProvider({ children }: { children: React.ReactNode }) { const { core } = usePluginContext(); diff --git a/x-pack/plugins/observability/public/context/plugin_context.tsx b/x-pack/plugins/observability/public/context/plugin_context.tsx index 7a6daca6e7923..eea259b36d5b9 100644 --- a/x-pack/plugins/observability/public/context/plugin_context.tsx +++ b/x-pack/plugins/observability/public/context/plugin_context.tsx @@ -8,9 +8,11 @@ import { createContext } from 'react'; import { AppMountParameters, CoreStart } from 'kibana/public'; import { ObservabilityPublicPluginsStart, ObservabilityRuleRegistry } from '../plugin'; +import { ConfigSchema } from '..'; export interface PluginContextValue { appMountParameters: AppMountParameters; + config: ConfigSchema; core: CoreStart; plugins: ObservabilityPublicPluginsStart; observabilityRuleRegistry: ObservabilityRuleRegistry; diff --git a/x-pack/plugins/observability/public/data_handler.test.ts b/x-pack/plugins/observability/public/data_handler.test.ts index bba2083aceb80..385a0c7d40c20 100644 --- a/x-pack/plugins/observability/public/data_handler.test.ts +++ b/x-pack/plugins/observability/public/data_handler.test.ts @@ -179,7 +179,7 @@ describe('registerDataHandler', () => { }); describe('Uptime', () => { registerDataHandler({ - appName: 'uptime', + appName: 'synthetics', fetchData: async () => { return { title: 'uptime', @@ -213,17 +213,17 @@ describe('registerDataHandler', () => { }, }; }, - hasData: async () => true, + hasData: async () => ({ hasData: true, indices: 'heartbeat-*,synthetics-*' }), }); it('registered data handler', () => { - const dataHandler = getDataHandler('uptime'); + const dataHandler = getDataHandler('synthetics'); expect(dataHandler?.fetchData).toBeDefined(); expect(dataHandler?.hasData).toBeDefined(); }); it('returns data when fetchData is called', async () => { - const dataHandler = getDataHandler('uptime'); + const dataHandler = getDataHandler('synthetics'); const response = await dataHandler?.fetchData(params); expect(response).toEqual({ title: 'uptime', @@ -284,7 +284,11 @@ describe('registerDataHandler', () => { }, }; }, - hasData: async () => ({ hasData: true, serviceName: 'elastic-co-frontend' }), + hasData: async () => ({ + hasData: true, + serviceName: 'elastic-co-frontend', + indices: 'apm-*', + }), }); it('registered data handler', () => { diff --git a/x-pack/plugins/observability/public/hooks/use_time_range.test.ts b/x-pack/plugins/observability/public/hooks/use_time_range.test.ts index 61505d4850dc4..43fbc18062b75 100644 --- a/x-pack/plugins/observability/public/hooks/use_time_range.test.ts +++ b/x-pack/plugins/observability/public/hooks/use_time_range.test.ts @@ -24,6 +24,7 @@ describe('useTimeRange', () => { jest.spyOn(pluginContext, 'usePluginContext').mockImplementation(() => ({ core: {} as CoreStart, appMountParameters: {} as AppMountParameters, + config: { unsafe: { alertingExperience: { enabled: true } } }, plugins: ({ data: { query: { @@ -65,6 +66,7 @@ describe('useTimeRange', () => { jest.spyOn(pluginContext, 'usePluginContext').mockImplementation(() => ({ core: {} as CoreStart, appMountParameters: {} as AppMountParameters, + config: { unsafe: { alertingExperience: { enabled: true } } }, plugins: ({ data: { query: { diff --git a/x-pack/plugins/observability/public/index.ts b/x-pack/plugins/observability/public/index.ts index ee2df9369aa39..b34b1f81467d9 100644 --- a/x-pack/plugins/observability/public/index.ts +++ b/x-pack/plugins/observability/public/index.ts @@ -21,12 +21,16 @@ export type { }; export { enableInspectEsQueries } from '../common/ui_settings_keys'; +export interface ConfigSchema { + unsafe: { alertingExperience: { enabled: boolean } }; +} + export const plugin: PluginInitializer< ObservabilityPublicSetup, ObservabilityPublicStart, ObservabilityPublicPluginsSetup, ObservabilityPublicPluginsStart -> = (context: PluginInitializerContext) => { +> = (context: PluginInitializerContext) => { return new Plugin(context); }; diff --git a/x-pack/plugins/observability/public/pages/alerts/alerts.stories.tsx b/x-pack/plugins/observability/public/pages/alerts/alerts.stories.tsx index 33eec65c40dce..6940f6aaad692 100644 --- a/x-pack/plugins/observability/public/pages/alerts/alerts.stories.tsx +++ b/x-pack/plugins/observability/public/pages/alerts/alerts.stories.tsx @@ -16,18 +16,12 @@ import { PluginContext, PluginContextValue } from '../../context/plugin_context' import { createObservabilityRuleRegistryMock } from '../../rules/observability_rule_registry_mock'; import { createCallObservabilityApi } from '../../services/call_observability_api'; import type { ObservabilityAPIReturnType } from '../../services/call_observability_api/types'; -import { AlertsFlyout } from './alerts_flyout'; -import { TopAlert } from './alerts_table'; -import { apmAlertResponseExample, dynamicIndexPattern, flyoutItemExample } from './example_data'; +import { apmAlertResponseExample, dynamicIndexPattern } from './example_data'; interface PageArgs { items: ObservabilityAPIReturnType<'GET /api/observability/rules/alerts/top'>; } -interface FlyoutArgs { - alert: TopAlert; -} - export default { title: 'app/Alerts', component: AlertsPage, @@ -95,8 +89,3 @@ export function EmptyState(_args: PageArgs) { return ; } EmptyState.args = { items: [] } as PageArgs; - -export function Flyout({ alert }: FlyoutArgs) { - return {}} />; -} -Flyout.args = { alert: flyoutItemExample } as FlyoutArgs; diff --git a/x-pack/plugins/observability/public/pages/alerts/alerts_flyout.tsx b/x-pack/plugins/observability/public/pages/alerts/alerts_flyout.tsx deleted file mode 100644 index 4b383283c4d4b..0000000000000 --- a/x-pack/plugins/observability/public/pages/alerts/alerts_flyout.tsx +++ /dev/null @@ -1,120 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. - */ - -import { - EuiFlyout, - EuiFlyoutHeader, - EuiFlyoutProps, - EuiInMemoryTable, - EuiSpacer, - EuiTabbedContent, - EuiTitle, -} from '@elastic/eui'; -import { i18n } from '@kbn/i18n'; -import React from 'react'; -import { asDuration } from '../../../common/utils/formatters'; -import { TopAlert } from './alerts_table'; - -type AlertsFlyoutProps = { alert: TopAlert } & EuiFlyoutProps; - -export function AlertsFlyout(props: AlertsFlyoutProps) { - const { onClose, alert } = props; - - const overviewListItems = [ - { - title: 'Status', - description: alert.active ? 'Active' : 'Recovered', - }, - { - title: 'Severity', - description: alert.severityLevel || '-', // TODO: badge and "(changed 2 min ago)" - }, - // { - // title: 'Affected entity', - // description: affectedEntity || '-', // TODO: link to entity - // }, - { - title: 'Triggered', - description: alert.start, // TODO: format date - }, - { - title: 'Duration', - description: asDuration(alert.duration, { extended: true }) || '-', // TODO: format duration - }, - // { - // title: 'Expected value', - // description: expectedValue || '-', - // }, - // { - // title: 'Actual value', - // description: actualValue || '-', - // }, - { - title: 'Rule type', - description: alert.ruleCategory || '-', - }, - ]; - - const tabs = [ - { - id: 'overview', - name: i18n.translate('xpack.observability.alerts.flyoutOverviewTabTitle', { - defaultMessage: 'Overview', - }), - content: ( - <> - - - {/* - -

    Severity log

    -
    - ( - <> - {item.severity} {item.message} - - ), - }, - ]} - items={severityLog ?? []} - /> */} - - ), - }, - { - id: 'metadata', - name: i18n.translate('xpack.observability.alerts.flyoutMetadataTabTitle', { - defaultMessage: 'Metadata', - }), - disabled: true, - content: <>, - }, - ]; - - return ( - - - -

    {alert.ruleName}

    -
    - -
    -
    - ); -} diff --git a/x-pack/plugins/observability/public/pages/alerts/alerts_flyout/alerts_flyout.stories.tsx b/x-pack/plugins/observability/public/pages/alerts/alerts_flyout/alerts_flyout.stories.tsx new file mode 100644 index 0000000000000..96d3c1fc9c390 --- /dev/null +++ b/x-pack/plugins/observability/public/pages/alerts/alerts_flyout/alerts_flyout.stories.tsx @@ -0,0 +1,86 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import React, { ComponentType } from 'react'; +import { KibanaContextProvider } from '../../../../../../../src/plugins/kibana_react/public'; +import { PluginContext, PluginContextValue } from '../../../context/plugin_context'; +import { TopAlert } from '../'; +import { AlertsFlyout } from './'; + +interface Args { + alert: TopAlert; +} + +export default { + title: 'app/Alerts/AlertsFlyout', + component: AlertsFlyout, + decorators: [ + (Story: ComponentType) => { + return ( + {} }, + uiSettings: { + get: (setting: string) => { + if (setting === 'dateFormat') { + return 'MMM D, YYYY @ HH:mm:ss.SSS'; + } + }, + }, + }} + > + {' '} + '' } }, + }, + } as unknown) as PluginContextValue + } + > + + + + // + ); + }, + ], +}; + +export function Example({ alert }: Args) { + return {}} />; +} +Example.args = { + alert: { + link: '/app/apm/services/opbeans-java?rangeFrom=now-15m&rangeTo=now', + reason: 'Error count for opbeans-java was above the threshold', + active: true, + start: 1618235449493, + + 'rule.id': 'apm.error_rate', + 'service.environment': 'production', + 'service.name': 'opbeans-java', + 'rule.name': 'Error count threshold | opbeans-java (smith test)', + 'kibana.rac.alert.duration.us': 61787000, + 'kibana.observability.evaluation.threshold': 0, + 'kibana.rac.alert.status': 'open', + tags: ['apm', 'service.name:opbeans-java'], + 'kibana.rac.alert.uuid': 'c50fbc70-0d77-462d-ac0a-f2bd0b8512e4', + 'rule.uuid': '474920d0-93e9-11eb-ac86-0b455460de81', + 'event.action': 'active', + '@timestamp': '2021-04-14T21:43:42.966Z', + 'kibana.rac.alert.id': 'apm.error_rate_opbeans-java_production', + 'processor.event': 'error', + 'kibana.rac.alert.start': '2021-04-14T21:42:41.179Z', + 'kibana.rac.producer': 'apm', + 'event.kind': 'state', + 'rule.category': 'Error count threshold', + 'kibana.observability.evaluation.value': 1, + }, +} as Args; diff --git a/x-pack/plugins/observability/public/pages/alerts/alerts_flyout/index.tsx b/x-pack/plugins/observability/public/pages/alerts/alerts_flyout/index.tsx new file mode 100644 index 0000000000000..892274b2fb8b0 --- /dev/null +++ b/x-pack/plugins/observability/public/pages/alerts/alerts_flyout/index.tsx @@ -0,0 +1,126 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import { + EuiButton, + EuiDescriptionList, + EuiFlexGroup, + EuiFlexItem, + EuiFlyout, + EuiFlyoutBody, + EuiFlyoutFooter, + EuiFlyoutHeader, + EuiFlyoutProps, + EuiSpacer, + EuiTabbedContent, + EuiText, + EuiTitle, +} from '@elastic/eui'; +import { i18n } from '@kbn/i18n'; +import moment from 'moment-timezone'; +import React from 'react'; +import { useUiSetting } from '../../../../../../../src/plugins/kibana_react/public'; +import { asDuration } from '../../../../common/utils/formatters'; +import { usePluginContext } from '../../../hooks/use_plugin_context'; +import { TopAlert } from '../'; +import { SeverityBadge } from '../severity_badge'; + +type AlertsFlyoutProps = { alert: TopAlert } & EuiFlyoutProps; + +export function AlertsFlyout({ onClose, alert }: AlertsFlyoutProps) { + const dateFormat = useUiSetting('dateFormat'); + const { core } = usePluginContext(); + const { prepend } = core.http.basePath; + + const overviewListItems = [ + { + title: i18n.translate('xpack.observability.alertsFlyout.statusLabel', { + defaultMessage: 'Status', + }), + description: alert.active ? 'Active' : 'Recovered', + }, + { + title: i18n.translate('xpack.observability.alertsFlyout.severityLabel', { + defaultMessage: 'Severity', + }), + description: , + }, + { + title: i18n.translate('xpack.observability.alertsFlyout.triggeredLabel', { + defaultMessage: 'Triggered', + }), + description: ( + {moment(alert.start).format(dateFormat)} + ), + }, + { + title: i18n.translate('xpack.observability.alertsFlyout.durationLabel', { + defaultMessage: 'Duration', + }), + description: asDuration(alert['kibana.rac.alert.duration.us'], { extended: true }), + }, + { + title: i18n.translate('xpack.observability.alertsFlyout.expectedValueLabel', { + defaultMessage: 'Expected value', + }), + description: alert['kibana.observability.evaluation.threshold'] ?? '-', + }, + { + title: i18n.translate('xpack.observability.alertsFlyout.actualValueLabel', { + defaultMessage: 'Actual value', + }), + description: alert['kibana.observability.evaluation.value'] ?? '-', + }, + { + title: i18n.translate('xpack.observability.alertsFlyout.ruleTypeLabel', { + defaultMessage: 'Rule type', + }), + description: alert['rule.category'] ?? '-', + }, + ]; + + const tabs = [ + { + id: 'overview', + name: i18n.translate('xpack.observability.alerts.flyoutOverviewTabTitle', { + defaultMessage: 'Overview', + }), + content: ( + <> + + + + ), + }, + ]; + + return ( + + + +

    {alert['rule.name']}

    +
    + + {alert.reason} +
    + + + + {alert.link && ( + + + + + View in app + + + + + )} +
    + ); +} diff --git a/x-pack/plugins/observability/public/pages/alerts/alerts_search_bar.tsx b/x-pack/plugins/observability/public/pages/alerts/alerts_search_bar.tsx index 97595b456d503..c0a08fa7faac7 100644 --- a/x-pack/plugins/observability/public/pages/alerts/alerts_search_bar.tsx +++ b/x-pack/plugins/observability/public/pages/alerts/alerts_search_bar.tsx @@ -6,7 +6,7 @@ */ import { i18n } from '@kbn/i18n'; -import React, { useMemo } from 'react'; +import React, { useMemo, useState } from 'react'; import { SearchBar, TimeHistory } from '../../../../../../src/plugins/data/public'; import { Storage } from '../../../../../../src/plugins/kibana_utils/public'; import { useFetcher } from '../../hooks/use_fetcher'; @@ -29,6 +29,7 @@ export function AlertsSearchBar({ const timeHistory = useMemo(() => { return new TimeHistory(new Storage(localStorage)); }, []); + const [queryLanguage, setQueryLanguage] = useState<'lucene' | 'kuery'>('kuery'); const { data: dynamicIndexPattern } = useFetcher(({ signal }) => { return callObservabilityApi({ @@ -43,7 +44,7 @@ export function AlertsSearchBar({ placeholder={i18n.translate('xpack.observability.alerts.searchBarPlaceholder', { defaultMessage: '"domain": "ecommerce" AND ("service.name": "ProductCatalogService" …)', })} - query={{ query: query ?? '', language: 'kuery' }} + query={{ query: query ?? '', language: queryLanguage }} timeHistory={timeHistory} dateRangeFrom={rangeFrom} dateRangeTo={rangeTo} @@ -55,6 +56,7 @@ export function AlertsSearchBar({ dateRange, query: typeof nextQuery?.query === 'string' ? nextQuery.query : '', }); + setQueryLanguage((nextQuery?.language || 'kuery') as 'kuery' | 'lucene'); }} /> ); diff --git a/x-pack/plugins/observability/public/pages/alerts/alerts_table.tsx b/x-pack/plugins/observability/public/pages/alerts/alerts_table.tsx index 0985597cc4b69..b0ff156fde377 100644 --- a/x-pack/plugins/observability/public/pages/alerts/alerts_table.tsx +++ b/x-pack/plugins/observability/public/pages/alerts/alerts_table.tsx @@ -6,31 +6,22 @@ */ import { + CustomItemAction, EuiBasicTable, EuiBasicTableColumn, EuiBasicTableProps, - DefaultItemAction, - EuiTableSelectionType, + EuiButton, + EuiIconTip, EuiLink, - EuiBadge, } from '@elastic/eui'; import { i18n } from '@kbn/i18n'; import React, { useState } from 'react'; import { asDuration } from '../../../common/utils/formatters'; import { TimestampTooltip } from '../../components/shared/timestamp_tooltip'; import { usePluginContext } from '../../hooks/use_plugin_context'; +import type { TopAlert } from './'; import { AlertsFlyout } from './alerts_flyout'; - -export interface TopAlert { - start: number; - duration: number; - reason: string; - link?: string; - severityLevel?: string; - active: boolean; - ruleName: string; - ruleCategory: string; -} +import { SeverityBadge } from './severity_badge'; type AlertsTableProps = Omit< EuiBasicTableProps, @@ -43,13 +34,18 @@ export function AlertsTable(props: AlertsTableProps) { const { core } = usePluginContext(); const { prepend } = core.http.basePath; - const actions: Array> = [ + const actions: Array> = [ { - name: 'Alert details', - description: 'Alert details', - onClick: (item) => { - setFlyoutAlert(item); - }, + render: (alert) => + alert.link ? ( + + {i18n.translate('xpack.observability.alertsTable.viewInAppButtonLabel', { + defaultMessage: 'View in app', + })} + + ) : ( + <> + ), isPrimary: true, }, ]; @@ -57,54 +53,76 @@ export function AlertsTable(props: AlertsTableProps) { const columns: Array> = [ { field: 'active', - name: 'Status', - width: '112px', - render: (_, { active }) => { - const style = { - width: '96px', - textAlign: 'center' as const, - }; + name: i18n.translate('xpack.observability.alertsTable.statusColumnDescription', { + defaultMessage: 'Status', + }), + align: 'center', + render: (_, alert) => { + const { active } = alert; return active ? ( - - {i18n.translate('xpack.observability.alertsTable.status.active', { + + color="danger" + type="alert" + /> ) : ( - - {i18n.translate('xpack.observability.alertsTable.status.recovered', { + + type="check" + /> ); }, }, { field: 'start', - name: 'Triggered', + name: i18n.translate('xpack.observability.alertsTable.triggeredColumnDescription', { + defaultMessage: 'Triggered', + }), render: (_, item) => { return ; }, }, { field: 'duration', - name: 'Duration', - render: (_, { duration, active }) => { - return active ? null : asDuration(duration, { extended: true }); + name: i18n.translate('xpack.observability.alertsTable.durationColumnDescription', { + defaultMessage: 'Duration', + }), + render: (_, alert) => { + const { active } = alert; + return active + ? null + : asDuration(alert['kibana.rac.alert.duration.us'], { extended: true }); + }, + }, + { + field: 'severity', + name: i18n.translate('xpack.observability.alertsTable.severityColumnDescription', { + defaultMessage: 'Severity', + }), + render: (_, alert) => { + return ; }, }, { field: 'reason', - name: 'Reason', + name: i18n.translate('xpack.observability.alertsTable.reasonColumnDescription', { + defaultMessage: 'Reason', + }), dataType: 'string', render: (_, item) => { - return item.link ? {item.reason} : item.reason; + return setFlyoutAlert(item)}>{item.reason}; }, }, { actions, - name: 'Actions', + name: i18n.translate('xpack.observability.alertsTable.actionsColumnDescription', { + defaultMessage: 'Actions', + }), }, ]; @@ -113,8 +131,6 @@ export function AlertsTable(props: AlertsTableProps) { {flyoutAlert && } {...props} - isSelectable={true} - selection={{} as EuiTableSelectionType} columns={columns} tableLayout="auto" pagination={{ pageIndex: 0, pageSize: 0, totalItemCount: 0 }} diff --git a/x-pack/plugins/observability/public/pages/alerts/example_data.ts b/x-pack/plugins/observability/public/pages/alerts/example_data.ts index 860c8d059f00d..dba6f1e9aaa2f 100644 --- a/x-pack/plugins/observability/public/pages/alerts/example_data.ts +++ b/x-pack/plugins/observability/public/pages/alerts/example_data.ts @@ -12,6 +12,7 @@ export const apmAlertResponseExample = [ 'rule.name': 'Error count threshold | opbeans-java (smith test)', 'kibana.rac.alert.duration.us': 180057000, 'kibana.rac.alert.status': 'open', + 'kibana.rac.alert.severity.level': 'warning', tags: ['apm', 'service.name:opbeans-java'], 'kibana.rac.alert.uuid': '0175ec0a-a3b1-4d41-b557-e21c2d024352', 'rule.uuid': '474920d0-93e9-11eb-ac86-0b455460de81', @@ -47,16 +48,6 @@ export const apmAlertResponseExample = [ }, ]; -export const flyoutItemExample = { - link: '/app/apm/services/opbeans-java?rangeFrom=now-15m&rangeTo=now', - reason: 'Error count for opbeans-java was above the threshold', - active: true, - start: 1618235449493, - duration: 180057000, - ruleCategory: 'Error count threshold', - ruleName: 'Error count threshold | opbeans-java (smith test)', -}; - export const dynamicIndexPattern = { fields: [ { diff --git a/x-pack/plugins/observability/public/pages/alerts/index.tsx b/x-pack/plugins/observability/public/pages/alerts/index.tsx index aa5fb2c32ea11..76e5d62369029 100644 --- a/x-pack/plugins/observability/public/pages/alerts/index.tsx +++ b/x-pack/plugins/observability/public/pages/alerts/index.tsx @@ -18,6 +18,7 @@ import { i18n } from '@kbn/i18n'; import React from 'react'; import { useHistory } from 'react-router-dom'; import { format, parse } from 'url'; +import type { ObservabilityAPIReturnType } from '../../services/call_observability_api/types'; import { ExperimentalBadge } from '../../components/shared/experimental_badge'; import { useFetcher } from '../../hooks/use_fetcher'; import { usePluginContext } from '../../hooks/use_plugin_context'; @@ -28,6 +29,15 @@ import { asDuration, asPercent } from '../../../common/utils/formatters'; import { AlertsSearchBar } from './alerts_search_bar'; import { AlertsTable } from './alerts_table'; +export type TopAlertResponse = ObservabilityAPIReturnType<'GET /api/observability/rules/alerts/top'>[number]; + +export interface TopAlert extends TopAlertResponse { + start: number; + reason: string; + link?: string; + active: boolean; +} + interface AlertsPageProps { routeParams: RouteParams<'/alerts'>; } @@ -75,6 +85,7 @@ export function AlertsPage({ routeParams }: AlertsPageProps) { const parsedLink = formatted.link ? parse(formatted.link, true) : undefined; return { + ...alert, ...formatted, link: parsedLink ? format({ @@ -87,11 +98,7 @@ export function AlertsPage({ routeParams }: AlertsPageProps) { }) : undefined, active: alert['event.action'] !== 'close', - severityLevel: alert['kibana.rac.alert.severity.level'], start: new Date(alert['kibana.rac.alert.start']).getTime(), - duration: alert['kibana.rac.alert.duration.us'], - ruleCategory: alert['rule.category'], - ruleName: alert['rule.name'], }; }); }); diff --git a/x-pack/plugins/observability/public/pages/alerts/severity_badge.stories.tsx b/x-pack/plugins/observability/public/pages/alerts/severity_badge.stories.tsx new file mode 100644 index 0000000000000..3f7357fe607e6 --- /dev/null +++ b/x-pack/plugins/observability/public/pages/alerts/severity_badge.stories.tsx @@ -0,0 +1,21 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import React, { ComponentProps } from 'react'; +import { SeverityBadge } from './severity_badge'; + +type Args = ComponentProps; + +export default { + title: 'app/Alerts/SeverityBadge', + component: SeverityBadge, +}; + +export function Example({ severityLevel }: Args) { + return ; +} +Example.args = { severityLevel: 'critical' } as Args; diff --git a/x-pack/plugins/observability/public/pages/alerts/severity_badge.tsx b/x-pack/plugins/observability/public/pages/alerts/severity_badge.tsx new file mode 100644 index 0000000000000..931b9396f912a --- /dev/null +++ b/x-pack/plugins/observability/public/pages/alerts/severity_badge.tsx @@ -0,0 +1,30 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import { EuiBadge } from '@elastic/eui'; +import { i18n } from '@kbn/i18n'; +import React from 'react'; + +export interface SeverityBadgeProps { + severityLevel?: string; +} + +const colorMap: { [key: string]: string } = { + critical: 'danger', + warning: 'warning', +}; + +export function SeverityBadge({ severityLevel }: SeverityBadgeProps) { + return ( + + {severityLevel ?? + i18n.translate('xpack.observability.severityBadge.unknownDescription', { + defaultMessage: 'unknown', + })} + + ); +} diff --git a/x-pack/plugins/observability/public/pages/home/section.ts b/x-pack/plugins/observability/public/pages/home/section.ts index e374f1d3cc2a9..31c70823127e0 100644 --- a/x-pack/plugins/observability/public/pages/home/section.ts +++ b/x-pack/plugins/observability/public/pages/home/section.ts @@ -46,7 +46,7 @@ export const appsSection: ISection[] = [ href: 'https://www.elastic.co', }, { - id: 'uptime', + id: 'synthetics', title: i18n.translate('xpack.observability.section.apps.uptime.title', { defaultMessage: 'Uptime', }), diff --git a/x-pack/plugins/observability/public/pages/overview/empty_section.ts b/x-pack/plugins/observability/public/pages/overview/empty_section.ts index 077978b7ad0e7..40b1157b29e35 100644 --- a/x-pack/plugins/observability/public/pages/overview/empty_section.ts +++ b/x-pack/plugins/observability/public/pages/overview/empty_section.ts @@ -57,7 +57,7 @@ export const getEmptySections = ({ core }: { core: CoreStart }): ISection[] => { href: core.http.basePath.prepend('/app/home#/tutorial_directory/metrics'), }, { - id: 'uptime', + id: 'synthetics', title: i18n.translate('xpack.observability.emptySection.apps.uptime.title', { defaultMessage: 'Uptime', }), diff --git a/x-pack/plugins/observability/public/pages/overview/overview.stories.tsx b/x-pack/plugins/observability/public/pages/overview/overview.stories.tsx index 6fc573b11109a..559aa8d5884a9 100644 --- a/x-pack/plugins/observability/public/pages/overview/overview.stories.tsx +++ b/x-pack/plugins/observability/public/pages/overview/overview.stories.tsx @@ -29,7 +29,7 @@ function unregisterAll() { unregisterDataHandler({ appName: 'apm' }); unregisterDataHandler({ appName: 'infra_logs' }); unregisterDataHandler({ appName: 'infra_metrics' }); - unregisterDataHandler({ appName: 'uptime' }); + unregisterDataHandler({ appName: 'synthetics' }); } const withCore = makeDecorator({ @@ -45,6 +45,7 @@ const withCore = makeDecorator({ appMountParameters: ({ setHeaderActionMenu: () => {}, } as unknown) as AppMountParameters, + config: { unsafe: { alertingExperience: { enabled: true } } }, core: options as CoreStart, plugins: ({ data: { @@ -187,9 +188,9 @@ storiesOf('app/Overview', module) hasData: async () => false, }); registerDataHandler({ - appName: 'uptime', + appName: 'synthetics', fetchData: fetchUptimeData, - hasData: async () => false, + hasData: async () => ({ hasData: false, indices: 'heartbeat-*,synthetics-*' }), }); return ; @@ -299,9 +300,9 @@ storiesOf('app/Overview', module) hasData: async () => true, }); registerDataHandler({ - appName: 'uptime', + appName: 'synthetics', fetchData: fetchUptimeData, - hasData: async () => true, + hasData: async () => ({ hasData: true, indices: 'heartbeat-*,synthetics-*' }), }); return ( @@ -331,9 +332,9 @@ storiesOf('app/Overview', module) hasData: async () => true, }); registerDataHandler({ - appName: 'uptime', + appName: 'synthetics', fetchData: fetchUptimeData, - hasData: async () => true, + hasData: async () => ({ hasData: true, indices: 'heartbeat-*,synthetics-*' }), }); return ( @@ -365,9 +366,9 @@ storiesOf('app/Overview', module) hasData: async () => true, }); registerDataHandler({ - appName: 'uptime', + appName: 'synthetics', fetchData: fetchUptimeData, - hasData: async () => true, + hasData: async () => ({ hasData: true, indices: 'heartbeat-*,synthetics-*' }), }); return ( true, }); registerDataHandler({ - appName: 'uptime', + appName: 'synthetics', fetchData: async () => emptyUptimeResponse, - hasData: async () => true, + hasData: async () => ({ hasData: true, indices: 'heartbeat-*,synthetics-*' }), }); return ( @@ -434,11 +435,11 @@ storiesOf('app/Overview', module) hasData: async () => true, }); registerDataHandler({ - appName: 'uptime', + appName: 'synthetics', fetchData: async () => { throw new Error('Error fetching Uptime data'); }, - hasData: async () => true, + hasData: async () => ({ hasData: true, indices: 'heartbeat-*,synthetics-*' }), }); return ( { throw new Error('Error has data'); }, @@ -464,7 +465,7 @@ storiesOf('app/Overview', module) registerDataHandler({ appName: 'infra_logs', fetchData: fetchLogsData, - // @ts-ignore thows an error instead + // @ts-ignore throws an error instead hasData: async () => { throw new Error('Error has data'); }, @@ -472,15 +473,15 @@ storiesOf('app/Overview', module) registerDataHandler({ appName: 'infra_metrics', fetchData: fetchMetricsData, - // @ts-ignore thows an error instead + // @ts-ignore throws an error instead hasData: async () => { throw new Error('Error has data'); }, }); registerDataHandler({ - appName: 'uptime', + appName: 'synthetics', fetchData: fetchUptimeData, - // @ts-ignore thows an error instead + // @ts-ignore throws an error instead hasData: async () => { throw new Error('Error has data'); }, @@ -499,7 +500,7 @@ storiesOf('app/Overview', module) registerDataHandler({ appName: 'apm', fetchData: fetchApmData, - // @ts-ignore thows an error instead + // @ts-ignore throws an error instead hasData: async () => { throw new Error('Error has data'); }, @@ -507,7 +508,7 @@ storiesOf('app/Overview', module) registerDataHandler({ appName: 'infra_logs', fetchData: fetchLogsData, - // @ts-ignore thows an error instead + // @ts-ignore throws an error instead hasData: async () => { throw new Error('Error has data'); }, @@ -515,15 +516,15 @@ storiesOf('app/Overview', module) registerDataHandler({ appName: 'infra_metrics', fetchData: fetchMetricsData, - // @ts-ignore thows an error instead + // @ts-ignore throws an error instead hasData: async () => { throw new Error('Error has data'); }, }); registerDataHandler({ - appName: 'uptime', + appName: 'synthetics', fetchData: fetchUptimeData, - // @ts-ignore thows an error instead + // @ts-ignore throws an error instead hasData: async () => { throw new Error('Error has data'); }, diff --git a/x-pack/plugins/observability/public/plugin.ts b/x-pack/plugins/observability/public/plugin.ts index 1f56bdebbbb9b..517675fe1d525 100644 --- a/x-pack/plugins/observability/public/plugin.ts +++ b/x-pack/plugins/observability/public/plugin.ts @@ -32,6 +32,7 @@ import { registerDataHandler } from './data_handler'; import { FormatterRuleRegistry } from './rules/formatter_rule_registry'; import { createCallObservabilityApi } from './services/call_observability_api'; import { toggleOverviewLinkInNav } from './toggle_overview_link_in_nav'; +import { ConfigSchema } from '.'; export type ObservabilityPublicSetup = ReturnType; export type ObservabilityRuleRegistry = ObservabilityPublicSetup['ruleRegistry']; @@ -60,7 +61,9 @@ export class Plugin > { private readonly appUpdater$ = new BehaviorSubject(() => ({})); - constructor(context: PluginInitializerContext) {} + constructor(private readonly initializerContext: PluginInitializerContext) { + this.initializerContext = initializerContext; + } public setup( coreSetup: CoreSetup, @@ -68,6 +71,7 @@ export class Plugin ) { const category = DEFAULT_APP_CATEGORIES.observability; const euiIconType = 'logoObservability'; + const config = this.initializerContext.config.get(); createCallObservabilityApi(coreSetup.http); @@ -84,6 +88,7 @@ export class Plugin const [coreStart, pluginsStart] = await coreSetup.getStartServices(); return renderApp({ + config, core: coreStart, plugins: pluginsStart, appMountParameters: params, @@ -104,7 +109,7 @@ export class Plugin updater$, }); - if (coreSetup.uiSettings.get('observability:enableAlertingExperience')) { + if (config.unsafe.alertingExperience.enabled) { coreSetup.application.register({ id: 'observability-alerts', title: 'Alerts', @@ -161,6 +166,7 @@ export class Plugin return { dashboard: { register: registerDataHandler }, ruleRegistry: observabilityRuleRegistry, + isAlertingExperienceEnabled: () => config.unsafe.alertingExperience.enabled, }; } public start({ application }: CoreStart) { diff --git a/x-pack/plugins/observability/public/rules/observability_rule_registry_mock.ts b/x-pack/plugins/observability/public/rules/observability_rule_registry_mock.ts index 939e3a3608f8b..389b581b5fb60 100644 --- a/x-pack/plugins/observability/public/rules/observability_rule_registry_mock.ts +++ b/x-pack/plugins/observability/public/rules/observability_rule_registry_mock.ts @@ -9,7 +9,7 @@ import { ObservabilityRuleRegistry } from '../plugin'; const createRuleRegistryMock = () => ({ registerType: () => {}, - getTypeByRuleId: () => {}, + getTypeByRuleId: () => ({ format: () => ({ link: '/test/example' }) }), create: () => createRuleRegistryMock(), }); diff --git a/x-pack/plugins/observability/public/typings/fetch_overview_data/index.ts b/x-pack/plugins/observability/public/typings/fetch_overview_data/index.ts index ae3e2eb8c270d..6b69aa9888cf6 100644 --- a/x-pack/plugins/observability/public/typings/fetch_overview_data/index.ts +++ b/x-pack/plugins/observability/public/typings/fetch_overview_data/index.ts @@ -32,8 +32,12 @@ export interface HasDataParams { absoluteTime: { start: number; end: number }; } -export interface UXHasDataResponse { +export interface HasDataResponse { hasData: boolean; + indices: string; +} + +export interface UXHasDataResponse extends HasDataResponse { serviceName: string | number | undefined; } @@ -47,7 +51,7 @@ export type HasData = ( export type ObservabilityFetchDataPlugins = Exclude< ObservabilityApp, - 'observability-overview' | 'stack_monitoring' + 'observability-overview' | 'stack_monitoring' | 'uptime' | 'fleet' >; export interface DataHandler< @@ -126,7 +130,6 @@ export interface ObservabilityFetchDataResponse { infra_metrics: MetricsFetchDataResponse; infra_logs: LogsFetchDataResponse; synthetics: UptimeFetchDataResponse; - uptime: UptimeFetchDataResponse; ux: UxFetchDataResponse; } @@ -134,7 +137,6 @@ export interface ObservabilityHasDataResponse { apm: boolean; infra_metrics: boolean; infra_logs: boolean; - uptime: boolean; - synthetics: boolean; + synthetics: HasDataResponse; ux: UXHasDataResponse; } diff --git a/x-pack/plugins/observability/public/utils/observability_index_patterns.ts b/x-pack/plugins/observability/public/utils/observability_index_patterns.ts deleted file mode 100644 index b23a246105544..0000000000000 --- a/x-pack/plugins/observability/public/utils/observability_index_patterns.ts +++ /dev/null @@ -1,64 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. - */ - -import { DataPublicPluginStart, IndexPattern } from '../../../../../src/plugins/data/public'; - -export type DataType = 'synthetics' | 'apm' | 'logs' | 'metrics' | 'rum'; - -const indexPatternList: Record = { - synthetics: 'synthetics_static_index_pattern_id', - apm: 'apm_static_index_pattern_id', - rum: 'apm_static_index_pattern_id', - logs: 'logs_static_index_pattern_id', - metrics: 'metrics_static_index_pattern_id', -}; - -const appToPatternMap: Record = { - synthetics: 'heartbeat-*', - apm: 'apm-*', - rum: 'apm-*', - logs: 'logs-*,filebeat-*', - metrics: 'metrics-*,metricbeat-*', -}; - -export class ObservabilityIndexPatterns { - data?: DataPublicPluginStart; - - constructor(data: DataPublicPluginStart) { - this.data = data; - } - - async createIndexPattern(app: DataType) { - if (!this.data) { - throw new Error('data is not defined'); - } - - const pattern = appToPatternMap[app]; - - const fields = await this.data.indexPatterns.getFieldsForWildcard({ - pattern, - }); - - return await this.data.indexPatterns.createAndSave({ - fields, - title: pattern, - id: indexPatternList[app], - timeFieldName: '@timestamp', - }); - } - - async getIndexPattern(app: DataType): Promise { - if (!this.data) { - throw new Error('data is not defined'); - } - try { - return await this.data?.indexPatterns.get(indexPatternList[app]); - } catch (e) { - return await this.createIndexPattern(app || 'apm'); - } - } -} diff --git a/x-pack/plugins/observability/public/utils/test_helper.tsx b/x-pack/plugins/observability/public/utils/test_helper.tsx index 97916b414330f..63e34b018aed0 100644 --- a/x-pack/plugins/observability/public/utils/test_helper.tsx +++ b/x-pack/plugins/observability/public/utils/test_helper.tsx @@ -31,6 +31,8 @@ export const core = ({ }, } as unknown) as CoreStart; +const config = { unsafe: { alertingExperience: { enabled: true } } }; + const plugins = ({ data: { query: { timefilter: { timefilter: { setTime: jest.fn() } } } }, } as unknown) as ObservabilityPublicPluginsStart; @@ -42,7 +44,7 @@ export const render = (component: React.ReactNode) => { {component} diff --git a/x-pack/plugins/observability/server/index.ts b/x-pack/plugins/observability/server/index.ts index 6785436042f97..ec471df164fe1 100644 --- a/x-pack/plugins/observability/server/index.ts +++ b/x-pack/plugins/observability/server/index.ts @@ -16,12 +16,18 @@ export { rangeQuery, kqlQuery } from './utils/queries'; export * from './types'; export const config = { + exposeToBrowser: { + unsafe: { alertingExperience: { enabled: true } }, + }, schema: schema.object({ enabled: schema.boolean({ defaultValue: true }), annotations: schema.object({ enabled: schema.boolean({ defaultValue: true }), index: schema.string({ defaultValue: 'observability-annotations' }), }), + unsafe: schema.object({ + alertingExperience: schema.object({ enabled: schema.boolean({ defaultValue: false }) }), + }), }), }; diff --git a/x-pack/plugins/observability/server/routes/rules.ts b/x-pack/plugins/observability/server/routes/rules.ts index 10f2f50886f07..cd3f4976e0af3 100644 --- a/x-pack/plugins/observability/server/routes/rules.ts +++ b/x-pack/plugins/observability/server/routes/rules.ts @@ -35,7 +35,7 @@ const alertsListRoute = createObservabilityServerRoute({ }); if (!ruleRegistryClient) { - throw Boom.failedDependency(); + throw Boom.failedDependency('xpack.ruleRegistry.unsafe.write.enabled is set to false'); } const { diff --git a/x-pack/plugins/observability/server/ui_settings.ts b/x-pack/plugins/observability/server/ui_settings.ts index 43041280d0282..46ae106efe6bc 100644 --- a/x-pack/plugins/observability/server/ui_settings.ts +++ b/x-pack/plugins/observability/server/ui_settings.ts @@ -8,27 +8,12 @@ import { schema } from '@kbn/config-schema'; import { i18n } from '@kbn/i18n'; import { UiSettingsParams } from '../../../../src/core/types'; -import { enableAlertingExperience, enableInspectEsQueries } from '../common/ui_settings_keys'; +import { enableInspectEsQueries } from '../common/ui_settings_keys'; /** * uiSettings definitions for Observability. */ export const uiSettings: Record> = { - [enableAlertingExperience]: { - category: ['observability'], - name: i18n.translate('xpack.observability.enableAlertingExperienceExperimentName', { - defaultMessage: 'Observability alerting experience', - }), - value: false, - description: i18n.translate( - 'xpack.observability.enableAlertingExperienceExperimentDescription', - { - defaultMessage: - 'Enable the experimental alerting experience for Observability. Adds the Alerts and Cases pages.', - } - ), - schema: schema.boolean(), - }, [enableInspectEsQueries]: { category: ['observability'], name: i18n.translate('xpack.observability.enableInspectEsQueriesExperimentName', { diff --git a/x-pack/plugins/observability/typings/common.ts b/x-pack/plugins/observability/typings/common.ts index 81477d0a7f815..d6209c737a468 100644 --- a/x-pack/plugins/observability/typings/common.ts +++ b/x-pack/plugins/observability/typings/common.ts @@ -14,7 +14,8 @@ export type ObservabilityApp = | 'synthetics' | 'observability-overview' | 'stack_monitoring' - | 'ux'; + | 'ux' + | 'fleet'; export type PromiseReturnType = Func extends (...args: any[]) => Promise ? Value diff --git a/x-pack/plugins/osquery/common/constants.ts b/x-pack/plugins/osquery/common/constants.ts index 794ac5004c9f1..5354332fd89f8 100644 --- a/x-pack/plugins/osquery/common/constants.ts +++ b/x-pack/plugins/osquery/common/constants.ts @@ -7,3 +7,5 @@ export const DEFAULT_MAX_TABLE_QUERY_SIZE = 10000; export const DEFAULT_DARK_MODE = 'theme:darkMode'; +export const OSQUERY_INTEGRATION_NAME = 'osquery_manager'; +export const BASE_PATH = '/app/osquery'; diff --git a/x-pack/plugins/osquery/kibana.json b/x-pack/plugins/osquery/kibana.json index fea20d9fb3cb5..17d74b124f45b 100644 --- a/x-pack/plugins/osquery/kibana.json +++ b/x-pack/plugins/osquery/kibana.json @@ -20,6 +20,8 @@ "actions", "data", "dataEnhanced", + "discover", + "features", "fleet", "navigation", "triggersActionsUi" diff --git a/x-pack/plugins/osquery/public/action_results/action_results_summary.tsx b/x-pack/plugins/osquery/public/action_results/action_results_summary.tsx new file mode 100644 index 0000000000000..9542286c860f2 --- /dev/null +++ b/x-pack/plugins/osquery/public/action_results/action_results_summary.tsx @@ -0,0 +1,239 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +/* eslint-disable @typescript-eslint/no-unused-vars */ + +import { i18n } from '@kbn/i18n'; +import { + EuiLink, + EuiFlexGroup, + EuiFlexItem, + EuiCard, + EuiTextColor, + EuiSpacer, + EuiDescriptionList, + EuiInMemoryTable, + EuiCodeBlock, +} from '@elastic/eui'; +import React, { useCallback, useMemo, useState } from 'react'; + +import { pagePathGetters } from '../../../fleet/public'; +import { useActionResults } from './use_action_results'; +import { useAllResults } from '../results/use_all_results'; +import { Direction } from '../../common/search_strategy'; +import { useKibana } from '../common/lib/kibana'; + +interface ActionResultsSummaryProps { + actionId: string; + agentIds?: string[]; + isLive?: boolean; +} + +const renderErrorMessage = (error: string) => ( + + {error} + +); + +const ActionResultsSummaryComponent: React.FC = ({ + actionId, + agentIds, + isLive, +}) => { + const getUrlForApp = useKibana().services.application.getUrlForApp; + // @ts-expect-error update types + const [pageIndex, setPageIndex] = useState(0); + // @ts-expect-error update types + const [pageSize, setPageSize] = useState(50); + const { + // @ts-expect-error update types + data: { aggregations, edges }, + } = useActionResults({ + actionId, + activePage: pageIndex, + agentIds, + limit: pageSize, + direction: Direction.asc, + sortField: '@timestamp', + isLive, + }); + + const { data: logsResults } = useAllResults({ + actionId, + activePage: pageIndex, + limit: pageSize, + direction: Direction.asc, + sortField: '@timestamp', + isLive, + }); + + const notRespondedCount = useMemo(() => { + if (!agentIds || !aggregations.totalResponded) { + return '-'; + } + + return agentIds.length - aggregations.totalResponded; + }, [aggregations.totalResponded, agentIds]); + + const listItems = useMemo( + () => [ + { + title: i18n.translate( + 'xpack.osquery.liveQueryActionResults.summary.agentsQueriedLabelText', + { + defaultMessage: 'Agents queried', + } + ), + description: agentIds?.length, + }, + { + title: i18n.translate('xpack.osquery.liveQueryActionResults.summary.successfulLabelText', { + defaultMessage: 'Successful', + }), + description: aggregations.successful, + }, + { + title: i18n.translate('xpack.osquery.liveQueryActionResults.summary.pendingLabelText', { + defaultMessage: 'Not yet responded', + }), + description: notRespondedCount, + }, + { + title: i18n.translate('xpack.osquery.liveQueryActionResults.summary.failedLabelText', { + defaultMessage: 'Failed', + }), + description: ( + + {aggregations.failed} + + ), + }, + ], + [agentIds, aggregations.failed, aggregations.successful, notRespondedCount] + ); + + const renderAgentIdColumn = useCallback( + (agentId) => ( + + {agentId} + + ), + [getUrlForApp] + ); + + const renderRowsColumn = useCallback( + (_, item) => { + if (!logsResults) return '-'; + const agentId = item.fields.agent_id[0]; + + return ( + // @ts-expect-error update types + logsResults?.rawResponse?.aggregations?.count_by_agent_id?.buckets?.find( + // @ts-expect-error update types + (bucket) => bucket.key === agentId + )?.doc_count ?? '-' + ); + }, + [logsResults] + ); + + const renderStatusColumn = useCallback((_, item) => { + if (!item.fields.completed_at) { + return i18n.translate('xpack.osquery.liveQueryActionResults.table.pendingStatusText', { + defaultMessage: 'pending', + }); + } + + if (item.fields['error.keyword']) { + return i18n.translate('xpack.osquery.liveQueryActionResults.table.errorStatusText', { + defaultMessage: 'error', + }); + } + + return i18n.translate('xpack.osquery.liveQueryActionResults.table.successStatusText', { + defaultMessage: 'success', + }); + }, []); + + const columns = useMemo( + () => [ + { + field: 'status', + name: i18n.translate('xpack.osquery.liveQueryActionResults.table.statusColumnTitle', { + defaultMessage: 'Status', + }), + render: renderStatusColumn, + }, + { + field: 'fields.agent_id[0]', + name: i18n.translate('xpack.osquery.liveQueryActionResults.table.agentIdColumnTitle', { + defaultMessage: 'Agent Id', + }), + truncateText: true, + render: renderAgentIdColumn, + }, + { + field: 'fields.rows[0]', + name: i18n.translate( + 'xpack.osquery.liveQueryActionResults.table.resultRowsNumberColumnTitle', + { + defaultMessage: 'Number of result rows', + } + ), + render: renderRowsColumn, + }, + { + field: 'fields.error[0]', + name: i18n.translate('xpack.osquery.liveQueryActionResults.table.errorColumnTitle', { + defaultMessage: 'Error', + }), + render: renderErrorMessage, + }, + ], + [renderAgentIdColumn, renderRowsColumn, renderStatusColumn] + ); + + const pagination = useMemo( + () => ({ + initialPageSize: 20, + pageSizeOptions: [10, 20, 50, 100], + }), + [] + ); + + return ( + <> + + + + + + + + + {edges.length ? ( + <> + + + + ) : null} + + ); +}; + +export const ActionResultsSummary = React.memo(ActionResultsSummaryComponent); diff --git a/x-pack/plugins/osquery/public/action_results/action_results_table.tsx b/x-pack/plugins/osquery/public/action_results/action_results_table.tsx deleted file mode 100644 index 660b837da6d93..0000000000000 --- a/x-pack/plugins/osquery/public/action_results/action_results_table.tsx +++ /dev/null @@ -1,196 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. - */ - -import { find, map } from 'lodash/fp'; -import { - EuiDataGrid, - EuiDataGridProps, - EuiDataGridColumn, - EuiDataGridSorting, - EuiHealth, - EuiIcon, - EuiLink, -} from '@elastic/eui'; -import React, { createContext, useState, useCallback, useContext, useMemo } from 'react'; - -import { useAllAgents } from './../agents/use_all_agents'; -import { useActionResults } from './use_action_results'; -import { useAllResults } from '../results/use_all_results'; -import { Direction, ResultEdges } from '../../common/search_strategy'; -import { useRouterNavigate } from '../common/lib/kibana'; -import { useOsqueryPolicies } from '../agents/use_osquery_policies'; - -const DataContext = createContext([]); - -interface ActionResultsTableProps { - actionId: string; -} - -const ActionResultsTableComponent: React.FC = ({ actionId }) => { - const [pagination, setPagination] = useState({ pageIndex: 0, pageSize: 50 }); - const onChangeItemsPerPage = useCallback( - (pageSize) => - setPagination((currentPagination) => ({ - ...currentPagination, - pageSize, - pageIndex: 0, - })), - [setPagination] - ); - const onChangePage = useCallback( - (pageIndex) => setPagination((currentPagination) => ({ ...currentPagination, pageIndex })), - [setPagination] - ); - - const [columns] = useState([ - { - id: 'status', - displayAsText: 'status', - defaultSortDirection: Direction.asc, - }, - { - id: 'rows_count', - displayAsText: '# rows', - defaultSortDirection: Direction.asc, - }, - { - id: 'agent_status', - displayAsText: 'online', - defaultSortDirection: Direction.asc, - }, - { - id: 'agent', - displayAsText: 'agent', - defaultSortDirection: Direction.asc, - }, - { - id: '@timestamp', - displayAsText: '@timestamp', - defaultSortDirection: Direction.asc, - }, - ]); - - // ** Sorting config - const [sortingColumns, setSortingColumns] = useState([]); - - const { data: actionResultsData } = useActionResults({ - actionId, - activePage: pagination.pageIndex, - limit: pagination.pageSize, - direction: Direction.asc, - sortField: '@timestamp', - }); - - const [visibleColumns, setVisibleColumns] = useState(() => map('id', columns)); // initialize to the full set of columns - - const columnVisibility = useMemo(() => ({ visibleColumns, setVisibleColumns }), [ - visibleColumns, - setVisibleColumns, - ]); - - const osqueryPolicyData = useOsqueryPolicies(); - const { agents } = useAllAgents(osqueryPolicyData); - - const renderCellValue: EuiDataGridProps['renderCellValue'] = useMemo( - () => ({ rowIndex, columnId }) => { - // eslint-disable-next-line react-hooks/rules-of-hooks - const data = useContext(DataContext); - const value = data[rowIndex]; - - if (columnId === 'status') { - // eslint-disable-next-line react-hooks/rules-of-hooks - const linkProps = useRouterNavigate( - `/live_query/${actionId}/results/${value.fields?.agent_id[0]}` - ); - - return ( - <> - - {'View results'} - - ); - } - - if (columnId === 'rows_count') { - // eslint-disable-next-line react-hooks/rules-of-hooks - const { data: allResultsData } = useAllResults({ - actionId, - agentId: value.fields?.agent_id[0], - activePage: pagination.pageIndex, - limit: pagination.pageSize, - direction: Direction.asc, - sortField: '@timestamp', - }); - // @ts-expect-error update types - return allResultsData?.totalCount ?? '-'; - } - - if (columnId === 'agent_status') { - const agentIdValue = value.fields?.agent_id[0]; - const agent = find(['_id', agentIdValue], agents); - const online = agent?.active; - const color = online ? 'success' : 'danger'; - const label = online ? 'Online' : 'Offline'; - return {label}; - } - - if (columnId === 'agent') { - const agentIdValue = value.fields?.agent_id[0]; - const agent = find(['_id', agentIdValue], agents); - const agentName = agent?.local_metadata.host.name; - - // eslint-disable-next-line react-hooks/rules-of-hooks - const linkProps = useRouterNavigate(`/live_query/${actionId}/results/${agentIdValue}`); - return ( - {`(${agent?.local_metadata.os.name}) ${agentName}`} - ); - } - - if (columnId === '@timestamp') { - // @ts-expect-error fields is optional - return value.fields['@timestamp']; - } - - return '-'; - }, - [actionId, agents, pagination.pageIndex, pagination.pageSize] - ); - - const tableSorting: EuiDataGridSorting = useMemo( - () => ({ columns: sortingColumns, onSort: setSortingColumns }), - [sortingColumns] - ); - - const tablePagination = useMemo( - () => ({ - ...pagination, - pageSizeOptions: [10, 50, 100], - onChangeItemsPerPage, - onChangePage, - }), - [onChangeItemsPerPage, onChangePage, pagination] - ); - - return ( - // @ts-expect-error update types - - - - ); -}; - -export const ActionResultsTable = React.memo(ActionResultsTableComponent); diff --git a/x-pack/plugins/osquery/public/action_results/helpers.ts b/x-pack/plugins/osquery/public/action_results/helpers.ts index 802674ee0398c..171530a77299f 100644 --- a/x-pack/plugins/osquery/public/action_results/helpers.ts +++ b/x-pack/plugins/osquery/public/action_results/helpers.ts @@ -16,15 +16,14 @@ export type InspectResponse = Inspect & { response: string[] }; export const generateTablePaginationOptions = ( activePage: number, - limit: number, - isBucketSort?: boolean + limit: number ): PaginationInputPaginated => { const cursorStart = activePage * limit; return { activePage, cursorStart, fakePossibleCount: 4 <= activePage && activePage > 0 ? limit * (activePage + 2) : limit * 5, - querySize: isBucketSort ? limit : limit + cursorStart, + querySize: limit, }; }; diff --git a/x-pack/plugins/osquery/public/action_results/use_action_results.ts b/x-pack/plugins/osquery/public/action_results/use_action_results.ts index 58a877e799703..7cad8ca3fc498 100644 --- a/x-pack/plugins/osquery/public/action_results/use_action_results.ts +++ b/x-pack/plugins/osquery/public/action_results/use_action_results.ts @@ -5,8 +5,7 @@ * 2.0. */ -import deepEqual from 'fast-deep-equal'; -import { useEffect, useState } from 'react'; +import { flatten, reverse, uniqBy } from 'lodash/fp'; import { useQuery } from 'react-query'; import { createFilter } from '../common/helpers'; @@ -20,6 +19,7 @@ import { Direction, } from '../../common/search_strategy'; import { ESTermQuery } from '../../common/typed_json'; +import { queryClient } from '../query_client'; import { generateTablePaginationOptions, getInspectResponse, InspectResponse } from './helpers'; @@ -35,68 +35,91 @@ export interface ResultsArgs { interface UseActionResults { actionId: string; activePage: number; + agentIds?: string[]; direction: Direction; limit: number; sortField: string; filterQuery?: ESTermQuery | string; skip?: boolean; + isLive?: boolean; } export const useActionResults = ({ actionId, activePage, + agentIds, direction, limit, sortField, filterQuery, skip = false, + isLive = false, }: UseActionResults) => { const { data } = useKibana().services; - const [resultsRequest, setHostRequest] = useState(null); - - const response = useQuery( - ['actionResults', { actionId, activePage, direction, limit, sortField }], + return useQuery( + ['actionResults', { actionId }], async () => { - if (!resultsRequest) return Promise.resolve(); - const responseData = await data.search - .search(resultsRequest, { - strategy: 'osquerySearchStrategy', - }) + .search( + { + actionId, + factoryQueryType: OsqueryQueries.actionResults, + filterQuery: createFilter(filterQuery), + pagination: generateTablePaginationOptions(activePage, limit), + sort: { + direction, + field: sortField, + }, + }, + { + strategy: 'osquerySearchStrategy', + } + ) .toPromise(); + const totalResponded = + // @ts-expect-error update types + responseData.rawResponse?.aggregations?.aggs.responses_by_action_id?.doc_count; + const aggsBuckets = + // @ts-expect-error update types + responseData.rawResponse?.aggregations?.aggs.responses_by_action_id?.responses.buckets; + + const cachedData = queryClient.getQueryData(['actionResults', { actionId }]); + + // @ts-expect-error update types + const previousEdges = cachedData?.edges.length + ? // @ts-expect-error update types + cachedData?.edges + : agentIds?.map((agentId) => ({ fields: { agent_id: [agentId] } })) ?? []; + return { ...responseData, - results: responseData.edges, + edges: reverse(uniqBy('fields.agent_id[0]', flatten([responseData.edges, previousEdges]))), + aggregations: { + totalResponded, + // @ts-expect-error update types + successful: aggsBuckets.find((bucket) => bucket.key === 'success')?.doc_count ?? 0, + // @ts-expect-error update types + failed: aggsBuckets.find((bucket) => bucket.key === 'error')?.doc_count ?? 0, + }, inspect: getInspectResponse(responseData, {} as InspectResponse), }; }, { - refetchInterval: 1000, - enabled: !skip && !!resultsRequest, + initialData: { + edges: [], + aggregations: { + totalResponded: 0, + successful: 0, + // @ts-expect-error update types + pending: agentIds?.length ?? 0, + failed: 0, + }, + }, + refetchInterval: isLive ? 1000 : false, + keepPreviousData: true, + enabled: !skip && !!agentIds?.length, } ); - - useEffect(() => { - setHostRequest((prevRequest) => { - const myRequest = { - ...(prevRequest ?? {}), - actionId, - factoryQueryType: OsqueryQueries.actionResults, - filterQuery: createFilter(filterQuery), - pagination: generateTablePaginationOptions(activePage, limit), - sort: { - direction, - field: sortField, - }, - }; - if (!deepEqual(prevRequest, myRequest)) { - return myRequest; - } - return prevRequest; - }); - }, [actionId, activePage, direction, filterQuery, limit, sortField]); - - return response; }; diff --git a/x-pack/plugins/osquery/public/actions/actions_table.tsx b/x-pack/plugins/osquery/public/actions/actions_table.tsx index ca85693849651..5d1b9b723d98b 100644 --- a/x-pack/plugins/osquery/public/actions/actions_table.tsx +++ b/x-pack/plugins/osquery/public/actions/actions_table.tsx @@ -5,128 +5,123 @@ * 2.0. */ -import { isEmpty, isEqual, keys, map } from 'lodash/fp'; -import { - EuiLink, - EuiDataGrid, - EuiDataGridProps, - EuiDataGridColumn, - EuiDataGridSorting, - EuiLoadingContent, -} from '@elastic/eui'; -import React, { createContext, useEffect, useState, useCallback, useContext, useMemo } from 'react'; +import { i18n } from '@kbn/i18n'; +import { EuiBasicTable, EuiButtonIcon, EuiCodeBlock, formatDate } from '@elastic/eui'; +import React, { useState, useCallback, useMemo } from 'react'; import { useAllActions } from './use_all_actions'; -import { ActionEdges, Direction } from '../../common/search_strategy'; +import { Direction } from '../../common/search_strategy'; import { useRouterNavigate } from '../common/lib/kibana'; -const DataContext = createContext([]); +interface ActionTableResultsButtonProps { + actionId: string; +} -const ActionsTableComponent = () => { - const [pagination, setPagination] = useState({ pageIndex: 0, pageSize: 50 }); - const onChangeItemsPerPage = useCallback( - (pageSize) => - setPagination((currentPagination) => ({ - ...currentPagination, - pageSize, - pageIndex: 0, - })), - [setPagination] - ); - const onChangePage = useCallback( - (pageIndex) => setPagination((currentPagination) => ({ ...currentPagination, pageIndex })), - [setPagination] - ); +const ActionTableResultsButton = React.memo(({ actionId }) => { + const navProps = useRouterNavigate(`live_queries/${actionId}`); + + return ; +}); - const [columns, setColumns] = useState([]); +ActionTableResultsButton.displayName = 'ActionTableResultsButton'; - // ** Sorting config - const [sortingColumns, setSortingColumns] = useState([]); +const ActionsTableComponent = () => { + const [pageIndex, setPageIndex] = useState(0); + const [pageSize, setPageSize] = useState(20); - const { isLoading: actionsLoading, data: actionsData } = useAllActions({ - activePage: pagination.pageIndex, - limit: pagination.pageSize, + const { data: actionsData } = useAllActions({ + activePage: pageIndex, + limit: pageSize, direction: Direction.desc, sortField: '@timestamp', }); - // Column visibility - const [visibleColumns, setVisibleColumns] = useState([]); // initialize to the full set of columns - - const columnVisibility = useMemo(() => ({ visibleColumns, setVisibleColumns }), [ - visibleColumns, - setVisibleColumns, - ]); - - const renderCellValue: EuiDataGridProps['renderCellValue'] = useMemo( - () => ({ rowIndex, columnId }) => { - // eslint-disable-next-line react-hooks/rules-of-hooks - const data = useContext(DataContext); - // @ts-expect-error fields is optional - const value = data[rowIndex].fields[columnId]; - - if (columnId === 'action_id') { - // eslint-disable-next-line react-hooks/rules-of-hooks - const linkProps = useRouterNavigate(`/live_query/${value}`); - return {value}; - } - - return !isEmpty(value) ? value : '-'; - }, + const onTableChange = useCallback(({ page = {} }) => { + const { index, size } = page; + + setPageIndex(index); + setPageSize(size); + }, []); + + const renderQueryColumn = useCallback( + (_, item) => ( + + {item._source.data.query} + + ), [] ); - const tableSorting: EuiDataGridSorting = useMemo( - () => ({ columns: sortingColumns, onSort: setSortingColumns }), - [setSortingColumns, sortingColumns] + const renderAgentsColumn = useCallback((_, item) => <>{item.fields.agents?.length ?? 0}, []); + + const renderTimestampColumn = useCallback( + (_, item) => <>{formatDate(item.fields['@timestamp'][0])}, + [] + ); + + const renderActionsColumn = useCallback( + (item) => , + [] ); - const tablePagination = useMemo( + const columns = useMemo( + () => [ + { + field: 'query', + name: i18n.translate('xpack.osquery.liveQueryActions.table.queryColumnTitle', { + defaultMessage: 'Query', + }), + truncateText: true, + render: renderQueryColumn, + }, + { + field: 'agents', + name: i18n.translate('xpack.osquery.liveQueryActions.table.agentsColumnTitle', { + defaultMessage: 'Agents', + }), + width: '100px', + render: renderAgentsColumn, + }, + { + field: 'created_at', + name: i18n.translate('xpack.osquery.liveQueryActions.table.createdAtColumnTitle', { + defaultMessage: 'Created at', + }), + width: '200px', + render: renderTimestampColumn, + }, + { + name: i18n.translate('xpack.osquery.liveQueryActions.table.viewDetailsColumnTitle', { + defaultMessage: 'View details', + }), + actions: [ + { + render: renderActionsColumn, + }, + ], + }, + ], + [renderActionsColumn, renderAgentsColumn, renderQueryColumn, renderTimestampColumn] + ); + + const pagination = useMemo( () => ({ - ...pagination, - pageSizeOptions: [10, 50, 100], - onChangeItemsPerPage, - onChangePage, + pageIndex, + pageSize, + totalItemCount: actionsData?.totalCount ?? 0, + pageSizeOptions: [20, 50, 100], }), - [onChangeItemsPerPage, onChangePage, pagination] + [actionsData?.totalCount, pageIndex, pageSize] ); - useEffect(() => { - // @ts-expect-error update types - const newColumns = keys(actionsData?.actions[0]?.fields) - .sort() - .map((fieldName) => ({ - id: fieldName, - displayAsText: fieldName.split('.')[1], - defaultSortDirection: Direction.asc, - })); - - if (!isEqual(columns, newColumns)) { - setColumns(newColumns); - setVisibleColumns(map('id', newColumns)); - } - // @ts-expect-error update types - }, [columns, actionsData?.actions]); - - if (actionsLoading) { - return ; - } - return ( - // @ts-expect-error update types - // eslint-disable-next-line react-perf/jsx-no-new-array-as-prop - - - + ); }; diff --git a/x-pack/plugins/osquery/public/actions/helpers.ts b/x-pack/plugins/osquery/public/actions/helpers.ts index 802674ee0398c..171530a77299f 100644 --- a/x-pack/plugins/osquery/public/actions/helpers.ts +++ b/x-pack/plugins/osquery/public/actions/helpers.ts @@ -16,15 +16,14 @@ export type InspectResponse = Inspect & { response: string[] }; export const generateTablePaginationOptions = ( activePage: number, - limit: number, - isBucketSort?: boolean + limit: number ): PaginationInputPaginated => { const cursorStart = activePage * limit; return { activePage, cursorStart, fakePossibleCount: 4 <= activePage && activePage > 0 ? limit * (activePage + 2) : limit * 5, - querySize: isBucketSort ? limit : limit + cursorStart, + querySize: limit, }; }; diff --git a/x-pack/plugins/osquery/public/actions/use_action_details.ts b/x-pack/plugins/osquery/public/actions/use_action_details.ts index eb5317f6c40e0..2e5fa79cae992 100644 --- a/x-pack/plugins/osquery/public/actions/use_action_details.ts +++ b/x-pack/plugins/osquery/public/actions/use_action_details.ts @@ -5,8 +5,6 @@ * 2.0. */ -import deepEqual from 'fast-deep-equal'; -import { useEffect, useState } from 'react'; import { useQuery } from 'react-query'; import { createFilter } from '../common/helpers'; @@ -36,17 +34,20 @@ interface UseActionDetails { export const useActionDetails = ({ actionId, filterQuery, skip = false }: UseActionDetails) => { const { data } = useKibana().services; - const [actionDetailsRequest, setHostRequest] = useState(null); - - const response = useQuery( - ['action', { actionId }], + return useQuery( + ['actionDetails', { actionId, filterQuery }], async () => { - if (!actionDetailsRequest) return Promise.resolve(); - const responseData = await data.search - .search(actionDetailsRequest, { - strategy: 'osquerySearchStrategy', - }) + .search( + { + actionId, + factoryQueryType: OsqueryQueries.actionDetails, + filterQuery: createFilter(filterQuery), + }, + { + strategy: 'osquerySearchStrategy', + } + ) .toPromise(); return { @@ -55,24 +56,7 @@ export const useActionDetails = ({ actionId, filterQuery, skip = false }: UseAct }; }, { - enabled: !skip && !!actionDetailsRequest, + enabled: !skip, } ); - - useEffect(() => { - setHostRequest((prevRequest) => { - const myRequest = { - ...(prevRequest ?? {}), - actionId, - factoryQueryType: OsqueryQueries.actionDetails, - filterQuery: createFilter(filterQuery), - }; - if (!deepEqual(prevRequest, myRequest)) { - return myRequest; - } - return prevRequest; - }); - }, [actionId, filterQuery]); - - return response; }; diff --git a/x-pack/plugins/osquery/public/actions/use_all_actions.ts b/x-pack/plugins/osquery/public/actions/use_all_actions.ts index 2b76435efff0a..a58f45b8e99a2 100644 --- a/x-pack/plugins/osquery/public/actions/use_all_actions.ts +++ b/x-pack/plugins/osquery/public/actions/use_all_actions.ts @@ -5,9 +5,7 @@ * 2.0. */ -import { useEffect, useState } from 'react'; import { useQuery } from 'react-query'; -import deepEqual from 'fast-deep-equal'; import { createFilter } from '../common/helpers'; import { useKibana } from '../common/lib/kibana'; @@ -51,17 +49,24 @@ export const useAllActions = ({ }: UseAllActions) => { const { data } = useKibana().services; - const [actionsRequest, setHostRequest] = useState(null); - - const response = useQuery( + return useQuery( ['actions', { activePage, direction, limit, sortField }], async () => { - if (!actionsRequest) return Promise.resolve(); - const responseData = await data.search - .search(actionsRequest, { - strategy: 'osquerySearchStrategy', - }) + .search( + { + factoryQueryType: OsqueryQueries.actions, + filterQuery: createFilter(filterQuery), + pagination: generateTablePaginationOptions(activePage, limit), + sort: { + direction, + field: sortField, + }, + }, + { + strategy: 'osquerySearchStrategy', + } + ) .toPromise(); return { @@ -71,28 +76,8 @@ export const useAllActions = ({ }; }, { - enabled: !skip && !!actionsRequest, + keepPreviousData: true, + enabled: !skip, } ); - - useEffect(() => { - setHostRequest((prevRequest) => { - const myRequest = { - ...(prevRequest ?? {}), - factoryQueryType: OsqueryQueries.actions, - filterQuery: createFilter(filterQuery), - pagination: generateTablePaginationOptions(activePage, limit), - sort: { - direction, - field: sortField, - }, - }; - if (!deepEqual(prevRequest, myRequest)) { - return myRequest; - } - return prevRequest; - }); - }, [activePage, direction, filterQuery, limit, sortField]); - - return response; }; diff --git a/x-pack/plugins/osquery/public/agent_policies/agents_policy_link.tsx b/x-pack/plugins/osquery/public/agent_policies/agents_policy_link.tsx new file mode 100644 index 0000000000000..549e70aa1f634 --- /dev/null +++ b/x-pack/plugins/osquery/public/agent_policies/agents_policy_link.tsx @@ -0,0 +1,55 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import { EuiLink } from '@elastic/eui'; +import React, { useCallback, useMemo } from 'react'; + +import { pagePathGetters } from '../../../fleet/public'; +import { useKibana, isModifiedEvent, isLeftClickEvent } from '../common/lib/kibana'; +import { useAgentPolicy } from './use_agent_policy'; + +interface AgentsPolicyLinkProps { + policyId: string; +} + +const AgentsPolicyLinkComponent: React.FC = ({ policyId }) => { + const { + application: { getUrlForApp, navigateToApp }, + } = useKibana().services; + + const { data } = useAgentPolicy({ policyId }); + + const href = useMemo( + () => + getUrlForApp('fleet', { + path: `#` + pagePathGetters.policy_details({ policyId }), + }), + [getUrlForApp, policyId] + ); + + const handleClick = useCallback( + (event) => { + if (!isModifiedEvent(event) && isLeftClickEvent(event)) { + event.preventDefault(); + + return navigateToApp('fleet', { + path: `#` + pagePathGetters.policy_details({ policyId }), + }); + } + }, + [navigateToApp, policyId] + ); + + return ( + // eslint-disable-next-line @elastic/eui/href-or-on-click + + {data?.name ?? policyId} + + ); +}; + +export const AgentsPolicyLink = React.memo(AgentsPolicyLinkComponent); diff --git a/x-pack/plugins/osquery/public/agent_policies/index.tsx b/x-pack/plugins/osquery/public/agent_policies/index.tsx new file mode 100644 index 0000000000000..c010c8f10f9b6 --- /dev/null +++ b/x-pack/plugins/osquery/public/agent_policies/index.tsx @@ -0,0 +1,9 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +export * from './use_agent_policies'; +export * from './use_agent_policy'; diff --git a/x-pack/plugins/osquery/public/agent_policies/use_agent_policies.ts b/x-pack/plugins/osquery/public/agent_policies/use_agent_policies.ts new file mode 100644 index 0000000000000..95323dd23f4d2 --- /dev/null +++ b/x-pack/plugins/osquery/public/agent_policies/use_agent_policies.ts @@ -0,0 +1,35 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import { useQuery } from 'react-query'; + +import { useKibana } from '../common/lib/kibana'; +import { + agentPolicyRouteService, + GetAgentPoliciesResponse, + GetAgentPoliciesResponseItem, +} from '../../../fleet/common'; + +export const useAgentPolicies = () => { + const { http } = useKibana().services; + + return useQuery( + ['agentPolicies'], + () => + http.get(agentPolicyRouteService.getListPath(), { + query: { + perPage: 100, + }, + }), + { + initialData: { items: [], total: 0, page: 1, perPage: 100 }, + placeholderData: [], + keepPreviousData: true, + select: (response) => response.items, + } + ); +}; diff --git a/x-pack/plugins/osquery/public/agent_policies/use_agent_policy.ts b/x-pack/plugins/osquery/public/agent_policies/use_agent_policy.ts new file mode 100644 index 0000000000000..5fdc317d3f6f1 --- /dev/null +++ b/x-pack/plugins/osquery/public/agent_policies/use_agent_policy.ts @@ -0,0 +1,30 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import { useQuery } from 'react-query'; + +import { useKibana } from '../common/lib/kibana'; +import { agentPolicyRouteService } from '../../../fleet/common'; + +interface UseAgentPolicy { + policyId: string; + skip?: boolean; +} + +export const useAgentPolicy = ({ policyId, skip }: UseAgentPolicy) => { + const { http } = useKibana().services; + + return useQuery( + ['agentPolicy', { policyId }], + () => http.get(agentPolicyRouteService.getInfoPath(policyId)), + { + enabled: !skip, + keepPreviousData: true, + select: (response) => response.item, + } + ); +}; diff --git a/x-pack/plugins/osquery/public/agents/agent_grouper.test.ts b/x-pack/plugins/osquery/public/agents/agent_grouper.test.ts new file mode 100644 index 0000000000000..13c073c3bf8be --- /dev/null +++ b/x-pack/plugins/osquery/public/agents/agent_grouper.test.ts @@ -0,0 +1,140 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import { AgentGrouper } from './agent_grouper'; +import { AGENT_GROUP_KEY, Group, GroupedAgent, GroupOptionValue } from './types'; +import uuid from 'uuid'; +import { ALL_AGENTS_LABEL } from './translations'; + +type GroupData = { + [key in Exclude]: Group[]; +}; +export function genGroup(name: string) { + return { + name, + id: uuid.v4(), + size: 5, + }; +} + +export function genAgent(policyId: string, hostname: string, id: string): GroupedAgent { + return { + status: 'online', + policy_id: policyId, + local_metadata: { + elastic: { + agent: { + id, + }, + }, + os: { + platform: 'test platform', + }, + host: { + hostname, + }, + }, + }; +} +export const groupData: GroupData = { + [AGENT_GROUP_KEY.Platform]: new Array(3).fill('test platform ').map((el, i) => genGroup(el + i)), + [AGENT_GROUP_KEY.Policy]: new Array(3).fill('test policy ').map((el, i) => genGroup(el + i)), +}; + +describe('AgentGrouper', () => { + describe('All agents', () => { + it('should handle empty groups properly', () => { + const agentGrouper = new AgentGrouper(); + expect(agentGrouper.generateOptions()).toEqual([]); + }); + + it('should ignore calls to add things to the "all" group', () => { + const agentGrouper = new AgentGrouper(); + agentGrouper.updateGroup(AGENT_GROUP_KEY.All, [{}]); + expect(agentGrouper.generateOptions()).toEqual([]); + }); + + it('should omit the "all agents" option when total is set to <= 0', () => { + const agentGrouper = new AgentGrouper(); + agentGrouper.setTotalAgents(0); + expect(agentGrouper.generateOptions()).toEqual([]); + agentGrouper.setTotalAgents(-1); + expect(agentGrouper.generateOptions()).toEqual([]); + }); + + it('should add the "all agents" option when the total is set to > 0', () => { + const agentGrouper = new AgentGrouper(); + agentGrouper.setTotalAgents(100); + const groups = agentGrouper.generateOptions(); + + // eslint-disable-next-line @typescript-eslint/no-non-null-assertion + const allGroup = groups[AGENT_GROUP_KEY.All].options![0]; + expect(allGroup.label).toEqual(ALL_AGENTS_LABEL); + const size: number = (allGroup.value as GroupOptionValue).size; + + expect(size).toEqual(100); + agentGrouper.setTotalAgents(0); + expect(agentGrouper.generateOptions()).toEqual([]); + }); + }); + + describe('Policies and platforms', () => { + function genGroupTest( + key: AGENT_GROUP_KEY.Platform | AGENT_GROUP_KEY.Policy, + dataName: string + ) { + return () => { + const agentGrouper = new AgentGrouper(); + const data = groupData[key]; + agentGrouper.updateGroup(key, data); + + const groups = agentGrouper.generateOptions(); + const options = groups[0].options; + expect(options).toBeTruthy(); + + data.forEach((datum, i) => { + // eslint-disable-next-line @typescript-eslint/no-non-null-assertion + const opt = options![i]; + expect(opt.label).toEqual(`test ${dataName} ${i} (${datum.id})`); + expect(opt.key).toEqual(datum.id); + expect(opt.value).toEqual({ + groupType: key, + id: datum.id, + size: 5, + }); + }); + }; + } + it('should generate policy options', genGroupTest(AGENT_GROUP_KEY.Policy, 'policy')); + it('should generate platform options', genGroupTest(AGENT_GROUP_KEY.Platform, 'platform')); + }); + + describe('agents', () => { + it('should generate agent options', () => { + const agentGrouper = new AgentGrouper(); + const policyId = uuid.v4(); + const agentData: GroupedAgent[] = [ + genAgent(policyId, `agent host 1`, uuid.v4()), + genAgent(policyId, `agent host 2`, uuid.v4()), + ]; + agentGrouper.updateGroup(AGENT_GROUP_KEY.Agent, agentData); + + const groups = agentGrouper.generateOptions(); + const options = groups[0].options; + expect(options).toBeTruthy(); + agentData.forEach((ag, i) => { + // eslint-disable-next-line @typescript-eslint/no-non-null-assertion + const opt = options![i]; + expect(opt.label).toEqual( + `${ag.local_metadata.host.hostname} (${ag.local_metadata.elastic.agent.id})` + ); + expect(opt.key).toEqual(ag.local_metadata.elastic.agent.id); + expect(opt.value?.id).toEqual(ag.local_metadata.elastic.agent.id); + }); + }); + }); +}); diff --git a/x-pack/plugins/osquery/public/agents/agent_grouper.ts b/x-pack/plugins/osquery/public/agents/agent_grouper.ts index 419a3b9e733a4..bc4b4129d3b2b 100644 --- a/x-pack/plugins/osquery/public/agents/agent_grouper.ts +++ b/x-pack/plugins/osquery/public/agents/agent_grouper.ts @@ -5,7 +5,6 @@ * 2.0. */ -import { Agent } from '../../common/shared_imports'; import { generateColorPicker } from './helpers'; import { ALL_AGENTS_LABEL, @@ -13,7 +12,7 @@ import { AGENT_POLICY_LABEL, AGENT_SELECTION_LABEL, } from './translations'; -import { AGENT_GROUP_KEY, Group, GroupOption } from './types'; +import { AGENT_GROUP_KEY, Group, GroupOption, GroupedAgent } from './types'; const getColor = generateColorPicker(); @@ -27,6 +26,38 @@ const generateGroup = (label: string, groupType: AGENT_GROUP_KEY) => }; }; +export const generateAgentOption = ( + label: string, + groupType: AGENT_GROUP_KEY, + data: GroupedAgent[] +) => ({ + label, + options: data.map((agent) => ({ + label: `${agent.local_metadata.host.hostname} (${agent.local_metadata.elastic.agent.id})`, + key: agent.local_metadata.elastic.agent.id, + color: getColor(groupType), + value: { + groupType, + groups: { + policy: agent.policy_id ?? '', + platform: agent.local_metadata.os.platform, + }, + id: agent.local_metadata.elastic.agent.id, + status: agent.status ?? 'unknown', + }, + })), +}); + +export const generateGroupOption = (label: string, groupType: AGENT_GROUP_KEY, data: Group[]) => ({ + label, + options: (data as Group[]).map(({ name, id, size }) => ({ + label: name !== id ? `${name} (${id})` : name, + key: id, + color: getColor(groupType), + value: { groupType, id, size }, + })), +}); + export class AgentGrouper { groupOrder = [ AGENT_GROUP_KEY.All, @@ -38,12 +69,15 @@ export class AgentGrouper { [AGENT_GROUP_KEY.All]: generateGroup(ALL_AGENTS_LABEL, AGENT_GROUP_KEY.All), [AGENT_GROUP_KEY.Platform]: generateGroup(AGENT_PLATFORMS_LABEL, AGENT_GROUP_KEY.Platform), [AGENT_GROUP_KEY.Policy]: generateGroup(AGENT_POLICY_LABEL, AGENT_GROUP_KEY.Policy), - [AGENT_GROUP_KEY.Agent]: generateGroup(AGENT_SELECTION_LABEL, AGENT_GROUP_KEY.Agent), + [AGENT_GROUP_KEY.Agent]: generateGroup( + AGENT_SELECTION_LABEL, + AGENT_GROUP_KEY.Agent + ), }; // eslint-disable-next-line @typescript-eslint/no-explicit-any updateGroup(key: AGENT_GROUP_KEY, data: any[], append = false) { - if (!data?.length) { + if (!data?.length || key === AGENT_GROUP_KEY.All) { return; } const group = this.groups[key]; @@ -56,6 +90,9 @@ export class AgentGrouper { } setTotalAgents(total: number): void { + if (total < 0) { + return; + } this.groups[AGENT_GROUP_KEY.All].size = total; } @@ -82,34 +119,10 @@ export class AgentGrouper { break; case AGENT_GROUP_KEY.Platform: case AGENT_GROUP_KEY.Policy: - opts.push({ - label, - options: (data as Group[]).map(({ name, id, size: groupSize }) => ({ - label: name !== id ? `${name} (${id})` : name, - key: id, - color: getColor(groupType), - value: { groupType, id, size: groupSize }, - })), - }); + opts.push(generateGroupOption(label, key, data as Group[])); break; case AGENT_GROUP_KEY.Agent: - opts.push({ - label, - options: (data as Agent[]).map((agent: Agent) => ({ - label: `${agent.local_metadata.host.hostname} (${agent.local_metadata.elastic.agent.id})`, - key: agent.local_metadata.elastic.agent.id, - color, - value: { - groupType, - groups: { - policy: agent.policy_id ?? '', - platform: agent.local_metadata.os.platform, - }, - id: agent.local_metadata.elastic.agent.id, - online: agent.active, - }, - })), - }); + opts.push(generateAgentOption(label, key, data as GroupedAgent[])); break; } } diff --git a/x-pack/plugins/osquery/public/agents/agents_table.tsx b/x-pack/plugins/osquery/public/agents/agents_table.tsx index 38132957c341f..7f57f70e459da 100644 --- a/x-pack/plugins/osquery/public/agents/agents_table.tsx +++ b/x-pack/plugins/osquery/public/agents/agents_table.tsx @@ -5,8 +5,9 @@ * 2.0. */ -import React, { useCallback, useEffect, useMemo, useState } from 'react'; -import { EuiComboBox, EuiHealth, EuiHighlight } from '@elastic/eui'; +import { find } from 'lodash/fp'; +import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react'; +import { EuiComboBox, EuiHealth, EuiHighlight, EuiSpacer } from '@elastic/eui'; import { useDebounce } from 'react-use'; import { useAllAgents } from './use_all_agents'; @@ -38,7 +39,7 @@ interface AgentsTableProps { const perPage = 10; const DEBOUNCE_DELAY = 100; // ms -const AgentsTableComponent: React.FC = ({ onChange }) => { +const AgentsTableComponent: React.FC = ({ agentSelection, onChange }) => { // search related const [searchValue, setSearchValue] = useState(''); const [modifyingSearch, setModifyingSearch] = useState(false); @@ -67,13 +68,34 @@ const AgentsTableComponent: React.FC = ({ onChange }) => { const [options, setOptions] = useState([]); const [selectedOptions, setSelectedOptions] = useState([]); const [numAgentsSelected, setNumAgentsSelected] = useState(0); + const defaultValueInitialized = useRef(false); + + useEffect(() => { + if (agentSelection && !defaultValueInitialized.current && options.length) { + if (agentSelection.policiesSelected) { + const policyOptions = find(['label', 'Policy'], options); + + if (policyOptions) { + const defaultOptions = policyOptions.options?.filter((option) => + agentSelection.policiesSelected.includes(option.label) + ); + + if (defaultOptions?.length) { + setSelectedOptions(defaultOptions); + } + defaultValueInitialized.current = true; + } + } + } + }, [agentSelection, options]); useEffect(() => { // update the groups when groups or agents have changed grouper.setTotalAgents(totalNumAgents); grouper.updateGroup(AGENT_GROUP_KEY.Platform, groups.platforms); grouper.updateGroup(AGENT_GROUP_KEY.Policy, groups.policies); - grouper.updateGroup(AGENT_GROUP_KEY.Agent, agents); + // eslint-disable-next-line @typescript-eslint/no-non-null-assertion + grouper.updateGroup(AGENT_GROUP_KEY.Agent, agents!); const newOptions = grouper.generateOptions(); setOptions(newOptions); }, [groups.platforms, groups.policies, totalNumAgents, groupsLoading, agents, grouper]); @@ -112,7 +134,7 @@ const AgentsTableComponent: React.FC = ({ onChange }) => { const renderOption = useCallback((option, searchVal, contentClassName) => { const { label, value } = option; return value?.groupType === AGENT_GROUP_KEY.Agent ? ( - + {label} @@ -134,8 +156,6 @@ const AgentsTableComponent: React.FC = ({ onChange }) => { return (
    - {numAgentsSelected > 0 ? {generateSelectedAgentsMessage(numAgentsSelected)} : ''} -   = ({ onChange }) => { onChange={onSelection} renderOption={renderOption} /> + + {numAgentsSelected > 0 ? {generateSelectedAgentsMessage(numAgentsSelected)} : ''}
    ); }; diff --git a/x-pack/plugins/osquery/public/agents/helpers.test.ts b/x-pack/plugins/osquery/public/agents/helpers.test.ts index f7ed4570b1a27..3ec75f2b5bba7 100644 --- a/x-pack/plugins/osquery/public/agents/helpers.test.ts +++ b/x-pack/plugins/osquery/public/agents/helpers.test.ts @@ -5,8 +5,59 @@ * 2.0. */ -import { getNumOverlapped, getNumAgentsInGrouping, processAggregations } from './helpers'; -import { Overlap, SelectedGroups } from './types'; +import uuid from 'uuid'; +import { generateGroupOption } from './agent_grouper'; +import { + getNumOverlapped, + getNumAgentsInGrouping, + processAggregations, + generateAgentSelection, +} from './helpers'; +import { AGENT_GROUP_KEY, GroupOption, Overlap, SelectedGroups } from './types'; + +describe('generateAgentSelection', () => { + it('should handle empty input', () => { + const options: GroupOption[] = []; + const { newAgentSelection, selectedGroups, selectedAgents } = generateAgentSelection(options); + expect(newAgentSelection).toEqual({ + agents: [], + allAgentsSelected: false, + platformsSelected: [], + policiesSelected: [], + }); + expect(selectedAgents).toEqual([]); + expect(selectedGroups).toEqual({ + policy: {}, + platform: {}, + }); + }); + + it('should properly pull out group ids', () => { + const options: GroupOption[] = []; + const policyOptions = generateGroupOption('policy', AGENT_GROUP_KEY.Policy, [ + { name: 'policy 1', id: 'policy 1', size: 5 }, + { name: 'policy 2', id: uuid.v4(), size: 5 }, + ]).options; + options.push(...policyOptions); + + const platformOptions = generateGroupOption('platform', AGENT_GROUP_KEY.Platform, [ + { name: 'platform 1', id: 'platform 1', size: 5 }, + { name: 'platform 2', id: uuid.v4(), size: 5 }, + ]).options; + options.push(...platformOptions); + + const { newAgentSelection, selectedGroups, selectedAgents } = generateAgentSelection(options); + expect(newAgentSelection).toEqual({ + agents: [], + allAgentsSelected: false, + platformsSelected: platformOptions.map(({ value: { id } }) => id), + policiesSelected: policyOptions.map(({ value: { id } }) => id), + }); + expect(selectedAgents).toEqual([]); + expect(Object.keys(selectedGroups.platform).length).toEqual(2); + expect(Object.keys(selectedGroups.policy).length).toEqual(2); + }); +}); describe('processAggregations', () => { it('should handle empty inputs properly', () => { diff --git a/x-pack/plugins/osquery/public/agents/helpers.ts b/x-pack/plugins/osquery/public/agents/helpers.ts index 14a8dd64fb4da..a79933db0ceb0 100644 --- a/x-pack/plugins/osquery/public/agents/helpers.ts +++ b/x-pack/plugins/osquery/public/agents/helpers.ts @@ -114,9 +114,10 @@ export const generateAgentSelection = (selection: GroupOption[]) => { platform: {}, }; - // TODO: clean this up, make it less awkward for (const opt of selection) { const groupType = opt.value?.groupType; + // best effort to get the proper identity + const key = opt.key ?? opt.value?.id ?? opt.label; let value; switch (groupType) { case AGENT_GROUP_KEY.All: @@ -126,17 +127,17 @@ export const generateAgentSelection = (selection: GroupOption[]) => { value = opt.value as GroupOptionValue; if (!newAgentSelection.allAgentsSelected) { // we don't need to calculate diffs when all agents are selected - selectedGroups.platform[opt.value?.id ?? opt.label] = value.size; + selectedGroups.platform[key] = value.size; } - newAgentSelection.platformsSelected.push(opt.label); + newAgentSelection.platformsSelected.push(key); break; case AGENT_GROUP_KEY.Policy: value = opt.value as GroupOptionValue; if (!newAgentSelection.allAgentsSelected) { // we don't need to calculate diffs when all agents are selected - selectedGroups.policy[opt.value?.id ?? opt.label] = value.size; + selectedGroups.policy[key] = value.size; } - newAgentSelection.policiesSelected.push(opt.label); + newAgentSelection.policiesSelected.push(key); break; case AGENT_GROUP_KEY.Agent: value = opt.value as AgentOptionValue; @@ -144,9 +145,7 @@ export const generateAgentSelection = (selection: GroupOption[]) => { // we don't need to count how many agents are selected if they are all selected selectedAgents.push(value); } - if (value?.id) { - newAgentSelection.agents.push(value.id); - } + newAgentSelection.agents.push(key); break; default: // this should never happen! @@ -159,15 +158,14 @@ export const generateAgentSelection = (selection: GroupOption[]) => { export const generateTablePaginationOptions = ( activePage: number, - limit: number, - isBucketSort?: boolean + limit: number ): PaginationInputPaginated => { const cursorStart = activePage * limit; return { activePage, cursorStart, fakePossibleCount: 4 <= activePage && activePage > 0 ? limit * (activePage + 2) : limit * 5, - querySize: isBucketSort ? limit : limit + cursorStart, + querySize: limit, }; }; diff --git a/x-pack/plugins/osquery/public/agents/types.ts b/x-pack/plugins/osquery/public/agents/types.ts index b26404f9c5e70..302b2686d511e 100644 --- a/x-pack/plugins/osquery/public/agents/types.ts +++ b/x-pack/plugins/osquery/public/agents/types.ts @@ -7,6 +7,7 @@ import { TermsAggregate } from '@elastic/elasticsearch/api/types'; import { EuiComboBoxOptionOption } from '@elastic/eui'; +import { Agent } from '../../common/shared_imports'; interface BaseDataPoint { key: string; @@ -30,6 +31,8 @@ export interface SelectedGroups { [groupType: string]: { [groupName: string]: number }; } +export type GroupedAgent = Pick; + export type GroupOption = EuiComboBoxOptionOption; export interface AgentSelection { @@ -46,7 +49,7 @@ interface BaseGroupOption { export type AgentOptionValue = BaseGroupOption & { groups: { [groupType: string]: string }; - online: boolean; + status: string; }; export type GroupOptionValue = BaseGroupOption & { @@ -57,5 +60,6 @@ export enum AGENT_GROUP_KEY { All, Platform, Policy, + // eslint-disable-next-line @typescript-eslint/no-shadow Agent, } diff --git a/x-pack/plugins/osquery/public/agents/use_agent_policies.ts b/x-pack/plugins/osquery/public/agents/use_agent_policies.ts index 3045423ccbe2d..c8b3ef064c038 100644 --- a/x-pack/plugins/osquery/public/agents/use_agent_policies.ts +++ b/x-pack/plugins/osquery/public/agents/use_agent_policies.ts @@ -5,13 +5,10 @@ * 2.0. */ +import { mapKeys } from 'lodash'; import { useQueries, UseQueryResult } from 'react-query'; import { useKibana } from '../common/lib/kibana'; -import { - AgentPolicy, - agentPolicyRouteService, - GetOneAgentPolicyResponse, -} from '../../../fleet/common'; +import { agentPolicyRouteService, GetOneAgentPolicyResponse } from '../../../fleet/common'; export const useAgentPolicies = (policyIds: string[] = []) => { const { http } = useKibana().services; @@ -26,13 +23,7 @@ export const useAgentPolicies = (policyIds: string[] = []) => { const agentPoliciesLoading = agentResponse.some((p) => p.isLoading); const agentPolicies = agentResponse.map((p) => p.data?.item); - const agentPolicyById = agentPolicies.reduce((acc, p) => { - if (!p) { - return acc; - } - acc[p.id] = p; - return acc; - }, {} as { [key: string]: AgentPolicy }); + const agentPolicyById = mapKeys(agentPolicies, 'id'); return { agentPoliciesLoading, agentPolicies, agentPolicyById }; }; diff --git a/x-pack/plugins/osquery/public/agents/use_agent_status.ts b/x-pack/plugins/osquery/public/agents/use_agent_status.ts new file mode 100644 index 0000000000000..c26adb908f6be --- /dev/null +++ b/x-pack/plugins/osquery/public/agents/use_agent_status.ts @@ -0,0 +1,39 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import { useQuery } from 'react-query'; + +import { GetAgentStatusResponse, agentRouteService } from '../../../fleet/common'; +import { useKibana } from '../common/lib/kibana'; + +interface UseAgentStatus { + policyId?: string; + skip?: boolean; +} + +export const useAgentStatus = ({ policyId, skip }: UseAgentStatus) => { + const { http } = useKibana().services; + + return useQuery( + ['agentStatus', policyId], + () => + http.get( + agentRouteService.getStatusPath(), + policyId + ? { + query: { + policyId, + }, + } + : {} + ), + { + enabled: !skip, + select: (response) => response.results, + } + ); +}; diff --git a/x-pack/plugins/osquery/public/agents/use_all_agents.ts b/x-pack/plugins/osquery/public/agents/use_all_agents.ts index bd9b1c32412e6..e10bc2a0d9bf6 100644 --- a/x-pack/plugins/osquery/public/agents/use_all_agents.ts +++ b/x-pack/plugins/osquery/public/agents/use_all_agents.ts @@ -7,6 +7,7 @@ import { useQuery } from 'react-query'; +import { GetAgentsResponse, agentRouteService } from '../../../fleet/common'; import { useKibana } from '../common/lib/kibana'; interface UseAllAgents { @@ -27,17 +28,25 @@ export const useAllAgents = ( ) => { const { perPage } = opts; const { http } = useKibana().services; - const { isLoading: agentsLoading, data: agentData } = useQuery( + const { isLoading: agentsLoading, data: agentData } = useQuery( ['agents', osqueryPolicies, searchValue, perPage], - async () => { - let kuery = `(${osqueryPolicies.map((p) => `policy_id:${p}`).join(' or ')})`; + () => { + const kueryFragments: string[] = []; + if (osqueryPolicies.length) { + kueryFragments.push(`${osqueryPolicies.map((p) => `policy_id:${p}`).join(' or ')}`); + } + if (searchValue) { - kuery += ` and (local_metadata.host.hostname:/${searchValue}/ or local_metadata.elastic.agent.id:/${searchValue}/)`; + kueryFragments.push( + `local_metadata.host.hostname:*${searchValue}* or local_metadata.elastic.agent.id:*${searchValue}*` + ); } - return await http.get('/api/fleet/agents', { + + return http.get(agentRouteService.getListPath(), { query: { - kuery, + kuery: kueryFragments.map((frag) => `(${frag})`).join(' and '), perPage, + showInactive: true, }, }); }, diff --git a/x-pack/plugins/osquery/public/agents/use_osquery_policies.ts b/x-pack/plugins/osquery/public/agents/use_osquery_policies.ts index f786e9167d2f8..2937c57b50a3d 100644 --- a/x-pack/plugins/osquery/public/agents/use_osquery_policies.ts +++ b/x-pack/plugins/osquery/public/agents/use_osquery_policies.ts @@ -7,20 +7,20 @@ import { useQuery } from 'react-query'; import { useKibana } from '../common/lib/kibana'; -import { PACKAGE_POLICY_SAVED_OBJECT_TYPE } from '../../../fleet/common'; +import { packagePolicyRouteService, PACKAGE_POLICY_SAVED_OBJECT_TYPE } from '../../../fleet/common'; +import { OSQUERY_INTEGRATION_NAME } from '../../common'; export const useOsqueryPolicies = () => { const { http } = useKibana().services; const { isLoading: osqueryPoliciesLoading, data: osqueryPolicies } = useQuery( ['osqueryPolicies'], - async () => { - return await http.get('/api/fleet/package_policies', { + () => + http.get(packagePolicyRouteService.getListPath(), { query: { - kuery: `${PACKAGE_POLICY_SAVED_OBJECT_TYPE}.package.name:osquery_manager`, + kuery: `${PACKAGE_POLICY_SAVED_OBJECT_TYPE}.package.name:${OSQUERY_INTEGRATION_NAME}`, }, - }); - }, + }), { select: (data) => data.items.map((p: { policy_id: string }) => p.policy_id) } ); diff --git a/x-pack/plugins/osquery/public/application.tsx b/x-pack/plugins/osquery/public/application.tsx index d72a788b16245..3e959132e21a8 100644 --- a/x-pack/plugins/osquery/public/application.tsx +++ b/x-pack/plugins/osquery/public/application.tsx @@ -13,7 +13,7 @@ import ReactDOM from 'react-dom'; import { Router } from 'react-router-dom'; import { I18nProvider } from '@kbn/i18n/react'; import { ThemeProvider } from 'styled-components'; -import { QueryClient, QueryClientProvider } from 'react-query'; +import { QueryClientProvider } from 'react-query'; import { ReactQueryDevtools } from 'react-query/devtools'; import { useUiSetting$ } from '../../../../src/plugins/kibana_react/public'; @@ -23,8 +23,7 @@ import { AppPluginStartDependencies } from './types'; import { OsqueryApp } from './components/app'; import { DEFAULT_DARK_MODE, PLUGIN_NAME } from '../common'; import { KibanaContextProvider } from './common/lib/kibana'; - -const queryClient = new QueryClient(); +import { queryClient } from './query_client'; const OsqueryAppContext = () => { const [darkMode] = useUiSetting$(DEFAULT_DARK_MODE); diff --git a/x-pack/plugins/osquery/public/common/hooks/index.tsx b/x-pack/plugins/osquery/public/common/hooks/index.tsx new file mode 100644 index 0000000000000..750e09b44d89b --- /dev/null +++ b/x-pack/plugins/osquery/public/common/hooks/index.tsx @@ -0,0 +1,9 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +export * from './use_discover_link'; +export * from './use_osquery_integration'; diff --git a/x-pack/plugins/osquery/public/common/hooks/use_breadcrumbs.tsx b/x-pack/plugins/osquery/public/common/hooks/use_breadcrumbs.tsx new file mode 100644 index 0000000000000..660ef87fb57e3 --- /dev/null +++ b/x-pack/plugins/osquery/public/common/hooks/use_breadcrumbs.tsx @@ -0,0 +1,136 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import { i18n } from '@kbn/i18n'; +import type { ChromeBreadcrumb } from 'src/core/public'; + +import { BASE_PATH } from '../../../common/constants'; +import type { Page, DynamicPagePathValues } from '../page_paths'; +import { pagePathGetters } from '../page_paths'; + +import { useKibana } from '../lib/kibana'; + +const BASE_BREADCRUMB: ChromeBreadcrumb = { + href: pagePathGetters.overview(), + text: i18n.translate('xpack.osquery.breadcrumbs.appTitle', { + defaultMessage: 'Osquery', + }), +}; + +const breadcrumbGetters: { + [key in Page]?: (values: DynamicPagePathValues) => ChromeBreadcrumb[]; +} = { + base: () => [BASE_BREADCRUMB], + overview: () => [ + BASE_BREADCRUMB, + { + text: i18n.translate('xpack.osquery.breadcrumbs.overviewPageTitle', { + defaultMessage: 'Overview', + }), + }, + ], + live_queries: () => [ + BASE_BREADCRUMB, + { + text: i18n.translate('xpack.osquery.breadcrumbs.liveQueriesPageTitle', { + defaultMessage: 'Live queries', + }), + }, + ], + live_query_new: () => [ + BASE_BREADCRUMB, + { + href: pagePathGetters.live_queries(), + text: i18n.translate('xpack.osquery.breadcrumbs.liveQueriesPageTitle', { + defaultMessage: 'Live queries', + }), + }, + { + text: i18n.translate('xpack.osquery.breadcrumbs.newLiveQueryPageTitle', { + defaultMessage: 'New', + }), + }, + ], + live_query_details: ({ liveQueryId }) => [ + BASE_BREADCRUMB, + { + href: pagePathGetters.live_queries(), + text: i18n.translate('xpack.osquery.breadcrumbs.liveQueriesPageTitle', { + defaultMessage: 'Live queries', + }), + }, + { + text: liveQueryId, + }, + ], + scheduled_query_groups: () => [ + BASE_BREADCRUMB, + { + text: i18n.translate('xpack.osquery.breadcrumbs.scheduledQueryGroupsPageTitle', { + defaultMessage: 'Scheduled query groups', + }), + }, + ], + scheduled_query_group_add: () => [ + BASE_BREADCRUMB, + { + href: pagePathGetters.scheduled_query_groups(), + text: i18n.translate('xpack.osquery.breadcrumbs.scheduledQueryGroupsPageTitle', { + defaultMessage: 'Scheduled query groups', + }), + }, + { + text: i18n.translate('xpack.osquery.breadcrumbs.addScheduledQueryGroupsPageTitle', { + defaultMessage: 'Add', + }), + }, + ], + scheduled_query_group_details: ({ scheduledQueryGroupName }) => [ + BASE_BREADCRUMB, + { + href: pagePathGetters.scheduled_query_groups(), + text: i18n.translate('xpack.osquery.breadcrumbs.scheduledQueryGroupsPageTitle', { + defaultMessage: 'Scheduled query groups', + }), + }, + { + text: scheduledQueryGroupName, + }, + ], + scheduled_query_group_edit: ({ scheduledQueryGroupName, scheduledQueryGroupId }) => [ + BASE_BREADCRUMB, + { + href: pagePathGetters.scheduled_query_groups(), + text: i18n.translate('xpack.osquery.breadcrumbs.scheduledQueryGroupsPageTitle', { + defaultMessage: 'Scheduled query groups', + }), + }, + { + href: pagePathGetters.scheduled_query_group_details({ scheduledQueryGroupId }), + text: scheduledQueryGroupName, + }, + { + text: i18n.translate('xpack.osquery.breadcrumbs.editScheduledQueryGroupsPageTitle', { + defaultMessage: 'Edit', + }), + }, + ], +}; + +export function useBreadcrumbs(page: Page, values: DynamicPagePathValues = {}) { + const { chrome, http } = useKibana().services; + const breadcrumbs: ChromeBreadcrumb[] = + breadcrumbGetters[page]?.(values).map((breadcrumb) => ({ + ...breadcrumb, + href: breadcrumb.href ? http.basePath.prepend(`${BASE_PATH}${breadcrumb.href}`) : undefined, + })) || []; + const docTitle: string[] = [...breadcrumbs] + .reverse() + .map((breadcrumb) => breadcrumb.text as string); + chrome.docTitle.change(docTitle); + chrome.setBreadcrumbs(breadcrumbs); +} diff --git a/x-pack/plugins/osquery/public/common/hooks/use_discover_link.tsx b/x-pack/plugins/osquery/public/common/hooks/use_discover_link.tsx new file mode 100644 index 0000000000000..dd091d80ce62e --- /dev/null +++ b/x-pack/plugins/osquery/public/common/hooks/use_discover_link.tsx @@ -0,0 +1,64 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import { useCallback, useEffect, useState } from 'react'; + +import { FilterStateStore } from '../../../../../../src/plugins/data/common'; +import { useKibana, isModifiedEvent, isLeftClickEvent } from '../lib/kibana'; + +interface UseDiscoverLink { + filters: Array<{ key: string; value: string | number }>; +} + +export const useDiscoverLink = ({ filters }: UseDiscoverLink) => { + const { + application: { navigateToUrl }, + } = useKibana().services; + const urlGenerator = useKibana().services.discover?.urlGenerator; + const [discoverUrl, setDiscoverUrl] = useState(''); + + useEffect(() => { + const getDiscoverUrl = async () => { + if (!urlGenerator?.createUrl) return; + + const newUrl = await urlGenerator.createUrl({ + indexPatternId: 'logs-*', + filters: filters.map((filter) => ({ + meta: { + index: 'logs-*', + alias: null, + negate: false, + disabled: false, + type: 'phrase', + key: filter.key, + params: { query: filter.value }, + }, + query: { match_phrase: { action_id: filter.value } }, + $state: { store: FilterStateStore.APP_STATE }, + })), + }); + setDiscoverUrl(newUrl); + }; + getDiscoverUrl(); + }, [filters, urlGenerator]); + + const onClick = useCallback( + (event: React.MouseEvent) => { + if (!isModifiedEvent(event) && isLeftClickEvent(event) && discoverUrl) { + event.preventDefault(); + + return navigateToUrl(discoverUrl); + } + }, + [discoverUrl, navigateToUrl] + ); + + return { + href: discoverUrl, + onClick, + }; +}; diff --git a/x-pack/plugins/osquery/public/common/hooks/use_osquery_integration.tsx b/x-pack/plugins/osquery/public/common/hooks/use_osquery_integration.tsx new file mode 100644 index 0000000000000..d8bed30b969ad --- /dev/null +++ b/x-pack/plugins/osquery/public/common/hooks/use_osquery_integration.tsx @@ -0,0 +1,31 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import { find } from 'lodash/fp'; +import { useQuery } from 'react-query'; + +import { GetPackagesResponse, epmRouteService } from '../../../../fleet/common'; +import { OSQUERY_INTEGRATION_NAME } from '../../../common'; +import { useKibana } from '../lib/kibana'; + +export const useOsqueryIntegration = () => { + const { http } = useKibana().services; + + return useQuery( + 'integrations', + () => + http.get(epmRouteService.getListPath(), { + query: { + experimental: true, + }, + }), + { + select: ({ response }: GetPackagesResponse) => + find(['name', OSQUERY_INTEGRATION_NAME], response), + } + ); +}; diff --git a/x-pack/plugins/osquery/public/common/lib/kibana/kibana_react.ts b/x-pack/plugins/osquery/public/common/lib/kibana/kibana_react.ts index 63288507b29d4..dc49bfcee6dda 100644 --- a/x-pack/plugins/osquery/public/common/lib/kibana/kibana_react.ts +++ b/x-pack/plugins/osquery/public/common/lib/kibana/kibana_react.ts @@ -5,6 +5,7 @@ * 2.0. */ +import React from 'react'; import { useHistory } from 'react-router-dom'; import { KibanaContextProvider, @@ -24,6 +25,11 @@ export interface WithKibanaProps { const useTypedKibana = () => useKibana(); +const isModifiedEvent = (event: React.MouseEvent) => + !!(event.metaKey || event.altKey || event.ctrlKey || event.shiftKey); + +const isLeftClickEvent = (event: React.MouseEvent) => event.button === 0; + const useRouterNavigate = ( to: Parameters[1], onClickCallback?: Parameters[2] @@ -35,6 +41,8 @@ const useRouterNavigate = ( export { KibanaContextProvider, useRouterNavigate, + isLeftClickEvent, + isModifiedEvent, useTypedKibana as useKibana, useUiSetting, useUiSetting$, diff --git a/x-pack/plugins/osquery/public/common/page_paths.ts b/x-pack/plugins/osquery/public/common/page_paths.ts new file mode 100644 index 0000000000000..b4c7963fb9a02 --- /dev/null +++ b/x-pack/plugins/osquery/public/common/page_paths.ts @@ -0,0 +1,59 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +export type StaticPage = + | 'base' + | 'overview' + | 'live_queries' + | 'live_query_new' + | 'scheduled_query_groups' + | 'scheduled_query_group_add'; + +export type DynamicPage = + | 'live_query_details' + | 'scheduled_query_group_details' + | 'scheduled_query_group_edit'; + +export type Page = StaticPage | DynamicPage; + +export interface DynamicPagePathValues { + [key: string]: string; +} + +export const BASE_PATH = '/app/fleet'; + +// If routing paths are changed here, please also check to see if +// `pagePathGetters()`, below, needs any modifications +export const PAGE_ROUTING_PATHS = { + overview: '/', + live_queries: '/live_queries', + live_query_new: '/live_queries/new', + live_query_details: '/live_queries/:liveQueryId', + scheduled_query_groups: '/scheduled_query_groups', + scheduled_query_group_add: '/scheduled_query_groups/add', + scheduled_query_group_details: '/scheduled_query_groups/:scheduledQueryGroupId', + scheduled_query_group_edit: '/scheduled_query_groups/:scheduledQueryGroupId/edit', +}; + +export const pagePathGetters: { + [key in StaticPage]: () => string; +} & + { + [key in DynamicPage]: (values: DynamicPagePathValues) => string; + } = { + base: () => '/', + overview: () => '/', + live_queries: () => '/live_queries', + live_query_new: () => '/live_queries/new', + live_query_details: ({ liveQueryId }) => `/live_queries/${liveQueryId}`, + scheduled_query_groups: () => '/scheduled_query_groups', + scheduled_query_group_add: () => '/scheduled_query_groups/add', + scheduled_query_group_details: ({ scheduledQueryGroupId }) => + `/scheduled_query_groups/${scheduledQueryGroupId}`, + scheduled_query_group_edit: ({ scheduledQueryGroupId }) => + `/scheduled_query_groups/${scheduledQueryGroupId}/edit`, +}; diff --git a/x-pack/plugins/osquery/public/components/app.tsx b/x-pack/plugins/osquery/public/components/app.tsx index a4a1f51fdd02b..d56aacc99ad53 100644 --- a/x-pack/plugins/osquery/public/components/app.tsx +++ b/x-pack/plugins/osquery/public/components/app.tsx @@ -7,14 +7,15 @@ import React, { useMemo } from 'react'; import { FormattedMessage } from '@kbn/i18n/react'; -import { EuiFlexGroup, EuiFlexItem, EuiTabs, EuiTab } from '@elastic/eui'; +import { EuiButtonEmpty, EuiFlexGroup, EuiFlexItem, EuiTabs, EuiTab } from '@elastic/eui'; import { useLocation } from 'react-router-dom'; import { Container, Nav, Wrapper } from './layouts'; import { OsqueryAppRoutes } from '../routes'; import { useRouterNavigate } from '../common/lib/kibana'; +import { ManageIntegrationLink } from './manage_integration_link'; -export const OsqueryAppComponent = () => { +const OsqueryAppComponent = () => { const location = useLocation(); const section = useMemo(() => location.pathname.split('/')[1] ?? 'overview', [location.pathname]); @@ -25,20 +26,49 @@ export const OsqueryAppComponent = () => { - + {/* + */} + + - + + + + + + + + + + + diff --git a/x-pack/plugins/osquery/public/components/beta_badge.tsx b/x-pack/plugins/osquery/public/components/beta_badge.tsx new file mode 100644 index 0000000000000..f63c80168b487 --- /dev/null +++ b/x-pack/plugins/osquery/public/components/beta_badge.tsx @@ -0,0 +1,37 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import { EuiBetaBadge, EuiText } from '@elastic/eui'; +import { i18n } from '@kbn/i18n'; +import React from 'react'; +import styled from 'styled-components'; + +export const BetaBadgeRowWrapper = styled(EuiText)` + display: flex; + align-items: center; +`; + +const Wrapper = styled.div` + padding-left: ${({ theme }) => theme.eui.paddingSizes.s}; +`; + +const betaBadgeLabel = i18n.translate('xpack.osquery.common.tabBetaBadgeLabel', { + defaultMessage: 'Beta', +}); + +const betaBadgeTooltipContent = i18n.translate('xpack.osquery.common.tabBetaBadgeTooltipContent', { + defaultMessage: + 'This feature is under active development. Extra functionality is coming, and some functionality may change.', +}); + +const BetaBadgeComponent = () => ( + + + +); + +export const BetaBadge = React.memo(BetaBadgeComponent); diff --git a/x-pack/plugins/osquery/public/components/manage_integration_link.tsx b/x-pack/plugins/osquery/public/components/manage_integration_link.tsx new file mode 100644 index 0000000000000..8419003f57715 --- /dev/null +++ b/x-pack/plugins/osquery/public/components/manage_integration_link.tsx @@ -0,0 +1,68 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import React, { useCallback, useMemo } from 'react'; +import { FormattedMessage } from '@kbn/i18n/react'; +import { EuiButtonEmpty, EuiFlexItem } from '@elastic/eui'; + +import { pagePathGetters } from '../../../fleet/public'; + +import { useKibana, isModifiedEvent, isLeftClickEvent } from '../common/lib/kibana'; +import { useOsqueryIntegration } from '../common/hooks'; + +const ManageIntegrationLinkComponent = () => { + const { + application: { getUrlForApp, navigateToApp }, + } = useKibana().services; + const { data: osqueryIntegration } = useOsqueryIntegration(); + + const integrationHref = useMemo(() => { + if (osqueryIntegration) { + return getUrlForApp('fleet', { + path: + '#' + + pagePathGetters.integration_details_policies({ + pkgkey: `${osqueryIntegration.name}-${osqueryIntegration.version}`, + }), + }); + } + }, [getUrlForApp, osqueryIntegration]); + + const integrationClick = useCallback( + (event) => { + if (!isModifiedEvent(event) && isLeftClickEvent(event)) { + event.preventDefault(); + if (osqueryIntegration) { + return navigateToApp('fleet', { + path: + '#' + + pagePathGetters.integration_details_policies({ + pkgkey: `${osqueryIntegration.name}-${osqueryIntegration.version}`, + }), + }); + } + } + }, + [navigateToApp, osqueryIntegration] + ); + + return integrationHref ? ( + + { + // eslint-disable-next-line @elastic/eui/href-or-on-click + + + + } + + ) : null; +}; + +export const ManageIntegrationLink = React.memo(ManageIntegrationLinkComponent); diff --git a/x-pack/plugins/osquery/public/editor/index.tsx b/x-pack/plugins/osquery/public/editor/index.tsx index 4cdb027480f98..70da55ca3f007 100644 --- a/x-pack/plugins/osquery/public/editor/index.tsx +++ b/x-pack/plugins/osquery/public/editor/index.tsx @@ -5,7 +5,7 @@ * 2.0. */ -import React, { useCallback } from 'react'; +import React from 'react'; import { EuiCodeEditor } from '@elastic/eui'; import 'brace/theme/tomorrow'; @@ -22,30 +22,27 @@ const EDITOR_PROPS = { interface OsqueryEditorProps { defaultValue: string; + disabled?: boolean; onChange: (newValue: string) => void; } -const OsqueryEditorComponent: React.FC = ({ defaultValue, onChange }) => { - const handleChange = useCallback( - (newValue) => { - onChange(newValue); - }, - [onChange] - ); - - return ( - - ); -}; +const OsqueryEditorComponent: React.FC = ({ + defaultValue, + // disabled, + onChange, +}) => ( + +); export const OsqueryEditor = React.memo(OsqueryEditorComponent); diff --git a/x-pack/plugins/osquery/public/fleet_integration/components/add_new_query_flyout.tsx b/x-pack/plugins/osquery/public/fleet_integration/components/add_new_query_flyout.tsx deleted file mode 100644 index b02b3d288256e..0000000000000 --- a/x-pack/plugins/osquery/public/fleet_integration/components/add_new_query_flyout.tsx +++ /dev/null @@ -1,68 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. - */ - -/* eslint-disable react/jsx-no-bind */ - -/* eslint-disable react-perf/jsx-no-new-function-as-prop */ - -import { produce } from 'immer'; -import { EuiFlyout, EuiTitle, EuiFlyoutBody, EuiFlyoutHeader, EuiPortal } from '@elastic/eui'; -import React from 'react'; - -import { AddPackQueryForm } from '../../packs/common/add_pack_query'; - -// @ts-expect-error update types -export const AddNewQueryFlyout = ({ data, handleChange, onClose }) => { - // @ts-expect-error update types - const handleSubmit = (payload) => { - // @ts-expect-error update types - const updatedPolicy = produce(data, (draft) => { - draft.inputs[0].streams.push({ - data_stream: { - type: 'logs', - dataset: 'osquery_elastic_managed.osquery', - }, - vars: { - query: { - type: 'text', - value: payload.query.attributes.query, - }, - interval: { - type: 'text', - value: `${payload.interval}`, - }, - id: { - type: 'text', - value: payload.query.id, - }, - }, - enabled: true, - }); - }); - - onClose(); - handleChange({ - isValid: true, - updatedPolicy, - }); - }; - - return ( - - - - -

    Attach next query

    -
    -
    - - - -
    -
    - ); -}; diff --git a/x-pack/plugins/osquery/public/fleet_integration/components/custom_tab_tabs.tsx b/x-pack/plugins/osquery/public/fleet_integration/components/custom_tab_tabs.tsx deleted file mode 100644 index 9d2df5bbb0960..0000000000000 --- a/x-pack/plugins/osquery/public/fleet_integration/components/custom_tab_tabs.tsx +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. - */ - -import React, { useMemo } from 'react'; -import { useLocation } from 'react-router-dom'; -import qs from 'query-string'; - -import { Queries } from '../../queries'; -import { Packs } from '../../packs'; -import { LiveQuery } from '../../live_query'; - -const CustomTabTabsComponent = () => { - const location = useLocation(); - - const selectedTab = useMemo(() => qs.parse(location.search)?.tab, [location.search]); - - if (selectedTab === 'packs') { - return ; - } - - if (selectedTab === 'saved_queries') { - return ; - } - - if (selectedTab === 'live_query') { - return ; - } - - return ; -}; - -export const CustomTabTabs = React.memo(CustomTabTabsComponent); diff --git a/x-pack/plugins/osquery/public/fleet_integration/components/form.tsx b/x-pack/plugins/osquery/public/fleet_integration/components/form.tsx deleted file mode 100644 index bb9bf066a9f92..0000000000000 --- a/x-pack/plugins/osquery/public/fleet_integration/components/form.tsx +++ /dev/null @@ -1,240 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. - */ - -/* eslint-disable @typescript-eslint/naming-convention */ - -import produce from 'immer'; -import { find } from 'lodash/fp'; -import { EuiSpacer, EuiText, EuiHorizontalRule, EuiSuperSelect } from '@elastic/eui'; -import React, { useCallback, useMemo } from 'react'; -import deepEqual from 'fast-deep-equal'; -import { useQuery } from 'react-query'; - -import { - // UseField, - useForm, - useFormData, - UseArray, - getUseField, - Field, - ToggleField, - Form, -} from '../../shared_imports'; - -// import { OsqueryStreamField } from '../../scheduled_query/common/osquery_stream_field'; -import { useKibana } from '../../common/lib/kibana'; -import { ScheduledQueryQueriesTable } from './scheduled_queries_table'; -import { schema } from './schema'; - -const CommonUseField = getUseField({ component: Field }); - -const EDIT_SCHEDULED_QUERY_FORM_ID = 'editScheduledQueryForm'; - -interface EditScheduledQueryFormProps { - // eslint-disable-next-line @typescript-eslint/no-explicit-any - data: Array>; - handleSubmit: () => Promise; -} - -const EditScheduledQueryFormComponent: React.FC = ({ - data, - handleSubmit, -}) => { - const { http } = useKibana().services; - - const { - data: { saved_objects: packs } = { - saved_objects: [], - }, - } = useQuery('packs', () => http.get('/internal/osquery/pack')); - - const { form } = useForm({ - id: EDIT_SCHEDULED_QUERY_FORM_ID, - onSubmit: handleSubmit, - schema, - defaultValue: data, - options: { - stripEmptyFields: false, - }, - // @ts-expect-error update types - deserializer: (payload) => { - const deserialized = produce(payload, (draft) => { - // @ts-expect-error update types - draft.streams = draft.inputs[0].streams.map(({ data_stream, enabled, vars }) => ({ - data: { - data_stream, - enabled, - vars, - }, - })); - }); - - return deserialized; - }, - // @ts-expect-error update types - serializer: (payload) => { - const serialized = produce(payload, (draft) => { - // @ts-expect-error update types - if (draft.inputs) { - // @ts-expect-error update types - draft.inputs[0].config = { - pack: { - type: 'id', - value: 'e33f5f30-705e-11eb-9e99-9f6b4d0d9506', - }, - }; - // @ts-expect-error update types - draft.inputs[0].type = 'osquery'; - // @ts-expect-error update types - draft.inputs[0].streams = draft.inputs[0].streams?.map((stream) => stream.data) ?? []; - } - }); - - return serialized; - }, - }); - - const { setFieldValue } = form; - - const handlePackChange = useCallback( - (value) => { - const newPack = find(['id', value], packs); - - setFieldValue( - 'streams', - // @ts-expect-error update types - newPack.queries.map((packQuery, index) => ({ - id: index, - isNew: true, - path: `streams[${index}]`, - data: { - data_stream: { - type: 'logs', - dataset: 'osquery_elastic_managed.osquery', - }, - id: 'osquery-osquery_elastic_managed.osquery-7065c2dc-f835-4d13-9486-6eec515f39bd', - vars: { - query: { - type: 'text', - value: packQuery.query, - }, - interval: { - type: 'text', - value: `${packQuery.interval}`, - }, - id: { - type: 'text', - value: packQuery.id, - }, - }, - enabled: true, - }, - })) - ); - }, - [packs, setFieldValue] - ); - - const [formData] = useFormData({ form, watch: ['streams'] }); - - const scheduledQueries = useMemo(() => { - if (formData.inputs) { - // @ts-expect-error update types - return formData.streams.reduce((acc, stream) => { - if (!stream.data) { - return acc; - } - - return [...acc, stream.data]; - }, []); - } - - return []; - }, [formData]); - - return ( -
    - ({ - value: pack.id, - inputDisplay: ( - <> - {pack.name} - -

    {pack.description}

    -
    - - ), - }))} - valueOfSelected={packs[0]?.id} - onChange={handlePackChange} - /> - - - - - - { - // eslint-disable-next-line @typescript-eslint/no-unused-vars - ({ items, form: streamsForm, addItem, removeItem }) => { - return ( - <> - {/* {items.map((item) => { - return ( - removeItem(item.id)} - // readDefaultValueOnForm={true} - defaultValue={ - item.isNew - ? // eslint-disable-next-line react-perf/jsx-no-new-object-as-prop - { - data_stream: { - type: 'logs', - dataset: 'osquery_elastic_managed.osquery', - }, - vars: { - query: { - type: 'text', - value: 'select * from uptime', - }, - interval: { - type: 'text', - value: '120', - }, - id: { - type: 'text', - value: uuid.v4(), - }, - }, - enabled: true, - } - : get(item.path, streamsForm.getFormData()) - } - /> - ); - })} */} - {/* - {'Add query'} - */} - - ); - } - } - - - ); -}; - -export const EditScheduledQueryForm = React.memo( - EditScheduledQueryFormComponent, - (prevProps, nextProps) => deepEqual(prevProps.data, nextProps.data) -); diff --git a/x-pack/plugins/osquery/public/fleet_integration/components/input_stream_form.tsx b/x-pack/plugins/osquery/public/fleet_integration/components/input_stream_form.tsx deleted file mode 100644 index 34508c93e73bd..0000000000000 --- a/x-pack/plugins/osquery/public/fleet_integration/components/input_stream_form.tsx +++ /dev/null @@ -1,69 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. - */ - -import React from 'react'; - -import { useForm, Form, getUseField, Field, FIELD_TYPES } from '../../shared_imports'; - -const CommonUseField = getUseField({ component: Field }); - -const FORM_ID = 'inputStreamForm'; - -const schema = { - data_stream: { - dataset: { - type: FIELD_TYPES.TEXT, - }, - type: { - type: FIELD_TYPES.TEXT, - }, - }, - enabled: { - type: FIELD_TYPES.TOGGLE, - label: 'Active', - }, - id: { - type: FIELD_TYPES.TEXT, - }, - vars: { - id: { - type: { - type: FIELD_TYPES.TEXT, - }, - value: { type: FIELD_TYPES.TEXT }, - }, - interval: { - type: { - type: FIELD_TYPES.TEXT, - }, - value: { type: FIELD_TYPES.TEXT }, - }, - query: { - type: { - type: FIELD_TYPES.TEXT, - }, - value: { type: FIELD_TYPES.TEXT }, - }, - }, -}; - -// @ts-expect-error update types -const InputStreamFormComponent = ({ data }) => { - const { form } = useForm({ - id: FORM_ID, - schema, - defaultValue: data, - }); - - return ( -
    - - - ); -}; - -export const InputStreamForm = React.memo(InputStreamFormComponent); diff --git a/x-pack/plugins/osquery/public/fleet_integration/components/input_type.tsx b/x-pack/plugins/osquery/public/fleet_integration/components/input_type.tsx deleted file mode 100644 index 4a4e2a799ae42..0000000000000 --- a/x-pack/plugins/osquery/public/fleet_integration/components/input_type.tsx +++ /dev/null @@ -1,64 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. - */ - -/* eslint-disable react-perf/jsx-no-new-object-as-prop */ - -/* eslint-disable react-perf/jsx-no-new-array-as-prop */ - -import React, { useCallback } from 'react'; -import produce from 'immer'; -import { EuiRadioGroup } from '@elastic/eui'; - -// @ts-expect-error update types -export const ScheduledQueryInputType = ({ data, handleChange }) => { - const radios = [ - { - id: 'pack', - label: 'Pack', - }, - { - id: 'saved_queries', - label: 'Saved queries', - }, - ]; - - const onChange = useCallback( - (optionId: string) => { - // @ts-expect-error update types - const updatedPolicy = produce(data, (draft) => { - if (!draft.inputs[0].config) { - draft.inputs[0].config = { - input_source: { - type: 'text', - value: optionId, - }, - }; - } else { - draft.inputs[0].config.input_source.value = optionId; - } - }); - - handleChange({ - isValid: true, - updatedPolicy, - }); - }, - [data, handleChange] - ); - - return ( - {'Choose input type'}, - }} - /> - ); -}; diff --git a/x-pack/plugins/osquery/public/fleet_integration/components/navigation.tsx b/x-pack/plugins/osquery/public/fleet_integration/components/navigation.tsx deleted file mode 100644 index 5f5d5c0c8b546..0000000000000 --- a/x-pack/plugins/osquery/public/fleet_integration/components/navigation.tsx +++ /dev/null @@ -1,92 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. - */ - -import { snakeCase } from 'lodash/fp'; -import { EuiIcon, EuiSideNav } from '@elastic/eui'; -import React, { useCallback, useMemo } from 'react'; -import { useHistory, useLocation } from 'react-router-dom'; -import qs from 'query-string'; - -export const Navigation = () => { - const { push } = useHistory(); - const location = useLocation(); - - const selectedItemName = useMemo(() => qs.parse(location.search)?.tab, [location.search]); - - const handleTabClick = useCallback( - (tab) => { - push({ - search: qs.stringify({ tab }), - }); - }, - [push] - ); - - const createItem = useCallback( - (name, data = {}) => ({ - ...data, - id: snakeCase(name), - name, - isSelected: selectedItemName === name, - onClick: () => handleTabClick(snakeCase(name)), - }), - [handleTabClick, selectedItemName] - ); - - const sideNav = useMemo( - () => [ - createItem('Packs', { - forceOpen: true, - items: [ - createItem('List', { - icon: , - }), - createItem('New pack', { - icon: , - }), - ], - }), - createItem('Saved Queries', { - forceOpen: true, - items: [ - createItem('List', { - icon: , - }), - createItem('New query', { - icon: , - }), - ], - }), - // createItem('Scheduled Queries', { - // forceOpen: true, - // items: [ - // createItem('List', { - // icon: , - // }), - // createItem('Schedule new query', { - // icon: , - // }), - // ], - // }), - createItem('Live Query', { - forceOpen: true, - items: [ - createItem('Run', { - icon: , - }), - createItem('History', { - icon: , - }), - ], - }), - ], - [createItem] - ); - - // eslint-disable-next-line react-perf/jsx-no-new-object-as-prop - return ; -}; diff --git a/x-pack/plugins/osquery/public/fleet_integration/components/pack_selector.tsx b/x-pack/plugins/osquery/public/fleet_integration/components/pack_selector.tsx deleted file mode 100644 index 7d3f7debace72..0000000000000 --- a/x-pack/plugins/osquery/public/fleet_integration/components/pack_selector.tsx +++ /dev/null @@ -1,87 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. - */ - -/* eslint-disable react/jsx-no-bind */ - -/* eslint-disable react-perf/jsx-no-new-function-as-prop */ - -import { find } from 'lodash/fp'; -import { produce } from 'immer'; -import { EuiText, EuiSuperSelect } from '@elastic/eui'; -import React from 'react'; -import { useQuery } from 'react-query'; - -import { useKibana } from '../../common/lib/kibana'; - -// @ts-expect-error update types -export const ScheduledQueryPackSelector = ({ data, handleChange }) => { - const { http } = useKibana().services; - const { - data: { saved_objects: packs } = { - saved_objects: [], - }, - } = useQuery('packs', () => http.get('/internal/osquery/pack')); - - // @ts-expect-error update types - const handlePackChange = (value) => { - const newPack = find(['id', value], packs); - - // @ts-expect-error update types - const updatedPolicy = produce(data, (draft) => { - draft.inputs[0].config.pack = { - type: 'text', - value: newPack.id, - }; - // @ts-expect-error update types - draft.inputs[0].streams = newPack.queries.map((packQuery) => ({ - data_stream: { - type: 'logs', - dataset: 'osquery_elastic_managed.osquery', - }, - vars: { - query: { - type: 'text', - value: packQuery.query, - }, - interval: { - type: 'text', - value: `${packQuery.interval}`, - }, - id: { - type: 'text', - value: packQuery.id, - }, - }, - enabled: true, - })); - }); - - handleChange({ - isValid: true, - updatedPolicy, - }); - }; - - return ( - ({ - value: pack.id, - inputDisplay: ( - <> - {pack.name} - -

    {pack.description}

    -
    - - ), - }))} - valueOfSelected={data.inputs[0].config} - onChange={handlePackChange} - /> - ); -}; diff --git a/x-pack/plugins/osquery/public/fleet_integration/components/scheduled_queries_table.tsx b/x-pack/plugins/osquery/public/fleet_integration/components/scheduled_queries_table.tsx deleted file mode 100644 index 67a94ec518d60..0000000000000 --- a/x-pack/plugins/osquery/public/fleet_integration/components/scheduled_queries_table.tsx +++ /dev/null @@ -1,142 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. - */ - -/* eslint-disable react-perf/jsx-no-new-function-as-prop */ - -/* eslint-disable react/jsx-no-bind */ - -/* eslint-disable react-perf/jsx-no-new-object-as-prop */ - -/* eslint-disable react/display-name */ - -/* eslint-disable react-perf/jsx-no-new-array-as-prop */ - -import React, { useState } from 'react'; -import { - EuiBasicTable, - EuiButtonIcon, - EuiHealth, - EuiDescriptionList, - RIGHT_ALIGNMENT, -} from '@elastic/eui'; - -// @ts-expect-error update types -export const ScheduledQueryQueriesTable = ({ data }) => { - const [pageIndex, setPageIndex] = useState(0); - const [pageSize, setPageSize] = useState(5); - const [sortField, setSortField] = useState('firstName'); - const [sortDirection, setSortDirection] = useState('asc'); - const [itemIdToExpandedRowMap, setItemIdToExpandedRowMap] = useState({}); - - const onTableChange = ({ page = {}, sort = {} }) => { - // @ts-expect-error update types - const { index, size } = page; - // @ts-expect-error update types - const { field, direction } = sort; - - setPageIndex(index); - setPageSize(size); - setSortField(field); - setSortDirection(direction); - }; - - // @ts-expect-error update types - const toggleDetails = (item) => { - const itemIdToExpandedRowMapValues = { ...itemIdToExpandedRowMap }; - // @ts-expect-error update types - if (itemIdToExpandedRowMapValues[item.id]) { - // @ts-expect-error update types - delete itemIdToExpandedRowMapValues[item.id]; - } else { - const { online } = item; - const color = online ? 'success' : 'danger'; - const label = online ? 'Online' : 'Offline'; - const listItems = [ - { - title: 'Online', - description: {label}, - }, - ]; - // @ts-expect-error update types - itemIdToExpandedRowMapValues[item.id] = ; - } - setItemIdToExpandedRowMap(itemIdToExpandedRowMapValues); - }; - - const columns = [ - { - field: 'vars.id.value', - name: 'ID', - }, - { - field: 'vars.interval.value', - name: 'Interval', - }, - { - field: 'enabled', - name: 'Active', - }, - { - name: 'Actions', - actions: [ - { - name: 'Clone', - description: 'Clone this person', - type: 'icon', - icon: 'copy', - onClick: () => '', - }, - ], - }, - { - align: RIGHT_ALIGNMENT, - width: '40px', - isExpander: true, - // @ts-expect-error update types - render: (item) => ( - toggleDetails(item)} - // @ts-expect-error update types - aria-label={itemIdToExpandedRowMap[item.id] ? 'Collapse' : 'Expand'} - // @ts-expect-error update types - iconType={itemIdToExpandedRowMap[item.id] ? 'arrowUp' : 'arrowDown'} - /> - ), - }, - ]; - - const pagination = { - pageIndex, - pageSize, - totalItemCount: data.inputs[0].streams.length, - pageSizeOptions: [3, 5, 8], - }; - - const sorting = { - sort: { - field: sortField, - direction: sortDirection, - }, - }; - - return ( - - ); -}; diff --git a/x-pack/plugins/osquery/public/fleet_integration/components/schema.ts b/x-pack/plugins/osquery/public/fleet_integration/components/schema.ts deleted file mode 100644 index 9a59c443b0a50..0000000000000 --- a/x-pack/plugins/osquery/public/fleet_integration/components/schema.ts +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. - */ - -import { FIELD_TYPES } from '../../shared_imports'; - -export const schema = { - name: { - type: FIELD_TYPES.TEXT, - label: 'Name', - }, - description: { - type: FIELD_TYPES.TEXT, - label: 'Description', - }, - namespace: { - type: FIELD_TYPES.TEXT, - }, - enabled: { - type: FIELD_TYPES.TOGGLE, - }, - policy_id: { - type: FIELD_TYPES.TEXT, - }, - streams: { - type: FIELD_TYPES.MULTI_SELECT, - vars: { - query: { - type: { - type: FIELD_TYPES.TEXT, - }, - value: { - type: FIELD_TYPES.TEXT, - }, - }, - }, - }, -}; diff --git a/x-pack/plugins/osquery/public/fleet_integration/index.ts b/x-pack/plugins/osquery/public/fleet_integration/index.ts index b36a2698b8337..e27c2712c7d8c 100644 --- a/x-pack/plugins/osquery/public/fleet_integration/index.ts +++ b/x-pack/plugins/osquery/public/fleet_integration/index.ts @@ -5,8 +5,6 @@ * 2.0. */ -export * from './lazy_osquery_managed_empty_create_policy_extension'; -export * from './lazy_osquery_managed_empty_edit_policy_extension'; -export * from './lazy_osquery_managed_policy_create_extension'; +export * from './lazy_osquery_managed_policy_create_import_extension'; export * from './lazy_osquery_managed_policy_edit_extension'; -export * from './lazy_osquery_managed_custom_extension'; +export * from './lazy_osquery_managed_custom_button_extension'; diff --git a/x-pack/plugins/osquery/public/fleet_integration/lazy_osquery_managed_custom_extension.tsx b/x-pack/plugins/osquery/public/fleet_integration/lazy_osquery_managed_custom_button_extension.tsx similarity index 53% rename from x-pack/plugins/osquery/public/fleet_integration/lazy_osquery_managed_custom_extension.tsx rename to x-pack/plugins/osquery/public/fleet_integration/lazy_osquery_managed_custom_button_extension.tsx index 1493182cdbaa6..e547686c0166b 100644 --- a/x-pack/plugins/osquery/public/fleet_integration/lazy_osquery_managed_custom_extension.tsx +++ b/x-pack/plugins/osquery/public/fleet_integration/lazy_osquery_managed_custom_button_extension.tsx @@ -8,9 +8,13 @@ import { lazy } from 'react'; import { PackageCustomExtensionComponent } from '../../../fleet/public'; -export const LazyOsqueryManagedCustomExtension = lazy(async () => { - const { OsqueryManagedCustomExtension } = await import('./osquery_managed_custom_extension'); - return { - default: OsqueryManagedCustomExtension, - }; -}); +export const LazyOsqueryManagedCustomButtonExtension = lazy( + async () => { + const { OsqueryManagedCustomButtonExtension } = await import( + './osquery_managed_custom_button_extension' + ); + return { + default: OsqueryManagedCustomButtonExtension, + }; + } +); diff --git a/x-pack/plugins/osquery/public/fleet_integration/lazy_osquery_managed_empty_edit_policy_extension.tsx b/x-pack/plugins/osquery/public/fleet_integration/lazy_osquery_managed_empty_edit_policy_extension.tsx deleted file mode 100644 index 3f9ef42e97104..0000000000000 --- a/x-pack/plugins/osquery/public/fleet_integration/lazy_osquery_managed_empty_edit_policy_extension.tsx +++ /dev/null @@ -1,20 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. - */ - -import { lazy } from 'react'; -import { PackagePolicyEditExtensionComponent } from '../../../fleet/public'; - -export const LazyOsqueryManagedEmptyEditPolicyExtension = lazy( - async () => { - const { OsqueryManagedEmptyEditPolicyExtension } = await import( - './osquery_managed_empty_edit_policy_extension' - ); - return { - default: OsqueryManagedEmptyEditPolicyExtension, - }; - } -); diff --git a/x-pack/plugins/osquery/public/fleet_integration/lazy_osquery_managed_policy_create_extension.tsx b/x-pack/plugins/osquery/public/fleet_integration/lazy_osquery_managed_policy_create_import_extension.tsx similarity index 58% rename from x-pack/plugins/osquery/public/fleet_integration/lazy_osquery_managed_policy_create_extension.tsx rename to x-pack/plugins/osquery/public/fleet_integration/lazy_osquery_managed_policy_create_import_extension.tsx index 8f0726fdbe209..95220e8251707 100644 --- a/x-pack/plugins/osquery/public/fleet_integration/lazy_osquery_managed_policy_create_extension.tsx +++ b/x-pack/plugins/osquery/public/fleet_integration/lazy_osquery_managed_policy_create_import_extension.tsx @@ -8,13 +8,13 @@ import { lazy } from 'react'; import { PackagePolicyCreateExtensionComponent } from '../../../fleet/public'; -export const LazyOsqueryManagedPolicyCreateExtension = lazy( +export const LazyOsqueryManagedPolicyCreateImportExtension = lazy( async () => { - const { OsqueryManagedPolicyCreateExtension } = await import( - './osquery_managed_policy_create_extension' + const { OsqueryManagedPolicyCreateImportExtension } = await import( + './osquery_managed_policy_create_import_extension' ); return { - default: OsqueryManagedPolicyCreateExtension, + default: OsqueryManagedPolicyCreateImportExtension, }; } ); diff --git a/x-pack/plugins/osquery/public/fleet_integration/lazy_osquery_managed_policy_edit_extension.tsx b/x-pack/plugins/osquery/public/fleet_integration/lazy_osquery_managed_policy_edit_extension.tsx index 4289bcccdbc56..787a39f3a34b7 100644 --- a/x-pack/plugins/osquery/public/fleet_integration/lazy_osquery_managed_policy_edit_extension.tsx +++ b/x-pack/plugins/osquery/public/fleet_integration/lazy_osquery_managed_policy_edit_extension.tsx @@ -10,11 +10,11 @@ import { PackagePolicyEditExtensionComponent } from '../../../fleet/public'; export const LazyOsqueryManagedPolicyEditExtension = lazy( async () => { - const { OsqueryManagedPolicyCreateExtension } = await import( - './osquery_managed_policy_create_extension' + const { OsqueryManagedPolicyCreateImportExtension } = await import( + './osquery_managed_policy_create_import_extension' ); return { - default: OsqueryManagedPolicyCreateExtension, + default: OsqueryManagedPolicyCreateImportExtension, }; } ); diff --git a/x-pack/plugins/osquery/public/fleet_integration/navigation_buttons.tsx b/x-pack/plugins/osquery/public/fleet_integration/navigation_buttons.tsx new file mode 100644 index 0000000000000..808718c55d199 --- /dev/null +++ b/x-pack/plugins/osquery/public/fleet_integration/navigation_buttons.tsx @@ -0,0 +1,105 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import { EuiFlexGroup, EuiFlexItem, EuiCard, EuiIcon } from '@elastic/eui'; +import { i18n } from '@kbn/i18n'; +import React, { useCallback, useMemo } from 'react'; + +import { useKibana, isModifiedEvent, isLeftClickEvent } from '../common/lib/kibana'; + +interface NavigationButtonsProps { + isDisabled?: boolean; + integrationPolicyId?: string; + agentPolicyId?: string; +} + +const NavigationButtonsComponent: React.FC = ({ + isDisabled, + integrationPolicyId, + agentPolicyId, +}) => { + const { + application: { getUrlForApp, navigateToApp }, + } = useKibana().services; + + const liveQueryHref = useMemo( + () => + getUrlForApp('osquery', { + path: agentPolicyId + ? `/live_queries/new?agentPolicyId=${agentPolicyId}` + : ' `/live_queries/new', + }), + [agentPolicyId, getUrlForApp] + ); + + const liveQueryClick = useCallback( + (event) => { + if (!isModifiedEvent(event) && isLeftClickEvent(event)) { + event.preventDefault(); + navigateToApp('osquery', { + path: agentPolicyId + ? `/live_queries/new?agentPolicyId=${agentPolicyId}` + : ' `/live_queries/new', + }); + } + }, + [agentPolicyId, navigateToApp] + ); + + const scheduleQueryGroupsHref = getUrlForApp('osquery', { + path: integrationPolicyId + ? `/scheduled_query_groups/${integrationPolicyId}/edit` + : `/scheduled_query_groups`, + }); + + const scheduleQueryGroupsClick = useCallback( + (event) => { + if (!isModifiedEvent(event) && isLeftClickEvent(event)) { + event.preventDefault(); + navigateToApp('osquery', { + path: integrationPolicyId + ? `/scheduled_query_groups/${integrationPolicyId}/edit` + : `/scheduled_query_groups`, + }); + } + }, + [navigateToApp, integrationPolicyId] + ); + + return ( + + + } + title={i18n.translate('xpack.osquery.fleetIntegration.runLiveQueriesButtonText', { + defaultMessage: 'Run live queries', + })} + href={liveQueryHref} + onClick={liveQueryClick} + description={''} + isDisabled={isDisabled} + /> + + + } + title={i18n.translate('xpack.osquery.fleetIntegration.scheduleQueryGroupsButtonText', { + defaultMessage: 'Schedule query groups', + })} + description={''} + isDisabled={isDisabled} + href={scheduleQueryGroupsHref} + onClick={scheduleQueryGroupsClick} + /> + + + ); +}; + +NavigationButtonsComponent.displayName = 'NavigationButtonsComponent'; + +export const NavigationButtons = React.memo(NavigationButtonsComponent); diff --git a/x-pack/plugins/osquery/public/fleet_integration/osquery_managed_custom_button_extension.tsx b/x-pack/plugins/osquery/public/fleet_integration/osquery_managed_custom_button_extension.tsx new file mode 100644 index 0000000000000..775b5c7a06d21 --- /dev/null +++ b/x-pack/plugins/osquery/public/fleet_integration/osquery_managed_custom_button_extension.tsx @@ -0,0 +1,20 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import React from 'react'; + +import { PackageCustomExtensionComponentProps } from '../../../fleet/public'; +import { NavigationButtons } from './navigation_buttons'; + +/** + * Exports Osquery-specific package policy instructions + * for use in the Fleet app custom tab + */ +export const OsqueryManagedCustomButtonExtension = React.memo( + () => +); +OsqueryManagedCustomButtonExtension.displayName = 'OsqueryManagedCustomButtonExtension'; diff --git a/x-pack/plugins/osquery/public/fleet_integration/osquery_managed_custom_extension.tsx b/x-pack/plugins/osquery/public/fleet_integration/osquery_managed_custom_extension.tsx deleted file mode 100644 index 1295699a270a5..0000000000000 --- a/x-pack/plugins/osquery/public/fleet_integration/osquery_managed_custom_extension.tsx +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. - */ - -import { EuiFlexGroup, EuiFlexItem } from '@elastic/eui'; -import React from 'react'; -import { QueryClient, QueryClientProvider } from 'react-query'; - -import { PackageCustomExtensionComponentProps } from '../../../fleet/public'; -import { CustomTabTabs } from './components/custom_tab_tabs'; -import { Navigation } from './components/navigation'; - -const queryClient = new QueryClient(); - -/** - * Exports Osquery-specific package policy instructions - * for use in the Fleet app custom tab - */ -export const OsqueryManagedCustomExtension = React.memo( - () => ( - - - - - - - - - - - ) -); -OsqueryManagedCustomExtension.displayName = 'OsqueryManagedCustomExtension'; diff --git a/x-pack/plugins/osquery/public/fleet_integration/osquery_managed_empty_create_policy_extension.tsx b/x-pack/plugins/osquery/public/fleet_integration/osquery_managed_empty_create_policy_extension.tsx deleted file mode 100644 index 828edfc0a29b4..0000000000000 --- a/x-pack/plugins/osquery/public/fleet_integration/osquery_managed_empty_create_policy_extension.tsx +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. - */ - -import React, { useEffect } from 'react'; -import { produce } from 'immer'; -import deepEqual from 'fast-deep-equal'; - -import { PackagePolicyCreateExtensionComponentProps } from '../../../fleet/public'; - -/** - * Exports Osquery-specific package policy instructions - * for use in the Fleet app create / edit package policy - */ -const OsqueryManagedEmptyCreatePolicyExtensionComponent: React.FC = ({ - onChange, - newPolicy, -}) => { - useEffect(() => { - const updatedPolicy = produce(newPolicy, (draft) => { - draft.inputs.forEach((input) => (input.streams = [])); - }); - - onChange({ - isValid: true, - updatedPolicy, - }); - }); - - return <>; -}; - -OsqueryManagedEmptyCreatePolicyExtensionComponent.displayName = - 'OsqueryManagedEmptyCreatePolicyExtension'; - -export const OsqueryManagedEmptyCreatePolicyExtension = React.memo( - OsqueryManagedEmptyCreatePolicyExtensionComponent, - // we don't want to update the component if onChange has changed - (prevProps, nextProps) => deepEqual(prevProps.newPolicy, nextProps.newPolicy) -); diff --git a/x-pack/plugins/osquery/public/fleet_integration/osquery_managed_empty_edit_policy_extension.tsx b/x-pack/plugins/osquery/public/fleet_integration/osquery_managed_empty_edit_policy_extension.tsx deleted file mode 100644 index c8304ea5f0d1e..0000000000000 --- a/x-pack/plugins/osquery/public/fleet_integration/osquery_managed_empty_edit_policy_extension.tsx +++ /dev/null @@ -1,23 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. - */ - -import React from 'react'; - -import { PackagePolicyEditExtensionComponentProps } from '../../../fleet/public'; - -/** - * Exports Osquery-specific package policy instructions - * for use in the Fleet app edit package policy - */ -const OsqueryManagedEmptyEditPolicyExtensionComponent = () => <>; - -OsqueryManagedEmptyEditPolicyExtensionComponent.displayName = - 'OsqueryManagedEmptyEditPolicyExtension'; - -export const OsqueryManagedEmptyEditPolicyExtension = React.memo( - OsqueryManagedEmptyEditPolicyExtensionComponent -); diff --git a/x-pack/plugins/osquery/public/fleet_integration/osquery_managed_policy_create_extension.tsx b/x-pack/plugins/osquery/public/fleet_integration/osquery_managed_policy_create_extension.tsx deleted file mode 100644 index 09653b09365ce..0000000000000 --- a/x-pack/plugins/osquery/public/fleet_integration/osquery_managed_policy_create_extension.tsx +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. - */ - -import { EuiButton } from '@elastic/eui'; -import React, { useCallback, useState } from 'react'; -import { QueryClient, QueryClientProvider } from 'react-query'; - -import { PackagePolicyCreateExtensionComponentProps } from '../../../fleet/public'; -import { ScheduledQueryInputType } from './components/input_type'; -import { ScheduledQueryPackSelector } from './components/pack_selector'; -import { ScheduledQueryQueriesTable } from './components/scheduled_queries_table'; -import { AddNewQueryFlyout } from './components/add_new_query_flyout'; - -const queryClient = new QueryClient(); - -/** - * Exports Osquery-specific package policy instructions - * for use in the Fleet app create / edit package policy - */ -export const OsqueryManagedPolicyCreateExtension = React.memo( - ({ onChange, newPolicy }) => { - const [showAddQueryFlyout, setShowAddQueryFlyout] = useState(false); - - const handleShowFlyout = useCallback(() => setShowAddQueryFlyout(true), []); - const handleHideFlyout = useCallback(() => setShowAddQueryFlyout(false), []); - - return ( - - - {newPolicy.inputs[0].config?.input_source?.value === 'pack' && ( - - )} - {newPolicy.inputs[0].streams.length && ( - // @ts-expect-error update types - - )} - {newPolicy.inputs[0].config?.input_source?.value !== 'pack' && ( - - {'Attach next query'} - - )} - {showAddQueryFlyout && ( - - )} - - ); - } -); -OsqueryManagedPolicyCreateExtension.displayName = 'OsqueryManagedPolicyCreateExtension'; diff --git a/x-pack/plugins/osquery/public/fleet_integration/osquery_managed_policy_create_import_extension.tsx b/x-pack/plugins/osquery/public/fleet_integration/osquery_managed_policy_create_import_extension.tsx new file mode 100644 index 0000000000000..3b99e1d46855f --- /dev/null +++ b/x-pack/plugins/osquery/public/fleet_integration/osquery_managed_policy_create_import_extension.tsx @@ -0,0 +1,202 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import { filter } from 'lodash/fp'; +import { EuiFlexGroup, EuiFlexItem, EuiSpacer, EuiCallOut, EuiLink } from '@elastic/eui'; +import React, { useEffect, useMemo, useState } from 'react'; +import { useHistory } from 'react-router-dom'; +import { produce } from 'immer'; + +import { i18n } from '@kbn/i18n'; +import { + agentRouteService, + agentPolicyRouteService, + PackagePolicy, + AgentPolicy, +} from '../../../fleet/common'; +import { + pagePathGetters, + CreatePackagePolicyRouteState, + PackagePolicyCreateExtensionComponentProps, + PackagePolicyEditExtensionComponentProps, +} from '../../../fleet/public'; +import { ScheduledQueryGroupQueriesTable } from '../scheduled_query_groups/scheduled_query_group_queries_table'; +import { useKibana } from '../common/lib/kibana'; +import { NavigationButtons } from './navigation_buttons'; + +/** + * Exports Osquery-specific package policy instructions + * for use in the Fleet app create / edit package policy + */ + +export const OsqueryManagedPolicyCreateImportExtension = React.memo< + PackagePolicyCreateExtensionComponentProps & { + policy?: PackagePolicyEditExtensionComponentProps['policy']; + } +>(({ onChange, policy, newPolicy }) => { + const [policyAgentsCount, setPolicyAgentsCount] = useState(null); + const [agentPolicy, setAgentPolicy] = useState(null); + const [editMode] = useState(!!policy); + const { + application: { getUrlForApp }, + http, + } = useKibana().services; + const { replace } = useHistory(); + + const agentsLinkHref = useMemo(() => { + if (!policy?.policy_id) return '#'; + + return getUrlForApp('fleet', { + path: + `#` + + pagePathGetters.policy_details({ policyId: policy?.policy_id }) + + '?openEnrollmentFlyout=true', + }); + }, [getUrlForApp, policy?.policy_id]); + + useEffect(() => { + if (editMode && policyAgentsCount === null) { + const fetchAgentsCount = async () => { + try { + const response = await http.fetch(agentRouteService.getStatusPath(), { + query: { + policyId: policy?.policy_id, + }, + }); + if (response.results) { + setPolicyAgentsCount(response.results.total); + } + // eslint-disable-next-line no-empty + } catch (e) {} + }; + + const fetchAgentPolicyDetails = async () => { + if (policy?.policy_id) { + try { + const response = await http.fetch( + agentPolicyRouteService.getInfoPath(policy?.policy_id) + ); + if (response.item) { + setAgentPolicy(response.item); + } + // eslint-disable-next-line no-empty + } catch (e) {} + } + }; + + fetchAgentsCount(); + fetchAgentPolicyDetails(); + } + }, [editMode, http, policy?.policy_id, policyAgentsCount]); + + useEffect(() => { + /* + by default Fleet set up streams with an empty scheduled query, + this code removes that, so the user can schedule queries + in the next step + */ + if (!editMode) { + const updatedPolicy = produce(newPolicy, (draft) => { + draft.inputs[0].streams = []; + return draft; + }); + onChange({ + isValid: true, + updatedPolicy, + }); + } + // eslint-disable-next-line react-hooks/exhaustive-deps + }, []); + + useEffect(() => { + if (!editMode) { + replace({ + state: { + onSaveNavigateTo: (newPackagePolicy) => [ + 'fleet', + { + path: + '#' + + pagePathGetters.integration_policy_edit({ + packagePolicyId: newPackagePolicy.id, + }), + }, + ], + } as CreatePackagePolicyRouteState, + }); + } + }, [editMode, replace]); + + const scheduledQueryGroupTableData = useMemo(() => { + const policyWithoutEmptyQueries = produce(newPolicy, (draft) => { + draft.inputs[0].streams = filter(['compiled_stream.id', null], draft.inputs[0].streams); + return draft; + }); + + return policyWithoutEmptyQueries; + }, [newPolicy]); + + return ( + <> + {!editMode ? ( + <> + + + + + + + + ) : null} + {policyAgentsCount === 0 ? ( + <> + + + +

    + {`Fleet has detected that you have not assigned yet any agent to the `} + { + + {agentPolicy?.name ?? policy?.policy_id} + + } + {`. `} +
    + {`Only agents within the policy with active Osquery Manager integration support the functionality presented below.`} +

    +
    +
    +
    + + + ) : null} + + + + + {editMode && scheduledQueryGroupTableData.inputs[0].streams.length ? ( + + + + + + ) : null} + + ); +}); + +OsqueryManagedPolicyCreateImportExtension.displayName = 'OsqueryManagedPolicyCreateImportExtension'; diff --git a/x-pack/plugins/osquery/public/live_query/agent_results/index.tsx b/x-pack/plugins/osquery/public/live_queries/agent_results/index.tsx similarity index 89% rename from x-pack/plugins/osquery/public/live_query/agent_results/index.tsx rename to x-pack/plugins/osquery/public/live_queries/agent_results/index.tsx index 63dbca98d648f..272e65d9cc0fa 100644 --- a/x-pack/plugins/osquery/public/live_query/agent_results/index.tsx +++ b/x-pack/plugins/osquery/public/live_queries/agent_results/index.tsx @@ -19,10 +19,7 @@ const QueryAgentResultsComponent = () => { return ( <> - { - // @ts-expect-error update types - data?.actionDetails._source?.data?.query - } + {data?.actionDetails._source?.data?.query} diff --git a/x-pack/plugins/osquery/public/live_query/form/agents_table_field.tsx b/x-pack/plugins/osquery/public/live_queries/form/agents_table_field.tsx similarity index 100% rename from x-pack/plugins/osquery/public/live_query/form/agents_table_field.tsx rename to x-pack/plugins/osquery/public/live_queries/form/agents_table_field.tsx diff --git a/x-pack/plugins/osquery/public/live_queries/form/index.tsx b/x-pack/plugins/osquery/public/live_queries/form/index.tsx new file mode 100644 index 0000000000000..056bbc75f3b76 --- /dev/null +++ b/x-pack/plugins/osquery/public/live_queries/form/index.tsx @@ -0,0 +1,174 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import { EuiButton, EuiSteps, EuiSpacer, EuiFlexGroup, EuiFlexItem } from '@elastic/eui'; +import { EuiContainedStepProps } from '@elastic/eui/src/components/steps/steps'; +import { i18n } from '@kbn/i18n'; +import { FormattedMessage } from '@kbn/i18n/react'; +import React, { useMemo } from 'react'; +import { useMutation } from 'react-query'; + +import { UseField, Form, FormData, useForm, useFormData } from '../../shared_imports'; +import { AgentsTableField } from './agents_table_field'; +import { LiveQueryQueryField } from './live_query_query_field'; +import { useKibana } from '../../common/lib/kibana'; +import { ResultTabs } from '../../queries/edit/tabs'; + +const FORM_ID = 'liveQueryForm'; + +interface LiveQueryFormProps { + defaultValue?: Partial | undefined; + onSubmit?: (payload: Record) => Promise; + onSuccess?: () => void; +} + +const LiveQueryFormComponent: React.FC = ({ + defaultValue, + // onSubmit, + onSuccess, +}) => { + const { http } = useKibana().services; + + const { + data, + isLoading, + mutateAsync, + isError, + isSuccess, + // error + } = useMutation( + (payload: Record) => + http.post('/internal/osquery/action', { + body: JSON.stringify(payload), + }), + { + onSuccess, + } + ); + + const { form } = useForm({ + id: FORM_ID, + // schema: formSchema, + onSubmit: (payload) => { + return mutateAsync(payload); + }, + options: { + stripEmptyFields: false, + }, + defaultValue: defaultValue ?? { + query: { + id: null, + query: '', + }, + }, + }); + + const { submit } = form; + + const actionId = useMemo(() => data?.actions[0].action_id, [data?.actions]); + const agentIds = useMemo(() => data?.actions[0].agents, [data?.actions]); + const [{ agentSelection, query }] = useFormData({ form, watch: ['agentSelection', 'query'] }); + + const agentSelected = useMemo( + () => + agentSelection && + !!( + agentSelection.allAgentsSelected || + agentSelection.agents?.length || + agentSelection.platformsSelected?.length || + agentSelection.policiesSelected?.length + ), + [agentSelection] + ); + + const queryValueProvided = useMemo(() => !!query?.query?.length, [query]); + + const queryStatus = useMemo(() => { + if (!agentSelected) return 'disabled'; + if (isError) return 'danger'; + if (isLoading) return 'loading'; + if (isSuccess) return 'complete'; + + return 'incomplete'; + }, [agentSelected, isError, isLoading, isSuccess]); + + const resultsStatus = useMemo(() => (queryStatus === 'complete' ? 'incomplete' : 'disabled'), [ + queryStatus, + ]); + + const queryComponentProps = useMemo( + () => ({ + disabled: queryStatus === 'disabled', + }), + [queryStatus] + ); + + const formSteps: EuiContainedStepProps[] = useMemo( + () => [ + { + title: i18n.translate('xpack.osquery.liveQueryForm.steps.agentsStepHeading', { + defaultMessage: 'Select agents', + }), + children: , + status: agentSelected ? 'complete' : 'incomplete', + }, + { + title: i18n.translate('xpack.osquery.liveQueryForm.steps.queryStepHeading', { + defaultMessage: 'Enter query', + }), + children: ( + <> + + + + + + + + + + + ), + status: queryStatus, + }, + { + title: i18n.translate('xpack.osquery.liveQueryForm.steps.resultsStepHeading', { + defaultMessage: 'Check results', + }), + children: actionId ? ( + + ) : null, + status: resultsStatus, + }, + ], + [ + actionId, + agentIds, + agentSelected, + queryComponentProps, + queryStatus, + queryValueProvided, + resultsStatus, + submit, + ] + ); + + return ( +
    + + + ); +}; + +export const LiveQueryForm = React.memo(LiveQueryFormComponent); diff --git a/x-pack/plugins/osquery/public/live_query/form/live_query_query_field.tsx b/x-pack/plugins/osquery/public/live_queries/form/live_query_query_field.tsx similarity index 93% rename from x-pack/plugins/osquery/public/live_query/form/live_query_query_field.tsx rename to x-pack/plugins/osquery/public/live_queries/form/live_query_query_field.tsx index bc3da3ea37209..68207200dc789 100644 --- a/x-pack/plugins/osquery/public/live_query/form/live_query_query_field.tsx +++ b/x-pack/plugins/osquery/public/live_queries/form/live_query_query_field.tsx @@ -15,13 +15,14 @@ import { FieldHook } from '../../shared_imports'; import { OsqueryEditor } from '../../editor'; interface LiveQueryQueryFieldProps { + disabled?: boolean; field: FieldHook<{ id: string | null; query: string; }>; } -const LiveQueryQueryFieldComponent: React.FC = ({ field }) => { +const LiveQueryQueryFieldComponent: React.FC = ({ disabled, field }) => { // const { http } = useKibana().services; // const { data } = useQuery('savedQueryList', () => // http.get('/internal/osquery/saved_query', { @@ -82,7 +83,7 @@ const LiveQueryQueryFieldComponent: React.FC = ({ fiel onChange={handleSavedQueryChange} /> */} - + ); }; diff --git a/x-pack/plugins/osquery/public/live_query/form/schema.ts b/x-pack/plugins/osquery/public/live_queries/form/schema.ts similarity index 100% rename from x-pack/plugins/osquery/public/live_query/form/schema.ts rename to x-pack/plugins/osquery/public/live_queries/form/schema.ts diff --git a/x-pack/plugins/osquery/public/live_queries/index.tsx b/x-pack/plugins/osquery/public/live_queries/index.tsx new file mode 100644 index 0000000000000..3fb36f57ef82f --- /dev/null +++ b/x-pack/plugins/osquery/public/live_queries/index.tsx @@ -0,0 +1,22 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import React from 'react'; + +import { LiveQueryForm } from './form'; +import { FormData } from '../shared_imports'; + +interface LiveQueryProps { + defaultValue?: Partial | undefined; + onSuccess?: () => void; +} + +const LiveQueryComponent: React.FC = ({ defaultValue, onSuccess }) => ( + +); + +export const LiveQuery = React.memo(LiveQueryComponent); diff --git a/x-pack/plugins/osquery/public/live_query/form/index.tsx b/x-pack/plugins/osquery/public/live_query/form/index.tsx deleted file mode 100644 index 7e19bee530ec5..0000000000000 --- a/x-pack/plugins/osquery/public/live_query/form/index.tsx +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. - */ - -import { EuiButton, EuiSpacer } from '@elastic/eui'; -import React from 'react'; - -import { UseField, Form, useForm } from '../../shared_imports'; -import { AgentsTableField } from './agents_table_field'; -import { LiveQueryQueryField } from './live_query_query_field'; - -const FORM_ID = 'liveQueryForm'; - -interface LiveQueryFormProps { - defaultValue?: unknown; - onSubmit: (payload: Record) => Promise; -} - -const LiveQueryFormComponent: React.FC = ({ defaultValue, onSubmit }) => { - const { form } = useForm({ - id: FORM_ID, - // schema: formSchema, - onSubmit, - options: { - stripEmptyFields: false, - }, - defaultValue: { - // @ts-expect-error update types - query: defaultValue ?? { - id: null, - query: '', - }, - }, - }); - - const { submit } = form; - - return ( -
    - - - - - {'Send query'} - - ); -}; - -export const LiveQueryForm = React.memo(LiveQueryFormComponent); diff --git a/x-pack/plugins/osquery/public/live_query/index.tsx b/x-pack/plugins/osquery/public/live_query/index.tsx deleted file mode 100644 index 324f9896cbd96..0000000000000 --- a/x-pack/plugins/osquery/public/live_query/index.tsx +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. - */ - -import { EuiSpacer } from '@elastic/eui'; -import React from 'react'; -import { useMutation } from 'react-query'; -import { useLocation } from 'react-router-dom'; - -import { useKibana } from '../common/lib/kibana'; -import { LiveQueryForm } from './form'; -import { ResultTabs } from '../queries/edit/tabs'; - -const LiveQueryComponent = () => { - const location = useLocation(); - const { http } = useKibana().services; - - const createActionMutation = useMutation((payload: Record) => - http.post('/internal/osquery/action', { - body: JSON.stringify(payload), - }) - ); - - return ( - <> - { - - } - - {createActionMutation.data && ( - <> - - - - )} - - ); -}; - -export const LiveQuery = React.memo(LiveQueryComponent); diff --git a/x-pack/plugins/osquery/public/osquery_action_type/example_params_fields.tsx b/x-pack/plugins/osquery/public/osquery_action_type/example_params_fields.tsx deleted file mode 100644 index 898806ea542a8..0000000000000 --- a/x-pack/plugins/osquery/public/osquery_action_type/example_params_fields.tsx +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. - */ - -/* eslint-disable react-perf/jsx-no-new-function-as-prop, react/jsx-no-bind */ - -import React, { Fragment } from 'react'; -import { EuiTextArea } from '@elastic/eui'; -// eslint-disable-next-line @kbn/eslint/no-restricted-paths -import { ActionParamsProps } from '../../../triggers_actions_ui/public/types'; - -interface ExampleActionParams { - message: string; -} - -const ExampleParamsFields: React.FunctionComponent> = ({ - actionParams, - editAction, - index, - errors, -}) => { - // console.error('actionParams', actionParams, index, errors); - const { message } = actionParams; - return ( - - 0 && message !== undefined} - name="message" - value={message || ''} - onChange={(e) => { - editAction('message', e.target.value, index); - }} - onBlur={() => { - if (!message) { - editAction('message', '', index); - } - }} - /> - - ); -}; - -// Export as default in order to support lazy loading -// eslint-disable-next-line import/no-default-export -export { ExampleParamsFields as default }; diff --git a/x-pack/plugins/osquery/public/osquery_action_type/index.tsx b/x-pack/plugins/osquery/public/osquery_action_type/index.tsx deleted file mode 100644 index 2e162b34ab96d..0000000000000 --- a/x-pack/plugins/osquery/public/osquery_action_type/index.tsx +++ /dev/null @@ -1,73 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. - */ - -import { lazy } from 'react'; -import { i18n } from '@kbn/i18n'; -// eslint-disable-next-line @kbn/eslint/no-restricted-paths -import { ActionTypeModel, ValidationResult } from '../../../triggers_actions_ui/public/types'; - -interface ExampleActionParams { - message: string; -} - -export function getActionType(): ActionTypeModel { - return { - id: '.osquery', - iconClass: 'logoOsquery', - selectMessage: i18n.translate( - 'xpack.osquery.components.builtinActionTypes.exampleAction.selectMessageText', - { - defaultMessage: 'Example Action is used to show how to create new action type UI.', - } - ), - actionTypeTitle: i18n.translate( - 'xpack.osquery.components.builtinActionTypes.exampleAction.actionTypeTitle', - { - defaultMessage: 'Example Action', - } - ), - // @ts-expect-error update types - validateConnector: (action): ValidationResult => { - const validationResult = { errors: {} }; - const errors = { - someConnectorField: new Array(), - }; - validationResult.errors = errors; - if (!action.config.someConnectorField) { - errors.someConnectorField.push( - i18n.translate( - 'xpack.osquery.components.builtinActionTypes.error.requiredSomeConnectorFieldeText', - { - defaultMessage: 'SomeConnectorField is required.', - } - ) - ); - } - return validationResult; - }, - validateParams: (actionParams: ExampleActionParams): ValidationResult => { - const validationResult = { errors: {} }; - const errors = { - message: new Array(), - }; - validationResult.errors = errors; - if (!actionParams.message?.length) { - errors.message.push( - i18n.translate( - 'xpack.osquery.components.builtinActionTypes.error.requiredExampleMessageText', - { - defaultMessage: 'Message is required.', - } - ) - ); - } - return validationResult; - }, - actionConnectorFields: null, - actionParamsFields: lazy(() => import('./example_params_fields')), - }; -} diff --git a/x-pack/plugins/osquery/public/packs/edit/index.tsx b/x-pack/plugins/osquery/public/packs/edit/index.tsx index 478152bb8b4a3..3cbd80c9f4db0 100644 --- a/x-pack/plugins/osquery/public/packs/edit/index.tsx +++ b/x-pack/plugins/osquery/public/packs/edit/index.tsx @@ -26,6 +26,7 @@ const EditPackPageComponent: React.FC = ({ onSuccess, packId queries: [], }, } = useQuery(['pack', { id: packId }], ({ queryKey }) => { + // @ts-expect-error update types return http.get(`/internal/osquery/pack/${queryKey[1].id}`); }); diff --git a/x-pack/plugins/osquery/public/plugin.ts b/x-pack/plugins/osquery/public/plugin.ts index b807e93236df6..c0a097cb3ba28 100644 --- a/x-pack/plugins/osquery/public/plugin.ts +++ b/x-pack/plugins/osquery/public/plugin.ts @@ -14,6 +14,7 @@ import { CoreStart, DEFAULT_APP_CATEGORIES, AppStatus, + AppNavLinkStatus, AppUpdater, } from '../../../../src/core/public'; import { Storage } from '../../../../src/plugins/kibana_utils/public'; @@ -24,28 +25,51 @@ import { StartPlugins, AppPluginStartDependencies, } from './types'; -import { PLUGIN_NAME } from '../common'; +import { OSQUERY_INTEGRATION_NAME, PLUGIN_NAME } from '../common'; +import { epmRouteService, GetPackagesResponse } from '../../fleet/common'; import { - LazyOsqueryManagedEmptyCreatePolicyExtension, - LazyOsqueryManagedEmptyEditPolicyExtension, + LazyOsqueryManagedPolicyCreateImportExtension, + LazyOsqueryManagedPolicyEditExtension, + LazyOsqueryManagedCustomButtonExtension, } from './fleet_integration'; -// import { getActionType } from './osquery_action_type'; - -export function toggleOsqueryPlugin(updater$: Subject, http: CoreStart['http']) { - http.fetch('/api/fleet/epm/packages', { query: { experimental: true } }).then(({ response }) => { - const installed = response.find( - // @ts-expect-error update types - (integration) => - integration?.name === 'osquery_elastic_managed' && integration?.status === 'installed' - ); - updater$.next(() => ({ - status: installed ? AppStatus.accessible : AppStatus.inaccessible, - })); - }); + +export function toggleOsqueryPlugin( + updater$: Subject, + http: CoreStart['http'], + registerExtension?: StartPlugins['fleet']['registerExtension'] +) { + http + .fetch(epmRouteService.getListPath(), { query: { experimental: true } }) + .then(({ response }) => { + const installed = response.find( + (integration) => + integration?.name === OSQUERY_INTEGRATION_NAME && integration?.status === 'installed' + ); + + if (installed && registerExtension) { + registerExtension({ + package: OSQUERY_INTEGRATION_NAME, + view: 'package-detail-custom', + component: LazyOsqueryManagedCustomButtonExtension, + }); + } + + updater$.next(() => ({ + navLinkStatus: installed ? AppNavLinkStatus.visible : AppNavLinkStatus.hidden, + })); + }) + .catch(() => { + updater$.next(() => ({ + status: AppStatus.inaccessible, + navLinkStatus: AppNavLinkStatus.hidden, + })); + }); } export class OsqueryPlugin implements Plugin { - private readonly appUpdater$ = new BehaviorSubject(() => ({})); + private readonly appUpdater$ = new BehaviorSubject(() => ({ + navLinkStatus: AppNavLinkStatus.hidden, + })); private kibanaVersion: string; private storage = new Storage(localStorage); @@ -53,11 +77,14 @@ export class OsqueryPlugin implements Plugin(); + public setup(core: CoreSetup): OsqueryPluginSetup { + const config = this.initializerContext.config.get<{ + enabled: boolean; + actionEnabled: boolean; + scheduledQueries: boolean; + savedQueries: boolean; + packs: boolean; + }>(); if (!config.enabled) { return {}; @@ -71,6 +98,7 @@ export class OsqueryPlugin implements Plugin(); - - if (!config.enabled) { - return {}; - } + const config = this.initializerContext.config.get<{ + enabled: boolean; + actionEnabled: boolean; + scheduledQueries: boolean; + savedQueries: boolean; + packs: boolean; + }>(); if (plugins.fleet) { const { registerExtension } = plugins.fleet; - toggleOsqueryPlugin(this.appUpdater$, core.http); + if (config.enabled) { + toggleOsqueryPlugin(this.appUpdater$, core.http, registerExtension); + } registerExtension({ - package: 'osquery_elastic_managed', + package: OSQUERY_INTEGRATION_NAME, view: 'package-policy-create', - component: LazyOsqueryManagedEmptyCreatePolicyExtension, + component: LazyOsqueryManagedPolicyCreateImportExtension, }); registerExtension({ - package: 'osquery_elastic_managed', + package: OSQUERY_INTEGRATION_NAME, view: 'package-policy-edit', - component: LazyOsqueryManagedEmptyEditPolicyExtension, + component: LazyOsqueryManagedPolicyEditExtension, }); - - // registerExtension({ - // package: 'osquery_elastic_managed', - // view: 'package-detail-custom', - // component: LazyOsqueryManagedCustomExtension, - // }); } else { this.appUpdater$.next(() => ({ status: AppStatus.inaccessible, diff --git a/x-pack/plugins/osquery/public/queries/edit/tabs.tsx b/x-pack/plugins/osquery/public/queries/edit/tabs.tsx index 4aa9d20d11123..1a6b317653c98 100644 --- a/x-pack/plugins/osquery/public/queries/edit/tabs.tsx +++ b/x-pack/plugins/osquery/public/queries/edit/tabs.tsx @@ -9,13 +9,15 @@ import { EuiTabbedContent, EuiSpacer } from '@elastic/eui'; import React, { useMemo } from 'react'; import { ResultsTable } from '../../results/results_table'; -import { ActionResultsTable } from '../../action_results/action_results_table'; +import { ActionResultsSummary } from '../../action_results/action_results_summary'; interface ResultTabsProps { actionId: string; + agentIds?: string[]; + isLive?: boolean; } -const ResultTabsComponent: React.FC = ({ actionId }) => { +const ResultTabsComponent: React.FC = ({ actionId, agentIds, isLive }) => { const tabs = useMemo( () => [ { @@ -24,7 +26,7 @@ const ResultTabsComponent: React.FC = ({ actionId }) => { content: ( <> - + ), }, @@ -34,12 +36,12 @@ const ResultTabsComponent: React.FC = ({ actionId }) => { content: ( <> - + ), }, ], - [actionId] + [actionId, agentIds, isLive] ); return ( diff --git a/x-pack/plugins/osquery/public/queries/form/code_editor_field.tsx b/x-pack/plugins/osquery/public/queries/form/code_editor_field.tsx index 5a564af987562..a56e747355c5b 100644 --- a/x-pack/plugins/osquery/public/queries/form/code_editor_field.tsx +++ b/x-pack/plugins/osquery/public/queries/form/code_editor_field.tsx @@ -5,6 +5,9 @@ * 2.0. */ +import { FormattedMessage } from '@kbn/i18n/react'; +import { isEmpty } from 'lodash/fp'; +import { EuiFormRow, EuiLink, EuiText } from '@elastic/eui'; import React from 'react'; import { OsqueryEditor } from '../../editor'; @@ -14,10 +17,34 @@ interface CodeEditorFieldProps { field: FieldHook; } +const OsquerySchemaLink = React.memo(() => ( + + + + + +)); + +OsquerySchemaLink.displayName = 'OsquerySchemaLink'; + const CodeEditorFieldComponent: React.FC = ({ field }) => { - const { value, setValue } = field; + const { value, label, labelAppend, helpText, setValue } = field; - return ; + return ( + } + helpText={helpText} + // isInvalid={typeof error === 'string'} + // error={error} + fullWidth + > + + + ); }; export const CodeEditorField = React.memo(CodeEditorFieldComponent); diff --git a/x-pack/plugins/security_solution/server/graphql/scalar_to_date_array/schema.gql.ts b/x-pack/plugins/osquery/public/query_client.ts similarity index 74% rename from x-pack/plugins/security_solution/server/graphql/scalar_to_date_array/schema.gql.ts rename to x-pack/plugins/osquery/public/query_client.ts index 7238e975c4c25..7541e80aee935 100644 --- a/x-pack/plugins/security_solution/server/graphql/scalar_to_date_array/schema.gql.ts +++ b/x-pack/plugins/osquery/public/query_client.ts @@ -5,8 +5,6 @@ * 2.0. */ -import gql from 'graphql-tag'; +import { QueryClient } from 'react-query'; -export const toDateSchema = gql` - scalar ToDateArray -`; +export const queryClient = new QueryClient(); diff --git a/x-pack/plugins/osquery/public/results/helpers.ts b/x-pack/plugins/osquery/public/results/helpers.ts index 802674ee0398c..171530a77299f 100644 --- a/x-pack/plugins/osquery/public/results/helpers.ts +++ b/x-pack/plugins/osquery/public/results/helpers.ts @@ -16,15 +16,14 @@ export type InspectResponse = Inspect & { response: string[] }; export const generateTablePaginationOptions = ( activePage: number, - limit: number, - isBucketSort?: boolean + limit: number ): PaginationInputPaginated => { const cursorStart = activePage * limit; return { activePage, cursorStart, fakePossibleCount: 4 <= activePage && activePage > 0 ? limit * (activePage + 2) : limit * 5, - querySize: isBucketSort ? limit : limit + cursorStart, + querySize: limit, }; }; diff --git a/x-pack/plugins/osquery/public/results/results_table.tsx b/x-pack/plugins/osquery/public/results/results_table.tsx index 7557828c4407c..d82c45d802520 100644 --- a/x-pack/plugins/osquery/public/results/results_table.tsx +++ b/x-pack/plugins/osquery/public/results/results_table.tsx @@ -6,22 +6,40 @@ */ import { isEmpty, isEqual, keys, map } from 'lodash/fp'; -import { EuiDataGrid, EuiDataGridProps, EuiDataGridColumn, EuiLink } from '@elastic/eui'; +import { + EuiDataGrid, + EuiDataGridSorting, + EuiDataGridProps, + EuiDataGridColumn, + EuiLink, +} from '@elastic/eui'; +import { i18n } from '@kbn/i18n'; import React, { createContext, useEffect, useState, useCallback, useContext, useMemo } from 'react'; -import { EuiDataGridSorting } from '@elastic/eui'; +import { pagePathGetters } from '../../../fleet/public'; import { useAllResults } from './use_all_results'; import { Direction, ResultEdges } from '../../common/search_strategy'; -import { useRouterNavigate } from '../common/lib/kibana'; +import { useKibana } from '../common/lib/kibana'; const DataContext = createContext([]); interface ResultsTableComponentProps { actionId: string; agentId?: string; + isLive?: boolean; } -const ResultsTableComponent: React.FC = ({ actionId, agentId }) => { +const ResultsTableComponent: React.FC = ({ actionId, isLive }) => { + const { getUrlForApp } = useKibana().services.application; + + const getFleetAppUrl = useCallback( + (agentId) => + getUrlForApp('fleet', { + path: `#` + pagePathGetters.fleet_agent_details({ agentId }), + }), + [getUrlForApp] + ); + const [pagination, setPagination] = useState({ pageIndex: 0, pageSize: 50 }); const onChangeItemsPerPage = useCallback( (pageSize) => @@ -39,22 +57,15 @@ const ResultsTableComponent: React.FC = ({ actionId, const [columns, setColumns] = useState([]); - // ** Sorting config const [sortingColumns, setSortingColumns] = useState([]); - const onSort = useCallback( - (newSortingColumns) => { - setSortingColumns(newSortingColumns); - }, - [setSortingColumns] - ); - const { data: allResultsData = [] } = useAllResults({ + const { data: allResultsData } = useAllResults({ actionId, - agentId, activePage: pagination.pageIndex, limit: pagination.pageSize, direction: Direction.asc, sortField: '@timestamp', + isLive, }); const [visibleColumns, setVisibleColumns] = useState([]); @@ -68,24 +79,22 @@ const ResultsTableComponent: React.FC = ({ actionId, // eslint-disable-next-line react-hooks/rules-of-hooks const data = useContext(DataContext); - // @ts-expect-error fields is optional - const value = data[rowIndex].fields[columnId]; + // @ts-expect-error update types + const value = data[rowIndex % pagination.pageSize]?.fields[columnId]; if (columnId === 'agent.name') { - // @ts-expect-error fields is optional - const agentIdValue = data[rowIndex].fields['agent.id']; - // eslint-disable-next-line react-hooks/rules-of-hooks - const linkProps = useRouterNavigate(`/live_query/${actionId}/results/${agentIdValue}`); - return {value}; + // @ts-expect-error update types + const agentIdValue = data[rowIndex % pagination.pageSize]?.fields['agent.id']; + + return {value}; } return !isEmpty(value) ? value : '-'; }, - [actionId] + [getFleetAppUrl, pagination.pageSize] ); - const tableSorting = useMemo(() => ({ columns: sortingColumns, onSort }), [ - onSort, + const tableSorting = useMemo(() => ({ columns: sortingColumns, onSort: setSortingColumns }), [ sortingColumns, ]); @@ -100,34 +109,32 @@ const ResultsTableComponent: React.FC = ({ actionId, ); useEffect(() => { - // @ts-expect-error update types - if (!allResultsData?.results) { + if (!allResultsData?.edges) { return; } - // @ts-expect-error update types - const newColumns = keys(allResultsData?.results[0]?.fields) + + const newColumns = keys(allResultsData?.edges[0]?.fields) .sort() .reduce((acc, fieldName) => { if (fieldName === 'agent.name') { - return [ - ...acc, - { - id: fieldName, - displayAsText: 'agent', - defaultSortDirection: Direction.asc, - }, - ]; + acc.push({ + id: fieldName, + displayAsText: i18n.translate('xpack.osquery.liveQueryResults.table.agentColumnTitle', { + defaultMessage: 'agent', + }), + defaultSortDirection: Direction.asc, + }); + + return acc; } if (fieldName.startsWith('osquery.')) { - return [ - ...acc, - { - id: fieldName, - displayAsText: fieldName.split('.')[1], - defaultSortDirection: Direction.asc, - }, - ]; + acc.push({ + id: fieldName, + displayAsText: fieldName.split('.')[1], + defaultSortDirection: Direction.asc, + }); + return acc; } return acc; @@ -137,22 +144,20 @@ const ResultsTableComponent: React.FC = ({ actionId, setColumns(newColumns); setVisibleColumns(map('id', newColumns)); } - // @ts-expect-error update types - }, [columns, allResultsData?.results]); + }, [columns, allResultsData?.edges]); return ( // @ts-expect-error update types - + ); diff --git a/x-pack/plugins/osquery/public/results/use_all_results.ts b/x-pack/plugins/osquery/public/results/use_all_results.ts index 5727edf1bf4c3..7140f80f510f4 100644 --- a/x-pack/plugins/osquery/public/results/use_all_results.ts +++ b/x-pack/plugins/osquery/public/results/use_all_results.ts @@ -5,8 +5,6 @@ * 2.0. */ -import deepEqual from 'fast-deep-equal'; -import { useEffect, useState } from 'react'; import { useQuery } from 'react-query'; import { createFilter } from '../common/helpers'; @@ -35,71 +33,55 @@ export interface ResultsArgs { interface UseAllResults { actionId: string; activePage: number; - agentId?: string; direction: Direction; limit: number; sortField: string; filterQuery?: ESTermQuery | string; skip?: boolean; + isLive?: boolean; } export const useAllResults = ({ actionId, activePage, - agentId, direction, limit, sortField, filterQuery, skip = false, + isLive = false, }: UseAllResults) => { const { data } = useKibana().services; - const [resultsRequest, setHostRequest] = useState(null); - - const response = useQuery( + return useQuery( ['allActionResults', { actionId, activePage, direction, limit, sortField }], async () => { - if (!resultsRequest) return Promise.resolve(); - const responseData = await data.search - .search(resultsRequest, { - strategy: 'osquerySearchStrategy', - }) + .search( + { + actionId, + factoryQueryType: OsqueryQueries.results, + filterQuery: createFilter(filterQuery), + pagination: generateTablePaginationOptions(activePage, limit), + sort: { + direction, + field: sortField, + }, + }, + { + strategy: 'osquerySearchStrategy', + } + ) .toPromise(); return { ...responseData, - results: responseData.edges, inspect: getInspectResponse(responseData, {} as InspectResponse), }; }, { - refetchInterval: 1000, - enabled: !skip && !!resultsRequest, + refetchInterval: isLive ? 1000 : false, + enabled: !skip, } ); - - useEffect(() => { - setHostRequest((prevRequest) => { - const myRequest = { - ...(prevRequest ?? {}), - actionId, - agentId, - factoryQueryType: OsqueryQueries.results, - filterQuery: createFilter(filterQuery), - pagination: generateTablePaginationOptions(activePage, limit), - sort: { - direction, - field: sortField, - }, - }; - if (!deepEqual(prevRequest, myRequest)) { - return myRequest; - } - return prevRequest; - }); - }, [actionId, activePage, agentId, direction, filterQuery, limit, sortField]); - - return response; }; diff --git a/x-pack/plugins/osquery/public/routes/index.tsx b/x-pack/plugins/osquery/public/routes/index.tsx index 18ba0abec5696..7007feb19d663 100644 --- a/x-pack/plugins/osquery/public/routes/index.tsx +++ b/x-pack/plugins/osquery/public/routes/index.tsx @@ -8,24 +8,24 @@ import React from 'react'; import { Switch, Redirect, Route } from 'react-router-dom'; -import { LiveQueries } from './live_query'; +import { useBreadcrumbs } from '../common/hooks/use_breadcrumbs'; +import { LiveQueries } from './live_queries'; +import { ScheduledQueryGroups } from './scheduled_query_groups'; -const OsqueryAppRoutesComponent = () => ( - - {/* - - - - - - - - */} - - - - - -); +const OsqueryAppRoutesComponent = () => { + useBreadcrumbs('base'); + + return ( + + + + + + + + + + ); +}; export const OsqueryAppRoutes = React.memo(OsqueryAppRoutesComponent); diff --git a/x-pack/plugins/osquery/public/routes/live_queries/details/actions_menu.tsx b/x-pack/plugins/osquery/public/routes/live_queries/details/actions_menu.tsx new file mode 100644 index 0000000000000..5e7c6082fef5a --- /dev/null +++ b/x-pack/plugins/osquery/public/routes/live_queries/details/actions_menu.tsx @@ -0,0 +1,68 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import { FormattedMessage } from '@kbn/i18n/react'; +import { EuiButton, EuiContextMenuPanel, EuiContextMenuItem, EuiPopover } from '@elastic/eui'; +import React, { useCallback, useMemo, useState } from 'react'; + +import { useDiscoverLink } from '../../../common/hooks'; +interface LiveQueryDetailsActionsMenuProps { + actionId: string; +} + +const LiveQueryDetailsActionsMenuComponent: React.FC = ({ + actionId, +}) => { + const discoverLinkProps = useDiscoverLink({ filters: [{ key: 'action_id', value: actionId }] }); + const [isPopoverOpen, setPopover] = useState(false); + + const onButtonClick = useCallback(() => { + setPopover((currentIsPopoverOpen) => !currentIsPopoverOpen); + }, []); + + const closePopover = useCallback(() => { + setPopover(false); + }, []); + + const items = useMemo( + () => [ + + + , + ], + [discoverLinkProps] + ); + + const button = useMemo( + () => ( + + + + ), + [onButtonClick] + ); + + return ( + + + + ); +}; + +export const LiveQueryDetailsActionsMenu = React.memo(LiveQueryDetailsActionsMenuComponent); diff --git a/x-pack/plugins/osquery/public/routes/live_query/details/index.tsx b/x-pack/plugins/osquery/public/routes/live_queries/details/index.tsx similarity index 75% rename from x-pack/plugins/osquery/public/routes/live_query/details/index.tsx rename to x-pack/plugins/osquery/public/routes/live_queries/details/index.tsx index 11665bede97c5..9f759f847f4c8 100644 --- a/x-pack/plugins/osquery/public/routes/live_query/details/index.tsx +++ b/x-pack/plugins/osquery/public/routes/live_queries/details/index.tsx @@ -7,7 +7,7 @@ import { EuiButtonEmpty, - EuiText, + EuiTextColor, EuiFlexGroup, EuiFlexItem, EuiCodeBlock, @@ -28,6 +28,8 @@ import { useActionResults } from '../../../action_results/use_action_results'; import { useActionDetails } from '../../../actions/use_action_details'; import { ResultTabs } from '../../../queries/edit/tabs'; import { LiveQueryDetailsActionsMenu } from './actions_menu'; +import { useBreadcrumbs } from '../../../common/hooks/use_breadcrumbs'; +import { BetaBadge, BetaBadgeRowWrapper } from '../../../components/beta_badge'; const Divider = styled.div` width: 0; @@ -37,7 +39,8 @@ const Divider = styled.div` const LiveQueryDetailsPageComponent = () => { const { actionId } = useParams<{ actionId: string }>(); - const liveQueryListProps = useRouterNavigate('live_query'); + useBreadcrumbs('live_query_details', { liveQueryId: actionId }); + const liveQueryListProps = useRouterNavigate('live_queries'); const { data } = useActionDetails({ actionId }); const { data: actionResultsData } = useActionResults({ @@ -54,30 +57,21 @@ const LiveQueryDetailsPageComponent = () => { - +

    -
    -
    - - -

    - -

    -
    + +
    ), @@ -103,10 +97,7 @@ const LiveQueryDetailsPageComponent = () => { /> - { - // @ts-expect-error update types - data?.actionDetails?.fields?.agents?.length ?? '0' - } + {data?.actionDetails?.fields?.agents?.length ?? '0'} @@ -123,17 +114,13 @@ const LiveQueryDetailsPageComponent = () => { /> - { - // @ts-expect-error update types - actionResultsData?.rawResponse?.aggregations?.responses?.buckets.find( - // @ts-expect-error update types - (bucket) => bucket.key === 'error' - )?.doc_count ?? '0' - } + + {actionResultsData?.aggregations.failed} + - + @@ -141,25 +128,16 @@ const LiveQueryDetailsPageComponent = () => { ), - [ - actionId, - // @ts-expect-error update types - actionResultsData?.rawResponse?.aggregations?.responses?.buckets, - // @ts-expect-error update types - data?.actionDetails?.fields?.agents?.length, - ] + [actionId, actionResultsData?.aggregations.failed, data?.actionDetails?.fields?.agents?.length] ); return ( - { - // @ts-expect-error update types - data?.actionDetails._source?.data?.query - } + {data?.actionDetails._source?.data?.query} - + ); }; diff --git a/x-pack/plugins/osquery/public/routes/live_query/index.tsx b/x-pack/plugins/osquery/public/routes/live_queries/index.tsx similarity index 83% rename from x-pack/plugins/osquery/public/routes/live_query/index.tsx rename to x-pack/plugins/osquery/public/routes/live_queries/index.tsx index 738f96087545c..af039e85e9785 100644 --- a/x-pack/plugins/osquery/public/routes/live_query/index.tsx +++ b/x-pack/plugins/osquery/public/routes/live_queries/index.tsx @@ -11,9 +11,10 @@ import { Switch, Route, useRouteMatch } from 'react-router-dom'; import { LiveQueriesPage } from './list'; import { NewLiveQueryPage } from './new'; import { LiveQueryDetailsPage } from './details'; -import { LiveQueryAgentDetailsPage } from './agent_details'; +import { useBreadcrumbs } from '../../common/hooks/use_breadcrumbs'; const LiveQueriesComponent = () => { + useBreadcrumbs('live_queries'); const match = useRouteMatch(); return ( @@ -21,9 +22,6 @@ const LiveQueriesComponent = () => { - - - diff --git a/x-pack/plugins/osquery/public/routes/live_query/list/index.tsx b/x-pack/plugins/osquery/public/routes/live_queries/list/index.tsx similarity index 61% rename from x-pack/plugins/osquery/public/routes/live_query/list/index.tsx rename to x-pack/plugins/osquery/public/routes/live_queries/list/index.tsx index ed72fe704294d..90ac7b5cc17ae 100644 --- a/x-pack/plugins/osquery/public/routes/live_query/list/index.tsx +++ b/x-pack/plugins/osquery/public/routes/live_queries/list/index.tsx @@ -5,39 +5,33 @@ * 2.0. */ -import { EuiButton, EuiText, EuiFlexGroup, EuiFlexItem } from '@elastic/eui'; +import { EuiButton, EuiFlexGroup, EuiFlexItem } from '@elastic/eui'; import { FormattedMessage } from '@kbn/i18n/react'; import React, { useMemo } from 'react'; import { useRouterNavigate } from '../../../common/lib/kibana'; import { ActionsTable } from '../../../actions/actions_table'; import { WithHeaderLayout } from '../../../components/layouts'; +import { useBreadcrumbs } from '../../../common/hooks/use_breadcrumbs'; +import { BetaBadge, BetaBadgeRowWrapper } from '../../../components/beta_badge'; const LiveQueriesPageComponent = () => { - const newQueryLinkProps = useRouterNavigate('live_query/new'); + useBreadcrumbs('live_queries'); + const newQueryLinkProps = useRouterNavigate('live_queries/new'); const LeftColumn = useMemo( () => ( - +

    -
    -
    - - -

    - -

    -
    + +
    ), @@ -46,8 +40,11 @@ const LiveQueriesPageComponent = () => { const RightColumn = useMemo( () => ( - - {'New live query'} + + ), [newQueryLinkProps] diff --git a/x-pack/plugins/osquery/public/routes/live_query/new/index.tsx b/x-pack/plugins/osquery/public/routes/live_queries/new/index.tsx similarity index 51% rename from x-pack/plugins/osquery/public/routes/live_query/new/index.tsx rename to x-pack/plugins/osquery/public/routes/live_queries/new/index.tsx index 0aeb46da2a897..9967eb97cddf2 100644 --- a/x-pack/plugins/osquery/public/routes/live_query/new/index.tsx +++ b/x-pack/plugins/osquery/public/routes/live_queries/new/index.tsx @@ -5,16 +5,39 @@ * 2.0. */ -import { EuiButtonEmpty, EuiText, EuiFlexGroup, EuiFlexItem } from '@elastic/eui'; +import { EuiButtonEmpty, EuiFlexGroup, EuiFlexItem } from '@elastic/eui'; import { FormattedMessage } from '@kbn/i18n/react'; import React, { useMemo } from 'react'; +import { useLocation } from 'react-router-dom'; +import qs from 'query-string'; import { WithHeaderLayout } from '../../../components/layouts'; import { useRouterNavigate } from '../../../common/lib/kibana'; -import { LiveQuery } from '../../../live_query'; +import { LiveQuery } from '../../../live_queries'; +import { useBreadcrumbs } from '../../../common/hooks/use_breadcrumbs'; +import { BetaBadge, BetaBadgeRowWrapper } from '../../../components/beta_badge'; const NewLiveQueryPageComponent = () => { - const liveQueryListProps = useRouterNavigate('live_query'); + useBreadcrumbs('live_query_new'); + const location = useLocation(); + const liveQueryListProps = useRouterNavigate('live_queries'); + + const formDefaultValue = useMemo(() => { + const queryParams = qs.parse(location.search); + + if (queryParams?.agentPolicyId) { + return { + agentSelection: { + allAgentsSelected: false, + agents: [], + platformsSelected: [], + policiesSelected: [queryParams?.agentPolicyId], + }, + }; + } + + return undefined; + }, [location.search]); const LeftColumn = useMemo( () => ( @@ -22,30 +45,21 @@ const NewLiveQueryPageComponent = () => { - +

    -
    -
    - - -

    - -

    -
    + +
    ), @@ -54,7 +68,7 @@ const NewLiveQueryPageComponent = () => { return ( - + ); }; diff --git a/x-pack/plugins/osquery/public/routes/live_query/agent_details/index.tsx b/x-pack/plugins/osquery/public/routes/live_query/agent_details/index.tsx deleted file mode 100644 index 266847a803c0d..0000000000000 --- a/x-pack/plugins/osquery/public/routes/live_query/agent_details/index.tsx +++ /dev/null @@ -1,82 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. - */ - -import { - EuiButtonEmpty, - EuiText, - EuiFlexGroup, - EuiFlexItem, - EuiCodeBlock, - EuiSpacer, -} from '@elastic/eui'; -import { FormattedMessage } from '@kbn/i18n/react'; -import React, { useMemo } from 'react'; -import { useParams } from 'react-router-dom'; - -import { useRouterNavigate } from '../../../common/lib/kibana'; -import { WithHeaderLayout } from '../../../components/layouts'; -import { useActionDetails } from '../../../actions/use_action_details'; -import { ResultsTable } from '../../../results/results_table'; - -const LiveQueryAgentDetailsPageComponent = () => { - const { actionId, agentId } = useParams<{ actionId: string; agentId: string }>(); - const { data } = useActionDetails({ actionId }); - const liveQueryListProps = useRouterNavigate(`live_query/${actionId}`); - - const LeftColumn = useMemo( - () => ( - - - - - - - - -

    - -

    -
    -
    - - -

    - -

    -
    -
    -
    - ), - [agentId, liveQueryListProps] - ); - - return ( - - - { - // @ts-expect-error update types - data?.actionDetails._source?.data?.query - } - - - - - ); -}; - -export const LiveQueryAgentDetailsPage = React.memo(LiveQueryAgentDetailsPageComponent); diff --git a/x-pack/plugins/osquery/public/routes/scheduled_query_groups/add/index.tsx b/x-pack/plugins/osquery/public/routes/scheduled_query_groups/add/index.tsx new file mode 100644 index 0000000000000..3d5f25a0e3231 --- /dev/null +++ b/x-pack/plugins/osquery/public/routes/scheduled_query_groups/add/index.tsx @@ -0,0 +1,68 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import { EuiButtonEmpty, EuiFlexGroup, EuiFlexItem } from '@elastic/eui'; +import { FormattedMessage } from '@kbn/i18n/react'; +import React, { useMemo } from 'react'; + +import { WithHeaderLayout } from '../../../components/layouts'; +import { useRouterNavigate } from '../../../common/lib/kibana'; +import { ScheduledQueryGroupForm } from '../../../scheduled_query_groups/form'; +import { useOsqueryIntegration } from '../../../common/hooks'; +import { useBreadcrumbs } from '../../../common/hooks/use_breadcrumbs'; +import { BetaBadge, BetaBadgeRowWrapper } from '../../../components/beta_badge'; + +const AddScheduledQueryGroupPageComponent = () => { + useBreadcrumbs('scheduled_query_group_add'); + const scheduledQueryListProps = useRouterNavigate('scheduled_query_groups'); + const { data: osqueryIntegration } = useOsqueryIntegration(); + + const packageInfo = useMemo(() => { + if (!osqueryIntegration) return; + + return { + name: osqueryIntegration.name, + title: osqueryIntegration.title, + version: osqueryIntegration.version, + }; + }, [osqueryIntegration]); + + const LeftColumn = useMemo( + () => ( + + + + + + + + +

    + +

    + +
    +
    +
    + ), + [scheduledQueryListProps] + ); + + return ( + + {packageInfo && } + + ); +}; + +export const AddScheduledQueryGroupPage = React.memo(AddScheduledQueryGroupPageComponent); diff --git a/x-pack/plugins/osquery/public/routes/live_query/details/actions_menu.tsx b/x-pack/plugins/osquery/public/routes/scheduled_query_groups/details/actions_menu.tsx similarity index 60% rename from x-pack/plugins/osquery/public/routes/live_query/details/actions_menu.tsx rename to x-pack/plugins/osquery/public/routes/scheduled_query_groups/details/actions_menu.tsx index 677b917e047b4..ccfb933afdad6 100644 --- a/x-pack/plugins/osquery/public/routes/live_query/details/actions_menu.tsx +++ b/x-pack/plugins/osquery/public/routes/scheduled_query_groups/details/actions_menu.tsx @@ -5,10 +5,11 @@ * 2.0. */ +import { FormattedMessage } from '@kbn/i18n/react'; import { EuiButton, EuiContextMenuPanel, EuiContextMenuItem, EuiPopover } from '@elastic/eui'; import React, { useCallback, useMemo, useState } from 'react'; -import { useKibana } from '../../../common/lib/kibana'; +import { useDiscoverLink } from '../../../common/hooks'; interface LiveQueryDetailsActionsMenuProps { actionId: string; @@ -17,13 +18,9 @@ interface LiveQueryDetailsActionsMenuProps { const LiveQueryDetailsActionsMenuComponent: React.FC = ({ actionId, }) => { - const services = useKibana().services; + const discoverLinkProps = useDiscoverLink({ filters: [{ key: 'action_id', value: actionId }] }); const [isPopoverOpen, setPopover] = useState(false); - const discoverLinkHref = services?.application?.getUrlForApp('discover', { - path: `#/?_g=(filters:!(),refreshInterval:(pause:!t,value:0),time:(from:now-24h,to:now))&_a=(columns:!(),filters:!(('$state':(store:appState),meta:(alias:!n,disabled:!f,index:'logs-*',key:action_id,negate:!f,params:(query:'${actionId}'),type:phrase),query:(match_phrase:(action_id:'${actionId}')))),index:'logs-*',interval:auto,query:(language:kuery,query:''),sort:!(!('@timestamp',desc)))`, - }); - const onButtonClick = useCallback(() => { setPopover((currentIsPopoverOpen) => !currentIsPopoverOpen); }, []); @@ -34,17 +31,26 @@ const LiveQueryDetailsActionsMenuComponent: React.FC [ - - Check results in Discover + + , ], - [discoverLinkHref] + [discoverLinkProps] ); - const button = ( - - Actions - + const button = useMemo( + () => ( + + + + ), + [onButtonClick] ); return ( diff --git a/x-pack/plugins/osquery/public/routes/scheduled_query_groups/details/index.tsx b/x-pack/plugins/osquery/public/routes/scheduled_query_groups/details/index.tsx new file mode 100644 index 0000000000000..d27dcfe194366 --- /dev/null +++ b/x-pack/plugins/osquery/public/routes/scheduled_query_groups/details/index.tsx @@ -0,0 +1,123 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import { + EuiButtonEmpty, + EuiButton, + EuiFlexGroup, + EuiFlexItem, + EuiDescriptionList, + EuiDescriptionListTitle, + EuiDescriptionListDescription, +} from '@elastic/eui'; +import { FormattedMessage } from '@kbn/i18n/react'; +import React, { useMemo } from 'react'; +import { useParams } from 'react-router-dom'; +import styled from 'styled-components'; + +import { useRouterNavigate } from '../../../common/lib/kibana'; +import { WithHeaderLayout } from '../../../components/layouts'; +import { useScheduledQueryGroup } from '../../../scheduled_query_groups/use_scheduled_query_group'; +import { ScheduledQueryGroupQueriesTable } from '../../../scheduled_query_groups/scheduled_query_group_queries_table'; +import { useBreadcrumbs } from '../../../common/hooks/use_breadcrumbs'; +import { AgentsPolicyLink } from '../../../agent_policies/agents_policy_link'; +import { BetaBadge, BetaBadgeRowWrapper } from '../../../components/beta_badge'; + +const Divider = styled.div` + width: 0; + height: 100%; + border-left: ${({ theme }) => theme.eui.euiBorderThin}; +`; + +const ScheduledQueryGroupDetailsPageComponent = () => { + const { scheduledQueryGroupId } = useParams<{ scheduledQueryGroupId: string }>(); + const scheduledQueryGroupsListProps = useRouterNavigate('scheduled_query_groups'); + const editQueryLinkProps = useRouterNavigate( + `scheduled_query_groups/${scheduledQueryGroupId}/edit` + ); + + const { data } = useScheduledQueryGroup({ scheduledQueryGroupId }); + + useBreadcrumbs('scheduled_query_group_details', { scheduledQueryGroupName: data?.name ?? '' }); + + const LeftColumn = useMemo( + () => ( + + + + + + + + +

    + +

    + +
    +
    +
    + ), + [data?.name, scheduledQueryGroupsListProps] + ); + + const RightColumn = useMemo( + () => ( + + + {/* eslint-disable-next-line react-perf/jsx-no-new-object-as-prop */} + + + + + + {data?.policy_id ? : null} + + + + + + + + + + + + + ), + [data?.policy_id, editQueryLinkProps] + ); + + return ( + + {data && } + + ); +}; + +export const ScheduledQueryGroupDetailsPage = React.memo(ScheduledQueryGroupDetailsPageComponent); diff --git a/x-pack/plugins/osquery/public/routes/scheduled_query_groups/edit/index.tsx b/x-pack/plugins/osquery/public/routes/scheduled_query_groups/edit/index.tsx new file mode 100644 index 0000000000000..0d63dba2fd1e6 --- /dev/null +++ b/x-pack/plugins/osquery/public/routes/scheduled_query_groups/edit/index.tsx @@ -0,0 +1,74 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import { EuiButtonEmpty, EuiFlexGroup, EuiFlexItem, EuiLoadingContent } from '@elastic/eui'; +import { FormattedMessage } from '@kbn/i18n/react'; +import React, { useMemo } from 'react'; +import { useParams } from 'react-router-dom'; + +import { WithHeaderLayout } from '../../../components/layouts'; +import { useRouterNavigate } from '../../../common/lib/kibana'; +import { ScheduledQueryGroupForm } from '../../../scheduled_query_groups/form'; +import { useScheduledQueryGroup } from '../../../scheduled_query_groups/use_scheduled_query_group'; +import { useBreadcrumbs } from '../../../common/hooks/use_breadcrumbs'; +import { BetaBadge, BetaBadgeRowWrapper } from '../../../components/beta_badge'; + +const EditScheduledQueryGroupPageComponent = () => { + const { scheduledQueryGroupId } = useParams<{ scheduledQueryGroupId: string }>(); + const queryDetailsLinkProps = useRouterNavigate( + `scheduled_query_groups/${scheduledQueryGroupId}` + ); + + const { data } = useScheduledQueryGroup({ scheduledQueryGroupId }); + + useBreadcrumbs('scheduled_query_group_edit', { scheduledQueryGroupName: data?.name ?? '' }); + + const LeftColumn = useMemo( + () => ( + + + + + + + + +

    + +

    + +
    +
    +
    + ), + [data?.name, queryDetailsLinkProps] + ); + + return ( + + {!data ? ( + + ) : ( + + )} + + ); +}; + +export const EditScheduledQueryGroupPage = React.memo(EditScheduledQueryGroupPageComponent); diff --git a/x-pack/plugins/osquery/public/routes/scheduled_query_groups/index.tsx b/x-pack/plugins/osquery/public/routes/scheduled_query_groups/index.tsx new file mode 100644 index 0000000000000..76ca2bf14d303 --- /dev/null +++ b/x-pack/plugins/osquery/public/routes/scheduled_query_groups/index.tsx @@ -0,0 +1,39 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import React from 'react'; +import { Switch, Route, useRouteMatch } from 'react-router-dom'; + +import { ScheduledQueryGroupsPage } from './list'; +import { AddScheduledQueryGroupPage } from './add'; +import { EditScheduledQueryGroupPage } from './edit'; +import { ScheduledQueryGroupDetailsPage } from './details'; +import { useBreadcrumbs } from '../../common/hooks/use_breadcrumbs'; + +const ScheduledQueryGroupsComponent = () => { + useBreadcrumbs('scheduled_query_groups'); + const match = useRouteMatch(); + + return ( + + + + + + + + + + + + + + + ); +}; + +export const ScheduledQueryGroups = React.memo(ScheduledQueryGroupsComponent); diff --git a/x-pack/plugins/osquery/public/routes/scheduled_query_groups/list/index.tsx b/x-pack/plugins/osquery/public/routes/scheduled_query_groups/list/index.tsx new file mode 100644 index 0000000000000..b02ef95498b5c --- /dev/null +++ b/x-pack/plugins/osquery/public/routes/scheduled_query_groups/list/index.tsx @@ -0,0 +1,58 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import { EuiButton, EuiFlexGroup, EuiFlexItem } from '@elastic/eui'; +import { FormattedMessage } from '@kbn/i18n/react'; +import React, { useMemo } from 'react'; + +import { useRouterNavigate } from '../../../common/lib/kibana'; +import { WithHeaderLayout } from '../../../components/layouts'; +import { ScheduledQueryGroupsTable } from '../../../scheduled_query_groups/scheduled_query_groups_table'; +import { BetaBadge, BetaBadgeRowWrapper } from '../../../components/beta_badge'; + +const ScheduledQueryGroupsPageComponent = () => { + const newQueryLinkProps = useRouterNavigate('scheduled_query_groups/add'); + + const LeftColumn = useMemo( + () => ( + + + +

    + +

    + +
    +
    +
    + ), + [] + ); + + const RightColumn = useMemo( + () => ( + + + + ), + [newQueryLinkProps] + ); + + return ( + + + + ); +}; + +export const ScheduledQueryGroupsPage = React.memo(ScheduledQueryGroupsPageComponent); diff --git a/x-pack/plugins/osquery/public/scheduled_query/common/osquery_stream_field.tsx b/x-pack/plugins/osquery/public/scheduled_query/common/osquery_stream_field.tsx deleted file mode 100644 index 6f589f6f64b13..0000000000000 --- a/x-pack/plugins/osquery/public/scheduled_query/common/osquery_stream_field.tsx +++ /dev/null @@ -1,169 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. - */ - -import { find } from 'lodash/fp'; -import { - EuiButtonIcon, - EuiFieldText, - EuiForm, - EuiFormRow, - EuiSelect, - EuiSpacer, - EuiSwitch, - EuiHorizontalRule, -} from '@elastic/eui'; -import React, { useCallback, useMemo } from 'react'; -import { useQuery } from 'react-query'; - -import { useKibana } from '../../common/lib/kibana'; - -// @ts-expect-error update types -const OsqueryStreamFieldComponent = ({ field, removeItem }) => { - const { http } = useKibana().services; - const { data: { saved_objects: savedQueries } = {} } = useQuery(['savedQueryList'], () => - http.get('/internal/osquery/saved_query', { - query: { pageIndex: 0, pageSize: 100, sortField: 'updated_at', sortDirection: 'desc' }, - }) - ); - - const { setValue } = field; - - const savedQueriesOptions = useMemo( - () => - // @ts-expect-error update types - (savedQueries ?? []).map((savedQuery) => ({ - text: savedQuery.attributes.name, - value: savedQuery.id, - })), - [savedQueries] - ); - - const handleSavedQueryChange = useCallback( - (event) => { - event.persist(); - const savedQueryId = event.target.value; - const savedQuery = find(['id', savedQueryId], savedQueries); - - if (savedQuery) { - // @ts-expect-error update types - setValue((prev) => ({ - ...prev, - vars: { - ...prev.vars, - id: { - ...prev.vars.id, - value: savedQuery.id, - }, - query: { - ...prev.vars.query, - value: savedQuery.attributes.query, - }, - }, - })); - } - }, - [savedQueries, setValue] - ); - - const handleEnabledChange = useCallback(() => { - // @ts-expect-error update types - setValue((prev) => ({ - ...prev, - enabled: !prev.enabled, - })); - }, [setValue]); - - const handleQueryChange = useCallback( - (event) => { - event.persist(); - // @ts-expect-error update types - setValue((prev) => ({ - ...prev, - vars: { - ...prev.vars, - query: { - ...prev.vars.query, - value: event.target.value, - }, - }, - })); - }, - [setValue] - ); - - const handleIntervalChange = useCallback( - (event) => { - event.persist(); - // @ts-expect-error update types - setValue((prev) => ({ - ...prev, - vars: { - ...prev.vars, - interval: { - ...prev.vars.interval, - value: event.target.value, - }, - }, - })); - }, - [setValue] - ); - - const handleIdChange = useCallback( - (event) => { - event.persist(); - // @ts-expect-error update types - setValue((prev) => ({ - ...prev, - vars: { - ...prev.vars, - id: { - ...prev.vars.id, - value: event.target.value, - }, - }, - })); - }, - [setValue] - ); - - return ( - - - - - - - - - - - - - - - - - - - - - - - - - - - ); -}; - -export const OsqueryStreamField = React.memo(OsqueryStreamFieldComponent); diff --git a/x-pack/plugins/osquery/public/scheduled_query/edit/form.tsx b/x-pack/plugins/osquery/public/scheduled_query/edit/form.tsx deleted file mode 100644 index 3e0e2b33efdae..0000000000000 --- a/x-pack/plugins/osquery/public/scheduled_query/edit/form.tsx +++ /dev/null @@ -1,153 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. - */ - -import produce from 'immer'; -import { get, omit } from 'lodash/fp'; -import { EuiButton, EuiButtonEmpty, EuiSpacer, EuiHorizontalRule } from '@elastic/eui'; -import uuid from 'uuid'; -import React, { useMemo } from 'react'; - -import { - UseField, - useForm, - UseArray, - getUseField, - Field, - ToggleField, - Form, -} from '../../shared_imports'; - -import { OsqueryStreamField } from '../common/osquery_stream_field'; -import { schema } from './schema'; - -const CommonUseField = getUseField({ component: Field }); - -const EDIT_SCHEDULED_QUERY_FORM_ID = 'editScheduledQueryForm'; - -interface EditScheduledQueryFormProps { - // eslint-disable-next-line @typescript-eslint/no-explicit-any - agentPolicies: Array>; - // eslint-disable-next-line @typescript-eslint/no-explicit-any - data: Array>; - handleSubmit: () => Promise; -} - -const EditScheduledQueryFormComponent: React.FC = ({ - agentPolicies, - data, - handleSubmit, -}) => { - const agentPoliciesOptions = useMemo( - () => - agentPolicies.map((policy) => ({ - value: policy.id, - text: policy.name, - })), - [agentPolicies] - ); - - const { form } = useForm({ - schema, - id: EDIT_SCHEDULED_QUERY_FORM_ID, - onSubmit: handleSubmit, - defaultValue: data, - // @ts-expect-error update types - deserializer: (payload) => { - const deserialized = produce(payload, (draft) => { - // @ts-expect-error update types - draft.inputs[0].streams.forEach((stream) => { - delete stream.compiled_stream; - }); - }); - - return deserialized; - }, - // @ts-expect-error update types - serializer: (payload) => - omit(['id', 'revision', 'created_at', 'created_by', 'updated_at', 'updated_by', 'version'], { - ...data, - ...payload, - // @ts-expect-error update types - inputs: [{ type: 'osquery', ...((payload.inputs && payload.inputs[0]) ?? {}) }], - }), - }); - - const { submit } = form; - - const policyIdComponentProps = useMemo( - () => ({ - euiFieldProps: { - disabled: true, - options: agentPoliciesOptions, - }, - }), - [agentPoliciesOptions] - ); - - return ( -
    - - - - - - - - - - - {({ items, addItem, removeItem }) => ( - <> - {items.map((item) => ( - removeItem(item.id)} - defaultValue={ - // eslint-disable-next-line react-perf/jsx-no-new-object-as-prop - get(item.path, form.getFormData()) ?? { - data_stream: { - type: 'logs', - dataset: 'osquery_elastic_managed.osquery', - }, - vars: { - query: { - type: 'text', - value: 'select * from uptime', - }, - interval: { - type: 'text', - value: '120', - }, - id: { - type: 'text', - value: uuid.v4(), - }, - }, - enabled: true, - } - } - /> - ))} - - {'Add query'} - - - )} - - - - - Save - - - ); -}; - -export const EditScheduledQueryForm = React.memo(EditScheduledQueryFormComponent); diff --git a/x-pack/plugins/osquery/public/scheduled_query/edit/index.tsx b/x-pack/plugins/osquery/public/scheduled_query/edit/index.tsx deleted file mode 100644 index 65dec2e467b35..0000000000000 --- a/x-pack/plugins/osquery/public/scheduled_query/edit/index.tsx +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. - */ - -import React from 'react'; -import { useParams } from 'react-router-dom'; -import { useMutation, useQuery } from 'react-query'; - -import { useKibana } from '../../common/lib/kibana'; -import { EditScheduledQueryForm } from './form'; - -const EditScheduledQueryPageComponent = () => { - const { http } = useKibana().services; - const { scheduledQueryId } = useParams<{ scheduledQueryId: string }>(); - - const { data } = useQuery(['scheduledQuery', { scheduledQueryId }], () => - http.get(`/internal/osquery/scheduled_query/${scheduledQueryId}`) - ); - - const { data: agentPolicies } = useQuery( - ['agentPolicy'], - () => http.get(`/api/fleet/agent_policies`), - { initialData: { items: [] } } - ); - - const updateScheduledQueryMutation = useMutation((payload) => - http.put(`/api/fleet/package_policies/${scheduledQueryId}`, { body: JSON.stringify(payload) }) - ); - - if (data) { - return ( - - ); - } - - return
    Loading
    ; -}; - -export const EditScheduledQueryPage = React.memo(EditScheduledQueryPageComponent); diff --git a/x-pack/plugins/osquery/public/scheduled_query/edit/schema.ts b/x-pack/plugins/osquery/public/scheduled_query/edit/schema.ts deleted file mode 100644 index 75a6d955c62ec..0000000000000 --- a/x-pack/plugins/osquery/public/scheduled_query/edit/schema.ts +++ /dev/null @@ -1,26 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. - */ - -import { FIELD_TYPES } from '../../shared_imports'; - -export const schema = { - policy_id: { - type: FIELD_TYPES.SELECT, - label: 'Policy', - }, - name: { - type: FIELD_TYPES.TEXT, - label: 'Name', - }, - description: { - type: FIELD_TYPES.TEXT, - label: 'Description', - }, - streams: { - type: FIELD_TYPES.MULTI_SELECT, - }, -}; diff --git a/x-pack/plugins/osquery/public/scheduled_query/index.tsx b/x-pack/plugins/osquery/public/scheduled_query/index.tsx deleted file mode 100644 index 205c87b3a0d50..0000000000000 --- a/x-pack/plugins/osquery/public/scheduled_query/index.tsx +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. - */ - -import React from 'react'; -import { Switch, Route, useRouteMatch } from 'react-router-dom'; - -import { ScheduledQueriesPage } from './queries'; -import { NewScheduledQueryPage } from './new'; -import { EditScheduledQueryPage } from './edit'; -// import { QueryAgentResults } from './agent_results'; -// import { SavedQueriesPage } from './saved_query'; - -const ScheduledQueriesComponent = () => { - const match = useRouteMatch(); - - return ( - - - - - {/* - - */} - - - - - - - - ); -}; - -export const ScheduledQueries = React.memo(ScheduledQueriesComponent); diff --git a/x-pack/plugins/osquery/public/scheduled_query/new/form.tsx b/x-pack/plugins/osquery/public/scheduled_query/new/form.tsx deleted file mode 100644 index 186e74d190c6d..0000000000000 --- a/x-pack/plugins/osquery/public/scheduled_query/new/form.tsx +++ /dev/null @@ -1,105 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. - */ - -import { EuiButton, EuiButtonEmpty, EuiSpacer } from '@elastic/eui'; -import deepmerge from 'deepmerge'; -import React, { useCallback } from 'react'; - -import { useForm, UseArray, UseField, getUseField, Field, Form } from '../../shared_imports'; - -import { OsqueryStreamField } from '../common/osquery_stream_field'; -import { defaultValue, schema } from './schema'; -import { combineMerge } from './utils'; - -const CommonUseField = getUseField({ component: Field }); - -const NEW_SCHEDULED_QUERY_FORM_ID = 'newScheduledQueryForm'; - -interface NewScheduledQueryFormProps { - handleSubmit: () => Promise; -} - -const NewScheduledQueryFormComponent: React.FC = ({ handleSubmit }) => { - const { form } = useForm({ - schema, - id: NEW_SCHEDULED_QUERY_FORM_ID, - options: { - stripEmptyFields: false, - }, - onSubmit: handleSubmit, - // @ts-expect-error update types - defaultValue, - serializer: (payload) => - deepmerge(defaultValue, payload, { - arrayMerge: combineMerge, - }), - }); - const { submit } = form; - - const StreamsContent = useCallback( - ({ items, addItem, removeItem }) => ( - <> - { - // @ts-expect-error update types - items.map((item) => ( - removeItem(item.id)} - // eslint-disable-next-line react-perf/jsx-no-new-object-as-prop - defaultValue={{ - data_stream: { - type: 'logs', - dataset: 'osquery_elastic_managed.osquery', - }, - vars: { - query: { - type: 'text', - value: '', - }, - interval: { - type: 'text', - value: '', - }, - id: { - type: 'text', - value: '', - }, - }, - enabled: true, - }} - /> - )) - } - - {'Add query'} - - - ), - [] - ); - - return ( -
    - - - - - - {StreamsContent} - - - - {'Save'} - - - ); -}; - -export const NewScheduledQueryForm = React.memo(NewScheduledQueryFormComponent); diff --git a/x-pack/plugins/osquery/public/scheduled_query/new/index.tsx b/x-pack/plugins/osquery/public/scheduled_query/new/index.tsx deleted file mode 100644 index bb4ae6f113de2..0000000000000 --- a/x-pack/plugins/osquery/public/scheduled_query/new/index.tsx +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. - */ - -import React from 'react'; -import { useHistory } from 'react-router-dom'; -import { useMutation } from 'react-query'; - -import { useKibana } from '../../common/lib/kibana'; -import { NewScheduledQueryForm } from './form'; - -const NewScheduledQueryPageComponent = () => { - const { http } = useKibana().services; - const history = useHistory(); - - const createScheduledQueryMutation = useMutation( - (payload) => http.post(`/api/fleet/package_policies`, { body: JSON.stringify(payload) }), - { - onSuccess: (data) => { - history.push(`/scheduled_queries/${data.item.id}`); - }, - } - ); - - // @ts-expect-error update types - return ; -}; - -export const NewScheduledQueryPage = React.memo(NewScheduledQueryPageComponent); diff --git a/x-pack/plugins/osquery/public/scheduled_query/new/schema.ts b/x-pack/plugins/osquery/public/scheduled_query/new/schema.ts deleted file mode 100644 index aef33e57f6f30..0000000000000 --- a/x-pack/plugins/osquery/public/scheduled_query/new/schema.ts +++ /dev/null @@ -1,67 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. - */ - -import { FIELD_TYPES } from '../../shared_imports'; - -export const defaultValue = { - name: '', - description: '', - namespace: 'default', - enabled: true, - policy_id: '1e2bb670-686c-11eb-84b4-81282a213fcf', - output_id: '', - package: { - name: 'osquery_elastic_managed', - title: 'OSquery Elastic Managed', - version: '0.1.2', - }, - inputs: [ - { - type: 'osquery', - enabled: true, - streams: [], - }, - ], -}; - -export const schema = { - name: { - type: FIELD_TYPES.TEXT, - label: 'Name', - }, - description: { - type: FIELD_TYPES.TEXT, - label: 'Description', - }, - namespace: { - type: FIELD_TYPES.TEXT, - }, - enabled: { - type: FIELD_TYPES.TOGGLE, - }, - policy_id: { - type: FIELD_TYPES.TEXT, - }, - inputs: { - enabled: { - type: FIELD_TYPES.TOGGLE, - }, - streams: { - type: FIELD_TYPES.MULTI_SELECT, - vars: { - query: { - type: { - type: FIELD_TYPES.TEXT, - }, - value: { - type: FIELD_TYPES.TEXT, - }, - }, - }, - }, - }, -}; diff --git a/x-pack/plugins/osquery/public/scheduled_query/new/utils.ts b/x-pack/plugins/osquery/public/scheduled_query/new/utils.ts deleted file mode 100644 index 2de5c90f19c0e..0000000000000 --- a/x-pack/plugins/osquery/public/scheduled_query/new/utils.ts +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. - */ - -import deepmerge from 'deepmerge'; - -// @ts-expect-error update types -export const combineMerge = (target, source, options) => { - const destination = target.slice(); - - // @ts-expect-error update types - source.forEach((item, index) => { - if (typeof destination[index] === 'undefined') { - destination[index] = options.cloneUnlessOtherwiseSpecified(item, options); - } else if (options.isMergeableObject(item)) { - destination[index] = deepmerge(target[index], item, options); - } else if (target.indexOf(item) === -1) { - destination.push(item); - } - }); - return destination; -}; diff --git a/x-pack/plugins/osquery/public/scheduled_query/queries/index.tsx b/x-pack/plugins/osquery/public/scheduled_query/queries/index.tsx deleted file mode 100644 index 24a78320e30d2..0000000000000 --- a/x-pack/plugins/osquery/public/scheduled_query/queries/index.tsx +++ /dev/null @@ -1,185 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. - */ - -import { - EuiBasicTable, - EuiButton, - EuiButtonIcon, - EuiCodeBlock, - RIGHT_ALIGNMENT, -} from '@elastic/eui'; -import React, { useCallback, useMemo, useState } from 'react'; -import { useQuery } from 'react-query'; -import { useHistory } from 'react-router-dom'; - -import { Direction } from '../../../common/search_strategy'; -import { useKibana, useRouterNavigate } from '../../common/lib/kibana'; - -const ScheduledQueriesPageComponent = () => { - const { push } = useHistory(); - const [pageIndex, setPageIndex] = useState(0); - const [pageSize, setPageSize] = useState(5); - const [sortField, setSortField] = useState('updated_at'); - const [sortDirection, setSortDirection] = useState(Direction.desc); - // eslint-disable-next-line @typescript-eslint/no-explicit-any - const [itemIdToExpandedRowMap, setItemIdToExpandedRowMap] = useState>({}); - const { http } = useKibana().services; - const newQueryLinkProps = useRouterNavigate('scheduled_queries/new'); - - const { data = {} } = useQuery( - ['scheduledQueryList', { pageIndex, pageSize, sortField, sortDirection }], - () => - http.get('/internal/osquery/scheduled_query', { - query: { - pageIndex, - pageSize, - sortField, - sortDirection, - }, - }), - { - keepPreviousData: true, - // Refetch the data every 5 seconds - refetchInterval: 5000, - } - ); - const { total = 0, items: savedQueries } = data; - - const toggleDetails = useCallback( - (item) => () => { - const itemIdToExpandedRowMapValues = { ...itemIdToExpandedRowMap }; - if (itemIdToExpandedRowMapValues[item.id]) { - delete itemIdToExpandedRowMapValues[item.id]; - } else { - // @ts-expect-error update types - itemIdToExpandedRowMapValues[item.id] = item.inputs[0].streams.map((stream) => ( - - {`${stream.vars.query.value} every ${stream.vars.interval.value}s`} - - )); - } - setItemIdToExpandedRowMap(itemIdToExpandedRowMapValues); - }, - [itemIdToExpandedRowMap] - ); - - const renderExtendedItemToggle = useCallback( - (item) => ( - - ), - [itemIdToExpandedRowMap, toggleDetails] - ); - - const handleEditClick = useCallback((item) => push(`/scheduled_queries/${item.id}`), [push]); - - const columns = useMemo( - () => [ - { - field: 'name', - name: 'Query name', - sortable: true, - truncateText: true, - }, - { - field: 'enabled', - name: 'Active', - sortable: true, - truncateText: true, - }, - { - field: 'updated_at', - name: 'Last updated at', - sortable: true, - truncateText: true, - }, - { - name: 'Actions', - actions: [ - { - name: 'Edit', - description: 'Edit or run this query', - type: 'icon', - icon: 'documentEdit', - onClick: handleEditClick, - }, - ], - }, - { - align: RIGHT_ALIGNMENT, - width: '40px', - isExpander: true, - render: renderExtendedItemToggle, - }, - ], - [handleEditClick, renderExtendedItemToggle] - ); - - const onTableChange = useCallback(({ page = {}, sort = {} }) => { - setPageIndex(page.index); - setPageSize(page.size); - setSortField(sort.field); - setSortDirection(sort.direction); - }, []); - - const pagination = useMemo( - () => ({ - pageIndex, - pageSize, - totalItemCount: total, - pageSizeOptions: [3, 5, 8], - }), - [total, pageIndex, pageSize] - ); - - const sorting = useMemo( - () => ({ - sort: { - field: sortField, - direction: sortDirection, - }, - }), - [sortDirection, sortField] - ); - - const selection = useMemo( - () => ({ - selectable: () => true, - initialSelected: [], - }), - [] - ); - - return ( -
    - - {'New query'} - - - {savedQueries && ( - - )} -
    - ); -}; - -export const ScheduledQueriesPage = React.memo(ScheduledQueriesPageComponent); diff --git a/x-pack/plugins/osquery/public/scheduled_query_groups/active_state_switch.tsx b/x-pack/plugins/osquery/public/scheduled_query_groups/active_state_switch.tsx new file mode 100644 index 0000000000000..578cd4654e6b8 --- /dev/null +++ b/x-pack/plugins/osquery/public/scheduled_query_groups/active_state_switch.tsx @@ -0,0 +1,139 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import { produce } from 'immer'; +import { EuiSwitch, EuiLoadingSpinner } from '@elastic/eui'; +import React, { useCallback, useState } from 'react'; +import { useMutation, useQueryClient } from 'react-query'; +import styled from 'styled-components'; +import { i18n } from '@kbn/i18n'; + +import { + PackagePolicy, + UpdatePackagePolicy, + packagePolicyRouteService, +} from '../../../fleet/common'; +import { useKibana } from '../common/lib/kibana'; +import { useAgentStatus } from '../agents/use_agent_status'; +import { useAgentPolicy } from '../agent_policies/use_agent_policy'; +import { ConfirmDeployAgentPolicyModal } from './form/confirmation_modal'; + +const StyledEuiLoadingSpinner = styled(EuiLoadingSpinner)` + margin-right: ${({ theme }) => theme.eui.paddingSizes.s}; +`; + +interface ActiveStateSwitchProps { + item: PackagePolicy; +} + +const ActiveStateSwitchComponent: React.FC = ({ item }) => { + const queryClient = useQueryClient(); + const { + http, + notifications: { toasts }, + } = useKibana().services; + const [confirmationModal, setConfirmationModal] = useState(false); + + const hideConfirmationModal = useCallback(() => setConfirmationModal(false), []); + + const { data: agentStatus } = useAgentStatus({ policyId: item.policy_id }); + const { data: agentPolicy } = useAgentPolicy({ policyId: item.policy_id }); + + const { isLoading, mutate } = useMutation( + ({ id, ...payload }: UpdatePackagePolicy & { id: string }) => + http.put(packagePolicyRouteService.getUpdatePath(id), { + body: JSON.stringify(payload), + }), + { + onSuccess: (response) => { + queryClient.invalidateQueries('scheduledQueries'); + toasts.addSuccess( + response.item.enabled + ? i18n.translate( + 'xpack.osquery.scheduledQueryGroup.table.activatedSuccessToastMessageText', + { + defaultMessage: 'Successfully activated {scheduledQueryGroupName}', + values: { + scheduledQueryGroupName: response.item.name, + }, + } + ) + : i18n.translate( + 'xpack.osquery.scheduledQueryGroup.table.deactivatedSuccessToastMessageText', + { + defaultMessage: 'Successfully deactivated {scheduledQueryGroupName}', + values: { + scheduledQueryGroupName: response.item.name, + }, + } + ) + ); + }, + } + ); + + const handleToggleActive = useCallback(() => { + const updatedPolicy = produce< + UpdatePackagePolicy & { id: string }, + Omit & + Partial<{ + revision: number; + updated_at: string; + updated_by: string; + created_at: string; + created_by: string; + }> + >(item, (draft) => { + delete draft.revision; + delete draft.updated_at; + delete draft.updated_by; + delete draft.created_at; + delete draft.created_by; + + draft.enabled = !item.enabled; + draft.inputs[0].streams.forEach((stream) => { + delete stream.compiled_stream; + }); + + return draft; + }); + + mutate(updatedPolicy); + hideConfirmationModal(); + }, [hideConfirmationModal, item, mutate]); + + const handleToggleActiveClick = useCallback(() => { + if (agentStatus?.total) { + return setConfirmationModal(true); + } + + handleToggleActive(); + }, [agentStatus?.total, handleToggleActive]); + + return ( + <> + {isLoading && } + + {confirmationModal && agentStatus?.total && ( + + )} + + ); +}; + +export const ActiveStateSwitch = React.memo(ActiveStateSwitchComponent); diff --git a/x-pack/plugins/osquery/public/scheduled_query_groups/form/add_query_flyout.tsx b/x-pack/plugins/osquery/public/scheduled_query_groups/form/add_query_flyout.tsx new file mode 100644 index 0000000000000..b2cfa05e0fc63 --- /dev/null +++ b/x-pack/plugins/osquery/public/scheduled_query_groups/form/add_query_flyout.tsx @@ -0,0 +1,124 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import { + EuiFlyout, + EuiTitle, + EuiSpacer, + EuiFlyoutBody, + EuiFlyoutHeader, + EuiFlyoutFooter, + EuiPortal, + EuiFlexGroup, + EuiFlexItem, + EuiButtonEmpty, + EuiButton, +} from '@elastic/eui'; +import React from 'react'; +import { FormattedMessage } from '@kbn/i18n/react'; +import { i18n } from '@kbn/i18n'; + +import { CodeEditorField } from '../../queries/form/code_editor_field'; +import { Form, useForm, FormData, getUseField, Field, FIELD_TYPES } from '../../shared_imports'; + +const FORM_ID = 'addQueryFlyoutForm'; + +const CommonUseField = getUseField({ component: Field }); + +interface AddQueryFlyoutProps { + onSave: (payload: FormData) => Promise; + onClose: () => void; +} + +const AddQueryFlyoutComponent: React.FC = ({ onSave, onClose }) => { + const { form } = useForm({ + id: FORM_ID, + // @ts-expect-error update types + onSubmit: (payload, isValid) => { + if (isValid) { + onSave(payload); + onClose(); + } + }, + schema: { + id: { + type: FIELD_TYPES.TEXT, + label: i18n.translate('xpack.osquery.scheduledQueryGroup.queryFlyoutForm.idFieldLabel', { + defaultMessage: 'ID', + }), + }, + query: { + type: FIELD_TYPES.TEXT, + label: i18n.translate('xpack.osquery.scheduledQueryGroup.queryFlyoutForm.queryFieldLabel', { + defaultMessage: 'Query', + }), + }, + interval: { + type: FIELD_TYPES.NUMBER, + label: i18n.translate( + 'xpack.osquery.scheduledQueryGroup.queryFlyoutForm.intervalFieldLabel', + { + defaultMessage: 'Interval (s)', + } + ), + }, + }, + }); + + const { submit } = form; + + return ( + + + + +

    + +

    +
    +
    + +
    + + + + + { + // eslint-disable-next-line react-perf/jsx-no-new-object-as-prop + + } + +
    + + + + + + + + + + + + + + +
    +
    + ); +}; + +export const AddQueryFlyout = React.memo(AddQueryFlyoutComponent); diff --git a/x-pack/plugins/osquery/public/scheduled_query_groups/form/confirmation_modal.tsx b/x-pack/plugins/osquery/public/scheduled_query_groups/form/confirmation_modal.tsx new file mode 100644 index 0000000000000..e686038430829 --- /dev/null +++ b/x-pack/plugins/osquery/public/scheduled_query_groups/form/confirmation_modal.tsx @@ -0,0 +1,82 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import React from 'react'; +import { EuiCallOut, EuiConfirmModal, EuiSpacer } from '@elastic/eui'; +import { FormattedMessage } from '@kbn/i18n/react'; +import { i18n } from '@kbn/i18n'; + +import { AgentPolicy } from '../../../../fleet/common'; + +interface ConfirmDeployAgentPolicyModalProps { + onConfirm: () => void; + onCancel: () => void; + agentCount: number; + agentPolicy: AgentPolicy; +} + +const ConfirmDeployAgentPolicyModalComponent: React.FC = ({ + onConfirm, + onCancel, + agentCount, + agentPolicy, +}) => ( + + } + onCancel={onCancel} + onConfirm={onConfirm} + cancelButtonText={ + + } + confirmButtonText={ + + } + buttonColor="primary" + > + +
    + {agentPolicy.name}, + }} + /> +
    +
    + + +
    +); + +export const ConfirmDeployAgentPolicyModal = React.memo(ConfirmDeployAgentPolicyModalComponent); diff --git a/x-pack/plugins/osquery/public/scheduled_query_groups/form/edit_query_flyout.tsx b/x-pack/plugins/osquery/public/scheduled_query_groups/form/edit_query_flyout.tsx new file mode 100644 index 0000000000000..41846636eccd4 --- /dev/null +++ b/x-pack/plugins/osquery/public/scheduled_query_groups/form/edit_query_flyout.tsx @@ -0,0 +1,136 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import { + EuiFlyout, + EuiTitle, + EuiSpacer, + EuiFlyoutBody, + EuiFlyoutHeader, + EuiFlyoutFooter, + EuiPortal, + EuiFlexGroup, + EuiFlexItem, + EuiButtonEmpty, + EuiButton, +} from '@elastic/eui'; +import React from 'react'; +import { FormattedMessage } from '@kbn/i18n/react'; +import { i18n } from '@kbn/i18n'; + +import { PackagePolicyInputStream } from '../../../../fleet/common'; +import { CodeEditorField } from '../../queries/form/code_editor_field'; +import { Form, useForm, getUseField, Field, FIELD_TYPES } from '../../shared_imports'; + +const FORM_ID = 'editQueryFlyoutForm'; + +const CommonUseField = getUseField({ component: Field }); + +interface EditQueryFlyoutProps { + defaultValue: PackagePolicyInputStream; + onSave: (payload: FormData) => void; + onClose: () => void; +} + +export const EditQueryFlyout: React.FC = ({ + defaultValue, + onSave, + onClose, +}) => { + const { form } = useForm({ + id: FORM_ID, + // @ts-expect-error update types + onSubmit: (payload, isValid) => { + if (isValid) { + // @ts-expect-error update types + onSave(payload); + onClose(); + } + return; + }, + defaultValue, + deserializer: (payload) => ({ + id: payload.vars.id.value, + query: payload.vars.query.value, + interval: payload.vars.interval.value, + }), + schema: { + id: { + type: FIELD_TYPES.TEXT, + label: i18n.translate('xpack.osquery.scheduledQueryGroup.queryFlyoutForm.idFieldLabel', { + defaultMessage: 'ID', + }), + }, + query: { + type: FIELD_TYPES.TEXT, + label: i18n.translate('xpack.osquery.scheduledQueryGroup.queryFlyoutForm.queryFieldLabel', { + defaultMessage: 'Query', + }), + }, + interval: { + type: FIELD_TYPES.NUMBER, + label: i18n.translate( + 'xpack.osquery.scheduledQueryGroup.queryFlyoutForm.intervalFieldLabel', + { + defaultMessage: 'Interval (s)', + } + ), + }, + }, + }); + + const { submit } = form; + + return ( + + + + +

    + +

    +
    +
    + +
    + + + + + { + // eslint-disable-next-line react-perf/jsx-no-new-object-as-prop + + } + +
    + + + + + + + + + + + + + + +
    +
    + ); +}; diff --git a/x-pack/plugins/osquery/public/scheduled_query_groups/form/index.tsx b/x-pack/plugins/osquery/public/scheduled_query_groups/form/index.tsx new file mode 100644 index 0000000000000..68652e13bed07 --- /dev/null +++ b/x-pack/plugins/osquery/public/scheduled_query_groups/form/index.tsx @@ -0,0 +1,339 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import { mapKeys } from 'lodash'; +import { merge } from 'lodash/fp'; +import { + EuiFlexGroup, + EuiFlexItem, + EuiButtonEmpty, + EuiButton, + EuiDescribedFormGroup, + EuiSpacer, + EuiAccordion, + EuiBottomBar, + EuiHorizontalRule, +} from '@elastic/eui'; +import React, { useCallback, useMemo, useState } from 'react'; +import { useMutation } from 'react-query'; +import { produce } from 'immer'; +import { i18n } from '@kbn/i18n'; +import { FormattedMessage } from '@kbn/i18n/react'; + +import { + AgentPolicy, + PackagePolicy, + PackagePolicyPackage, + packagePolicyRouteService, +} from '../../../../fleet/common'; +import { Form, useForm, useFormData, getUseField, Field, FIELD_TYPES } from '../../shared_imports'; +import { useKibana, useRouterNavigate } from '../../common/lib/kibana'; +import { PolicyIdComboBoxField } from './policy_id_combobox_field'; +import { QueriesField } from './queries_field'; +import { ConfirmDeployAgentPolicyModal } from './confirmation_modal'; +import { useAgentPolicies } from '../../agent_policies'; + +const GhostFormField = () => <>; + +const FORM_ID = 'scheduledQueryForm'; + +const CommonUseField = getUseField({ component: Field }); + +interface ScheduledQueryGroupFormProps { + defaultValue?: PackagePolicy; + packageInfo?: PackagePolicyPackage; + editMode?: boolean; +} + +const ScheduledQueryGroupFormComponent: React.FC = ({ + defaultValue, + packageInfo, + editMode = false, +}) => { + const { + application: { navigateToApp }, + http, + notifications: { toasts }, + } = useKibana().services; + const [showConfirmationModal, setShowConfirmationModal] = useState(false); + const handleHideConfirmationModal = useCallback(() => setShowConfirmationModal(false), []); + + const { data: agentPolicies } = useAgentPolicies(); + const agentPoliciesById = mapKeys(agentPolicies, 'id'); + const agentPolicyOptions = useMemo( + () => + agentPolicies?.map((agentPolicy) => ({ + key: agentPolicy.id, + label: agentPolicy.id, + })) ?? [], + [agentPolicies] + ); + + const cancelButtonProps = useRouterNavigate( + `scheduled_query_groups/${editMode ? defaultValue?.id : ''}` + ); + + const { isLoading, mutateAsync } = useMutation( + (payload: Record) => + editMode && defaultValue?.id + ? http.put(packagePolicyRouteService.getUpdatePath(defaultValue.id), { + body: JSON.stringify(payload), + }) + : http.post(packagePolicyRouteService.getCreatePath(), { + body: JSON.stringify(payload), + }), + { + onSuccess: (data) => { + if (!editMode) { + navigateToApp('osquery', { path: `scheduled_query_groups/${data.item.id}` }); + toasts.addSuccess( + i18n.translate('xpack.osquery.scheduledQueryGroup.form.createSuccessToastMessageText', { + defaultMessage: 'Successfully scheduled {scheduledQueryGroupName}', + values: { + scheduledQueryGroupName: data.item.name, + }, + }) + ); + return; + } + + navigateToApp('osquery', { path: `scheduled_query_groups/${data.item.id}` }); + toasts.addSuccess( + i18n.translate('xpack.osquery.scheduledQueryGroup.form.updateSuccessToastMessageText', { + defaultMessage: 'Successfully updated {scheduledQueryGroupName}', + values: { + scheduledQueryGroupName: data.item.name, + }, + }) + ); + }, + onError: (error) => { + // @ts-expect-error update types + toasts.addError(error, { title: error.body.error, toastMessage: error.body.message }); + }, + } + ); + + const { form } = useForm({ + id: FORM_ID, + schema: { + name: { + type: FIELD_TYPES.TEXT, + label: i18n.translate('xpack.osquery.scheduledQueryGroup.form.nameFieldLabel', { + defaultMessage: 'Name', + }), + }, + description: { + type: FIELD_TYPES.TEXT, + label: i18n.translate('xpack.osquery.scheduledQueryGroup.form.descriptionFieldLabel', { + defaultMessage: 'Description', + }), + }, + namespace: { + type: FIELD_TYPES.COMBO_BOX, + label: i18n.translate('xpack.osquery.scheduledQueryGroup.form.namespaceFieldLabel', { + defaultMessage: 'Namespace', + }), + }, + policy_id: { + type: FIELD_TYPES.COMBO_BOX, + label: i18n.translate('xpack.osquery.scheduledQueryGroup.form.agentPolicyFieldLabel', { + defaultMessage: 'Agent policy', + }), + }, + }, + onSubmit: (payload) => { + const formData = produce(payload, (draft) => { + // @ts-expect-error update types + draft.inputs[0].streams.forEach((stream) => { + delete stream.compiled_stream; + }); + return draft; + }); + return mutateAsync(formData); + }, + options: { + stripEmptyFields: false, + }, + // @ts-expect-error update types + deserializer: (payload) => ({ + ...payload, + policy_id: payload.policy_id.length ? [payload.policy_id] : [], + namespace: [payload.namespace], + }), + serializer: (payload) => ({ + ...payload, + // @ts-expect-error update types + policy_id: payload.policy_id[0], + // @ts-expect-error update types + namespace: payload.namespace[0], + }), + defaultValue: merge( + { + name: '', + description: '', + enabled: true, + policy_id: [], + namespace: 'default', + output_id: '', + package: packageInfo, + inputs: [ + { + type: 'osquery', + enabled: true, + streams: [], + }, + ], + }, + defaultValue ?? {} + ), + }); + + const { submit } = form; + + const policyIdEuiFieldProps = useMemo( + () => ({ isDisabled: !!defaultValue, options: agentPolicyOptions }), + [defaultValue, agentPolicyOptions] + ); + + const [{ policy_id: policyId }] = useFormData({ form, watch: ['policy_id'] }); + + const currentPolicy = useMemo(() => { + if (!policyId) { + return { + agentCount: 0, + agentPolicy: {} as AgentPolicy, + }; + } + + const currentAgentPolicy = agentPoliciesById[policyId[0]]; + return { + agentCount: currentAgentPolicy?.agents ?? 0, + agentPolicy: currentAgentPolicy, + }; + }, [agentPoliciesById, policyId]); + + const handleSaveClick = useCallback(() => { + if (currentPolicy.agentCount) { + setShowConfirmationModal(true); + return; + } + + submit(); + }, [currentPolicy.agentCount, submit]); + + const handleConfirmConfirmationClick = useCallback(() => { + submit(); + setShowConfirmationModal(false); + }, [submit]); + + return ( + <> +
    + + + + } + fullWidth + description={ + + } + > + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + {showConfirmationModal && ( + + )} + + ); +}; + +export const ScheduledQueryGroupForm = React.memo(ScheduledQueryGroupFormComponent); diff --git a/x-pack/plugins/osquery/public/scheduled_query_groups/form/pack_uploader.tsx b/x-pack/plugins/osquery/public/scheduled_query_groups/form/pack_uploader.tsx new file mode 100644 index 0000000000000..3cd1b96f12fa4 --- /dev/null +++ b/x-pack/plugins/osquery/public/scheduled_query_groups/form/pack_uploader.tsx @@ -0,0 +1,142 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import { mapKeys, kebabCase } from 'lodash'; +import { EuiLink, EuiFormRow, EuiFilePicker, EuiSpacer } from '@elastic/eui'; +import React, { useCallback, useState, useRef } from 'react'; +import { i18n } from '@kbn/i18n'; +import { FormattedMessage } from '@kbn/i18n/react'; + +const SUPPORTED_PACK_EXTENSIONS = ['application/json', 'text/plain']; + +const ExamplePackLink = React.memo(() => ( + + + +)); + +ExamplePackLink.displayName = 'ExamplePackLink'; + +interface OsqueryPackUploaderProps { + onChange: (payload: Record) => void; +} + +const OsqueryPackUploaderComponent: React.FC = ({ onChange }) => { + const packName = useRef(''); + const filePickerRef = useRef(null); + const [isInvalid, setIsInvalid] = useState(null); + // @ts-expect-error update types + let fileReader; + + const handleFileRead = () => { + // @ts-expect-error update types + const content = fileReader.result; + + let parsedContent; + + try { + parsedContent = JSON.parse(content.replaceAll('\\\n', ''), (key, value) => { + if (key === 'query') { + // remove any multiple spaces from the query + return value.replaceAll(/\s(?=\s)/gm, ''); + } + return value; + }); + + setIsInvalid(null); + } catch (error) { + setIsInvalid(error); + // @ts-expect-error update types + filePickerRef.current?.removeFiles(new Event('fake')); + } + + if (!parsedContent?.queries) { + return; + } + + const queriesJSON = mapKeys( + parsedContent?.queries, + (value, key) => `pack_${packName.current}_${key}` + ); + + onChange(queriesJSON); + // @ts-expect-error update types + filePickerRef.current?.removeFiles(new Event('fake')); + }; + + // @ts-expect-error update types + // eslint-disable-next-line react-hooks/exhaustive-deps + const handleFileChosen = (file) => { + fileReader = new FileReader(); + fileReader.onloadend = handleFileRead; + fileReader.readAsText(file); + }; + + const handleInputChange = useCallback( + (inputFiles) => { + if (!inputFiles.length) { + packName.current = ''; + return; + } + + if ( + inputFiles.length && + ((!!inputFiles[0].type.length && !SUPPORTED_PACK_EXTENSIONS.includes(inputFiles[0].type)) ?? + !inputFiles[0].name.endsWith('.conf')) + ) { + packName.current = ''; + setIsInvalid( + i18n.translate('xpack.osquery.packUploader.unsupportedFileTypeText', { + defaultMessage: + 'File type {fileType} is not supported, please upload {supportedFileTypes} config file', + values: { + fileType: inputFiles[0].type, + supportedFileTypes: SUPPORTED_PACK_EXTENSIONS.join(' or '), + }, + }) + ); + // @ts-expect-error update types + filePickerRef.current?.removeFiles(new Event('fake')); + return; + } + + packName.current = kebabCase(inputFiles[0].name.split('.')[0]); + handleFileChosen(inputFiles[0]); + }, + [handleFileChosen] + ); + + return ( + <> + + } + isInvalid={!!isInvalid} + error={<>{`${isInvalid}`}} + > + + + + ); +}; + +export const OsqueryPackUploader = React.memo(OsqueryPackUploaderComponent); diff --git a/x-pack/plugins/osquery/public/scheduled_query_groups/form/policy_id_combobox_field.tsx b/x-pack/plugins/osquery/public/scheduled_query_groups/form/policy_id_combobox_field.tsx new file mode 100644 index 0000000000000..75bb95b198f54 --- /dev/null +++ b/x-pack/plugins/osquery/public/scheduled_query_groups/form/policy_id_combobox_field.tsx @@ -0,0 +1,121 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import { FormattedMessage } from '@kbn/i18n/react'; +import { EuiFlexGroup, EuiFlexItem, EuiTextColor, EuiComboBoxOptionOption } from '@elastic/eui'; +import React, { useCallback, useMemo } from 'react'; +import styled from 'styled-components'; + +import { GetAgentPoliciesResponseItem } from '../../../../fleet/common'; +import { ComboBoxField, FieldHook } from '../../shared_imports'; + +// Custom styling for drop down list items due to: +// 1) the max-width and overflow properties is added to prevent long agent policy +// names/descriptions from overflowing the flex items +// 2) max-width is built from the grow property on the flex items because the value +// changes based on if Fleet is enabled/setup or not +const AgentPolicyNameColumn = styled(EuiFlexItem)` + max-width: ${(props) => `${((props.grow as number) / 9) * 100}%`}; + overflow: hidden; +`; +const AgentPolicyDescriptionColumn = styled(EuiFlexItem)` + max-width: ${(props) => `${((props.grow as number) / 9) * 100}%`}; + overflow: hidden; +`; + +type ComboBoxFieldProps = Parameters[0]; + +type PolicyIdComboBoxFieldProps = Pick & { + field: FieldHook; + agentPoliciesById: Record; +}; + +const PolicyIdComboBoxFieldComponent: React.FC = ({ + euiFieldProps, + field, + agentPoliciesById, +}) => { + const { value } = field; + + const renderOption = useCallback( + (option: EuiComboBoxOptionOption) => ( + + + + {(option.key && agentPoliciesById[option.key]?.name) ?? option.label} + + + + + {(option.key && agentPoliciesById[option.key].description) ?? ''} + + + + + + + + + ), + [agentPoliciesById] + ); + + const selectedOptions = useMemo(() => { + if (!value?.length || !value[0].length) return []; + + return value.map((policyId) => ({ + label: agentPoliciesById[policyId]?.name ?? policyId, + })); + }, [agentPoliciesById, value]); + + const helpText = useMemo(() => { + if (!value?.length || !value[0].length || !agentPoliciesById || !agentPoliciesById[value[0]]) + return; + + return ( + + ); + }, [agentPoliciesById, value]); + + const mergedEuiFieldProps = useMemo( + () => ({ + onCreateOption: null, + singleSelection: { asPlainText: true }, + noSuggestions: false, + isClearable: false, + selectedOptions, + renderOption, + ...euiFieldProps, + }), + [euiFieldProps, renderOption, selectedOptions] + ); + + return ( + + ); +}; + +export const PolicyIdComboBoxField = React.memo(PolicyIdComboBoxFieldComponent); diff --git a/x-pack/plugins/osquery/public/scheduled_query_groups/form/queries_field.tsx b/x-pack/plugins/osquery/public/scheduled_query_groups/form/queries_field.tsx new file mode 100644 index 0000000000000..7d5a2c5ac99ce --- /dev/null +++ b/x-pack/plugins/osquery/public/scheduled_query_groups/form/queries_field.tsx @@ -0,0 +1,190 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import { findIndex, forEach, pullAt } from 'lodash'; +import { EuiFlexGroup, EuiFlexItem, EuiButton, EuiSpacer } from '@elastic/eui'; +import { produce } from 'immer'; +import React, { useCallback, useState } from 'react'; +import { FormattedMessage } from '@kbn/i18n/react'; + +import { PackagePolicyInput, PackagePolicyInputStream } from '../../../../fleet/common'; +import { OSQUERY_INTEGRATION_NAME } from '../../../common'; +import { FieldHook } from '../../shared_imports'; +import { ScheduledQueryGroupQueriesTable } from '../scheduled_query_group_queries_table'; +import { AddQueryFlyout } from './add_query_flyout'; +import { EditQueryFlyout } from './edit_query_flyout'; +import { OsqueryPackUploader } from './pack_uploader'; + +interface QueriesFieldProps { + field: FieldHook; + scheduledQueryGroupId: string; +} + +interface GetNewStreamProps { + id: string; + interval: string; + query: string; + scheduledQueryGroupId?: string; +} + +const getNewStream = ({ id, interval, query, scheduledQueryGroupId }: GetNewStreamProps) => ({ + data_stream: { type: 'logs', dataset: `${OSQUERY_INTEGRATION_NAME}.result` }, + enabled: true, + id: scheduledQueryGroupId + ? `osquery-${OSQUERY_INTEGRATION_NAME}.result-${scheduledQueryGroupId}` + : null, + vars: { + id: { type: 'text', value: id }, + interval: { + type: 'integer', + value: interval, + }, + query: { type: 'text', value: query }, + }, +}); + +const QueriesFieldComponent: React.FC = ({ field, scheduledQueryGroupId }) => { + const [showAddQueryFlyout, setShowAddQueryFlyout] = useState(false); + const [showEditQueryFlyout, setShowEditQueryFlyout] = useState(-1); + + const handleShowAddFlyout = useCallback(() => setShowAddQueryFlyout(true), []); + const handleHideAddFlyout = useCallback(() => setShowAddQueryFlyout(false), []); + const handleHideEditFlyout = useCallback(() => setShowEditQueryFlyout(-1), []); + + const { setValue } = field; + + const handleDeleteClick = useCallback( + (stream: PackagePolicyInputStream) => { + const streamIndex = findIndex(field.value[0].streams, [ + 'vars.id.value', + stream.vars?.id.value, + ]); + + if (streamIndex > -1) { + setValue( + produce((draft) => { + pullAt(draft[0].streams, [streamIndex]); + + return draft; + }) + ); + } + }, + [field.value, setValue] + ); + + const handleEditClick = useCallback( + (stream: PackagePolicyInputStream) => { + const streamIndex = findIndex(field.value[0].streams, [ + 'vars.id.value', + stream.vars?.id.value, + ]); + + setShowEditQueryFlyout(streamIndex); + }, + [field.value] + ); + + const handleEditQuery = useCallback( + (updatedQuery) => { + if (showEditQueryFlyout >= 0) { + setValue( + produce((draft) => { + draft[0].streams[showEditQueryFlyout].vars.id.value = updatedQuery.id; + draft[0].streams[showEditQueryFlyout].vars.interval.value = updatedQuery.interval; + draft[0].streams[showEditQueryFlyout].vars.query.value = updatedQuery.query; + + return draft; + }) + ); + } + + handleHideEditFlyout(); + }, + [handleHideEditFlyout, setValue, showEditQueryFlyout] + ); + + const handleAddQuery = useCallback( + (newQuery) => { + setValue( + produce((draft) => { + draft[0].streams.push( + getNewStream({ + ...newQuery, + scheduledQueryGroupId, + }) + ); + return draft; + }) + ); + handleHideAddFlyout(); + }, + [handleHideAddFlyout, scheduledQueryGroupId, setValue] + ); + + const handlePackUpload = useCallback( + (newQueries) => { + setValue( + produce((draft) => { + forEach(newQueries, (newQuery, newQueryId) => { + draft[0].streams.push( + getNewStream({ + id: newQueryId, + interval: newQuery.interval, + query: newQuery.query, + scheduledQueryGroupId, + }) + ); + }); + + return draft; + }) + ); + }, + [scheduledQueryGroupId, setValue] + ); + + return ( + <> + + + + + + + + + {field.value && field.value[0].streams?.length ? ( + + ) : null} + + {} + {showAddQueryFlyout && ( + // @ts-expect-error update types + + )} + {showEditQueryFlyout != null && showEditQueryFlyout >= 0 && ( + + )} + + ); +}; + +export const QueriesField = React.memo(QueriesFieldComponent); diff --git a/x-pack/plugins/osquery/public/scheduled_query_groups/index.tsx b/x-pack/plugins/osquery/public/scheduled_query_groups/index.tsx new file mode 100644 index 0000000000000..f97127a946558 --- /dev/null +++ b/x-pack/plugins/osquery/public/scheduled_query_groups/index.tsx @@ -0,0 +1,8 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +export * from './scheduled_query_groups_table'; diff --git a/x-pack/plugins/osquery/public/scheduled_query_groups/scheduled_query_group_queries_table.tsx b/x-pack/plugins/osquery/public/scheduled_query_groups/scheduled_query_group_queries_table.tsx new file mode 100644 index 0000000000000..d501f56b789d7 --- /dev/null +++ b/x-pack/plugins/osquery/public/scheduled_query_groups/scheduled_query_group_queries_table.tsx @@ -0,0 +1,214 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import React, { useCallback, useEffect, useState, useMemo } from 'react'; +import { EuiInMemoryTable, EuiCodeBlock, EuiButtonIcon } from '@elastic/eui'; +import { i18n } from '@kbn/i18n'; + +import { PackagePolicy, PackagePolicyInputStream } from '../../../fleet/common'; +import { FilterStateStore } from '../../../../../src/plugins/data/common'; +import { useKibana } from '../common/lib/kibana'; + +interface ViewResultsInDiscoverActionProps { + item: PackagePolicyInputStream; +} + +const ViewResultsInDiscoverAction: React.FC = ({ item }) => { + const urlGenerator = useKibana().services.discover?.urlGenerator; + const [discoverUrl, setDiscoverUrl] = useState(''); + + useEffect(() => { + const getDiscoverUrl = async () => { + if (!urlGenerator?.createUrl) return; + + const newUrl = await urlGenerator.createUrl({ + indexPatternId: 'logs-*', + filters: [ + { + meta: { + index: 'logs-*', + alias: null, + negate: false, + disabled: false, + type: 'phrase', + key: 'action_id', + params: { query: item.vars?.id.value }, + }, + query: { match_phrase: { action_id: item.vars?.id.value } }, + $state: { store: FilterStateStore.APP_STATE }, + }, + ], + }); + setDiscoverUrl(newUrl); + }; + getDiscoverUrl(); + }, [item.vars?.id.value, urlGenerator]); + + return ( + + ); +}; + +interface ScheduledQueryGroupQueriesTableProps { + data: Pick; + editMode?: boolean; + onDeleteClick?: (item: PackagePolicyInputStream) => void; + onEditClick?: (item: PackagePolicyInputStream) => void; +} + +const ScheduledQueryGroupQueriesTableComponent: React.FC = ({ + data, + editMode = false, + onDeleteClick, + onEditClick, +}) => { + const renderDeleteAction = useCallback( + (item: PackagePolicyInputStream) => ( + onDeleteClick(item)} + iconType="trash" + aria-label={i18n.translate( + 'xpack.osquery.scheduledQueryGroup.queriesTable.deleteActionAriaLabel', + { + defaultMessage: 'Delete {queryName}', + values: { + queryName: item.vars?.id.value, + }, + } + )} + /> + ), + [onDeleteClick] + ); + + const renderEditAction = useCallback( + (item: PackagePolicyInputStream) => ( + onEditClick(item)} + iconType="pencil" + aria-label={i18n.translate( + 'xpack.osquery.scheduledQueryGroup.queriesTable.editActionAriaLabel', + { + defaultMessage: 'Edit {queryName}', + values: { + queryName: item.vars?.id.value, + }, + } + )} + /> + ), + [onEditClick] + ); + + const renderQueryColumn = useCallback( + (query: string) => ( + + {query} + + ), + [] + ); + + const renderDiscoverResultsAction = useCallback( + (item) => , + [] + ); + + const columns = useMemo( + () => [ + { + field: 'vars.id.value', + name: i18n.translate('xpack.osquery.scheduledQueryGroup.queriesTable.idColumnTitle', { + defaultMessage: 'ID', + }), + width: '20%', + }, + { + field: 'vars.interval.value', + name: i18n.translate('xpack.osquery.scheduledQueryGroup.queriesTable.intervalColumnTitle', { + defaultMessage: 'Interval', + }), + width: '100px', + }, + { + field: 'vars.query.value', + name: i18n.translate('xpack.osquery.scheduledQueryGroup.queriesTable.queryColumnTitle', { + defaultMessage: 'Query', + }), + render: renderQueryColumn, + }, + { + name: editMode + ? i18n.translate('xpack.osquery.scheduledQueryGroup.queriesTable.actionsColumnTitle', { + defaultMessage: 'Actions', + }) + : i18n.translate( + 'xpack.osquery.scheduledQueryGroup.queriesTable.viewResultsColumnTitle', + { + defaultMessage: 'View results', + } + ), + width: '120px', + actions: editMode + ? [ + { + render: renderEditAction, + }, + { + render: renderDeleteAction, + }, + ] + : [ + { + render: renderDiscoverResultsAction, + }, + ], + }, + ], + [editMode, renderDeleteAction, renderDiscoverResultsAction, renderEditAction, renderQueryColumn] + ); + + const sorting = useMemo( + () => ({ + sort: { + field: 'vars.id.value', + direction: 'asc' as const, + }, + }), + [] + ); + + return ( + + items={data.inputs[0].streams} + itemId="vars.id.value" + isExpandable={true} + columns={columns} + sorting={sorting} + /> + ); +}; + +export const ScheduledQueryGroupQueriesTable = React.memo(ScheduledQueryGroupQueriesTableComponent); diff --git a/x-pack/plugins/osquery/public/scheduled_query_groups/scheduled_query_groups_table.tsx b/x-pack/plugins/osquery/public/scheduled_query_groups/scheduled_query_groups_table.tsx new file mode 100644 index 0000000000000..7b5f91157132e --- /dev/null +++ b/x-pack/plugins/osquery/public/scheduled_query_groups/scheduled_query_groups_table.tsx @@ -0,0 +1,104 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import { EuiInMemoryTable, EuiBasicTableColumn, EuiLink } from '@elastic/eui'; +import React, { useCallback, useMemo } from 'react'; + +import { i18n } from '@kbn/i18n'; +import { PackagePolicy } from '../../../fleet/common'; +import { useRouterNavigate } from '../common/lib/kibana'; +import { useScheduledQueryGroups } from './use_scheduled_query_groups'; +import { ActiveStateSwitch } from './active_state_switch'; +import { AgentsPolicyLink } from '../agent_policies/agents_policy_link'; + +const ScheduledQueryNameComponent = ({ id, name }: { id: string; name: string }) => ( + {name} +); + +const ScheduledQueryName = React.memo(ScheduledQueryNameComponent); + +const renderName = (_: unknown, item: PackagePolicy) => ( + +); + +const ScheduledQueryGroupsTableComponent = () => { + const { data } = useScheduledQueryGroups(); + + const renderAgentPolicy = useCallback((policyId) => , []); + + const renderQueries = useCallback( + (streams: PackagePolicy['inputs'][0]['streams']) => <>{streams.length}, + [] + ); + + const renderActive = useCallback((_, item) => , []); + + const columns: Array> = useMemo( + () => [ + { + field: 'name', + name: i18n.translate('xpack.osquery.scheduledQueryGroups.table.nameColumnTitle', { + defaultMessage: 'Name', + }), + sortable: true, + render: renderName, + }, + { + field: 'policy_id', + name: i18n.translate('xpack.osquery.scheduledQueryGroups.table.policyColumnTitle', { + defaultMessage: 'Policy', + }), + truncateText: true, + render: renderAgentPolicy, + }, + { + field: 'inputs[0].streams', + name: i18n.translate( + 'xpack.osquery.scheduledQueryGroups.table.numberOfQueriesColumnTitle', + { + defaultMessage: 'Number of queries', + } + ), + render: renderQueries, + width: '150px', + }, + { + field: 'enabled', + name: i18n.translate('xpack.osquery.scheduledQueryGroups.table.activeColumnTitle', { + defaultMessage: 'Active', + }), + sortable: true, + align: 'right', + width: '80px', + render: renderActive, + }, + ], + [renderActive, renderAgentPolicy, renderQueries] + ); + + const sorting = useMemo( + () => ({ + sort: { + field: 'name', + direction: 'asc' as const, + }, + }), + [] + ); + + return ( + + // eslint-disable-next-line react-perf/jsx-no-new-array-as-prop + items={data?.items ?? []} + columns={columns} + pagination={true} + sorting={sorting} + /> + ); +}; + +export const ScheduledQueryGroupsTable = React.memo(ScheduledQueryGroupsTableComponent); diff --git a/x-pack/plugins/osquery/public/scheduled_query_groups/use_scheduled_query_group.ts b/x-pack/plugins/osquery/public/scheduled_query_groups/use_scheduled_query_group.ts new file mode 100644 index 0000000000000..e0f892d0302c0 --- /dev/null +++ b/x-pack/plugins/osquery/public/scheduled_query_groups/use_scheduled_query_group.ts @@ -0,0 +1,37 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import { useQuery } from 'react-query'; + +import { useKibana } from '../common/lib/kibana'; +import { + GetOnePackagePolicyResponse, + PackagePolicy, + packagePolicyRouteService, +} from '../../../fleet/common'; + +interface UseScheduledQueryGroup { + scheduledQueryGroupId: string; + skip?: boolean; +} + +export const useScheduledQueryGroup = ({ + scheduledQueryGroupId, + skip = false, +}: UseScheduledQueryGroup) => { + const { http } = useKibana().services; + + return useQuery( + ['scheduledQueryGroup', { scheduledQueryGroupId }], + () => http.get(packagePolicyRouteService.getInfoPath(scheduledQueryGroupId)), + { + keepPreviousData: true, + enabled: !skip, + select: (response) => response.item, + } + ); +}; diff --git a/x-pack/plugins/osquery/public/scheduled_query_groups/use_scheduled_query_groups.ts b/x-pack/plugins/osquery/public/scheduled_query_groups/use_scheduled_query_groups.ts new file mode 100644 index 0000000000000..3302d8e621eb7 --- /dev/null +++ b/x-pack/plugins/osquery/public/scheduled_query_groups/use_scheduled_query_groups.ts @@ -0,0 +1,46 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import { produce } from 'immer'; +import { useQuery } from 'react-query'; + +import { useKibana } from '../common/lib/kibana'; +import { + ListResult, + PackagePolicy, + packagePolicyRouteService, + PACKAGE_POLICY_SAVED_OBJECT_TYPE, +} from '../../../fleet/common'; +import { OSQUERY_INTEGRATION_NAME } from '../../common'; + +export const useScheduledQueryGroups = () => { + const { http } = useKibana().services; + + return useQuery>( + ['scheduledQueries'], + () => + http.get(packagePolicyRouteService.getListPath(), { + query: { + page: 1, + perPage: 10000, + kuery: `${PACKAGE_POLICY_SAVED_OBJECT_TYPE}.package.name: ${OSQUERY_INTEGRATION_NAME}`, + }, + }), + { + keepPreviousData: true, + select: produce((draft: ListResult) => { + draft.items = draft.items.filter( + (item) => + !( + item.inputs[0].streams.length === 1 && + !item.inputs[0].streams[0].compiled_stream.query + ) + ); + }), + } + ); +}; diff --git a/x-pack/plugins/osquery/public/shared_imports.ts b/x-pack/plugins/osquery/public/shared_imports.ts index 42e82b25d1b8f..bae73da78f704 100644 --- a/x-pack/plugins/osquery/public/shared_imports.ts +++ b/x-pack/plugins/osquery/public/shared_imports.ts @@ -28,6 +28,7 @@ export { } from '../../../../src/plugins/es_ui_shared/static/forms/hook_form_lib'; export { Field, + ComboBoxField, ToggleField, SelectField, } from '../../../../src/plugins/es_ui_shared/static/forms/components'; diff --git a/x-pack/plugins/osquery/public/types.ts b/x-pack/plugins/osquery/public/types.ts index 02b5fc9c7a5d6..f1dbec045dacc 100644 --- a/x-pack/plugins/osquery/public/types.ts +++ b/x-pack/plugins/osquery/public/types.ts @@ -5,6 +5,7 @@ * 2.0. */ +import { DiscoverStart } from '../../../../src/plugins/discover/public'; import { DataPublicPluginStart } from '../../../../src/plugins/data/public'; import { FleetStart } from '../../fleet/public'; import { CoreStart } from '../../../../src/core/public'; @@ -24,8 +25,9 @@ export interface AppPluginStartDependencies { } export interface StartPlugins { + discover: DiscoverStart; data: DataPublicPluginStart; - fleet?: FleetStart; + fleet: FleetStart; triggersActionsUi: TriggersAndActionsUIPublicPluginStart; } diff --git a/x-pack/plugins/osquery/server/config.ts b/x-pack/plugins/osquery/server/config.ts index 31be256611803..56d67400a47d9 100644 --- a/x-pack/plugins/osquery/server/config.ts +++ b/x-pack/plugins/osquery/server/config.ts @@ -8,7 +8,10 @@ import { TypeOf, schema } from '@kbn/config-schema'; export const ConfigSchema = schema.object({ - enabled: schema.boolean({ defaultValue: false }), + enabled: schema.boolean({ defaultValue: true }), + actionEnabled: schema.boolean({ defaultValue: false }), + savedQueries: schema.boolean({ defaultValue: false }), + packs: schema.boolean({ defaultValue: false }), }); export type ConfigType = TypeOf; diff --git a/x-pack/plugins/osquery/server/index.ts b/x-pack/plugins/osquery/server/index.ts index f19d47cbeffb3..30bc5ed5bd835 100644 --- a/x-pack/plugins/osquery/server/index.ts +++ b/x-pack/plugins/osquery/server/index.ts @@ -13,6 +13,9 @@ export const config = { schema: ConfigSchema, exposeToBrowser: { enabled: true, + actionEnabled: true, + savedQueries: true, + packs: true, }, }; export function plugin(initializerContext: PluginInitializerContext) { diff --git a/x-pack/plugins/osquery/server/lib/osquery_app_context_services.ts b/x-pack/plugins/osquery/server/lib/osquery_app_context_services.ts index ffe2a772ecb7f..5b1f8e780494d 100644 --- a/x-pack/plugins/osquery/server/lib/osquery_app_context_services.ts +++ b/x-pack/plugins/osquery/server/lib/osquery_app_context_services.ts @@ -68,7 +68,7 @@ export class OsqueryAppContextService { */ export interface OsqueryAppContext { logFactory: LoggerFactory; - config(): Promise; + config(): ConfigType; /** * Object readiness is tied to plugin start method diff --git a/x-pack/plugins/osquery/server/plugin.ts b/x-pack/plugins/osquery/server/plugin.ts index ce6e8d51d9b52..31f611c5f1d31 100644 --- a/x-pack/plugins/osquery/server/plugin.ts +++ b/x-pack/plugins/osquery/server/plugin.ts @@ -5,8 +5,6 @@ * 2.0. */ -// import { curry } from 'lodash'; -// import { ActionTypeExecutorResult } from '../../actions/server/types'; import { PluginInitializerContext, CoreSetup, @@ -19,7 +17,7 @@ import { createConfig } from './create_config'; import { OsqueryPluginSetup, OsqueryPluginStart, SetupPlugins, StartPlugins } from './types'; import { defineRoutes } from './routes'; import { osquerySearchStrategyProvider } from './search_strategy/osquery'; -// import { initSavedObjects } from './saved_objects'; +import { initSavedObjects } from './saved_objects'; import { OsqueryAppContext, OsqueryAppContextService } from './lib/osquery_app_context_services'; import { ConfigType } from './config'; @@ -46,19 +44,12 @@ export class OsqueryPlugin implements Plugin => Promise.resolve(config), + config: (): ConfigType => config, }; - // initSavedObjects(core.savedObjects); + initSavedObjects(core.savedObjects, osqueryContext); defineRoutes(router, osqueryContext); - // plugins.actions.registerType({ - // id: '.osquery', - // name: 'Osquery', - // minimumLicenseRequired: 'gold', - // executor: curry(executor)({}), - // }); - core.getStartServices().then(([, depsStart]) => { const osquerySearchStrategy = osquerySearchStrategyProvider(depsStart.data); @@ -89,7 +80,3 @@ export class OsqueryPlugin implements Plugin> { -// return { status: 'ok', data: {}, actionId: execOptions.actionId }; -// } diff --git a/x-pack/plugins/osquery/server/routes/action/create_action_route.ts b/x-pack/plugins/osquery/server/routes/action/create_action_route.ts index 7068243cc0fb7..8e741c6a9e3ca 100644 --- a/x-pack/plugins/osquery/server/routes/action/create_action_route.ts +++ b/x-pack/plugins/osquery/server/routes/action/create_action_route.ts @@ -5,13 +5,11 @@ * 2.0. */ -import { find } from 'lodash/fp'; import uuid from 'uuid'; -import { schema } from '@kbn/config-schema'; import moment from 'moment'; +import { schema } from '@kbn/config-schema'; import { IRouter } from '../../../../../../src/core/server'; -import { packSavedObjectType, savedQuerySavedObjectType } from '../../../common/types'; import { OsqueryAppContext } from '../../lib/osquery_app_context_services'; import { parseAgentSelection, AgentSelection } from '../../lib/parse_agent_groups'; @@ -24,86 +22,19 @@ export const createActionRoute = (router: IRouter, osqueryContext: OsqueryAppCon params: schema.object({}, { unknowns: 'allow' }), body: schema.object({}, { unknowns: 'allow' }), }, + options: { + tags: ['access:osquery', 'access:osquery_write'], + }, }, async (context, request, response) => { - const esClient = context.core.elasticsearch.client.asInternalUser; + const esClient = context.core.elasticsearch.client.asCurrentUser; const { agentSelection } = request.body as { agentSelection: AgentSelection }; const selectedAgents = await parseAgentSelection(esClient, osqueryContext, agentSelection); - // @ts-expect-error update validation - if (request.body.pack_id) { - const savedObjectsClient = context.core.savedObjects.client; - const { attributes, references, ...rest } = await savedObjectsClient.get<{ - title: string; - description: string; - queries: Array<{ name: string; interval: string }>; - }>( - packSavedObjectType, - // @ts-expect-error update types - request.body.pack_id - ); - - const pack = { - ...rest, - ...attributes, - queries: - attributes.queries?.map((packQuery) => { - const queryReference = find(['name', packQuery.name], references); - - if (queryReference) { - return { - ...packQuery, - id: queryReference?.id, - }; - } - - return packQuery; - }) ?? [], - }; - - const { saved_objects: queriesSavedObjects } = await savedObjectsClient.bulkGet( - pack.queries.map((packQuery) => ({ - // @ts-expect-error update validation - id: packQuery.id, - type: savedQuerySavedObjectType, - })) - ); - - const actionId = uuid.v4(); - - const actions = queriesSavedObjects.map((query) => ({ - action_id: actionId, - '@timestamp': moment().toISOString(), - expiration: moment().add(2, 'days').toISOString(), - type: 'INPUT_ACTION', - input_type: 'osquery', - agents: selectedAgents, - data: { - id: query.id, - // @ts-expect-error update validation - query: query.attributes.query, - }, - })); - - const query = await esClient.bulk<{}>({ - index: '.fleet-actions', - // @ts-expect-error update validation - body: actions.reduce((acc, action) => { - return [...acc, { create: { _index: '.fleet-actions' } }, action]; - }, []), - }); - - return response.ok({ - body: { - actions, - query, - }, - }); - } const action = { action_id: uuid.v4(), '@timestamp': moment().toISOString(), - expiration: moment().add(2, 'days').toISOString(), + expiration: moment().add(1, 'days').toISOString(), type: 'INPUT_ACTION', input_type: 'osquery', agents: selectedAgents, @@ -114,15 +45,15 @@ export const createActionRoute = (router: IRouter, osqueryContext: OsqueryAppCon query: request.body.query.query, }, }; - const query = await esClient.index<{}, {}>({ + const actionResponse = await esClient.index<{}, {}>({ index: '.fleet-actions', body: action, }); return response.ok({ body: { - response: query, - action, + response: actionResponse, + actions: [action], }, }); } diff --git a/x-pack/plugins/osquery/server/routes/index.ts b/x-pack/plugins/osquery/server/routes/index.ts index 59d4085a77be1..7eee5b94fd84d 100644 --- a/x-pack/plugins/osquery/server/routes/index.ts +++ b/x-pack/plugins/osquery/server/routes/index.ts @@ -6,15 +6,21 @@ */ import { IRouter } from '../../../../../src/core/server'; -import { initSavedQueryRoutes } from './saved_query'; -import { initScheduledQueryRoutes } from './scheduled_query'; import { initActionRoutes } from './action'; import { OsqueryAppContext } from '../lib/osquery_app_context_services'; +import { initSavedQueryRoutes } from './saved_query'; import { initPackRoutes } from './pack'; export const defineRoutes = (router: IRouter, context: OsqueryAppContext) => { + const config = context.config(); + initActionRoutes(router, context); - initPackRoutes(router); - initSavedQueryRoutes(router); - initScheduledQueryRoutes(router, context); + + if (config.packs) { + initPackRoutes(router); + } + + if (config.savedQueries) { + initSavedQueryRoutes(router); + } }; diff --git a/x-pack/plugins/osquery/server/routes/scheduled_query/find_scheduled_query_route.ts b/x-pack/plugins/osquery/server/routes/scheduled_query/find_scheduled_query_route.ts index b9058a2868763..43d5f3fc893f0 100644 --- a/x-pack/plugins/osquery/server/routes/scheduled_query/find_scheduled_query_route.ts +++ b/x-pack/plugins/osquery/server/routes/scheduled_query/find_scheduled_query_route.ts @@ -6,8 +6,10 @@ */ import { schema } from '@kbn/config-schema'; +import { OSQUERY_INTEGRATION_NAME } from '../../../common'; import { IRouter } from '../../../../../../src/core/server'; +import { PACKAGE_POLICY_SAVED_OBJECT_TYPE } from '../../../../fleet/common'; import { OsqueryAppContext } from '../../lib/osquery_app_context_services'; export const findScheduledQueryRoute = (router: IRouter, osqueryContext: OsqueryAppContext) => { @@ -19,7 +21,7 @@ export const findScheduledQueryRoute = (router: IRouter, osqueryContext: Osquery }, }, async (context, request, response) => { - const kuery = 'ingest-package-policies.attributes.package.name: osquery_elastic_managed'; + const kuery = `${PACKAGE_POLICY_SAVED_OBJECT_TYPE}.attributes.package.name: ${OSQUERY_INTEGRATION_NAME}`; const packagePolicyService = osqueryContext.service.getPackagePolicyService(); const policies = await packagePolicyService?.list(context.core.savedObjects.client, { kuery, diff --git a/x-pack/plugins/osquery/server/saved_objects.ts b/x-pack/plugins/osquery/server/saved_objects.ts index 15a0f8e2be0da..c6be1098cedb2 100644 --- a/x-pack/plugins/osquery/server/saved_objects.ts +++ b/x-pack/plugins/osquery/server/saved_objects.ts @@ -7,12 +7,24 @@ import { CoreSetup } from '../../../../src/core/server'; +import { OsqueryAppContext } from './lib/osquery_app_context_services'; import { savedQueryType, packType } from './lib/saved_query/saved_object_mappings'; const types = [savedQueryType, packType]; export const savedObjectTypes = types.map((type) => type.name); -export const initSavedObjects = (savedObjects: CoreSetup['savedObjects']) => { - types.forEach((type) => savedObjects.registerType(type)); +export const initSavedObjects = ( + savedObjects: CoreSetup['savedObjects'], + osqueryContext: OsqueryAppContext +) => { + const config = osqueryContext.config(); + + if (config.savedQueries) { + savedObjects.registerType(savedQueryType); + } + + if (config.packs) { + savedObjects.registerType(packType); + } }; diff --git a/x-pack/plugins/osquery/server/search_strategy/osquery/factory/actions/results/query.action_results.dsl.ts b/x-pack/plugins/osquery/server/search_strategy/osquery/factory/actions/results/query.action_results.dsl.ts index 75e6201545a8e..e8a8fbd63a84d 100644 --- a/x-pack/plugins/osquery/server/search_strategy/osquery/factory/actions/results/query.action_results.dsl.ts +++ b/x-pack/plugins/osquery/server/search_strategy/osquery/factory/actions/results/query.action_results.dsl.ts @@ -12,8 +12,8 @@ import { createQueryFilterClauses } from '../../../../../../common/utils/build_q export const buildActionResultsQuery = ({ actionId, filterQuery, + // pagination: { activePage, querySize }, sort, - pagination: { activePage, querySize }, }: ActionResultsRequestOptions): ISearchRequestParams => { const filter = [ ...createQueryFilterClauses(filterQuery), @@ -30,18 +30,39 @@ export const buildActionResultsQuery = ({ ignoreUnavailable: true, body: { aggs: { - responses: { - terms: { - script: { - lang: 'painless', - source: "if (doc['error'].size()==0) { return 'success' } else { return 'error' }", + aggs: { + global: {}, + aggs: { + responses_by_action_id: { + filter: { + bool: { + must: [ + { + match: { + action_id: actionId, + }, + }, + ], + }, + }, + aggs: { + responses: { + terms: { + script: { + lang: 'painless', + source: + "if (doc['error.keyword'].size()==0) { return 'success' } else { return 'error' }", + }, + }, + }, + }, }, }, }, }, query: { bool: { filter } }, - from: activePage * querySize, - size: querySize, + // from: activePage * querySize, + size: 10000, // querySize, track_total_hits: true, fields: ['*'], sort: [ diff --git a/x-pack/plugins/osquery/server/search_strategy/osquery/factory/results/query.all_results.dsl.ts b/x-pack/plugins/osquery/server/search_strategy/osquery/factory/results/query.all_results.dsl.ts index 04ba05532cd0d..ac36f4b31e5fc 100644 --- a/x-pack/plugins/osquery/server/search_strategy/osquery/factory/results/query.all_results.dsl.ts +++ b/x-pack/plugins/osquery/server/search_strategy/osquery/factory/results/query.all_results.dsl.ts @@ -5,6 +5,7 @@ * 2.0. */ +import { OSQUERY_INTEGRATION_NAME } from '../../../../../common'; import { ISearchRequestParams } from '../../../../../../../../src/plugins/data/common'; import { ResultsRequestOptions } from '../../../../../common/search_strategy'; import { createQueryFilterClauses } from '../../../../../common/utils/build_query'; @@ -13,7 +14,7 @@ export const buildResultsQuery = ({ actionId, agentId, filterQuery, - // sort, + sort, pagination: { activePage, querySize }, }: ResultsRequestOptions): ISearchRequestParams => { const filter = [ @@ -36,21 +37,29 @@ export const buildResultsQuery = ({ const dslQuery = { allowNoIndices: true, - index: 'logs-elastic_agent.osquery*', + index: `logs-${OSQUERY_INTEGRATION_NAME}.result*`, ignoreUnavailable: true, body: { + aggs: { + count_by_agent_id: { + terms: { + field: 'agent.id', + size: 10000, + }, + }, + }, query: { bool: { filter } }, from: activePage * querySize, size: querySize, track_total_hits: true, fields: agentId ? ['osquery.*'] : ['agent.*', 'osquery.*'], - // sort: [ - // { - // [sort.field]: { - // order: [sort.direction], - // }, - // }, - // ], + sort: [ + { + [sort.field]: { + order: sort.direction, + }, + }, + ], }, }; diff --git a/x-pack/plugins/osquery/server/search_strategy/osquery/index.ts b/x-pack/plugins/osquery/server/search_strategy/osquery/index.ts index e589ab7a3aa06..9fffb0726dce6 100644 --- a/x-pack/plugins/osquery/server/search_strategy/osquery/index.ts +++ b/x-pack/plugins/osquery/server/search_strategy/osquery/index.ts @@ -11,7 +11,7 @@ import { PluginStart, shimHitsTotal, } from '../../../../../../src/plugins/data/server'; -import { ENHANCED_ES_SEARCH_STRATEGY } from '../../../../data_enhanced/common'; +import { ENHANCED_ES_SEARCH_STRATEGY } from '../../../../../../src/plugins/data/common'; import { FactoryQueryTypes, StrategyResponseType, diff --git a/x-pack/plugins/osquery/server/types.ts b/x-pack/plugins/osquery/server/types.ts index dd9d45b2c3cc6..1882e52074660 100644 --- a/x-pack/plugins/osquery/server/types.ts +++ b/x-pack/plugins/osquery/server/types.ts @@ -11,6 +11,7 @@ import { PluginStart as DataPluginStart, } from '../../../../src/plugins/data/server'; import { FleetStartContract } from '../../fleet/server'; +import { PluginSetupContract } from '../../features/server'; // eslint-disable-next-line @typescript-eslint/no-empty-interface export interface OsqueryPluginSetup {} @@ -20,6 +21,7 @@ export interface OsqueryPluginStart {} export interface SetupPlugins { actions: ActionsPlugin['setup']; data: DataPluginSetup; + features: PluginSetupContract; } export interface StartPlugins { diff --git a/x-pack/plugins/remote_clusters/common/lib/cluster_serialization.ts b/x-pack/plugins/remote_clusters/common/lib/cluster_serialization.ts index 8d3b1b895651a..bf0fc11e882cc 100644 --- a/x-pack/plugins/remote_clusters/common/lib/cluster_serialization.ts +++ b/x-pack/plugins/remote_clusters/common/lib/cluster_serialization.ts @@ -45,7 +45,7 @@ export interface Cluster { hasDeprecatedProxySetting?: boolean; } -interface ClusterPayloadEs { +export interface ClusterPayloadEs { skip_unavailable?: boolean | null; mode?: 'sniff' | 'proxy' | null; proxy_address?: string | null; diff --git a/x-pack/plugins/remote_clusters/common/lib/index.ts b/x-pack/plugins/remote_clusters/common/lib/index.ts index 7afba67d3622d..b17283511b8b7 100644 --- a/x-pack/plugins/remote_clusters/common/lib/index.ts +++ b/x-pack/plugins/remote_clusters/common/lib/index.ts @@ -10,4 +10,5 @@ export { serializeCluster, Cluster, ClusterInfoEs, + ClusterPayloadEs, } from './cluster_serialization'; diff --git a/x-pack/plugins/remote_clusters/public/application/sections/components/remote_cluster_form/remote_cluster_form.tsx b/x-pack/plugins/remote_clusters/public/application/sections/components/remote_cluster_form/remote_cluster_form.tsx index 9f6eee757c755..766f12fedc81c 100644 --- a/x-pack/plugins/remote_clusters/public/application/sections/components/remote_cluster_form/remote_cluster_form.tsx +++ b/x-pack/plugins/remote_clusters/public/application/sections/components/remote_cluster_form/remote_cluster_form.tsx @@ -47,8 +47,8 @@ import { convertCloudUrlToProxyConnection, convertProxyConnectionToCloudUrl, validateCluster, + isCloudUrlEnabled, } from './validators'; -import { isCloudUrlEnabled } from './validators/validate_cloud_url'; const defaultClusterValues: Cluster = { name: '', @@ -369,7 +369,7 @@ export class RemoteClusterForm extends Component {
    - + {isRequestVisible ? ( { return ( - +

    {name ? ( - - {icon} + {icon} + - - {message} - - + + {message} {!isConnected && mode === SNIFF_MODE && ( diff --git a/x-pack/plugins/remote_clusters/public/application/sections/remote_cluster_list/detail_panel/detail_panel.js b/x-pack/plugins/remote_clusters/public/application/sections/remote_cluster_list/detail_panel/detail_panel.js index c25be664896c3..6969f98e5f092 100644 --- a/x-pack/plugins/remote_clusters/public/application/sections/remote_cluster_list/detail_panel/detail_panel.js +++ b/x-pack/plugins/remote_clusters/public/application/sections/remote_cluster_list/detail_panel/detail_panel.js @@ -183,9 +183,9 @@ export class DetailPanel extends Component { mode, }) { return ( - - - + + + - - - - {connectedNodesCount} - - - - - - - {seeds.map((seed) => ( @@ -236,9 +225,11 @@ export class DetailPanel extends Component { ))} - + + - + + - {this.renderSkipUnavailableValue(skipUnavailable)} - - - - - - - {maxConnectionsPerCluster} - - - {initialConnectTimeout} - - - + + + ); } @@ -302,9 +282,9 @@ export class DetailPanel extends Component { serverName, }) { return ( - - - + + + - - - - {connectedSocketsCount ? connectedSocketsCount : '-'} - - - - - - - {proxyAddress} - - + + + + + + + {serverName ? serverName : '-'} + + + + + - {this.renderSkipUnavailableValue(skipUnavailable)} - - - - - - - {proxySocketConnections ? proxySocketConnections : '-'} - - - {initialConnectTimeout} - - - - - - - - - - - - - - - {serverName ? serverName : '-'} - - - - + + + ); } renderCluster(cluster) { return (
    - +

    boolean; } export type ReportingStart = ReportingSetup; diff --git a/x-pack/plugins/reporting/public/panel_actions/get_csv_panel_action.test.ts b/x-pack/plugins/reporting/public/panel_actions/get_csv_panel_action.test.ts index 06d626a4c4044..dbd0421fdf9b0 100644 --- a/x-pack/plugins/reporting/public/panel_actions/get_csv_panel_action.test.ts +++ b/x-pack/plugins/reporting/public/panel_actions/get_csv_panel_action.test.ts @@ -5,10 +5,11 @@ * 2.0. */ -import { of } from 'rxjs'; +import * as Rx from 'rxjs'; import { first } from 'rxjs/operators'; +import { CoreStart } from 'src/core/public'; import { LicensingPluginSetup } from '../../../licensing/public'; -import { GetCsvReportPanelAction } from './get_csv_panel_action'; +import { ReportingCsvPanelAction } from './get_csv_panel_action'; type LicenseResults = 'valid' | 'invalid' | 'unavailable' | 'expired'; @@ -17,6 +18,8 @@ describe('GetCsvReportPanelAction', () => { let context: any; let mockLicense$: any; let mockSearchSource: any; + let mockStartServicesPayload: [CoreStart, object, unknown]; + let mockStartServices$: Rx.Subject; beforeAll(() => { if (typeof window.URL.revokeObjectURL === 'undefined') { @@ -30,11 +33,20 @@ describe('GetCsvReportPanelAction', () => { beforeEach(() => { mockLicense$ = (state: LicenseResults = 'valid') => { - return (of({ + return (Rx.of({ check: jest.fn().mockImplementation(() => ({ state })), }) as unknown) as LicensingPluginSetup['license$']; }; + mockStartServices$ = new Rx.Subject<[CoreStart, object, unknown]>(); + mockStartServicesPayload = [ + ({ + application: { capabilities: { dashboard: { downloadCsv: true } } }, + } as unknown) as CoreStart, + {}, + null, + ]; + core = { http: { post: jest.fn().mockImplementation(() => Promise.resolve(true)), @@ -78,7 +90,14 @@ describe('GetCsvReportPanelAction', () => { }); it('translates empty embeddable context into job params', async () => { - const panel = new GetCsvReportPanelAction(core, mockLicense$()); + const panel = new ReportingCsvPanelAction({ + core, + license$: mockLicense$(), + startServices$: mockStartServices$, + usesUiCapabilities: true, + }); + + mockStartServices$.next(mockStartServicesPayload); await panel.execute(context); @@ -91,7 +110,6 @@ describe('GetCsvReportPanelAction', () => { }); it('translates embeddable context into job params', async () => { - // setup mockSearchSource = { createCopy: () => mockSearchSource, removeField: jest.fn(), @@ -106,9 +124,15 @@ describe('GetCsvReportPanelAction', () => { }; }; - const panel = new GetCsvReportPanelAction(core, mockLicense$()); + const panel = new ReportingCsvPanelAction({ + core, + license$: mockLicense$(), + startServices$: mockStartServices$, + usesUiCapabilities: true, + }); + + mockStartServices$.next(mockStartServicesPayload); - // test await panel.execute(context); expect(core.http.post).toHaveBeenCalledWith( @@ -121,7 +145,14 @@ describe('GetCsvReportPanelAction', () => { }); it('allows downloading for valid licenses', async () => { - const panel = new GetCsvReportPanelAction(core, mockLicense$()); + const panel = new ReportingCsvPanelAction({ + core, + license$: mockLicense$(), + startServices$: mockStartServices$, + usesUiCapabilities: true, + }); + + mockStartServices$.next(mockStartServicesPayload); await panel.execute(context); @@ -129,7 +160,14 @@ describe('GetCsvReportPanelAction', () => { }); it('shows a good old toastie when it successfully starts', async () => { - const panel = new GetCsvReportPanelAction(core, mockLicense$()); + const panel = new ReportingCsvPanelAction({ + core, + license$: mockLicense$(), + startServices$: mockStartServices$, + usesUiCapabilities: true, + }); + + mockStartServices$.next(mockStartServicesPayload); await panel.execute(context); @@ -144,7 +182,14 @@ describe('GetCsvReportPanelAction', () => { post: jest.fn().mockImplementation(() => Promise.reject('No more ram!')), }, }; - const panel = new GetCsvReportPanelAction(coreFails, mockLicense$()); + const panel = new ReportingCsvPanelAction({ + core: coreFails, + license$: mockLicense$(), + startServices$: mockStartServices$, + usesUiCapabilities: true, + }); + + mockStartServices$.next(mockStartServicesPayload); await panel.execute(context); @@ -152,15 +197,76 @@ describe('GetCsvReportPanelAction', () => { }); it(`doesn't allow downloads with bad licenses`, async () => { - const licenseMock = mockLicense$('invalid'); - const plugin = new GetCsvReportPanelAction(core, licenseMock); - await licenseMock.pipe(first()).toPromise(); + const licenseMock$ = mockLicense$('invalid'); + const plugin = new ReportingCsvPanelAction({ + core, + license$: licenseMock$, + startServices$: mockStartServices$, + usesUiCapabilities: true, + }); + + mockStartServices$.next(mockStartServicesPayload); + + await licenseMock$.pipe(first()).toPromise(); + expect(await plugin.isCompatible(context)).toEqual(false); }); it('sets a display and icon type', () => { - const panel = new GetCsvReportPanelAction(core, mockLicense$()); + const panel = new ReportingCsvPanelAction({ + core, + license$: mockLicense$(), + startServices$: mockStartServices$, + usesUiCapabilities: true, + }); + + mockStartServices$.next(mockStartServicesPayload); + expect(panel.getIconType()).toMatchInlineSnapshot(`"document"`); expect(panel.getDisplayName()).toMatchInlineSnapshot(`"Download CSV"`); }); + + describe('Application UI Capabilities', () => { + it(`doesn't allow downloads when UI capability is not enabled`, async () => { + const plugin = new ReportingCsvPanelAction({ + core, + license$: mockLicense$(), + startServices$: mockStartServices$, + usesUiCapabilities: true, + }); + + mockStartServices$.next([ + ({ application: { capabilities: {} } } as unknown) as CoreStart, + {}, + null, + ]); + + expect(await plugin.isCompatible(context)).toEqual(false); + }); + + it(`allows downloads when license is valid and UI capability is enabled`, async () => { + mockStartServices$ = new Rx.Subject(); + const plugin = new ReportingCsvPanelAction({ + core, + license$: mockLicense$(), + startServices$: mockStartServices$, + usesUiCapabilities: true, + }); + + mockStartServices$.next(mockStartServicesPayload); + + expect(await plugin.isCompatible(context)).toEqual(true); + }); + + it(`allows download when license is valid and deprecated roles config is enabled`, async () => { + const plugin = new ReportingCsvPanelAction({ + core, + license$: mockLicense$(), + startServices$: mockStartServices$, + usesUiCapabilities: false, + }); + + expect(await plugin.isCompatible(context)).toEqual(true); + }); + }); }); diff --git a/x-pack/plugins/reporting/public/panel_actions/get_csv_panel_action.tsx b/x-pack/plugins/reporting/public/panel_actions/get_csv_panel_action.tsx index 95d193880975c..8a863e1ceaa65 100644 --- a/x-pack/plugins/reporting/public/panel_actions/get_csv_panel_action.tsx +++ b/x-pack/plugins/reporting/public/panel_actions/get_csv_panel_action.tsx @@ -7,7 +7,9 @@ import { i18n } from '@kbn/i18n'; import moment from 'moment-timezone'; +import * as Rx from 'rxjs'; import type { CoreSetup } from 'src/core/public'; +import { CoreStart } from 'src/core/public'; import type { ISearchEmbeddable, SavedSearch } from '../../../../../src/plugins/discover/public'; import { loadSharingDataHelpers, @@ -32,22 +34,38 @@ interface ActionContext { embeddable: ISearchEmbeddable; } -export class GetCsvReportPanelAction implements ActionDefinition { +interface Params { + core: CoreSetup; + startServices$: Rx.Observable<[CoreStart, object, unknown]>; + license$: LicensingPluginSetup['license$']; + usesUiCapabilities: boolean; +} + +export class ReportingCsvPanelAction implements ActionDefinition { private isDownloading: boolean; public readonly type = ''; public readonly id = CSV_REPORTING_ACTION; - private canDownloadCSV: boolean = false; + private licenseHasDownloadCsv: boolean = false; + private capabilityHasDownloadCsv: boolean = false; private core: CoreSetup; - constructor(core: CoreSetup, license$: LicensingPluginSetup['license$']) { + constructor({ core, startServices$, license$, usesUiCapabilities }: Params) { this.isDownloading = false; this.core = core; license$.subscribe((license) => { const results = license.check('reporting', 'basic'); const { showLinks } = checkLicense(results); - this.canDownloadCSV = showLinks; + this.licenseHasDownloadCsv = showLinks; }); + + if (usesUiCapabilities) { + startServices$.subscribe(([{ application }]) => { + this.capabilityHasDownloadCsv = application.capabilities.dashboard?.downloadCsv === true; + }); + } else { + this.capabilityHasDownloadCsv = true; // deprecated + } } public getIconType() { @@ -70,7 +88,7 @@ export class GetCsvReportPanelAction implements ActionDefinition } public isCompatible = async (context: ActionContext) => { - if (!this.canDownloadCSV) { + if (!this.licenseHasDownloadCsv || !this.capabilityHasDownloadCsv) { return false; } @@ -82,7 +100,7 @@ export class GetCsvReportPanelAction implements ActionDefinition public execute = async (context: ActionContext) => { const { embeddable } = context; - if (!isSavedSearchEmbeddable(embeddable)) { + if (!isSavedSearchEmbeddable(embeddable) || !(await this.isCompatible(context))) { throw new IncompatibleActionError(); } @@ -93,6 +111,10 @@ export class GetCsvReportPanelAction implements ActionDefinition const savedSearch = embeddable.getSavedSearch(); const { columns, searchSource } = await this.getSearchSource(savedSearch, embeddable); + // If the TZ is set to the default "Browser", it will not be useful for + // server-side export. We need to derive the timezone and pass it as a param + // to the export API. + // TODO: create a helper utility in Reporting. This is repeated in a few places. const kibanaTimezone = this.core.uiSettings.get('dateFormat:tz'); const browserTimezone = kibanaTimezone === 'Browser' ? moment.tz.guess() : kibanaTimezone; const immediateJobParams: JobParamsDownloadCSV = { diff --git a/x-pack/plugins/reporting/public/plugin.ts b/x-pack/plugins/reporting/public/plugin.ts index 435291e76ac49..ff0d425faf54a 100644 --- a/x-pack/plugins/reporting/public/plugin.ts +++ b/x-pack/plugins/reporting/public/plugin.ts @@ -35,17 +35,13 @@ import { } from './components'; import { ReportingAPIClient } from './lib/reporting_api_client'; import { ReportingNotifierStreamHandler as StreamHandler } from './lib/stream_handler'; -import { GetCsvReportPanelAction } from './panel_actions/get_csv_panel_action'; -import { csvReportingProvider } from './share_context_menu/register_csv_reporting'; -import { reportingPDFPNGProvider } from './share_context_menu/register_pdf_png_reporting'; +import { ReportingCsvPanelAction } from './panel_actions/get_csv_panel_action'; +import { ReportingCsvShareProvider } from './share_context_menu/register_csv_reporting'; +import { reportingScreenshotShareProvider } from './share_context_menu/register_pdf_png_reporting'; export interface ClientConfigType { - poll: { - jobsRefresh: { - interval: number; - intervalErrorMultiplier: number; - }; - }; + poll: { jobsRefresh: { interval: number; intervalErrorMultiplier: number } }; + roles: { enabled: boolean }; } function getStored(): JobId[] { @@ -90,11 +86,7 @@ export class ReportingPublicPlugin ReportingPublicPluginSetupDendencies, ReportingPublicPluginStartDendencies > { - private readonly contract: ReportingStart = { - components: { ScreenCapturePanel }, - getDefaultLayoutSelectors, - ReportingAPIClient, - }; + private readonly contract: ReportingStart; private readonly stop$ = new Rx.ReplaySubject(1); private readonly title = i18n.translate('xpack.reporting.management.reportingTitle', { defaultMessage: 'Reporting', @@ -106,22 +98,30 @@ export class ReportingPublicPlugin constructor(initializerContext: PluginInitializerContext) { this.config = initializerContext.config.get(); + + this.contract = { + ReportingAPIClient, + components: { ScreenCapturePanel }, + getDefaultLayoutSelectors, + usesUiCapabilities: () => this.config.roles?.enabled === false, + }; } - public setup( - core: CoreSetup, - { home, management, licensing, uiActions, share }: ReportingPublicPluginSetupDendencies - ) { + public setup(core: CoreSetup, setupDeps: ReportingPublicPluginSetupDendencies) { + const { http, notifications, getStartServices, uiSettings } = core; + const { toasts } = notifications; const { - http, - notifications: { toasts }, - getStartServices, - uiSettings, - } = core; - const { license$ } = licensing; + home, + management, + licensing: { license$ }, + share, + uiActions, + } = setupDeps; + + const startServices$ = Rx.from(getStartServices()); + const usesUiCapabilities = !this.config.roles.enabled; const apiClient = new ReportingAPIClient(http); - const action = new GetCsvReportPanelAction(core, license$); home.featureCatalogue.register({ id: 'reporting', @@ -136,6 +136,7 @@ export class ReportingPublicPlugin showOnHomePage: false, category: FeatureCatalogueCategory.ADMIN, }); + management.sections.section.insightsAndAlerting.registerApp({ id: 'reporting', title: this.title, @@ -157,15 +158,29 @@ export class ReportingPublicPlugin }, }); - uiActions.addTriggerAction(CONTEXT_MENU_TRIGGER, action); + uiActions.addTriggerAction( + CONTEXT_MENU_TRIGGER, + new ReportingCsvPanelAction({ core, startServices$, license$, usesUiCapabilities }) + ); - share.register(csvReportingProvider({ apiClient, toasts, license$, uiSettings })); share.register( - reportingPDFPNGProvider({ + ReportingCsvShareProvider({ + apiClient, + toasts, + license$, + startServices$, + uiSettings, + usesUiCapabilities, + }) + ); + share.register( + reportingScreenshotShareProvider({ apiClient, toasts, license$, + startServices$, uiSettings, + usesUiCapabilities, }) ); diff --git a/x-pack/plugins/reporting/public/share_context_menu/register_csv_reporting.tsx b/x-pack/plugins/reporting/public/share_context_menu/register_csv_reporting.tsx index 8995ef4739b09..9d26c69e57297 100644 --- a/x-pack/plugins/reporting/public/share_context_menu/register_csv_reporting.tsx +++ b/x-pack/plugins/reporting/public/share_context_menu/register_csv_reporting.tsx @@ -8,7 +8,9 @@ import { i18n } from '@kbn/i18n'; import moment from 'moment-timezone'; import React from 'react'; +import * as Rx from 'rxjs'; import type { IUiSettingsClient, ToastsSetup } from 'src/core/public'; +import { CoreStart } from 'src/core/public'; import type { SearchSourceFields } from 'src/plugins/data/common'; import type { ShareContext } from '../../../../../src/plugins/share/public'; import type { LicensingPluginSetup } from '../../../licensing/public'; @@ -18,34 +20,46 @@ import { ReportingPanelContent } from '../components/reporting_panel_content_laz import { checkLicense } from '../lib/license_check'; import type { ReportingAPIClient } from '../lib/reporting_api_client'; -interface ReportingProvider { - apiClient: ReportingAPIClient; - toasts: ToastsSetup; - license$: LicensingPluginSetup['license$']; - uiSettings: IUiSettingsClient; -} - -export const csvReportingProvider = ({ +export const ReportingCsvShareProvider = ({ apiClient, toasts, license$, + startServices$, uiSettings, -}: ReportingProvider) => { - let toolTipContent = ''; - let disabled = true; - let hasCSVReporting = false; + usesUiCapabilities, +}: { + apiClient: ReportingAPIClient; + toasts: ToastsSetup; + license$: LicensingPluginSetup['license$']; + startServices$: Rx.Observable<[CoreStart, object, unknown]>; + uiSettings: IUiSettingsClient; + usesUiCapabilities: boolean; +}) => { + let licenseToolTipContent = ''; + let licenseHasCsvReporting = false; + let licenseDisabled = true; + let capabilityHasCsvReporting = false; license$.subscribe((license) => { - const { enableLinks, showLinks, message } = checkLicense(license.check('reporting', 'basic')); - - toolTipContent = message; - hasCSVReporting = showLinks; - disabled = !enableLinks; + const licenseCheck = checkLicense(license.check('reporting', 'basic')); + licenseToolTipContent = licenseCheck.message; + licenseHasCsvReporting = licenseCheck.showLinks; + licenseDisabled = !licenseCheck.enableLinks; }); + if (usesUiCapabilities) { + startServices$.subscribe(([{ application }]) => { + // TODO: add abstractions in ExportTypeRegistry to use here? + capabilityHasCsvReporting = application.capabilities.discover?.generateCsv === true; + }); + } else { + capabilityHasCsvReporting = true; // deprecated + } + // If the TZ is set to the default "Browser", it will not be useful for // server-side export. We need to derive the timezone and pass it as a param // to the export API. + // TODO: create a helper utility in Reporting. This is repeated in a few places. const browserTimezone = uiSettings.get('dateFormat:tz') === 'Browser' ? moment.tz.guess() @@ -74,7 +88,7 @@ export const csvReportingProvider = ({ const shareActions = []; - if (hasCSVReporting) { + if (licenseHasCsvReporting && capabilityHasCsvReporting) { const panelTitle = i18n.translate('xpack.reporting.shareContextMenu.csvReportsButtonLabel', { defaultMessage: 'CSV Reports', }); @@ -83,8 +97,8 @@ export const csvReportingProvider = ({ shareMenuItem: { name: panelTitle, icon: 'document', - toolTipContent, - disabled, + toolTipContent: licenseToolTipContent, + disabled: licenseDisabled, ['data-test-subj']: 'csvReportMenuItem', sortOrder: 1, }, diff --git a/x-pack/plugins/reporting/public/share_context_menu/register_pdf_png_reporting.tsx b/x-pack/plugins/reporting/public/share_context_menu/register_pdf_png_reporting.tsx index 00ba167c50ae6..f4a952ef58298 100644 --- a/x-pack/plugins/reporting/public/share_context_menu/register_pdf_png_reporting.tsx +++ b/x-pack/plugins/reporting/public/share_context_menu/register_pdf_png_reporting.tsx @@ -8,7 +8,9 @@ import { i18n } from '@kbn/i18n'; import moment from 'moment-timezone'; import React from 'react'; +import * as Rx from 'rxjs'; import type { IUiSettingsClient, ToastsSetup } from 'src/core/public'; +import { CoreStart } from 'src/core/public'; import type { ShareContext } from '../../../../../src/plugins/share/public'; import type { LicensingPluginSetup } from '../../../licensing/public'; import type { LayoutParams } from '../../common/types'; @@ -18,34 +20,100 @@ import { ScreenCapturePanelContent } from '../components/screen_capture_panel_co import { checkLicense } from '../lib/license_check'; import type { ReportingAPIClient } from '../lib/reporting_api_client'; -interface ReportingPDFPNGProvider { +interface JobParamsProviderOptions { + shareableUrl: string; apiClient: ReportingAPIClient; - toasts: ToastsSetup; - license$: LicensingPluginSetup['license$']; - uiSettings: IUiSettingsClient; + objectType: string; + browserTimezone: string; + sharingData: Record; } -export const reportingPDFPNGProvider = ({ +const jobParamsProvider = ({ + objectType, + browserTimezone, + sharingData, +}: JobParamsProviderOptions) => { + return { + objectType, + browserTimezone, + layout: sharingData.layout as LayoutParams, + title: sharingData.title as string, + }; +}; + +const getPdfJobParams = (opts: JobParamsProviderOptions) => (): JobParamsPDF => { + // Relative URL must have URL prefix (Spaces ID prefix), but not server basePath + // Replace hashes with original RISON values. + const relativeUrl = opts.shareableUrl.replace( + window.location.origin + opts.apiClient.getServerBasePath(), + '' + ); + + return { + ...jobParamsProvider(opts), + relativeUrls: [relativeUrl], // multi URL for PDF + }; +}; + +const getPngJobParams = (opts: JobParamsProviderOptions) => (): JobParamsPNG => { + // Replace hashes with original RISON values. + const relativeUrl = opts.shareableUrl.replace( + window.location.origin + opts.apiClient.getServerBasePath(), + '' + ); + + return { + ...jobParamsProvider(opts), + relativeUrl, // single URL for PNG + }; +}; + +export const reportingScreenshotShareProvider = ({ apiClient, toasts, license$, + startServices$, uiSettings, -}: ReportingPDFPNGProvider) => { - let toolTipContent = ''; - let disabled = true; - let hasPDFPNGReporting = false; + usesUiCapabilities, +}: { + apiClient: ReportingAPIClient; + toasts: ToastsSetup; + license$: LicensingPluginSetup['license$']; + startServices$: Rx.Observable<[CoreStart, object, unknown]>; + uiSettings: IUiSettingsClient; + usesUiCapabilities: boolean; +}) => { + let licenseToolTipContent = ''; + let licenseDisabled = true; + let licenseHasScreenshotReporting = false; + let capabilityHasDashboardScreenshotReporting = false; + let capabilityHasVisualizeScreenshotReporting = false; license$.subscribe((license) => { const { enableLinks, showLinks, message } = checkLicense(license.check('reporting', 'gold')); - - toolTipContent = message; - hasPDFPNGReporting = showLinks; - disabled = !enableLinks; + licenseToolTipContent = message; + licenseHasScreenshotReporting = showLinks; + licenseDisabled = !enableLinks; }); + if (usesUiCapabilities) { + startServices$.subscribe(([{ application }]) => { + // TODO: add abstractions in ExportTypeRegistry to use here? + capabilityHasDashboardScreenshotReporting = + application.capabilities.dashboard?.generateScreenshot === true; + capabilityHasVisualizeScreenshotReporting = + application.capabilities.visualize?.generateScreenshot === true; + }); + } else { + // deprecated + capabilityHasDashboardScreenshotReporting = true; + capabilityHasVisualizeScreenshotReporting = true; + } + // If the TZ is set to the default "Browser", it will not be useful for // server-side export. We need to derive the timezone and pass it as a param // to the export API. + // TODO: create a helper utility in Reporting. This is repeated in a few places. const browserTimezone = uiSettings.get('dateFormat:tz') === 'Browser' ? moment.tz.guess() @@ -59,124 +127,100 @@ export const reportingPDFPNGProvider = ({ onClose, shareableUrl, }: ShareContext) => { - if (!['dashboard', 'visualization'].includes(objectType)) { + if (!licenseHasScreenshotReporting) { return []; } - // Dashboard only mode does not currently support reporting - // https://github.com/elastic/kibana/issues/18286 - // @TODO For NP - if (objectType === 'dashboard' && false) { + + if (!['dashboard', 'visualization'].includes(objectType)) { return []; } - const getPdfJobParams = (): JobParamsPDF => { - // Relative URL must have URL prefix (Spaces ID prefix), but not server basePath - // Replace hashes with original RISON values. - const relativeUrl = shareableUrl.replace( - window.location.origin + apiClient.getServerBasePath(), - '' - ); - - return { - objectType, - browserTimezone, - relativeUrls: [relativeUrl], // multi URL for PDF - layout: sharingData.layout as LayoutParams, - title: sharingData.title as string, - }; - }; + if (objectType === 'dashboard' && !capabilityHasDashboardScreenshotReporting) { + return []; + } - const getPngJobParams = (): JobParamsPNG => { - // Replace hashes with original RISON values. - const relativeUrl = shareableUrl.replace( - window.location.origin + apiClient.getServerBasePath(), - '' - ); - - return { - objectType, - browserTimezone, - relativeUrl, // single URL for PNG - layout: sharingData.layout as LayoutParams, - title: sharingData.title as string, - }; - }; + if (objectType === 'visualize' && !capabilityHasVisualizeScreenshotReporting) { + return []; + } const shareActions = []; - if (hasPDFPNGReporting) { - const pngPanelTitle = i18n.translate( - 'xpack.reporting.shareContextMenu.pngReportsButtonLabel', - { - defaultMessage: 'PNG Reports', - } - ); - - const pdfPanelTitle = i18n.translate( - 'xpack.reporting.shareContextMenu.pdfReportsButtonLabel', - { - defaultMessage: 'PDF Reports', - } - ); - - shareActions.push({ - shareMenuItem: { - name: pngPanelTitle, - icon: 'document', - toolTipContent, - disabled, - ['data-test-subj']: 'pngReportMenuItem', - sortOrder: 10, - }, - panel: { - id: 'reportingPngPanel', - title: pngPanelTitle, - content: ( - - ), - }, - }); - - shareActions.push({ - shareMenuItem: { - name: pdfPanelTitle, - icon: 'document', - toolTipContent, - disabled, - ['data-test-subj']: 'pdfReportMenuItem', - sortOrder: 10, - }, - panel: { - id: 'reportingPdfPanel', - title: pdfPanelTitle, - content: ( - - ), - }, - }); - } + const pngPanelTitle = i18n.translate('xpack.reporting.shareContextMenu.pngReportsButtonLabel', { + defaultMessage: 'PNG Reports', + }); + + const panelPng = { + shareMenuItem: { + name: pngPanelTitle, + icon: 'document', + toolTipContent: licenseToolTipContent, + disabled: licenseDisabled, + ['data-test-subj']: 'pngReportMenuItem', + sortOrder: 10, + }, + panel: { + id: 'reportingPngPanel', + title: pngPanelTitle, + content: ( + + ), + }, + }; + const pdfPanelTitle = i18n.translate('xpack.reporting.shareContextMenu.pdfReportsButtonLabel', { + defaultMessage: 'PDF Reports', + }); + + const panelPdf = { + shareMenuItem: { + name: pdfPanelTitle, + icon: 'document', + toolTipContent: licenseToolTipContent, + disabled: licenseDisabled, + ['data-test-subj']: 'pdfReportMenuItem', + sortOrder: 10, + }, + panel: { + id: 'reportingPdfPanel', + title: pdfPanelTitle, + content: ( + + ), + }, + }; + + shareActions.push(panelPng); + shareActions.push(panelPdf); return shareActions; }; - return { - id: 'screenCaptureReports', - getShareMenuItems, - }; + return { id: 'screenCaptureReports', getShareMenuItems }; }; diff --git a/x-pack/plugins/reporting/server/config/create_config.test.ts b/x-pack/plugins/reporting/server/config/create_config.test.ts index c649fff446a22..e78c7f2a88a2b 100644 --- a/x-pack/plugins/reporting/server/config/create_config.test.ts +++ b/x-pack/plugins/reporting/server/config/create_config.test.ts @@ -103,6 +103,9 @@ describe('Reporting server createConfig$', () => { "pollInterval": 3000, "timeout": 120000, }, + "roles": Object { + "enabled": false, + }, } `); expect((mockLogger.warn as any).mock.calls.length).toBe(0); diff --git a/x-pack/plugins/reporting/server/config/index.test.ts b/x-pack/plugins/reporting/server/config/index.test.ts index a395cd23288eb..cba64500575aa 100644 --- a/x-pack/plugins/reporting/server/config/index.test.ts +++ b/x-pack/plugins/reporting/server/config/index.test.ts @@ -32,7 +32,7 @@ const applyReportingDeprecations = (settings: Record = {}) => { describe('deprecations', () => { ['.foo', '.reporting'].forEach((index) => { it('logs a warning if index is set', () => { - const { messages } = applyReportingDeprecations({ index }); + const { messages } = applyReportingDeprecations({ index, roles: { enabled: false } }); expect(messages).toMatchInlineSnapshot(` Array [ "\\"xpack.reporting.index\\" is deprecated. Multitenancy by changing \\"kibana.index\\" will not be supported starting in 8.0. See https://ela.st/kbn-remove-legacy-multitenancy for more details", @@ -40,4 +40,18 @@ describe('deprecations', () => { `); }); }); + + it('logs a warning if roles.enabled: true is set', () => { + const { messages } = applyReportingDeprecations({ roles: { enabled: true } }); + expect(messages).toMatchInlineSnapshot(` + Array [ + "\\"xpack.reporting.roles\\" is deprecated. Granting reporting privilege through a \\"reporting_user\\" role will not be supported starting in 8.0. Please set 'xpack.reporting.roles.enabled' to 'false' and grant reporting privilege to users through feature controls in Management > Security > Roles", + ] + `); + }); + + it('does not log a warning if roles.enabled: false is set', () => { + const { messages } = applyReportingDeprecations({ roles: { enabled: false } }); + expect(messages).toMatchInlineSnapshot(`Array []`); + }); }); diff --git a/x-pack/plugins/reporting/server/config/index.ts b/x-pack/plugins/reporting/server/config/index.ts index 4b97dbc1e2a84..cdd395037a410 100644 --- a/x-pack/plugins/reporting/server/config/index.ts +++ b/x-pack/plugins/reporting/server/config/index.ts @@ -7,14 +7,13 @@ import { PluginConfigDescriptor } from 'kibana/server'; import { get } from 'lodash'; - import { ConfigSchema, ReportingConfigType } from './schema'; export { buildConfig } from './config'; export { registerUiSettings } from './ui_settings'; export { ConfigSchema, ReportingConfigType }; export const config: PluginConfigDescriptor = { - exposeToBrowser: { poll: true }, + exposeToBrowser: { poll: true, roles: true }, schema: ConfigSchema, deprecations: ({ unused }) => [ unused('capture.browser.chromium.maxScreenshotDimension'), @@ -31,6 +30,16 @@ export const config: PluginConfigDescriptor = { message: `"${fromPath}.index" is deprecated. Multitenancy by changing "kibana.index" will not be supported starting in 8.0. See https://ela.st/kbn-remove-legacy-multitenancy for more details`, }); } + + if (reporting?.roles?.enabled !== false) { + addDeprecation({ + message: + `"${fromPath}.roles" is deprecated. Granting reporting privilege through a "reporting_user" role will not be supported ` + + `starting in 8.0. Please set 'xpack.reporting.roles.enabled' to 'false' and grant reporting privilege to users ` + + `through feature controls in Management > Security > Roles`, + }); + } + return settings; }, ], diff --git a/x-pack/plugins/reporting/server/config/schema.test.ts b/x-pack/plugins/reporting/server/config/schema.test.ts index 49e740b4f2683..e299db2405125 100644 --- a/x-pack/plugins/reporting/server/config/schema.test.ts +++ b/x-pack/plugins/reporting/server/config/schema.test.ts @@ -107,6 +107,7 @@ describe('Reporting Config Schema', () => { "allow": Array [ "reporting_user", ], + "enabled": true, }, } `); @@ -211,6 +212,7 @@ describe('Reporting Config Schema', () => { "allow": Array [ "reporting_user", ], + "enabled": true, }, } `); diff --git a/x-pack/plugins/reporting/server/config/schema.ts b/x-pack/plugins/reporting/server/config/schema.ts index 3f901b283f7bd..f56bf5520072b 100644 --- a/x-pack/plugins/reporting/server/config/schema.ts +++ b/x-pack/plugins/reporting/server/config/schema.ts @@ -160,6 +160,7 @@ const EncryptionKeySchema = schema.conditional( ); const RolesSchema = schema.object({ + enabled: schema.boolean({ defaultValue: true }), // true: use ES API for access control (deprecated in 7.x). false: use Kibana API for application features (8.0) allow: schema.arrayOf(schema.string(), { defaultValue: ['reporting_user'] }), }); diff --git a/x-pack/plugins/reporting/server/core.ts b/x-pack/plugins/reporting/server/core.ts index 03c76941a6e99..62cab5a8fef19 100644 --- a/x-pack/plugins/reporting/server/core.ts +++ b/x-pack/plugins/reporting/server/core.ts @@ -17,6 +17,7 @@ import { SavedObjectsServiceStart, UiSettingsServiceStart, } from '../../../../src/core/server'; +import { PluginStart as DataPluginStart } from '../../../../src/plugins/data/server'; import { PluginSetupContract as FeaturesPluginSetup } from '../../features/server'; import { LicensingPluginSetup } from '../../licensing/server'; import { SecurityPluginSetup } from '../../security/server'; @@ -30,8 +31,7 @@ import { checkLicense, getExportTypesRegistry, LevelLogger } from './lib'; import { screenshotsObservableFactory, ScreenshotsObservableFn } from './lib/screenshots'; import { ReportingStore } from './lib/store'; import { ExecuteReportTask, MonitorReportsTask, ReportTaskParams } from './lib/tasks'; -import { ReportingPluginRouter } from './types'; -import { PluginStart as DataPluginStart } from '../../../../src/plugins/data/server'; +import { ReportingPluginRouter, ReportingStart } from './types'; export interface ReportingInternalSetup { basePath: Pick; @@ -41,6 +41,7 @@ export interface ReportingInternalSetup { security?: SecurityPluginSetup; spaces?: SpacesPluginSetup; taskManager: TaskManagerSetupContract; + logger: LevelLogger; } export interface ReportingInternalStart { @@ -51,6 +52,7 @@ export interface ReportingInternalStart { esClient: IClusterClient; data: DataPluginStart; taskManager: TaskManagerStartContract; + logger: LevelLogger; } export class ReportingCore { @@ -58,16 +60,27 @@ export class ReportingCore { private pluginStartDeps?: ReportingInternalStart; private readonly pluginSetup$ = new Rx.ReplaySubject(); // observe async background setupDeps and config each are done private readonly pluginStart$ = new Rx.ReplaySubject(); // observe async background startDeps + private deprecatedAllowedRoles: string[] | false = false; // DEPRECATED. If `false`, the deprecated features have been disableed private exportTypesRegistry = getExportTypesRegistry(); private executeTask: ExecuteReportTask; private monitorTask: MonitorReportsTask; - private config?: ReportingConfig; + private config?: ReportingConfig; // final config, includes dynamic values based on OS type private executing: Set; + public getStartContract: () => ReportingStart; + constructor(private logger: LevelLogger, context: PluginInitializerContext) { - const config = context.config.get(); - this.executeTask = new ExecuteReportTask(this, config, this.logger); - this.monitorTask = new MonitorReportsTask(this, config, this.logger); + const syncConfig = context.config.get(); + this.deprecatedAllowedRoles = syncConfig.roles.enabled ? syncConfig.roles.allow : false; + this.executeTask = new ExecuteReportTask(this, syncConfig, this.logger); + this.monitorTask = new MonitorReportsTask(this, syncConfig, this.logger); + + this.getStartContract = (): ReportingStart => { + return { + usesUiCapabilities: () => syncConfig.roles.enabled === false, + }; + }; + this.executing = new Set(); } @@ -132,23 +145,38 @@ export class ReportingCore { } /** - * Registers reporting as an Elasticsearch feature for the purpose of toggling visibility based on roles. + * If xpack.reporting.roles.enabled === true, register Reporting as a feature + * that is controlled by user role names */ public registerFeature() { - const config = this.getConfig(); - const allowedRoles = ['superuser', ...(config.get('roles')?.allow ?? [])]; - this.getPluginSetupDeps().features.registerElasticsearchFeature({ - id: 'reporting', - catalogue: ['reporting'], - management: { - insightsAndAlerting: ['reporting'], - }, - privileges: allowedRoles.map((role) => ({ + const { features } = this.getPluginSetupDeps(); + const deprecatedRoles = this.getDeprecatedAllowedRoles(); + + if (deprecatedRoles !== false) { + // refer to roles.allow configuration (deprecated path) + const allowedRoles = ['superuser', ...(deprecatedRoles ?? [])]; + const privileges = allowedRoles.map((role) => ({ requiredClusterPrivileges: [], requiredRoles: [role], ui: [], - })), - }); + })); + + // self-register as an elasticsearch feature (deprecated) + features.registerElasticsearchFeature({ + id: 'reporting', + catalogue: ['reporting'], + management: { + insightsAndAlerting: ['reporting'], + }, + privileges, + }); + } else { + this.logger.debug( + `Reporting roles configuration is disabled. Please assign access to Reporting use Kibana feature controls for applications.` + ); + // trigger application to register Reporting as a subfeature + features.enableReportingUiCapabilities(); + } } /* @@ -161,6 +189,15 @@ export class ReportingCore { return this.config; } + /* + * If deprecated feature has not been disabled, + * this returns an array of allowed role names + * that have access to Reporting. + */ + public getDeprecatedAllowedRoles(): string[] | false { + return this.deprecatedAllowedRoles; + } + /* * Gives async access to the startDeps */ diff --git a/x-pack/plugins/reporting/server/export_types/csv/execute_job.test.ts b/x-pack/plugins/reporting/server/export_types/csv/execute_job.test.ts index f63c07e51dd03..32b5370371cce 100644 --- a/x-pack/plugins/reporting/server/export_types/csv/execute_job.test.ts +++ b/x-pack/plugins/reporting/server/export_types/csv/execute_job.test.ts @@ -22,7 +22,7 @@ import { CancellationToken } from '../../../common'; import { CSV_BOM_CHARS } from '../../../common/constants'; import { LevelLogger } from '../../lib'; import { setFieldFormats } from '../../services'; -import { createMockReportingCore } from '../../test_helpers'; +import { createMockConfigSchema, createMockReportingCore } from '../../test_helpers'; import { runTaskFnFactory } from './execute_job'; import { TaskPayloadDeprecatedCSV } from './types'; @@ -75,7 +75,7 @@ describe('CSV Execute Job', function () { configGetStub.withArgs('csv', 'scroll').returns({}); mockReportingConfig = { get: configGetStub, kbnConfig: { get: configGetStub } }; - mockReportingCore = await createMockReportingCore(mockReportingConfig); + mockReportingCore = await createMockReportingCore(createMockConfigSchema()); mockReportingCore.getUiSettingsServiceFactory = () => Promise.resolve((mockUiSettingsClient as unknown) as IUiSettingsClient); mockReportingCore.setConfig(mockReportingConfig); diff --git a/x-pack/plugins/reporting/server/export_types/csv_searchsource/execute_job.test.ts b/x-pack/plugins/reporting/server/export_types/csv_searchsource/execute_job.test.ts index 1c2e15ebc5d9b..c9d57370ab766 100644 --- a/x-pack/plugins/reporting/server/export_types/csv_searchsource/execute_job.test.ts +++ b/x-pack/plugins/reporting/server/export_types/csv_searchsource/execute_job.test.ts @@ -19,7 +19,6 @@ import nodeCrypto from '@elastic/node-crypto'; import { ReportingCore } from '../../'; import { CancellationToken } from '../../../common'; import { - createMockConfig, createMockConfigSchema, createMockLevelLogger, createMockReportingCore, @@ -34,7 +33,9 @@ let reportingCore: ReportingCore; beforeAll(async () => { const crypto = nodeCrypto({ encryptionKey }); - const config = createMockConfig( + + encryptedHeaders = await crypto.encrypt(headers); + reportingCore = await createMockReportingCore( createMockConfigSchema({ encryptionKey, csv: { @@ -45,10 +46,6 @@ beforeAll(async () => { }, }) ); - - encryptedHeaders = await crypto.encrypt(headers); - - reportingCore = await createMockReportingCore(config); }); test('gets the csv content from job parameters', async () => { diff --git a/x-pack/plugins/reporting/server/export_types/png/execute_job/index.test.ts b/x-pack/plugins/reporting/server/export_types/png/execute_job/index.test.ts index 34fe5360522b1..ee264f7c57ff6 100644 --- a/x-pack/plugins/reporting/server/export_types/png/execute_job/index.test.ts +++ b/x-pack/plugins/reporting/server/export_types/png/execute_job/index.test.ts @@ -9,7 +9,11 @@ import * as Rx from 'rxjs'; import { ReportingCore } from '../../../'; import { CancellationToken } from '../../../../common'; import { cryptoFactory, LevelLogger } from '../../../lib'; -import { createMockReportingCore } from '../../../test_helpers'; +import { + createMockConfig, + createMockConfigSchema, + createMockReportingCore, +} from '../../../test_helpers'; import { generatePngObservableFactory } from '../lib/generate_png'; import { TaskPayloadPNG } from '../types'; import { runTaskFnFactory } from './'; @@ -40,27 +44,17 @@ const encryptHeaders = async (headers: Record) => { const getBasePayload = (baseObj: any) => baseObj as TaskPayloadPNG; beforeEach(async () => { - const kbnConfig = { - 'server.basePath': '/sbp', - }; - const reportingConfig = { + const mockReportingConfig = createMockConfigSchema({ index: '.reporting-2018.10.10', encryptionKey: mockEncryptionKey, - 'kibanaServer.hostname': 'localhost', - 'kibanaServer.port': 5601, - 'kibanaServer.protocol': 'http', - 'queue.indexInterval': 'daily', - 'queue.timeout': Infinity, - }; - const mockReportingConfig = { - get: (...keys: string[]) => (reportingConfig as any)[keys.join('.')], - kbnConfig: { get: (...keys: string[]) => (kbnConfig as any)[keys.join('.')] }, - }; + queue: { + indexInterval: 'daily', + timeout: Infinity, + }, + }); mockReporting = await createMockReportingCore(mockReportingConfig); - - // @ts-ignore over-riding config method - mockReporting.config = mockReportingConfig; + mockReporting.setConfig(createMockConfig(mockReportingConfig)); (generatePngObservableFactory as jest.Mock).mockReturnValue(jest.fn()); }); @@ -98,14 +92,14 @@ test(`passes browserTimezone to generatePng`, async () => { ], "warning": [Function], }, - "http://localhost:5601/sbp/app/kibana#/something", + "localhost:80undefined/app/kibana#/something", "UTC", Object { "conditions": Object { - "basePath": "/sbp", + "basePath": undefined, "hostname": "localhost", - "port": 5601, - "protocol": "http", + "port": 80, + "protocol": undefined, }, "headers": Object {}, }, diff --git a/x-pack/plugins/reporting/server/export_types/printable_pdf/execute_job/index.test.ts b/x-pack/plugins/reporting/server/export_types/printable_pdf/execute_job/index.test.ts index 61eab18987f7c..a9863a7edf607 100644 --- a/x-pack/plugins/reporting/server/export_types/printable_pdf/execute_job/index.test.ts +++ b/x-pack/plugins/reporting/server/export_types/printable_pdf/execute_job/index.test.ts @@ -11,11 +11,7 @@ import * as Rx from 'rxjs'; import { ReportingCore } from '../../../'; import { CancellationToken } from '../../../../common'; import { cryptoFactory, LevelLogger } from '../../../lib'; -import { - createMockConfig, - createMockConfigSchema, - createMockReportingCore, -} from '../../../test_helpers'; +import { createMockConfigSchema, createMockReportingCore } from '../../../test_helpers'; import { generatePdfObservableFactory } from '../lib/generate_pdf'; import { TaskPayloadPDF } from '../types'; import { runTaskFnFactory } from './'; @@ -53,12 +49,7 @@ beforeEach(async () => { 'kibanaServer.protocol': 'http', }; const mockSchema = createMockConfigSchema(reportingConfig); - const mockReportingConfig = createMockConfig(mockSchema); - - mockReporting = await createMockReportingCore(mockReportingConfig); - - // @ts-ignore over-riding config - mockReporting.config = mockReportingConfig; + mockReporting = await createMockReportingCore(mockSchema); (generatePdfObservableFactory as jest.Mock).mockReturnValue(jest.fn()); }); diff --git a/x-pack/plugins/reporting/server/export_types/printable_pdf/lib/get_custom_logo.test.ts b/x-pack/plugins/reporting/server/export_types/printable_pdf/lib/get_custom_logo.test.ts index ed58fef2f5dc8..ebdceda0820b9 100644 --- a/x-pack/plugins/reporting/server/export_types/printable_pdf/lib/get_custom_logo.test.ts +++ b/x-pack/plugins/reporting/server/export_types/printable_pdf/lib/get_custom_logo.test.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { ReportingConfig, ReportingCore } from '../../../'; +import { ReportingCore } from '../../../'; import { createMockConfig, createMockConfigSchema, @@ -15,14 +15,12 @@ import { import { getConditionalHeaders } from '../../common'; import { getCustomLogo } from './get_custom_logo'; -let mockConfig: ReportingConfig; let mockReportingPlugin: ReportingCore; const logger = createMockLevelLogger(); beforeEach(async () => { - mockConfig = createMockConfig(createMockConfigSchema()); - mockReportingPlugin = await createMockReportingCore(mockConfig); + mockReportingPlugin = await createMockReportingCore(createMockConfigSchema()); }); test(`gets logo from uiSettings`, async () => { @@ -42,7 +40,10 @@ test(`gets logo from uiSettings`, async () => { get: mockGet, }); - const conditionalHeaders = getConditionalHeaders(mockConfig, permittedHeaders); + const conditionalHeaders = getConditionalHeaders( + createMockConfig(createMockConfigSchema()), + permittedHeaders + ); const { logo } = await getCustomLogo( mockReportingPlugin, diff --git a/x-pack/plugins/reporting/server/index.ts b/x-pack/plugins/reporting/server/index.ts index 0233e4dfa4ebd..999311b9ae17b 100644 --- a/x-pack/plugins/reporting/server/index.ts +++ b/x-pack/plugins/reporting/server/index.ts @@ -6,17 +6,20 @@ */ import { PluginInitializerContext } from 'kibana/server'; -import { ReportingPlugin } from './plugin'; import { ReportingConfigType } from './config'; +import { ReportingPlugin } from './plugin'; export const plugin = (initContext: PluginInitializerContext) => new ReportingPlugin(initContext); -export { ReportingPlugin as Plugin }; export { config } from './config'; -export { ReportingSetupDeps as PluginSetup } from './types'; -export { ReportingStartDeps as PluginStart } from './types'; - +export { ReportingConfig } from './config/config'; // internal imports export { ReportingCore } from './core'; -export { ReportingConfig } from './config/config'; +export { + ReportingSetup, + ReportingSetupDeps as PluginSetup, + ReportingStartDeps as PluginStart, +} from './types'; + +export { ReportingPlugin as Plugin }; diff --git a/x-pack/plugins/reporting/server/lib/enqueue_job.test.ts b/x-pack/plugins/reporting/server/lib/enqueue_job.test.ts index 8e5a61e46df91..d9d1815835baa 100644 --- a/x-pack/plugins/reporting/server/lib/enqueue_job.test.ts +++ b/x-pack/plugins/reporting/server/lib/enqueue_job.test.ts @@ -10,7 +10,6 @@ import { ReportingCore } from '../'; import { TaskManagerStartContract } from '../../../task_manager/server'; import { ReportingInternalStart } from '../core'; import { - createMockConfig, createMockConfigSchema, createMockLevelLogger, createMockReportingCore, @@ -23,8 +22,6 @@ import { TaskRunResult } from './tasks'; describe('Enqueue Job', () => { const logger = createMockLevelLogger(); - const mockSchema = createMockConfigSchema(); - const mockConfig = createMockConfig(mockSchema); let mockReporting: ReportingCore; let mockExportTypesRegistry: ExportTypesRegistry; @@ -42,7 +39,7 @@ describe('Enqueue Job', () => { runTaskFnFactory: () => async () => (({ runParamsTest: { test2: 'yes' } } as unknown) as TaskRunResult), }); - mockReporting = await createMockReportingCore(mockConfig); + mockReporting = await createMockReportingCore(createMockConfigSchema()); mockReporting.getExportTypesRegistry = () => mockExportTypesRegistry; mockReporting.getStore = () => Promise.resolve(({ diff --git a/x-pack/plugins/reporting/server/lib/store/store.test.ts b/x-pack/plugins/reporting/server/lib/store/store.test.ts index 2af0fe7830eea..7f96433fcc6ce 100644 --- a/x-pack/plugins/reporting/server/lib/store/store.test.ts +++ b/x-pack/plugins/reporting/server/lib/store/store.test.ts @@ -7,9 +7,8 @@ import type { DeeplyMockedKeys } from '@kbn/utility-types/jest'; import { ElasticsearchClient } from 'src/core/server'; -import { ReportingConfig, ReportingCore } from '../../'; +import { ReportingCore } from '../../'; import { - createMockConfig, createMockConfigSchema, createMockLevelLogger, createMockReportingCore, @@ -19,7 +18,6 @@ import { ReportingStore } from './store'; describe('ReportingStore', () => { const mockLogger = createMockLevelLogger(); - let mockConfig: ReportingConfig; let mockCore: ReportingCore; let mockEsClient: DeeplyMockedKeys; @@ -28,9 +26,7 @@ describe('ReportingStore', () => { index: '.reporting-test', queue: { indexInterval: 'week' }, }; - const mockSchema = createMockConfigSchema(reportingConfig); - mockConfig = createMockConfig(mockSchema); - mockCore = await createMockReportingCore(mockConfig); + mockCore = await createMockReportingCore(createMockConfigSchema(reportingConfig)); mockEsClient = (await mockCore.getEsClient()).asInternalUser as typeof mockEsClient; mockEsClient.indices.create.mockResolvedValue({} as any); @@ -71,9 +67,7 @@ describe('ReportingStore', () => { index: '.reporting-test', queue: { indexInterval: 'centurially' }, }; - const mockSchema = createMockConfigSchema(reportingConfig); - mockConfig = createMockConfig(mockSchema); - mockCore = await createMockReportingCore(mockConfig); + mockCore = await createMockReportingCore(createMockConfigSchema(reportingConfig)); const store = new ReportingStore(mockCore, mockLogger); const mockReport = new Report({ diff --git a/x-pack/plugins/reporting/server/lib/tasks/execute_report.test.ts b/x-pack/plugins/reporting/server/lib/tasks/execute_report.test.ts index 5bd895360ef78..99045050120c1 100644 --- a/x-pack/plugins/reporting/server/lib/tasks/execute_report.test.ts +++ b/x-pack/plugins/reporting/server/lib/tasks/execute_report.test.ts @@ -10,7 +10,6 @@ import { RunContext } from '../../../../task_manager/server'; import { taskManagerMock } from '../../../../task_manager/server/mocks'; import { ReportingConfigType } from '../../config'; import { - createMockConfig, createMockConfigSchema, createMockLevelLogger, createMockReportingCore, @@ -24,8 +23,7 @@ describe('Execute Report Task', () => { let configType: ReportingConfigType; beforeAll(async () => { configType = createMockConfigSchema(); - const mockConfig = createMockConfig(configType); - mockReporting = await createMockReportingCore(mockConfig); + mockReporting = await createMockReportingCore(configType); }); it('Instance setup', () => { diff --git a/x-pack/plugins/reporting/server/lib/tasks/monitor_report.test.ts b/x-pack/plugins/reporting/server/lib/tasks/monitor_report.test.ts index 65627dc86fa5a..fb9b49ab9e265 100644 --- a/x-pack/plugins/reporting/server/lib/tasks/monitor_report.test.ts +++ b/x-pack/plugins/reporting/server/lib/tasks/monitor_report.test.ts @@ -10,7 +10,6 @@ import { RunContext } from '../../../../task_manager/server'; import { taskManagerMock } from '../../../../task_manager/server/mocks'; import { ReportingConfigType } from '../../config'; import { - createMockConfig, createMockConfigSchema, createMockLevelLogger, createMockReportingCore, @@ -24,8 +23,7 @@ describe('Execute Report Task', () => { let configType: ReportingConfigType; beforeAll(async () => { configType = createMockConfigSchema(); - const mockConfig = createMockConfig(configType); - mockReporting = await createMockReportingCore(mockConfig); + mockReporting = await createMockReportingCore(configType); }); it('Instance setup', () => { diff --git a/x-pack/plugins/reporting/server/plugin.ts b/x-pack/plugins/reporting/server/plugin.ts index 75411b30ec0bd..26a9be2b15c3f 100644 --- a/x-pack/plugins/reporting/server/plugin.ts +++ b/x-pack/plugins/reporting/server/plugin.ts @@ -24,23 +24,23 @@ import { registerReportingUsageCollector } from './usage'; export class ReportingPlugin implements Plugin { - private readonly initializerContext: PluginInitializerContext; private logger: LevelLogger; - private reportingCore: ReportingCore; + private reportingCore?: ReportingCore; - constructor(context: PluginInitializerContext) { - this.logger = new LevelLogger(context.logger.get()); - this.reportingCore = new ReportingCore(this.logger, context); - this.initializerContext = context; + constructor(private initContext: PluginInitializerContext) { + this.logger = new LevelLogger(initContext.logger.get()); } public setup(core: CoreSetup, plugins: ReportingSetupDeps) { + const reportingCore = new ReportingCore(this.logger, this.initContext); + // prevent throwing errors in route handlers about async deps not being initialized // @ts-expect-error null is not assignable to object. use a boolean property to ensure reporting API is enabled. core.http.registerRouteHandlerContext(PLUGIN_ID, () => { - if (this.reportingCore.pluginIsStarted()) { - return {}; // ReportingStart contract + if (reportingCore.pluginIsStarted()) { + return reportingCore.getStartContract(); } else { + this.logger.error(`Reporting features are not yet ready`); return null; } }); @@ -49,7 +49,6 @@ export class ReportingPlugin const { http } = core; const { features, licensing, security, spaces, taskManager } = plugins; - const { initializerContext: initContext, reportingCore } = this; const router = http.createRouter(); const basePath = http.basePath; @@ -62,6 +61,7 @@ export class ReportingPlugin security, spaces, taskManager, + logger: this.logger, }); registerReportingUsageCollector(reportingCore, plugins); @@ -69,7 +69,7 @@ export class ReportingPlugin // async background setup (async () => { - const config = await buildConfig(initContext, core, this.logger); + const config = await buildConfig(this.initContext, core, this.logger); reportingCore.setConfig(config); // Feature registration relies on config, so it cannot be setup before here. reportingCore.registerFeature(); @@ -79,22 +79,22 @@ export class ReportingPlugin this.logger.error(e); }); - return {}; + this.reportingCore = reportingCore; + return reportingCore.getStartContract(); } public start(core: CoreStart, plugins: ReportingStartDeps) { // use data plugin for csv formats setFieldFormats(plugins.data.fieldFormats); - - const { logger, reportingCore } = this; + const reportingCore = this.reportingCore!; // async background start (async () => { - await this.reportingCore.pluginSetsUp(); + await reportingCore.pluginSetsUp(); const config = reportingCore.getConfig(); - const browserDriverFactory = await initializeBrowserDriverFactory(config, logger); - const store = new ReportingStore(reportingCore, logger); + const browserDriverFactory = await initializeBrowserDriverFactory(config, this.logger); + const store = new ReportingStore(reportingCore, this.logger); await reportingCore.pluginStart({ browserDriverFactory, @@ -104,6 +104,7 @@ export class ReportingPlugin esClient: core.elasticsearch.client, data: plugins.data, taskManager: plugins.taskManager, + logger: this.logger, }); this.logger.debug('Start complete'); @@ -112,6 +113,6 @@ export class ReportingPlugin this.logger.error(e); }); - return {}; + return reportingCore.getStartContract(); } } diff --git a/x-pack/plugins/reporting/server/routes/csv_searchsource_immediate.ts b/x-pack/plugins/reporting/server/routes/csv_searchsource_immediate.ts index 5d2b77c082ca5..2da509f024c25 100644 --- a/x-pack/plugins/reporting/server/routes/csv_searchsource_immediate.ts +++ b/x-pack/plugins/reporting/server/routes/csv_searchsource_immediate.ts @@ -38,6 +38,13 @@ export function registerGenerateCsvFromSavedObjectImmediate( const userHandler = authorizedUserPreRoutingFactory(reporting); const { router } = setupDeps; + // TODO: find a way to abstract this using ExportTypeRegistry: it needs a new + // public method to return this array + // const registry = reporting.getExportTypesRegistry(); + // const kibanaAccessControlTags = registry.getAllAccessControlTags(); + const useKibanaAccessControl = reporting.getDeprecatedAllowedRoles() === false; // true if deprecated config is turned off + const kibanaAccessControlTags = useKibanaAccessControl ? ['access:downloadCsv'] : []; + // This API calls run the SearchSourceImmediate export type's runTaskFn directly router.post( { @@ -50,6 +57,9 @@ export function registerGenerateCsvFromSavedObjectImmediate( title: schema.string(), }), }, + options: { + tags: kibanaAccessControlTags, + }, }, userHandler(async (user, context, req: CsvFromSavedObjectRequest, res) => { const logger = parentLogger.clone(['csv_searchsource_immediate']); diff --git a/x-pack/plugins/reporting/server/routes/diagnostic/browser.test.ts b/x-pack/plugins/reporting/server/routes/diagnostic/browser.test.ts index d80be2d7f0f42..37361fc91392c 100644 --- a/x-pack/plugins/reporting/server/routes/diagnostic/browser.test.ts +++ b/x-pack/plugins/reporting/server/routes/diagnostic/browser.test.ts @@ -12,12 +12,13 @@ import { setupServer } from 'src/core/server/test_utils'; import supertest from 'supertest'; import { ReportingCore } from '../..'; import { + createMockConfigSchema, createMockLevelLogger, createMockPluginSetup, createMockReportingCore, } from '../../test_helpers'; -import { registerDiagnoseBrowser } from './browser'; import type { ReportingRequestHandlerContext } from '../../types'; +import { registerDiagnoseBrowser } from './browser'; jest.mock('child_process'); jest.mock('readline'); @@ -38,25 +39,17 @@ describe('POST /diagnose/browser', () => { const mockedSpawn: any = spawn; const mockedCreateInterface: any = createInterface; - const config = { - get: jest.fn().mockImplementation((...keys) => { - const key = keys.join('.'); - switch (key) { - case 'queue.timeout': - return 120000; - case 'capture.browser.chromium.proxy': - return { enabled: false }; - } - }), - kbnConfig: { get: jest.fn() }, - }; + const config = createMockConfigSchema({ + queue: { timeout: 120000 }, + capture: { browser: { chromium: { proxy: { enabled: false } } } }, + }); beforeEach(async () => { ({ server, httpSetup } = await setupServer(reportingSymbol)); httpSetup.registerRouteHandlerContext( reportingSymbol, 'reporting', - () => ({}) + () => ({ usesUiCapabilities: () => false }) ); const mockSetupDeps = createMockPluginSetup({ diff --git a/x-pack/plugins/reporting/server/routes/diagnostic/config.test.ts b/x-pack/plugins/reporting/server/routes/diagnostic/config.test.ts index 952a33ff64190..9e6a7769f6351 100644 --- a/x-pack/plugins/reporting/server/routes/diagnostic/config.test.ts +++ b/x-pack/plugins/reporting/server/routes/diagnostic/config.test.ts @@ -11,13 +11,16 @@ import { ElasticsearchClient } from 'kibana/server'; import { setupServer } from 'src/core/server/test_utils'; import supertest from 'supertest'; import { ReportingCore } from '../..'; +import { ReportingConfigType } from '../../config'; import { - createMockReportingCore, + createMockConfig, + createMockConfigSchema, createMockLevelLogger, createMockPluginSetup, + createMockReportingCore, } from '../../test_helpers'; -import { registerDiagnoseConfig } from './config'; import type { ReportingRequestHandlerContext } from '../../types'; +import { registerDiagnoseConfig } from './config'; type SetupServerReturn = UnwrapPromise>; @@ -27,7 +30,7 @@ describe('POST /diagnose/config', () => { let httpSetup: SetupServerReturn['httpSetup']; let core: ReportingCore; let mockSetupDeps: any; - let config: any; + let config: ReportingConfigType; let mockEsClient: DeeplyMockedKeys; const mockLogger = createMockLevelLogger(); @@ -37,26 +40,14 @@ describe('POST /diagnose/config', () => { httpSetup.registerRouteHandlerContext( reportingSymbol, 'reporting', - () => ({}) + () => ({ usesUiCapabilities: () => false }) ); mockSetupDeps = createMockPluginSetup({ router: httpSetup.createRouter(''), } as unknown) as any; - config = { - get: jest.fn().mockImplementation((...keys) => { - const key = keys.join('.'); - switch (key) { - case 'queue.timeout': - return 120000; - case 'csv.maxSizeBytes': - return 1024; - } - }), - kbnConfig: { get: jest.fn() }, - }; - + config = createMockConfigSchema({ queue: { timeout: 120000 }, csv: { maxSizeBytes: 1024 } }); core = await createMockReportingCore(config, mockSetupDeps); mockEsClient = (await core.getEsClient()).asInternalUser as typeof mockEsClient; }); @@ -94,7 +85,11 @@ describe('POST /diagnose/config', () => { }); it('returns a 200 with help text when not configured properly', async () => { - config.get.mockImplementation(() => 10485760); + core.setConfig( + createMockConfig( + createMockConfigSchema({ queue: { timeout: 120000 }, csv: { maxSizeBytes: 10485760 } }) + ) + ); mockEsClient.cluster.getSettings.mockResolvedValueOnce({ body: { defaults: { diff --git a/x-pack/plugins/reporting/server/routes/diagnostic/screenshot.test.ts b/x-pack/plugins/reporting/server/routes/diagnostic/screenshot.test.ts index 6c723764d9f0a..9b3260cb31da7 100644 --- a/x-pack/plugins/reporting/server/routes/diagnostic/screenshot.test.ts +++ b/x-pack/plugins/reporting/server/routes/diagnostic/screenshot.test.ts @@ -13,6 +13,7 @@ import { createMockReportingCore, createMockLevelLogger, createMockPluginSetup, + createMockConfigSchema, } from '../../test_helpers'; import { registerDiagnoseScreenshot } from './screenshot'; import type { ReportingRequestHandlerContext } from '../../types'; @@ -38,14 +39,7 @@ describe('POST /diagnose/screenshot', () => { (generatePngObservableFactory as any).mockResolvedValue(generateMock); }; - const config = { - get: jest.fn().mockImplementation((...keys) => { - if (keys.join('.') === 'queue.timeout') { - return 120000; - } - }), - kbnConfig: { get: jest.fn() }, - }; + const config = createMockConfigSchema({ queue: { timeout: 120000 } }); const mockLogger = createMockLevelLogger(); beforeEach(async () => { @@ -53,7 +47,7 @@ describe('POST /diagnose/screenshot', () => { httpSetup.registerRouteHandlerContext( reportingSymbol, 'reporting', - () => ({}) + () => ({ usesUiCapabilities: () => false }) ); const mockSetupDeps = createMockPluginSetup({ diff --git a/x-pack/plugins/reporting/server/routes/generate_from_jobparams.ts b/x-pack/plugins/reporting/server/routes/generate_from_jobparams.ts index 681d93f1f6dff..55d12e5c6d442 100644 --- a/x-pack/plugins/reporting/server/routes/generate_from_jobparams.ts +++ b/x-pack/plugins/reporting/server/routes/generate_from_jobparams.ts @@ -24,26 +24,22 @@ export function registerGenerateFromJobParams( const userHandler = authorizedUserPreRoutingFactory(reporting); const { router } = setupDeps; + // TODO: find a way to abstract this using ExportTypeRegistry: it needs a new + // public method to return this array + // const registry = reporting.getExportTypesRegistry(); + // const kibanaAccessControlTags = registry.getAllAccessControlTags(); + const useKibanaAccessControl = reporting.getDeprecatedAllowedRoles() === false; // true if Reporting's deprecated access control feature is disabled + const kibanaAccessControlTags = useKibanaAccessControl ? ['access:generateReport'] : []; + router.post( { path: `${BASE_GENERATE}/{exportType}`, validate: { - params: schema.object({ - exportType: schema.string({ minLength: 2 }), - }), - body: schema.nullable( - schema.object({ - jobParams: schema.maybe(schema.string()), - }) - ), - query: schema.nullable( - schema.object({ - jobParams: schema.string({ - defaultValue: '', - }), - }) - ), + params: schema.object({ exportType: schema.string({ minLength: 2 }) }), + body: schema.nullable(schema.object({ jobParams: schema.maybe(schema.string()) })), + query: schema.nullable(schema.object({ jobParams: schema.string({ defaultValue: '' }) })), }, + options: { tags: kibanaAccessControlTags }, }, userHandler(async (user, context, req, res) => { let jobParamsRison: null | string = null; diff --git a/x-pack/plugins/reporting/server/routes/generation.test.ts b/x-pack/plugins/reporting/server/routes/generation.test.ts index 0ce977e0a5431..c6889f3612b59 100644 --- a/x-pack/plugins/reporting/server/routes/generation.test.ts +++ b/x-pack/plugins/reporting/server/routes/generation.test.ts @@ -14,7 +14,10 @@ import supertest from 'supertest'; import { ReportingCore } from '..'; import { ExportTypesRegistry } from '../lib/export_types_registry'; import { createMockLevelLogger, createMockReportingCore } from '../test_helpers'; -import { createMockPluginSetup } from '../test_helpers/create_mock_reportingplugin'; +import { + createMockConfigSchema, + createMockPluginSetup, +} from '../test_helpers/create_mock_reportingplugin'; import { registerJobGenerationRoutes } from './generation'; import type { ReportingRequestHandlerContext } from '../types'; @@ -28,24 +31,15 @@ describe('POST /api/reporting/generate', () => { let core: ReportingCore; let mockEsClient: DeeplyMockedKeys; - const config = { - get: jest.fn().mockImplementation((...args) => { - const key = args.join('.'); - switch (key) { - case 'queue.indexInterval': - return 'year'; - case 'queue.timeout': - return 10000; - case 'index': - return '.reporting'; - case 'queue.pollEnabled': - return true; - default: - return; - } - }), - kbnConfig: { get: jest.fn() }, - }; + const config = createMockConfigSchema({ + queue: { + indexInterval: 'year', + timeout: 10000, + pollEnabled: true, + }, + index: '.reporting', + }); + const mockLogger = createMockLevelLogger(); beforeEach(async () => { @@ -53,7 +47,7 @@ describe('POST /api/reporting/generate', () => { httpSetup.registerRouteHandlerContext( reportingSymbol, 'reporting', - () => ({}) + () => ({ usesUiCapabilities: jest.fn() }) ); const mockSetupDeps = createMockPluginSetup({ diff --git a/x-pack/plugins/reporting/server/routes/jobs.test.ts b/x-pack/plugins/reporting/server/routes/jobs.test.ts index 885fc701935fe..3f913dfd1f32f 100644 --- a/x-pack/plugins/reporting/server/routes/jobs.test.ts +++ b/x-pack/plugins/reporting/server/routes/jobs.test.ts @@ -15,7 +15,6 @@ import { ReportingCore } from '..'; import { ReportingInternalSetup } from '../core'; import { ExportTypesRegistry } from '../lib/export_types_registry'; import { - createMockConfig, createMockConfigSchema, createMockPluginSetup, createMockReportingCore, @@ -31,9 +30,9 @@ describe('GET /api/reporting/jobs/download', () => { let httpSetup: SetupServerReturn['httpSetup']; let exportTypesRegistry: ExportTypesRegistry; let core: ReportingCore; + let mockSetupDeps: ReportingInternalSetup; let mockEsClient: DeeplyMockedKeys; - const config = createMockConfig(createMockConfigSchema()); const getHits = (...sources: any) => { return { hits: { @@ -47,9 +46,9 @@ describe('GET /api/reporting/jobs/download', () => { httpSetup.registerRouteHandlerContext( reportingSymbol, 'reporting', - () => ({}) + () => ({ usesUiCapabilities: jest.fn() }) ); - const mockSetupDeps = createMockPluginSetup({ + mockSetupDeps = createMockPluginSetup({ security: { license: { isEnabled: () => true, @@ -72,7 +71,10 @@ describe('GET /api/reporting/jobs/download', () => { }, }); - core = await createMockReportingCore(config, mockSetupDeps); + core = await createMockReportingCore( + createMockConfigSchema({ roles: { enabled: false } }), + mockSetupDeps + ); // @ts-ignore exportTypesRegistry = new ExportTypesRegistry(); exportTypesRegistry.register({ @@ -139,36 +141,6 @@ describe('GET /api/reporting/jobs/download', () => { ); }); - it('fails on users without the appropriate role', async () => { - // @ts-ignore - core.pluginSetupDeps = ({ - // @ts-ignore - ...core.pluginSetupDeps, - security: { - license: { - isEnabled: () => true, - }, - authc: { - getCurrentUser: () => ({ - id: '123', - roles: ['peasant'], - username: 'Tom Riddle', - }), - }, - }, - } as unknown) as ReportingInternalSetup; - registerJobInfoRoutes(core); - - await server.start(); - - await supertest(httpSetup.server.listener) - .get('/api/reporting/jobs/download/dope') - .expect(403) - .then(({ body }) => - expect(body.message).toMatchInlineSnapshot(`"Sorry, you don't have access to Reporting"`) - ); - }); - it('returns 404 if job not found', async () => { mockEsClient.search.mockResolvedValueOnce({ body: getHits() } as any); registerJobInfoRoutes(core); @@ -329,4 +301,38 @@ describe('GET /api/reporting/jobs/download', () => { }); }); }); + + describe('Deprecated: role-based access control', () => { + it('fails on users without the appropriate role', async () => { + const deprecatedConfig = createMockConfigSchema({ roles: { enabled: true } }); + core = await createMockReportingCore(deprecatedConfig, mockSetupDeps); + // @ts-ignore + core.pluginSetupDeps = ({ + // @ts-ignore + ...core.pluginSetupDeps, + security: { + license: { + isEnabled: () => true, + }, + authc: { + getCurrentUser: () => ({ + id: '123', + roles: ['peasant'], + username: 'Tom Riddle', + }), + }, + }, + } as unknown) as ReportingInternalSetup; + registerJobInfoRoutes(core); + + await server.start(); + + await supertest(httpSetup.server.listener) + .get('/api/reporting/jobs/download/dope') + .expect(403) + .then(({ body }) => + expect(body.message).toMatchInlineSnapshot(`"Sorry, you don't have access to Reporting"`) + ); + }); + }); }); diff --git a/x-pack/plugins/reporting/server/routes/lib/authorized_user_pre_routing.test.ts b/x-pack/plugins/reporting/server/routes/lib/authorized_user_pre_routing.test.ts index 0f1bfa38ee6c8..16ef9e6d5bc10 100644 --- a/x-pack/plugins/reporting/server/routes/lib/authorized_user_pre_routing.test.ts +++ b/x-pack/plugins/reporting/server/routes/lib/authorized_user_pre_routing.test.ts @@ -5,22 +5,16 @@ * 2.0. */ -import { KibanaRequest, KibanaResponseFactory } from 'kibana/server'; +import { KibanaRequest, KibanaResponseFactory } from 'src/core/server'; import { coreMock, httpServerMock } from 'src/core/server/mocks'; import { ReportingCore } from '../../'; import { ReportingInternalSetup } from '../../core'; -import { - createMockConfig, - createMockConfigSchema, - createMockReportingCore, -} from '../../test_helpers'; -import { authorizedUserPreRoutingFactory } from './authorized_user_pre_routing'; +import { createMockConfigSchema, createMockReportingCore } from '../../test_helpers'; import type { ReportingRequestHandlerContext } from '../../types'; +import { authorizedUserPreRoutingFactory } from './authorized_user_pre_routing'; let mockCore: ReportingCore; -const mockConfig: any = { 'server.basePath': '/sbp', 'roles.allow': ['reporting_user'] }; -const mockReportingConfigSchema = createMockConfigSchema(mockConfig); -const mockReportingConfig = createMockConfig(mockReportingConfigSchema); +const mockReportingConfig = createMockConfigSchema({ roles: { enabled: false } }); const getMockContext = () => (({ @@ -111,50 +105,64 @@ describe('authorized_user_pre_routing', function () { }); }); - it(`should return with 403 when security is enabled but user doesn't have the allowed role`, async function () { - mockCore.getPluginSetupDeps = () => - (({ - // @ts-ignore - ...mockCore.pluginSetupDeps, - security: { - license: { isEnabled: () => true }, - authc: { getCurrentUser: () => ({ username: 'friendlyuser', roles: ['cowboy'] }) }, + describe('Deprecated: security roles for access control', () => { + beforeEach(async () => { + const mockReportingConfigDeprecated = createMockConfigSchema({ + roles: { + allow: ['reporting_user'], + enabled: true, }, - } as unknown) as ReportingInternalSetup); - const authorizedUserPreRouting = authorizedUserPreRoutingFactory(mockCore); - const mockResponseFactory = getMockResponseFactory(); + }); + mockCore = await createMockReportingCore(mockReportingConfigDeprecated); + }); - const mockHandler = () => { - throw new Error('Handler callback should not be called'); - }; - expect( - authorizedUserPreRouting(mockHandler)(getMockContext(), getMockRequest(), mockResponseFactory) - ).toMatchObject({ body: `Sorry, you don't have access to Reporting` }); - }); + it(`should return with 403 when security is enabled but user doesn't have the allowed role`, async function () { + mockCore.getPluginSetupDeps = () => + (({ + // @ts-ignore + ...mockCore.pluginSetupDeps, + security: { + license: { isEnabled: () => true }, + authc: { getCurrentUser: () => ({ username: 'friendlyuser', roles: ['cowboy'] }) }, + }, + } as unknown) as ReportingInternalSetup); + const authorizedUserPreRouting = authorizedUserPreRoutingFactory(mockCore); + const mockResponseFactory = getMockResponseFactory(); + + const mockHandler = () => { + throw new Error('Handler callback should not be called'); + }; + expect( + authorizedUserPreRouting(mockHandler)( + getMockContext(), + getMockRequest(), + mockResponseFactory + ) + ).toMatchObject({ body: `Sorry, you don't have access to Reporting` }); + }); - it('should return from handler when security is enabled and user has explicitly allowed role', function (done) { - mockCore.getPluginSetupDeps = () => - (({ - // @ts-ignore - ...mockCore.pluginSetupDeps, - security: { - license: { isEnabled: () => true }, - authc: { - getCurrentUser: () => ({ username: 'friendlyuser', roles: ['reporting_user'] }), + it('should return from handler when security is enabled and user has explicitly allowed role', function (done) { + mockCore.getPluginSetupDeps = () => + (({ + // @ts-ignore + ...mockCore.pluginSetupDeps, + security: { + license: { isEnabled: () => true }, + authc: { + getCurrentUser: () => ({ username: 'friendlyuser', roles: ['reporting_user'] }), + }, }, - }, - } as unknown) as ReportingInternalSetup); - // @ts-ignore overloading config getter - mockCore.config = mockReportingConfig; - const authorizedUserPreRouting = authorizedUserPreRoutingFactory(mockCore); - const mockResponseFactory = getMockResponseFactory(); + } as unknown) as ReportingInternalSetup); + const authorizedUserPreRouting = authorizedUserPreRoutingFactory(mockCore); + const mockResponseFactory = getMockResponseFactory(); + + authorizedUserPreRouting((user) => { + expect(user).toMatchObject({ roles: ['reporting_user'], username: 'friendlyuser' }); + done(); + return Promise.resolve({ status: 200, options: {} }); + })(getMockContext(), getMockRequest(), mockResponseFactory); + }); - authorizedUserPreRouting((user) => { - expect(user).toMatchObject({ roles: ['reporting_user'], username: 'friendlyuser' }); - done(); - return Promise.resolve({ status: 200, options: {} }); - })(getMockContext(), getMockRequest(), mockResponseFactory); + it('should return from handler when security is enabled and user has superuser role', async function () {}); }); - - it('should return from handler when security is enabled and user has superuser role', async function () {}); }); diff --git a/x-pack/plugins/reporting/server/routes/lib/authorized_user_pre_routing.ts b/x-pack/plugins/reporting/server/routes/lib/authorized_user_pre_routing.ts index d2576224fc792..846d8c28a5378 100644 --- a/x-pack/plugins/reporting/server/routes/lib/authorized_user_pre_routing.ts +++ b/x-pack/plugins/reporting/server/routes/lib/authorized_user_pre_routing.ts @@ -26,35 +26,40 @@ export type RequestHandlerUser = RequestHandler< export const authorizedUserPreRoutingFactory = function authorizedUserPreRoutingFn( reporting: ReportingCore ) { - const setupDeps = reporting.getPluginSetupDeps(); - const getUser = getUserFactory(setupDeps.security); + const { logger, security } = reporting.getPluginSetupDeps(); + const getUser = getUserFactory(security); return ( handler: RequestHandlerUser ): RequestHandler => { return (context, req, res) => { - let user: ReportingRequestUser = false; - if (setupDeps.security && setupDeps.security.license.isEnabled()) { - // find the authenticated user, or null if security is not enabled - user = getUser(req); - if (!user) { - // security is enabled but the user is null - return res.unauthorized({ body: `Sorry, you aren't authenticated` }); + try { + let user: ReportingRequestUser = false; + if (security && security.license.isEnabled()) { + // find the authenticated user, or null if security is not enabled + user = getUser(req); + if (!user) { + // security is enabled but the user is null + return res.unauthorized({ body: `Sorry, you aren't authenticated` }); + } } - } - if (user) { - // check allowance with the configured set of roleas + "superuser" - const config = reporting.getConfig(); - const allowedRoles = config.get('roles', 'allow') || []; - const authorizedRoles = [superuserRole, ...allowedRoles]; + const deprecatedAllowedRoles = reporting.getDeprecatedAllowedRoles(); + if (user && deprecatedAllowedRoles !== false) { + // check allowance with the configured set of roleas + "superuser" + const allowedRoles = deprecatedAllowedRoles || []; + const authorizedRoles = [superuserRole, ...allowedRoles]; - if (!user.roles.find((role) => authorizedRoles.includes(role))) { - // user's roles do not allow - return res.forbidden({ body: `Sorry, you don't have access to Reporting` }); + if (!user.roles.find((role) => authorizedRoles.includes(role))) { + // user's roles do not allow + return res.forbidden({ body: `Sorry, you don't have access to Reporting` }); + } } - } - return handler(user, context, req, res); + return handler(user, context, req, res); + } catch (err) { + logger.error(err); + return res.custom({ statusCode: 500 }); + } }; }; }; diff --git a/x-pack/plugins/reporting/server/routes/lib/job_response_handler.ts b/x-pack/plugins/reporting/server/routes/lib/job_response_handler.ts index cbdb39f7a935e..8ffefa9c8a98c 100644 --- a/x-pack/plugins/reporting/server/routes/lib/job_response_handler.ts +++ b/x-pack/plugins/reporting/server/routes/lib/job_response_handler.ts @@ -32,37 +32,42 @@ export function downloadJobResponseHandlerFactory(reporting: ReportingCore) { params: JobResponseHandlerParams, opts: JobResponseHandlerOpts = {} ) { - const { docId } = params; - - const doc = await jobsQuery.get(user, docId, { includeContent: !opts.excludeContent }); - if (!doc) { - return res.notFound(); - } - - const { jobtype: jobType } = doc._source; - - if (!validJobTypes.includes(jobType)) { - return res.unauthorized({ - body: `Sorry, you are not authorized to download ${jobType} reports`, - }); - } - - const payload = getDocumentPayload(doc); - - if (!payload.contentType || !ALLOWED_JOB_CONTENT_TYPES.includes(payload.contentType)) { - return res.badRequest({ - body: `Unsupported content-type of ${payload.contentType} specified by job output`, + try { + const { docId } = params; + + const doc = await jobsQuery.get(user, docId, { includeContent: !opts.excludeContent }); + if (!doc) { + return res.notFound(); + } + + const { jobtype: jobType } = doc._source; + + if (!validJobTypes.includes(jobType)) { + return res.unauthorized({ + body: `Sorry, you are not authorized to download ${jobType} reports`, + }); + } + + const payload = getDocumentPayload(doc); + + if (!payload.contentType || !ALLOWED_JOB_CONTENT_TYPES.includes(payload.contentType)) { + return res.badRequest({ + body: `Unsupported content-type of ${payload.contentType} specified by job output`, + }); + } + + return res.custom({ + body: typeof payload.content === 'string' ? Buffer.from(payload.content) : payload.content, + statusCode: payload.statusCode, + headers: { + ...payload.headers, + 'content-type': payload.contentType || '', + }, }); + } catch (err) { + const { logger } = reporting.getPluginSetupDeps(); + logger.error(err); } - - return res.custom({ - body: typeof payload.content === 'string' ? Buffer.from(payload.content) : payload.content, - statusCode: payload.statusCode, - headers: { - ...payload.headers, - 'content-type': payload.contentType || '', - }, - }); }; } diff --git a/x-pack/plugins/reporting/server/test_helpers/create_mock_reportingplugin.ts b/x-pack/plugins/reporting/server/test_helpers/create_mock_reportingplugin.ts index 952f801ba519d..695f29dd8d632 100644 --- a/x-pack/plugins/reporting/server/test_helpers/create_mock_reportingplugin.ts +++ b/x-pack/plugins/reporting/server/test_helpers/create_mock_reportingplugin.ts @@ -42,6 +42,7 @@ export const createMockPluginSetup = (setupMock?: any): ReportingInternalSetup = security: setupMock.security, licensing: { license$: Rx.of({ isAvailable: true, isActive: true, type: 'basic' }) } as any, taskManager: { registerTaskDefinitions: jest.fn() } as any, + logger: createMockLevelLogger(), ...setupMock, }; }; @@ -69,6 +70,7 @@ export const createMockPluginStart = ( schedule: jest.fn().mockImplementation(() => ({ id: 'taskId' })), ensureScheduled: jest.fn(), } as any, + logger: createMockLevelLogger(), ...startMock, }; }; @@ -79,6 +81,7 @@ interface ReportingConfigTestType { queue: Partial; kibanaServer: Partial; csv: Partial; + roles?: Partial; capture: any; server?: any; } @@ -114,6 +117,10 @@ export const createMockConfigSchema = ( csv: { ...overrides.csv, }, + roles: { + enabled: false, + ...overrides.roles, + }, } as any; }; @@ -130,12 +137,12 @@ export const createMockConfig = ( }; export const createMockReportingCore = async ( - config: ReportingConfig, + config: ReportingConfigType, setupDepsMock: ReportingInternalSetup | undefined = undefined, startDepsMock: ReportingInternalStart | undefined = undefined ) => { const mockReportingCore = ({ - getConfig: () => config, + getConfig: () => createMockConfig(config), getEsClient: () => startDepsMock?.esClient, getDataService: () => startDepsMock?.data, } as unknown) as ReportingCore; @@ -148,8 +155,10 @@ export const createMockReportingCore = async ( } const context = coreMock.createPluginInitializerContext(createMockConfigSchema()); + context.config = { get: () => config } as any; + const core = new ReportingCore(logger, context); - core.setConfig(config); + core.setConfig(createMockConfig(config)); core.pluginSetup(setupDepsMock); await core.pluginSetsUp(); diff --git a/x-pack/plugins/reporting/server/types.ts b/x-pack/plugins/reporting/server/types.ts index 2a9cbaeaa6755..757d1a68075a8 100644 --- a/x-pack/plugins/reporting/server/types.ts +++ b/x-pack/plugins/reporting/server/types.ts @@ -39,8 +39,11 @@ export interface ReportingStartDeps { taskManager: TaskManagerStartContract; } -export type ReportingStart = object; -export type ReportingSetup = object; +export interface ReportingSetup { + usesUiCapabilities: () => boolean; +} + +export type ReportingStart = ReportingSetup; /* * Internal Types @@ -100,8 +103,9 @@ export interface ExportTypeDefinition< /** * @internal */ -export interface ReportingRequestHandlerContext extends RequestHandlerContext { +export interface ReportingRequestHandlerContext { reporting: ReportingStart | null; + core: RequestHandlerContext['core']; } /** diff --git a/x-pack/plugins/reporting/server/usage/reporting_usage_collector.test.ts b/x-pack/plugins/reporting/server/usage/reporting_usage_collector.test.ts index 05b80bc8acc75..226704b255ab3 100644 --- a/x-pack/plugins/reporting/server/usage/reporting_usage_collector.test.ts +++ b/x-pack/plugins/reporting/server/usage/reporting_usage_collector.test.ts @@ -9,9 +9,9 @@ import * as Rx from 'rxjs'; import sinon from 'sinon'; import { CollectorFetchContext, UsageCollectionSetup } from 'src/plugins/usage_collection/server'; import { createCollectorFetchContextMock } from 'src/plugins/usage_collection/server/mocks'; -import { ReportingConfig, ReportingCore } from '../'; +import { ReportingCore } from '../'; import { getExportTypesRegistry } from '../lib/export_types_registry'; -import { createMockConfig, createMockConfigSchema, createMockReportingCore } from '../test_helpers'; +import { createMockConfigSchema, createMockReportingCore } from '../test_helpers'; import { ReportingSetupDeps } from '../types'; import { FeaturesAvailability } from './'; import { @@ -64,11 +64,9 @@ const getMockFetchClients = (resp: any) => { return fetchParamsMock; }; describe('license checks', () => { - let mockConfig: ReportingConfig; let mockCore: ReportingCore; beforeAll(async () => { - mockConfig = createMockConfig(createMockConfigSchema()); - mockCore = await createMockReportingCore(mockConfig); + mockCore = await createMockReportingCore(createMockConfigSchema()); }); describe('with a basic license', () => { @@ -185,12 +183,10 @@ describe('license checks', () => { }); describe('data modeling', () => { - let mockConfig: ReportingConfig; let mockCore: ReportingCore; let collectorFetchContext: CollectorFetchContext; beforeAll(async () => { - mockConfig = createMockConfig(createMockConfigSchema()); - mockCore = await createMockReportingCore(mockConfig); + mockCore = await createMockReportingCore(createMockConfigSchema()); }); test('with normal looking usage data', async () => { const plugins = getPluginsMock(); @@ -456,8 +452,7 @@ describe('data modeling', () => { describe('Ready for collection observable', () => { test('converts observable to promise', async () => { - const mockConfig = createMockConfig(createMockConfigSchema()); - const mockReporting = await createMockReportingCore(mockConfig); + const mockReporting = await createMockReportingCore(createMockConfigSchema()); const usageCollection = getMockUsageCollection(); const makeCollectorSpy = sinon.spy(); diff --git a/x-pack/plugins/rule_registry/README.md b/x-pack/plugins/rule_registry/README.md index 17fe2b20f74fa..2c8f534a63d6b 100644 --- a/x-pack/plugins/rule_registry/README.md +++ b/x-pack/plugins/rule_registry/README.md @@ -1,3 +1,5 @@ +# Rule Registry + The rule registry plugin aims to make it easy for rule type producers to have their rules produce the data that they need to build rich experiences on top of a unified experience, without the risk of mapping conflicts. A rule registry creates a template, an ILM policy, and an alias. The template mappings can be configured. It also injects a client scoped to these indices. @@ -6,7 +8,17 @@ It also supports inheritance, which means that producers can create a registry s The rule registry plugin creates a root rule registry, with the mappings defined needed to create a unified experience. Rule type producers can use the plugin to access the root rule registry, and create their own registry that branches off of the root rule registry. The rule registry client sees data from its own registry, and all registries that branches off of it. It does not see data from its parents. -Creating a rule registry +## Enabling writing + +Set + +```yaml +xpack.ruleRegistry.unsafe.write.enabled: true +``` + +in your Kibana configuration to allow the Rule Registry to write events to the alert indices. + +## Creating a rule registry To create a rule registry, producers should add the `ruleRegistry` plugin to their dependencies. They can then use the `ruleRegistry.create` method to create a child registry, with the additional mappings that should be used by specifying `fieldMap`: @@ -16,7 +28,7 @@ const observabilityRegistry = plugins.ruleRegistry.create({ fieldMap: { ...pickWithPatterns(ecsFieldMap, 'host.name', 'service.name'), }, -}) +}); ``` `fieldMap` is a key-value map of field names and mapping options: @@ -37,13 +49,13 @@ To pick many fields, you can use `pickWithPatterns`, which supports wildcards wi If a registry is created, it will initialise as soon as the core services needed become available. It will create a (versioned) template, alias, and ILM policy, but only if these do not exist yet. -### Rule registry client +## Rule registry client The rule registry client can either be injected in the executor, or created in the scope of a request. It exposes a `search` method and a `bulkIndex` method. When `search` is called, it first gets all the rules the current user has access to, and adds these ids to the search request that it executes. This means that the user can only see data from rules they have access to. Both `search` and `bulkIndex` are fully typed, in the sense that they reflect the mappings defined for the registry. -### Schema +## Schema The following fields are available in the root rule registry: @@ -60,8 +72,8 @@ The following fields are available in the root rule registry: - `kibana.rac.alert.uuid`: the unique identifier for the alert during its lifespan. If an alert recovers (or closes), this identifier is re-generated when it is opened again. - `kibana.rac.alert.status`: the status of the alert. Can be `open` or `closed`. - `kibana.rac.alert.start`: the ISO timestamp of the time at which the alert started. -- `kibana.rac.alert.end`: the ISO timestamp of the time at which the alert recovered. -- `kibana.rac.alert.duration.us`: the duration of the alert, in microseconds. This is always the difference between either the current time, or the time when the alert recovered. +- `kibana.rac.alert.end`: the ISO timestamp of the time at which the alert recovered. +- `kibana.rac.alert.duration.us`: the duration of the alert, in microseconds. This is always the difference between either the current time, or the time when the alert recovered. - `kibana.rac.alert.severity.level`: the severity of the alert, as a keyword (e.g. critical). - `kibana.rac.alert.severity.value`: the severity of the alert, as a numerical value, which allows sorting. diff --git a/x-pack/plugins/rule_registry/server/index.ts b/x-pack/plugins/rule_registry/server/index.ts index 3d492bb690b05..9fd1408fcdb21 100644 --- a/x-pack/plugins/rule_registry/server/index.ts +++ b/x-pack/plugins/rule_registry/server/index.ts @@ -17,7 +17,9 @@ export { ScopedRuleRegistryClient } from './rule_registry/create_scoped_rule_reg export const config = { schema: schema.object({ enabled: schema.boolean({ defaultValue: true }), - writeEnabled: schema.boolean({ defaultValue: false }), + unsafe: schema.object({ + write: schema.object({ enabled: schema.boolean({ defaultValue: false }) }), + }), }), }; diff --git a/x-pack/plugins/rule_registry/server/plugin.ts b/x-pack/plugins/rule_registry/server/plugin.ts index dabedc2849d07..09df47c40a394 100644 --- a/x-pack/plugins/rule_registry/server/plugin.ts +++ b/x-pack/plugins/rule_registry/server/plugin.ts @@ -37,7 +37,7 @@ export class RuleRegistryPlugin implements Plugin { expect( savedObjectEvent({ action: SavedObjectAction.CREATE, - outcome: EventOutcome.UNKNOWN, + outcome: 'unknown', savedObject: { type: 'dashboard', id: 'SAVED_OBJECT_ID' }, }) ).toMatchInlineSnapshot(` @@ -34,9 +33,13 @@ describe('#savedObjectEvent', () => { "error": undefined, "event": Object { "action": "saved_object_create", - "category": "database", + "category": Array [ + "database", + ], "outcome": "unknown", - "type": "creation", + "type": Array [ + "creation", + ], }, "kibana": Object { "add_to_spaces": undefined, @@ -62,9 +65,13 @@ describe('#savedObjectEvent', () => { "error": undefined, "event": Object { "action": "saved_object_create", - "category": "database", + "category": Array [ + "database", + ], "outcome": "success", - "type": "creation", + "type": Array [ + "creation", + ], }, "kibana": Object { "add_to_spaces": undefined, @@ -94,9 +101,13 @@ describe('#savedObjectEvent', () => { }, "event": Object { "action": "saved_object_create", - "category": "database", + "category": Array [ + "database", + ], "outcome": "failure", - "type": "creation", + "type": Array [ + "creation", + ], }, "kibana": Object { "add_to_spaces": undefined, @@ -197,9 +208,13 @@ describe('#savedObjectEvent', () => { "error": undefined, "event": Object { "action": "saved_object_remove_references", - "category": "database", + "category": Array [ + "database", + ], "outcome": "success", - "type": "change", + "type": Array [ + "change", + ], }, "kibana": Object { "add_to_spaces": undefined, @@ -228,7 +243,9 @@ describe('#userLoginEvent', () => { "error": undefined, "event": Object { "action": "user_login", - "category": "authentication", + "category": Array [ + "authentication", + ], "outcome": "success", }, "kibana": Object { @@ -264,7 +281,9 @@ describe('#userLoginEvent', () => { }, "event": Object { "action": "user_login", - "category": "authentication", + "category": Array [ + "authentication", + ], "outcome": "failure", }, "kibana": Object { @@ -291,7 +310,9 @@ describe('#httpRequestEvent', () => { Object { "event": Object { "action": "http_request", - "category": "web", + "category": Array [ + "web", + ], "outcome": "unknown", }, "http": Object { @@ -328,7 +349,9 @@ describe('#httpRequestEvent', () => { Object { "event": Object { "action": "http_request", - "category": "web", + "category": Array [ + "web", + ], "outcome": "unknown", }, "http": Object { @@ -354,7 +377,7 @@ describe('#spaceAuditEvent', () => { expect( spaceAuditEvent({ action: SpaceAuditAction.CREATE, - outcome: EventOutcome.UNKNOWN, + outcome: 'unknown', savedObject: { type: 'space', id: 'SPACE_ID' }, }) ).toMatchInlineSnapshot(` @@ -362,9 +385,13 @@ describe('#spaceAuditEvent', () => { "error": undefined, "event": Object { "action": "space_create", - "category": "database", + "category": Array [ + "database", + ], "outcome": "unknown", - "type": "creation", + "type": Array [ + "creation", + ], }, "kibana": Object { "saved_object": Object { @@ -388,9 +415,13 @@ describe('#spaceAuditEvent', () => { "error": undefined, "event": Object { "action": "space_create", - "category": "database", + "category": Array [ + "database", + ], "outcome": "success", - "type": "creation", + "type": Array [ + "creation", + ], }, "kibana": Object { "saved_object": Object { @@ -418,9 +449,13 @@ describe('#spaceAuditEvent', () => { }, "event": Object { "action": "space_create", - "category": "database", + "category": Array [ + "database", + ], "outcome": "failure", - "type": "creation", + "type": Array [ + "creation", + ], }, "kibana": Object { "saved_object": Object { diff --git a/x-pack/plugins/security/server/audit/audit_events.ts b/x-pack/plugins/security/server/audit/audit_events.ts index 00f77ff2bc5fd..70d8149682370 100644 --- a/x-pack/plugins/security/server/audit/audit_events.ts +++ b/x-pack/plugins/security/server/audit/audit_events.ts @@ -5,36 +5,20 @@ * 2.0. */ -import type { KibanaRequest } from 'src/core/server'; +import type { EcsEventOutcome, EcsEventType, KibanaRequest, LogMeta } from 'src/core/server'; import type { AuthenticationResult } from '../authentication/authentication_result'; /** - * Audit event schema using ECS format: https://www.elastic.co/guide/en/ecs/1.6/index.html + * Audit event schema using ECS format: https://www.elastic.co/guide/en/ecs/1.9/index.html * * If you add additional fields to the schema ensure you update the Kibana Filebeat module: * https://github.com/elastic/beats/tree/master/filebeat/module/kibana * * @public */ -export interface AuditEvent { - /** - * Human readable message describing action, outcome and user. - * - * @example - * Failed attempt to login using basic provider [name=basic1] - */ +export interface AuditEvent extends LogMeta { message: string; - event: { - action: string; - category?: EventCategory; - type?: EventType; - outcome?: EventOutcome; - }; - user?: { - name: string; - roles?: readonly string[]; - }; kibana?: { /** * The ID of the space associated with this event. @@ -77,41 +61,6 @@ export interface AuditEvent { */ delete_from_spaces?: readonly string[]; }; - error?: { - code?: string; - message?: string; - }; - http?: { - request?: { - method?: string; - }; - }; - url?: { - domain?: string; - path?: string; - port?: number; - query?: string; - scheme?: string; - }; -} - -export enum EventCategory { - DATABASE = 'database', - WEB = 'web', - AUTHENTICATION = 'authentication', -} - -export enum EventType { - CREATION = 'creation', - ACCESS = 'access', - CHANGE = 'change', - DELETION = 'deletion', -} - -export enum EventOutcome { - SUCCESS = 'success', - FAILURE = 'failure', - UNKNOWN = 'unknown', } export interface HttpRequestParams { @@ -125,8 +74,8 @@ export function httpRequestEvent({ request }: HttpRequestParams): AuditEvent { message: `User is requesting [${url.pathname}] endpoint`, event: { action: 'http_request', - category: EventCategory.WEB, - outcome: EventOutcome.UNKNOWN, + category: ['web'], + outcome: 'unknown', }, http: { request: { @@ -160,12 +109,12 @@ export function userLoginEvent({ : `Failed attempt to login using ${authenticationType} provider [name=${authenticationProvider}]`, event: { action: 'user_login', - category: EventCategory.AUTHENTICATION, - outcome: authenticationResult.user ? EventOutcome.SUCCESS : EventOutcome.FAILURE, + category: ['authentication'], + outcome: authenticationResult.user ? 'success' : 'failure', }, user: authenticationResult.user && { name: authenticationResult.user.username, - roles: authenticationResult.user.roles, + roles: authenticationResult.user.roles as string[], }, kibana: { space_id: undefined, // Ensure this does not get populated by audit service @@ -223,23 +172,23 @@ const savedObjectAuditVerbs: Record = { ], }; -const savedObjectAuditTypes: Record = { - saved_object_create: EventType.CREATION, - saved_object_get: EventType.ACCESS, - saved_object_resolve: EventType.ACCESS, - saved_object_update: EventType.CHANGE, - saved_object_delete: EventType.DELETION, - saved_object_find: EventType.ACCESS, - saved_object_add_to_spaces: EventType.CHANGE, - saved_object_delete_from_spaces: EventType.CHANGE, - saved_object_open_point_in_time: EventType.CREATION, - saved_object_close_point_in_time: EventType.DELETION, - saved_object_remove_references: EventType.CHANGE, +const savedObjectAuditTypes: Record = { + saved_object_create: 'creation', + saved_object_get: 'access', + saved_object_resolve: 'access', + saved_object_update: 'change', + saved_object_delete: 'deletion', + saved_object_find: 'access', + saved_object_add_to_spaces: 'change', + saved_object_delete_from_spaces: 'change', + saved_object_open_point_in_time: 'creation', + saved_object_close_point_in_time: 'deletion', + saved_object_remove_references: 'change', }; export interface SavedObjectEventParams { action: SavedObjectAction; - outcome?: EventOutcome; + outcome?: EcsEventOutcome; savedObject?: NonNullable['saved_object']; addToSpaces?: readonly string[]; deleteFromSpaces?: readonly string[]; @@ -258,13 +207,13 @@ export function savedObjectEvent({ const [present, progressive, past] = savedObjectAuditVerbs[action]; const message = error ? `Failed attempt to ${present} ${doc}` - : outcome === EventOutcome.UNKNOWN + : outcome === 'unknown' ? `User is ${progressive} ${doc}` : `User has ${past} ${doc}`; const type = savedObjectAuditTypes[action]; if ( - type === EventType.ACCESS && + type === 'access' && savedObject && (savedObject.type === 'config' || savedObject.type === 'telemetry') ) { @@ -275,9 +224,9 @@ export function savedObjectEvent({ message, event: { action, - category: EventCategory.DATABASE, - type, - outcome: outcome ?? (error ? EventOutcome.FAILURE : EventOutcome.SUCCESS), + category: ['database'], + type: [type], + outcome: outcome ?? (error ? 'failure' : 'success'), }, kibana: { saved_object: savedObject, @@ -307,17 +256,17 @@ const spaceAuditVerbs: Record = { space_find: ['access', 'accessing', 'accessed'], }; -const spaceAuditTypes: Record = { - space_create: EventType.CREATION, - space_get: EventType.ACCESS, - space_update: EventType.CHANGE, - space_delete: EventType.DELETION, - space_find: EventType.ACCESS, +const spaceAuditTypes: Record = { + space_create: 'creation', + space_get: 'access', + space_update: 'change', + space_delete: 'deletion', + space_find: 'access', }; export interface SpacesAuditEventParams { action: SpaceAuditAction; - outcome?: EventOutcome; + outcome?: EcsEventOutcome; savedObject?: NonNullable['saved_object']; error?: Error; } @@ -332,7 +281,7 @@ export function spaceAuditEvent({ const [present, progressive, past] = spaceAuditVerbs[action]; const message = error ? `Failed attempt to ${present} ${doc}` - : outcome === EventOutcome.UNKNOWN + : outcome === 'unknown' ? `User is ${progressive} ${doc}` : `User has ${past} ${doc}`; const type = spaceAuditTypes[action]; @@ -341,9 +290,9 @@ export function spaceAuditEvent({ message, event: { action, - category: EventCategory.DATABASE, - type, - outcome: outcome ?? (error ? EventOutcome.FAILURE : EventOutcome.SUCCESS), + category: ['database'], + type: [type], + outcome: outcome ?? (error ? 'failure' : 'success'), }, kibana: { saved_object: savedObject, diff --git a/x-pack/plugins/security/server/audit/audit_service.test.ts b/x-pack/plugins/security/server/audit/audit_service.test.ts index ffacaff7237c5..7c7bc4f031793 100644 --- a/x-pack/plugins/security/server/audit/audit_service.test.ts +++ b/x-pack/plugins/security/server/audit/audit_service.test.ts @@ -19,7 +19,6 @@ import { licenseMock } from '../../common/licensing/index.mock'; import type { ConfigType } from '../config'; import { ConfigSchema } from '../config'; import type { AuditEvent } from './audit_events'; -import { EventCategory, EventOutcome, EventType } from './audit_events'; import { AuditService, createLoggingConfig, @@ -185,10 +184,8 @@ describe('#asScoped', () => { await auditSetup.asScoped(request).log({ message: 'MESSAGE', event: { action: 'ACTION' } }); expect(logger.info).toHaveBeenCalledWith('MESSAGE', { - ecs: { version: '1.6.0' }, event: { action: 'ACTION' }, kibana: { space_id: 'default', session_id: 'SESSION_ID' }, - message: 'MESSAGE', trace: { id: 'REQUEST_ID' }, user: { name: 'jdoe', roles: ['admin'] }, }); @@ -349,21 +346,25 @@ describe('#createLoggingConfig', () => { }); describe('#filterEvent', () => { - const event: AuditEvent = { - message: 'this is my audit message', - event: { - action: 'http_request', - category: EventCategory.WEB, - type: EventType.ACCESS, - outcome: EventOutcome.SUCCESS, - }, - user: { - name: 'jdoe', - }, - kibana: { - space_id: 'default', - }, - }; + let event: AuditEvent; + + beforeEach(() => { + event = { + message: 'this is my audit message', + event: { + action: 'http_request', + category: ['web'], + type: ['access'], + outcome: 'success', + }, + user: { + name: 'jdoe', + }, + kibana: { + space_id: 'default', + }, + }; + }); test('keeps event when ignore filters are undefined or empty', () => { expect(filterEvent(event, undefined)).toBeTruthy(); @@ -421,6 +422,66 @@ describe('#filterEvent', () => { ).toBeTruthy(); }); + test('keeps event when one item per category does not match', () => { + event = { + message: 'this is my audit message', + event: { + action: 'http_request', + category: ['authentication', 'web'], + type: ['access'], + outcome: 'success', + }, + user: { + name: 'jdoe', + }, + kibana: { + space_id: 'default', + }, + }; + + expect( + filterEvent(event, [ + { + actions: ['http_request'], + categories: ['web', 'NO_MATCH'], + types: ['access'], + outcomes: ['success'], + spaces: ['default'], + }, + ]) + ).toBeTruthy(); + }); + + test('keeps event when one item per type does not match', () => { + event = { + message: 'this is my audit message', + event: { + action: 'http_request', + category: ['web'], + type: ['access', 'user'], + outcome: 'success', + }, + user: { + name: 'jdoe', + }, + kibana: { + space_id: 'default', + }, + }; + + expect( + filterEvent(event, [ + { + actions: ['http_request'], + categories: ['web'], + types: ['access', 'NO_MATCH'], + outcomes: ['success'], + spaces: ['default'], + }, + ]) + ).toBeTruthy(); + }); + test('filters out event when all criteria in a single rule match', () => { expect( filterEvent(event, [ @@ -441,6 +502,66 @@ describe('#filterEvent', () => { ]) ).toBeFalsy(); }); + + test('filters out event when all categories match', () => { + event = { + message: 'this is my audit message', + event: { + action: 'http_request', + category: ['authentication', 'web'], + type: ['access'], + outcome: 'success', + }, + user: { + name: 'jdoe', + }, + kibana: { + space_id: 'default', + }, + }; + + expect( + filterEvent(event, [ + { + actions: ['http_request'], + categories: ['authentication', 'web'], + types: ['access'], + outcomes: ['success'], + spaces: ['default'], + }, + ]) + ).toBeFalsy(); + }); + + test('filters out event when all types match', () => { + event = { + message: 'this is my audit message', + event: { + action: 'http_request', + category: ['web'], + type: ['access', 'user'], + outcome: 'success', + }, + user: { + name: 'jdoe', + }, + kibana: { + space_id: 'default', + }, + }; + + expect( + filterEvent(event, [ + { + actions: ['http_request'], + categories: ['web'], + types: ['access', 'user'], + outcomes: ['success'], + spaces: ['default'], + }, + ]) + ).toBeFalsy(); + }); }); describe('#getLogger', () => { diff --git a/x-pack/plugins/security/server/audit/audit_service.ts b/x-pack/plugins/security/server/audit/audit_service.ts index 7511e079b9adb..a6205ff196537 100644 --- a/x-pack/plugins/security/server/audit/audit_service.ts +++ b/x-pack/plugins/security/server/audit/audit_service.ts @@ -37,15 +37,6 @@ export interface AuditLogger { log: (event: AuditEvent | undefined) => void; } -interface AuditLogMeta extends AuditEvent { - ecs: { - version: string; - }; - trace: { - id: string; - }; -} - export interface AuditServiceSetup { asScoped: (request: KibanaRequest) => AuditLogger; getLogger: (id?: string) => LegacyAuditLogger; @@ -146,7 +137,7 @@ export class AuditService { * message: 'User is updating dashboard [id=123]', * event: { * action: 'saved_object_update', - * outcome: EventOutcome.UNKNOWN + * outcome: 'unknown' * }, * kibana: { * saved_object: { type: 'dashboard', id: '123' } @@ -161,13 +152,12 @@ export class AuditService { const spaceId = getSpaceId(request); const user = getCurrentUser(request); const sessionId = await getSID(request); - const meta: AuditLogMeta = { - ecs: { version: ECS_VERSION }, + const meta: AuditEvent = { ...event, user: (user && { name: user.username, - roles: user.roles, + roles: user.roles as string[], }) || event.user, kibana: { @@ -178,7 +168,8 @@ export class AuditService { trace: { id: request.id }, }; if (filterEvent(meta, config.ignore_filters)) { - this.ecsLogger.info(event.message!, meta); + const { message, ...eventMeta } = meta; + this.ecsLogger.info(message, eventMeta); } }; return { log }; @@ -243,6 +234,13 @@ export const createLoggingConfig = (config: ConfigType['audit']) => ], })); +/** + * Evaluates the list of provided ignore rules, and filters out events only + * if *all* rules match the event. + * + * For event fields that can contain an array of multiple values, every value + * must be matched by an ignore rule for the event to be excluded. + */ export function filterEvent( event: AuditEvent, ignoreFilters: ConfigType['audit']['ignore_filters'] @@ -250,10 +248,10 @@ export function filterEvent( if (ignoreFilters) { return !ignoreFilters.some( (rule) => - (!rule.actions || rule.actions.includes(event.event.action)) && - (!rule.categories || rule.categories.includes(event.event.category!)) && - (!rule.types || rule.types.includes(event.event.type!)) && - (!rule.outcomes || rule.outcomes.includes(event.event.outcome!)) && + (!rule.actions || rule.actions.includes(event.event?.action!)) && + (!rule.categories || event.event?.category?.every((c) => rule.categories?.includes(c))) && + (!rule.types || event.event?.type?.every((t) => rule.types?.includes(t))) && + (!rule.outcomes || rule.outcomes.includes(event.event?.outcome!)) && (!rule.spaces || rule.spaces.includes(event.kibana?.space_id!)) ); } diff --git a/x-pack/plugins/security/server/audit/index.ts b/x-pack/plugins/security/server/audit/index.ts index ebf1e9bed5df6..c42022bc76aa9 100644 --- a/x-pack/plugins/security/server/audit/index.ts +++ b/x-pack/plugins/security/server/audit/index.ts @@ -8,9 +8,6 @@ export { AuditService, AuditServiceSetup, AuditLogger, LegacyAuditLogger } from './audit_service'; export { AuditEvent, - EventCategory, - EventType, - EventOutcome, userLoginEvent, httpRequestEvent, savedObjectEvent, diff --git a/x-pack/plugins/security/server/authentication/authenticator.test.ts b/x-pack/plugins/security/server/authentication/authenticator.test.ts index be53caffc066d..1bd430d0c5c98 100644 --- a/x-pack/plugins/security/server/authentication/authenticator.test.ts +++ b/x-pack/plugins/security/server/authentication/authenticator.test.ts @@ -337,7 +337,7 @@ describe('Authenticator', () => { expect(auditLogger.log).toHaveBeenCalledTimes(1); expect(auditLogger.log).toHaveBeenCalledWith( expect.objectContaining({ - event: { action: 'user_login', category: 'authentication', outcome: 'success' }, + event: { action: 'user_login', category: ['authentication'], outcome: 'success' }, }) ); }); @@ -353,7 +353,7 @@ describe('Authenticator', () => { expect(auditLogger.log).toHaveBeenCalledTimes(1); expect(auditLogger.log).toHaveBeenCalledWith( expect.objectContaining({ - event: { action: 'user_login', category: 'authentication', outcome: 'failure' }, + event: { action: 'user_login', category: ['authentication'], outcome: 'failure' }, }) ); }); diff --git a/x-pack/plugins/security/server/index.ts b/x-pack/plugins/security/server/index.ts index 6412562af8a41..b66ed6e9eb7ca 100644 --- a/x-pack/plugins/security/server/index.ts +++ b/x-pack/plugins/security/server/index.ts @@ -27,14 +27,7 @@ export type { GrantAPIKeyResult, } from './authentication'; export type { CheckPrivilegesPayload } from './authorization'; -export { - LegacyAuditLogger, - AuditLogger, - AuditEvent, - EventCategory, - EventType, - EventOutcome, -} from './audit'; +export { LegacyAuditLogger, AuditLogger, AuditEvent } from './audit'; export type { SecurityPluginSetup, SecurityPluginStart }; export type { AuthenticatedUser } from '../common/model'; diff --git a/x-pack/plugins/security/server/saved_objects/secure_saved_objects_client_wrapper.test.ts b/x-pack/plugins/security/server/saved_objects/secure_saved_objects_client_wrapper.test.ts index 554244dc98be9..2658f4edec5ac 100644 --- a/x-pack/plugins/security/server/saved_objects/secure_saved_objects_client_wrapper.test.ts +++ b/x-pack/plugins/security/server/saved_objects/secure_saved_objects_client_wrapper.test.ts @@ -5,11 +5,10 @@ * 2.0. */ -import type { SavedObjectsClientContract } from 'src/core/server'; +import type { EcsEventOutcome, SavedObjectsClientContract } from 'src/core/server'; import { httpServerMock, savedObjectsClientMock } from 'src/core/server/mocks'; import type { AuditEvent } from '../audit'; -import { EventOutcome } from '../audit'; import { auditServiceMock, securityAuditLoggerMock } from '../audit/index.mock'; import { Actions } from '../authorization'; import type { SavedObjectActions } from '../authorization/actions/saved_object'; @@ -199,8 +198,8 @@ const expectObjectNamespaceFiltering = async ( }; const expectAuditEvent = ( - action: AuditEvent['event']['action'], - outcome: AuditEvent['event']['outcome'], + action: string, + outcome: EcsEventOutcome, savedObject?: Required['kibana']['saved_object'] ) => { expect(clientOpts.auditLogger.log).toHaveBeenCalledWith( @@ -445,14 +444,14 @@ describe('#addToNamespaces', () => { await client.addToNamespaces(type, id, namespaces); expect(clientOpts.auditLogger.log).toHaveBeenCalledTimes(1); - expectAuditEvent('saved_object_add_to_spaces', EventOutcome.UNKNOWN, { type, id }); + expectAuditEvent('saved_object_add_to_spaces', 'unknown', { type, id }); }); test(`adds audit event when not successful`, async () => { clientOpts.checkSavedObjectsPrivilegesAsCurrentUser.mockRejectedValue(new Error()); await expect(() => client.addToNamespaces(type, id, namespaces)).rejects.toThrow(); expect(clientOpts.auditLogger.log).toHaveBeenCalledTimes(1); - expectAuditEvent('saved_object_add_to_spaces', EventOutcome.FAILURE, { type, id }); + expectAuditEvent('saved_object_add_to_spaces', 'failure', { type, id }); }); }); @@ -515,16 +514,16 @@ describe('#bulkCreate', () => { const options = { namespace }; await expectSuccess(client.bulkCreate, { objects, options }); expect(clientOpts.auditLogger.log).toHaveBeenCalledTimes(2); - expectAuditEvent('saved_object_create', EventOutcome.UNKNOWN, { type: obj1.type, id: obj1.id }); - expectAuditEvent('saved_object_create', EventOutcome.UNKNOWN, { type: obj2.type, id: obj2.id }); + expectAuditEvent('saved_object_create', 'unknown', { type: obj1.type, id: obj1.id }); + expectAuditEvent('saved_object_create', 'unknown', { type: obj2.type, id: obj2.id }); }); test(`adds audit event when not successful`, async () => { clientOpts.checkSavedObjectsPrivilegesAsCurrentUser.mockRejectedValue(new Error()); await expect(() => client.bulkCreate([obj1, obj2], { namespace })).rejects.toThrow(); expect(clientOpts.auditLogger.log).toHaveBeenCalledTimes(2); - expectAuditEvent('saved_object_create', EventOutcome.FAILURE, { type: obj1.type, id: obj1.id }); - expectAuditEvent('saved_object_create', EventOutcome.FAILURE, { type: obj2.type, id: obj2.id }); + expectAuditEvent('saved_object_create', 'failure', { type: obj1.type, id: obj1.id }); + expectAuditEvent('saved_object_create', 'failure', { type: obj2.type, id: obj2.id }); }); }); @@ -573,16 +572,16 @@ describe('#bulkGet', () => { const options = { namespace }; await expectSuccess(client.bulkGet, { objects, options }); expect(clientOpts.auditLogger.log).toHaveBeenCalledTimes(2); - expectAuditEvent('saved_object_get', EventOutcome.SUCCESS, obj1); - expectAuditEvent('saved_object_get', EventOutcome.SUCCESS, obj2); + expectAuditEvent('saved_object_get', 'success', obj1); + expectAuditEvent('saved_object_get', 'success', obj2); }); test(`adds audit event when not successful`, async () => { clientOpts.checkSavedObjectsPrivilegesAsCurrentUser.mockRejectedValue(new Error()); await expect(() => client.bulkGet([obj1, obj2], { namespace })).rejects.toThrow(); expect(clientOpts.auditLogger.log).toHaveBeenCalledTimes(2); - expectAuditEvent('saved_object_get', EventOutcome.FAILURE, obj1); - expectAuditEvent('saved_object_get', EventOutcome.FAILURE, obj2); + expectAuditEvent('saved_object_get', 'failure', obj1); + expectAuditEvent('saved_object_get', 'failure', obj2); }); }); @@ -642,16 +641,16 @@ describe('#bulkUpdate', () => { const options = { namespace }; await expectSuccess(client.bulkUpdate, { objects, options }); expect(clientOpts.auditLogger.log).toHaveBeenCalledTimes(2); - expectAuditEvent('saved_object_update', EventOutcome.UNKNOWN, { type: obj1.type, id: obj1.id }); - expectAuditEvent('saved_object_update', EventOutcome.UNKNOWN, { type: obj2.type, id: obj2.id }); + expectAuditEvent('saved_object_update', 'unknown', { type: obj1.type, id: obj1.id }); + expectAuditEvent('saved_object_update', 'unknown', { type: obj2.type, id: obj2.id }); }); test(`adds audit event when not successful`, async () => { clientOpts.checkSavedObjectsPrivilegesAsCurrentUser.mockRejectedValue(new Error()); await expect(() => client.bulkUpdate([obj1, obj2], { namespace })).rejects.toThrow(); expect(clientOpts.auditLogger.log).toHaveBeenCalledTimes(2); - expectAuditEvent('saved_object_update', EventOutcome.FAILURE, { type: obj1.type, id: obj1.id }); - expectAuditEvent('saved_object_update', EventOutcome.FAILURE, { type: obj2.type, id: obj2.id }); + expectAuditEvent('saved_object_update', 'failure', { type: obj1.type, id: obj1.id }); + expectAuditEvent('saved_object_update', 'failure', { type: obj2.type, id: obj2.id }); }); }); @@ -744,14 +743,14 @@ describe('#create', () => { const options = { id: 'mock-saved-object-id', namespace }; await expectSuccess(client.create, { type, attributes, options }); expect(clientOpts.auditLogger.log).toHaveBeenCalledTimes(1); - expectAuditEvent('saved_object_create', EventOutcome.UNKNOWN, { type, id: expect.any(String) }); + expectAuditEvent('saved_object_create', 'unknown', { type, id: expect.any(String) }); }); test(`adds audit event when not successful`, async () => { clientOpts.checkSavedObjectsPrivilegesAsCurrentUser.mockRejectedValue(new Error()); await expect(() => client.create(type, attributes, { namespace })).rejects.toThrow(); expect(clientOpts.auditLogger.log).toHaveBeenCalledTimes(1); - expectAuditEvent('saved_object_create', EventOutcome.FAILURE, { type, id: expect.any(String) }); + expectAuditEvent('saved_object_create', 'failure', { type, id: expect.any(String) }); }); }); @@ -789,14 +788,14 @@ describe('#delete', () => { const options = { namespace }; await expectSuccess(client.delete, { type, id, options }); expect(clientOpts.auditLogger.log).toHaveBeenCalledTimes(1); - expectAuditEvent('saved_object_delete', EventOutcome.UNKNOWN, { type, id }); + expectAuditEvent('saved_object_delete', 'unknown', { type, id }); }); test(`adds audit event when not successful`, async () => { clientOpts.checkSavedObjectsPrivilegesAsCurrentUser.mockRejectedValue(new Error()); await expect(() => client.delete(type, id)).rejects.toThrow(); expect(clientOpts.auditLogger.log).toHaveBeenCalledTimes(1); - expectAuditEvent('saved_object_delete', EventOutcome.FAILURE, { type, id }); + expectAuditEvent('saved_object_delete', 'failure', { type, id }); }); }); @@ -936,8 +935,8 @@ describe('#find', () => { const options = Object.freeze({ type: type1, namespaces: ['some-ns'] }); await expectSuccess(client.find, { options }); expect(clientOpts.auditLogger.log).toHaveBeenCalledTimes(2); - expectAuditEvent('saved_object_find', EventOutcome.SUCCESS, obj1); - expectAuditEvent('saved_object_find', EventOutcome.SUCCESS, obj2); + expectAuditEvent('saved_object_find', 'success', obj1); + expectAuditEvent('saved_object_find', 'success', obj2); }); test(`adds audit event when not successful`, async () => { @@ -946,7 +945,7 @@ describe('#find', () => { ); await client.find({ type: type1 }); expect(clientOpts.auditLogger.log).toHaveBeenCalledTimes(1); - expectAuditEvent('saved_object_find', EventOutcome.FAILURE); + expectAuditEvent('saved_object_find', 'failure'); }); }); @@ -989,14 +988,14 @@ describe('#get', () => { const options = { namespace }; await expectSuccess(client.get, { type, id, options }); expect(clientOpts.auditLogger.log).toHaveBeenCalledTimes(1); - expectAuditEvent('saved_object_get', EventOutcome.SUCCESS, { type, id }); + expectAuditEvent('saved_object_get', 'success', { type, id }); }); test(`adds audit event when not successful`, async () => { clientOpts.checkSavedObjectsPrivilegesAsCurrentUser.mockRejectedValue(new Error()); await expect(() => client.get(type, id, { namespace })).rejects.toThrow(); expect(clientOpts.auditLogger.log).toHaveBeenCalledTimes(1); - expectAuditEvent('saved_object_get', EventOutcome.FAILURE, { type, id }); + expectAuditEvent('saved_object_get', 'failure', { type, id }); }); }); @@ -1023,14 +1022,14 @@ describe('#openPointInTimeForType', () => { const options = { namespace }; await expectSuccess(client.openPointInTimeForType, { type, options }); expect(clientOpts.auditLogger.log).toHaveBeenCalledTimes(1); - expectAuditEvent('saved_object_open_point_in_time', EventOutcome.UNKNOWN); + expectAuditEvent('saved_object_open_point_in_time', 'unknown'); }); test(`adds audit event when not successful`, async () => { clientOpts.checkSavedObjectsPrivilegesAsCurrentUser.mockRejectedValue(new Error()); await expect(() => client.openPointInTimeForType(type, { namespace })).rejects.toThrow(); expect(clientOpts.auditLogger.log).toHaveBeenCalledTimes(1); - expectAuditEvent('saved_object_open_point_in_time', EventOutcome.FAILURE); + expectAuditEvent('saved_object_open_point_in_time', 'failure'); }); }); @@ -1054,7 +1053,7 @@ describe('#closePointInTime', () => { const options = { namespace }; await client.closePointInTime(id, options); expect(clientOpts.auditLogger.log).toHaveBeenCalledTimes(1); - expectAuditEvent('saved_object_close_point_in_time', EventOutcome.UNKNOWN); + expectAuditEvent('saved_object_close_point_in_time', 'unknown'); }); }); @@ -1153,14 +1152,14 @@ describe('#resolve', () => { const options = { namespace }; await expectSuccess(client.resolve, { type, id, options }, 'resolve'); expect(clientOpts.auditLogger.log).toHaveBeenCalledTimes(1); - expectAuditEvent('saved_object_resolve', EventOutcome.SUCCESS, { type, id: resolvedId }); + expectAuditEvent('saved_object_resolve', 'success', { type, id: resolvedId }); }); test(`adds audit event when not successful`, async () => { clientOpts.checkSavedObjectsPrivilegesAsCurrentUser.mockRejectedValue(new Error()); await expect(() => client.resolve(type, id, { namespace })).rejects.toThrow(); expect(clientOpts.auditLogger.log).toHaveBeenCalledTimes(1); - expectAuditEvent('saved_object_resolve', EventOutcome.FAILURE, { type, id }); + expectAuditEvent('saved_object_resolve', 'failure', { type, id }); }); }); @@ -1239,14 +1238,14 @@ describe('#deleteFromNamespaces', () => { clientOpts.baseClient.deleteFromNamespaces.mockReturnValue(apiCallReturnValue as any); await client.deleteFromNamespaces(type, id, namespaces); expect(clientOpts.auditLogger.log).toHaveBeenCalledTimes(1); - expectAuditEvent('saved_object_delete_from_spaces', EventOutcome.UNKNOWN, { type, id }); + expectAuditEvent('saved_object_delete_from_spaces', 'unknown', { type, id }); }); test(`adds audit event when not successful`, async () => { clientOpts.checkSavedObjectsPrivilegesAsCurrentUser.mockRejectedValue(new Error()); await expect(() => client.deleteFromNamespaces(type, id, namespaces)).rejects.toThrow(); expect(clientOpts.auditLogger.log).toHaveBeenCalledTimes(1); - expectAuditEvent('saved_object_delete_from_spaces', EventOutcome.FAILURE, { type, id }); + expectAuditEvent('saved_object_delete_from_spaces', 'failure', { type, id }); }); }); @@ -1290,14 +1289,14 @@ describe('#update', () => { const options = { namespace }; await expectSuccess(client.update, { type, id, attributes, options }); expect(clientOpts.auditLogger.log).toHaveBeenCalledTimes(1); - expectAuditEvent('saved_object_update', EventOutcome.UNKNOWN, { type, id }); + expectAuditEvent('saved_object_update', 'unknown', { type, id }); }); test(`adds audit event when not successful`, async () => { clientOpts.checkSavedObjectsPrivilegesAsCurrentUser.mockRejectedValue(new Error()); await expect(() => client.update(type, id, attributes, { namespace })).rejects.toThrow(); expect(clientOpts.auditLogger.log).toHaveBeenCalledTimes(1); - expectAuditEvent('saved_object_update', EventOutcome.FAILURE, { type, id }); + expectAuditEvent('saved_object_update', 'failure', { type, id }); }); }); @@ -1341,14 +1340,14 @@ describe('#removeReferencesTo', () => { await client.removeReferencesTo(type, id); expect(clientOpts.auditLogger.log).toHaveBeenCalledTimes(1); - expectAuditEvent('saved_object_remove_references', EventOutcome.UNKNOWN, { type, id }); + expectAuditEvent('saved_object_remove_references', 'unknown', { type, id }); }); test(`adds audit event when not successful`, async () => { clientOpts.checkSavedObjectsPrivilegesAsCurrentUser.mockRejectedValue(new Error()); await expect(() => client.removeReferencesTo(type, id)).rejects.toThrow(); expect(clientOpts.auditLogger.log).toHaveBeenCalledTimes(1); - expectAuditEvent('saved_object_remove_references', EventOutcome.FAILURE, { type, id }); + expectAuditEvent('saved_object_remove_references', 'failure', { type, id }); }); }); diff --git a/x-pack/plugins/security/server/saved_objects/secure_saved_objects_client_wrapper.ts b/x-pack/plugins/security/server/saved_objects/secure_saved_objects_client_wrapper.ts index d876175a05fe8..066a720f70721 100644 --- a/x-pack/plugins/security/server/saved_objects/secure_saved_objects_client_wrapper.ts +++ b/x-pack/plugins/security/server/saved_objects/secure_saved_objects_client_wrapper.ts @@ -28,7 +28,7 @@ import type { import { SavedObjectsUtils } from '../../../../../src/core/server'; import { ALL_SPACES_ID, UNKNOWN_SPACE } from '../../common/constants'; import type { AuditLogger, SecurityAuditLogger } from '../audit'; -import { EventOutcome, SavedObjectAction, savedObjectEvent } from '../audit'; +import { SavedObjectAction, savedObjectEvent } from '../audit'; import type { Actions, CheckSavedObjectsPrivileges } from '../authorization'; import type { CheckPrivilegesResponse } from '../authorization/types'; import type { SpacesService } from '../plugin'; @@ -116,7 +116,7 @@ export class SecureSavedObjectsClientWrapper implements SavedObjectsClientContra this.auditLogger.log( savedObjectEvent({ action: SavedObjectAction.CREATE, - outcome: EventOutcome.UNKNOWN, + outcome: 'unknown', savedObject: { type, id: optionsWithId.id }, }) ); @@ -178,7 +178,7 @@ export class SecureSavedObjectsClientWrapper implements SavedObjectsClientContra this.auditLogger.log( savedObjectEvent({ action: SavedObjectAction.CREATE, - outcome: EventOutcome.UNKNOWN, + outcome: 'unknown', savedObject: { type, id }, }) ) @@ -205,7 +205,7 @@ export class SecureSavedObjectsClientWrapper implements SavedObjectsClientContra this.auditLogger.log( savedObjectEvent({ action: SavedObjectAction.DELETE, - outcome: EventOutcome.UNKNOWN, + outcome: 'unknown', savedObject: { type, id }, }) ); @@ -400,7 +400,7 @@ export class SecureSavedObjectsClientWrapper implements SavedObjectsClientContra this.auditLogger.log( savedObjectEvent({ action: SavedObjectAction.UPDATE, - outcome: EventOutcome.UNKNOWN, + outcome: 'unknown', savedObject: { type, id }, }) ); @@ -446,7 +446,7 @@ export class SecureSavedObjectsClientWrapper implements SavedObjectsClientContra this.auditLogger.log( savedObjectEvent({ action: SavedObjectAction.ADD_TO_SPACES, - outcome: EventOutcome.UNKNOWN, + outcome: 'unknown', savedObject: { type, id }, addToSpaces: namespaces, }) @@ -483,7 +483,7 @@ export class SecureSavedObjectsClientWrapper implements SavedObjectsClientContra this.auditLogger.log( savedObjectEvent({ action: SavedObjectAction.DELETE_FROM_SPACES, - outcome: EventOutcome.UNKNOWN, + outcome: 'unknown', savedObject: { type, id }, deleteFromSpaces: namespaces, }) @@ -524,7 +524,7 @@ export class SecureSavedObjectsClientWrapper implements SavedObjectsClientContra this.auditLogger.log( savedObjectEvent({ action: SavedObjectAction.UPDATE, - outcome: EventOutcome.UNKNOWN, + outcome: 'unknown', savedObject: { type, id }, }) ) @@ -560,7 +560,7 @@ export class SecureSavedObjectsClientWrapper implements SavedObjectsClientContra savedObjectEvent({ action: SavedObjectAction.REMOVE_REFERENCES, savedObject: { type, id }, - outcome: EventOutcome.UNKNOWN, + outcome: 'unknown', }) ); @@ -592,7 +592,7 @@ export class SecureSavedObjectsClientWrapper implements SavedObjectsClientContra this.auditLogger.log( savedObjectEvent({ action: SavedObjectAction.OPEN_POINT_IN_TIME, - outcome: EventOutcome.UNKNOWN, + outcome: 'unknown', }) ); @@ -611,7 +611,7 @@ export class SecureSavedObjectsClientWrapper implements SavedObjectsClientContra this.auditLogger.log( savedObjectEvent({ action: SavedObjectAction.CLOSE_POINT_IN_TIME, - outcome: EventOutcome.UNKNOWN, + outcome: 'unknown', }) ); diff --git a/x-pack/plugins/security/server/spaces/secure_spaces_client_wrapper.test.ts b/x-pack/plugins/security/server/spaces/secure_spaces_client_wrapper.test.ts index 3f17d18bbe5f7..0b8a7abab2382 100644 --- a/x-pack/plugins/security/server/spaces/secure_spaces_client_wrapper.test.ts +++ b/x-pack/plugins/security/server/spaces/secure_spaces_client_wrapper.test.ts @@ -6,13 +6,14 @@ */ import { deepFreeze } from '@kbn/std'; +import type { EcsEventOutcome } from 'src/core/server'; import { SavedObjectsErrorHelpers } from 'src/core/server'; import { httpServerMock } from 'src/core/server/mocks'; import type { GetAllSpacesPurpose, Space } from '../../../spaces/server'; import { spacesClientMock } from '../../../spaces/server/mocks'; import type { AuditEvent, AuditLogger } from '../audit'; -import { EventOutcome, SpaceAuditAction } from '../audit'; +import { SpaceAuditAction } from '../audit'; import { auditServiceMock } from '../audit/index.mock'; import type { AuthorizationServiceSetup } from '../authorization'; import { authorizationMock } from '../authorization/index.mock'; @@ -135,8 +136,8 @@ const expectSuccessAuditLogging = ( const expectAuditEvent = ( auditLogger: AuditLogger, - action: AuditEvent['event']['action'], - outcome: AuditEvent['event']['outcome'], + action: string, + outcome: EcsEventOutcome, savedObject?: Required['kibana']['saved_object'] ) => { expect(auditLogger.log).toHaveBeenCalledWith( @@ -194,15 +195,15 @@ describe('SecureSpacesClientWrapper', () => { expect(response).toEqual(spaces); expectNoAuthorizationCheck(authorization); expectNoAuditLogging(legacyAuditLogger); - expectAuditEvent(auditLogger, SpaceAuditAction.FIND, EventOutcome.SUCCESS, { + expectAuditEvent(auditLogger, SpaceAuditAction.FIND, 'success', { type: 'space', id: spaces[0].id, }); - expectAuditEvent(auditLogger, SpaceAuditAction.FIND, EventOutcome.SUCCESS, { + expectAuditEvent(auditLogger, SpaceAuditAction.FIND, 'success', { type: 'space', id: spaces[1].id, }); - expectAuditEvent(auditLogger, SpaceAuditAction.FIND, EventOutcome.SUCCESS, { + expectAuditEvent(auditLogger, SpaceAuditAction.FIND, 'success', { type: 'space', id: spaces[2].id, }); @@ -285,7 +286,7 @@ describe('SecureSpacesClientWrapper', () => { ); expectForbiddenAuditLogging(legacyAuditLogger, username, 'getAll'); - expectAuditEvent(auditLogger, SpaceAuditAction.FIND, EventOutcome.FAILURE); + expectAuditEvent(auditLogger, SpaceAuditAction.FIND, 'failure'); }); test(`returns spaces that the user is authorized for`, async () => { @@ -330,7 +331,7 @@ describe('SecureSpacesClientWrapper', () => { ); expectSuccessAuditLogging(legacyAuditLogger, username, 'getAll', [spaces[0].id]); - expectAuditEvent(auditLogger, SpaceAuditAction.FIND, EventOutcome.SUCCESS, { + expectAuditEvent(auditLogger, SpaceAuditAction.FIND, 'success', { type: 'space', id: spaces[0].id, }); @@ -351,7 +352,7 @@ describe('SecureSpacesClientWrapper', () => { expect(response).toEqual(spaces[0]); expectNoAuthorizationCheck(authorization); expectNoAuditLogging(legacyAuditLogger); - expectAuditEvent(auditLogger, SpaceAuditAction.GET, EventOutcome.SUCCESS, { + expectAuditEvent(auditLogger, SpaceAuditAction.GET, 'success', { type: 'space', id: spaces[0].id, }); @@ -392,7 +393,7 @@ describe('SecureSpacesClientWrapper', () => { }); expectForbiddenAuditLogging(legacyAuditLogger, username, 'get', spaceId); - expectAuditEvent(auditLogger, SpaceAuditAction.GET, EventOutcome.FAILURE, { + expectAuditEvent(auditLogger, SpaceAuditAction.GET, 'failure', { type: 'space', id: spaces[0].id, }); @@ -432,7 +433,7 @@ describe('SecureSpacesClientWrapper', () => { }); expectSuccessAuditLogging(legacyAuditLogger, username, 'get', [spaceId]); - expectAuditEvent(auditLogger, SpaceAuditAction.GET, EventOutcome.SUCCESS, { + expectAuditEvent(auditLogger, SpaceAuditAction.GET, 'success', { type: 'space', id: spaceId, }); @@ -457,7 +458,7 @@ describe('SecureSpacesClientWrapper', () => { expect(response).toEqual(space); expectNoAuthorizationCheck(authorization); expectNoAuditLogging(legacyAuditLogger); - expectAuditEvent(auditLogger, SpaceAuditAction.CREATE, EventOutcome.UNKNOWN, { + expectAuditEvent(auditLogger, SpaceAuditAction.CREATE, 'unknown', { type: 'space', id: space.id, }); @@ -495,7 +496,7 @@ describe('SecureSpacesClientWrapper', () => { }); expectForbiddenAuditLogging(legacyAuditLogger, username, 'create'); - expectAuditEvent(auditLogger, SpaceAuditAction.CREATE, EventOutcome.FAILURE, { + expectAuditEvent(auditLogger, SpaceAuditAction.CREATE, 'failure', { type: 'space', id: space.id, }); @@ -534,7 +535,7 @@ describe('SecureSpacesClientWrapper', () => { }); expectSuccessAuditLogging(legacyAuditLogger, username, 'create'); - expectAuditEvent(auditLogger, SpaceAuditAction.CREATE, EventOutcome.UNKNOWN, { + expectAuditEvent(auditLogger, SpaceAuditAction.CREATE, 'unknown', { type: 'space', id: space.id, }); @@ -559,7 +560,7 @@ describe('SecureSpacesClientWrapper', () => { expect(response).toEqual(space.id); expectNoAuthorizationCheck(authorization); expectNoAuditLogging(legacyAuditLogger); - expectAuditEvent(auditLogger, SpaceAuditAction.UPDATE, EventOutcome.UNKNOWN, { + expectAuditEvent(auditLogger, SpaceAuditAction.UPDATE, 'unknown', { type: 'space', id: space.id, }); @@ -597,7 +598,7 @@ describe('SecureSpacesClientWrapper', () => { }); expectForbiddenAuditLogging(legacyAuditLogger, username, 'update'); - expectAuditEvent(auditLogger, SpaceAuditAction.UPDATE, EventOutcome.FAILURE, { + expectAuditEvent(auditLogger, SpaceAuditAction.UPDATE, 'failure', { type: 'space', id: space.id, }); @@ -636,7 +637,7 @@ describe('SecureSpacesClientWrapper', () => { }); expectSuccessAuditLogging(legacyAuditLogger, username, 'update'); - expectAuditEvent(auditLogger, SpaceAuditAction.UPDATE, EventOutcome.UNKNOWN, { + expectAuditEvent(auditLogger, SpaceAuditAction.UPDATE, 'unknown', { type: 'space', id: space.id, }); @@ -660,7 +661,7 @@ describe('SecureSpacesClientWrapper', () => { expect(baseClient.delete).toHaveBeenCalledWith(space.id); expectNoAuthorizationCheck(authorization); expectNoAuditLogging(legacyAuditLogger); - expectAuditEvent(auditLogger, SpaceAuditAction.DELETE, EventOutcome.UNKNOWN, { + expectAuditEvent(auditLogger, SpaceAuditAction.DELETE, 'unknown', { type: 'space', id: space.id, }); @@ -698,7 +699,7 @@ describe('SecureSpacesClientWrapper', () => { }); expectForbiddenAuditLogging(legacyAuditLogger, username, 'delete'); - expectAuditEvent(auditLogger, SpaceAuditAction.DELETE, EventOutcome.FAILURE, { + expectAuditEvent(auditLogger, SpaceAuditAction.DELETE, 'failure', { type: 'space', id: space.id, }); @@ -735,7 +736,7 @@ describe('SecureSpacesClientWrapper', () => { }); expectSuccessAuditLogging(legacyAuditLogger, username, 'delete'); - expectAuditEvent(auditLogger, SpaceAuditAction.DELETE, EventOutcome.UNKNOWN, { + expectAuditEvent(auditLogger, SpaceAuditAction.DELETE, 'unknown', { type: 'space', id: space.id, }); diff --git a/x-pack/plugins/security/server/spaces/secure_spaces_client_wrapper.ts b/x-pack/plugins/security/server/spaces/secure_spaces_client_wrapper.ts index 7257dc625d4b4..ab882570ac630 100644 --- a/x-pack/plugins/security/server/spaces/secure_spaces_client_wrapper.ts +++ b/x-pack/plugins/security/server/spaces/secure_spaces_client_wrapper.ts @@ -17,7 +17,7 @@ import type { Space, } from '../../../spaces/server'; import type { AuditLogger } from '../audit'; -import { EventOutcome, SpaceAuditAction, spaceAuditEvent } from '../audit'; +import { SpaceAuditAction, spaceAuditEvent } from '../audit'; import type { AuthorizationServiceSetup } from '../authorization'; import type { SecurityPluginSetup } from '../plugin'; import type { LegacySpacesAuditLogger } from './legacy_audit_logger'; @@ -207,7 +207,7 @@ export class SecureSpacesClientWrapper implements ISpacesClient { this.auditLogger.log( spaceAuditEvent({ action: SpaceAuditAction.CREATE, - outcome: EventOutcome.UNKNOWN, + outcome: 'unknown', savedObject: { type: 'space', id: space.id }, }) ); @@ -238,7 +238,7 @@ export class SecureSpacesClientWrapper implements ISpacesClient { this.auditLogger.log( spaceAuditEvent({ action: SpaceAuditAction.UPDATE, - outcome: EventOutcome.UNKNOWN, + outcome: 'unknown', savedObject: { type: 'space', id }, }) ); @@ -269,7 +269,7 @@ export class SecureSpacesClientWrapper implements ISpacesClient { this.auditLogger.log( spaceAuditEvent({ action: SpaceAuditAction.DELETE, - outcome: EventOutcome.UNKNOWN, + outcome: 'unknown', savedObject: { type: 'space', id }, }) ); diff --git a/x-pack/plugins/security_solution/.gitattributes b/x-pack/plugins/security_solution/.gitattributes deleted file mode 100644 index 431f25be5e78e..0000000000000 --- a/x-pack/plugins/security_solution/.gitattributes +++ /dev/null @@ -1,6 +0,0 @@ -# Auto-collapse generated files in GitHub -# https://help.github.com/en/articles/customizing-how-changed-files-appear-on-github -x-pack/plugins/security_solution/server/graphql/types.ts linguist-generated=true -x-pack/plugins/security_solution/public/graphql/types.ts linguist-generated=true -x-pack/plugins/security_solution/public/graphql/introspection.json linguist-generated=true - diff --git a/x-pack/plugins/security_solution/common/constants.ts b/x-pack/plugins/security_solution/common/constants.ts index 4c62179f9ed54..2b584b196a738 100644 --- a/x-pack/plugins/security_solution/common/constants.ts +++ b/x-pack/plugins/security_solution/common/constants.ts @@ -136,11 +136,16 @@ export const DETECTION_ENGINE_RULES_STATUS_URL = `${DETECTION_ENGINE_RULES_URL}/ export const DETECTION_ENGINE_PREPACKAGED_RULES_STATUS_URL = `${DETECTION_ENGINE_RULES_URL}/prepackaged/_status`; export const TIMELINE_URL = '/api/timeline'; +export const TIMELINES_URL = '/api/timelines'; +export const TIMELINE_FAVORITE_URL = '/api/timeline/_favorite'; export const TIMELINE_DRAFT_URL = `${TIMELINE_URL}/_draft`; export const TIMELINE_EXPORT_URL = `${TIMELINE_URL}/_export`; export const TIMELINE_IMPORT_URL = `${TIMELINE_URL}/_import`; export const TIMELINE_PREPACKAGED_URL = `${TIMELINE_URL}/_prepackaged`; +export const NOTE_URL = '/api/note'; +export const PINNED_EVENT_URL = '/api/pinned_event'; + /** * Default signals index key for kibana.dev.yml */ diff --git a/x-pack/plugins/security_solution/common/cti/constants.ts b/x-pack/plugins/security_solution/common/cti/constants.ts index cdd4a564f3d73..3423f17e3f683 100644 --- a/x-pack/plugins/security_solution/common/cti/constants.ts +++ b/x-pack/plugins/security_solution/common/cti/constants.ts @@ -19,10 +19,14 @@ export const INDICATOR_MATCHED_TYPE = `${INDICATOR_DESTINATION_PATH}.${MATCHED_T export const EVENT_DATASET = 'event.dataset'; export const EVENT_REFERENCE = 'event.reference'; export const PROVIDER = 'provider'; +export const FIRSTSEEN = 'first_seen'; export const INDICATOR_DATASET = `${INDICATOR_DESTINATION_PATH}.${EVENT_DATASET}`; -export const INDICATOR_REFERENCE = `${INDICATOR_DESTINATION_PATH}.${EVENT_REFERENCE}`; +export const INDICATOR_EVENT_URL = `${INDICATOR_DESTINATION_PATH}.event.url`; +export const INDICATOR_FIRSTSEEN = `${INDICATOR_DESTINATION_PATH}.${FIRSTSEEN}`; +export const INDICATOR_LASTSEEN = `${INDICATOR_DESTINATION_PATH}.last_seen`; export const INDICATOR_PROVIDER = `${INDICATOR_DESTINATION_PATH}.${PROVIDER}`; +export const INDICATOR_REFERENCE = `${INDICATOR_DESTINATION_PATH}.${EVENT_REFERENCE}`; export const CTI_ROW_RENDERER_FIELDS = [ INDICATOR_MATCHED_ATOMIC, @@ -32,3 +36,11 @@ export const CTI_ROW_RENDERER_FIELDS = [ INDICATOR_REFERENCE, INDICATOR_PROVIDER, ]; + +export const SORTED_THREAT_SUMMARY_FIELDS = [ + INDICATOR_MATCHED_FIELD, + INDICATOR_MATCHED_TYPE, + INDICATOR_PROVIDER, + INDICATOR_FIRSTSEEN, + INDICATOR_LASTSEEN, +]; diff --git a/x-pack/plugins/security_solution/common/detection_engine/get_query_filter.test.ts b/x-pack/plugins/security_solution/common/detection_engine/get_query_filter.test.ts index 3c04e2b0da9c3..63a38ad7d71c1 100644 --- a/x-pack/plugins/security_solution/common/detection_engine/get_query_filter.test.ts +++ b/x-pack/plugins/security_solution/common/detection_engine/get_query_filter.test.ts @@ -1161,8 +1161,8 @@ describe('get_filter', () => { expect(request).toEqual({ method: 'POST', path: `/testindex1,testindex2/_eql/search?allow_no_indices=true`, - event_category_field: 'event.other_category', body: { + event_category_field: 'event.other_category', size: 100, query: 'process where true', filter: { diff --git a/x-pack/plugins/security_solution/common/detection_engine/get_query_filter.ts b/x-pack/plugins/security_solution/common/detection_engine/get_query_filter.ts index 70fe2b6187aa6..e562d186bc424 100644 --- a/x-pack/plugins/security_solution/common/detection_engine/get_query_filter.ts +++ b/x-pack/plugins/security_solution/common/detection_engine/get_query_filter.ts @@ -65,7 +65,6 @@ interface EqlSearchRequest { method: string; path: string; body: object; - event_category_field?: string; } export const buildEqlSearchRequest = ( @@ -109,7 +108,7 @@ export const buildEqlSearchRequest = ( }, }); } - const baseRequest = { + return { method: 'POST', path: `/${indexString}/_eql/search?allow_no_indices=true`, body: { @@ -120,14 +119,7 @@ export const buildEqlSearchRequest = ( filter: requestFilter, }, }, + event_category_field: eventCategoryOverride, }, }; - if (eventCategoryOverride) { - return { - ...baseRequest, - event_category_field: eventCategoryOverride, - }; - } else { - return baseRequest; - } }; diff --git a/x-pack/plugins/security_solution/common/graphql/shared/schema.gql.ts b/x-pack/plugins/security_solution/common/graphql/shared/schema.gql.ts deleted file mode 100644 index 86416cf354498..0000000000000 --- a/x-pack/plugins/security_solution/common/graphql/shared/schema.gql.ts +++ /dev/null @@ -1,92 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. - */ - -import gql from 'graphql-tag'; - -export const sharedSchema = gql` - input TimerangeInput { - "The interval string to use for last bucket. The format is '{value}{unit}'. For example '5m' would return the metrics for the last 5 minutes of the timespan." - interval: String! - "The end of the timerange" - to: String! - "The beginning of the timerange" - from: String! - } - - input docValueFieldsInput { - field: String! - format: String! - } - - type CursorType { - value: String - tiebreaker: String - } - - input PaginationInput { - "The limit parameter allows you to configure the maximum amount of items to be returned" - limit: Float! - "The cursor parameter defines the next result you want to fetch" - cursor: String - "The tiebreaker parameter allow to be more precise to fetch the next item" - tiebreaker: String - } - - input PaginationInputPaginated { - "The activePage parameter defines the page of results you want to fetch" - activePage: Float! - "The cursorStart parameter defines the start of the results to be displayed" - cursorStart: Float! - "The fakePossibleCount parameter determines the total count in order to show 5 additional pages" - fakePossibleCount: Float! - "The querySize parameter is the number of items to be returned" - querySize: Float! - } - - enum Direction { - asc - desc - } - - enum FlowTarget { - client - destination - server - source - } - - enum FlowTargetSourceDest { - destination - source - } - - enum FlowDirection { - uniDirectional - biDirectional - } - - input SortField { - sortFieldId: String! - direction: Direction! - } - - type PageInfo { - endCursor: CursorType - hasNextPage: Boolean - } - - type Inspect { - dsl: [String!]! - response: [String!]! - } - - type PageInfoPaginated { - activePage: Float! - fakeTotalCount: Float! - showMorePagesIndicator: Boolean! - } -`; diff --git a/x-pack/plugins/security_solution/common/machine_learning/empty_ml_capabilities.ts b/x-pack/plugins/security_solution/common/machine_learning/empty_ml_capabilities.ts index 54c2beaa06b09..257a6f0c30981 100644 --- a/x-pack/plugins/security_solution/common/machine_learning/empty_ml_capabilities.ts +++ b/x-pack/plugins/security_solution/common/machine_learning/empty_ml_capabilities.ts @@ -38,6 +38,7 @@ export const emptyMlCapabilities: MlCapabilitiesResponse = { canCreateDataFrameAnalytics: false, canStartStopDataFrameAnalytics: false, canCreateMlAlerts: false, + canUseMlAlerts: false, }, isPlatinumOrTrialLicense: false, mlFeatureEnabledInSpace: false, diff --git a/x-pack/plugins/security_solution/common/search_strategy/security_solution/index.ts b/x-pack/plugins/security_solution/common/search_strategy/security_solution/index.ts index 2160ed6170e29..ae2cff20717f3 100644 --- a/x-pack/plugins/security_solution/common/search_strategy/security_solution/index.ts +++ b/x-pack/plugins/security_solution/common/search_strategy/security_solution/index.ts @@ -192,3 +192,9 @@ export type StrategyRequestType = T extends HostsQu : T extends typeof MatrixHistogramQuery ? MatrixHistogramRequestOptions : never; + +export interface DocValueFieldsInput { + field: string; + + format: string; +} diff --git a/x-pack/plugins/security_solution/common/search_strategy/timeline/events/eql/index.ts b/x-pack/plugins/security_solution/common/search_strategy/timeline/events/eql/index.ts index 6bf01e478a972..c508876032fca 100644 --- a/x-pack/plugins/security_solution/common/search_strategy/timeline/events/eql/index.ts +++ b/x-pack/plugins/security_solution/common/search_strategy/timeline/events/eql/index.ts @@ -9,7 +9,7 @@ import { EuiComboBoxOptionOption } from '@elastic/eui'; import { EqlSearchStrategyRequest, EqlSearchStrategyResponse, -} from '../../../../../../data_enhanced/common'; +} from '../../../../../../../../src/plugins/data/common'; import { Inspect, Maybe, PaginationInputPaginated } from '../../..'; import { TimelineEdges, TimelineEventsAllRequestOptions } from '../..'; import { EqlSearchResponse } from '../../../../detection_engine/types'; diff --git a/x-pack/plugins/security_solution/common/search_strategy/timeline/index.ts b/x-pack/plugins/security_solution/common/search_strategy/timeline/index.ts index 504e71cd8cefb..9c2c23eb334a3 100644 --- a/x-pack/plugins/security_solution/common/search_strategy/timeline/index.ts +++ b/x-pack/plugins/security_solution/common/search_strategy/timeline/index.ts @@ -17,7 +17,14 @@ import { TimelineEventsLastEventTimeStrategyResponse, TimelineKpiStrategyResponse, } from './events'; -import { DocValueFields, PaginationInputPaginated, TimerangeInput, SortField } from '../common'; +import { + DocValueFields, + PaginationInputPaginated, + TimerangeInput, + SortField, + Maybe, +} from '../common'; +import { DataProviderType, TimelineType, TimelineStatus } from '../../types/timeline'; export * from './events'; @@ -64,3 +71,141 @@ export type TimelineStrategyRequestType< : T extends TimelineEventsQueries.lastEventTime ? TimelineEventsLastEventTimeRequestOptions : never; + +export interface ColumnHeaderInput { + aggregatable?: Maybe; + category?: Maybe; + columnHeaderType?: Maybe; + description?: Maybe; + example?: Maybe; + indexes?: Maybe; + id?: Maybe; + name?: Maybe; + placeholder?: Maybe; + searchable?: Maybe; + type?: Maybe; +} + +export interface QueryMatchInput { + field?: Maybe; + + displayField?: Maybe; + + value?: Maybe; + + displayValue?: Maybe; + + operator?: Maybe; +} + +export interface DataProviderInput { + id?: Maybe; + name?: Maybe; + enabled?: Maybe; + excluded?: Maybe; + kqlQuery?: Maybe; + queryMatch?: Maybe; + and?: Maybe; + type?: Maybe; +} + +export interface EqlOptionsInput { + eventCategoryField?: Maybe; + tiebreakerField?: Maybe; + timestampField?: Maybe; + query?: Maybe; + size?: Maybe; +} + +export interface FilterMetaTimelineInput { + alias?: Maybe; + controlledBy?: Maybe; + disabled?: Maybe; + field?: Maybe; + formattedValue?: Maybe; + index?: Maybe; + key?: Maybe; + negate?: Maybe; + params?: Maybe; + type?: Maybe; + value?: Maybe; +} + +export interface FilterTimelineInput { + exists?: Maybe; + meta?: Maybe; + match_all?: Maybe; + missing?: Maybe; + query?: Maybe; + range?: Maybe; + script?: Maybe; +} + +export interface SerializedFilterQueryInput { + filterQuery?: Maybe; +} + +export interface SerializedKueryQueryInput { + kuery?: Maybe; + serializedQuery?: Maybe; +} + +export interface KueryFilterQueryInput { + kind?: Maybe; + expression?: Maybe; +} + +export interface DateRangePickerInput { + start?: Maybe; + end?: Maybe; +} + +export interface SortTimelineInput { + columnId?: Maybe; + sortDirection?: Maybe; +} + +export enum RowRendererId { + alerts = 'alerts', + auditd = 'auditd', + auditd_file = 'auditd_file', + library = 'library', + netflow = 'netflow', + plain = 'plain', + registry = 'registry', + suricata = 'suricata', + system = 'system', + system_dns = 'system_dns', + system_endgame_process = 'system_endgame_process', + system_file = 'system_file', + system_fim = 'system_fim', + system_security_event = 'system_security_event', + system_socket = 'system_socket', + zeek = 'zeek', +} + +export interface TimelineInput { + columns?: Maybe; + dataProviders?: Maybe; + description?: Maybe; + eqlOptions?: Maybe; + eventType?: Maybe; + excludedRowRendererIds?: Maybe; + filters?: Maybe; + kqlMode?: Maybe; + kqlQuery?: Maybe; + indexNames?: Maybe; + title?: Maybe; + templateTimelineId?: Maybe; + templateTimelineVersion?: Maybe; + timelineType?: Maybe; + dateRange?: Maybe; + savedQueryId?: Maybe; + sort?: Maybe; + status?: Maybe; +} + +export enum FlowDirection { + uniDirectional = 'uniDirectional', + biDirectional = 'biDirectional', +} diff --git a/x-pack/plugins/security_solution/common/types/timeline/index.ts b/x-pack/plugins/security_solution/common/types/timeline/index.ts index 9def70048410a..5b6c9c532ba7c 100644 --- a/x-pack/plugins/security_solution/common/types/timeline/index.ts +++ b/x-pack/plugins/security_solution/common/types/timeline/index.ts @@ -8,8 +8,12 @@ import * as runtimeTypes from 'io-ts'; import { stringEnum, unionWithNullType } from '../../utility_types'; -import { NoteSavedObject, NoteSavedObjectToReturnRuntimeType } from './note'; -import { PinnedEventToReturnSavedObjectRuntimeType, PinnedEventSavedObject } from './pinned_event'; +import { NoteResult, NoteSavedObject, NoteSavedObjectToReturnRuntimeType } from './note'; +import { + PinnedEventToReturnSavedObjectRuntimeType, + PinnedEventSavedObject, + PinnedEvent, +} from './pinned_event'; import { success, success_count as successCount, @@ -17,6 +21,7 @@ import { import { FlowTarget } from '../../search_strategy/security_solution/network'; import { PositiveInteger } from '../../detection_engine/schemas/types'; import { errorSchema } from '../../detection_engine/schemas/response/error_schema'; +import { Direction, Maybe } from '../../search_strategy'; /* * ColumnHeader Types @@ -167,6 +172,8 @@ const SavedSortRuntimeType = runtimeTypes.union([ SavedSortObject, ]); +export type Sort = runtimeTypes.TypeOf; + /* * Timeline Statuses */ @@ -346,6 +353,14 @@ export type TimelineSavedObject = runtimeTypes.TypeOf< typeof TimelineSavedToReturnObjectRuntimeType >; +export const SingleTimelineResponseType = runtimeTypes.type({ + data: runtimeTypes.type({ + getOneTimeline: TimelineSavedToReturnObjectRuntimeType, + }), +}); + +export type SingleTimelineResponse = runtimeTypes.TypeOf; + /** * All Timeline Saved object type with metadata */ @@ -476,3 +491,229 @@ export type TimelineExpandedDetailType = export type TimelineExpandedDetail = { [tab in TimelineTabs]?: TimelineExpandedDetailType; }; + +export const pageInfoTimeline = runtimeTypes.type({ + pageIndex: runtimeTypes.number, + pageSize: runtimeTypes.number, +}); + +export enum SortFieldTimeline { + title = 'title', + description = 'description', + updated = 'updated', + created = 'created', +} + +export const sortFieldTimeline = runtimeTypes.union([ + runtimeTypes.literal(SortFieldTimeline.title), + runtimeTypes.literal(SortFieldTimeline.description), + runtimeTypes.literal(SortFieldTimeline.updated), + runtimeTypes.literal(SortFieldTimeline.created), +]); + +export const direction = runtimeTypes.union([ + runtimeTypes.literal(Direction.asc), + runtimeTypes.literal(Direction.desc), +]); + +export const sortTimeline = runtimeTypes.type({ + sortField: sortFieldTimeline, + sortOrder: direction, +}); + +const favoriteTimelineResult = runtimeTypes.partial({ + fullName: unionWithNullType(runtimeTypes.string), + userName: unionWithNullType(runtimeTypes.string), + favoriteDate: unionWithNullType(runtimeTypes.number), +}); + +export type FavoriteTimelineResult = runtimeTypes.TypeOf; + +export const responseFavoriteTimeline = runtimeTypes.partial({ + savedObjectId: runtimeTypes.string, + version: runtimeTypes.string, + code: unionWithNullType(runtimeTypes.number), + message: unionWithNullType(runtimeTypes.string), + templateTimelineId: unionWithNullType(runtimeTypes.string), + templateTimelineVersion: unionWithNullType(runtimeTypes.number), + timelineType: unionWithNullType(TimelineTypeLiteralRt), + favorite: unionWithNullType(runtimeTypes.array(favoriteTimelineResult)), +}); + +export type ResponseFavoriteTimeline = runtimeTypes.TypeOf; + +export const getTimelinesArgs = runtimeTypes.partial({ + onlyUserFavorite: unionWithNullType(runtimeTypes.boolean), + pageInfo: unionWithNullType(pageInfoTimeline), + search: unionWithNullType(runtimeTypes.string), + sort: unionWithNullType(sortTimeline), + status: unionWithNullType(TimelineStatusLiteralRt), + timelineType: unionWithNullType(TimelineTypeLiteralRt), +}); + +export type GetTimelinesArgs = runtimeTypes.TypeOf; + +const responseTimelines = runtimeTypes.type({ + timeline: runtimeTypes.array(TimelineSavedToReturnObjectRuntimeType), + totalCount: runtimeTypes.number, +}); + +export type ResponseTimelines = runtimeTypes.TypeOf; + +export const allTimelinesResponse = runtimeTypes.intersection([ + responseTimelines, + runtimeTypes.type({ + defaultTimelineCount: runtimeTypes.number, + templateTimelineCount: runtimeTypes.number, + elasticTemplateTimelineCount: runtimeTypes.number, + customTemplateTimelineCount: runtimeTypes.number, + favoriteCount: runtimeTypes.number, + }), +]); + +export type AllTimelinesResponse = runtimeTypes.TypeOf; + +export interface PageInfoTimeline { + pageIndex: number; + + pageSize: number; +} + +export interface ColumnHeaderResult { + aggregatable?: Maybe; + category?: Maybe; + columnHeaderType?: Maybe; + description?: Maybe; + example?: Maybe; + indexes?: Maybe; + id?: Maybe; + name?: Maybe; + placeholder?: Maybe; + searchable?: Maybe; + type?: Maybe; +} + +export interface DataProviderResult { + id?: Maybe; + name?: Maybe; + enabled?: Maybe; + excluded?: Maybe; + kqlQuery?: Maybe; + queryMatch?: Maybe; + type?: Maybe; + and?: Maybe; +} + +export interface QueryMatchResult { + field?: Maybe; + displayField?: Maybe; + value?: Maybe; + displayValue?: Maybe; + operator?: Maybe; +} + +export interface DateRangePickerResult { + // eslint-disable-next-line @typescript-eslint/no-explicit-any + start?: Maybe; + // eslint-disable-next-line @typescript-eslint/no-explicit-any + end?: Maybe; +} + +export interface EqlOptionsResult { + eventCategoryField?: Maybe; + tiebreakerField?: Maybe; + timestampField?: Maybe; + query?: Maybe; + // eslint-disable-next-line @typescript-eslint/no-explicit-any + size?: Maybe; +} + +export interface FilterTimelineResult { + exists?: Maybe; + meta?: Maybe; + match_all?: Maybe; + missing?: Maybe; + query?: Maybe; + range?: Maybe; + script?: Maybe; +} + +export interface FilterMetaTimelineResult { + alias?: Maybe; + controlledBy?: Maybe; + disabled?: Maybe; + field?: Maybe; + formattedValue?: Maybe; + index?: Maybe; + key?: Maybe; + negate?: Maybe; + params?: Maybe; + type?: Maybe; + value?: Maybe; +} + +export interface SerializedFilterQueryResult { + filterQuery?: Maybe; +} + +export interface SerializedKueryQueryResult { + kuery?: Maybe; + serializedQuery?: Maybe; +} + +export interface KueryFilterQueryResult { + kind?: Maybe; + expression?: Maybe; +} + +export interface TimelineResult { + columns?: Maybe; + created?: Maybe; + createdBy?: Maybe; + dataProviders?: Maybe; + dateRange?: Maybe; + description?: Maybe; + eqlOptions?: Maybe; + eventIdToNoteIds?: Maybe; + eventType?: Maybe; + excludedRowRendererIds?: Maybe; + favorite?: Maybe; + filters?: Maybe; + kqlMode?: Maybe; + kqlQuery?: Maybe; + indexNames?: Maybe; + notes?: Maybe; + noteIds?: Maybe; + pinnedEventIds?: Maybe; + pinnedEventsSaveObject?: Maybe; + savedQueryId?: Maybe; + savedObjectId: string; + sort?: Maybe; + status?: Maybe; + title?: Maybe; + templateTimelineId?: Maybe; + templateTimelineVersion?: Maybe; + timelineType?: Maybe; + updated?: Maybe; + updatedBy?: Maybe; + version: string; +} + +export interface ResponseTimeline { + code?: Maybe; + message?: Maybe; + timeline: TimelineResult; +} +export interface SortTimeline { + sortField: SortFieldTimeline; + sortOrder: Direction; +} + +export interface GetAllTimelineVariables { + pageInfo: PageInfoTimeline; + search?: Maybe; + sort?: Maybe; + onlyUserFavorite?: Maybe; + timelineType?: Maybe; + status?: Maybe; +} diff --git a/x-pack/plugins/security_solution/common/types/timeline/note/index.ts b/x-pack/plugins/security_solution/common/types/timeline/note/index.ts index 1a97a59444a56..074e4132efdff 100644 --- a/x-pack/plugins/security_solution/common/types/timeline/note/index.ts +++ b/x-pack/plugins/security_solution/common/types/timeline/note/index.ts @@ -8,6 +8,7 @@ /* eslint-disable @typescript-eslint/no-empty-interface */ import * as runtimeTypes from 'io-ts'; +import { Direction, Maybe } from '../../../search_strategy/common'; import { unionWithNullType } from '../../../utility_types'; @@ -63,3 +64,64 @@ export const NoteSavedObjectToReturnRuntimeType = runtimeTypes.intersection([ export interface NoteSavedObject extends runtimeTypes.TypeOf {} + +export enum SortFieldNote { + updatedBy = 'updatedBy', + updated = 'updated', +} + +export const pageInfoNoteRt = runtimeTypes.type({ + pageIndex: runtimeTypes.number, + pageSize: runtimeTypes.number, +}); + +export type PageInfoNote = runtimeTypes.TypeOf; + +export const sortNoteRt = runtimeTypes.type({ + sortField: runtimeTypes.union([ + runtimeTypes.literal(SortFieldNote.updatedBy), + runtimeTypes.literal(SortFieldNote.updated), + ]), + sortOrder: runtimeTypes.union([ + runtimeTypes.literal(Direction.asc), + runtimeTypes.literal(Direction.desc), + ]), +}); + +export type SortNote = runtimeTypes.TypeOf; + +export interface NoteResult { + eventId?: Maybe; + + note?: Maybe; + + timelineId?: Maybe; + + noteId: string; + + created?: Maybe; + + createdBy?: Maybe; + + timelineVersion?: Maybe; + + updated?: Maybe; + + updatedBy?: Maybe; + + version?: Maybe; +} + +export interface ResponseNotes { + notes: NoteResult[]; + + totalCount?: Maybe; +} + +export interface ResponseNote { + code?: Maybe; + + message?: Maybe; + + note: NoteResult; +} diff --git a/x-pack/plugins/security_solution/common/types/timeline/pinned_event/index.ts b/x-pack/plugins/security_solution/common/types/timeline/pinned_event/index.ts index ba6ac673aa7d4..dbb19df7a6b05 100644 --- a/x-pack/plugins/security_solution/common/types/timeline/pinned_event/index.ts +++ b/x-pack/plugins/security_solution/common/types/timeline/pinned_event/index.ts @@ -8,6 +8,7 @@ /* eslint-disable @typescript-eslint/no-empty-interface */ import * as runtimeTypes from 'io-ts'; +import { Maybe } from '../../../search_strategy/common'; import { unionWithNullType } from '../../../utility_types'; @@ -58,3 +59,27 @@ export const PinnedEventToReturnSavedObjectRuntimeType = runtimeTypes.intersecti export interface PinnedEventSavedObject extends runtimeTypes.TypeOf {} + +export interface PinnedEvent { + code?: Maybe; + + message?: Maybe; + + pinnedEventId: string; + + eventId?: Maybe; + + timelineId?: Maybe; + + timelineVersion?: Maybe; + + created?: Maybe; + + createdBy?: Maybe; + + updated?: Maybe; + + updatedBy?: Maybe; + + version?: Maybe; +} diff --git a/x-pack/plugins/security_solution/cypress/integration/detection_rules/indicator_match_rule.spec.ts b/x-pack/plugins/security_solution/cypress/integration/detection_rules/indicator_match_rule.spec.ts index 129d592edd264..2a36a3d707aa8 100644 --- a/x-pack/plugins/security_solution/cypress/integration/detection_rules/indicator_match_rule.spec.ts +++ b/x-pack/plugins/security_solution/cypress/integration/detection_rules/indicator_match_rule.spec.ts @@ -65,11 +65,14 @@ import { openJsonView, scrollJsonViewToBottom } from '../../tasks/alerts_details import { changeRowsPerPageTo300, duplicateFirstRule, + duplicateSelectedRules, duplicateRuleFromMenu, filterByCustomRules, goToCreateNewRule, goToRuleDetails, waitForRulesTableToBeLoaded, + selectNumberOfRules, + checkDuplicatedRule, } from '../../tasks/alerts_detection_rules'; import { createCustomIndicatorRule } from '../../tasks/api_calls/rules'; import { cleanKibana, reload } from '../../tasks/common'; @@ -99,7 +102,7 @@ import { waitForAlertsToPopulate, waitForTheRuleToBeExecuted, } from '../../tasks/create_new_rule'; -import { waitForKibana } from '../../tasks/edit_rule'; +import { goBackToRuleDetails, waitForKibana } from '../../tasks/edit_rule'; import { esArchiverLoad, esArchiverUnload } from '../../tasks/es_archiver'; import { loginAndWaitForPageWithoutDateRange } from '../../tasks/login'; import { addsFieldsToTimeline, goBackToAllRulesTable } from '../../tasks/rule_details'; @@ -564,16 +567,26 @@ describe('indicator match', () => { it('Allows the rule to be duplicated from the table', () => { waitForKibana(); duplicateFirstRule(); - cy.contains(RULE_NAME, `${newThreatIndicatorRule.name} [Duplicate]`); + goBackToRuleDetails(); + goBackToAllRulesTable(); + checkDuplicatedRule(); + }); + + it("Allows the rule to be duplicated from the table's bulk actions", () => { + waitForKibana(); + selectNumberOfRules(1); + duplicateSelectedRules(); + checkDuplicatedRule(); }); it('Allows the rule to be duplicated from the edit screen', () => { waitForKibana(); goToRuleDetails(); duplicateRuleFromMenu(); + goBackToRuleDetails(); goBackToAllRulesTable(); reload(); - cy.contains(RULE_NAME, `${newThreatIndicatorRule.name} [Duplicate]`); + checkDuplicatedRule(); }); }); }); diff --git a/x-pack/plugins/security_solution/cypress/integration/timelines/fields_browser.spec.ts b/x-pack/plugins/security_solution/cypress/integration/timelines/fields_browser.spec.ts index 5d4bbdde5620e..35f38db4f38d2 100644 --- a/x-pack/plugins/security_solution/cypress/integration/timelines/fields_browser.spec.ts +++ b/x-pack/plugins/security_solution/cypress/integration/timelines/fields_browser.spec.ts @@ -111,7 +111,7 @@ describe('Fields Browser', () => { filterFieldsBrowser(filterInput); - cy.get(FIELDS_BROWSER_SELECTED_CATEGORY_COUNT).should('have.text', '4'); + cy.get(FIELDS_BROWSER_SELECTED_CATEGORY_COUNT).should('have.text', '5'); }); }); diff --git a/x-pack/plugins/security_solution/cypress/integration/timelines/open_timeline.spec.ts b/x-pack/plugins/security_solution/cypress/integration/timelines/open_timeline.spec.ts index 5d5d125082b8b..320d5979cb070 100644 --- a/x-pack/plugins/security_solution/cypress/integration/timelines/open_timeline.spec.ts +++ b/x-pack/plugins/security_solution/cypress/integration/timelines/open_timeline.spec.ts @@ -33,7 +33,8 @@ import { waitForTimelinesPanelToBeLoaded } from '../../tasks/timelines'; import { TIMELINES_URL } from '../../urls/navigation'; -describe('Open timeline', () => { +// FLAKY: https://github.com/elastic/kibana/issues/97544 +describe.skip('Open timeline', () => { let timelineId: string | null = null; before(() => { cleanKibana(); diff --git a/x-pack/plugins/security_solution/cypress/objects/rule.ts b/x-pack/plugins/security_solution/cypress/objects/rule.ts index 099cd39ba2d7b..957046cae003a 100644 --- a/x-pack/plugins/security_solution/cypress/objects/rule.ts +++ b/x-pack/plugins/security_solution/cypress/objects/rule.ts @@ -320,6 +320,8 @@ export const newThreatIndicatorRule: ThreatIndicatorRule = { maxSignals: 100, }; +export const duplicatedRuleName = `${newThreatIndicatorRule.name} [Duplicate]`; + export const severitiesOverride = ['Low', 'Medium', 'High', 'Critical']; export const editedRule = { diff --git a/x-pack/plugins/security_solution/cypress/screens/alerts_detection_rules.ts b/x-pack/plugins/security_solution/cypress/screens/alerts_detection_rules.ts index c74284eee15e4..70dde344c88b6 100644 --- a/x-pack/plugins/security_solution/cypress/screens/alerts_detection_rules.ts +++ b/x-pack/plugins/security_solution/cypress/screens/alerts_detection_rules.ts @@ -27,6 +27,8 @@ export const REFRESH_BTN = '[data-test-subj="refreshRulesAction"] button'; export const DELETE_RULE_BULK_BTN = '[data-test-subj="deleteRuleBulk"]'; +export const DUPLICATE_RULE_BULK_BTN = '[data-test-subj="duplicateRuleBulk"]'; + export const ELASTIC_RULES_BTN = '[data-test-subj="showElasticRulesFilterButton"]'; export const EXPORT_ACTION_BTN = '[data-test-subj="exportRuleAction"]'; diff --git a/x-pack/plugins/security_solution/cypress/screens/create_new_rule.ts b/x-pack/plugins/security_solution/cypress/screens/create_new_rule.ts index 8b9d9b144910d..db8d93dfbbef9 100644 --- a/x-pack/plugins/security_solution/cypress/screens/create_new_rule.ts +++ b/x-pack/plugins/security_solution/cypress/screens/create_new_rule.ts @@ -111,8 +111,6 @@ export const LOOK_BACK_TIME_TYPE = export const MACHINE_LEARNING_DROPDOWN_INPUT = '[data-test-subj="mlJobSelect"] [data-test-subj="comboBoxInput"]'; -export const MACHINE_LEARNING_DROPDOWN_ITEM = '.euiFilterSelectItem'; - export const MACHINE_LEARNING_TYPE = '[data-test-subj="machineLearningRuleType"]'; export const MITRE_TACTIC = '.euiContextMenuItem__text'; diff --git a/x-pack/plugins/security_solution/cypress/screens/edit_rule.ts b/x-pack/plugins/security_solution/cypress/screens/edit_rule.ts index a6cdf0c75535f..8d8520e109b15 100644 --- a/x-pack/plugins/security_solution/cypress/screens/edit_rule.ts +++ b/x-pack/plugins/security_solution/cypress/screens/edit_rule.ts @@ -6,5 +6,6 @@ */ export const EDIT_SUBMIT_BUTTON = '[data-test-subj="ruleEditSubmitButton"]'; +export const BACK_TO_RULE_DETAILS = '[data-test-subj="ruleEditBackToRuleDetails"]'; export const KIBANA_LOADING_INDICATOR = '[data-test-subj="globalLoadingIndicator"]'; export const KIBANA_LOADING_COMPLETE_INDICATOR = '[data-test-subj="globalLoadingIndicator-hidden"]'; diff --git a/x-pack/plugins/security_solution/cypress/tasks/alerts_detection_rules.ts b/x-pack/plugins/security_solution/cypress/tasks/alerts_detection_rules.ts index d66b839267ea0..cc14c54a4d84e 100644 --- a/x-pack/plugins/security_solution/cypress/tasks/alerts_detection_rules.ts +++ b/x-pack/plugins/security_solution/cypress/tasks/alerts_detection_rules.ts @@ -5,6 +5,7 @@ * 2.0. */ +import { duplicatedRuleName } from '../objects/rule'; import { BULK_ACTIONS_BTN, COLLAPSED_ACTION_BTN, @@ -33,6 +34,8 @@ import { pageSelector, DUPLICATE_RULE_ACTION_BTN, DUPLICATE_RULE_MENU_PANEL_BTN, + DUPLICATE_RULE_BULK_BTN, + RULES_ROW, } from '../screens/alerts_detection_rules'; import { ALL_ACTIONS, DELETE_RULE } from '../screens/rule_details'; @@ -54,6 +57,11 @@ export const duplicateFirstRule = () => { cy.get(DUPLICATE_RULE_ACTION_BTN).click(); }; +export const duplicateSelectedRules = () => { + cy.get(BULK_ACTIONS_BTN).click({ force: true }); + cy.get(DUPLICATE_RULE_BULK_BTN).click(); +}; + /** * Duplicates the rule from the menu and does additional * pipes and checking that the elements are present on the @@ -69,9 +77,18 @@ export const duplicateRuleFromMenu = () => { }) .should(($el) => expect($el).to.be.visible); // Because of a fade effect and fast clicking this can produce more than one click - cy.get(DUPLICATE_RULE_MENU_PANEL_BTN) - .pipe(($el) => $el.trigger('click')) - .should('not.be.visible'); + cy.get(DUPLICATE_RULE_MENU_PANEL_BTN).pipe(($el) => $el.trigger('click')); +}; + +/** + * Check that the duplicated rule is on the table + * and it is deactivated (default) + */ +export const checkDuplicatedRule = () => { + cy.contains(RULE_NAME, duplicatedRuleName) + .parents(RULES_ROW) + .find(RULE_SWITCH) + .should('have.attr', 'aria-checked', 'false'); }; export const deleteFirstRule = () => { diff --git a/x-pack/plugins/security_solution/cypress/tasks/api_calls/notes.ts b/x-pack/plugins/security_solution/cypress/tasks/api_calls/notes.ts index 0fc1a86395605..83651a0cbfd0b 100644 --- a/x-pack/plugins/security_solution/cypress/tasks/api_calls/notes.ts +++ b/x-pack/plugins/security_solution/cypress/tasks/api_calls/notes.ts @@ -7,17 +7,12 @@ export const addNoteToTimeline = (note: string, timelineId: string) => cy.request({ - method: 'POST', - url: '/api/solutions/security/graphql', + method: 'PATCH', + url: '/api/note', body: { - operationName: 'PersistTimelineNoteMutation', - variables: { - noteId: null, - version: null, - note: { note, timelineId }, - }, - query: - 'mutation PersistTimelineNoteMutation($noteId: ID, $version: String, $note: NoteInput!) {\n persistNote(noteId: $noteId, version: $version, note: $note) {\n code\n message\n note {\n eventId\n note\n timelineId\n timelineVersion\n noteId\n created\n createdBy\n updated\n updatedBy\n version\n __typename\n }\n __typename\n }\n}\n', + noteId: null, + version: null, + note: { note, timelineId }, }, headers: { 'kbn-xsrf': 'cypress-creds' }, }); diff --git a/x-pack/plugins/security_solution/cypress/tasks/api_calls/timelines.ts b/x-pack/plugins/security_solution/cypress/tasks/api_calls/timelines.ts index 4cfd1e7f89986..453c2db8afd65 100644 --- a/x-pack/plugins/security_solution/cypress/tasks/api_calls/timelines.ts +++ b/x-pack/plugins/security_solution/cypress/tasks/api_calls/timelines.ts @@ -98,13 +98,9 @@ export const createTimelineTemplate = (timeline: CompleteTimeline) => export const deleteTimeline = (timelineId: string) => { cy.request({ method: 'POST', - url: 'api/solutions/security/graphql', + url: 'api/timeline', body: { - operationName: 'DeleteTimelineMutation', - variables: { - id: [timelineId], - }, - query: 'mutation DeleteTimelineMutation($id: [ID!]!) {\n deleteTimeline(id: $id)\n}\n', + id: [timelineId], }, headers: { 'kbn-xsrf': 'delete-signals' }, }); @@ -112,15 +108,7 @@ export const deleteTimeline = (timelineId: string) => { export const getTimelineById = (timelineId: string) => cy.request({ - method: 'POST', - url: 'api/solutions/security/graphql', - body: { - operationName: 'GetOneTimeline', - variables: { - id: timelineId, - }, - query: - 'query GetOneTimeline($id: ID!, $timelineType: TimelineType) {\n getOneTimeline(id: $id, timelineType: $timelineType) {\n savedObjectId\n columns {\n aggregatable\n category\n columnHeaderType\n description\n example\n indexes\n id\n name\n searchable\n type\n __typename\n }\n dataProviders {\n id\n name\n enabled\n excluded\n kqlQuery\n type\n queryMatch {\n field\n displayField\n value\n displayValue\n operator\n __typename\n }\n and {\n id\n name\n enabled\n excluded\n kqlQuery\n type\n queryMatch {\n field\n displayField\n value\n displayValue\n operator\n __typename\n }\n __typename\n }\n __typename\n }\n dateRange {\n start\n end\n __typename\n }\n description\n eventType\n eventIdToNoteIds {\n eventId\n note\n timelineId\n noteId\n created\n createdBy\n timelineVersion\n updated\n updatedBy\n version\n __typename\n }\n excludedRowRendererIds\n favorite {\n fullName\n userName\n favoriteDate\n __typename\n }\n filters {\n meta {\n alias\n controlledBy\n disabled\n field\n formattedValue\n index\n key\n negate\n params\n type\n value\n __typename\n }\n query\n exists\n match_all\n missing\n range\n script\n __typename\n }\n kqlMode\n kqlQuery {\n filterQuery {\n kuery {\n kind\n expression\n __typename\n }\n serializedQuery\n __typename\n }\n __typename\n }\n indexNames\n notes {\n eventId\n note\n timelineId\n timelineVersion\n noteId\n created\n createdBy\n updated\n updatedBy\n version\n __typename\n }\n noteIds\n pinnedEventIds\n pinnedEventsSaveObject {\n pinnedEventId\n eventId\n timelineId\n created\n createdBy\n updated\n updatedBy\n version\n __typename\n }\n status\n title\n timelineType\n templateTimelineId\n templateTimelineVersion\n savedQueryId\n sort\n created\n createdBy\n updated\n updatedBy\n version\n __typename\n }\n}\n', - }, + method: 'GET', + url: `api/timeline?id=${timelineId}`, headers: { 'kbn-xsrf': 'timeline-by-id' }, }); diff --git a/x-pack/plugins/security_solution/cypress/tasks/create_new_rule.ts b/x-pack/plugins/security_solution/cypress/tasks/create_new_rule.ts index 9f957a0cb9a95..cd342e9456906 100644 --- a/x-pack/plugins/security_solution/cypress/tasks/create_new_rule.ts +++ b/x-pack/plugins/security_solution/cypress/tasks/create_new_rule.ts @@ -85,7 +85,6 @@ import { THRESHOLD_FIELD_SELECTION, THRESHOLD_INPUT_AREA, THRESHOLD_TYPE, - MACHINE_LEARNING_DROPDOWN_ITEM, } from '../screens/create_new_rule'; import { TOAST_ERROR } from '../screens/shared'; import { SERVER_SIDE_EVENT_COUNT } from '../screens/timeline'; @@ -436,7 +435,7 @@ export const fillDefineIndicatorMatchRuleAndContinue = (rule: ThreatIndicatorRul export const fillDefineMachineLearningRuleAndContinue = (rule: MachineLearningRule) => { rule.machineLearningJobs.forEach((machineLearningJob) => { cy.get(MACHINE_LEARNING_DROPDOWN_INPUT).click({ force: true }); - cy.contains(MACHINE_LEARNING_DROPDOWN_ITEM, machineLearningJob).click(); + cy.get(MACHINE_LEARNING_DROPDOWN_INPUT).type(`${machineLearningJob}{enter}`); cy.get(MACHINE_LEARNING_DROPDOWN_INPUT).type('{esc}'); }); cy.get(ANOMALY_THRESHOLD_INPUT).type(`{selectall}${machineLearningRule.anomalyScoreThreshold}`, { diff --git a/x-pack/plugins/security_solution/cypress/tasks/edit_rule.ts b/x-pack/plugins/security_solution/cypress/tasks/edit_rule.ts index e9691f2d922ae..2af563973b3d3 100644 --- a/x-pack/plugins/security_solution/cypress/tasks/edit_rule.ts +++ b/x-pack/plugins/security_solution/cypress/tasks/edit_rule.ts @@ -5,13 +5,22 @@ * 2.0. */ -import { EDIT_SUBMIT_BUTTON, KIBANA_LOADING_COMPLETE_INDICATOR } from '../screens/edit_rule'; +import { + BACK_TO_RULE_DETAILS, + EDIT_SUBMIT_BUTTON, + KIBANA_LOADING_COMPLETE_INDICATOR, +} from '../screens/edit_rule'; export const saveEditedRule = () => { cy.get(EDIT_SUBMIT_BUTTON).should('exist').click({ force: true }); cy.get(EDIT_SUBMIT_BUTTON).should('not.exist'); }; +export const goBackToRuleDetails = () => { + cy.get(BACK_TO_RULE_DETAILS).should('exist').click(); + cy.get(BACK_TO_RULE_DETAILS).should('not.exist'); +}; + export const waitForKibana = () => { cy.get(KIBANA_LOADING_COMPLETE_INDICATOR).should('exist'); }; diff --git a/x-pack/plugins/security_solution/package.json b/x-pack/plugins/security_solution/package.json index 211e6986e19a7..f35974d84164e 100644 --- a/x-pack/plugins/security_solution/package.json +++ b/x-pack/plugins/security_solution/package.json @@ -7,7 +7,6 @@ "scripts": { "extract-mitre-attacks": "node scripts/extract_tactics_techniques_mitre.js && node ../../../scripts/eslint ./public/detections/mitre/mitre_tactics_techniques.ts --fix", "build-beat-doc": "node scripts/beat_docs/build.js && node ../../../scripts/eslint ./server/utils/beat_schema/fields.ts --fix", - "build-graphql-types": "node scripts/generate_types_from_graphql.js", "cypress:open": "../../../node_modules/.bin/cypress open --config-file ./cypress/cypress.json", "cypress:open-as-ci": "node ../../../scripts/functional_tests --config ../../test/security_solution_cypress/visual_config.ts", "cypress:run": "../../../node_modules/.bin/cypress run --browser chrome --headless --spec ./cypress/integration/**/*.spec.ts --config-file ./cypress/cypress.json --reporter ../../../node_modules/cypress-multi-reporters --reporter-options configFile=./cypress/reporter_config.json; status=$?; ../../../node_modules/.bin/mochawesome-merge ../../../target/kibana-security-solution/cypress/results/mochawesome*.json > ../../../target/kibana-security-solution/cypress/results/output.json; ../../../node_modules/.bin/marge ../../../target/kibana-security-solution/cypress/results/output.json --reportDir ../../../target/kibana-security-solution/cypress/results; mkdir -p ../../../target/junit && cp ../../../target/kibana-security-solution/cypress/results/*.xml ../../../target/junit/ && exit $status;", diff --git a/x-pack/plugins/security_solution/public/app/app.tsx b/x-pack/plugins/security_solution/public/app/app.tsx index 451e29543fa03..0917354894834 100644 --- a/x-pack/plugins/security_solution/public/app/app.tsx +++ b/x-pack/plugins/security_solution/public/app/app.tsx @@ -7,7 +7,6 @@ import { History } from 'history'; import React, { memo, FC } from 'react'; -import { ApolloProvider } from 'react-apollo'; import { Store, Action } from 'redux'; import { Provider as ReduxStoreProvider } from 'react-redux'; @@ -19,30 +18,22 @@ import { DEFAULT_DARK_MODE, APP_NAME } from '../../common/constants'; import { ErrorToastDispatcher } from '../common/components/error_toast_dispatcher'; import { MlCapabilitiesProvider } from '../common/components/ml/permissions/ml_capabilities_provider'; import { GlobalToaster, ManageGlobalToaster } from '../common/components/toasters'; -import { AppFrontendLibs } from '../common/lib/lib'; import { KibanaContextProvider, useKibana, useUiSetting$ } from '../common/lib/kibana'; import { State } from '../common/store'; -import { ApolloClientContext } from '../common/utils/apollo_context'; import { ManageGlobalTimeline } from '../timelines/components/manage_timeline'; import { StartServices } from '../types'; import { PageRouter } from './routes'; import { EuiThemeProvider } from '../../../../../src/plugins/kibana_react/common'; -interface StartAppComponent extends AppFrontendLibs { +interface StartAppComponent { children: React.ReactNode; history: History; onAppLeave: (handler: AppLeaveHandler) => void; store: Store; } -const StartAppComponent: FC = ({ - children, - apolloClient, - history, - onAppLeave, - store, -}) => { +const StartAppComponent: FC = ({ children, history, onAppLeave, store }) => { const { i18n } = useKibana().services; const [darkMode] = useUiSetting$(DEFAULT_DARK_MODE); @@ -52,21 +43,17 @@ const StartAppComponent: FC = ({ - - - - - - - {children} - - - - - - - - + + + + + {children} + + + + + + @@ -77,7 +64,7 @@ const StartAppComponent: FC = ({ const StartApp = memo(StartAppComponent); -interface SecurityAppComponentProps extends AppFrontendLibs { +interface SecurityAppComponentProps { children: React.ReactNode; history: History; onAppLeave: (handler: AppLeaveHandler) => void; @@ -87,7 +74,6 @@ interface SecurityAppComponentProps extends AppFrontendLibs { const SecurityAppComponent: React.FC = ({ children, - apolloClient, history, onAppLeave, services, @@ -99,7 +85,7 @@ const SecurityAppComponent: React.FC = ({ ...services, }} > - + {children} diff --git a/x-pack/plugins/security_solution/public/app/index.tsx b/x-pack/plugins/security_solution/public/app/index.tsx index dadba699bd243..1e304c2686960 100644 --- a/x-pack/plugins/security_solution/public/app/index.tsx +++ b/x-pack/plugins/security_solution/public/app/index.tsx @@ -12,7 +12,6 @@ import { SecurityApp } from './app'; import { RenderAppProps } from './types'; export const renderApp = ({ - apolloClient, element, history, onAppLeave, @@ -21,13 +20,7 @@ export const renderApp = ({ SubPluginRoutes, }: RenderAppProps): (() => void) => { render( - + , element diff --git a/x-pack/plugins/security_solution/public/app/types.ts b/x-pack/plugins/security_solution/public/app/types.ts index 95e64fe37d333..a617c6f14b9c4 100644 --- a/x-pack/plugins/security_solution/public/app/types.ts +++ b/x-pack/plugins/security_solution/public/app/types.ts @@ -19,12 +19,11 @@ import { import { AppMountParameters, AppSearchDeepLink } from '../../../../../src/core/public'; import { StartServices } from '../types'; -import { AppFrontendLibs } from '../common/lib/lib'; /** * The React properties used to render `SecurityApp` as well as the `element` to render it into. */ -export interface RenderAppProps extends AppFrontendLibs, AppMountParameters { +export interface RenderAppProps extends AppMountParameters { services: StartServices; store: Store; SubPluginRoutes: React.FC; diff --git a/x-pack/plugins/security_solution/public/cases/components/user_action_tree/user_action_markdown.test.tsx b/x-pack/plugins/security_solution/public/cases/components/user_action_tree/user_action_markdown.test.tsx index 597566639a8d7..0b3915c3d38d4 100644 --- a/x-pack/plugins/security_solution/public/cases/components/user_action_tree/user_action_markdown.test.tsx +++ b/x-pack/plugins/security_solution/public/cases/components/user_action_tree/user_action_markdown.test.tsx @@ -11,9 +11,6 @@ import { Router, mockHistory } from '../__mock__/router'; import { UserActionMarkdown } from './user_action_markdown'; import { TestProviders } from '../../../common/mock'; import * as timelineHelpers from '../../../timelines/components/open_timeline/helpers'; -import { useApolloClient } from '../../../common/utils/apollo_context'; -const mockUseApolloClient = useApolloClient as jest.Mock; -jest.mock('../../../common/utils/apollo_context'); const onChangeEditable = jest.fn(); const onSaveContent = jest.fn(); @@ -30,7 +27,6 @@ const defaultProps = { describe('UserActionMarkdown ', () => { const queryTimelineByIdSpy = jest.spyOn(timelineHelpers, 'queryTimelineById'); beforeEach(() => { - mockUseApolloClient.mockClear(); jest.resetAllMocks(); }); @@ -49,7 +45,6 @@ describe('UserActionMarkdown ', () => { .simulate('click'); expect(queryTimelineByIdSpy).toBeCalledWith({ - apolloClient: mockUseApolloClient(), graphEventId: '', timelineId, updateIsLoading: expect.any(Function), @@ -79,7 +74,6 @@ describe('UserActionMarkdown ', () => { .first() .simulate('click'); expect(queryTimelineByIdSpy).toBeCalledWith({ - apolloClient: mockUseApolloClient(), graphEventId: '', timelineId, updateIsLoading: expect.any(Function), diff --git a/x-pack/plugins/security_solution/public/common/components/add_filter_to_global_search_bar/index.test.tsx b/x-pack/plugins/security_solution/public/common/components/add_filter_to_global_search_bar/index.test.tsx index 1b812c6e81e82..66b8c00879b1c 100644 --- a/x-pack/plugins/security_solution/public/common/components/add_filter_to_global_search_bar/index.test.tsx +++ b/x-pack/plugins/security_solution/public/common/components/add_filter_to_global_search_bar/index.test.tsx @@ -9,7 +9,6 @@ import { mount, shallow } from 'enzyme'; import React from 'react'; import { waitFor } from '@testing-library/react'; import { - apolloClientObservable, mockGlobalState, TestProviders, SUB_PLUGINS_REDUCER, @@ -37,23 +36,11 @@ jest.mock('../../lib/kibana', () => ({ describe('AddFilterToGlobalSearchBar Component', () => { const state: State = mockGlobalState; const { storage } = createSecuritySolutionStorageMock(); - let store = createStore( - state, - SUB_PLUGINS_REDUCER, - apolloClientObservable, - kibanaObservable, - storage - ); + let store = createStore(state, SUB_PLUGINS_REDUCER, kibanaObservable, storage); beforeEach(() => { jest.useFakeTimers(); - store = createStore( - state, - SUB_PLUGINS_REDUCER, - apolloClientObservable, - kibanaObservable, - storage - ); + store = createStore(state, SUB_PLUGINS_REDUCER, kibanaObservable, storage); mockAddFilters.mockClear(); }); diff --git a/x-pack/plugins/security_solution/public/common/components/error_toast_dispatcher/index.test.tsx b/x-pack/plugins/security_solution/public/common/components/error_toast_dispatcher/index.test.tsx index b58ecbdd3349d..98be87c737d58 100644 --- a/x-pack/plugins/security_solution/public/common/components/error_toast_dispatcher/index.test.tsx +++ b/x-pack/plugins/security_solution/public/common/components/error_toast_dispatcher/index.test.tsx @@ -10,7 +10,6 @@ import React from 'react'; import { Provider } from 'react-redux'; import { - apolloClientObservable, mockGlobalState, SUB_PLUGINS_REDUCER, kibanaObservable, @@ -24,22 +23,10 @@ import { State } from '../../store/types'; describe('Error Toast Dispatcher', () => { const state: State = mockGlobalState; const { storage } = createSecuritySolutionStorageMock(); - let store = createStore( - state, - SUB_PLUGINS_REDUCER, - apolloClientObservable, - kibanaObservable, - storage - ); + let store = createStore(state, SUB_PLUGINS_REDUCER, kibanaObservable, storage); beforeEach(() => { - store = createStore( - state, - SUB_PLUGINS_REDUCER, - apolloClientObservable, - kibanaObservable, - storage - ); + store = createStore(state, SUB_PLUGINS_REDUCER, kibanaObservable, storage); }); describe('rendering', () => { diff --git a/x-pack/plugins/security_solution/public/common/components/event_details/alert_summary_view.tsx b/x-pack/plugins/security_solution/public/common/components/event_details/alert_summary_view.tsx index 091049b967f02..5578264152c39 100644 --- a/x-pack/plugins/security_solution/public/common/components/event_details/alert_summary_view.tsx +++ b/x-pack/plugins/security_solution/public/common/components/event_details/alert_summary_view.tsx @@ -10,10 +10,13 @@ import { EuiDescriptionList, EuiDescriptionListDescription, EuiDescriptionListTitle, + EuiSpacer, } from '@elastic/eui'; import { get, getOr } from 'lodash/fp'; import React, { useMemo } from 'react'; import styled from 'styled-components'; + +import * as i18n from './translations'; import { FormattedFieldValue } from '../../../timelines/components/timeline/body/renderers/formatted_field'; import { TimelineEventsDetailsItem } from '../../../../common/search_strategy'; import { BrowserFields } from '../../../../common/search_strategy/index_fields'; @@ -33,7 +36,6 @@ import { DESTINATION_IP_FIELD_NAME, SOURCE_IP_FIELD_NAME } from '../../../networ import { SummaryView } from './summary_view'; import { AlertSummaryRow, getSummaryColumns, SummaryRow } from './helpers'; import { useRuleAsync } from '../../../detections/containers/detection_engine/rules/use_rule_async'; -import * as i18n from './translations'; import { LineClamp } from '../line_clamp'; const StyledEuiDescriptionList = styled(EuiDescriptionList)` @@ -166,7 +168,8 @@ const AlertSummaryViewComponent: React.FC<{ data: TimelineEventsDetailsItem[]; eventId: string; timelineId: string; -}> = ({ browserFields, data, eventId, timelineId }) => { + title?: string; +}> = ({ browserFields, data, eventId, timelineId, title }) => { const summaryRows = useMemo(() => getSummaryRows({ browserFields, data, eventId, timelineId }), [ browserFields, data, @@ -184,7 +187,8 @@ const AlertSummaryViewComponent: React.FC<{ return ( <> - + + {maybeRule?.note && ( {i18n.INVESTIGATION_GUIDE} diff --git a/x-pack/plugins/security_solution/public/common/components/event_details/columns.tsx b/x-pack/plugins/security_solution/public/common/components/event_details/columns.tsx index a62b652492c5f..836a67441ef8a 100644 --- a/x-pack/plugins/security_solution/public/common/components/event_details/columns.tsx +++ b/x-pack/plugins/security_solution/public/common/components/event_details/columns.tsx @@ -21,7 +21,6 @@ import styled from 'styled-components'; import { onFocusReFocusDraggable } from '../accessibility/helpers'; import { BrowserFields } from '../../containers/source'; -import { ToStringArray } from '../../../graphql/types'; import { ColumnHeaderOptions } from '../../../timelines/store/timeline/model'; import { DragEffects } from '../drag_and_drop/draggable_wrapper'; import { DroppableWrapper } from '../drag_and_drop/droppable_wrapper'; @@ -175,7 +174,7 @@ export const getColumns = ({ name: i18n.VALUE, sortable: true, truncateText: false, - render: (values: ToStringArray | null | undefined, data: EventFieldsData) => ( + render: (values: string[] | null | undefined, data: EventFieldsData) => ( { + const mount = useMountAppended(); + const mockTheme = getMockTheme({ + eui: { + euiBreakpoints: { + l: '1200px', + }, + paddingSizes: { + m: '8px', + xl: '32px', + }, + }, + }); + + beforeEach(() => { + jest.clearAllMocks(); + }); + + test('renders correct items', () => { + const wrapper = mount( + + + + ); + expect(wrapper.find('[data-test-subj="empty-threat-details-view"]').exists()).toEqual(true); + }); + + test('renders link to docs', () => { + const wrapper = mount( + + + + ); + expect(wrapper.find('a').exists()).toEqual(true); + }); +}); diff --git a/x-pack/plugins/security_solution/public/common/components/event_details/empty_threat_details_view.tsx b/x-pack/plugins/security_solution/public/common/components/event_details/empty_threat_details_view.tsx new file mode 100644 index 0000000000000..c78df92dceb3c --- /dev/null +++ b/x-pack/plugins/security_solution/public/common/components/event_details/empty_threat_details_view.tsx @@ -0,0 +1,50 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import { EuiLink, EuiSpacer, EuiTitle } from '@elastic/eui'; +import React from 'react'; +import styled from 'styled-components'; +import * as i18n from './translations'; +import { useKibana } from '../../lib/kibana'; + +const EmptyThreatDetailsViewContainer = styled.div` + display: flex; + flex-direction: column; + align-items: center; +`; + +const Span = styled.span` + color: ${({ theme }) => theme.eui.euiColorDarkShade}; + line-height: 1.8em; + text-align: center; + padding: ${({ theme }) => `${theme.eui.paddingSizes.m} ${theme.eui.paddingSizes.xl}`}; +`; + +const EmptyThreatDetailsViewComponent: React.FC<{}> = () => { + const threatIntelDocsUrl = `${ + useKibana().services.docLinks.links.filebeat.base + }/filebeat-module-threatintel.html`; + + return ( + + + +

    {i18n.NO_ENRICHMENT_FOUND}

    +
    + + {i18n.IF_CTI_NOT_ENABLED} + + {i18n.CHECK_DOCS} + + +
    + ); +}; + +EmptyThreatDetailsViewComponent.displayName = 'EmptyThreatDetailsView'; + +export const EmptyThreatDetailsView = React.memo(EmptyThreatDetailsViewComponent); diff --git a/x-pack/plugins/security_solution/public/common/components/event_details/event_details.test.tsx b/x-pack/plugins/security_solution/public/common/components/event_details/event_details.test.tsx index e799df0fdd10d..0c7515fe75d86 100644 --- a/x-pack/plugins/security_solution/public/common/components/event_details/event_details.test.tsx +++ b/x-pack/plugins/security_solution/public/common/components/event_details/event_details.test.tsx @@ -13,7 +13,7 @@ import '../../mock/match_media'; import '../../mock/react_beautiful_dnd'; import { mockDetailItemData, mockDetailItemDataId, TestProviders } from '../../mock'; -import { EventDetails, EventsViewType, EventView, ThreatView } from './event_details'; +import { EventDetails, EventsViewType } from './event_details'; import { mockBrowserFields } from '../../containers/source/mock'; import { useMountAppended } from '../../utils/use_mount_appended'; import { mockAlertDetailsData } from './__mocks__'; @@ -32,8 +32,7 @@ describe('EventDetails', () => { onThreatViewSelected: jest.fn(), timelineTabType: TimelineTabs.query, timelineId: 'test', - eventView: EventsViewType.summaryView as EventView, - threatView: EventsViewType.threatSummaryView as ThreatView, + eventView: EventsViewType.summaryView, }; const alertsProps = { @@ -78,13 +77,14 @@ describe('EventDetails', () => { }); describe('alerts tabs', () => { - ['Summary', 'Table', 'JSON View'].forEach((tab) => { + ['Summary', 'Threat Intel', 'Table', 'JSON View'].forEach((tab) => { test(`it renders the ${tab} tab`, () => { + const expectedCopy = tab === 'Threat Intel' ? `${tab} (1)` : tab; expect( alertsWrapper .find('[data-test-subj="eventDetails"]') .find('[role="tablist"]') - .containsMatchingElement({tab}) + .containsMatchingElement({expectedCopy}) ).toBeTruthy(); }); }); @@ -99,27 +99,4 @@ describe('EventDetails', () => { ).toEqual('Summary'); }); }); - - describe('threat tabs', () => { - ['Threat Summary', 'Threat Details'].forEach((tab) => { - test(`it renders the ${tab} tab`, () => { - expect( - alertsWrapper - .find('[data-test-subj="threatDetails"]') - .find('[role="tablist"]') - .containsMatchingElement({tab}) - ).toBeTruthy(); - }); - }); - - test('the Summary tab is selected by default', () => { - expect( - alertsWrapper - .find('[data-test-subj="threatDetails"]') - .find('.euiTab-isSelected') - .first() - .text() - ).toEqual('Threat Summary'); - }); - }); }); diff --git a/x-pack/plugins/security_solution/public/common/components/event_details/event_details.tsx b/x-pack/plugins/security_solution/public/common/components/event_details/event_details.tsx index 0e4cf7f4ae2fe..91ebec72d3845 100644 --- a/x-pack/plugins/security_solution/public/common/components/event_details/event_details.tsx +++ b/x-pack/plugins/security_solution/public/common/components/event_details/event_details.tsx @@ -6,31 +6,37 @@ */ import { EuiTabbedContent, EuiTabbedContentTab, EuiSpacer } from '@elastic/eui'; -import React, { useCallback, useMemo } from 'react'; +import React, { useCallback, useMemo, useState } from 'react'; import styled from 'styled-components'; -import { BrowserFields } from '../../containers/source'; -import { TimelineEventsDetailsItem } from '../../../../common/search_strategy/timeline'; import { EventFieldsBrowser } from './event_fields_browser'; import { JsonView } from './json_view'; -import * as i18n from './translations'; -import { AlertSummaryView } from './alert_summary_view'; import { ThreatSummaryView } from './threat_summary_view'; import { ThreatDetailsView } from './threat_details_view'; +import * as i18n from './translations'; +import { AlertSummaryView } from './alert_summary_view'; +import { BrowserFields } from '../../containers/source'; +import { TimelineEventsDetailsItem } from '../../../../common/search_strategy/timeline'; import { TimelineTabs } from '../../../../common/types/timeline'; import { INDICATOR_DESTINATION_PATH } from '../../../../common/constants'; +import { getDataFromSourceHits } from '../../../../common/utils/field_formatters'; + +interface EventViewTab { + id: EventViewId; + name: string; + content: JSX.Element; +} -export type EventView = +export type EventViewId = | EventsViewType.tableView | EventsViewType.jsonView - | EventsViewType.summaryView; -export type ThreatView = EventsViewType.threatSummaryView | EventsViewType.threatDetailsView; + | EventsViewType.summaryView + | EventsViewType.threatIntelView; export enum EventsViewType { tableView = 'table-view', jsonView = 'json-view', summaryView = 'summary-view', - threatSummaryView = 'threat-summary-view', - threatDetailsView = 'threat-details-view', + threatIntelView = 'threat-intel-view', } interface Props { @@ -38,10 +44,6 @@ interface Props { data: TimelineEventsDetailsItem[]; id: string; isAlert: boolean; - eventView: EventView; - threatView: ThreatView; - onEventViewSelected: (selected: EventView) => void; - onThreatViewSelected: (selected: ThreatView) => void; timelineTabType: TimelineTabs | 'flyout'; timelineId: string; } @@ -56,7 +58,8 @@ const StyledEuiTabbedContent = styled(EuiTabbedContent)` display: flex; flex: 1; flex-direction: column; - overflow: scroll; + overflow: hidden; + overflow-y: auto; ::-webkit-scrollbar { -webkit-appearance: none; width: 7px; @@ -77,132 +80,125 @@ const TabContentWrapper = styled.div` const EventDetailsComponent: React.FC = ({ browserFields, data, - eventView, id, isAlert, - onEventViewSelected, - onThreatViewSelected, - threatView, timelineId, timelineTabType, }) => { - const handleEventTabClick = useCallback((e) => onEventViewSelected(e.id), [onEventViewSelected]); - const handleThreatTabClick = useCallback((e) => onThreatViewSelected(e.id), [ - onThreatViewSelected, - ]); - - const alerts = useMemo( - () => [ - { - id: EventsViewType.summaryView, - name: i18n.SUMMARY, - content: ( - <> - - - - ), - }, - ], - [data, id, browserFields, timelineId] - ); - const tabs: EuiTabbedContentTab[] = useMemo( - () => [ - ...(isAlert ? alerts : []), - { - id: EventsViewType.tableView, - name: i18n.TABLE, - content: ( - <> - - - - ), - }, - { - id: EventsViewType.jsonView, - 'data-test-subj': 'jsonViewTab', - name: i18n.JSON_VIEW, - content: ( - <> - - - - - - ), - }, - ], - [alerts, browserFields, data, id, isAlert, timelineId, timelineTabType] + const [selectedTabId, setSelectedTabId] = useState(EventsViewType.summaryView); + const handleTabClick = useCallback( + (tab: EuiTabbedContentTab) => setSelectedTabId(tab.id as EventViewId), + [setSelectedTabId] ); - const selectedEventTab = useMemo(() => tabs.find((t) => t.id === eventView) ?? tabs[0], [ - tabs, - eventView, - ]); + const threatData = useMemo(() => { + if (isAlert && data) { + const threatIndicator = data.find( + ({ field, originalValue }) => field === INDICATOR_DESTINATION_PATH && originalValue + ); + if (!threatIndicator) return []; + const { originalValue } = threatIndicator; + const values = Array.isArray(originalValue) ? originalValue : [originalValue]; + return values.map((value) => getDataFromSourceHits(JSON.parse(value))); + } + return []; + }, [data, isAlert]); + + const threatCount = useMemo(() => threatData.length, [threatData.length]); + + const summaryTab = useMemo( + () => + isAlert + ? { + id: EventsViewType.summaryView, + name: i18n.SUMMARY, + content: ( + <> + + {threatCount > 0 && } + + ), + } + : undefined, + [browserFields, data, id, isAlert, timelineId, threatCount] + ); - const isThreatPresent: boolean = useMemo( + const threatIntelTab = useMemo( () => - selectedEventTab.id === tabs[0].id && - isAlert && - data.some((item) => item.field === INDICATOR_DESTINATION_PATH), - [tabs, selectedEventTab, isAlert, data] + isAlert + ? { + id: EventsViewType.threatIntelView, + name: `${i18n.THREAT_INTEL} (${threatCount})`, + content: , + } + : undefined, + [isAlert, threatCount, threatData] ); - const threatTabs: EuiTabbedContentTab[] = useMemo(() => { - return isAlert && isThreatPresent - ? [ - { - id: EventsViewType.threatSummaryView, - name: i18n.THREAT_SUMMARY, - content: , - }, - { - id: EventsViewType.threatDetailsView, - name: i18n.THREAT_DETAILS, - content: , - }, - ] - : []; - }, [data, id, isAlert, timelineId, isThreatPresent]); - - const selectedThreatTab = useMemo( - () => threatTabs.find((t) => t.id === threatView) ?? threatTabs[0], - [threatTabs, threatView] + const tableTab = useMemo( + () => ({ + id: EventsViewType.tableView, + name: i18n.TABLE, + content: ( + <> + + + + ), + }), + [browserFields, data, id, timelineId, timelineTabType] ); + const jsonTab = useMemo( + () => ({ + id: EventsViewType.jsonView, + 'data-test-subj': 'jsonViewTab', + name: i18n.JSON_VIEW, + content: ( + <> + + + + + + ), + }), + [data] + ); + + const tabs = useMemo(() => { + return [summaryTab, threatIntelTab, tableTab, jsonTab].filter( + (tab: EventViewTab | undefined): tab is EventViewTab => !!tab + ); + }, [summaryTab, threatIntelTab, tableTab, jsonTab]); + + const selectedTab = useMemo(() => tabs.find((tab) => tab.id === selectedTabId), [ + tabs, + selectedTabId, + ]); + return ( - <> - - {isThreatPresent && ( - - )} - + ); }; diff --git a/x-pack/plugins/security_solution/public/common/components/event_details/helpers.tsx b/x-pack/plugins/security_solution/public/common/components/event_details/helpers.tsx index 67e67584849cc..dfbaadbeed7b1 100644 --- a/x-pack/plugins/security_solution/public/common/components/event_details/helpers.tsx +++ b/x-pack/plugins/security_solution/public/common/components/event_details/helpers.tsx @@ -22,7 +22,6 @@ import { DEFAULT_DATE_COLUMN_MIN_WIDTH, DEFAULT_COLUMN_MIN_WIDTH, } from '../../../timelines/components/timeline/body/constants'; -import { ToStringArray } from '../../../graphql/types'; import * as i18n from './translations'; @@ -50,7 +49,7 @@ export interface Item { field: JSX.Element; fieldId: string; type: string; - values: ToStringArray; + values: string[]; } export interface AlertSummaryRow { @@ -225,7 +224,7 @@ export const getSummaryColumns = ( field: 'title', truncateText: false, render: getTitle, - width: '120px', + width: '160px', name: '', }, { diff --git a/x-pack/plugins/security_solution/public/common/components/event_details/summary_view.tsx b/x-pack/plugins/security_solution/public/common/components/event_details/summary_view.tsx index 3b2c55e9a6b67..1dda40ae4b19d 100644 --- a/x-pack/plugins/security_solution/public/common/components/event_details/summary_view.tsx +++ b/x-pack/plugins/security_solution/public/common/components/event_details/summary_view.tsx @@ -5,7 +5,7 @@ * 2.0. */ -import { EuiInMemoryTable, EuiBasicTableColumn } from '@elastic/eui'; +import { EuiInMemoryTable, EuiBasicTableColumn, EuiTitle, EuiHorizontalRule } from '@elastic/eui'; import React from 'react'; import styled from 'styled-components'; @@ -27,18 +27,47 @@ const StyledEuiInMemoryTable = styled(EuiInMemoryTable as any)` } `; +const StyledEuiTitle = styled(EuiTitle)` + color: ${({ theme }) => theme.eui.euiColorDarkShade}; + text-transform: lowercase; + padding-top: ${({ theme }) => theme.eui.paddingSizes.s}; + h2 { + min-width: 120px; + } + hr { + max-width: 75%; + } +`; + +const FlexDiv = styled.div` + display: flex; + align-items: center; + justify-content: flex-start; +`; + export const SummaryViewComponent: React.FC<{ + title?: string; summaryColumns: Array>; summaryRows: SummaryRow[]; dataTestSubj?: string; -}> = ({ summaryColumns, summaryRows, dataTestSubj = 'summary-view' }) => { +}> = ({ summaryColumns, summaryRows, dataTestSubj = 'summary-view', title }) => { return ( - + <> + {title && ( + + +

    {title}

    + +
    +
    + )} + + ); }; diff --git a/x-pack/plugins/security_solution/public/common/components/event_details/threat_details_view.test.tsx b/x-pack/plugins/security_solution/public/common/components/event_details/threat_details_view.test.tsx index 81bffe9b66638..4b2f56a205042 100644 --- a/x-pack/plugins/security_solution/public/common/components/event_details/threat_details_view.test.tsx +++ b/x-pack/plugins/security_solution/public/common/components/event_details/threat_details_view.test.tsx @@ -8,8 +8,6 @@ import React from 'react'; import { ThreatDetailsView } from './threat_details_view'; -import { mockAlertDetailsData } from './__mocks__'; -import { TimelineEventsDetailsItem } from '../../../../common/search_strategy'; import { TestProviders } from '../../mock'; import { useMountAppended } from '../../utils/use_mount_appended'; @@ -20,11 +18,56 @@ jest.mock('../../../detections/containers/detection_engine/rules/use_rule_async' }; }); -const props = { - data: mockAlertDetailsData as TimelineEventsDetailsItem[], - eventId: '5d1d53da502f56aacc14c3cb5c669363d102b31f99822e5d369d4804ed370a31', - timelineId: 'detections-page', -}; +const mostRecentDate = '2021-04-25T18:17:00.000Z'; + +const threatData = [ + [ + { + category: 'matched', + field: 'matched.field', + isObjectArray: false, + originalValue: ['test_field_2'], + values: ['test_field_2'], + }, + { + category: 'first_seen', + field: 'first_seen', + isObjectArray: false, + originalValue: ['2019-04-25T18:17:00.000Z'], + values: ['2019-04-25T18:17:00.000Z'], + }, + { + category: 'event', + field: 'event.reference', + isObjectArray: false, + originalValue: ['https://test.com/'], + values: ['https://test.com/'], + }, + { + category: 'event', + field: 'event.url', + isObjectArray: false, + originalValue: ['https://test2.com/'], + values: ['https://test2.com/'], + }, + ], + [ + { + category: 'first_seen', + field: 'first_seen', + isObjectArray: false, + originalValue: [mostRecentDate], + values: [mostRecentDate], + }, + { + category: 'matched', + field: 'matched.field', + isObjectArray: false, + originalValue: ['test_field'], + values: ['test_field'], + }, + ], +]; describe('ThreatDetailsView', () => { const mount = useMountAppended(); @@ -36,9 +79,36 @@ describe('ThreatDetailsView', () => { test('render correct items', () => { const wrapper = mount( - + ); expect(wrapper.find('[data-test-subj="threat-details-view-0"]').exists()).toEqual(true); }); + + test('renders empty view if there are no items', () => { + const wrapper = mount( + + + + ); + expect(wrapper.find('[data-test-subj="empty-threat-details-view"]').exists()).toEqual(true); + }); + + test('renders link for event.url and event.reference', () => { + const wrapper = mount( + + + + ); + expect(wrapper.find('a').length).toEqual(2); + }); + + test('orders items by first_seen', () => { + const wrapper = mount( + + + + ); + expect(wrapper.find('.euiToolTipAnchor span').at(0).text()).toEqual(mostRecentDate); + }); }); diff --git a/x-pack/plugins/security_solution/public/common/components/event_details/threat_details_view.tsx b/x-pack/plugins/security_solution/public/common/components/event_details/threat_details_view.tsx index 0889986237442..0f577200b7b47 100644 --- a/x-pack/plugins/security_solution/public/common/components/event_details/threat_details_view.tsx +++ b/x-pack/plugins/security_solution/public/common/components/event_details/threat_details_view.tsx @@ -10,51 +10,50 @@ import { EuiFlexGroup, EuiFlexItem, EuiHorizontalRule, + EuiSpacer, EuiToolTip, + EuiLink, } from '@elastic/eui'; -import React, { useMemo } from 'react'; +import React from 'react'; -import { TimelineEventsDetailsItem } from '../../../../common/search_strategy'; +import { isEmpty } from 'fp-ts/Array'; import { SummaryView } from './summary_view'; import { getSummaryColumns, SummaryRow, ThreatDetailsRow } from './helpers'; -import { getDataFromSourceHits } from '../../../../common/utils/field_formatters'; +import { TimelineEventsDetailsItem } from '../../../../common/search_strategy'; import { INDICATOR_DESTINATION_PATH } from '../../../../common/constants'; +import { + FIRSTSEEN, + INDICATOR_EVENT_URL, + INDICATOR_REFERENCE, +} from '../../../../common/cti/constants'; +import { EmptyThreatDetailsView } from './empty_threat_details_view'; const ThreatDetailsDescription: React.FC = ({ fieldName, value, -}) => ( - - - {fieldName} - - - } - > +}) => { + const tooltipChild = [INDICATOR_EVENT_URL, INDICATOR_REFERENCE].some( + (field) => field === fieldName + ) ? ( + + {value} + + ) : ( {value} - -); - -const getSummaryRowsArray = ({ - data, -}: { - data: TimelineEventsDetailsItem[]; -}): ThreatDetailsRow[][] => { - if (!data) return [[]]; - const threatInfo = data.find( - ({ field, originalValue }) => field === INDICATOR_DESTINATION_PATH && originalValue ); - if (!threatInfo) return [[]]; - const { originalValue } = threatInfo; - const values = Array.isArray(originalValue) ? originalValue : [originalValue]; - return values.map((value) => - getDataFromSourceHits(JSON.parse(value)).map((threatInfoItem) => ({ - title: threatInfoItem.field.replace(`${INDICATOR_DESTINATION_PATH}.`, ''), - description: { fieldName: threatInfoItem.field, value: threatInfoItem.originalValue }, - })) + return ( + + + {fieldName} + + + } + > + {tooltipChild} + ); }; @@ -62,17 +61,51 @@ const summaryColumns: Array> = getSummaryColumns ThreatDetailsDescription ); +const getISOStringFromThreatDataItem = (threatDataItem: TimelineEventsDetailsItem[]) => { + const firstSeen = threatDataItem.find( + (item: TimelineEventsDetailsItem) => item.field === FIRSTSEEN + ); + if (firstSeen) { + const { originalValue } = firstSeen; + const firstSeenValue = Array.isArray(originalValue) ? originalValue[0] : originalValue; + if (!Number.isNaN(Date.parse(firstSeenValue))) { + return firstSeenValue; + } + } + return new Date(-1).toString(); +}; + +const getThreatDetailsRowsArray = (threatData: TimelineEventsDetailsItem[][]) => + threatData + .sort( + (a, b) => + Date.parse(getISOStringFromThreatDataItem(b)) - + Date.parse(getISOStringFromThreatDataItem(a)) + ) + .map((items) => + items.map(({ field, originalValue }) => ({ + title: field, + description: { + fieldName: `${INDICATOR_DESTINATION_PATH}.${field}`, + value: Array.isArray(originalValue) ? originalValue[0] : originalValue, + }, + })) + ); + const ThreatDetailsViewComponent: React.FC<{ - data: TimelineEventsDetailsItem[]; -}> = ({ data }) => { - const summaryRowsArray = useMemo(() => getSummaryRowsArray({ data }), [data]); - return ( + threatData: TimelineEventsDetailsItem[][]; +}> = ({ threatData }) => { + const threatDetailsRowsArray = getThreatDetailsRowsArray(threatData); + return isEmpty(threatDetailsRowsArray) || isEmpty(threatDetailsRowsArray[0]) ? ( + + ) : ( <> - {summaryRowsArray.map((summaryRows, index, arr) => { + {threatDetailsRowsArray.map((summaryRows, index, arr) => { const key = summaryRows.find((threat) => threat.title === 'matched.id')?.description .value[0]; return ( -
    +
    + {index === 0 && } { return { diff --git a/x-pack/plugins/security_solution/public/common/components/event_details/threat_summary_view.tsx b/x-pack/plugins/security_solution/public/common/components/event_details/threat_summary_view.tsx index 96ae2071c449b..67b09e8e59699 100644 --- a/x-pack/plugins/security_solution/public/common/components/event_details/threat_summary_view.tsx +++ b/x-pack/plugins/security_solution/public/common/components/event_details/threat_summary_view.tsx @@ -5,16 +5,39 @@ * 2.0. */ -import { EuiBasicTableColumn } from '@elastic/eui'; -import React, { useMemo } from 'react'; +import { EuiBasicTableColumn, EuiSpacer } from '@elastic/eui'; +import React from 'react'; -import { TimelineEventsDetailsItem } from '../../../../common/search_strategy'; -import { FormattedFieldValue } from '../../../timelines/components/timeline/body/renderers/formatted_field'; -import { BrowserFields } from '../../../../common/search_strategy/index_fields'; +import * as i18n from './translations'; import { SummaryView } from './summary_view'; import { getSummaryColumns, SummaryRow, ThreatSummaryRow } from './helpers'; +import { FormattedFieldValue } from '../../../timelines/components/timeline/body/renderers/formatted_field'; +import { TimelineEventsDetailsItem } from '../../../../common/search_strategy/timeline'; +import { SORTED_THREAT_SUMMARY_FIELDS } from '../../../../common/cti/constants'; import { INDICATOR_DESTINATION_PATH } from '../../../../common/constants'; +const getThreatSummaryRows = ( + data: TimelineEventsDetailsItem[], + timelineId: string, + eventId: string +) => + SORTED_THREAT_SUMMARY_FIELDS.map((threatSummaryField) => { + const item = data.find(({ field }) => field === threatSummaryField); + if (item) { + const { field, originalValue } = item; + return { + title: field.replace(`${INDICATOR_DESTINATION_PATH}.`, ''), + description: { + values: Array.isArray(originalValue) ? originalValue : [originalValue], + contextId: timelineId, + eventId, + fieldName: field, + }, + }; + } + return null; + }).filter((item: ThreatSummaryRow | null): item is ThreatSummaryRow => !!item); + const getDescription = ({ contextId, eventId, @@ -34,56 +57,22 @@ const getDescription = ({ ); -const getSummaryRows = ({ - data, - timelineId: contextId, - eventId, -}: { - data: TimelineEventsDetailsItem[]; - browserFields?: BrowserFields; - timelineId: string; - eventId: string; -}) => { - if (!data) return []; - return data.reduce((acc, { field, originalValue }) => { - if (field.startsWith(`${INDICATOR_DESTINATION_PATH}.`) && originalValue) { - return [ - ...acc, - { - title: field.replace(`${INDICATOR_DESTINATION_PATH}.`, ''), - description: { - values: Array.isArray(originalValue) ? originalValue : [originalValue], - contextId, - eventId, - fieldName: field, - }, - }, - ]; - } - return acc; - }, []); -}; - const summaryColumns: Array> = getSummaryColumns(getDescription); const ThreatSummaryViewComponent: React.FC<{ data: TimelineEventsDetailsItem[]; - eventId: string; timelineId: string; -}> = ({ data, eventId, timelineId }) => { - const summaryRows = useMemo(() => getSummaryRows({ data, eventId, timelineId }), [ - data, - eventId, - timelineId, - ]); - - return ( + eventId: string; +}> = ({ data, timelineId, eventId }) => ( + <> + - ); -}; + +); export const ThreatSummaryView = React.memo(ThreatSummaryViewComponent); diff --git a/x-pack/plugins/security_solution/public/common/components/event_details/translations.ts b/x-pack/plugins/security_solution/public/common/components/event_details/translations.ts index 73a2e0d57307c..1ff88d9c2018b 100644 --- a/x-pack/plugins/security_solution/public/common/components/event_details/translations.ts +++ b/x-pack/plugins/security_solution/public/common/components/event_details/translations.ts @@ -11,12 +11,35 @@ export const SUMMARY = i18n.translate('xpack.securitySolution.alertDetails.summa defaultMessage: 'Summary', }); +export const ALERT_SUMMARY = i18n.translate('xpack.securitySolution.alertDetails.alertSummary', { + defaultMessage: 'Alert Summary', +}); + +export const THREAT_INTEL = i18n.translate('xpack.securitySolution.alertDetails.threatIntel', { + defaultMessage: 'Threat Intel', +}); + export const THREAT_SUMMARY = i18n.translate('xpack.securitySolution.alertDetails.threatSummary', { defaultMessage: 'Threat Summary', }); -export const THREAT_DETAILS = i18n.translate('xpack.securitySolution.alertDetails.threatDetails', { - defaultMessage: 'Threat Details', +export const NO_ENRICHMENT_FOUND = i18n.translate( + 'xpack.securitySolution.alertDetails.noEnrichmentFound', + { + defaultMessage: 'No Threat Intel Enrichment Found', + } +); + +export const IF_CTI_NOT_ENABLED = i18n.translate( + 'xpack.securitySolution.alertDetails.ifCtiNotEnabled', + { + defaultMessage: + "If you haven't enabled any threat intelligence sources and want to learn more about this capability, ", + } +); + +export const CHECK_DOCS = i18n.translate('xpack.securitySolution.alertDetails.checkDocs', { + defaultMessage: 'please check out our documentation.', }); export const INVESTIGATION_GUIDE = i18n.translate( diff --git a/x-pack/plugins/security_solution/public/common/components/generic_downloader/index.tsx b/x-pack/plugins/security_solution/public/common/components/generic_downloader/index.tsx index fa75b5d181856..2a2e425702755 100644 --- a/x-pack/plugins/security_solution/public/common/components/generic_downloader/index.tsx +++ b/x-pack/plugins/security_solution/public/common/components/generic_downloader/index.tsx @@ -12,6 +12,7 @@ import * as i18n from './translations'; import { ExportDocumentsProps } from '../../../detections/containers/detection_engine/rules'; import { useStateToaster, errorToToaster } from '../toasters'; +import { TimelineErrorResponse } from '../../../../common/types/timeline'; const InvisibleAnchor = styled.a` display: none; @@ -22,7 +23,7 @@ export type ExportSelectedData = ({ filename, ids, signal, -}: ExportDocumentsProps) => Promise; +}: ExportDocumentsProps) => Promise; export interface GenericDownloaderProps { filename: string; diff --git a/x-pack/plugins/security_solution/public/common/components/inspect/index.test.tsx b/x-pack/plugins/security_solution/public/common/components/inspect/index.test.tsx index 2a7b7811a2de8..6f3e28469a949 100644 --- a/x-pack/plugins/security_solution/public/common/components/inspect/index.test.tsx +++ b/x-pack/plugins/security_solution/public/common/components/inspect/index.test.tsx @@ -11,7 +11,6 @@ import React from 'react'; import { TestProviders, mockGlobalState, - apolloClientObservable, SUB_PLUGINS_REDUCER, kibanaObservable, createSecuritySolutionStorageMock, @@ -35,25 +34,13 @@ describe('Inspect Button', () => { state: state.inputs, }; - let store = createStore( - state, - SUB_PLUGINS_REDUCER, - apolloClientObservable, - kibanaObservable, - storage - ); + let store = createStore(state, SUB_PLUGINS_REDUCER, kibanaObservable, storage); describe('Render', () => { beforeEach(() => { const myState = cloneDeep(state); myState.inputs = upsertQuery(newQuery); - store = createStore( - myState, - SUB_PLUGINS_REDUCER, - apolloClientObservable, - kibanaObservable, - storage - ); + store = createStore(myState, SUB_PLUGINS_REDUCER, kibanaObservable, storage); }); test('Eui Empty Button', () => { const wrapper = mount( @@ -157,13 +144,7 @@ describe('Inspect Button', () => { response: ['my response'], }; myState.inputs = upsertQuery(myQuery); - store = createStore( - myState, - SUB_PLUGINS_REDUCER, - apolloClientObservable, - kibanaObservable, - storage - ); + store = createStore(myState, SUB_PLUGINS_REDUCER, kibanaObservable, storage); }); test('Open Inspect Modal', () => { const wrapper = mount( diff --git a/x-pack/plugins/security_solution/public/common/components/ml/criteria/get_criteria_from_network_type.test.ts b/x-pack/plugins/security_solution/public/common/components/ml/criteria/get_criteria_from_network_type.test.ts index e2b5a131a7954..e5d395561cc0a 100644 --- a/x-pack/plugins/security_solution/public/common/components/ml/criteria/get_criteria_from_network_type.test.ts +++ b/x-pack/plugins/security_solution/public/common/components/ml/criteria/get_criteria_from_network_type.test.ts @@ -7,7 +7,7 @@ import { getCriteriaFromNetworkType } from './get_criteria_from_network_type'; import { NetworkType } from '../../../../network/store/model'; -import { FlowTarget } from '../../../../graphql/types'; +import { FlowTarget } from '../../../../../common/search_strategy'; describe('get_criteria_from_network_type', () => { test('returns network names from criteria if the network type is details and it is source', () => { diff --git a/x-pack/plugins/security_solution/public/common/components/ml/criteria/get_criteria_from_network_type.ts b/x-pack/plugins/security_solution/public/common/components/ml/criteria/get_criteria_from_network_type.ts index 0bc42690f67bd..84fd7bd9d42d8 100644 --- a/x-pack/plugins/security_solution/public/common/components/ml/criteria/get_criteria_from_network_type.ts +++ b/x-pack/plugins/security_solution/public/common/components/ml/criteria/get_criteria_from_network_type.ts @@ -7,7 +7,7 @@ import { CriteriaFields } from '../types'; import { NetworkType } from '../../../../network/store/model'; -import { FlowTarget } from '../../../../graphql/types'; +import { FlowTarget } from '../../../../../common/search_strategy'; export const getCriteriaFromNetworkType = ( type: NetworkType, diff --git a/x-pack/plugins/security_solution/public/common/components/ml/criteria/network_to_criteria.test.ts b/x-pack/plugins/security_solution/public/common/components/ml/criteria/network_to_criteria.test.ts index 16e4150845b70..f9122038e989e 100644 --- a/x-pack/plugins/security_solution/public/common/components/ml/criteria/network_to_criteria.test.ts +++ b/x-pack/plugins/security_solution/public/common/components/ml/criteria/network_to_criteria.test.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { FlowTarget } from '../../../../graphql/types'; +import { FlowTarget } from '../../../../../common/search_strategy'; import { CriteriaFields } from '../types'; import { networkToCriteria } from './network_to_criteria'; diff --git a/x-pack/plugins/security_solution/public/common/components/ml/criteria/network_to_criteria.ts b/x-pack/plugins/security_solution/public/common/components/ml/criteria/network_to_criteria.ts index 72828be7e4877..10a2606a7545e 100644 --- a/x-pack/plugins/security_solution/public/common/components/ml/criteria/network_to_criteria.ts +++ b/x-pack/plugins/security_solution/public/common/components/ml/criteria/network_to_criteria.ts @@ -5,8 +5,8 @@ * 2.0. */ +import { FlowTarget } from '../../../../../common/search_strategy'; import { CriteriaFields } from '../types'; -import { FlowTarget } from '../../../../graphql/types'; export const networkToCriteria = (ip: string, flowTarget: FlowTarget): CriteriaFields[] => { if (flowTarget === FlowTarget.source) { diff --git a/x-pack/plugins/security_solution/public/common/components/ml/tables/get_anomalies_network_table_columns.tsx b/x-pack/plugins/security_solution/public/common/components/ml/tables/get_anomalies_network_table_columns.tsx index a2741331756ac..bc383ccefa453 100644 --- a/x-pack/plugins/security_solution/public/common/components/ml/tables/get_anomalies_network_table_columns.tsx +++ b/x-pack/plugins/security_solution/public/common/components/ml/tables/get_anomalies_network_table_columns.tsx @@ -24,7 +24,7 @@ import { ExplorerLink } from '../links/create_explorer_link'; import { FormattedRelativePreferenceDate } from '../../formatted_date'; import { NetworkType } from '../../../../network/store/model'; import { escapeDataProviderId } from '../../drag_and_drop/helpers'; -import { FlowTarget } from '../../../../graphql/types'; +import { FlowTarget } from '../../../../../common/search_strategy'; export const getAnomaliesNetworkTableColumns = ( startDate: string, diff --git a/x-pack/plugins/security_solution/public/common/components/ml/tables/network_equality.test.ts b/x-pack/plugins/security_solution/public/common/components/ml/tables/network_equality.test.ts index 4ab2b8cf44a0e..dd85d9fedab01 100644 --- a/x-pack/plugins/security_solution/public/common/components/ml/tables/network_equality.test.ts +++ b/x-pack/plugins/security_solution/public/common/components/ml/tables/network_equality.test.ts @@ -8,7 +8,7 @@ import { networkEquality } from './network_equality'; import { AnomaliesNetworkTableProps } from '../types'; import { NetworkType } from '../../../../network/store/model'; -import { FlowTarget } from '../../../../graphql/types'; +import { FlowTarget } from '../../../../../common/search_strategy'; describe('network_equality', () => { test('it returns true if start and end date are equal', () => { diff --git a/x-pack/plugins/security_solution/public/common/components/ml/types.ts b/x-pack/plugins/security_solution/public/common/components/ml/types.ts index 51da87e571e52..494c8a522ffac 100644 --- a/x-pack/plugins/security_solution/public/common/components/ml/types.ts +++ b/x-pack/plugins/security_solution/public/common/components/ml/types.ts @@ -6,10 +6,10 @@ */ import { Influencer } from '../../../../../ml/public'; +import { FlowTarget } from '../../../../common/search_strategy'; import { HostsType } from '../../../hosts/store/model'; import { NetworkType } from '../../../network/store/model'; -import { FlowTarget } from '../../../graphql/types'; export interface Source { job_id: string; diff --git a/x-pack/plugins/security_solution/public/common/components/ml_popover/ml_modules.tsx b/x-pack/plugins/security_solution/public/common/components/ml_popover/ml_modules.tsx index ebf726ae9b8ce..8dac6234f19a8 100644 --- a/x-pack/plugins/security_solution/public/common/components/ml_popover/ml_modules.tsx +++ b/x-pack/plugins/security_solution/public/common/components/ml_popover/ml_modules.tsx @@ -18,5 +18,6 @@ export const mlModules: string[] = [ 'siem_winlogbeat', 'siem_winlogbeat_auth', 'security_linux', + 'security_network', 'security_windows', ]; diff --git a/x-pack/plugins/security_solution/public/common/components/paginated_table/helpers.ts b/x-pack/plugins/security_solution/public/common/components/paginated_table/helpers.ts index 8c8f8d0acebc0..1e7b1c749c004 100644 --- a/x-pack/plugins/security_solution/public/common/components/paginated_table/helpers.ts +++ b/x-pack/plugins/security_solution/public/common/components/paginated_table/helpers.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { PaginationInputPaginated } from '../../../graphql/types'; +import { PaginationInputPaginated } from '../../../../common/search_strategy'; export const generateTablePaginationOptions = ( activePage: number, diff --git a/x-pack/plugins/security_solution/public/common/components/paginated_table/index.test.tsx b/x-pack/plugins/security_solution/public/common/components/paginated_table/index.test.tsx index 3439bb0a7ddb3..64c3584bc668c 100644 --- a/x-pack/plugins/security_solution/public/common/components/paginated_table/index.test.tsx +++ b/x-pack/plugins/security_solution/public/common/components/paginated_table/index.test.tsx @@ -9,12 +9,12 @@ import { mount, shallow } from 'enzyme'; import React from 'react'; import { DEFAULT_MAX_TABLE_QUERY_SIZE } from '../../../../common/constants'; -import { Direction } from '../../../graphql/types'; import { BasicTableProps, PaginatedTable } from './index'; import { getHostsColumns, mockData, rowItems, sortedHosts } from './index.mock'; import { ThemeProvider } from 'styled-components'; import { getMockTheme } from '../../lib/kibana/kibana_react.mock'; +import { Direction } from '../../../../common/search_strategy'; jest.mock('react', () => { const r = jest.requireActual('react'); diff --git a/x-pack/plugins/security_solution/public/common/components/sourcerer/index.test.tsx b/x-pack/plugins/security_solution/public/common/components/sourcerer/index.test.tsx index 3729f9dcdf68b..e8f382a5050d8 100644 --- a/x-pack/plugins/security_solution/public/common/components/sourcerer/index.test.tsx +++ b/x-pack/plugins/security_solution/public/common/components/sourcerer/index.test.tsx @@ -12,7 +12,6 @@ import { Sourcerer } from './index'; import { DEFAULT_INDEX_PATTERN } from '../../../../common/constants'; import { sourcererActions, sourcererModel } from '../../store/sourcerer'; import { - apolloClientObservable, createSecuritySolutionStorageMock, kibanaObservable, mockGlobalState, @@ -53,22 +52,10 @@ describe('Sourcerer component', () => { }); const state: State = mockGlobalState; const { storage } = createSecuritySolutionStorageMock(); - let store = createStore( - state, - SUB_PLUGINS_REDUCER, - apolloClientObservable, - kibanaObservable, - storage - ); + let store = createStore(state, SUB_PLUGINS_REDUCER, kibanaObservable, storage); beforeEach(() => { - store = createStore( - state, - SUB_PLUGINS_REDUCER, - apolloClientObservable, - kibanaObservable, - storage - ); + store = createStore(state, SUB_PLUGINS_REDUCER, kibanaObservable, storage); }); // Using props callback instead of simulating clicks, @@ -100,13 +87,7 @@ describe('Sourcerer component', () => { }, }; - store = createStore( - state2, - SUB_PLUGINS_REDUCER, - apolloClientObservable, - kibanaObservable, - storage - ); + store = createStore(state2, SUB_PLUGINS_REDUCER, kibanaObservable, storage); const wrapper = mount( @@ -154,7 +135,6 @@ describe('Sourcerer component', () => { }, }, SUB_PLUGINS_REDUCER, - apolloClientObservable, kibanaObservable, storage ); @@ -185,7 +165,6 @@ describe('Sourcerer component', () => { }, }, SUB_PLUGINS_REDUCER, - apolloClientObservable, kibanaObservable, storage ); @@ -209,7 +188,6 @@ describe('Sourcerer component', () => { }, }, SUB_PLUGINS_REDUCER, - apolloClientObservable, kibanaObservable, storage ); @@ -251,7 +229,6 @@ describe('Sourcerer component', () => { }, }, SUB_PLUGINS_REDUCER, - apolloClientObservable, kibanaObservable, storage ); diff --git a/x-pack/plugins/security_solution/public/common/components/stat_items/index.test.tsx b/x-pack/plugins/security_solution/public/common/components/stat_items/index.test.tsx index 4c4cc1f838a50..e2961de91c448 100644 --- a/x-pack/plugins/security_solution/public/common/components/stat_items/index.test.tsx +++ b/x-pack/plugins/security_solution/public/common/components/stat_items/index.test.tsx @@ -31,7 +31,6 @@ import { mockNarrowDateRange, } from '../../../network/components/kpi_network/mock'; import { - apolloClientObservable, createSecuritySolutionStorageMock, kibanaObservable, mockGlobalState, @@ -60,13 +59,7 @@ describe('Stat Items Component', () => { const mockTheme = getMockTheme({ eui: { euiColorMediumShade: '#ece' } }); const state: State = mockGlobalState; const { storage } = createSecuritySolutionStorageMock(); - const store = createStore( - state, - SUB_PLUGINS_REDUCER, - apolloClientObservable, - kibanaObservable, - storage - ); + const store = createStore(state, SUB_PLUGINS_REDUCER, kibanaObservable, storage); describe.each([ [ diff --git a/x-pack/plugins/security_solution/public/common/components/super_date_picker/index.test.tsx b/x-pack/plugins/security_solution/public/common/components/super_date_picker/index.test.tsx index 5af5b81c75cd6..7cc0b80b51f80 100644 --- a/x-pack/plugins/security_solution/public/common/components/super_date_picker/index.test.tsx +++ b/x-pack/plugins/security_solution/public/common/components/super_date_picker/index.test.tsx @@ -12,7 +12,6 @@ import { Provider as ReduxStoreProvider } from 'react-redux'; import { DEFAULT_TIMEPICKER_QUICK_RANGES } from '../../../../common/constants'; import { useUiSetting$ } from '../../lib/kibana'; import { - apolloClientObservable, mockGlobalState, SUB_PLUGINS_REDUCER, kibanaObservable, @@ -83,23 +82,11 @@ describe('SIEM Super Date Picker', () => { describe('#SuperDatePicker', () => { const state: State = mockGlobalState; const { storage } = createSecuritySolutionStorageMock(); - let store = createStore( - state, - SUB_PLUGINS_REDUCER, - apolloClientObservable, - kibanaObservable, - storage - ); + let store = createStore(state, SUB_PLUGINS_REDUCER, kibanaObservable, storage); beforeEach(() => { jest.clearAllMocks(); - store = createStore( - state, - SUB_PLUGINS_REDUCER, - apolloClientObservable, - kibanaObservable, - storage - ); + store = createStore(state, SUB_PLUGINS_REDUCER, kibanaObservable, storage); mockUseUiSetting$.mockImplementation((key, defaultValue) => { const useUiSetting$Mock = createUseUiSetting$Mock(); diff --git a/x-pack/plugins/security_solution/public/common/components/top_n/index.test.tsx b/x-pack/plugins/security_solution/public/common/components/top_n/index.test.tsx index 0b5e07488ff2a..005602738f376 100644 --- a/x-pack/plugins/security_solution/public/common/components/top_n/index.test.tsx +++ b/x-pack/plugins/security_solution/public/common/components/top_n/index.test.tsx @@ -11,7 +11,6 @@ import { waitFor } from '@testing-library/react'; import '../../mock/match_media'; import { mockBrowserFields } from '../../containers/source/mock'; import { - apolloClientObservable, mockGlobalState, TestProviders, SUB_PLUGINS_REDUCER, @@ -157,13 +156,7 @@ const state: State = { }; const { storage } = createSecuritySolutionStorageMock(); -const store = createStore( - state, - SUB_PLUGINS_REDUCER, - apolloClientObservable, - kibanaObservable, - storage -); +const store = createStore(state, SUB_PLUGINS_REDUCER, kibanaObservable, storage); let testProps = { browserFields: mockBrowserFields, diff --git a/x-pack/plugins/security_solution/public/common/components/url_state/initialize_redux_by_url.tsx b/x-pack/plugins/security_solution/public/common/components/url_state/initialize_redux_by_url.tsx index 56a6dd089cf05..a2d5076031328 100644 --- a/x-pack/plugins/security_solution/public/common/components/url_state/initialize_redux_by_url.tsx +++ b/x-pack/plugins/security_solution/public/common/components/url_state/initialize_redux_by_url.tsx @@ -29,7 +29,6 @@ import { SecurityPageName } from '../../../../common/constants'; export const dispatchSetInitialStateFromUrl = ( dispatch: Dispatch ): DispatchSetInitialStateFromUrl => ({ - apolloClient, detailName, filterManager, indexPattern, @@ -99,7 +98,6 @@ export const dispatchSetInitialStateFromUrl = ( if (timeline != null && timeline.id !== '') { queryTimelineById({ activeTimelineTab: timeline.activeTab, - apolloClient, duplicate: false, graphEventId: timeline.graphEventId, timelineId: timeline.id, diff --git a/x-pack/plugins/security_solution/public/common/components/url_state/types.ts b/x-pack/plugins/security_solution/public/common/components/url_state/types.ts index 8e41514d416ec..1a8d512d211e6 100644 --- a/x-pack/plugins/security_solution/public/common/components/url_state/types.ts +++ b/x-pack/plugins/security_solution/public/common/components/url_state/types.ts @@ -5,7 +5,6 @@ * 2.0. */ -import ApolloClient from 'apollo-client'; import * as H from 'history'; import { ActionCreator } from 'typescript-fsa'; import { @@ -148,7 +147,6 @@ export interface UrlStateToRedux { } export interface SetInitialStateFromUrl { - apolloClient: ApolloClient | ApolloClient<{}> | undefined; detailName: string | undefined; filterManager: FilterManager; indexPattern: IIndexPattern | undefined; @@ -160,7 +158,6 @@ export interface SetInitialStateFromUrl { } export type DispatchSetInitialStateFromUrl = ({ - apolloClient, detailName, indexPattern, pageName, diff --git a/x-pack/plugins/security_solution/public/common/components/url_state/use_url_state.tsx b/x-pack/plugins/security_solution/public/common/components/url_state/use_url_state.tsx index 84f74434cbcd0..7785fa6af2569 100644 --- a/x-pack/plugins/security_solution/public/common/components/url_state/use_url_state.tsx +++ b/x-pack/plugins/security_solution/public/common/components/url_state/use_url_state.tsx @@ -10,7 +10,6 @@ import { useEffect, useRef, useState } from 'react'; import deepEqual from 'fast-deep-equal'; import { useKibana } from '../../lib/kibana'; -import { useApolloClient } from '../../utils/apollo_context'; import { CONSTANTS, UrlStateType } from './constants'; import { getQueryStringFromLocation, @@ -70,7 +69,6 @@ export const useUrlStateHooks = ({ urlState, }: UrlStateContainerPropTypes) => { const [isInitializing, setIsInitializing] = useState(true); - const apolloClient = useApolloClient(); const { filterManager, savedQueries } = useKibana().services.data.query; const prevProps = usePrevious({ pathName, pageName, urlState }); @@ -161,7 +159,6 @@ export const useUrlStateHooks = ({ }); setInitialStateFromUrl({ - apolloClient, detailName, filterManager, indexPattern, diff --git a/x-pack/plugins/security_solution/public/common/containers/anomalies/anomalies_query_tab_body/types.ts b/x-pack/plugins/security_solution/public/common/containers/anomalies/anomalies_query_tab_body/types.ts index a50894ad278f3..2d3bb00501da5 100644 --- a/x-pack/plugins/security_solution/public/common/containers/anomalies/anomalies_query_tab_body/types.ts +++ b/x-pack/plugins/security_solution/public/common/containers/anomalies/anomalies_query_tab_body/types.ts @@ -9,9 +9,9 @@ import { ESTermQuery } from '../../../../../common/typed_json'; import { NarrowDateRange } from '../../../components/ml/types'; import { UpdateDateRange } from '../../../components/charts/common'; import { GlobalTimeArgs } from '../../use_global_time'; -import { FlowTarget } from '../../../../graphql/types'; import { HostsType } from '../../../../hosts/store/model'; import { NetworkType } from '../../../../network/store//model'; +import { FlowTarget } from '../../../../../common/search_strategy'; interface QueryTabBodyProps { type: HostsType | NetworkType; diff --git a/x-pack/plugins/security_solution/public/common/containers/anomalies/anomalies_query_tab_body/utils.ts b/x-pack/plugins/security_solution/public/common/containers/anomalies/anomalies_query_tab_body/utils.ts index ed0be60f22516..9a9b5b13137e6 100644 --- a/x-pack/plugins/security_solution/public/common/containers/anomalies/anomalies_query_tab_body/utils.ts +++ b/x-pack/plugins/security_solution/public/common/containers/anomalies/anomalies_query_tab_body/utils.ts @@ -8,9 +8,9 @@ import deepmerge from 'deepmerge'; import { MlSummaryJob } from '../../../../../../ml/public'; +import { FlowTarget } from '../../../../../common/search_strategy'; import { ESTermQuery } from '../../../../../common/typed_json'; import { createFilter } from '../../helpers'; -import { FlowTarget } from '../../../../graphql/types'; export const getAnomaliesFilterQuery = ( filterQuery: string | ESTermQuery | undefined, diff --git a/x-pack/plugins/security_solution/public/common/containers/errors/index.test.tsx b/x-pack/plugins/security_solution/public/common/containers/errors/index.test.tsx deleted file mode 100644 index 822c936206333..0000000000000 --- a/x-pack/plugins/security_solution/public/common/containers/errors/index.test.tsx +++ /dev/null @@ -1,108 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. - */ - -import { reTryOneTimeOnErrorHandler, errorLinkHandler } from '.'; -import { ServerError } from 'apollo-link-http-common'; -import { Operation } from 'apollo-link'; -import { GraphQLError } from 'graphql'; -import * as store from '../../store'; -import { onError } from 'apollo-link-error'; - -const mockDispatch = jest.fn(); -jest.mock('apollo-link-error'); -jest.mock('../../store'); -(store.getStore as jest.Mock).mockReturnValue({ dispatch: mockDispatch }); - -describe('errorLinkHandler', () => { - const mockGraphQLErrors: GraphQLError = { - message: 'GraphQLError', - } as GraphQLError; - const mockNetworkError: ServerError = { - result: {}, - statusCode: 503, - name: '', - message: 'error', - response: { - ok: false, - } as Response, - }; - const mockOperation: Operation = {} as Operation; - const mockForward = jest.fn(); - - afterEach(() => { - mockDispatch.mockClear(); - }); - - test('it should display error if graphQLErrors exist', () => { - errorLinkHandler({ - graphQLErrors: [mockGraphQLErrors], - operation: mockOperation, - forward: mockForward, - }); - - expect(store.getStore).toBeCalled(); - expect(mockDispatch.mock.calls.length).toBe(1); - }); - - test('it should display error if networkError exist', () => { - errorLinkHandler({ - networkError: mockNetworkError, - operation: mockOperation, - forward: mockForward, - }); - - expect(store.getStore).toBeCalled(); - expect(mockDispatch.mock.calls.length).toBe(1); - }); -}); - -describe('errorLink', () => { - test('onError should be called with errorLinkHandler', () => { - expect(onError).toHaveBeenCalledWith(errorLinkHandler); - }); -}); - -describe('reTryOneTimeOnErrorHandler', () => { - const mockNetworkError: ServerError = { - result: {}, - statusCode: 503, - name: '', - message: 'error', - response: { - ok: false, - } as Response, - }; - const mockOperation: Operation = {} as Operation; - const mockForward = jest.fn(); - - afterEach(() => { - mockForward.mockClear(); - }); - test('it should retry only if network status code is 503', () => { - reTryOneTimeOnErrorHandler({ - networkError: mockNetworkError, - operation: mockOperation, - forward: mockForward, - }); - expect(mockForward).toBeCalledWith(mockOperation); - }); - - test('it should not retry if other error happens', () => { - reTryOneTimeOnErrorHandler({ - networkError: { ...mockNetworkError, statusCode: 500 }, - operation: mockOperation, - forward: mockForward, - }); - expect(mockForward).not.toBeCalled(); - }); -}); - -describe('reTryOneTimeOnErrorLink', () => { - test('onError should be called with reTryOneTimeOnErrorHandler', () => { - expect(onError).toHaveBeenCalledWith(reTryOneTimeOnErrorHandler); - }); -}); diff --git a/x-pack/plugins/security_solution/public/common/containers/errors/index.tsx b/x-pack/plugins/security_solution/public/common/containers/errors/index.tsx deleted file mode 100644 index f1b3a1b0c4352..0000000000000 --- a/x-pack/plugins/security_solution/public/common/containers/errors/index.tsx +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. - */ - -import { onError, ErrorLink } from 'apollo-link-error'; -import { get, throttle, noop } from 'lodash/fp'; - -import uuid from 'uuid'; - -import * as i18n from './translations'; - -import { getStore } from '../../store'; -import { appActions } from '../../store/actions'; - -export const errorLinkHandler: ErrorLink.ErrorHandler = ({ graphQLErrors, networkError }) => { - const store = getStore(); - const dispatch = throttle(50, store != null ? store.dispatch : noop); - - if (graphQLErrors != null && store != null) { - dispatch( - appActions.addError({ - id: uuid.v4(), - title: i18n.DATA_FETCH_FAILURE, - message: graphQLErrors.map(({ message }) => message), - }) - ); - } - - if (networkError != null && store != null) { - dispatch( - appActions.addError({ - id: uuid.v4(), - title: i18n.NETWORK_FAILURE, - message: [networkError.message], - }) - ); - } -}; -export const errorLink = onError(errorLinkHandler); - -export const reTryOneTimeOnErrorHandler: ErrorLink.ErrorHandler = ({ - networkError, - operation, - forward, -}) => { - if (networkError != null) { - const statusCode = get('statusCode', networkError); - if (statusCode != null && statusCode === 503) { - return forward(operation); - } - } -}; - -export const reTryOneTimeOnErrorLink = onError(reTryOneTimeOnErrorHandler); diff --git a/x-pack/plugins/security_solution/public/common/containers/errors/translations.ts b/x-pack/plugins/security_solution/public/common/containers/errors/translations.ts deleted file mode 100644 index bec8c98951f28..0000000000000 --- a/x-pack/plugins/security_solution/public/common/containers/errors/translations.ts +++ /dev/null @@ -1,22 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. - */ - -import { i18n } from '@kbn/i18n'; - -export const DATA_FETCH_FAILURE = i18n.translate( - 'xpack.securitySolution.containers.errors.dataFetchFailureTitle', - { - defaultMessage: 'Data Fetch Failure', - } -); - -export const NETWORK_FAILURE = i18n.translate( - 'xpack.securitySolution.containers.errors.networkFailureTitle', - { - defaultMessage: 'Network Failure', - } -); diff --git a/x-pack/plugins/security_solution/public/common/containers/helpers.ts b/x-pack/plugins/security_solution/public/common/containers/helpers.ts index efc50f4e4d948..f46147ceabf7c 100644 --- a/x-pack/plugins/security_solution/public/common/containers/helpers.ts +++ b/x-pack/plugins/security_solution/public/common/containers/helpers.ts @@ -5,12 +5,9 @@ * 2.0. */ -import { FetchPolicy } from 'apollo-client'; import { isString } from 'lodash/fp'; import { ESQuery } from '../../../common/typed_json'; export const createFilter = (filterQuery: ESQuery | string | undefined) => isString(filterQuery) ? filterQuery : JSON.stringify(filterQuery); - -export const getDefaultFetchPolicy = (): FetchPolicy => 'cache-and-network'; diff --git a/x-pack/plugins/security_solution/public/common/containers/query_template.tsx b/x-pack/plugins/security_solution/public/common/containers/query_template.tsx deleted file mode 100644 index e8c7d2e0ef436..0000000000000 --- a/x-pack/plugins/security_solution/public/common/containers/query_template.tsx +++ /dev/null @@ -1,87 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. - */ - -import { ApolloQueryResult } from 'apollo-client'; -import React from 'react'; -import { FetchMoreOptions, FetchMoreQueryOptions, OperationVariables } from 'react-apollo'; - -import { ESQuery } from '../../../common/typed_json'; -import { DocValueFields } from './source'; - -export { DocValueFields }; - -export interface QueryTemplateProps { - indexNames: string[]; - docValueFields?: DocValueFields[]; - id?: string; - endDate?: string; - filterQuery?: ESQuery | string; - skip?: boolean; - sourceId: string; - startDate?: string; -} -// eslint-disable-next-line @typescript-eslint/no-explicit-any -export type FetchMoreOptionsArgs = FetchMoreQueryOptions & - FetchMoreOptions; - -// eslint-disable-next-line @typescript-eslint/no-explicit-any -type PromiseApolloQueryResult = Promise>; - -export class QueryTemplate< - T extends QueryTemplateProps, - // eslint-disable-next-line @typescript-eslint/no-explicit-any - TData = any, - TVariables = OperationVariables -> extends React.PureComponent { - private fetchMore!: ( - fetchMoreOptions: FetchMoreOptionsArgs - ) => PromiseApolloQueryResult; - - private fetchMoreOptions!: ( - newCursor: string, - tiebreaker?: string - ) => FetchMoreOptionsArgs; - - private refetch!: (variables?: TVariables) => Promise>; - - private executeBeforeFetchMore!: ({ id }: { id?: string }) => void; - - private executeBeforeRefetch!: ({ id }: { id?: string }) => void; - - public setExecuteBeforeFetchMore = (val: ({ id }: { id?: string }) => void) => { - this.executeBeforeFetchMore = val; - }; - public setExecuteBeforeRefetch = (val: ({ id }: { id?: string }) => void) => { - this.executeBeforeRefetch = val; - }; - - public setFetchMore = ( - val: (fetchMoreOptions: FetchMoreOptionsArgs) => PromiseApolloQueryResult - ) => { - this.fetchMore = val; - }; - - public setFetchMoreOptions = ( - val: (newCursor: string, tiebreaker?: string) => FetchMoreOptionsArgs - ) => { - this.fetchMoreOptions = val; - }; - - public setRefetch = (val: (variables?: TVariables) => Promise>) => { - this.refetch = val; - }; - - public wrappedLoadMore = (newCursor: string, tiebreaker?: string) => { - this.executeBeforeFetchMore({ id: this.props.id }); - return this.fetchMore(this.fetchMoreOptions(newCursor, tiebreaker)); - }; - - public wrappedRefetch = (variables?: TVariables) => { - this.executeBeforeRefetch({ id: this.props.id }); - return this.refetch(variables); - }; -} diff --git a/x-pack/plugins/security_solution/public/common/containers/query_template_paginated.tsx b/x-pack/plugins/security_solution/public/common/containers/query_template_paginated.tsx deleted file mode 100644 index 0dc8aa9abf38f..0000000000000 --- a/x-pack/plugins/security_solution/public/common/containers/query_template_paginated.tsx +++ /dev/null @@ -1,103 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. - */ - -import { ApolloQueryResult, NetworkStatus } from 'apollo-client'; -import memoizeOne from 'memoize-one'; -import React from 'react'; -import { FetchMoreOptions, FetchMoreQueryOptions, OperationVariables } from 'react-apollo'; -import deepEqual from 'fast-deep-equal'; - -import { ESQuery } from '../../../common/typed_json'; -import { inputsModel } from '../store/model'; -import { generateTablePaginationOptions } from '../components/paginated_table/helpers'; -import { DocValueFields } from './source'; - -export { DocValueFields }; - -export interface QueryTemplatePaginatedProps { - docValueFields?: DocValueFields[]; - id?: string; - endDate?: string; - filterQuery?: ESQuery | string; - skip?: boolean; - sourceId: string; - startDate?: string; -} -// eslint-disable-next-line @typescript-eslint/no-explicit-any -type FetchMoreOptionsArgs = FetchMoreQueryOptions & - FetchMoreOptions; - -// eslint-disable-next-line @typescript-eslint/no-explicit-any -type PromiseApolloQueryResult = Promise>; - -export class QueryTemplatePaginated< - T extends QueryTemplatePaginatedProps, - // eslint-disable-next-line @typescript-eslint/no-explicit-any - TData = any, - TVariables = OperationVariables -> extends React.PureComponent { - private queryVariables: TVariables | null = null; - private myLoading: boolean = false; - private fetchMore!: ( - fetchMoreOptions: FetchMoreOptionsArgs - ) => PromiseApolloQueryResult; - - private fetchMoreOptions!: (newActivePage: number) => FetchMoreOptionsArgs; - - public memoizedRefetchQuery: ( - variables: TVariables, - limit: number, - refetch: (variables?: TVariables) => Promise> - ) => inputsModel.Refetch; - - constructor(props: T) { - super(props); - this.memoizedRefetchQuery = memoizeOne(this.refetchQuery); - } - - public setFetchMore = ( - val: (fetchMoreOptions: FetchMoreOptionsArgs) => PromiseApolloQueryResult - ) => { - this.fetchMore = val; - }; - - public setFetchMoreOptions = ( - val: (newActivePage: number) => FetchMoreOptionsArgs - ) => { - this.fetchMoreOptions = val; - }; - - public wrappedLoadMore = (newActivePage: number) => { - return this.fetchMore(this.fetchMoreOptions(newActivePage)); - }; - - public refetchQuery = ( - variables: TVariables, - limit: number, - refetch: (variables?: TVariables) => Promise> - ): inputsModel.Refetch => () => { - refetch({ ...variables, pagination: generateTablePaginationOptions(0, limit) }); - }; - - public setPrevVariables(vars: TVariables) { - this.queryVariables = vars; - } - - public isItAValidLoading(loading: boolean, variables: TVariables, networkStatus: NetworkStatus) { - if ( - !this.myLoading && - (!deepEqual(variables, this.queryVariables) || networkStatus === NetworkStatus.refetch) && - loading - ) { - this.myLoading = true; - } else if (this.myLoading && !loading) { - this.myLoading = false; - } - this.setPrevVariables(variables); - return this.myLoading; - } -} diff --git a/x-pack/plugins/security_solution/public/common/containers/sourcerer/index.test.tsx b/x-pack/plugins/security_solution/public/common/containers/sourcerer/index.test.tsx index 7a20c98a8d4bf..542369fdf5aa3 100644 --- a/x-pack/plugins/security_solution/public/common/containers/sourcerer/index.test.tsx +++ b/x-pack/plugins/security_solution/public/common/containers/sourcerer/index.test.tsx @@ -12,7 +12,7 @@ import { act, renderHook } from '@testing-library/react-hooks'; import { Provider } from 'react-redux'; import { useInitSourcerer } from '.'; -import { mockPatterns, mockSource } from './mocks'; +import { mockPatterns } from './mocks'; // import { SourcererScopeName } from '../../store/sourcerer/model'; import { RouteSpyState } from '../../utils/route/types'; import { SecurityPageName } from '../../../../common/constants'; @@ -22,14 +22,12 @@ import { initialState as userInfoState, } from '../../../detections/components/user_info'; import { - apolloClientObservable, createSecuritySolutionStorageMock, kibanaObservable, mockGlobalState, SUB_PLUGINS_REDUCER, } from '../../mock'; import { SourcererScopeName } from '../../store/sourcerer/model'; -const mockSourceDefaults = mockSource; const mockRouteSpy: RouteSpyState = { pageName: SecurityPageName.overview, @@ -81,11 +79,6 @@ jest.mock('../../lib/kibana', () => ({ }), useUiSetting$: jest.fn().mockImplementation(() => [mockPatterns]), })); -jest.mock('../../utils/apollo_context', () => ({ - useApolloClient: jest.fn().mockReturnValue({ - query: jest.fn().mockImplementation(() => Promise.resolve(mockSourceDefaults)), - }), -})); describe('Sourcerer Hooks', () => { const state: State = { @@ -112,24 +105,12 @@ describe('Sourcerer Hooks', () => { }, }; const { storage } = createSecuritySolutionStorageMock(); - let store = createStore( - state, - SUB_PLUGINS_REDUCER, - apolloClientObservable, - kibanaObservable, - storage - ); + let store = createStore(state, SUB_PLUGINS_REDUCER, kibanaObservable, storage); beforeEach(() => { jest.clearAllMocks(); jest.restoreAllMocks(); - store = createStore( - state, - SUB_PLUGINS_REDUCER, - apolloClientObservable, - kibanaObservable, - storage - ); + store = createStore(state, SUB_PLUGINS_REDUCER, kibanaObservable, storage); mockUseUserInfo.mockImplementation(() => userInfoState); }); it('initializes loading default and timeline index patterns', async () => { diff --git a/x-pack/plugins/security_solution/public/common/hooks/eql/api.ts b/x-pack/plugins/security_solution/public/common/hooks/eql/api.ts index 6c107ae04c1a3..7e7942317788b 100644 --- a/x-pack/plugins/security_solution/public/common/hooks/eql/api.ts +++ b/x-pack/plugins/security_solution/public/common/hooks/eql/api.ts @@ -9,8 +9,8 @@ import { DataPublicPluginStart } from '../../../../../../../src/plugins/data/pub import { EqlSearchStrategyRequest, EqlSearchStrategyResponse, -} from '../../../../../data_enhanced/common'; -import { EQL_SEARCH_STRATEGY } from '../../../../../data_enhanced/public'; + EQL_SEARCH_STRATEGY, +} from '../../../../../../../src/plugins/data/common'; import { getValidationErrors, isErrorResponse, diff --git a/x-pack/plugins/security_solution/public/common/hooks/eql/eql_search_response.mock.ts b/x-pack/plugins/security_solution/public/common/hooks/eql/eql_search_response.mock.ts index 56000ce4b7bde..513bfc654027d 100644 --- a/x-pack/plugins/security_solution/public/common/hooks/eql/eql_search_response.mock.ts +++ b/x-pack/plugins/security_solution/public/common/hooks/eql/eql_search_response.mock.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { EqlSearchStrategyResponse } from '../../../../../data_enhanced/common'; +import { EqlSearchStrategyResponse } from '../../../../../../../src/plugins/data/common'; import { Source } from './types'; import { EqlSearchResponse } from '../../../../common/detection_engine/types'; import { Connection } from '@elastic/elasticsearch'; diff --git a/x-pack/plugins/security_solution/public/common/hooks/eql/helpers.test.ts b/x-pack/plugins/security_solution/public/common/hooks/eql/helpers.test.ts index a6cd135e88ec5..2dba3e3af3773 100644 --- a/x-pack/plugins/security_solution/public/common/hooks/eql/helpers.test.ts +++ b/x-pack/plugins/security_solution/public/common/hooks/eql/helpers.test.ts @@ -7,7 +7,7 @@ import moment from 'moment'; -import { EqlSearchStrategyResponse } from '../../../../../data_enhanced/common'; +import { EqlSearchStrategyResponse } from '../../../../../../../src/plugins/data/common'; import { Source } from './types'; import { EqlSearchResponse } from '../../../../common/detection_engine/types'; import { inputsModel } from '../../../common/store'; diff --git a/x-pack/plugins/security_solution/public/common/hooks/eql/helpers.ts b/x-pack/plugins/security_solution/public/common/hooks/eql/helpers.ts index 399bbb08aec5f..68a8cb53b3815 100644 --- a/x-pack/plugins/security_solution/public/common/hooks/eql/helpers.ts +++ b/x-pack/plugins/security_solution/public/common/hooks/eql/helpers.ts @@ -9,7 +9,7 @@ import moment from 'moment'; import { Unit } from '@elastic/datemath'; import { inputsModel } from '../../../common/store'; -import { EqlSearchStrategyResponse } from '../../../../../data_enhanced/common'; +import { EqlSearchStrategyResponse } from '../../../../../../../src/plugins/data/common'; import { InspectResponse } from '../../../types'; import { EqlPreviewResponse, Source } from './types'; import { BaseHit, EqlSearchResponse } from '../../../../common/detection_engine/types'; diff --git a/x-pack/plugins/security_solution/public/common/hooks/eql/use_eql_preview.test.ts b/x-pack/plugins/security_solution/public/common/hooks/eql/use_eql_preview.test.ts index 0245a35ef79b6..2afe14644f5e9 100644 --- a/x-pack/plugins/security_solution/public/common/hooks/eql/use_eql_preview.test.ts +++ b/x-pack/plugins/security_solution/public/common/hooks/eql/use_eql_preview.test.ts @@ -11,7 +11,7 @@ import { of, throwError } from 'rxjs'; import { delay } from 'rxjs/operators'; import * as i18n from '../translations'; -import { EqlSearchStrategyResponse } from '../../../../../data_enhanced/common'; +import { EqlSearchStrategyResponse } from '../../../../../../../src/plugins/data/common'; import { Source } from './types'; import { EqlSearchResponse } from '../../../../common/detection_engine/types'; import { useKibana } from '../../../common/lib/kibana'; diff --git a/x-pack/plugins/security_solution/public/common/hooks/eql/use_eql_preview.ts b/x-pack/plugins/security_solution/public/common/hooks/eql/use_eql_preview.ts index 0c0834fc2a457..5632dd0ed03be 100644 --- a/x-pack/plugins/security_solution/public/common/hooks/eql/use_eql_preview.ts +++ b/x-pack/plugins/security_solution/public/common/hooks/eql/use_eql_preview.ts @@ -16,12 +16,10 @@ import { isCompleteResponse, isErrorResponse, isPartialResponse, -} from '../../../../../../../src/plugins/data/common'; -import { AbortError } from '../../../../../../../src/plugins/kibana_utils/common'; -import { EqlSearchStrategyRequest, EqlSearchStrategyResponse, -} from '../../../../../data_enhanced/common'; +} from '../../../../../../../src/plugins/data/common'; +import { AbortError } from '../../../../../../../src/plugins/kibana_utils/common'; import { formatInspect, getEqlAggsData } from './helpers'; import { EqlPreviewResponse, EqlPreviewRequest, Source } from './types'; import { hasEqlSequenceQuery } from '../../../../common/detection_engine/utils'; diff --git a/x-pack/plugins/security_solution/public/common/lib/compose/helpers.test.ts b/x-pack/plugins/security_solution/public/common/lib/compose/helpers.test.ts deleted file mode 100644 index 8465e343d2a41..0000000000000 --- a/x-pack/plugins/security_solution/public/common/lib/compose/helpers.test.ts +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. - */ - -import { InMemoryCache, IntrospectionFragmentMatcher } from 'apollo-cache-inmemory'; -import { errorLink, reTryOneTimeOnErrorLink } from '../../containers/errors'; -import { getLinks } from './helpers'; -import { withClientState } from 'apollo-link-state'; -import * as apolloLinkHttp from 'apollo-link-http'; -import introspectionQueryResultData from '../../../graphql/introspection.json'; - -jest.mock('apollo-cache-inmemory'); -jest.mock('apollo-link-http'); -jest.mock('apollo-link-state'); -jest.mock('../../containers/errors'); -const mockWithClientState = 'mockWithClientState'; -const mockHttpLink = { mockHttpLink: 'mockHttpLink' }; - -(withClientState as jest.Mock).mockReturnValue(mockWithClientState); -(apolloLinkHttp.createHttpLink as jest.Mock).mockImplementation(() => mockHttpLink); - -describe('getLinks helper', () => { - test('It should return links in correct order', () => { - const mockCache = new InMemoryCache({ - dataIdFromObject: () => null, - fragmentMatcher: new IntrospectionFragmentMatcher({ - // @ts-expect-error apollo-cache-inmemory types don't match actual introspection data - introspectionQueryResultData, - }), - }); - const links = getLinks(mockCache, 'basePath'); - expect(links[0]).toEqual(errorLink); - expect(links[1]).toEqual(reTryOneTimeOnErrorLink); - expect(links[2]).toEqual(mockWithClientState); - expect(links[3]).toEqual(mockHttpLink); - }); -}); diff --git a/x-pack/plugins/security_solution/public/common/lib/compose/helpers.ts b/x-pack/plugins/security_solution/public/common/lib/compose/helpers.ts deleted file mode 100644 index d9833844d843f..0000000000000 --- a/x-pack/plugins/security_solution/public/common/lib/compose/helpers.ts +++ /dev/null @@ -1,26 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. - */ - -import { createHttpLink } from 'apollo-link-http'; -import { withClientState } from 'apollo-link-state'; -import { InMemoryCache } from 'apollo-cache-inmemory'; - -import { errorLink, reTryOneTimeOnErrorLink } from '../../containers/errors'; - -export const getLinks = (cache: InMemoryCache, basePath: string) => [ - errorLink, - reTryOneTimeOnErrorLink, - withClientState({ - cache, - resolvers: {}, - }), - createHttpLink({ - credentials: 'same-origin', - headers: { 'kbn-xsrf': 'true' }, - uri: `${basePath}/api/solutions/security/graphql`, - }), -]; diff --git a/x-pack/plugins/security_solution/public/common/lib/compose/kibana_compose.tsx b/x-pack/plugins/security_solution/public/common/lib/compose/kibana_compose.tsx deleted file mode 100644 index 74a31ac58c6c5..0000000000000 --- a/x-pack/plugins/security_solution/public/common/lib/compose/kibana_compose.tsx +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. - */ - -import { InMemoryCache, IntrospectionFragmentMatcher } from 'apollo-cache-inmemory'; -import ApolloClient from 'apollo-client'; -import { ApolloLink } from 'apollo-link'; - -import introspectionQueryResultData from '../../../graphql/introspection.json'; -import { AppFrontendLibs } from '../lib'; -import { getLinks } from './helpers'; -import { CoreStart } from '../../../../../../../src/core/public'; - -export function composeLibs(core: CoreStart): AppFrontendLibs { - const cache = new InMemoryCache({ - dataIdFromObject: () => null, - fragmentMatcher: new IntrospectionFragmentMatcher({ - // @ts-expect-error apollo-cache-inmemory types don't match actual introspection data - introspectionQueryResultData, - }), - }); - const basePath = core.http.basePath.get(); - - const apolloClient = new ApolloClient({ - connectToDevTools: process.env.NODE_ENV !== 'production', - cache, - link: ApolloLink.from(getLinks(cache, basePath)), - }); - - const libs: AppFrontendLibs = { - apolloClient, - }; - return libs; -} diff --git a/x-pack/plugins/security_solution/public/common/lib/lib.ts b/x-pack/plugins/security_solution/public/common/lib/lib.ts deleted file mode 100644 index 7919ef78fff0b..0000000000000 --- a/x-pack/plugins/security_solution/public/common/lib/lib.ts +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. - */ - -import { NormalizedCacheObject } from 'apollo-cache-inmemory'; -import ApolloClient from 'apollo-client'; - -export interface AppFrontendLibs { - apolloClient: AppApolloClient; -} - -export type AppTimezoneProvider = () => string; - -export type AppApolloClient = ApolloClient; - -export interface AppFrameworkAdapter { - appState?: object; - bytesFormat?: string; - dateFormat?: string; - dateFormatTz?: string; - darkMode?: boolean; - indexPattern?: string; - anomalyScore?: number; - scaledDateFormat?: string; - timezone?: string; - - // eslint-disable-next-line @typescript-eslint/no-explicit-any - setUISettings(key: string, value: any): void; -} - -export interface AppKibanaUIConfig { - // eslint-disable-next-line @typescript-eslint/no-explicit-any - get(key: string): any; - // eslint-disable-next-line @typescript-eslint/no-explicit-any - set(key: string, value: any): Promise; -} diff --git a/x-pack/plugins/security_solution/public/common/mock/endpoint/app_context_render.tsx b/x-pack/plugins/security_solution/public/common/mock/endpoint/app_context_render.tsx index 6f0f719c867d2..2d3a01f820b44 100644 --- a/x-pack/plugins/security_solution/public/common/mock/endpoint/app_context_render.tsx +++ b/x-pack/plugins/security_solution/public/common/mock/endpoint/app_context_render.tsx @@ -14,7 +14,7 @@ import { coreMock } from '../../../../../../../src/core/public/mocks'; import { StartPlugins } from '../../../types'; import { depsStartMock } from './dependencies_start_mock'; import { MiddlewareActionSpyHelper, createSpyMiddleware } from '../../store/test_utils'; -import { apolloClientObservable, kibanaObservable } from '../test_providers'; +import { kibanaObservable } from '../test_providers'; import { createStore, State } from '../../store'; import { AppRootProvider } from './app_root_provider'; import { managementMiddlewareFactory } from '../../../management/store/middleware'; @@ -58,14 +58,10 @@ export const createAppRootMockRenderer = (): AppContextTestRender => { const middlewareSpy = createSpyMiddleware(); const { storage } = createSecuritySolutionStorageMock(); - const store = createStore( - mockGlobalState, - SUB_PLUGINS_REDUCER, - apolloClientObservable, - kibanaObservable, - storage, - [...managementMiddlewareFactory(coreStart, depsStart), middlewareSpy.actionSpyMiddleware] - ); + const store = createStore(mockGlobalState, SUB_PLUGINS_REDUCER, kibanaObservable, storage, [ + ...managementMiddlewareFactory(coreStart, depsStart), + middlewareSpy.actionSpyMiddleware, + ]); const MockKibanaContextProvider = createKibanaContextProviderMock(); diff --git a/x-pack/plugins/security_solution/public/common/mock/test_providers.tsx b/x-pack/plugins/security_solution/public/common/mock/test_providers.tsx index 5baec99274823..90526e84a2262 100644 --- a/x-pack/plugins/security_solution/public/common/mock/test_providers.tsx +++ b/x-pack/plugins/security_solution/public/common/mock/test_providers.tsx @@ -7,11 +7,8 @@ import euiDarkVars from '@elastic/eui/dist/eui_theme_dark.json'; import { I18nProvider } from '@kbn/i18n/react'; -import { InMemoryCache as Cache } from 'apollo-cache-inmemory'; -import ApolloClient from 'apollo-client'; -import { ApolloLink } from 'apollo-link'; + import React from 'react'; -import { ApolloProvider } from 'react-apollo'; import { DragDropContext, DropResult, ResponderProvided } from 'react-beautiful-dnd'; import { Provider as ReduxStoreProvider } from 'react-redux'; import { Store } from 'redux'; @@ -36,12 +33,6 @@ interface Props { onDragEnd?: (result: DropResult, provided: ResponderProvided) => void; } -export const apolloClient = new ApolloClient({ - cache: new Cache(), - link: new ApolloLink((o, f) => (f ? f(o) : null)), -}); - -export const apolloClientObservable = new BehaviorSubject(apolloClient); export const kibanaObservable = new BehaviorSubject(createStartServicesMock()); Object.defineProperty(window, 'localStorage', { @@ -54,24 +45,16 @@ const { storage } = createSecuritySolutionStorageMock(); /** A utility for wrapping children in the providers required to run most tests */ const TestProvidersComponent: React.FC = ({ children, - store = createStore( - state, - SUB_PLUGINS_REDUCER, - apolloClientObservable, - kibanaObservable, - storage - ), + store = createStore(state, SUB_PLUGINS_REDUCER, kibanaObservable, storage), onDragEnd = jest.fn(), }) => ( - - - ({ eui: euiDarkVars, darkMode: true })}> - {children} - - - + + ({ eui: euiDarkVars, darkMode: true })}> + {children} + + ); diff --git a/x-pack/plugins/security_solution/public/common/mock/timeline_results.ts b/x-pack/plugins/security_solution/public/common/mock/timeline_results.ts index 5aef3b97c81b7..c02c47d45f732 100644 --- a/x-pack/plugins/security_solution/public/common/mock/timeline_results.ts +++ b/x-pack/plugins/security_solution/public/common/mock/timeline_results.ts @@ -12,1736 +12,1606 @@ import { TimelineType, TimelineStatus, TimelineTabs, + TimelineResult, } from '../../../common/types/timeline'; import { OpenTimelineResult } from '../../timelines/components/open_timeline/types'; -import { GetAllTimeline, SortFieldTimeline, TimelineResult, Direction } from '../../graphql/types'; -import { TimelineEventsDetailsItem } from '../../../common/search_strategy'; -import { allTimelinesQuery } from '../../timelines/containers/all/index.gql_query'; +import { Direction, TimelineEventsDetailsItem } from '../../../common/search_strategy'; import { CreateTimelineProps } from '../../detections/components/alerts_table/types'; import { TimelineModel } from '../../timelines/store/timeline/model'; import { timelineDefaults } from '../../timelines/store/timeline/defaults'; -export interface MockedProvidedQuery { - request: { - query: GetAllTimeline.Query; - variables: GetAllTimeline.Variables; - }; - result: { - data: { - getAllTimeline: { - totalCount: number; - timeline: TimelineResult[]; - }; - }; - }; -} -/** Mocks results of a query run by the `OpenTimeline` component */ -export const mockOpenTimelineQueryResults: MockedProvidedQuery[] = [ - { - request: { - query: (allTimelinesQuery as unknown) as GetAllTimeline.Query, - variables: { - onlyUserFavorite: false, - pageInfo: { - pageIndex: 1, - pageSize: 10, - }, - search: '', - sort: { - sortField: 'updated' as SortFieldTimeline, - sortOrder: 'desc' as Direction, +export const mockOpenTimelineQueryResults = { + totalCount: 11, + timeline: [ + { + savedObjectId: '10849df0-7b44-11e9-a608-ab3d811609', + description: 'hhw4', + favorite: [ + { + fullName: null, + userName: 'elastic', + favoriteDate: 1558390951234, }, - }, + ], + eventIdToNoteIds: [ + { + eventId: '4l0W12oB9v5HJNSHY4wv', + note: 'test pinned event 2', + timelineId: '10849df0-7b44-11e9-a608-ab3d811602f9', + noteId: '44763500-7b6d-11e9-980a-e5349fc014ef', + created: 1558404484133, + createdBy: 'elastic', + timelineVersion: null, + updated: 1558404484133, + updatedBy: 'elastic', + version: 'WzEzOSwxXQ==', + }, + { + eventId: 'ZF0W12oB9v5HJNSHwY6L', + note: 'Test pinned 1', + timelineId: '10849df0-7b44-11e9-a608-ab3d811602f9', + noteId: '3e9d51e0-7b6d-11e9-980a-e5349fc014ef', + created: 1558404474317, + createdBy: 'elastic', + timelineVersion: null, + updated: 1558404474317, + updatedBy: 'elastic', + version: 'WzEzNywxXQ==', + }, + { + eventId: '4l0W12oB9v5HJNSHY4wv', + note: 'again', + timelineId: '10849df0-7b44-11e9-a608-ab3d811602f9', + noteId: '48eaf440-7b6d-11e9-980a-e5349fc014ef', + created: 1558404491600, + createdBy: 'elastic', + timelineVersion: null, + updated: 1558404491600, + updatedBy: 'elastic', + version: 'WzE0MSwxXQ==', + }, + ], + notes: [ + { + eventId: '4l0W12oB9v5HJNSHY4wv', + note: 'test pinned event 2', + timelineId: '10849df0-7b44-11e9-a608-ab3d811602f9', + timelineVersion: null, + noteId: '44763500-7b6d-11e9-980a-e5349fc014ef', + created: 1558404484133, + createdBy: 'elastic', + updated: 1558404484133, + updatedBy: 'elastic', + version: 'WzEzOSwxXQ==', + }, + { + eventId: 'ZF0W12oB9v5HJNSHwY6L', + note: 'Test pinned 1', + timelineId: '10849df0-7b44-11e9-a608-ab3d811602f9', + timelineVersion: null, + noteId: '3e9d51e0-7b6d-11e9-980a-e5349fc014ef', + created: 1558404474317, + createdBy: 'elastic', + updated: 1558404474317, + updatedBy: 'elastic', + version: 'WzEzNywxXQ==', + }, + { + eventId: '4l0W12oB9v5HJNSHY4wv', + note: 'again', + timelineId: '10849df0-7b44-11e9-a608-ab3d811602f9', + timelineVersion: null, + noteId: '48eaf440-7b6d-11e9-980a-e5349fc014ef', + created: 1558404491600, + createdBy: 'elastic', + updated: 1558404491600, + updatedBy: 'elastic', + version: 'WzE0MSwxXQ==', + }, + { + eventId: null, + note: 'Hello world', + timelineId: '10849df0-7b44-11e9-a608-ab3d811602f9', + timelineVersion: null, + noteId: '308783f0-7b6d-11e9-980a-e5349fc014ef', + created: 1558404450688, + createdBy: 'elastic', + updated: 1558404450688, + updatedBy: 'elastic', + version: 'WzEzMywxXQ==', + }, + { + eventId: null, + note: 'here I am', + timelineId: '10849df0-7b44-11e9-a608-ab3d811602f9', + timelineVersion: null, + noteId: '34ec1690-7b6d-11e9-980a-e5349fc014ef', + created: 1558404458065, + createdBy: 'elastic', + updated: 1558404458065, + updatedBy: 'elastic', + version: 'WzEzNCwxXQ==', + }, + ], + noteIds: ['308783f0-7b6d-11e9-980a-e5349fc014ef', '34ec1690-7b6d-11e9-980a-e5349fc014ef'], + pinnedEventIds: ['Wl0W12oB9v5HJNSHb400', '410W12oB9v5HJNSHY4wv', 'ZF0W12oB9v5HJNSHwY6L'], + title: 'test 1', + timelineType: TimelineType.default, + templateTimelineId: null, + templateTimelineVersion: null, + created: 1558386787614, + createdBy: 'elastic', + updated: 1558390951234, + updatedBy: 'elastic', + version: 'WzEyOCwxXQ==', }, - result: { - data: { - getAllTimeline: { - totalCount: 11, - timeline: [ - { - savedObjectId: '10849df0-7b44-11e9-a608-ab3d811609', - description: 'hhw4', - favorite: [ - { - fullName: null, - userName: 'elastic', - favoriteDate: 1558390951234, - }, - ], - eventIdToNoteIds: [ - { - eventId: '4l0W12oB9v5HJNSHY4wv', - note: 'test pinned event 2', - timelineId: '10849df0-7b44-11e9-a608-ab3d811602f9', - noteId: '44763500-7b6d-11e9-980a-e5349fc014ef', - created: 1558404484133, - createdBy: 'elastic', - timelineVersion: null, - updated: 1558404484133, - updatedBy: 'elastic', - version: 'WzEzOSwxXQ==', - }, - { - eventId: 'ZF0W12oB9v5HJNSHwY6L', - note: 'Test pinned 1', - timelineId: '10849df0-7b44-11e9-a608-ab3d811602f9', - noteId: '3e9d51e0-7b6d-11e9-980a-e5349fc014ef', - created: 1558404474317, - createdBy: 'elastic', - timelineVersion: null, - updated: 1558404474317, - updatedBy: 'elastic', - version: 'WzEzNywxXQ==', - }, - { - eventId: '4l0W12oB9v5HJNSHY4wv', - note: 'again', - timelineId: '10849df0-7b44-11e9-a608-ab3d811602f9', - noteId: '48eaf440-7b6d-11e9-980a-e5349fc014ef', - created: 1558404491600, - createdBy: 'elastic', - timelineVersion: null, - updated: 1558404491600, - updatedBy: 'elastic', - version: 'WzE0MSwxXQ==', - }, - ], - notes: [ - { - eventId: '4l0W12oB9v5HJNSHY4wv', - note: 'test pinned event 2', - timelineId: '10849df0-7b44-11e9-a608-ab3d811602f9', - timelineVersion: null, - noteId: '44763500-7b6d-11e9-980a-e5349fc014ef', - created: 1558404484133, - createdBy: 'elastic', - updated: 1558404484133, - updatedBy: 'elastic', - version: 'WzEzOSwxXQ==', - }, - { - eventId: 'ZF0W12oB9v5HJNSHwY6L', - note: 'Test pinned 1', - timelineId: '10849df0-7b44-11e9-a608-ab3d811602f9', - timelineVersion: null, - noteId: '3e9d51e0-7b6d-11e9-980a-e5349fc014ef', - created: 1558404474317, - createdBy: 'elastic', - updated: 1558404474317, - updatedBy: 'elastic', - version: 'WzEzNywxXQ==', - }, - { - eventId: '4l0W12oB9v5HJNSHY4wv', - note: 'again', - timelineId: '10849df0-7b44-11e9-a608-ab3d811602f9', - timelineVersion: null, - noteId: '48eaf440-7b6d-11e9-980a-e5349fc014ef', - created: 1558404491600, - createdBy: 'elastic', - updated: 1558404491600, - updatedBy: 'elastic', - version: 'WzE0MSwxXQ==', - }, - { - eventId: null, - note: 'Hello world', - timelineId: '10849df0-7b44-11e9-a608-ab3d811602f9', - timelineVersion: null, - noteId: '308783f0-7b6d-11e9-980a-e5349fc014ef', - created: 1558404450688, - createdBy: 'elastic', - updated: 1558404450688, - updatedBy: 'elastic', - version: 'WzEzMywxXQ==', - }, - { - eventId: null, - note: 'here I am', - timelineId: '10849df0-7b44-11e9-a608-ab3d811602f9', - timelineVersion: null, - noteId: '34ec1690-7b6d-11e9-980a-e5349fc014ef', - created: 1558404458065, - createdBy: 'elastic', - updated: 1558404458065, - updatedBy: 'elastic', - version: 'WzEzNCwxXQ==', - }, - ], - noteIds: [ - '308783f0-7b6d-11e9-980a-e5349fc014ef', - '34ec1690-7b6d-11e9-980a-e5349fc014ef', - ], - pinnedEventIds: [ - 'Wl0W12oB9v5HJNSHb400', - '410W12oB9v5HJNSHY4wv', - 'ZF0W12oB9v5HJNSHwY6L', - ], - title: 'test 1', - timelineType: TimelineType.default, - templateTimelineId: null, - templateTimelineVersion: null, - created: 1558386787614, - createdBy: 'elastic', - updated: 1558390951234, - updatedBy: 'elastic', - version: 'WzEyOCwxXQ==', - }, - { - savedObjectId: '10849df0-7b44-11e9-a608-ab3d811602f91', - description: 'hhw4', - favorite: [ - { - fullName: null, - userName: 'elastic', - favoriteDate: 1558390951234, - }, - ], - eventIdToNoteIds: [ - { - eventId: '4l0W12oB9v5HJNSHY4wv', - note: 'test pinned event 2', - timelineId: '10849df0-7b44-11e9-a608-ab3d811602f9', - noteId: '44763500-7b6d-11e9-980a-e5349fc014ef', - created: 1558404484133, - createdBy: 'elastic', - timelineVersion: null, - updated: 1558404484133, - updatedBy: 'elastic', - version: 'WzEzOSwxXQ==', - }, - { - eventId: 'ZF0W12oB9v5HJNSHwY6L', - note: 'Test pinned 1', - timelineId: '10849df0-7b44-11e9-a608-ab3d811602f9', - noteId: '3e9d51e0-7b6d-11e9-980a-e5349fc014ef', - created: 1558404474317, - createdBy: 'elastic', - timelineVersion: null, - updated: 1558404474317, - updatedBy: 'elastic', - version: 'WzEzNywxXQ==', - }, - { - eventId: '4l0W12oB9v5HJNSHY4wv', - note: 'again', - timelineId: '10849df0-7b44-11e9-a608-ab3d811602f9', - noteId: '48eaf440-7b6d-11e9-980a-e5349fc014ef', - created: 1558404491600, - createdBy: 'elastic', - timelineVersion: null, - updated: 1558404491600, - updatedBy: 'elastic', - version: 'WzE0MSwxXQ==', - }, - ], - notes: [ - { - eventId: '4l0W12oB9v5HJNSHY4wv', - note: 'test pinned event 2', - timelineId: '10849df0-7b44-11e9-a608-ab3d811602f9', - timelineVersion: null, - noteId: '44763500-7b6d-11e9-980a-e5349fc014ef', - created: 1558404484133, - createdBy: 'elastic', - updated: 1558404484133, - updatedBy: 'elastic', - version: 'WzEzOSwxXQ==', - }, - { - eventId: 'ZF0W12oB9v5HJNSHwY6L', - note: 'Test pinned 1', - timelineId: '10849df0-7b44-11e9-a608-ab3d811602f9', - timelineVersion: null, - noteId: '3e9d51e0-7b6d-11e9-980a-e5349fc014ef', - created: 1558404474317, - createdBy: 'elastic', - updated: 1558404474317, - updatedBy: 'elastic', - version: 'WzEzNywxXQ==', - }, - { - eventId: '4l0W12oB9v5HJNSHY4wv', - note: 'again', - timelineId: '10849df0-7b44-11e9-a608-ab3d811602f9', - timelineVersion: null, - noteId: '48eaf440-7b6d-11e9-980a-e5349fc014ef', - created: 1558404491600, - createdBy: 'elastic', - updated: 1558404491600, - updatedBy: 'elastic', - version: 'WzE0MSwxXQ==', - }, - { - eventId: null, - note: 'Hello world', - timelineId: '10849df0-7b44-11e9-a608-ab3d811602f9', - timelineVersion: null, - noteId: '308783f0-7b6d-11e9-980a-e5349fc014ef', - created: 1558404450688, - createdBy: 'elastic', - updated: 1558404450688, - updatedBy: 'elastic', - version: 'WzEzMywxXQ==', - }, - { - eventId: null, - note: 'here I am', - timelineId: '10849df0-7b44-11e9-a608-ab3d811602f9', - timelineVersion: null, - noteId: '34ec1690-7b6d-11e9-980a-e5349fc014ef', - created: 1558404458065, - createdBy: 'elastic', - updated: 1558404458065, - updatedBy: 'elastic', - version: 'WzEzNCwxXQ==', - }, - ], - noteIds: [ - '308783f0-7b6d-11e9-980a-e5349fc014ef', - '34ec1690-7b6d-11e9-980a-e5349fc014ef', - ], - pinnedEventIds: [ - 'Wl0W12oB9v5HJNSHb400', - '410W12oB9v5HJNSHY4wv', - 'ZF0W12oB9v5HJNSHwY6L', - ], - title: 'test 2', - timelineType: TimelineType.default, - templateTimelineId: null, - templateTimelineVersion: null, - created: 1558386787614, - createdBy: 'elastic', - updated: 1558390951234, - updatedBy: 'elastic', - version: 'WzEyOCwxXQ==', - }, - { - savedObjectId: '10849df0-7b44-11e9-a608-ab3d811602f92', - description: 'hhw4', - favorite: [ - { - fullName: null, - userName: 'elastic', - favoriteDate: 1558390951234, - }, - ], - eventIdToNoteIds: [ - { - eventId: '4l0W12oB9v5HJNSHY4wv', - note: 'test pinned event 2', - timelineId: '10849df0-7b44-11e9-a608-ab3d811602f9', - noteId: '44763500-7b6d-11e9-980a-e5349fc014ef', - created: 1558404484133, - createdBy: 'elastic', - timelineVersion: null, - updated: 1558404484133, - updatedBy: 'elastic', - version: 'WzEzOSwxXQ==', - }, - { - eventId: 'ZF0W12oB9v5HJNSHwY6L', - note: 'Test pinned 1', - timelineId: '10849df0-7b44-11e9-a608-ab3d811602f9', - noteId: '3e9d51e0-7b6d-11e9-980a-e5349fc014ef', - created: 1558404474317, - createdBy: 'elastic', - timelineVersion: null, - updated: 1558404474317, - updatedBy: 'elastic', - version: 'WzEzNywxXQ==', - }, - { - eventId: '4l0W12oB9v5HJNSHY4wv', - note: 'again', - timelineId: '10849df0-7b44-11e9-a608-ab3d811602f9', - noteId: '48eaf440-7b6d-11e9-980a-e5349fc014ef', - created: 1558404491600, - createdBy: 'elastic', - timelineVersion: null, - updated: 1558404491600, - updatedBy: 'elastic', - version: 'WzE0MSwxXQ==', - }, - ], - notes: [ - { - eventId: '4l0W12oB9v5HJNSHY4wv', - note: 'test pinned event 2', - timelineId: '10849df0-7b44-11e9-a608-ab3d811602f9', - timelineVersion: null, - noteId: '44763500-7b6d-11e9-980a-e5349fc014ef', - created: 1558404484133, - createdBy: 'elastic', - updated: 1558404484133, - updatedBy: 'elastic', - version: 'WzEzOSwxXQ==', - }, - { - eventId: 'ZF0W12oB9v5HJNSHwY6L', - note: 'Test pinned 1', - timelineId: '10849df0-7b44-11e9-a608-ab3d811602f9', - timelineVersion: null, - noteId: '3e9d51e0-7b6d-11e9-980a-e5349fc014ef', - created: 1558404474317, - createdBy: 'elastic', - updated: 1558404474317, - updatedBy: 'elastic', - version: 'WzEzNywxXQ==', - }, - { - eventId: '4l0W12oB9v5HJNSHY4wv', - note: 'again', - timelineId: '10849df0-7b44-11e9-a608-ab3d811602f9', - timelineVersion: null, - noteId: '48eaf440-7b6d-11e9-980a-e5349fc014ef', - created: 1558404491600, - createdBy: 'elastic', - updated: 1558404491600, - updatedBy: 'elastic', - version: 'WzE0MSwxXQ==', - }, - { - eventId: null, - note: 'Hello world', - timelineId: '10849df0-7b44-11e9-a608-ab3d811602f9', - timelineVersion: null, - noteId: '308783f0-7b6d-11e9-980a-e5349fc014ef', - created: 1558404450688, - createdBy: 'elastic', - updated: 1558404450688, - updatedBy: 'elastic', - version: 'WzEzMywxXQ==', - }, - { - eventId: null, - note: 'here I am', - timelineId: '10849df0-7b44-11e9-a608-ab3d811602f9', - timelineVersion: null, - noteId: '34ec1690-7b6d-11e9-980a-e5349fc014ef', - created: 1558404458065, - createdBy: 'elastic', - updated: 1558404458065, - updatedBy: 'elastic', - version: 'WzEzNCwxXQ==', - }, - ], - noteIds: [ - '308783f0-7b6d-11e9-980a-e5349fc014ef', - '34ec1690-7b6d-11e9-980a-e5349fc014ef', - ], - pinnedEventIds: [ - 'Wl0W12oB9v5HJNSHb400', - '410W12oB9v5HJNSHY4wv', - 'ZF0W12oB9v5HJNSHwY6L', - ], - title: 'test 2', - timelineType: TimelineType.default, - templateTimelineId: null, - templateTimelineVersion: null, - created: 1558386787614, - createdBy: 'elastic', - updated: 1558390951234, - updatedBy: 'elastic', - version: 'WzEyOCwxXQ==', - }, - { - savedObjectId: '10849df0-7b44-11e9-a608-ab3d811602f9', - description: 'hhw4', - favorite: [ - { - fullName: null, - userName: 'elastic', - favoriteDate: 1558390951234, - }, - ], - eventIdToNoteIds: [ - { - eventId: '4l0W12oB9v5HJNSHY4wv', - note: 'test pinned event 2', - timelineId: '10849df0-7b44-11e9-a608-ab3d811602f9', - noteId: '44763500-7b6d-11e9-980a-e5349fc014ef', - created: 1558404484133, - createdBy: 'elastic', - timelineVersion: null, - updated: 1558404484133, - updatedBy: 'elastic', - version: 'WzEzOSwxXQ==', - }, - { - eventId: 'ZF0W12oB9v5HJNSHwY6L', - note: 'Test pinned 1', - timelineId: '10849df0-7b44-11e9-a608-ab3d811602f9', - noteId: '3e9d51e0-7b6d-11e9-980a-e5349fc014ef', - created: 1558404474317, - createdBy: 'elastic', - timelineVersion: null, - updated: 1558404474317, - updatedBy: 'elastic', - version: 'WzEzNywxXQ==', - }, - { - eventId: '4l0W12oB9v5HJNSHY4wv', - note: 'again', - timelineId: '10849df0-7b44-11e9-a608-ab3d811602f9', - noteId: '48eaf440-7b6d-11e9-980a-e5349fc014ef', - created: 1558404491600, - createdBy: 'elastic', - timelineVersion: null, - updated: 1558404491600, - updatedBy: 'elastic', - version: 'WzE0MSwxXQ==', - }, - ], - notes: [ - { - eventId: '4l0W12oB9v5HJNSHY4wv', - note: 'test pinned event 2', - timelineId: '10849df0-7b44-11e9-a608-ab3d811602f9', - timelineVersion: null, - noteId: '44763500-7b6d-11e9-980a-e5349fc014ef', - created: 1558404484133, - createdBy: 'elastic', - updated: 1558404484133, - updatedBy: 'elastic', - version: 'WzEzOSwxXQ==', - }, - { - eventId: 'ZF0W12oB9v5HJNSHwY6L', - note: 'Test pinned 1', - timelineId: '10849df0-7b44-11e9-a608-ab3d811602f9', - timelineVersion: null, - noteId: '3e9d51e0-7b6d-11e9-980a-e5349fc014ef', - created: 1558404474317, - createdBy: 'elastic', - updated: 1558404474317, - updatedBy: 'elastic', - version: 'WzEzNywxXQ==', - }, - { - eventId: '4l0W12oB9v5HJNSHY4wv', - note: 'again', - timelineId: '10849df0-7b44-11e9-a608-ab3d811602f9', - timelineVersion: null, - noteId: '48eaf440-7b6d-11e9-980a-e5349fc014ef', - created: 1558404491600, - createdBy: 'elastic', - updated: 1558404491600, - updatedBy: 'elastic', - version: 'WzE0MSwxXQ==', - }, - { - eventId: null, - note: 'Hello world', - timelineId: '10849df0-7b44-11e9-a608-ab3d811602f9', - timelineVersion: null, - noteId: '308783f0-7b6d-11e9-980a-e5349fc014ef', - created: 1558404450688, - createdBy: 'elastic', - updated: 1558404450688, - updatedBy: 'elastic', - version: 'WzEzMywxXQ==', - }, - { - eventId: null, - note: 'here I am', - timelineId: '10849df0-7b44-11e9-a608-ab3d811602f9', - timelineVersion: null, - noteId: '34ec1690-7b6d-11e9-980a-e5349fc014ef', - created: 1558404458065, - createdBy: 'elastic', - updated: 1558404458065, - updatedBy: 'elastic', - version: 'WzEzNCwxXQ==', - }, - ], - noteIds: [ - '308783f0-7b6d-11e9-980a-e5349fc014ef', - '34ec1690-7b6d-11e9-980a-e5349fc014ef', - ], - pinnedEventIds: [ - 'Wl0W12oB9v5HJNSHb400', - '410W12oB9v5HJNSHY4wv', - 'ZF0W12oB9v5HJNSHwY6L', - ], - title: 'test 3', - timelineType: TimelineType.default, - templateTimelineId: null, - templateTimelineVersion: null, - created: 1558386787614, - createdBy: 'elastic', - updated: 1558390951234, - updatedBy: 'elastic', - version: 'WzEyOCwxXQ==', - }, - { - savedObjectId: '10849df0-7b44-11e9-a608-ab3d811602f93', - description: 'hhw4', - favorite: [ - { - fullName: null, - userName: 'elastic', - favoriteDate: 1558390951234, - }, - ], - eventIdToNoteIds: [ - { - eventId: '4l0W12oB9v5HJNSHY4wv', - note: 'test pinned event 2', - timelineId: '10849df0-7b44-11e9-a608-ab3d811602f9', - noteId: '44763500-7b6d-11e9-980a-e5349fc014ef', - created: 1558404484133, - createdBy: 'elastic', - timelineVersion: null, - updated: 1558404484133, - updatedBy: 'elastic', - version: 'WzEzOSwxXQ==', - }, - { - eventId: 'ZF0W12oB9v5HJNSHwY6L', - note: 'Test pinned 1', - timelineId: '10849df0-7b44-11e9-a608-ab3d811602f9', - noteId: '3e9d51e0-7b6d-11e9-980a-e5349fc014ef', - created: 1558404474317, - createdBy: 'elastic', - timelineVersion: null, - updated: 1558404474317, - updatedBy: 'elastic', - version: 'WzEzNywxXQ==', - }, - { - eventId: '4l0W12oB9v5HJNSHY4wv', - note: 'again', - timelineId: '10849df0-7b44-11e9-a608-ab3d811602f9', - noteId: '48eaf440-7b6d-11e9-980a-e5349fc014ef', - created: 1558404491600, - createdBy: 'elastic', - timelineVersion: null, - updated: 1558404491600, - updatedBy: 'elastic', - version: 'WzE0MSwxXQ==', - }, - ], - notes: [ - { - eventId: '4l0W12oB9v5HJNSHY4wv', - note: 'test pinned event 2', - timelineId: '10849df0-7b44-11e9-a608-ab3d811602f9', - timelineVersion: null, - noteId: '44763500-7b6d-11e9-980a-e5349fc014ef', - created: 1558404484133, - createdBy: 'elastic', - updated: 1558404484133, - updatedBy: 'elastic', - version: 'WzEzOSwxXQ==', - }, - { - eventId: 'ZF0W12oB9v5HJNSHwY6L', - note: 'Test pinned 1', - timelineId: '10849df0-7b44-11e9-a608-ab3d811602f9', - timelineVersion: null, - noteId: '3e9d51e0-7b6d-11e9-980a-e5349fc014ef', - created: 1558404474317, - createdBy: 'elastic', - updated: 1558404474317, - updatedBy: 'elastic', - version: 'WzEzNywxXQ==', - }, - { - eventId: '4l0W12oB9v5HJNSHY4wv', - note: 'again', - timelineId: '10849df0-7b44-11e9-a608-ab3d811602f9', - timelineVersion: null, - noteId: '48eaf440-7b6d-11e9-980a-e5349fc014ef', - created: 1558404491600, - createdBy: 'elastic', - updated: 1558404491600, - updatedBy: 'elastic', - version: 'WzE0MSwxXQ==', - }, - { - eventId: null, - note: 'Hello world', - timelineId: '10849df0-7b44-11e9-a608-ab3d811602f9', - timelineVersion: null, - noteId: '308783f0-7b6d-11e9-980a-e5349fc014ef', - created: 1558404450688, - createdBy: 'elastic', - updated: 1558404450688, - updatedBy: 'elastic', - version: 'WzEzMywxXQ==', - }, - { - eventId: null, - note: 'here I am', - timelineId: '10849df0-7b44-11e9-a608-ab3d811602f9', - timelineVersion: null, - noteId: '34ec1690-7b6d-11e9-980a-e5349fc014ef', - created: 1558404458065, - createdBy: 'elastic', - updated: 1558404458065, - updatedBy: 'elastic', - version: 'WzEzNCwxXQ==', - }, - ], - noteIds: [ - '308783f0-7b6d-11e9-980a-e5349fc014ef', - '34ec1690-7b6d-11e9-980a-e5349fc014ef', - ], - pinnedEventIds: [ - 'Wl0W12oB9v5HJNSHb400', - '410W12oB9v5HJNSHY4wv', - 'ZF0W12oB9v5HJNSHwY6L', - ], - title: 'test 4', - timelineType: TimelineType.default, - templateTimelineId: null, - templateTimelineVersion: null, - created: 1558386787614, - createdBy: 'elastic', - updated: 1558390951234, - updatedBy: 'elastic', - version: 'WzEyOCwxXQ==', - }, - { - savedObjectId: '10849df0-7b44-11e9-a608-ab3d811602f94', - description: 'hhw4', - favorite: [ - { - fullName: null, - userName: 'elastic', - favoriteDate: 1558390951234, - }, - ], - eventIdToNoteIds: [ - { - eventId: '4l0W12oB9v5HJNSHY4wv', - note: 'test pinned event 2', - timelineId: '10849df0-7b44-11e9-a608-ab3d811602f9', - noteId: '44763500-7b6d-11e9-980a-e5349fc014ef', - created: 1558404484133, - createdBy: 'elastic', - timelineVersion: null, - updated: 1558404484133, - updatedBy: 'elastic', - version: 'WzEzOSwxXQ==', - }, - { - eventId: 'ZF0W12oB9v5HJNSHwY6L', - note: 'Test pinned 1', - timelineId: '10849df0-7b44-11e9-a608-ab3d811602f9', - noteId: '3e9d51e0-7b6d-11e9-980a-e5349fc014ef', - created: 1558404474317, - createdBy: 'elastic', - timelineVersion: null, - updated: 1558404474317, - updatedBy: 'elastic', - version: 'WzEzNywxXQ==', - }, - { - eventId: '4l0W12oB9v5HJNSHY4wv', - note: 'again', - timelineId: '10849df0-7b44-11e9-a608-ab3d811602f9', - noteId: '48eaf440-7b6d-11e9-980a-e5349fc014ef', - created: 1558404491600, - createdBy: 'elastic', - timelineVersion: null, - updated: 1558404491600, - updatedBy: 'elastic', - version: 'WzE0MSwxXQ==', - }, - ], - notes: [ - { - eventId: '4l0W12oB9v5HJNSHY4wv', - note: 'test pinned event 2', - timelineId: '10849df0-7b44-11e9-a608-ab3d811602f9', - timelineVersion: null, - noteId: '44763500-7b6d-11e9-980a-e5349fc014ef', - created: 1558404484133, - createdBy: 'elastic', - updated: 1558404484133, - updatedBy: 'elastic', - version: 'WzEzOSwxXQ==', - }, - { - eventId: 'ZF0W12oB9v5HJNSHwY6L', - note: 'Test pinned 1', - timelineId: '10849df0-7b44-11e9-a608-ab3d811602f9', - timelineVersion: null, - noteId: '3e9d51e0-7b6d-11e9-980a-e5349fc014ef', - created: 1558404474317, - createdBy: 'elastic', - updated: 1558404474317, - updatedBy: 'elastic', - version: 'WzEzNywxXQ==', - }, - { - eventId: '4l0W12oB9v5HJNSHY4wv', - note: 'again', - timelineId: '10849df0-7b44-11e9-a608-ab3d811602f9', - timelineVersion: null, - noteId: '48eaf440-7b6d-11e9-980a-e5349fc014ef', - created: 1558404491600, - createdBy: 'elastic', - updated: 1558404491600, - updatedBy: 'elastic', - version: 'WzE0MSwxXQ==', - }, - { - eventId: null, - note: 'Hello world', - timelineId: '10849df0-7b44-11e9-a608-ab3d811602f9', - timelineVersion: null, - noteId: '308783f0-7b6d-11e9-980a-e5349fc014ef', - created: 1558404450688, - createdBy: 'elastic', - updated: 1558404450688, - updatedBy: 'elastic', - version: 'WzEzMywxXQ==', - }, - { - eventId: null, - note: 'here I am', - timelineId: '10849df0-7b44-11e9-a608-ab3d811602f9', - timelineVersion: null, - noteId: '34ec1690-7b6d-11e9-980a-e5349fc014ef', - created: 1558404458065, - createdBy: 'elastic', - updated: 1558404458065, - updatedBy: 'elastic', - version: 'WzEzNCwxXQ==', - }, - ], - noteIds: [ - '308783f0-7b6d-11e9-980a-e5349fc014ef', - '34ec1690-7b6d-11e9-980a-e5349fc014ef', - ], - pinnedEventIds: [ - 'Wl0W12oB9v5HJNSHb400', - '410W12oB9v5HJNSHY4wv', - 'ZF0W12oB9v5HJNSHwY6L', - ], - title: 'test 5', - timelineType: TimelineType.default, - templateTimelineId: null, - templateTimelineVersion: null, - created: 1558386787614, - createdBy: 'elastic', - updated: 1558390951234, - updatedBy: 'elastic', - version: 'WzEyOCwxXQ==', - }, - { - savedObjectId: '10849df0-7b44-11e9-a608-ab3d811602f95', - description: 'hhw4', - favorite: [ - { - fullName: null, - userName: 'elastic', - favoriteDate: 1558390951234, - }, - ], - eventIdToNoteIds: [ - { - eventId: '4l0W12oB9v5HJNSHY4wv', - note: 'test pinned event 2', - timelineId: '10849df0-7b44-11e9-a608-ab3d811602f9', - noteId: '44763500-7b6d-11e9-980a-e5349fc014ef', - created: 1558404484133, - createdBy: 'elastic', - timelineVersion: null, - updated: 1558404484133, - updatedBy: 'elastic', - version: 'WzEzOSwxXQ==', - }, - { - eventId: 'ZF0W12oB9v5HJNSHwY6L', - note: 'Test pinned 1', - timelineId: '10849df0-7b44-11e9-a608-ab3d811602f9', - noteId: '3e9d51e0-7b6d-11e9-980a-e5349fc014ef', - created: 1558404474317, - createdBy: 'elastic', - timelineVersion: null, - updated: 1558404474317, - updatedBy: 'elastic', - version: 'WzEzNywxXQ==', - }, - { - eventId: '4l0W12oB9v5HJNSHY4wv', - note: 'again', - timelineId: '10849df0-7b44-11e9-a608-ab3d811602f9', - noteId: '48eaf440-7b6d-11e9-980a-e5349fc014ef', - created: 1558404491600, - createdBy: 'elastic', - timelineVersion: null, - updated: 1558404491600, - updatedBy: 'elastic', - version: 'WzE0MSwxXQ==', - }, - ], - notes: [ - { - eventId: '4l0W12oB9v5HJNSHY4wv', - note: 'test pinned event 2', - timelineId: '10849df0-7b44-11e9-a608-ab3d811602f9', - timelineVersion: null, - noteId: '44763500-7b6d-11e9-980a-e5349fc014ef', - created: 1558404484133, - createdBy: 'elastic', - updated: 1558404484133, - updatedBy: 'elastic', - version: 'WzEzOSwxXQ==', - }, - { - eventId: 'ZF0W12oB9v5HJNSHwY6L', - note: 'Test pinned 1', - timelineId: '10849df0-7b44-11e9-a608-ab3d811602f9', - timelineVersion: null, - noteId: '3e9d51e0-7b6d-11e9-980a-e5349fc014ef', - created: 1558404474317, - createdBy: 'elastic', - updated: 1558404474317, - updatedBy: 'elastic', - version: 'WzEzNywxXQ==', - }, - { - eventId: '4l0W12oB9v5HJNSHY4wv', - note: 'again', - timelineId: '10849df0-7b44-11e9-a608-ab3d811602f9', - timelineVersion: null, - noteId: '48eaf440-7b6d-11e9-980a-e5349fc014ef', - created: 1558404491600, - createdBy: 'elastic', - updated: 1558404491600, - updatedBy: 'elastic', - version: 'WzE0MSwxXQ==', - }, - { - eventId: null, - note: 'Hello world', - timelineId: '10849df0-7b44-11e9-a608-ab3d811602f9', - timelineVersion: null, - noteId: '308783f0-7b6d-11e9-980a-e5349fc014ef', - created: 1558404450688, - createdBy: 'elastic', - updated: 1558404450688, - updatedBy: 'elastic', - version: 'WzEzMywxXQ==', - }, - { - eventId: null, - note: 'here I am', - timelineId: '10849df0-7b44-11e9-a608-ab3d811602f9', - timelineVersion: null, - noteId: '34ec1690-7b6d-11e9-980a-e5349fc014ef', - created: 1558404458065, - createdBy: 'elastic', - updated: 1558404458065, - updatedBy: 'elastic', - version: 'WzEzNCwxXQ==', - }, - ], - noteIds: [ - '308783f0-7b6d-11e9-980a-e5349fc014ef', - '34ec1690-7b6d-11e9-980a-e5349fc014ef', - ], - pinnedEventIds: [ - 'Wl0W12oB9v5HJNSHb400', - '410W12oB9v5HJNSHY4wv', - 'ZF0W12oB9v5HJNSHwY6L', - ], - title: 'test 6', - timelineType: TimelineType.default, - templateTimelineId: null, - templateTimelineVersion: null, - created: 1558386787614, - createdBy: 'elastic', - updated: 1558390951234, - updatedBy: 'elastic', - version: 'WzEyOCwxXQ==', - }, - { - savedObjectId: '10849df0-7b44-11e9-a608-ab3d811602f96', - description: 'hhw4', - favorite: [ - { - fullName: null, - userName: 'elastic', - favoriteDate: 1558390951234, - }, - ], - eventIdToNoteIds: [ - { - eventId: '4l0W12oB9v5HJNSHY4wv', - note: 'test pinned event 2', - timelineId: '10849df0-7b44-11e9-a608-ab3d811602f9', - noteId: '44763500-7b6d-11e9-980a-e5349fc014ef', - created: 1558404484133, - createdBy: 'elastic', - timelineVersion: null, - updated: 1558404484133, - updatedBy: 'elastic', - version: 'WzEzOSwxXQ==', - }, - { - eventId: 'ZF0W12oB9v5HJNSHwY6L', - note: 'Test pinned 1', - timelineId: '10849df0-7b44-11e9-a608-ab3d811602f9', - noteId: '3e9d51e0-7b6d-11e9-980a-e5349fc014ef', - created: 1558404474317, - createdBy: 'elastic', - timelineVersion: null, - updated: 1558404474317, - updatedBy: 'elastic', - version: 'WzEzNywxXQ==', - }, - { - eventId: '4l0W12oB9v5HJNSHY4wv', - note: 'again', - timelineId: '10849df0-7b44-11e9-a608-ab3d811602f9', - noteId: '48eaf440-7b6d-11e9-980a-e5349fc014ef', - created: 1558404491600, - createdBy: 'elastic', - timelineVersion: null, - updated: 1558404491600, - updatedBy: 'elastic', - version: 'WzE0MSwxXQ==', - }, - ], - notes: [ - { - eventId: '4l0W12oB9v5HJNSHY4wv', - note: 'test pinned event 2', - timelineId: '10849df0-7b44-11e9-a608-ab3d811602f9', - timelineVersion: null, - noteId: '44763500-7b6d-11e9-980a-e5349fc014ef', - created: 1558404484133, - createdBy: 'elastic', - updated: 1558404484133, - updatedBy: 'elastic', - version: 'WzEzOSwxXQ==', - }, - { - eventId: 'ZF0W12oB9v5HJNSHwY6L', - note: 'Test pinned 1', - timelineId: '10849df0-7b44-11e9-a608-ab3d811602f9', - timelineVersion: null, - noteId: '3e9d51e0-7b6d-11e9-980a-e5349fc014ef', - created: 1558404474317, - createdBy: 'elastic', - updated: 1558404474317, - updatedBy: 'elastic', - version: 'WzEzNywxXQ==', - }, - { - eventId: '4l0W12oB9v5HJNSHY4wv', - note: 'again', - timelineId: '10849df0-7b44-11e9-a608-ab3d811602f9', - timelineVersion: null, - noteId: '48eaf440-7b6d-11e9-980a-e5349fc014ef', - created: 1558404491600, - createdBy: 'elastic', - updated: 1558404491600, - updatedBy: 'elastic', - version: 'WzE0MSwxXQ==', - }, - { - eventId: null, - note: 'Hello world', - timelineId: '10849df0-7b44-11e9-a608-ab3d811602f9', - timelineVersion: null, - noteId: '308783f0-7b6d-11e9-980a-e5349fc014ef', - created: 1558404450688, - createdBy: 'elastic', - updated: 1558404450688, - updatedBy: 'elastic', - version: 'WzEzMywxXQ==', - }, - { - eventId: null, - note: 'here I am', - timelineId: '10849df0-7b44-11e9-a608-ab3d811602f9', - timelineVersion: null, - noteId: '34ec1690-7b6d-11e9-980a-e5349fc014ef', - created: 1558404458065, - createdBy: 'elastic', - updated: 1558404458065, - updatedBy: 'elastic', - version: 'WzEzNCwxXQ==', - }, - ], - noteIds: [ - '308783f0-7b6d-11e9-980a-e5349fc014ef', - '34ec1690-7b6d-11e9-980a-e5349fc014ef', - ], - pinnedEventIds: [ - 'Wl0W12oB9v5HJNSHb400', - '410W12oB9v5HJNSHY4wv', - 'ZF0W12oB9v5HJNSHwY6L', - ], - title: 'test 7', - timelineType: TimelineType.default, - templateTimelineId: null, - templateTimelineVersion: null, - created: 1558386787614, - createdBy: 'elastic', - updated: 1558390951234, - updatedBy: 'elastic', - version: 'WzEyOCwxXQ==', - }, - { - savedObjectId: '10849df0-7b44-11e9-a608-ab3d811602f97', - description: 'hhw4', - favorite: [ - { - fullName: null, - userName: 'elastic', - favoriteDate: 1558390951234, - }, - ], - eventIdToNoteIds: [ - { - eventId: '4l0W12oB9v5HJNSHY4wv', - note: 'test pinned event 2', - timelineId: '10849df0-7b44-11e9-a608-ab3d811602f9', - noteId: '44763500-7b6d-11e9-980a-e5349fc014ef', - created: 1558404484133, - createdBy: 'elastic', - timelineVersion: null, - updated: 1558404484133, - updatedBy: 'elastic', - version: 'WzEzOSwxXQ==', - }, - { - eventId: 'ZF0W12oB9v5HJNSHwY6L', - note: 'Test pinned 1', - timelineId: '10849df0-7b44-11e9-a608-ab3d811602f9', - noteId: '3e9d51e0-7b6d-11e9-980a-e5349fc014ef', - created: 1558404474317, - createdBy: 'elastic', - timelineVersion: null, - updated: 1558404474317, - updatedBy: 'elastic', - version: 'WzEzNywxXQ==', - }, - { - eventId: '4l0W12oB9v5HJNSHY4wv', - note: 'again', - timelineId: '10849df0-7b44-11e9-a608-ab3d811602f9', - noteId: '48eaf440-7b6d-11e9-980a-e5349fc014ef', - created: 1558404491600, - createdBy: 'elastic', - timelineVersion: null, - updated: 1558404491600, - updatedBy: 'elastic', - version: 'WzE0MSwxXQ==', - }, - ], - notes: [ - { - eventId: '4l0W12oB9v5HJNSHY4wv', - note: 'test pinned event 2', - timelineId: '10849df0-7b44-11e9-a608-ab3d811602f9', - timelineVersion: null, - noteId: '44763500-7b6d-11e9-980a-e5349fc014ef', - created: 1558404484133, - createdBy: 'elastic', - updated: 1558404484133, - updatedBy: 'elastic', - version: 'WzEzOSwxXQ==', - }, - { - eventId: 'ZF0W12oB9v5HJNSHwY6L', - note: 'Test pinned 1', - timelineId: '10849df0-7b44-11e9-a608-ab3d811602f9', - timelineVersion: null, - noteId: '3e9d51e0-7b6d-11e9-980a-e5349fc014ef', - created: 1558404474317, - createdBy: 'elastic', - updated: 1558404474317, - updatedBy: 'elastic', - version: 'WzEzNywxXQ==', - }, - { - eventId: '4l0W12oB9v5HJNSHY4wv', - note: 'again', - timelineId: '10849df0-7b44-11e9-a608-ab3d811602f9', - timelineVersion: null, - noteId: '48eaf440-7b6d-11e9-980a-e5349fc014ef', - created: 1558404491600, - createdBy: 'elastic', - updated: 1558404491600, - updatedBy: 'elastic', - version: 'WzE0MSwxXQ==', - }, - { - eventId: null, - note: 'Hello world', - timelineId: '10849df0-7b44-11e9-a608-ab3d811602f9', - timelineVersion: null, - noteId: '308783f0-7b6d-11e9-980a-e5349fc014ef', - created: 1558404450688, - createdBy: 'elastic', - updated: 1558404450688, - updatedBy: 'elastic', - version: 'WzEzMywxXQ==', - }, - { - eventId: null, - note: 'here I am', - timelineId: '10849df0-7b44-11e9-a608-ab3d811602f9', - timelineVersion: null, - noteId: '34ec1690-7b6d-11e9-980a-e5349fc014ef', - created: 1558404458065, - createdBy: 'elastic', - updated: 1558404458065, - updatedBy: 'elastic', - version: 'WzEzNCwxXQ==', - }, - ], - noteIds: [ - '308783f0-7b6d-11e9-980a-e5349fc014ef', - '34ec1690-7b6d-11e9-980a-e5349fc014ef', - ], - pinnedEventIds: [ - 'Wl0W12oB9v5HJNSHb400', - '410W12oB9v5HJNSHY4wv', - 'ZF0W12oB9v5HJNSHwY6L', - ], - title: 'test 7', - timelineType: TimelineType.default, - templateTimelineId: null, - templateTimelineVersion: null, - created: 1558386787614, - createdBy: 'elastic', - updated: 1558390951234, - updatedBy: 'elastic', - version: 'WzEyOCwxXQ==', - }, - { - savedObjectId: '10849df0-7b44-11e9-a608-ab3d811602f98', - description: 'hhw4', - favorite: [ - { - fullName: null, - userName: 'elastic', - favoriteDate: 1558390951234, - }, - ], - eventIdToNoteIds: [ - { - eventId: '4l0W12oB9v5HJNSHY4wv', - note: 'test pinned event 2', - timelineId: '10849df0-7b44-11e9-a608-ab3d811602f9', - noteId: '44763500-7b6d-11e9-980a-e5349fc014ef', - created: 1558404484133, - createdBy: 'elastic', - timelineVersion: null, - updated: 1558404484133, - updatedBy: 'elastic', - version: 'WzEzOSwxXQ==', - }, - { - eventId: 'ZF0W12oB9v5HJNSHwY6L', - note: 'Test pinned 1', - timelineId: '10849df0-7b44-11e9-a608-ab3d811602f9', - noteId: '3e9d51e0-7b6d-11e9-980a-e5349fc014ef', - created: 1558404474317, - createdBy: 'elastic', - timelineVersion: null, - updated: 1558404474317, - updatedBy: 'elastic', - version: 'WzEzNywxXQ==', - }, - { - eventId: '4l0W12oB9v5HJNSHY4wv', - note: 'again', - timelineId: '10849df0-7b44-11e9-a608-ab3d811602f9', - noteId: '48eaf440-7b6d-11e9-980a-e5349fc014ef', - created: 1558404491600, - createdBy: 'elastic', - timelineVersion: null, - updated: 1558404491600, - updatedBy: 'elastic', - version: 'WzE0MSwxXQ==', - }, - ], - notes: [ - { - eventId: '4l0W12oB9v5HJNSHY4wv', - note: 'test pinned event 2', - timelineId: '10849df0-7b44-11e9-a608-ab3d811602f9', - timelineVersion: null, - noteId: '44763500-7b6d-11e9-980a-e5349fc014ef', - created: 1558404484133, - createdBy: 'elastic', - updated: 1558404484133, - updatedBy: 'elastic', - version: 'WzEzOSwxXQ==', - }, - { - eventId: 'ZF0W12oB9v5HJNSHwY6L', - note: 'Test pinned 1', - timelineId: '10849df0-7b44-11e9-a608-ab3d811602f9', - timelineVersion: null, - noteId: '3e9d51e0-7b6d-11e9-980a-e5349fc014ef', - created: 1558404474317, - createdBy: 'elastic', - updated: 1558404474317, - updatedBy: 'elastic', - version: 'WzEzNywxXQ==', - }, - { - eventId: '4l0W12oB9v5HJNSHY4wv', - note: 'again', - timelineId: '10849df0-7b44-11e9-a608-ab3d811602f9', - timelineVersion: null, - noteId: '48eaf440-7b6d-11e9-980a-e5349fc014ef', - created: 1558404491600, - createdBy: 'elastic', - updated: 1558404491600, - updatedBy: 'elastic', - version: 'WzE0MSwxXQ==', - }, - { - eventId: null, - note: 'Hello world', - timelineId: '10849df0-7b44-11e9-a608-ab3d811602f9', - timelineVersion: null, - noteId: '308783f0-7b6d-11e9-980a-e5349fc014ef', - created: 1558404450688, - createdBy: 'elastic', - updated: 1558404450688, - updatedBy: 'elastic', - version: 'WzEzMywxXQ==', - }, - { - eventId: null, - note: 'here I am', - timelineId: '10849df0-7b44-11e9-a608-ab3d811602f9', - timelineVersion: null, - noteId: '34ec1690-7b6d-11e9-980a-e5349fc014ef', - created: 1558404458065, - createdBy: 'elastic', - updated: 1558404458065, - updatedBy: 'elastic', - version: 'WzEzNCwxXQ==', - }, - ], - noteIds: [ - '308783f0-7b6d-11e9-980a-e5349fc014ef', - '34ec1690-7b6d-11e9-980a-e5349fc014ef', - ], - pinnedEventIds: [ - 'Wl0W12oB9v5HJNSHb400', - '410W12oB9v5HJNSHY4wv', - 'ZF0W12oB9v5HJNSHwY6L', - ], - title: 'test 7', - timelineType: TimelineType.default, - templateTimelineId: null, - templateTimelineVersion: null, - created: 1558386787614, - createdBy: 'elastic', - updated: 1558390951234, - updatedBy: 'elastic', - version: 'WzEyOCwxXQ==', - }, - { - savedObjectId: '10849df0-7b44-11e9-a608-ab3d811602f99', - description: 'hhw4', - favorite: [ - { - fullName: null, - userName: 'elastic', - favoriteDate: 1558390951234, - }, - ], - eventIdToNoteIds: [ - { - eventId: '4l0W12oB9v5HJNSHY4wv', - note: 'test pinned event 2', - timelineId: '10849df0-7b44-11e9-a608-ab3d811602f9', - noteId: '44763500-7b6d-11e9-980a-e5349fc014ef', - created: 1558404484133, - createdBy: 'elastic', - timelineVersion: null, - updated: 1558404484133, - updatedBy: 'elastic', - version: 'WzEzOSwxXQ==', - }, - { - eventId: 'ZF0W12oB9v5HJNSHwY6L', - note: 'Test pinned 1', - timelineId: '10849df0-7b44-11e9-a608-ab3d811602f9', - noteId: '3e9d51e0-7b6d-11e9-980a-e5349fc014ef', - created: 1558404474317, - createdBy: 'elastic', - timelineVersion: null, - updated: 1558404474317, - updatedBy: 'elastic', - version: 'WzEzNywxXQ==', - }, - { - eventId: '4l0W12oB9v5HJNSHY4wv', - note: 'again', - timelineId: '10849df0-7b44-11e9-a608-ab3d811602f9', - noteId: '48eaf440-7b6d-11e9-980a-e5349fc014ef', - created: 1558404491600, - createdBy: 'elastic', - timelineVersion: null, - updated: 1558404491600, - updatedBy: 'elastic', - version: 'WzE0MSwxXQ==', - }, - ], - notes: [ - { - eventId: '4l0W12oB9v5HJNSHY4wv', - note: 'test pinned event 2', - timelineId: '10849df0-7b44-11e9-a608-ab3d811602f9', - timelineVersion: null, - noteId: '44763500-7b6d-11e9-980a-e5349fc014ef', - created: 1558404484133, - createdBy: 'elastic', - updated: 1558404484133, - updatedBy: 'elastic', - version: 'WzEzOSwxXQ==', - }, - { - eventId: 'ZF0W12oB9v5HJNSHwY6L', - note: 'Test pinned 1', - timelineId: '10849df0-7b44-11e9-a608-ab3d811602f9', - timelineVersion: null, - noteId: '3e9d51e0-7b6d-11e9-980a-e5349fc014ef', - created: 1558404474317, - createdBy: 'elastic', - updated: 1558404474317, - updatedBy: 'elastic', - version: 'WzEzNywxXQ==', - }, - { - eventId: '4l0W12oB9v5HJNSHY4wv', - note: 'again', - timelineId: '10849df0-7b44-11e9-a608-ab3d811602f9', - timelineVersion: null, - noteId: '48eaf440-7b6d-11e9-980a-e5349fc014ef', - created: 1558404491600, - createdBy: 'elastic', - updated: 1558404491600, - updatedBy: 'elastic', - version: 'WzE0MSwxXQ==', - }, - { - eventId: null, - note: 'Hello world', - timelineId: '10849df0-7b44-11e9-a608-ab3d811602f9', - timelineVersion: null, - noteId: '308783f0-7b6d-11e9-980a-e5349fc014ef', - created: 1558404450688, - createdBy: 'elastic', - updated: 1558404450688, - updatedBy: 'elastic', - version: 'WzEzMywxXQ==', - }, - { - eventId: null, - note: 'here I am', - timelineId: '10849df0-7b44-11e9-a608-ab3d811602f9', - timelineVersion: null, - noteId: '34ec1690-7b6d-11e9-980a-e5349fc014ef', - created: 1558404458065, - createdBy: 'elastic', - updated: 1558404458065, - updatedBy: 'elastic', - version: 'WzEzNCwxXQ==', - }, - ], - noteIds: [ - '308783f0-7b6d-11e9-980a-e5349fc014ef', - '34ec1690-7b6d-11e9-980a-e5349fc014ef', - ], - pinnedEventIds: [ - 'Wl0W12oB9v5HJNSHb400', - '410W12oB9v5HJNSHY4wv', - 'ZF0W12oB9v5HJNSHwY6L', - ], - title: 'test 7', - timelineType: TimelineType.default, - templateTimelineId: null, - templateTimelineVersion: null, - created: 1558386787614, - createdBy: 'elastic', - updated: 1558390951234, - updatedBy: 'elastic', - version: 'WzEyOCwxXQ==', - }, - { - savedObjectId: '10849df0-7b44-11e9-a608-ab3d811602f910', - description: 'hhw4', - favorite: [ - { - fullName: null, - userName: 'elastic', - favoriteDate: 1558390951234, - }, - ], - eventIdToNoteIds: [ - { - eventId: '4l0W12oB9v5HJNSHY4wv', - note: 'test pinned event 2', - timelineId: '10849df0-7b44-11e9-a608-ab3d811602f9', - noteId: '44763500-7b6d-11e9-980a-e5349fc014ef', - created: 1558404484133, - createdBy: 'elastic', - timelineVersion: null, - updated: 1558404484133, - updatedBy: 'elastic', - version: 'WzEzOSwxXQ==', - }, - { - eventId: 'ZF0W12oB9v5HJNSHwY6L', - note: 'Test pinned 1', - timelineId: '10849df0-7b44-11e9-a608-ab3d811602f9', - noteId: '3e9d51e0-7b6d-11e9-980a-e5349fc014ef', - created: 1558404474317, - createdBy: 'elastic', - timelineVersion: null, - updated: 1558404474317, - updatedBy: 'elastic', - version: 'WzEzNywxXQ==', - }, - { - eventId: '4l0W12oB9v5HJNSHY4wv', - note: 'again', - timelineId: '10849df0-7b44-11e9-a608-ab3d811602f9', - noteId: '48eaf440-7b6d-11e9-980a-e5349fc014ef', - created: 1558404491600, - createdBy: 'elastic', - timelineVersion: null, - updated: 1558404491600, - updatedBy: 'elastic', - version: 'WzE0MSwxXQ==', - }, - ], - notes: [ - { - eventId: '4l0W12oB9v5HJNSHY4wv', - note: 'test pinned event 2', - timelineId: '10849df0-7b44-11e9-a608-ab3d811602f9', - timelineVersion: null, - noteId: '44763500-7b6d-11e9-980a-e5349fc014ef', - created: 1558404484133, - createdBy: 'elastic', - updated: 1558404484133, - updatedBy: 'elastic', - version: 'WzEzOSwxXQ==', - }, - { - eventId: 'ZF0W12oB9v5HJNSHwY6L', - note: 'Test pinned 1', - timelineId: '10849df0-7b44-11e9-a608-ab3d811602f9', - timelineVersion: null, - noteId: '3e9d51e0-7b6d-11e9-980a-e5349fc014ef', - created: 1558404474317, - createdBy: 'elastic', - updated: 1558404474317, - updatedBy: 'elastic', - version: 'WzEzNywxXQ==', - }, - { - eventId: '4l0W12oB9v5HJNSHY4wv', - note: 'again', - timelineId: '10849df0-7b44-11e9-a608-ab3d811602f9', - timelineVersion: null, - noteId: '48eaf440-7b6d-11e9-980a-e5349fc014ef', - created: 1558404491600, - createdBy: 'elastic', - updated: 1558404491600, - updatedBy: 'elastic', - version: 'WzE0MSwxXQ==', - }, - { - eventId: null, - note: 'Hello world', - timelineId: '10849df0-7b44-11e9-a608-ab3d811602f9', - timelineVersion: null, - noteId: '308783f0-7b6d-11e9-980a-e5349fc014ef', - created: 1558404450688, - createdBy: 'elastic', - updated: 1558404450688, - updatedBy: 'elastic', - version: 'WzEzMywxXQ==', - }, - { - eventId: null, - note: 'here I am', - timelineId: '10849df0-7b44-11e9-a608-ab3d811602f9', - timelineVersion: null, - noteId: '34ec1690-7b6d-11e9-980a-e5349fc014ef', - created: 1558404458065, - createdBy: 'elastic', - updated: 1558404458065, - updatedBy: 'elastic', - version: 'WzEzNCwxXQ==', - }, - ], - noteIds: [ - '308783f0-7b6d-11e9-980a-e5349fc014ef', - '34ec1690-7b6d-11e9-980a-e5349fc014ef', - ], - pinnedEventIds: [ - 'Wl0W12oB9v5HJNSHb400', - '410W12oB9v5HJNSHY4wv', - 'ZF0W12oB9v5HJNSHwY6L', - ], - title: 'test 7', - timelineType: TimelineType.default, - templateTimelineId: null, - templateTimelineVersion: null, - created: 1558386787614, - createdBy: 'elastic', - updated: 1558390951234, - updatedBy: 'elastic', - version: 'WzEyOCwxXQ==', - }, - { - savedObjectId: '10849df0-7b44-11e9-a608-ab3d811602f911', - description: 'hhw4', - favorite: [ - { - fullName: null, - userName: 'elastic', - favoriteDate: 1558390951234, - }, - ], - eventIdToNoteIds: [ - { - eventId: '4l0W12oB9v5HJNSHY4wv', - note: 'test pinned event 2', - timelineId: '10849df0-7b44-11e9-a608-ab3d811602f9', - noteId: '44763500-7b6d-11e9-980a-e5349fc014ef', - created: 1558404484133, - createdBy: 'elastic', - timelineVersion: null, - updated: 1558404484133, - updatedBy: 'elastic', - version: 'WzEzOSwxXQ==', - }, - { - eventId: 'ZF0W12oB9v5HJNSHwY6L', - note: 'Test pinned 1', - timelineId: '10849df0-7b44-11e9-a608-ab3d811602f9', - noteId: '3e9d51e0-7b6d-11e9-980a-e5349fc014ef', - created: 1558404474317, - createdBy: 'elastic', - timelineVersion: null, - updated: 1558404474317, - updatedBy: 'elastic', - version: 'WzEzNywxXQ==', - }, - { - eventId: '4l0W12oB9v5HJNSHY4wv', - note: 'again', - timelineId: '10849df0-7b44-11e9-a608-ab3d811602f9', - noteId: '48eaf440-7b6d-11e9-980a-e5349fc014ef', - created: 1558404491600, - createdBy: 'elastic', - timelineVersion: null, - updated: 1558404491600, - updatedBy: 'elastic', - version: 'WzE0MSwxXQ==', - }, - ], - notes: [ - { - eventId: '4l0W12oB9v5HJNSHY4wv', - note: 'test pinned event 2', - timelineId: '10849df0-7b44-11e9-a608-ab3d811602f9', - timelineVersion: null, - noteId: '44763500-7b6d-11e9-980a-e5349fc014ef', - created: 1558404484133, - createdBy: 'elastic', - updated: 1558404484133, - updatedBy: 'elastic', - version: 'WzEzOSwxXQ==', - }, - { - eventId: 'ZF0W12oB9v5HJNSHwY6L', - note: 'Test pinned 1', - timelineId: '10849df0-7b44-11e9-a608-ab3d811602f9', - timelineVersion: null, - noteId: '3e9d51e0-7b6d-11e9-980a-e5349fc014ef', - created: 1558404474317, - createdBy: 'elastic', - updated: 1558404474317, - updatedBy: 'elastic', - version: 'WzEzNywxXQ==', - }, - { - eventId: '4l0W12oB9v5HJNSHY4wv', - note: 'again', - timelineId: '10849df0-7b44-11e9-a608-ab3d811602f9', - timelineVersion: null, - noteId: '48eaf440-7b6d-11e9-980a-e5349fc014ef', - created: 1558404491600, - createdBy: 'elastic', - updated: 1558404491600, - updatedBy: 'elastic', - version: 'WzE0MSwxXQ==', - }, - { - eventId: null, - note: 'Hello world', - timelineId: '10849df0-7b44-11e9-a608-ab3d811602f9', - timelineVersion: null, - noteId: '308783f0-7b6d-11e9-980a-e5349fc014ef', - created: 1558404450688, - createdBy: 'elastic', - updated: 1558404450688, - updatedBy: 'elastic', - version: 'WzEzMywxXQ==', - }, - { - eventId: null, - note: 'here I am', - timelineId: '10849df0-7b44-11e9-a608-ab3d811602f9', - timelineVersion: null, - noteId: '34ec1690-7b6d-11e9-980a-e5349fc014ef', - created: 1558404458065, - createdBy: 'elastic', - updated: 1558404458065, - updatedBy: 'elastic', - version: 'WzEzNCwxXQ==', - }, - ], - noteIds: [ - '308783f0-7b6d-11e9-980a-e5349fc014ef', - '34ec1690-7b6d-11e9-980a-e5349fc014ef', - ], - pinnedEventIds: [ - 'Wl0W12oB9v5HJNSHb400', - '410W12oB9v5HJNSHY4wv', - 'ZF0W12oB9v5HJNSHwY6L', - ], - title: 'test 7', - timelineType: TimelineType.default, - templateTimelineId: null, - templateTimelineVersion: null, - created: 1558386787614, - createdBy: 'elastic', - updated: 1558390951234, - updatedBy: 'elastic', - version: 'WzEyOCwxXQ==', - }, - ], + { + savedObjectId: '10849df0-7b44-11e9-a608-ab3d811602f91', + description: 'hhw4', + favorite: [ + { + fullName: null, + userName: 'elastic', + favoriteDate: 1558390951234, }, - }, + ], + eventIdToNoteIds: [ + { + eventId: '4l0W12oB9v5HJNSHY4wv', + note: 'test pinned event 2', + timelineId: '10849df0-7b44-11e9-a608-ab3d811602f9', + noteId: '44763500-7b6d-11e9-980a-e5349fc014ef', + created: 1558404484133, + createdBy: 'elastic', + timelineVersion: null, + updated: 1558404484133, + updatedBy: 'elastic', + version: 'WzEzOSwxXQ==', + }, + { + eventId: 'ZF0W12oB9v5HJNSHwY6L', + note: 'Test pinned 1', + timelineId: '10849df0-7b44-11e9-a608-ab3d811602f9', + noteId: '3e9d51e0-7b6d-11e9-980a-e5349fc014ef', + created: 1558404474317, + createdBy: 'elastic', + timelineVersion: null, + updated: 1558404474317, + updatedBy: 'elastic', + version: 'WzEzNywxXQ==', + }, + { + eventId: '4l0W12oB9v5HJNSHY4wv', + note: 'again', + timelineId: '10849df0-7b44-11e9-a608-ab3d811602f9', + noteId: '48eaf440-7b6d-11e9-980a-e5349fc014ef', + created: 1558404491600, + createdBy: 'elastic', + timelineVersion: null, + updated: 1558404491600, + updatedBy: 'elastic', + version: 'WzE0MSwxXQ==', + }, + ], + notes: [ + { + eventId: '4l0W12oB9v5HJNSHY4wv', + note: 'test pinned event 2', + timelineId: '10849df0-7b44-11e9-a608-ab3d811602f9', + timelineVersion: null, + noteId: '44763500-7b6d-11e9-980a-e5349fc014ef', + created: 1558404484133, + createdBy: 'elastic', + updated: 1558404484133, + updatedBy: 'elastic', + version: 'WzEzOSwxXQ==', + }, + { + eventId: 'ZF0W12oB9v5HJNSHwY6L', + note: 'Test pinned 1', + timelineId: '10849df0-7b44-11e9-a608-ab3d811602f9', + timelineVersion: null, + noteId: '3e9d51e0-7b6d-11e9-980a-e5349fc014ef', + created: 1558404474317, + createdBy: 'elastic', + updated: 1558404474317, + updatedBy: 'elastic', + version: 'WzEzNywxXQ==', + }, + { + eventId: '4l0W12oB9v5HJNSHY4wv', + note: 'again', + timelineId: '10849df0-7b44-11e9-a608-ab3d811602f9', + timelineVersion: null, + noteId: '48eaf440-7b6d-11e9-980a-e5349fc014ef', + created: 1558404491600, + createdBy: 'elastic', + updated: 1558404491600, + updatedBy: 'elastic', + version: 'WzE0MSwxXQ==', + }, + { + eventId: null, + note: 'Hello world', + timelineId: '10849df0-7b44-11e9-a608-ab3d811602f9', + timelineVersion: null, + noteId: '308783f0-7b6d-11e9-980a-e5349fc014ef', + created: 1558404450688, + createdBy: 'elastic', + updated: 1558404450688, + updatedBy: 'elastic', + version: 'WzEzMywxXQ==', + }, + { + eventId: null, + note: 'here I am', + timelineId: '10849df0-7b44-11e9-a608-ab3d811602f9', + timelineVersion: null, + noteId: '34ec1690-7b6d-11e9-980a-e5349fc014ef', + created: 1558404458065, + createdBy: 'elastic', + updated: 1558404458065, + updatedBy: 'elastic', + version: 'WzEzNCwxXQ==', + }, + ], + noteIds: ['308783f0-7b6d-11e9-980a-e5349fc014ef', '34ec1690-7b6d-11e9-980a-e5349fc014ef'], + pinnedEventIds: ['Wl0W12oB9v5HJNSHb400', '410W12oB9v5HJNSHY4wv', 'ZF0W12oB9v5HJNSHwY6L'], + title: 'test 2', + timelineType: TimelineType.default, + templateTimelineId: null, + templateTimelineVersion: null, + created: 1558386787614, + createdBy: 'elastic', + updated: 1558390951234, + updatedBy: 'elastic', + version: 'WzEyOCwxXQ==', }, - }, -]; + { + savedObjectId: '10849df0-7b44-11e9-a608-ab3d811602f92', + description: 'hhw4', + favorite: [ + { + fullName: null, + userName: 'elastic', + favoriteDate: 1558390951234, + }, + ], + eventIdToNoteIds: [ + { + eventId: '4l0W12oB9v5HJNSHY4wv', + note: 'test pinned event 2', + timelineId: '10849df0-7b44-11e9-a608-ab3d811602f9', + noteId: '44763500-7b6d-11e9-980a-e5349fc014ef', + created: 1558404484133, + createdBy: 'elastic', + timelineVersion: null, + updated: 1558404484133, + updatedBy: 'elastic', + version: 'WzEzOSwxXQ==', + }, + { + eventId: 'ZF0W12oB9v5HJNSHwY6L', + note: 'Test pinned 1', + timelineId: '10849df0-7b44-11e9-a608-ab3d811602f9', + noteId: '3e9d51e0-7b6d-11e9-980a-e5349fc014ef', + created: 1558404474317, + createdBy: 'elastic', + timelineVersion: null, + updated: 1558404474317, + updatedBy: 'elastic', + version: 'WzEzNywxXQ==', + }, + { + eventId: '4l0W12oB9v5HJNSHY4wv', + note: 'again', + timelineId: '10849df0-7b44-11e9-a608-ab3d811602f9', + noteId: '48eaf440-7b6d-11e9-980a-e5349fc014ef', + created: 1558404491600, + createdBy: 'elastic', + timelineVersion: null, + updated: 1558404491600, + updatedBy: 'elastic', + version: 'WzE0MSwxXQ==', + }, + ], + notes: [ + { + eventId: '4l0W12oB9v5HJNSHY4wv', + note: 'test pinned event 2', + timelineId: '10849df0-7b44-11e9-a608-ab3d811602f9', + timelineVersion: null, + noteId: '44763500-7b6d-11e9-980a-e5349fc014ef', + created: 1558404484133, + createdBy: 'elastic', + updated: 1558404484133, + updatedBy: 'elastic', + version: 'WzEzOSwxXQ==', + }, + { + eventId: 'ZF0W12oB9v5HJNSHwY6L', + note: 'Test pinned 1', + timelineId: '10849df0-7b44-11e9-a608-ab3d811602f9', + timelineVersion: null, + noteId: '3e9d51e0-7b6d-11e9-980a-e5349fc014ef', + created: 1558404474317, + createdBy: 'elastic', + updated: 1558404474317, + updatedBy: 'elastic', + version: 'WzEzNywxXQ==', + }, + { + eventId: '4l0W12oB9v5HJNSHY4wv', + note: 'again', + timelineId: '10849df0-7b44-11e9-a608-ab3d811602f9', + timelineVersion: null, + noteId: '48eaf440-7b6d-11e9-980a-e5349fc014ef', + created: 1558404491600, + createdBy: 'elastic', + updated: 1558404491600, + updatedBy: 'elastic', + version: 'WzE0MSwxXQ==', + }, + { + eventId: null, + note: 'Hello world', + timelineId: '10849df0-7b44-11e9-a608-ab3d811602f9', + timelineVersion: null, + noteId: '308783f0-7b6d-11e9-980a-e5349fc014ef', + created: 1558404450688, + createdBy: 'elastic', + updated: 1558404450688, + updatedBy: 'elastic', + version: 'WzEzMywxXQ==', + }, + { + eventId: null, + note: 'here I am', + timelineId: '10849df0-7b44-11e9-a608-ab3d811602f9', + timelineVersion: null, + noteId: '34ec1690-7b6d-11e9-980a-e5349fc014ef', + created: 1558404458065, + createdBy: 'elastic', + updated: 1558404458065, + updatedBy: 'elastic', + version: 'WzEzNCwxXQ==', + }, + ], + noteIds: ['308783f0-7b6d-11e9-980a-e5349fc014ef', '34ec1690-7b6d-11e9-980a-e5349fc014ef'], + pinnedEventIds: ['Wl0W12oB9v5HJNSHb400', '410W12oB9v5HJNSHY4wv', 'ZF0W12oB9v5HJNSHwY6L'], + title: 'test 2', + timelineType: TimelineType.default, + templateTimelineId: null, + templateTimelineVersion: null, + created: 1558386787614, + createdBy: 'elastic', + updated: 1558390951234, + updatedBy: 'elastic', + version: 'WzEyOCwxXQ==', + }, + { + savedObjectId: '10849df0-7b44-11e9-a608-ab3d811602f9', + description: 'hhw4', + favorite: [ + { + fullName: null, + userName: 'elastic', + favoriteDate: 1558390951234, + }, + ], + eventIdToNoteIds: [ + { + eventId: '4l0W12oB9v5HJNSHY4wv', + note: 'test pinned event 2', + timelineId: '10849df0-7b44-11e9-a608-ab3d811602f9', + noteId: '44763500-7b6d-11e9-980a-e5349fc014ef', + created: 1558404484133, + createdBy: 'elastic', + timelineVersion: null, + updated: 1558404484133, + updatedBy: 'elastic', + version: 'WzEzOSwxXQ==', + }, + { + eventId: 'ZF0W12oB9v5HJNSHwY6L', + note: 'Test pinned 1', + timelineId: '10849df0-7b44-11e9-a608-ab3d811602f9', + noteId: '3e9d51e0-7b6d-11e9-980a-e5349fc014ef', + created: 1558404474317, + createdBy: 'elastic', + timelineVersion: null, + updated: 1558404474317, + updatedBy: 'elastic', + version: 'WzEzNywxXQ==', + }, + { + eventId: '4l0W12oB9v5HJNSHY4wv', + note: 'again', + timelineId: '10849df0-7b44-11e9-a608-ab3d811602f9', + noteId: '48eaf440-7b6d-11e9-980a-e5349fc014ef', + created: 1558404491600, + createdBy: 'elastic', + timelineVersion: null, + updated: 1558404491600, + updatedBy: 'elastic', + version: 'WzE0MSwxXQ==', + }, + ], + notes: [ + { + eventId: '4l0W12oB9v5HJNSHY4wv', + note: 'test pinned event 2', + timelineId: '10849df0-7b44-11e9-a608-ab3d811602f9', + timelineVersion: null, + noteId: '44763500-7b6d-11e9-980a-e5349fc014ef', + created: 1558404484133, + createdBy: 'elastic', + updated: 1558404484133, + updatedBy: 'elastic', + version: 'WzEzOSwxXQ==', + }, + { + eventId: 'ZF0W12oB9v5HJNSHwY6L', + note: 'Test pinned 1', + timelineId: '10849df0-7b44-11e9-a608-ab3d811602f9', + timelineVersion: null, + noteId: '3e9d51e0-7b6d-11e9-980a-e5349fc014ef', + created: 1558404474317, + createdBy: 'elastic', + updated: 1558404474317, + updatedBy: 'elastic', + version: 'WzEzNywxXQ==', + }, + { + eventId: '4l0W12oB9v5HJNSHY4wv', + note: 'again', + timelineId: '10849df0-7b44-11e9-a608-ab3d811602f9', + timelineVersion: null, + noteId: '48eaf440-7b6d-11e9-980a-e5349fc014ef', + created: 1558404491600, + createdBy: 'elastic', + updated: 1558404491600, + updatedBy: 'elastic', + version: 'WzE0MSwxXQ==', + }, + { + eventId: null, + note: 'Hello world', + timelineId: '10849df0-7b44-11e9-a608-ab3d811602f9', + timelineVersion: null, + noteId: '308783f0-7b6d-11e9-980a-e5349fc014ef', + created: 1558404450688, + createdBy: 'elastic', + updated: 1558404450688, + updatedBy: 'elastic', + version: 'WzEzMywxXQ==', + }, + { + eventId: null, + note: 'here I am', + timelineId: '10849df0-7b44-11e9-a608-ab3d811602f9', + timelineVersion: null, + noteId: '34ec1690-7b6d-11e9-980a-e5349fc014ef', + created: 1558404458065, + createdBy: 'elastic', + updated: 1558404458065, + updatedBy: 'elastic', + version: 'WzEzNCwxXQ==', + }, + ], + noteIds: ['308783f0-7b6d-11e9-980a-e5349fc014ef', '34ec1690-7b6d-11e9-980a-e5349fc014ef'], + pinnedEventIds: ['Wl0W12oB9v5HJNSHb400', '410W12oB9v5HJNSHY4wv', 'ZF0W12oB9v5HJNSHwY6L'], + title: 'test 3', + timelineType: TimelineType.default, + templateTimelineId: null, + templateTimelineVersion: null, + created: 1558386787614, + createdBy: 'elastic', + updated: 1558390951234, + updatedBy: 'elastic', + version: 'WzEyOCwxXQ==', + }, + { + savedObjectId: '10849df0-7b44-11e9-a608-ab3d811602f93', + description: 'hhw4', + favorite: [ + { + fullName: null, + userName: 'elastic', + favoriteDate: 1558390951234, + }, + ], + eventIdToNoteIds: [ + { + eventId: '4l0W12oB9v5HJNSHY4wv', + note: 'test pinned event 2', + timelineId: '10849df0-7b44-11e9-a608-ab3d811602f9', + noteId: '44763500-7b6d-11e9-980a-e5349fc014ef', + created: 1558404484133, + createdBy: 'elastic', + timelineVersion: null, + updated: 1558404484133, + updatedBy: 'elastic', + version: 'WzEzOSwxXQ==', + }, + { + eventId: 'ZF0W12oB9v5HJNSHwY6L', + note: 'Test pinned 1', + timelineId: '10849df0-7b44-11e9-a608-ab3d811602f9', + noteId: '3e9d51e0-7b6d-11e9-980a-e5349fc014ef', + created: 1558404474317, + createdBy: 'elastic', + timelineVersion: null, + updated: 1558404474317, + updatedBy: 'elastic', + version: 'WzEzNywxXQ==', + }, + { + eventId: '4l0W12oB9v5HJNSHY4wv', + note: 'again', + timelineId: '10849df0-7b44-11e9-a608-ab3d811602f9', + noteId: '48eaf440-7b6d-11e9-980a-e5349fc014ef', + created: 1558404491600, + createdBy: 'elastic', + timelineVersion: null, + updated: 1558404491600, + updatedBy: 'elastic', + version: 'WzE0MSwxXQ==', + }, + ], + notes: [ + { + eventId: '4l0W12oB9v5HJNSHY4wv', + note: 'test pinned event 2', + timelineId: '10849df0-7b44-11e9-a608-ab3d811602f9', + timelineVersion: null, + noteId: '44763500-7b6d-11e9-980a-e5349fc014ef', + created: 1558404484133, + createdBy: 'elastic', + updated: 1558404484133, + updatedBy: 'elastic', + version: 'WzEzOSwxXQ==', + }, + { + eventId: 'ZF0W12oB9v5HJNSHwY6L', + note: 'Test pinned 1', + timelineId: '10849df0-7b44-11e9-a608-ab3d811602f9', + timelineVersion: null, + noteId: '3e9d51e0-7b6d-11e9-980a-e5349fc014ef', + created: 1558404474317, + createdBy: 'elastic', + updated: 1558404474317, + updatedBy: 'elastic', + version: 'WzEzNywxXQ==', + }, + { + eventId: '4l0W12oB9v5HJNSHY4wv', + note: 'again', + timelineId: '10849df0-7b44-11e9-a608-ab3d811602f9', + timelineVersion: null, + noteId: '48eaf440-7b6d-11e9-980a-e5349fc014ef', + created: 1558404491600, + createdBy: 'elastic', + updated: 1558404491600, + updatedBy: 'elastic', + version: 'WzE0MSwxXQ==', + }, + { + eventId: null, + note: 'Hello world', + timelineId: '10849df0-7b44-11e9-a608-ab3d811602f9', + timelineVersion: null, + noteId: '308783f0-7b6d-11e9-980a-e5349fc014ef', + created: 1558404450688, + createdBy: 'elastic', + updated: 1558404450688, + updatedBy: 'elastic', + version: 'WzEzMywxXQ==', + }, + { + eventId: null, + note: 'here I am', + timelineId: '10849df0-7b44-11e9-a608-ab3d811602f9', + timelineVersion: null, + noteId: '34ec1690-7b6d-11e9-980a-e5349fc014ef', + created: 1558404458065, + createdBy: 'elastic', + updated: 1558404458065, + updatedBy: 'elastic', + version: 'WzEzNCwxXQ==', + }, + ], + noteIds: ['308783f0-7b6d-11e9-980a-e5349fc014ef', '34ec1690-7b6d-11e9-980a-e5349fc014ef'], + pinnedEventIds: ['Wl0W12oB9v5HJNSHb400', '410W12oB9v5HJNSHY4wv', 'ZF0W12oB9v5HJNSHwY6L'], + title: 'test 4', + timelineType: TimelineType.default, + templateTimelineId: null, + templateTimelineVersion: null, + created: 1558386787614, + createdBy: 'elastic', + updated: 1558390951234, + updatedBy: 'elastic', + version: 'WzEyOCwxXQ==', + }, + { + savedObjectId: '10849df0-7b44-11e9-a608-ab3d811602f94', + description: 'hhw4', + favorite: [ + { + fullName: null, + userName: 'elastic', + favoriteDate: 1558390951234, + }, + ], + eventIdToNoteIds: [ + { + eventId: '4l0W12oB9v5HJNSHY4wv', + note: 'test pinned event 2', + timelineId: '10849df0-7b44-11e9-a608-ab3d811602f9', + noteId: '44763500-7b6d-11e9-980a-e5349fc014ef', + created: 1558404484133, + createdBy: 'elastic', + timelineVersion: null, + updated: 1558404484133, + updatedBy: 'elastic', + version: 'WzEzOSwxXQ==', + }, + { + eventId: 'ZF0W12oB9v5HJNSHwY6L', + note: 'Test pinned 1', + timelineId: '10849df0-7b44-11e9-a608-ab3d811602f9', + noteId: '3e9d51e0-7b6d-11e9-980a-e5349fc014ef', + created: 1558404474317, + createdBy: 'elastic', + timelineVersion: null, + updated: 1558404474317, + updatedBy: 'elastic', + version: 'WzEzNywxXQ==', + }, + { + eventId: '4l0W12oB9v5HJNSHY4wv', + note: 'again', + timelineId: '10849df0-7b44-11e9-a608-ab3d811602f9', + noteId: '48eaf440-7b6d-11e9-980a-e5349fc014ef', + created: 1558404491600, + createdBy: 'elastic', + timelineVersion: null, + updated: 1558404491600, + updatedBy: 'elastic', + version: 'WzE0MSwxXQ==', + }, + ], + notes: [ + { + eventId: '4l0W12oB9v5HJNSHY4wv', + note: 'test pinned event 2', + timelineId: '10849df0-7b44-11e9-a608-ab3d811602f9', + timelineVersion: null, + noteId: '44763500-7b6d-11e9-980a-e5349fc014ef', + created: 1558404484133, + createdBy: 'elastic', + updated: 1558404484133, + updatedBy: 'elastic', + version: 'WzEzOSwxXQ==', + }, + { + eventId: 'ZF0W12oB9v5HJNSHwY6L', + note: 'Test pinned 1', + timelineId: '10849df0-7b44-11e9-a608-ab3d811602f9', + timelineVersion: null, + noteId: '3e9d51e0-7b6d-11e9-980a-e5349fc014ef', + created: 1558404474317, + createdBy: 'elastic', + updated: 1558404474317, + updatedBy: 'elastic', + version: 'WzEzNywxXQ==', + }, + { + eventId: '4l0W12oB9v5HJNSHY4wv', + note: 'again', + timelineId: '10849df0-7b44-11e9-a608-ab3d811602f9', + timelineVersion: null, + noteId: '48eaf440-7b6d-11e9-980a-e5349fc014ef', + created: 1558404491600, + createdBy: 'elastic', + updated: 1558404491600, + updatedBy: 'elastic', + version: 'WzE0MSwxXQ==', + }, + { + eventId: null, + note: 'Hello world', + timelineId: '10849df0-7b44-11e9-a608-ab3d811602f9', + timelineVersion: null, + noteId: '308783f0-7b6d-11e9-980a-e5349fc014ef', + created: 1558404450688, + createdBy: 'elastic', + updated: 1558404450688, + updatedBy: 'elastic', + version: 'WzEzMywxXQ==', + }, + { + eventId: null, + note: 'here I am', + timelineId: '10849df0-7b44-11e9-a608-ab3d811602f9', + timelineVersion: null, + noteId: '34ec1690-7b6d-11e9-980a-e5349fc014ef', + created: 1558404458065, + createdBy: 'elastic', + updated: 1558404458065, + updatedBy: 'elastic', + version: 'WzEzNCwxXQ==', + }, + ], + noteIds: ['308783f0-7b6d-11e9-980a-e5349fc014ef', '34ec1690-7b6d-11e9-980a-e5349fc014ef'], + pinnedEventIds: ['Wl0W12oB9v5HJNSHb400', '410W12oB9v5HJNSHY4wv', 'ZF0W12oB9v5HJNSHwY6L'], + title: 'test 5', + timelineType: TimelineType.default, + templateTimelineId: null, + templateTimelineVersion: null, + created: 1558386787614, + createdBy: 'elastic', + updated: 1558390951234, + updatedBy: 'elastic', + version: 'WzEyOCwxXQ==', + }, + { + savedObjectId: '10849df0-7b44-11e9-a608-ab3d811602f95', + description: 'hhw4', + favorite: [ + { + fullName: null, + userName: 'elastic', + favoriteDate: 1558390951234, + }, + ], + eventIdToNoteIds: [ + { + eventId: '4l0W12oB9v5HJNSHY4wv', + note: 'test pinned event 2', + timelineId: '10849df0-7b44-11e9-a608-ab3d811602f9', + noteId: '44763500-7b6d-11e9-980a-e5349fc014ef', + created: 1558404484133, + createdBy: 'elastic', + timelineVersion: null, + updated: 1558404484133, + updatedBy: 'elastic', + version: 'WzEzOSwxXQ==', + }, + { + eventId: 'ZF0W12oB9v5HJNSHwY6L', + note: 'Test pinned 1', + timelineId: '10849df0-7b44-11e9-a608-ab3d811602f9', + noteId: '3e9d51e0-7b6d-11e9-980a-e5349fc014ef', + created: 1558404474317, + createdBy: 'elastic', + timelineVersion: null, + updated: 1558404474317, + updatedBy: 'elastic', + version: 'WzEzNywxXQ==', + }, + { + eventId: '4l0W12oB9v5HJNSHY4wv', + note: 'again', + timelineId: '10849df0-7b44-11e9-a608-ab3d811602f9', + noteId: '48eaf440-7b6d-11e9-980a-e5349fc014ef', + created: 1558404491600, + createdBy: 'elastic', + timelineVersion: null, + updated: 1558404491600, + updatedBy: 'elastic', + version: 'WzE0MSwxXQ==', + }, + ], + notes: [ + { + eventId: '4l0W12oB9v5HJNSHY4wv', + note: 'test pinned event 2', + timelineId: '10849df0-7b44-11e9-a608-ab3d811602f9', + timelineVersion: null, + noteId: '44763500-7b6d-11e9-980a-e5349fc014ef', + created: 1558404484133, + createdBy: 'elastic', + updated: 1558404484133, + updatedBy: 'elastic', + version: 'WzEzOSwxXQ==', + }, + { + eventId: 'ZF0W12oB9v5HJNSHwY6L', + note: 'Test pinned 1', + timelineId: '10849df0-7b44-11e9-a608-ab3d811602f9', + timelineVersion: null, + noteId: '3e9d51e0-7b6d-11e9-980a-e5349fc014ef', + created: 1558404474317, + createdBy: 'elastic', + updated: 1558404474317, + updatedBy: 'elastic', + version: 'WzEzNywxXQ==', + }, + { + eventId: '4l0W12oB9v5HJNSHY4wv', + note: 'again', + timelineId: '10849df0-7b44-11e9-a608-ab3d811602f9', + timelineVersion: null, + noteId: '48eaf440-7b6d-11e9-980a-e5349fc014ef', + created: 1558404491600, + createdBy: 'elastic', + updated: 1558404491600, + updatedBy: 'elastic', + version: 'WzE0MSwxXQ==', + }, + { + eventId: null, + note: 'Hello world', + timelineId: '10849df0-7b44-11e9-a608-ab3d811602f9', + timelineVersion: null, + noteId: '308783f0-7b6d-11e9-980a-e5349fc014ef', + created: 1558404450688, + createdBy: 'elastic', + updated: 1558404450688, + updatedBy: 'elastic', + version: 'WzEzMywxXQ==', + }, + { + eventId: null, + note: 'here I am', + timelineId: '10849df0-7b44-11e9-a608-ab3d811602f9', + timelineVersion: null, + noteId: '34ec1690-7b6d-11e9-980a-e5349fc014ef', + created: 1558404458065, + createdBy: 'elastic', + updated: 1558404458065, + updatedBy: 'elastic', + version: 'WzEzNCwxXQ==', + }, + ], + noteIds: ['308783f0-7b6d-11e9-980a-e5349fc014ef', '34ec1690-7b6d-11e9-980a-e5349fc014ef'], + pinnedEventIds: ['Wl0W12oB9v5HJNSHb400', '410W12oB9v5HJNSHY4wv', 'ZF0W12oB9v5HJNSHwY6L'], + title: 'test 6', + timelineType: TimelineType.default, + templateTimelineId: null, + templateTimelineVersion: null, + created: 1558386787614, + createdBy: 'elastic', + updated: 1558390951234, + updatedBy: 'elastic', + version: 'WzEyOCwxXQ==', + }, + { + savedObjectId: '10849df0-7b44-11e9-a608-ab3d811602f96', + description: 'hhw4', + favorite: [ + { + fullName: null, + userName: 'elastic', + favoriteDate: 1558390951234, + }, + ], + eventIdToNoteIds: [ + { + eventId: '4l0W12oB9v5HJNSHY4wv', + note: 'test pinned event 2', + timelineId: '10849df0-7b44-11e9-a608-ab3d811602f9', + noteId: '44763500-7b6d-11e9-980a-e5349fc014ef', + created: 1558404484133, + createdBy: 'elastic', + timelineVersion: null, + updated: 1558404484133, + updatedBy: 'elastic', + version: 'WzEzOSwxXQ==', + }, + { + eventId: 'ZF0W12oB9v5HJNSHwY6L', + note: 'Test pinned 1', + timelineId: '10849df0-7b44-11e9-a608-ab3d811602f9', + noteId: '3e9d51e0-7b6d-11e9-980a-e5349fc014ef', + created: 1558404474317, + createdBy: 'elastic', + timelineVersion: null, + updated: 1558404474317, + updatedBy: 'elastic', + version: 'WzEzNywxXQ==', + }, + { + eventId: '4l0W12oB9v5HJNSHY4wv', + note: 'again', + timelineId: '10849df0-7b44-11e9-a608-ab3d811602f9', + noteId: '48eaf440-7b6d-11e9-980a-e5349fc014ef', + created: 1558404491600, + createdBy: 'elastic', + timelineVersion: null, + updated: 1558404491600, + updatedBy: 'elastic', + version: 'WzE0MSwxXQ==', + }, + ], + notes: [ + { + eventId: '4l0W12oB9v5HJNSHY4wv', + note: 'test pinned event 2', + timelineId: '10849df0-7b44-11e9-a608-ab3d811602f9', + timelineVersion: null, + noteId: '44763500-7b6d-11e9-980a-e5349fc014ef', + created: 1558404484133, + createdBy: 'elastic', + updated: 1558404484133, + updatedBy: 'elastic', + version: 'WzEzOSwxXQ==', + }, + { + eventId: 'ZF0W12oB9v5HJNSHwY6L', + note: 'Test pinned 1', + timelineId: '10849df0-7b44-11e9-a608-ab3d811602f9', + timelineVersion: null, + noteId: '3e9d51e0-7b6d-11e9-980a-e5349fc014ef', + created: 1558404474317, + createdBy: 'elastic', + updated: 1558404474317, + updatedBy: 'elastic', + version: 'WzEzNywxXQ==', + }, + { + eventId: '4l0W12oB9v5HJNSHY4wv', + note: 'again', + timelineId: '10849df0-7b44-11e9-a608-ab3d811602f9', + timelineVersion: null, + noteId: '48eaf440-7b6d-11e9-980a-e5349fc014ef', + created: 1558404491600, + createdBy: 'elastic', + updated: 1558404491600, + updatedBy: 'elastic', + version: 'WzE0MSwxXQ==', + }, + { + eventId: null, + note: 'Hello world', + timelineId: '10849df0-7b44-11e9-a608-ab3d811602f9', + timelineVersion: null, + noteId: '308783f0-7b6d-11e9-980a-e5349fc014ef', + created: 1558404450688, + createdBy: 'elastic', + updated: 1558404450688, + updatedBy: 'elastic', + version: 'WzEzMywxXQ==', + }, + { + eventId: null, + note: 'here I am', + timelineId: '10849df0-7b44-11e9-a608-ab3d811602f9', + timelineVersion: null, + noteId: '34ec1690-7b6d-11e9-980a-e5349fc014ef', + created: 1558404458065, + createdBy: 'elastic', + updated: 1558404458065, + updatedBy: 'elastic', + version: 'WzEzNCwxXQ==', + }, + ], + noteIds: ['308783f0-7b6d-11e9-980a-e5349fc014ef', '34ec1690-7b6d-11e9-980a-e5349fc014ef'], + pinnedEventIds: ['Wl0W12oB9v5HJNSHb400', '410W12oB9v5HJNSHY4wv', 'ZF0W12oB9v5HJNSHwY6L'], + title: 'test 7', + timelineType: TimelineType.default, + templateTimelineId: null, + templateTimelineVersion: null, + created: 1558386787614, + createdBy: 'elastic', + updated: 1558390951234, + updatedBy: 'elastic', + version: 'WzEyOCwxXQ==', + }, + { + savedObjectId: '10849df0-7b44-11e9-a608-ab3d811602f97', + description: 'hhw4', + favorite: [ + { + fullName: null, + userName: 'elastic', + favoriteDate: 1558390951234, + }, + ], + eventIdToNoteIds: [ + { + eventId: '4l0W12oB9v5HJNSHY4wv', + note: 'test pinned event 2', + timelineId: '10849df0-7b44-11e9-a608-ab3d811602f9', + noteId: '44763500-7b6d-11e9-980a-e5349fc014ef', + created: 1558404484133, + createdBy: 'elastic', + timelineVersion: null, + updated: 1558404484133, + updatedBy: 'elastic', + version: 'WzEzOSwxXQ==', + }, + { + eventId: 'ZF0W12oB9v5HJNSHwY6L', + note: 'Test pinned 1', + timelineId: '10849df0-7b44-11e9-a608-ab3d811602f9', + noteId: '3e9d51e0-7b6d-11e9-980a-e5349fc014ef', + created: 1558404474317, + createdBy: 'elastic', + timelineVersion: null, + updated: 1558404474317, + updatedBy: 'elastic', + version: 'WzEzNywxXQ==', + }, + { + eventId: '4l0W12oB9v5HJNSHY4wv', + note: 'again', + timelineId: '10849df0-7b44-11e9-a608-ab3d811602f9', + noteId: '48eaf440-7b6d-11e9-980a-e5349fc014ef', + created: 1558404491600, + createdBy: 'elastic', + timelineVersion: null, + updated: 1558404491600, + updatedBy: 'elastic', + version: 'WzE0MSwxXQ==', + }, + ], + notes: [ + { + eventId: '4l0W12oB9v5HJNSHY4wv', + note: 'test pinned event 2', + timelineId: '10849df0-7b44-11e9-a608-ab3d811602f9', + timelineVersion: null, + noteId: '44763500-7b6d-11e9-980a-e5349fc014ef', + created: 1558404484133, + createdBy: 'elastic', + updated: 1558404484133, + updatedBy: 'elastic', + version: 'WzEzOSwxXQ==', + }, + { + eventId: 'ZF0W12oB9v5HJNSHwY6L', + note: 'Test pinned 1', + timelineId: '10849df0-7b44-11e9-a608-ab3d811602f9', + timelineVersion: null, + noteId: '3e9d51e0-7b6d-11e9-980a-e5349fc014ef', + created: 1558404474317, + createdBy: 'elastic', + updated: 1558404474317, + updatedBy: 'elastic', + version: 'WzEzNywxXQ==', + }, + { + eventId: '4l0W12oB9v5HJNSHY4wv', + note: 'again', + timelineId: '10849df0-7b44-11e9-a608-ab3d811602f9', + timelineVersion: null, + noteId: '48eaf440-7b6d-11e9-980a-e5349fc014ef', + created: 1558404491600, + createdBy: 'elastic', + updated: 1558404491600, + updatedBy: 'elastic', + version: 'WzE0MSwxXQ==', + }, + { + eventId: null, + note: 'Hello world', + timelineId: '10849df0-7b44-11e9-a608-ab3d811602f9', + timelineVersion: null, + noteId: '308783f0-7b6d-11e9-980a-e5349fc014ef', + created: 1558404450688, + createdBy: 'elastic', + updated: 1558404450688, + updatedBy: 'elastic', + version: 'WzEzMywxXQ==', + }, + { + eventId: null, + note: 'here I am', + timelineId: '10849df0-7b44-11e9-a608-ab3d811602f9', + timelineVersion: null, + noteId: '34ec1690-7b6d-11e9-980a-e5349fc014ef', + created: 1558404458065, + createdBy: 'elastic', + updated: 1558404458065, + updatedBy: 'elastic', + version: 'WzEzNCwxXQ==', + }, + ], + noteIds: ['308783f0-7b6d-11e9-980a-e5349fc014ef', '34ec1690-7b6d-11e9-980a-e5349fc014ef'], + pinnedEventIds: ['Wl0W12oB9v5HJNSHb400', '410W12oB9v5HJNSHY4wv', 'ZF0W12oB9v5HJNSHwY6L'], + title: 'test 7', + timelineType: TimelineType.default, + templateTimelineId: null, + templateTimelineVersion: null, + created: 1558386787614, + createdBy: 'elastic', + updated: 1558390951234, + updatedBy: 'elastic', + version: 'WzEyOCwxXQ==', + }, + { + savedObjectId: '10849df0-7b44-11e9-a608-ab3d811602f98', + description: 'hhw4', + favorite: [ + { + fullName: null, + userName: 'elastic', + favoriteDate: 1558390951234, + }, + ], + eventIdToNoteIds: [ + { + eventId: '4l0W12oB9v5HJNSHY4wv', + note: 'test pinned event 2', + timelineId: '10849df0-7b44-11e9-a608-ab3d811602f9', + noteId: '44763500-7b6d-11e9-980a-e5349fc014ef', + created: 1558404484133, + createdBy: 'elastic', + timelineVersion: null, + updated: 1558404484133, + updatedBy: 'elastic', + version: 'WzEzOSwxXQ==', + }, + { + eventId: 'ZF0W12oB9v5HJNSHwY6L', + note: 'Test pinned 1', + timelineId: '10849df0-7b44-11e9-a608-ab3d811602f9', + noteId: '3e9d51e0-7b6d-11e9-980a-e5349fc014ef', + created: 1558404474317, + createdBy: 'elastic', + timelineVersion: null, + updated: 1558404474317, + updatedBy: 'elastic', + version: 'WzEzNywxXQ==', + }, + { + eventId: '4l0W12oB9v5HJNSHY4wv', + note: 'again', + timelineId: '10849df0-7b44-11e9-a608-ab3d811602f9', + noteId: '48eaf440-7b6d-11e9-980a-e5349fc014ef', + created: 1558404491600, + createdBy: 'elastic', + timelineVersion: null, + updated: 1558404491600, + updatedBy: 'elastic', + version: 'WzE0MSwxXQ==', + }, + ], + notes: [ + { + eventId: '4l0W12oB9v5HJNSHY4wv', + note: 'test pinned event 2', + timelineId: '10849df0-7b44-11e9-a608-ab3d811602f9', + timelineVersion: null, + noteId: '44763500-7b6d-11e9-980a-e5349fc014ef', + created: 1558404484133, + createdBy: 'elastic', + updated: 1558404484133, + updatedBy: 'elastic', + version: 'WzEzOSwxXQ==', + }, + { + eventId: 'ZF0W12oB9v5HJNSHwY6L', + note: 'Test pinned 1', + timelineId: '10849df0-7b44-11e9-a608-ab3d811602f9', + timelineVersion: null, + noteId: '3e9d51e0-7b6d-11e9-980a-e5349fc014ef', + created: 1558404474317, + createdBy: 'elastic', + updated: 1558404474317, + updatedBy: 'elastic', + version: 'WzEzNywxXQ==', + }, + { + eventId: '4l0W12oB9v5HJNSHY4wv', + note: 'again', + timelineId: '10849df0-7b44-11e9-a608-ab3d811602f9', + timelineVersion: null, + noteId: '48eaf440-7b6d-11e9-980a-e5349fc014ef', + created: 1558404491600, + createdBy: 'elastic', + updated: 1558404491600, + updatedBy: 'elastic', + version: 'WzE0MSwxXQ==', + }, + { + eventId: null, + note: 'Hello world', + timelineId: '10849df0-7b44-11e9-a608-ab3d811602f9', + timelineVersion: null, + noteId: '308783f0-7b6d-11e9-980a-e5349fc014ef', + created: 1558404450688, + createdBy: 'elastic', + updated: 1558404450688, + updatedBy: 'elastic', + version: 'WzEzMywxXQ==', + }, + { + eventId: null, + note: 'here I am', + timelineId: '10849df0-7b44-11e9-a608-ab3d811602f9', + timelineVersion: null, + noteId: '34ec1690-7b6d-11e9-980a-e5349fc014ef', + created: 1558404458065, + createdBy: 'elastic', + updated: 1558404458065, + updatedBy: 'elastic', + version: 'WzEzNCwxXQ==', + }, + ], + noteIds: ['308783f0-7b6d-11e9-980a-e5349fc014ef', '34ec1690-7b6d-11e9-980a-e5349fc014ef'], + pinnedEventIds: ['Wl0W12oB9v5HJNSHb400', '410W12oB9v5HJNSHY4wv', 'ZF0W12oB9v5HJNSHwY6L'], + title: 'test 7', + timelineType: TimelineType.default, + templateTimelineId: null, + templateTimelineVersion: null, + created: 1558386787614, + createdBy: 'elastic', + updated: 1558390951234, + updatedBy: 'elastic', + version: 'WzEyOCwxXQ==', + }, + { + savedObjectId: '10849df0-7b44-11e9-a608-ab3d811602f99', + description: 'hhw4', + favorite: [ + { + fullName: null, + userName: 'elastic', + favoriteDate: 1558390951234, + }, + ], + eventIdToNoteIds: [ + { + eventId: '4l0W12oB9v5HJNSHY4wv', + note: 'test pinned event 2', + timelineId: '10849df0-7b44-11e9-a608-ab3d811602f9', + noteId: '44763500-7b6d-11e9-980a-e5349fc014ef', + created: 1558404484133, + createdBy: 'elastic', + timelineVersion: null, + updated: 1558404484133, + updatedBy: 'elastic', + version: 'WzEzOSwxXQ==', + }, + { + eventId: 'ZF0W12oB9v5HJNSHwY6L', + note: 'Test pinned 1', + timelineId: '10849df0-7b44-11e9-a608-ab3d811602f9', + noteId: '3e9d51e0-7b6d-11e9-980a-e5349fc014ef', + created: 1558404474317, + createdBy: 'elastic', + timelineVersion: null, + updated: 1558404474317, + updatedBy: 'elastic', + version: 'WzEzNywxXQ==', + }, + { + eventId: '4l0W12oB9v5HJNSHY4wv', + note: 'again', + timelineId: '10849df0-7b44-11e9-a608-ab3d811602f9', + noteId: '48eaf440-7b6d-11e9-980a-e5349fc014ef', + created: 1558404491600, + createdBy: 'elastic', + timelineVersion: null, + updated: 1558404491600, + updatedBy: 'elastic', + version: 'WzE0MSwxXQ==', + }, + ], + notes: [ + { + eventId: '4l0W12oB9v5HJNSHY4wv', + note: 'test pinned event 2', + timelineId: '10849df0-7b44-11e9-a608-ab3d811602f9', + timelineVersion: null, + noteId: '44763500-7b6d-11e9-980a-e5349fc014ef', + created: 1558404484133, + createdBy: 'elastic', + updated: 1558404484133, + updatedBy: 'elastic', + version: 'WzEzOSwxXQ==', + }, + { + eventId: 'ZF0W12oB9v5HJNSHwY6L', + note: 'Test pinned 1', + timelineId: '10849df0-7b44-11e9-a608-ab3d811602f9', + timelineVersion: null, + noteId: '3e9d51e0-7b6d-11e9-980a-e5349fc014ef', + created: 1558404474317, + createdBy: 'elastic', + updated: 1558404474317, + updatedBy: 'elastic', + version: 'WzEzNywxXQ==', + }, + { + eventId: '4l0W12oB9v5HJNSHY4wv', + note: 'again', + timelineId: '10849df0-7b44-11e9-a608-ab3d811602f9', + timelineVersion: null, + noteId: '48eaf440-7b6d-11e9-980a-e5349fc014ef', + created: 1558404491600, + createdBy: 'elastic', + updated: 1558404491600, + updatedBy: 'elastic', + version: 'WzE0MSwxXQ==', + }, + { + eventId: null, + note: 'Hello world', + timelineId: '10849df0-7b44-11e9-a608-ab3d811602f9', + timelineVersion: null, + noteId: '308783f0-7b6d-11e9-980a-e5349fc014ef', + created: 1558404450688, + createdBy: 'elastic', + updated: 1558404450688, + updatedBy: 'elastic', + version: 'WzEzMywxXQ==', + }, + { + eventId: null, + note: 'here I am', + timelineId: '10849df0-7b44-11e9-a608-ab3d811602f9', + timelineVersion: null, + noteId: '34ec1690-7b6d-11e9-980a-e5349fc014ef', + created: 1558404458065, + createdBy: 'elastic', + updated: 1558404458065, + updatedBy: 'elastic', + version: 'WzEzNCwxXQ==', + }, + ], + noteIds: ['308783f0-7b6d-11e9-980a-e5349fc014ef', '34ec1690-7b6d-11e9-980a-e5349fc014ef'], + pinnedEventIds: ['Wl0W12oB9v5HJNSHb400', '410W12oB9v5HJNSHY4wv', 'ZF0W12oB9v5HJNSHwY6L'], + title: 'test 7', + timelineType: TimelineType.default, + templateTimelineId: null, + templateTimelineVersion: null, + created: 1558386787614, + createdBy: 'elastic', + updated: 1558390951234, + updatedBy: 'elastic', + version: 'WzEyOCwxXQ==', + }, + { + savedObjectId: '10849df0-7b44-11e9-a608-ab3d811602f910', + description: 'hhw4', + favorite: [ + { + fullName: null, + userName: 'elastic', + favoriteDate: 1558390951234, + }, + ], + eventIdToNoteIds: [ + { + eventId: '4l0W12oB9v5HJNSHY4wv', + note: 'test pinned event 2', + timelineId: '10849df0-7b44-11e9-a608-ab3d811602f9', + noteId: '44763500-7b6d-11e9-980a-e5349fc014ef', + created: 1558404484133, + createdBy: 'elastic', + timelineVersion: null, + updated: 1558404484133, + updatedBy: 'elastic', + version: 'WzEzOSwxXQ==', + }, + { + eventId: 'ZF0W12oB9v5HJNSHwY6L', + note: 'Test pinned 1', + timelineId: '10849df0-7b44-11e9-a608-ab3d811602f9', + noteId: '3e9d51e0-7b6d-11e9-980a-e5349fc014ef', + created: 1558404474317, + createdBy: 'elastic', + timelineVersion: null, + updated: 1558404474317, + updatedBy: 'elastic', + version: 'WzEzNywxXQ==', + }, + { + eventId: '4l0W12oB9v5HJNSHY4wv', + note: 'again', + timelineId: '10849df0-7b44-11e9-a608-ab3d811602f9', + noteId: '48eaf440-7b6d-11e9-980a-e5349fc014ef', + created: 1558404491600, + createdBy: 'elastic', + timelineVersion: null, + updated: 1558404491600, + updatedBy: 'elastic', + version: 'WzE0MSwxXQ==', + }, + ], + notes: [ + { + eventId: '4l0W12oB9v5HJNSHY4wv', + note: 'test pinned event 2', + timelineId: '10849df0-7b44-11e9-a608-ab3d811602f9', + timelineVersion: null, + noteId: '44763500-7b6d-11e9-980a-e5349fc014ef', + created: 1558404484133, + createdBy: 'elastic', + updated: 1558404484133, + updatedBy: 'elastic', + version: 'WzEzOSwxXQ==', + }, + { + eventId: 'ZF0W12oB9v5HJNSHwY6L', + note: 'Test pinned 1', + timelineId: '10849df0-7b44-11e9-a608-ab3d811602f9', + timelineVersion: null, + noteId: '3e9d51e0-7b6d-11e9-980a-e5349fc014ef', + created: 1558404474317, + createdBy: 'elastic', + updated: 1558404474317, + updatedBy: 'elastic', + version: 'WzEzNywxXQ==', + }, + { + eventId: '4l0W12oB9v5HJNSHY4wv', + note: 'again', + timelineId: '10849df0-7b44-11e9-a608-ab3d811602f9', + timelineVersion: null, + noteId: '48eaf440-7b6d-11e9-980a-e5349fc014ef', + created: 1558404491600, + createdBy: 'elastic', + updated: 1558404491600, + updatedBy: 'elastic', + version: 'WzE0MSwxXQ==', + }, + { + eventId: null, + note: 'Hello world', + timelineId: '10849df0-7b44-11e9-a608-ab3d811602f9', + timelineVersion: null, + noteId: '308783f0-7b6d-11e9-980a-e5349fc014ef', + created: 1558404450688, + createdBy: 'elastic', + updated: 1558404450688, + updatedBy: 'elastic', + version: 'WzEzMywxXQ==', + }, + { + eventId: null, + note: 'here I am', + timelineId: '10849df0-7b44-11e9-a608-ab3d811602f9', + timelineVersion: null, + noteId: '34ec1690-7b6d-11e9-980a-e5349fc014ef', + created: 1558404458065, + createdBy: 'elastic', + updated: 1558404458065, + updatedBy: 'elastic', + version: 'WzEzNCwxXQ==', + }, + ], + noteIds: ['308783f0-7b6d-11e9-980a-e5349fc014ef', '34ec1690-7b6d-11e9-980a-e5349fc014ef'], + pinnedEventIds: ['Wl0W12oB9v5HJNSHb400', '410W12oB9v5HJNSHY4wv', 'ZF0W12oB9v5HJNSHwY6L'], + title: 'test 7', + timelineType: TimelineType.default, + templateTimelineId: null, + templateTimelineVersion: null, + created: 1558386787614, + createdBy: 'elastic', + updated: 1558390951234, + updatedBy: 'elastic', + version: 'WzEyOCwxXQ==', + }, + { + savedObjectId: '10849df0-7b44-11e9-a608-ab3d811602f911', + description: 'hhw4', + favorite: [ + { + fullName: null, + userName: 'elastic', + favoriteDate: 1558390951234, + }, + ], + eventIdToNoteIds: [ + { + eventId: '4l0W12oB9v5HJNSHY4wv', + note: 'test pinned event 2', + timelineId: '10849df0-7b44-11e9-a608-ab3d811602f9', + noteId: '44763500-7b6d-11e9-980a-e5349fc014ef', + created: 1558404484133, + createdBy: 'elastic', + timelineVersion: null, + updated: 1558404484133, + updatedBy: 'elastic', + version: 'WzEzOSwxXQ==', + }, + { + eventId: 'ZF0W12oB9v5HJNSHwY6L', + note: 'Test pinned 1', + timelineId: '10849df0-7b44-11e9-a608-ab3d811602f9', + noteId: '3e9d51e0-7b6d-11e9-980a-e5349fc014ef', + created: 1558404474317, + createdBy: 'elastic', + timelineVersion: null, + updated: 1558404474317, + updatedBy: 'elastic', + version: 'WzEzNywxXQ==', + }, + { + eventId: '4l0W12oB9v5HJNSHY4wv', + note: 'again', + timelineId: '10849df0-7b44-11e9-a608-ab3d811602f9', + noteId: '48eaf440-7b6d-11e9-980a-e5349fc014ef', + created: 1558404491600, + createdBy: 'elastic', + timelineVersion: null, + updated: 1558404491600, + updatedBy: 'elastic', + version: 'WzE0MSwxXQ==', + }, + ], + notes: [ + { + eventId: '4l0W12oB9v5HJNSHY4wv', + note: 'test pinned event 2', + timelineId: '10849df0-7b44-11e9-a608-ab3d811602f9', + timelineVersion: null, + noteId: '44763500-7b6d-11e9-980a-e5349fc014ef', + created: 1558404484133, + createdBy: 'elastic', + updated: 1558404484133, + updatedBy: 'elastic', + version: 'WzEzOSwxXQ==', + }, + { + eventId: 'ZF0W12oB9v5HJNSHwY6L', + note: 'Test pinned 1', + timelineId: '10849df0-7b44-11e9-a608-ab3d811602f9', + timelineVersion: null, + noteId: '3e9d51e0-7b6d-11e9-980a-e5349fc014ef', + created: 1558404474317, + createdBy: 'elastic', + updated: 1558404474317, + updatedBy: 'elastic', + version: 'WzEzNywxXQ==', + }, + { + eventId: '4l0W12oB9v5HJNSHY4wv', + note: 'again', + timelineId: '10849df0-7b44-11e9-a608-ab3d811602f9', + timelineVersion: null, + noteId: '48eaf440-7b6d-11e9-980a-e5349fc014ef', + created: 1558404491600, + createdBy: 'elastic', + updated: 1558404491600, + updatedBy: 'elastic', + version: 'WzE0MSwxXQ==', + }, + { + eventId: null, + note: 'Hello world', + timelineId: '10849df0-7b44-11e9-a608-ab3d811602f9', + timelineVersion: null, + noteId: '308783f0-7b6d-11e9-980a-e5349fc014ef', + created: 1558404450688, + createdBy: 'elastic', + updated: 1558404450688, + updatedBy: 'elastic', + version: 'WzEzMywxXQ==', + }, + { + eventId: null, + note: 'here I am', + timelineId: '10849df0-7b44-11e9-a608-ab3d811602f9', + timelineVersion: null, + noteId: '34ec1690-7b6d-11e9-980a-e5349fc014ef', + created: 1558404458065, + createdBy: 'elastic', + updated: 1558404458065, + updatedBy: 'elastic', + version: 'WzEzNCwxXQ==', + }, + ], + noteIds: ['308783f0-7b6d-11e9-980a-e5349fc014ef', '34ec1690-7b6d-11e9-980a-e5349fc014ef'], + pinnedEventIds: ['Wl0W12oB9v5HJNSHb400', '410W12oB9v5HJNSHY4wv', 'ZF0W12oB9v5HJNSHwY6L'], + title: 'test 7', + timelineType: TimelineType.default, + templateTimelineId: null, + templateTimelineVersion: null, + created: 1558386787614, + createdBy: 'elastic', + updated: 1558390951234, + updatedBy: 'elastic', + version: 'WzEyOCwxXQ==', + }, + ], +}; /** Mocks results of a query run by the `OpenTimeline` component */ export const mockTimelineResults: OpenTimelineResult[] = [ @@ -2170,7 +2040,7 @@ export const mockTimelineModel: TimelineModel = { version: '1', }; -export const mockTimelineResult: TimelineResult = { +export const mockGetOneTimelineResult: TimelineResult = { savedObjectId: 'ef579e40-jibber-jabber', columns: timelineDefaults.columns.filter((column) => column.id !== 'event.action'), dateRange: { start: '2020-03-18T13:46:38.929Z', end: '2020-03-18T13:52:38.929Z' }, @@ -2193,13 +2063,13 @@ export const mockTimelineResult: TimelineResult = { templateTimelineId: null, templateTimelineVersion: null, savedQueryId: null, - sort: [{ columnId: '@timestamp', columnType: 'number', sortDirection: 'desc' }], + sort: [{ columnId: '@timestamp', columnType: 'number', sortDirection: Direction.desc }], version: '1', }; -export const mockTimelineApolloResult = { +export const mockTimelineResult = { data: { - getOneTimeline: mockTimelineResult, + getOneTimeline: mockGetOneTimelineResult, }, loading: false, networkStatus: 7, diff --git a/x-pack/plugins/security_solution/public/common/store/store.ts b/x-pack/plugins/security_solution/public/common/store/store.ts index efd97891f1573..e253ae1bbaf98 100644 --- a/x-pack/plugins/security_solution/public/common/store/store.ts +++ b/x-pack/plugins/security_solution/public/common/store/store.ts @@ -26,7 +26,6 @@ import { timelineSelectors } from '../../timelines/store/timeline'; import { inputsSelectors } from './inputs'; import { SubPluginsInitReducer, createReducer } from './reducer'; import { createRootEpic } from './epic'; -import { AppApolloClient } from '../lib/lib'; import { AppAction } from './actions'; import { Immutable } from '../../../common/endpoint/types'; import { State } from './types'; @@ -52,7 +51,6 @@ let store: Store | null = null; export const createStore = ( state: PreloadedState, pluginsReducer: SubPluginsInitReducer, - apolloClient: Observable, kibana: Observable, storage: Storage, additionalMiddleware?: Array>>> @@ -60,7 +58,6 @@ export const createStore = ( const composeEnhancers = window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ || compose; const middlewareDependencies: TimelineEpicDependencies = { - apolloClient$: apolloClient, kibana$: kibana, selectAllTimelineQuery: inputsSelectors.globalQueryByIdSelector, selectNotesByIdSelector: appSelectors.selectNotesByIdSelector, diff --git a/x-pack/plugins/security_solution/public/common/utils/apollo_context.ts b/x-pack/plugins/security_solution/public/common/utils/apollo_context.ts deleted file mode 100644 index c53d9903cd8d5..0000000000000 --- a/x-pack/plugins/security_solution/public/common/utils/apollo_context.ts +++ /dev/null @@ -1,20 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. - */ - -import { ApolloClient } from 'apollo-client'; -import { createContext, useContext } from 'react'; - -/** - * This is a temporary provider and hook for use with hooks until react-apollo - * has upgraded to the new-style `createContext` api. - */ - -export const ApolloClientContext = createContext | undefined>(undefined); - -export const useApolloClient = () => { - return useContext(ApolloClientContext); -}; diff --git a/x-pack/plugins/security_solution/public/common/utils/route/types.ts b/x-pack/plugins/security_solution/public/common/utils/route/types.ts index 7305fc3121085..189e68d1c55bb 100644 --- a/x-pack/plugins/security_solution/public/common/utils/route/types.ts +++ b/x-pack/plugins/security_solution/public/common/utils/route/types.ts @@ -14,7 +14,7 @@ import { TimelineType } from '../../../../common/types/timeline'; import { HostsTableType } from '../../../hosts/store/model'; import { NetworkRouteType } from '../../../network/pages/navigation/types'; import { AdministrationSubTab as AdministrationType } from '../../../management/types'; -import { FlowTarget } from '../../../graphql/types'; +import { FlowTarget } from '../../../../common/search_strategy'; export type SiemRouteType = HostsTableType | NetworkRouteType | TimelineType | AdministrationType; export interface RouteSpyState { diff --git a/x-pack/plugins/security_solution/public/common/utils/timeline/use_timeline_click.tsx b/x-pack/plugins/security_solution/public/common/utils/timeline/use_timeline_click.tsx index 4289ccfbc61fa..2756ba2a696e1 100644 --- a/x-pack/plugins/security_solution/public/common/utils/timeline/use_timeline_click.tsx +++ b/x-pack/plugins/security_solution/public/common/utils/timeline/use_timeline_click.tsx @@ -7,7 +7,6 @@ import { useCallback } from 'react'; import { useDispatch } from 'react-redux'; -import { useApolloClient } from '../../../common/utils/apollo_context'; import { dispatchUpdateTimeline, queryTimelineById, @@ -16,12 +15,10 @@ import { updateIsLoading as dispatchUpdateIsLoading } from '../../../timelines/s export const useTimelineClick = () => { const dispatch = useDispatch(); - const apolloClient = useApolloClient(); const handleTimelineClick = useCallback( (timelineId: string, graphEventId?: string) => { queryTimelineById({ - apolloClient, graphEventId, timelineId, updateIsLoading: ({ @@ -34,7 +31,7 @@ export const useTimelineClick = () => { updateTimeline: dispatchUpdateTimeline(dispatch), }); }, - [apolloClient, dispatch] + [dispatch] ); return handleTimelineClick; diff --git a/x-pack/plugins/security_solution/public/detections/components/alerts_table/actions.test.tsx b/x-pack/plugins/security_solution/public/detections/components/alerts_table/actions.test.tsx index 6eccba954a175..d5b64a8fe27fc 100644 --- a/x-pack/plugins/security_solution/public/detections/components/alerts_table/actions.test.tsx +++ b/x-pack/plugins/security_solution/public/detections/components/alerts_table/actions.test.tsx @@ -5,7 +5,6 @@ * 2.0. */ -import { get } from 'lodash/fp'; import sinon from 'sinon'; import moment from 'moment'; @@ -13,9 +12,7 @@ import { sendAlertToTimelineAction, determineToAndFrom } from './actions'; import { mockEcsDataWithAlert, defaultTimelineProps, - apolloClient, - mockTimelineApolloResult, - mockTimelineDetailsApollo, + mockTimelineResult, mockTimelineDetails, } from '../../../common/mock/'; import { CreateTimeline, UpdateTimelineLoading } from './types'; @@ -28,8 +25,11 @@ import { } from '../../../../common/types/timeline'; import { ISearchStart } from '../../../../../../../src/plugins/data/public'; import { dataPluginMock } from '../../../../../../../src/plugins/data/public/mocks'; +import { getTimelineTemplate } from '../../../timelines/containers/api'; -jest.mock('apollo-client'); +jest.mock('../../../timelines/containers/api', () => ({ + getTimelineTemplate: jest.fn(), +})); describe('alert actions', () => { const anchor = '2020-03-01T17:59:46.349Z'; @@ -60,13 +60,7 @@ describe('alert actions', () => { searchSource: {} as ISearchStart['searchSource'], }; - jest.spyOn(apolloClient, 'query').mockImplementation((obj) => { - const id = get('variables.id', obj); - if (id != null) { - return Promise.resolve(mockTimelineApolloResult); - } - return Promise.resolve(mockTimelineDetailsApollo); - }); + (getTimelineTemplate as jest.Mock).mockResolvedValue(mockTimelineResult); clock = sinon.useFakeTimers(unix); }); @@ -79,7 +73,6 @@ describe('alert actions', () => { describe('timeline id is NOT empty string and apollo client exists', () => { test('it invokes updateTimelineIsLoading to set to true', async () => { await sendAlertToTimelineAction({ - apolloClient, createTimeline, ecsData: mockEcsDataWithAlert, nonEcsData: [], @@ -96,7 +89,6 @@ describe('alert actions', () => { test('it invokes createTimeline with designated timeline template if "timelineTemplate" exists', async () => { await sendAlertToTimelineAction({ - apolloClient, createTimeline, ecsData: mockEcsDataWithAlert, nonEcsData: [], @@ -236,8 +228,8 @@ describe('alert actions', () => { }); test('it invokes createTimeline with kqlQuery.filterQuery.kuery.kind as "kuery" if not specified in returned timeline template', async () => { - const mockTimelineApolloResultModified = { - ...mockTimelineApolloResult, + const mockTimelineResultModified = { + ...mockTimelineResult, kqlQuery: { filterQuery: { kuery: { @@ -246,10 +238,9 @@ describe('alert actions', () => { }, }, }; - jest.spyOn(apolloClient, 'query').mockResolvedValue(mockTimelineApolloResultModified); + (getTimelineTemplate as jest.Mock).mockResolvedValue(mockTimelineResultModified); await sendAlertToTimelineAction({ - apolloClient, createTimeline, ecsData: mockEcsDataWithAlert, nonEcsData: [], @@ -263,12 +254,11 @@ describe('alert actions', () => { }); test('it invokes createTimeline with default timeline if apolloClient throws', async () => { - jest.spyOn(apolloClient, 'query').mockImplementation(() => { + (getTimelineTemplate as jest.Mock).mockImplementation(() => { throw new Error('Test error'); }); await sendAlertToTimelineAction({ - apolloClient, createTimeline, ecsData: mockEcsDataWithAlert, nonEcsData: [], @@ -303,7 +293,6 @@ describe('alert actions', () => { }; await sendAlertToTimelineAction({ - apolloClient, createTimeline, ecsData: ecsDataMock, nonEcsData: [], diff --git a/x-pack/plugins/security_solution/public/detections/components/alerts_table/actions.tsx b/x-pack/plugins/security_solution/public/detections/components/alerts_table/actions.tsx index 4dd40eb2ddaee..e5cefca66d0fd 100644 --- a/x-pack/plugins/security_solution/public/detections/components/alerts_table/actions.tsx +++ b/x-pack/plugins/security_solution/public/detections/components/alerts_table/actions.tsx @@ -13,7 +13,12 @@ import moment from 'moment'; import { i18n } from '@kbn/i18n'; import type { Filter } from '../../../../../../../src/plugins/data/common/es_query/filters'; -import { TimelineId, TimelineStatus, TimelineType } from '../../../../common/types/timeline'; +import { + TimelineId, + TimelineResult, + TimelineStatus, + TimelineType, +} from '../../../../common/types/timeline'; import { updateAlertStatus } from '../../containers/detection_engine/alerts/api'; import { SendAlertToTimelineActionProps, @@ -21,7 +26,6 @@ import { UpdateAlertStatusActionProps, } from './types'; import { Ecs } from '../../../../common/ecs'; -import { GetOneTimeline, TimelineResult } from '../../../graphql/types'; import { TimelineNonEcsData, TimelineEventsDetailsItem, @@ -29,7 +33,6 @@ import { TimelineEventsDetailsStrategyResponse, TimelineEventsQueries, } from '../../../../common/search_strategy/timeline'; -import { oneTimelineQuery } from '../../../timelines/containers/one/index.gql_query'; import { timelineDefaults } from '../../../timelines/store/timeline/defaults'; import { omitTypenameInTimeline, @@ -47,6 +50,7 @@ import { QueryOperator, } from '../../../timelines/components/timeline/data_providers/data_provider'; import { esFilters } from '../../../../../../../src/plugins/data/public'; +import { getTimelineTemplate } from '../../../timelines/containers/api'; export const getUpdateAlertsQuery = (eventIds: Readonly) => { return { @@ -362,7 +366,6 @@ export const buildEqlDataProviderOrFilter = ( }; export const sendAlertToTimelineAction = async ({ - apolloClient, createTimeline, ecsData: ecs, nonEcsData, @@ -381,18 +384,11 @@ export const sendAlertToTimelineAction = async ({ const { to, from } = determineToAndFrom({ ecs }); // For now we do not want to populate the template timeline if we have alertIds - if (!isEmpty(timelineId) && apolloClient != null && isEmpty(alertIds)) { + if (!isEmpty(timelineId) && isEmpty(alertIds)) { try { updateTimelineIsLoading({ id: TimelineId.active, isLoading: true }); const [responseTimeline, eventDataResp] = await Promise.all([ - apolloClient.query({ - query: oneTimelineQuery, - fetchPolicy: 'no-cache', - variables: { - id: timelineId, - timelineType: TimelineType.template, - }, - }), + getTimelineTemplate(timelineId), searchStrategyClient .search( { diff --git a/x-pack/plugins/security_solution/public/detections/components/alerts_table/helpers.ts b/x-pack/plugins/security_solution/public/detections/components/alerts_table/helpers.ts index 98cb939ca2656..69cf6ac43d4a7 100644 --- a/x-pack/plugins/security_solution/public/detections/components/alerts_table/helpers.ts +++ b/x-pack/plugins/security_solution/public/detections/components/alerts_table/helpers.ts @@ -18,7 +18,7 @@ import { DataProvidersAnd, } from '../../../timelines/components/timeline/data_providers/data_provider'; import { TimelineEventsDetailsItem } from '../../../../common/search_strategy'; -import { TimelineType } from '../../../graphql/types'; +import { TimelineType } from '../../../../common/types/timeline'; interface FindValueToChangeInQuery { field: string; diff --git a/x-pack/plugins/security_solution/public/detections/components/alerts_table/timeline_actions/investigate_in_timeline_action.tsx b/x-pack/plugins/security_solution/public/detections/components/alerts_table/timeline_actions/investigate_in_timeline_action.tsx index 2f0fee980c218..3bf30d57d4a8a 100644 --- a/x-pack/plugins/security_solution/public/detections/components/alerts_table/timeline_actions/investigate_in_timeline_action.tsx +++ b/x-pack/plugins/security_solution/public/detections/components/alerts_table/timeline_actions/investigate_in_timeline_action.tsx @@ -13,7 +13,6 @@ import { TimelineId } from '../../../../../common/types/timeline'; import { Ecs } from '../../../../../common/ecs'; import { TimelineNonEcsData } from '../../../../../common/search_strategy/timeline'; import { timelineActions } from '../../../../timelines/store/timeline'; -import { useApolloClient } from '../../../../common/utils/apollo_context'; import { sendAlertToTimelineAction } from '../actions'; import { dispatchUpdateTimeline } from '../../../../timelines/components/open_timeline/helpers'; import { ActionIconItem } from '../../../../timelines/components/timeline/body/actions/action_icon_item'; @@ -42,7 +41,6 @@ const InvestigateInTimelineActionComponent: React.FC dispatch(timelineActions.updateIsLoading(payload)), @@ -74,7 +72,6 @@ const InvestigateInTimelineActionComponent: React.FC; createTimeline: CreateTimeline; ecsData: Ecs | Ecs[]; nonEcsData: TimelineNonEcsData[]; diff --git a/x-pack/plugins/security_solution/public/detections/components/rules/all_rules_tables/index.test.tsx b/x-pack/plugins/security_solution/public/detections/components/rules/all_rules_tables/index.test.tsx index 4c303bb7dd093..3400a960bbc60 100644 --- a/x-pack/plugins/security_solution/public/detections/components/rules/all_rules_tables/index.test.tsx +++ b/x-pack/plugins/security_solution/public/detections/components/rules/all_rules_tables/index.test.tsx @@ -15,7 +15,7 @@ import { AllRulesTabs } from '../../../pages/detection_engine/rules/all'; describe('AllRulesTables', () => { it('renders correctly', () => { const Component = () => { - const ref = useRef(); + const ref = useRef(null); return ( { it('renders rules tab when "selectedTab" is "rules"', () => { const Component = () => { - const ref = useRef(); + const ref = useRef(null); return ( { it('renders monitoring tab when "selectedTab" is "monitoring"', () => { const Component = () => { - const ref = useRef(); + const ref = useRef(null); return ( void; - tableRef?: React.MutableRefObject; + tableRef?: React.MutableRefObject; selectedTab: AllRulesTabs; } +const emptyPrompt = ( + {i18n.NO_RULES}

    } titleSize="xs" body={i18n.NO_RULES_BODY} /> +); + export const AllRulesTablesComponent: React.FC = ({ euiBasicTableSelectionProps, hasNoPermissions, @@ -68,16 +66,10 @@ export const AllRulesTablesComponent: React.FC = ({ tableRef, selectedTab, }) => { - const emptyPrompt = useMemo(() => { - return ( - {i18n.NO_RULES}

    } titleSize="xs" body={i18n.NO_RULES_BODY} /> - ); - }, []); - return ( <> {selectedTab === AllRulesTabs.rules && ( - = ({ /> )} {selectedTab === AllRulesTabs.monitoring && ( - = ({ noItemsMessage={emptyPrompt} onChange={tableOnChangeCallback} pagination={pagination} - sorting={sorting} /> )} diff --git a/x-pack/plugins/security_solution/public/detections/components/rules/ml_job_select/help_text.test.tsx b/x-pack/plugins/security_solution/public/detections/components/rules/ml_job_select/help_text.test.tsx new file mode 100644 index 0000000000000..3db1beb5bb743 --- /dev/null +++ b/x-pack/plugins/security_solution/public/detections/components/rules/ml_job_select/help_text.test.tsx @@ -0,0 +1,22 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import React from 'react'; +import { shallow } from 'enzyme'; +import { HelpText } from './help_text'; + +describe('MlJobSelect help text', () => { + it('does not show warning if all jobs are running', () => { + const wrapper = shallow(); + expect(wrapper.find('[data-test-subj="ml-warning-not-running-jobs"]')).toHaveLength(0); + }); + + it('shows warning if there are jobs not running', () => { + const wrapper = shallow(); + expect(wrapper.find('[data-test-subj="ml-warning-not-running-jobs"]')).toHaveLength(1); + }); +}); diff --git a/x-pack/plugins/security_solution/public/detections/components/rules/ml_job_select/help_text.tsx b/x-pack/plugins/security_solution/public/detections/components/rules/ml_job_select/help_text.tsx new file mode 100644 index 0000000000000..5195679c13d2a --- /dev/null +++ b/x-pack/plugins/security_solution/public/detections/components/rules/ml_job_select/help_text.tsx @@ -0,0 +1,68 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import React from 'react'; +import { EuiIcon, EuiLink, EuiText } from '@elastic/eui'; +import styled from 'styled-components'; + +import { FormattedMessage } from '@kbn/i18n/react'; + +const HelpTextWarningContainer = styled.div` + margin-top: 10px; +`; + +const HelpTextComponent: React.FC<{ href: string; notRunningJobIds: string[] }> = ({ + href, + notRunningJobIds, +}) => ( + <> + + + + ), + }} + /> + {notRunningJobIds.length > 0 && ( + + + + + {notRunningJobIds.length === 1 ? ( + + ) : ( + acc + (i < array.length - 1 ? ', ' : ', and ') + value + ), + }} + /> + )} + + + + )} + +); + +export const HelpText = React.memo(HelpTextComponent); diff --git a/x-pack/plugins/security_solution/public/detections/components/rules/ml_job_select/index.tsx b/x-pack/plugins/security_solution/public/detections/components/rules/ml_job_select/index.tsx index e5521492d3b5e..6d7b5d4acc5b8 100644 --- a/x-pack/plugins/security_solution/public/detections/components/rules/ml_job_select/index.tsx +++ b/x-pack/plugins/security_solution/public/detections/components/rules/ml_job_select/index.tsx @@ -6,15 +6,13 @@ */ import React, { useCallback, useMemo } from 'react'; -import { FormattedMessage } from '@kbn/i18n/react'; import { EuiComboBox, EuiComboBoxOptionOption, EuiFlexGroup, EuiFlexItem, EuiFormRow, - EuiIcon, - EuiLink, + EuiToolTip, EuiText, } from '@elastic/eui'; @@ -23,63 +21,36 @@ import { isJobStarted } from '../../../../../common/machine_learning/helpers'; import { FieldHook, getFieldValidityAndErrorMessage } from '../../../../shared_imports'; import { useSecurityJobs } from '../../../../common/components/ml_popover/hooks/use_security_jobs'; import { useKibana } from '../../../../common/lib/kibana'; -import { - ML_JOB_SELECT_PLACEHOLDER_TEXT, - ENABLE_ML_JOB_WARNING, -} from '../step_define_rule/translations'; +import { ML_JOB_SELECT_PLACEHOLDER_TEXT } from '../step_define_rule/translations'; +import { HelpText } from './help_text'; interface MlJobValue { id: string; description: string; } -type MlJobOption = EuiComboBoxOptionOption; - -const HelpTextWarningContainer = styled.div` - margin-top: 10px; +const JobDisplayContainer = styled.div` + width: 100%; + height: 100%; + display: flex; + flex-direction: column; `; +type MlJobOption = EuiComboBoxOptionOption; + const MlJobSelectEuiFlexGroup = styled(EuiFlexGroup)` margin-bottom: 5px; `; -const HelpText: React.FC<{ href: string; showEnableWarning: boolean }> = ({ - href, - showEnableWarning = false, -}) => ( - <> - - - - ), - }} - /> - {showEnableWarning && ( - - - - {ENABLE_ML_JOB_WARNING} - - - )} - -); - const JobDisplay: React.FC = ({ id, description }) => ( - <> + {id} - -

    {description}

    -
    - + + +

    {description}

    +
    +
    +
    ); interface MlJobSelectProps { @@ -114,9 +85,14 @@ export const MlJobSelect: React.FC = ({ describedByIds = [], f const selectedJobOptions = jobOptions.filter((option) => jobIds.includes(option.value.id)); - const allJobsRunning = useMemo(() => { + const notRunningJobIds = useMemo(() => { const selectedJobs = jobs.filter(({ id }) => jobIds.includes(id)); - return selectedJobs.every((job) => isJobStarted(job.jobState, job.datafeedState)); + return selectedJobs.reduce((acc, job) => { + if (!isJobStarted(job.jobState, job.datafeedState)) { + acc.push(job.id); + } + return acc; + }, [] as string[]); }, [jobs, jobIds]); return ( @@ -124,7 +100,7 @@ export const MlJobSelect: React.FC = ({ describedByIds = [], f } + helpText={} isInvalid={isInvalid} error={errorMessage} data-test-subj="mlJobSelect" diff --git a/x-pack/plugins/security_solution/public/detections/components/rules/rule_actions_overflow/index.test.tsx b/x-pack/plugins/security_solution/public/detections/components/rules/rule_actions_overflow/index.test.tsx index c354b7081c72c..53f478da28055 100644 --- a/x-pack/plugins/security_solution/public/detections/components/rules/rule_actions_overflow/index.test.tsx +++ b/x-pack/plugins/security_solution/public/detections/components/rules/rule_actions_overflow/index.test.tsx @@ -11,6 +11,7 @@ import React from 'react'; import { deleteRulesAction, duplicateRulesAction, + editRuleAction, } from '../../../pages/detection_engine/rules/all/actions'; import { RuleActionsOverflow } from './index'; import { mockRule } from '../../../pages/detection_engine/rules/all/__mocks__/mock'; @@ -24,9 +25,17 @@ jest.mock('react-router-dom', () => ({ jest.mock('../../../pages/detection_engine/rules/all/actions', () => ({ deleteRulesAction: jest.fn(), duplicateRulesAction: jest.fn(), + editRuleAction: jest.fn(), })); +const duplicateRulesActionMock = duplicateRulesAction as jest.Mock; +const flushPromises = () => new Promise(setImmediate); + describe('RuleActionsOverflow', () => { + afterEach(() => { + jest.resetAllMocks(); + }); + describe('snapshots', () => { test('renders correctly against snapshot', () => { const wrapper = shallow( @@ -208,6 +217,27 @@ describe('RuleActionsOverflow', () => { }); }); + test('it calls editRuleAction after the rule is duplicated', async () => { + const rule = mockRule('id'); + const ruleDuplicate = mockRule('newRule'); + duplicateRulesActionMock.mockImplementation(() => Promise.resolve([ruleDuplicate])); + const wrapper = mount( + + ); + wrapper.find('[data-test-subj="rules-details-popover-button-icon"] button').simulate('click'); + wrapper.update(); + wrapper.find('[data-test-subj="rules-details-duplicate-rule"] button').simulate('click'); + wrapper.update(); + await flushPromises(); + + expect(duplicateRulesAction).toHaveBeenCalled(); + expect(editRuleAction).toHaveBeenCalledWith(ruleDuplicate, expect.anything()); + }); + describe('rules details export rule', () => { test('it does not open the popover when rules-details-popover-button-icon is clicked and the user does not have permission', () => { const rule = mockRule('id'); diff --git a/x-pack/plugins/security_solution/public/detections/components/rules/rule_actions_overflow/index.tsx b/x-pack/plugins/security_solution/public/detections/components/rules/rule_actions_overflow/index.tsx index d1077b282ec5e..0482e1997c9d1 100644 --- a/x-pack/plugins/security_solution/public/detections/components/rules/rule_actions_overflow/index.tsx +++ b/x-pack/plugins/security_solution/public/detections/components/rules/rule_actions_overflow/index.tsx @@ -24,6 +24,7 @@ import { displaySuccessToast, useStateToaster } from '../../../../common/compone import { deleteRulesAction, duplicateRulesAction, + editRuleAction, } from '../../../pages/detection_engine/rules/all/actions'; import { GenericDownloader } from '../../../../common/components/generic_downloader'; import { getRulesUrl } from '../../../../common/components/link_to/redirect_to_detection_engine'; @@ -74,7 +75,15 @@ const RuleActionsOverflowComponent = ({ data-test-subj="rules-details-duplicate-rule" onClick={async () => { setIsPopoverOpen(false); - await duplicateRulesAction([rule], [rule.id], noop, dispatchToaster); + const createdRules = await duplicateRulesAction( + [rule], + [rule.id], + noop, + dispatchToaster + ); + if (createdRules?.length) { + editRuleAction(createdRules[0], history); + } }} > { const { result, waitForNextUpdate } = renderHook(() => useUserInfo()); await waitForNextUpdate(); - expect(result).toEqual({ - current: { - canUserCRUD: null, - hasEncryptionKey: null, - hasIndexManage: null, - hasIndexMaintenance: null, - hasIndexWrite: null, - hasIndexUpdateDelete: null, - isAuthenticated: null, - isSignalIndexExists: null, - loading: true, - signalIndexName: null, - signalIndexMappingOutdated: null, - }, - error: undefined, + expect(result.all).toHaveLength(1); + expect(result.current).toEqual({ + canUserCRUD: null, + hasEncryptionKey: null, + hasIndexManage: null, + hasIndexMaintenance: null, + hasIndexWrite: null, + hasIndexUpdateDelete: null, + isAuthenticated: null, + isSignalIndexExists: null, + loading: true, + signalIndexName: null, + signalIndexMappingOutdated: null, }); + expect(result.error).toBeUndefined(); }); }); diff --git a/x-pack/plugins/security_solution/public/detections/containers/detection_engine/rules/api.test.ts b/x-pack/plugins/security_solution/public/detections/containers/detection_engine/rules/api.test.ts index 3a9697da8bd64..3d1b3a422ff64 100644 --- a/x-pack/plugins/security_solution/public/detections/containers/detection_engine/rules/api.test.ts +++ b/x-pack/plugins/security_solution/public/detections/containers/detection_engine/rules/api.test.ts @@ -405,6 +405,15 @@ describe('Detections Rules API', () => { }); }); + test('check duplicated rules are disabled by default', async () => { + await duplicateRules({ rules: rulesMock.data.map((rule) => ({ ...rule, enabled: true })) }); + expect(fetchMock).toHaveBeenCalledTimes(1); + const [path, options] = fetchMock.mock.calls[0]; + expect(path).toBe('/api/detection_engine/rules/_bulk_create'); + const rules = JSON.parse(options.body); + expect(rules).toMatchObject([{ enabled: false }, { enabled: false }]); + }); + test('happy path', async () => { const ruleResp = await duplicateRules({ rules: rulesMock.data }); expect(ruleResp).toEqual(rulesMock); diff --git a/x-pack/plugins/security_solution/public/detections/containers/detection_engine/rules/api.ts b/x-pack/plugins/security_solution/public/detections/containers/detection_engine/rules/api.ts index edcab974c9761..d4c4e10813172 100644 --- a/x-pack/plugins/security_solution/public/detections/containers/detection_engine/rules/api.ts +++ b/x-pack/plugins/security_solution/public/detections/containers/detection_engine/rules/api.ts @@ -231,7 +231,7 @@ export const duplicateRules = async ({ rules }: DuplicateRulesProps): Promise { jest .spyOn(global.Date, 'now') .mockImplementationOnce(() => new Date('2020-10-31T11:01:58.135Z').valueOf()); - reducer = createRulesTableReducer({ current: undefined }); + reducer = createRulesTableReducer({ current: null }); }); afterEach(() => { diff --git a/x-pack/plugins/security_solution/public/detections/containers/detection_engine/rules/rules_table/rules_table_reducer.ts b/x-pack/plugins/security_solution/public/detections/containers/detection_engine/rules/rules_table/rules_table_reducer.ts index 92f21f6b508aa..01a87fef2b723 100644 --- a/x-pack/plugins/security_solution/public/detections/containers/detection_engine/rules/rules_table/rules_table_reducer.ts +++ b/x-pack/plugins/security_solution/public/detections/containers/detection_engine/rules/rules_table/rules_table_reducer.ts @@ -50,7 +50,7 @@ export type RulesTableAction = | { type: 'failure' }; export const createRulesTableReducer = ( - tableRef: React.MutableRefObject | undefined> + tableRef: React.MutableRefObject | null> ) => { const rulesTableReducer = (state: RulesTableState, action: RulesTableAction): RulesTableState => { switch (action.type) { diff --git a/x-pack/plugins/security_solution/public/detections/containers/detection_engine/rules/rules_table/use_rules_table.ts b/x-pack/plugins/security_solution/public/detections/containers/detection_engine/rules/rules_table/use_rules_table.ts index e36474a2fdddd..7fcefe02cfe33 100644 --- a/x-pack/plugins/security_solution/public/detections/containers/detection_engine/rules/rules_table/use_rules_table.ts +++ b/x-pack/plugins/security_solution/public/detections/containers/detection_engine/rules/rules_table/use_rules_table.ts @@ -43,7 +43,7 @@ const initialStateDefaults: RulesTableState = { }; export interface UseRulesTableParams { - tableRef: React.MutableRefObject | undefined>; + tableRef: React.MutableRefObject | null>; initialStateOverride?: Partial; } diff --git a/x-pack/plugins/security_solution/public/detections/pages/detection_engine/detection_engine.test.tsx b/x-pack/plugins/security_solution/public/detections/pages/detection_engine/detection_engine.test.tsx index d9fc3a60cb717..6bca9bf2756bb 100644 --- a/x-pack/plugins/security_solution/public/detections/pages/detection_engine/detection_engine.test.tsx +++ b/x-pack/plugins/security_solution/public/detections/pages/detection_engine/detection_engine.test.tsx @@ -11,7 +11,6 @@ import { useParams } from 'react-router-dom'; import { waitFor } from '@testing-library/react'; import '../../../common/mock/match_media'; import { - apolloClientObservable, createSecuritySolutionStorageMock, kibanaObservable, mockGlobalState, @@ -62,13 +61,7 @@ const state: State = { }; const { storage } = createSecuritySolutionStorageMock(); -const store = createStore( - state, - SUB_PLUGINS_REDUCER, - apolloClientObservable, - kibanaObservable, - storage -); +const store = createStore(state, SUB_PLUGINS_REDUCER, kibanaObservable, storage); describe('DetectionEnginePageComponent', () => { beforeAll(() => { diff --git a/x-pack/plugins/security_solution/public/detections/pages/detection_engine/rules/all/actions.tsx b/x-pack/plugins/security_solution/public/detections/pages/detection_engine/rules/all/actions.tsx index 6cc75a3fda03c..de33d414398a8 100644 --- a/x-pack/plugins/security_solution/public/detections/pages/detection_engine/rules/all/actions.tsx +++ b/x-pack/plugins/security_solution/public/detections/pages/detection_engine/rules/all/actions.tsx @@ -40,7 +40,7 @@ export const duplicateRulesAction = async ( ruleIds: string[], dispatch: React.Dispatch, dispatchToaster: Dispatch -) => { +): Promise => { try { dispatch({ type: 'loadingRuleIds', ids: ruleIds, actionType: 'duplicate' }); const response = await duplicateRules({ @@ -48,7 +48,7 @@ export const duplicateRulesAction = async ( // and the two types conflict with each other. rules: rules.map((rule) => transformOutput(rule as CreateRulesSchema) as Rule), }); - const { errors } = bucketRulesResponse(response); + const { errors, rules: createdRules } = bucketRulesResponse(response); if (errors.length > 0) { displayErrorToast( i18n.DUPLICATE_RULE_ERROR, @@ -59,6 +59,8 @@ export const duplicateRulesAction = async ( displaySuccessToast(i18n.SUCCESSFULLY_DUPLICATED_RULES(ruleIds.length), dispatchToaster); } dispatch({ type: 'loadingRuleIds', ids: [], actionType: null }); + + return createdRules; } catch (error) { dispatch({ type: 'loadingRuleIds', ids: [], actionType: null }); errorToToaster({ title: i18n.DUPLICATE_RULE_ERROR, error, dispatchToaster }); diff --git a/x-pack/plugins/security_solution/public/detections/pages/detection_engine/rules/all/batch_actions.tsx b/x-pack/plugins/security_solution/public/detections/pages/detection_engine/rules/all/batch_actions.tsx index d3e055a695d61..648d653d6a3c8 100644 --- a/x-pack/plugins/security_solution/public/detections/pages/detection_engine/rules/all/batch_actions.tsx +++ b/x-pack/plugins/security_solution/public/detections/pages/detection_engine/rules/all/batch_actions.tsx @@ -132,6 +132,7 @@ export const getBatchItems = ({ { diff --git a/x-pack/plugins/security_solution/public/detections/pages/detection_engine/rules/all/columns.test.tsx b/x-pack/plugins/security_solution/public/detections/pages/detection_engine/rules/all/columns.test.tsx index d39009cd9631c..8eb80bd0d5135 100644 --- a/x-pack/plugins/security_solution/public/detections/pages/detection_engine/rules/all/columns.test.tsx +++ b/x-pack/plugins/security_solution/public/detections/pages/detection_engine/rules/all/columns.test.tsx @@ -5,50 +5,41 @@ * 2.0. */ +import { scopedHistoryMock } from 'src/core/public/mocks'; import uuid from 'uuid'; -import { createMemoryHistory } from 'history'; - -const history = createMemoryHistory(); - import '../../../../../common/mock/match_media'; -import { mockRule } from './__mocks__/mock'; +import { deleteRulesAction, duplicateRulesAction, editRuleAction } from './actions'; import { getActions } from './columns'; +import { mockRule } from './__mocks__/mock'; jest.mock('./actions', () => ({ duplicateRulesAction: jest.fn(), deleteRulesAction: jest.fn(), + editRuleAction: jest.fn(), })); -import { duplicateRulesAction, deleteRulesAction } from './actions'; +const history = scopedHistoryMock.create(); +const duplicateRulesActionMock = duplicateRulesAction as jest.Mock; +const deleteRulesActionMock = deleteRulesAction as jest.Mock; +const editRuleActionMock = editRuleAction as jest.Mock; describe('AllRulesTable Columns', () => { describe('getActions', () => { const rule = mockRule(uuid.v4()); - let results: string[] = []; const dispatch = jest.fn(); const dispatchToaster = jest.fn(); const reFetchRules = jest.fn(); const refetchPrePackagedRulesStatus = jest.fn(); beforeEach(() => { - results = []; - - reFetchRules.mockImplementation(() => { - results.push('reFetchRules'); - Promise.resolve(); - }); + duplicateRulesActionMock.mockClear(); + deleteRulesActionMock.mockClear(); + reFetchRules.mockClear(); }); - test('duplicate rule onClick should call refetch after the rule is duplicated', async () => { - (duplicateRulesAction as jest.Mock).mockImplementation( - () => - new Promise((resolve) => - setTimeout(() => { - results.push('duplicateRulesAction'); - resolve(); - }, 500) - ) - ); + test('duplicate rule onClick should call rule edit after the rule is duplicated', async () => { + const ruleDuplicate = mockRule('newRule'); + duplicateRulesActionMock.mockImplementation(() => Promise.resolve([ruleDuplicate])); const duplicateRulesActionObject = getActions( dispatch, @@ -59,20 +50,11 @@ describe('AllRulesTable Columns', () => { true )[1]; await duplicateRulesActionObject.onClick(rule); - expect(results).toEqual(['duplicateRulesAction', 'reFetchRules']); + expect(duplicateRulesActionMock).toHaveBeenCalled(); + expect(editRuleActionMock).toHaveBeenCalledWith(ruleDuplicate, history); }); test('delete rule onClick should call refetch after the rule is deleted', async () => { - (deleteRulesAction as jest.Mock).mockImplementation( - () => - new Promise((resolve) => - setTimeout(() => { - results.push('deleteRulesAction'); - resolve(); - }, 500) - ) - ); - const deleteRulesActionObject = getActions( dispatch, dispatchToaster, @@ -82,7 +64,11 @@ describe('AllRulesTable Columns', () => { true )[3]; await deleteRulesActionObject.onClick(rule); - expect(results).toEqual(['deleteRulesAction', 'reFetchRules']); + expect(deleteRulesActionMock).toHaveBeenCalledTimes(1); + expect(reFetchRules).toHaveBeenCalledTimes(1); + expect(deleteRulesActionMock.mock.invocationCallOrder[0]).toBeLessThan( + reFetchRules.mock.invocationCallOrder[0] + ); }); }); }); diff --git a/x-pack/plugins/security_solution/public/detections/pages/detection_engine/rules/all/columns.tsx b/x-pack/plugins/security_solution/public/detections/pages/detection_engine/rules/all/columns.tsx index bb5dd590a8ea2..9ecfdc42d0792 100644 --- a/x-pack/plugins/security_solution/public/detections/pages/detection_engine/rules/all/columns.tsx +++ b/x-pack/plugins/security_solution/public/detections/pages/detection_engine/rules/all/columns.tsx @@ -80,9 +80,15 @@ export const getActions = ( ), enabled: (rowItem: Rule) => canEditRuleWithActions(rowItem, actionsPrivileges), onClick: async (rowItem: Rule) => { - await duplicateRulesAction([rowItem], [rowItem.id], dispatch, dispatchToaster); - await reFetchRules(); - await refetchPrePackagedRulesStatus(); + const createdRules = await duplicateRulesAction( + [rowItem], + [rowItem.id], + dispatch, + dispatchToaster + ); + if (createdRules?.length) { + editRuleAction(createdRules[0], history); + } }, }, { diff --git a/x-pack/plugins/security_solution/public/detections/pages/detection_engine/rules/all/exceptions/exceptions_table.tsx b/x-pack/plugins/security_solution/public/detections/pages/detection_engine/rules/all/exceptions/exceptions_table.tsx index d5acf0e1de3cf..5cfa5ecd225ec 100644 --- a/x-pack/plugins/security_solution/public/detections/pages/detection_engine/rules/all/exceptions/exceptions_table.tsx +++ b/x-pack/plugins/security_solution/public/detections/pages/detection_engine/rules/all/exceptions/exceptions_table.tsx @@ -13,7 +13,6 @@ import { EuiProgress, EuiSearchBarProps, } from '@elastic/eui'; -import styled from 'styled-components'; import { History } from 'history'; import { AutoDownload } from '../../../../../../common/components/auto_download/auto_download'; @@ -34,10 +33,6 @@ import { patchRule } from '../../../../../containers/detection_engine/rules/api' import { ExceptionsSearchBar } from './exceptions_search_bar'; import { getSearchFilters } from '../helpers'; -// Known lost battle with Eui :( -// eslint-disable-next-line @typescript-eslint/no-explicit-any -const MyEuiBasicTable = styled(EuiBasicTable as any)`` as any; - export type Func = () => Promise; interface ExceptionListsTableProps { @@ -317,7 +312,7 @@ export const ExceptionListsTable = React.memo( () => ({ pageIndex: pagination.page - 1, pageSize: pagination.perPage, - totalItemCount: pagination.total, + totalItemCount: pagination.total || 0, pageSizeOptions: [5, 10, 20, 50, 100, 200, 300], }), [pagination] @@ -368,7 +363,7 @@ export const ExceptionListsTable = React.memo( numberSelectedItems={0} onRefresh={handleRefresh} /> - ( }, } = useKibana(); - const tableRef = useRef(); + const tableRef = useRef(null); const [defaultAutoRefreshSetting] = useUiSetting$<{ on: boolean; diff --git a/x-pack/plugins/security_solution/public/detections/pages/detection_engine/rules/details/index.test.tsx b/x-pack/plugins/security_solution/public/detections/pages/detection_engine/rules/details/index.test.tsx index c9468005960a6..b1c7bf8aa41e4 100644 --- a/x-pack/plugins/security_solution/public/detections/pages/detection_engine/rules/details/index.test.tsx +++ b/x-pack/plugins/security_solution/public/detections/pages/detection_engine/rules/details/index.test.tsx @@ -11,7 +11,6 @@ import { waitFor } from '@testing-library/react'; import '../../../../../common/mock/match_media'; import { - apolloClientObservable, createSecuritySolutionStorageMock, kibanaObservable, mockGlobalState, @@ -60,13 +59,7 @@ const state: State = { ...mockGlobalState, }; const { storage } = createSecuritySolutionStorageMock(); -const store = createStore( - state, - SUB_PLUGINS_REDUCER, - apolloClientObservable, - kibanaObservable, - storage -); +const store = createStore(state, SUB_PLUGINS_REDUCER, kibanaObservable, storage); describe('RuleDetailsPageComponent', () => { beforeAll(() => { diff --git a/x-pack/plugins/security_solution/public/detections/pages/detection_engine/rules/edit/index.tsx b/x-pack/plugins/security_solution/public/detections/pages/detection_engine/rules/edit/index.tsx index da5cf720d5315..355aa2e4620b8 100644 --- a/x-pack/plugins/security_solution/public/detections/pages/detection_engine/rules/edit/index.tsx +++ b/x-pack/plugins/security_solution/public/detections/pages/detection_engine/rules/edit/index.tsx @@ -343,6 +343,7 @@ const EditRulePageComponent: FC = () => { href: getRuleDetailsUrl(ruleId ?? ''), text: `${i18n.BACK_TO} ${rule?.name ?? ''}`, pageId: SecurityPageName.detections, + dataTestSubj: 'ruleEditBackToRuleDetails', }} isLoading={isLoading} title={i18n.PAGE_TITLE} diff --git a/x-pack/plugins/security_solution/public/graphql/introspection.json b/x-pack/plugins/security_solution/public/graphql/introspection.json deleted file mode 100644 index 752173ded5163..0000000000000 --- a/x-pack/plugins/security_solution/public/graphql/introspection.json +++ /dev/null @@ -1,7647 +0,0 @@ -{ - "__schema": { - "queryType": { "name": "Query" }, - "mutationType": { "name": "Mutation" }, - "subscriptionType": null, - "types": [ - { - "kind": "OBJECT", - "name": "Query", - "description": "", - "fields": [ - { - "name": "getNote", - "description": "", - "args": [ - { - "name": "id", - "description": "", - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { "kind": "SCALAR", "name": "ID", "ofType": null } - }, - "defaultValue": null - } - ], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { "kind": "OBJECT", "name": "NoteResult", "ofType": null } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "getNotesByTimelineId", - "description": "", - "args": [ - { - "name": "timelineId", - "description": "", - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { "kind": "SCALAR", "name": "ID", "ofType": null } - }, - "defaultValue": null - } - ], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "LIST", - "name": null, - "ofType": { - "kind": "NON_NULL", - "name": null, - "ofType": { "kind": "OBJECT", "name": "NoteResult", "ofType": null } - } - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "getNotesByEventId", - "description": "", - "args": [ - { - "name": "eventId", - "description": "", - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { "kind": "SCALAR", "name": "ID", "ofType": null } - }, - "defaultValue": null - } - ], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "LIST", - "name": null, - "ofType": { - "kind": "NON_NULL", - "name": null, - "ofType": { "kind": "OBJECT", "name": "NoteResult", "ofType": null } - } - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "getAllNotes", - "description": "", - "args": [ - { - "name": "pageInfo", - "description": "", - "type": { "kind": "INPUT_OBJECT", "name": "PageInfoNote", "ofType": null }, - "defaultValue": null - }, - { - "name": "search", - "description": "", - "type": { "kind": "SCALAR", "name": "String", "ofType": null }, - "defaultValue": null - }, - { - "name": "sort", - "description": "", - "type": { "kind": "INPUT_OBJECT", "name": "SortNote", "ofType": null }, - "defaultValue": null - } - ], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { "kind": "OBJECT", "name": "ResponseNotes", "ofType": null } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "getAllPinnedEventsByTimelineId", - "description": "", - "args": [ - { - "name": "timelineId", - "description": "", - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { "kind": "SCALAR", "name": "ID", "ofType": null } - }, - "defaultValue": null - } - ], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "LIST", - "name": null, - "ofType": { - "kind": "NON_NULL", - "name": null, - "ofType": { "kind": "OBJECT", "name": "PinnedEvent", "ofType": null } - } - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "source", - "description": "Get a security data source by id", - "args": [ - { - "name": "id", - "description": "The id of the source", - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { "kind": "SCALAR", "name": "ID", "ofType": null } - }, - "defaultValue": null - } - ], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { "kind": "OBJECT", "name": "Source", "ofType": null } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "allSources", - "description": "Get a list of all security data sources", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "LIST", - "name": null, - "ofType": { - "kind": "NON_NULL", - "name": null, - "ofType": { "kind": "OBJECT", "name": "Source", "ofType": null } - } - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "getOneTimeline", - "description": "", - "args": [ - { - "name": "id", - "description": "", - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { "kind": "SCALAR", "name": "ID", "ofType": null } - }, - "defaultValue": null - }, - { - "name": "timelineType", - "description": "", - "type": { "kind": "ENUM", "name": "TimelineType", "ofType": null }, - "defaultValue": null - } - ], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { "kind": "OBJECT", "name": "TimelineResult", "ofType": null } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "getAllTimeline", - "description": "", - "args": [ - { - "name": "pageInfo", - "description": "", - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { "kind": "INPUT_OBJECT", "name": "PageInfoTimeline", "ofType": null } - }, - "defaultValue": null - }, - { - "name": "search", - "description": "", - "type": { "kind": "SCALAR", "name": "String", "ofType": null }, - "defaultValue": null - }, - { - "name": "sort", - "description": "", - "type": { "kind": "INPUT_OBJECT", "name": "SortTimeline", "ofType": null }, - "defaultValue": null - }, - { - "name": "onlyUserFavorite", - "description": "", - "type": { "kind": "SCALAR", "name": "Boolean", "ofType": null }, - "defaultValue": null - }, - { - "name": "timelineType", - "description": "", - "type": { "kind": "ENUM", "name": "TimelineType", "ofType": null }, - "defaultValue": null - }, - { - "name": "status", - "description": "", - "type": { "kind": "ENUM", "name": "TimelineStatus", "ofType": null }, - "defaultValue": null - } - ], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { "kind": "OBJECT", "name": "ResponseTimelines", "ofType": null } - }, - "isDeprecated": false, - "deprecationReason": null - } - ], - "inputFields": null, - "interfaces": [], - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "SCALAR", - "name": "ID", - "description": "The `ID` scalar type represents a unique identifier, often used to refetch an object or as key for a cache. The ID type appears in a JSON response as a String; however, it is not intended to be human-readable. When expected as an input type, any string (such as `\"4\"`) or integer (such as `4`) input value will be accepted as an ID.", - "fields": null, - "inputFields": null, - "interfaces": null, - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "OBJECT", - "name": "NoteResult", - "description": "", - "fields": [ - { - "name": "eventId", - "description": "", - "args": [], - "type": { "kind": "SCALAR", "name": "String", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "note", - "description": "", - "args": [], - "type": { "kind": "SCALAR", "name": "String", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "timelineId", - "description": "", - "args": [], - "type": { "kind": "SCALAR", "name": "String", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "noteId", - "description": "", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { "kind": "SCALAR", "name": "String", "ofType": null } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "created", - "description": "", - "args": [], - "type": { "kind": "SCALAR", "name": "Float", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "createdBy", - "description": "", - "args": [], - "type": { "kind": "SCALAR", "name": "String", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "timelineVersion", - "description": "", - "args": [], - "type": { "kind": "SCALAR", "name": "String", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "updated", - "description": "", - "args": [], - "type": { "kind": "SCALAR", "name": "Float", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "updatedBy", - "description": "", - "args": [], - "type": { "kind": "SCALAR", "name": "String", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "version", - "description": "", - "args": [], - "type": { "kind": "SCALAR", "name": "String", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - } - ], - "inputFields": null, - "interfaces": [], - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "SCALAR", - "name": "String", - "description": "The `String` scalar type represents textual data, represented as UTF-8 character sequences. The String type is most often used by GraphQL to represent free-form human-readable text.", - "fields": null, - "inputFields": null, - "interfaces": null, - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "SCALAR", - "name": "Float", - "description": "The `Float` scalar type represents signed double-precision fractional values as specified by [IEEE 754](http://en.wikipedia.org/wiki/IEEE_floating_point). ", - "fields": null, - "inputFields": null, - "interfaces": null, - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "INPUT_OBJECT", - "name": "PageInfoNote", - "description": "", - "fields": null, - "inputFields": [ - { - "name": "pageIndex", - "description": "", - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { "kind": "SCALAR", "name": "Float", "ofType": null } - }, - "defaultValue": null - }, - { - "name": "pageSize", - "description": "", - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { "kind": "SCALAR", "name": "Float", "ofType": null } - }, - "defaultValue": null - } - ], - "interfaces": null, - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "INPUT_OBJECT", - "name": "SortNote", - "description": "", - "fields": null, - "inputFields": [ - { - "name": "sortField", - "description": "", - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { "kind": "ENUM", "name": "SortFieldNote", "ofType": null } - }, - "defaultValue": null - }, - { - "name": "sortOrder", - "description": "", - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { "kind": "ENUM", "name": "Direction", "ofType": null } - }, - "defaultValue": null - } - ], - "interfaces": null, - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "ENUM", - "name": "SortFieldNote", - "description": "", - "fields": null, - "inputFields": null, - "interfaces": null, - "enumValues": [ - { - "name": "updatedBy", - "description": "", - "isDeprecated": false, - "deprecationReason": null - }, - { "name": "updated", "description": "", "isDeprecated": false, "deprecationReason": null } - ], - "possibleTypes": null - }, - { - "kind": "ENUM", - "name": "Direction", - "description": "", - "fields": null, - "inputFields": null, - "interfaces": null, - "enumValues": [ - { "name": "asc", "description": "", "isDeprecated": false, "deprecationReason": null }, - { "name": "desc", "description": "", "isDeprecated": false, "deprecationReason": null } - ], - "possibleTypes": null - }, - { - "kind": "OBJECT", - "name": "ResponseNotes", - "description": "", - "fields": [ - { - "name": "notes", - "description": "", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "LIST", - "name": null, - "ofType": { - "kind": "NON_NULL", - "name": null, - "ofType": { "kind": "OBJECT", "name": "NoteResult", "ofType": null } - } - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "totalCount", - "description": "", - "args": [], - "type": { "kind": "SCALAR", "name": "Float", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - } - ], - "inputFields": null, - "interfaces": [], - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "OBJECT", - "name": "PinnedEvent", - "description": "", - "fields": [ - { - "name": "code", - "description": "", - "args": [], - "type": { "kind": "SCALAR", "name": "Float", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "message", - "description": "", - "args": [], - "type": { "kind": "SCALAR", "name": "String", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "pinnedEventId", - "description": "", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { "kind": "SCALAR", "name": "ID", "ofType": null } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "eventId", - "description": "", - "args": [], - "type": { "kind": "SCALAR", "name": "ID", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "timelineId", - "description": "", - "args": [], - "type": { "kind": "SCALAR", "name": "ID", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "timelineVersion", - "description": "", - "args": [], - "type": { "kind": "SCALAR", "name": "String", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "created", - "description": "", - "args": [], - "type": { "kind": "SCALAR", "name": "Float", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "createdBy", - "description": "", - "args": [], - "type": { "kind": "SCALAR", "name": "String", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "updated", - "description": "", - "args": [], - "type": { "kind": "SCALAR", "name": "Float", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "updatedBy", - "description": "", - "args": [], - "type": { "kind": "SCALAR", "name": "String", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "version", - "description": "", - "args": [], - "type": { "kind": "SCALAR", "name": "String", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - } - ], - "inputFields": null, - "interfaces": [], - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "OBJECT", - "name": "Source", - "description": "", - "fields": [ - { - "name": "id", - "description": "The id of the source", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { "kind": "SCALAR", "name": "ID", "ofType": null } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "configuration", - "description": "The raw configuration of the source", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { "kind": "OBJECT", "name": "SourceConfiguration", "ofType": null } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "status", - "description": "The status of the source", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { "kind": "OBJECT", "name": "SourceStatus", "ofType": null } - }, - "isDeprecated": false, - "deprecationReason": null - } - ], - "inputFields": null, - "interfaces": [], - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "OBJECT", - "name": "SourceConfiguration", - "description": "A set of configuration options for a security data source", - "fields": [ - { - "name": "fields", - "description": "The field mapping to use for this source", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { "kind": "OBJECT", "name": "SourceFields", "ofType": null } - }, - "isDeprecated": false, - "deprecationReason": null - } - ], - "inputFields": null, - "interfaces": [], - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "OBJECT", - "name": "SourceFields", - "description": "A mapping of semantic fields to their document counterparts", - "fields": [ - { - "name": "container", - "description": "The field to identify a container by", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { "kind": "SCALAR", "name": "String", "ofType": null } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "host", - "description": "The fields to identify a host by", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { "kind": "SCALAR", "name": "String", "ofType": null } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "message", - "description": "The fields that may contain the log event message. The first field found win.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "LIST", - "name": null, - "ofType": { - "kind": "NON_NULL", - "name": null, - "ofType": { "kind": "SCALAR", "name": "String", "ofType": null } - } - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "pod", - "description": "The field to identify a pod by", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { "kind": "SCALAR", "name": "String", "ofType": null } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "tiebreaker", - "description": "The field to use as a tiebreaker for log events that have identical timestamps", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { "kind": "SCALAR", "name": "String", "ofType": null } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "timestamp", - "description": "The field to use as a timestamp for metrics and logs", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { "kind": "SCALAR", "name": "String", "ofType": null } - }, - "isDeprecated": false, - "deprecationReason": null - } - ], - "inputFields": null, - "interfaces": [], - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "OBJECT", - "name": "SourceStatus", - "description": "The status of an infrastructure data source", - "fields": [ - { - "name": "indicesExist", - "description": "Whether the configured alias or wildcard pattern resolve to any auditbeat indices", - "args": [ - { - "name": "defaultIndex", - "description": "", - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "LIST", - "name": null, - "ofType": { - "kind": "NON_NULL", - "name": null, - "ofType": { "kind": "SCALAR", "name": "String", "ofType": null } - } - } - }, - "defaultValue": null - } - ], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { "kind": "SCALAR", "name": "Boolean", "ofType": null } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "indexFields", - "description": "The list of fields defined in the index mappings", - "args": [ - { - "name": "defaultIndex", - "description": "", - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "LIST", - "name": null, - "ofType": { - "kind": "NON_NULL", - "name": null, - "ofType": { "kind": "SCALAR", "name": "String", "ofType": null } - } - } - }, - "defaultValue": null - } - ], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "LIST", - "name": null, - "ofType": { - "kind": "NON_NULL", - "name": null, - "ofType": { "kind": "SCALAR", "name": "String", "ofType": null } - } - } - }, - "isDeprecated": false, - "deprecationReason": null - } - ], - "inputFields": null, - "interfaces": [], - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "SCALAR", - "name": "Boolean", - "description": "The `Boolean` scalar type represents `true` or `false`.", - "fields": null, - "inputFields": null, - "interfaces": null, - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "ENUM", - "name": "TimelineType", - "description": "", - "fields": null, - "inputFields": null, - "interfaces": null, - "enumValues": [ - { - "name": "default", - "description": "", - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "template", - "description": "", - "isDeprecated": false, - "deprecationReason": null - } - ], - "possibleTypes": null - }, - { - "kind": "OBJECT", - "name": "TimelineResult", - "description": "", - "fields": [ - { - "name": "columns", - "description": "", - "args": [], - "type": { - "kind": "LIST", - "name": null, - "ofType": { - "kind": "NON_NULL", - "name": null, - "ofType": { "kind": "OBJECT", "name": "ColumnHeaderResult", "ofType": null } - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "created", - "description": "", - "args": [], - "type": { "kind": "SCALAR", "name": "Float", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "createdBy", - "description": "", - "args": [], - "type": { "kind": "SCALAR", "name": "String", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "dataProviders", - "description": "", - "args": [], - "type": { - "kind": "LIST", - "name": null, - "ofType": { - "kind": "NON_NULL", - "name": null, - "ofType": { "kind": "OBJECT", "name": "DataProviderResult", "ofType": null } - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "dateRange", - "description": "", - "args": [], - "type": { "kind": "OBJECT", "name": "DateRangePickerResult", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "description", - "description": "", - "args": [], - "type": { "kind": "SCALAR", "name": "String", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "eqlOptions", - "description": "", - "args": [], - "type": { "kind": "OBJECT", "name": "EqlOptionsResult", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "eventIdToNoteIds", - "description": "", - "args": [], - "type": { - "kind": "LIST", - "name": null, - "ofType": { - "kind": "NON_NULL", - "name": null, - "ofType": { "kind": "OBJECT", "name": "NoteResult", "ofType": null } - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "eventType", - "description": "", - "args": [], - "type": { "kind": "SCALAR", "name": "String", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "excludedRowRendererIds", - "description": "", - "args": [], - "type": { - "kind": "LIST", - "name": null, - "ofType": { - "kind": "NON_NULL", - "name": null, - "ofType": { "kind": "ENUM", "name": "RowRendererId", "ofType": null } - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "favorite", - "description": "", - "args": [], - "type": { - "kind": "LIST", - "name": null, - "ofType": { - "kind": "NON_NULL", - "name": null, - "ofType": { "kind": "OBJECT", "name": "FavoriteTimelineResult", "ofType": null } - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "filters", - "description": "", - "args": [], - "type": { - "kind": "LIST", - "name": null, - "ofType": { - "kind": "NON_NULL", - "name": null, - "ofType": { "kind": "OBJECT", "name": "FilterTimelineResult", "ofType": null } - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "kqlMode", - "description": "", - "args": [], - "type": { "kind": "SCALAR", "name": "String", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "kqlQuery", - "description": "", - "args": [], - "type": { "kind": "OBJECT", "name": "SerializedFilterQueryResult", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "indexNames", - "description": "", - "args": [], - "type": { - "kind": "LIST", - "name": null, - "ofType": { - "kind": "NON_NULL", - "name": null, - "ofType": { "kind": "SCALAR", "name": "String", "ofType": null } - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "notes", - "description": "", - "args": [], - "type": { - "kind": "LIST", - "name": null, - "ofType": { - "kind": "NON_NULL", - "name": null, - "ofType": { "kind": "OBJECT", "name": "NoteResult", "ofType": null } - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "noteIds", - "description": "", - "args": [], - "type": { - "kind": "LIST", - "name": null, - "ofType": { - "kind": "NON_NULL", - "name": null, - "ofType": { "kind": "SCALAR", "name": "String", "ofType": null } - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "pinnedEventIds", - "description": "", - "args": [], - "type": { - "kind": "LIST", - "name": null, - "ofType": { - "kind": "NON_NULL", - "name": null, - "ofType": { "kind": "SCALAR", "name": "String", "ofType": null } - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "pinnedEventsSaveObject", - "description": "", - "args": [], - "type": { - "kind": "LIST", - "name": null, - "ofType": { - "kind": "NON_NULL", - "name": null, - "ofType": { "kind": "OBJECT", "name": "PinnedEvent", "ofType": null } - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "savedQueryId", - "description": "", - "args": [], - "type": { "kind": "SCALAR", "name": "String", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "savedObjectId", - "description": "", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { "kind": "SCALAR", "name": "String", "ofType": null } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "sort", - "description": "", - "args": [], - "type": { "kind": "SCALAR", "name": "ToAny", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "status", - "description": "", - "args": [], - "type": { "kind": "ENUM", "name": "TimelineStatus", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "title", - "description": "", - "args": [], - "type": { "kind": "SCALAR", "name": "String", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "templateTimelineId", - "description": "", - "args": [], - "type": { "kind": "SCALAR", "name": "String", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "templateTimelineVersion", - "description": "", - "args": [], - "type": { "kind": "SCALAR", "name": "Int", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "timelineType", - "description": "", - "args": [], - "type": { "kind": "ENUM", "name": "TimelineType", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "updated", - "description": "", - "args": [], - "type": { "kind": "SCALAR", "name": "Float", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "updatedBy", - "description": "", - "args": [], - "type": { "kind": "SCALAR", "name": "String", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "version", - "description": "", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { "kind": "SCALAR", "name": "String", "ofType": null } - }, - "isDeprecated": false, - "deprecationReason": null - } - ], - "inputFields": null, - "interfaces": [], - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "OBJECT", - "name": "ColumnHeaderResult", - "description": "", - "fields": [ - { - "name": "aggregatable", - "description": "", - "args": [], - "type": { "kind": "SCALAR", "name": "Boolean", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "category", - "description": "", - "args": [], - "type": { "kind": "SCALAR", "name": "String", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "columnHeaderType", - "description": "", - "args": [], - "type": { "kind": "SCALAR", "name": "String", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "description", - "description": "", - "args": [], - "type": { "kind": "SCALAR", "name": "String", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "example", - "description": "", - "args": [], - "type": { "kind": "SCALAR", "name": "String", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "indexes", - "description": "", - "args": [], - "type": { - "kind": "LIST", - "name": null, - "ofType": { - "kind": "NON_NULL", - "name": null, - "ofType": { "kind": "SCALAR", "name": "String", "ofType": null } - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "id", - "description": "", - "args": [], - "type": { "kind": "SCALAR", "name": "String", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "name", - "description": "", - "args": [], - "type": { "kind": "SCALAR", "name": "String", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "placeholder", - "description": "", - "args": [], - "type": { "kind": "SCALAR", "name": "String", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "searchable", - "description": "", - "args": [], - "type": { "kind": "SCALAR", "name": "Boolean", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "type", - "description": "", - "args": [], - "type": { "kind": "SCALAR", "name": "String", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - } - ], - "inputFields": null, - "interfaces": [], - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "OBJECT", - "name": "DataProviderResult", - "description": "", - "fields": [ - { - "name": "id", - "description": "", - "args": [], - "type": { "kind": "SCALAR", "name": "String", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "name", - "description": "", - "args": [], - "type": { "kind": "SCALAR", "name": "String", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "enabled", - "description": "", - "args": [], - "type": { "kind": "SCALAR", "name": "Boolean", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "excluded", - "description": "", - "args": [], - "type": { "kind": "SCALAR", "name": "Boolean", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "kqlQuery", - "description": "", - "args": [], - "type": { "kind": "SCALAR", "name": "String", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "queryMatch", - "description": "", - "args": [], - "type": { "kind": "OBJECT", "name": "QueryMatchResult", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "type", - "description": "", - "args": [], - "type": { "kind": "ENUM", "name": "DataProviderType", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "and", - "description": "", - "args": [], - "type": { - "kind": "LIST", - "name": null, - "ofType": { - "kind": "NON_NULL", - "name": null, - "ofType": { "kind": "OBJECT", "name": "DataProviderResult", "ofType": null } - } - }, - "isDeprecated": false, - "deprecationReason": null - } - ], - "inputFields": null, - "interfaces": [], - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "OBJECT", - "name": "QueryMatchResult", - "description": "", - "fields": [ - { - "name": "field", - "description": "", - "args": [], - "type": { "kind": "SCALAR", "name": "String", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "displayField", - "description": "", - "args": [], - "type": { "kind": "SCALAR", "name": "String", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "value", - "description": "", - "args": [], - "type": { "kind": "SCALAR", "name": "String", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "displayValue", - "description": "", - "args": [], - "type": { "kind": "SCALAR", "name": "String", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "operator", - "description": "", - "args": [], - "type": { "kind": "SCALAR", "name": "String", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - } - ], - "inputFields": null, - "interfaces": [], - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "ENUM", - "name": "DataProviderType", - "description": "", - "fields": null, - "inputFields": null, - "interfaces": null, - "enumValues": [ - { - "name": "default", - "description": "", - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "template", - "description": "", - "isDeprecated": false, - "deprecationReason": null - } - ], - "possibleTypes": null - }, - { - "kind": "OBJECT", - "name": "DateRangePickerResult", - "description": "", - "fields": [ - { - "name": "start", - "description": "", - "args": [], - "type": { "kind": "SCALAR", "name": "ToAny", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "end", - "description": "", - "args": [], - "type": { "kind": "SCALAR", "name": "ToAny", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - } - ], - "inputFields": null, - "interfaces": [], - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "SCALAR", - "name": "ToAny", - "description": "", - "fields": null, - "inputFields": null, - "interfaces": null, - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "OBJECT", - "name": "EqlOptionsResult", - "description": "", - "fields": [ - { - "name": "eventCategoryField", - "description": "", - "args": [], - "type": { "kind": "SCALAR", "name": "String", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "tiebreakerField", - "description": "", - "args": [], - "type": { "kind": "SCALAR", "name": "String", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "timestampField", - "description": "", - "args": [], - "type": { "kind": "SCALAR", "name": "String", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "query", - "description": "", - "args": [], - "type": { "kind": "SCALAR", "name": "String", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "size", - "description": "", - "args": [], - "type": { "kind": "SCALAR", "name": "ToAny", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - } - ], - "inputFields": null, - "interfaces": [], - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "ENUM", - "name": "RowRendererId", - "description": "", - "fields": null, - "inputFields": null, - "interfaces": null, - "enumValues": [ - { "name": "alerts", "description": "", "isDeprecated": false, "deprecationReason": null }, - { "name": "auditd", "description": "", "isDeprecated": false, "deprecationReason": null }, - { - "name": "auditd_file", - "description": "", - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "library", - "description": "", - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "netflow", - "description": "", - "isDeprecated": false, - "deprecationReason": null - }, - { "name": "plain", "description": "", "isDeprecated": false, "deprecationReason": null }, - { - "name": "registry", - "description": "", - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "suricata", - "description": "", - "isDeprecated": false, - "deprecationReason": null - }, - { "name": "system", "description": "", "isDeprecated": false, "deprecationReason": null }, - { - "name": "system_dns", - "description": "", - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "system_endgame_process", - "description": "", - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "system_file", - "description": "", - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "system_fim", - "description": "", - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "system_security_event", - "description": "", - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "system_socket", - "description": "", - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "threat_match", - "description": "", - "isDeprecated": false, - "deprecationReason": null - }, - { "name": "zeek", "description": "", "isDeprecated": false, "deprecationReason": null } - ], - "possibleTypes": null - }, - { - "kind": "OBJECT", - "name": "FavoriteTimelineResult", - "description": "", - "fields": [ - { - "name": "fullName", - "description": "", - "args": [], - "type": { "kind": "SCALAR", "name": "String", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "userName", - "description": "", - "args": [], - "type": { "kind": "SCALAR", "name": "String", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "favoriteDate", - "description": "", - "args": [], - "type": { "kind": "SCALAR", "name": "Float", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - } - ], - "inputFields": null, - "interfaces": [], - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "OBJECT", - "name": "FilterTimelineResult", - "description": "", - "fields": [ - { - "name": "exists", - "description": "", - "args": [], - "type": { "kind": "SCALAR", "name": "String", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "meta", - "description": "", - "args": [], - "type": { "kind": "OBJECT", "name": "FilterMetaTimelineResult", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "match_all", - "description": "", - "args": [], - "type": { "kind": "SCALAR", "name": "String", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "missing", - "description": "", - "args": [], - "type": { "kind": "SCALAR", "name": "String", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "query", - "description": "", - "args": [], - "type": { "kind": "SCALAR", "name": "String", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "range", - "description": "", - "args": [], - "type": { "kind": "SCALAR", "name": "String", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "script", - "description": "", - "args": [], - "type": { "kind": "SCALAR", "name": "String", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - } - ], - "inputFields": null, - "interfaces": [], - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "OBJECT", - "name": "FilterMetaTimelineResult", - "description": "", - "fields": [ - { - "name": "alias", - "description": "", - "args": [], - "type": { "kind": "SCALAR", "name": "String", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "controlledBy", - "description": "", - "args": [], - "type": { "kind": "SCALAR", "name": "String", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "disabled", - "description": "", - "args": [], - "type": { "kind": "SCALAR", "name": "Boolean", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "field", - "description": "", - "args": [], - "type": { "kind": "SCALAR", "name": "String", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "formattedValue", - "description": "", - "args": [], - "type": { "kind": "SCALAR", "name": "String", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "index", - "description": "", - "args": [], - "type": { "kind": "SCALAR", "name": "String", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "key", - "description": "", - "args": [], - "type": { "kind": "SCALAR", "name": "String", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "negate", - "description": "", - "args": [], - "type": { "kind": "SCALAR", "name": "Boolean", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "params", - "description": "", - "args": [], - "type": { "kind": "SCALAR", "name": "String", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "type", - "description": "", - "args": [], - "type": { "kind": "SCALAR", "name": "String", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "value", - "description": "", - "args": [], - "type": { "kind": "SCALAR", "name": "String", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - } - ], - "inputFields": null, - "interfaces": [], - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "OBJECT", - "name": "SerializedFilterQueryResult", - "description": "", - "fields": [ - { - "name": "filterQuery", - "description": "", - "args": [], - "type": { "kind": "OBJECT", "name": "SerializedKueryQueryResult", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - } - ], - "inputFields": null, - "interfaces": [], - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "OBJECT", - "name": "SerializedKueryQueryResult", - "description": "", - "fields": [ - { - "name": "kuery", - "description": "", - "args": [], - "type": { "kind": "OBJECT", "name": "KueryFilterQueryResult", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "serializedQuery", - "description": "", - "args": [], - "type": { "kind": "SCALAR", "name": "String", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - } - ], - "inputFields": null, - "interfaces": [], - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "OBJECT", - "name": "KueryFilterQueryResult", - "description": "", - "fields": [ - { - "name": "kind", - "description": "", - "args": [], - "type": { "kind": "SCALAR", "name": "String", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "expression", - "description": "", - "args": [], - "type": { "kind": "SCALAR", "name": "String", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - } - ], - "inputFields": null, - "interfaces": [], - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "ENUM", - "name": "TimelineStatus", - "description": "", - "fields": null, - "inputFields": null, - "interfaces": null, - "enumValues": [ - { "name": "active", "description": "", "isDeprecated": false, "deprecationReason": null }, - { "name": "draft", "description": "", "isDeprecated": false, "deprecationReason": null }, - { - "name": "immutable", - "description": "", - "isDeprecated": false, - "deprecationReason": null - } - ], - "possibleTypes": null - }, - { - "kind": "SCALAR", - "name": "Int", - "description": "The `Int` scalar type represents non-fractional signed whole numeric values. Int can represent values between -(2^31) and 2^31 - 1. ", - "fields": null, - "inputFields": null, - "interfaces": null, - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "INPUT_OBJECT", - "name": "PageInfoTimeline", - "description": "", - "fields": null, - "inputFields": [ - { - "name": "pageIndex", - "description": "", - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { "kind": "SCALAR", "name": "Float", "ofType": null } - }, - "defaultValue": null - }, - { - "name": "pageSize", - "description": "", - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { "kind": "SCALAR", "name": "Float", "ofType": null } - }, - "defaultValue": null - } - ], - "interfaces": null, - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "INPUT_OBJECT", - "name": "SortTimeline", - "description": "", - "fields": null, - "inputFields": [ - { - "name": "sortField", - "description": "", - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { "kind": "ENUM", "name": "SortFieldTimeline", "ofType": null } - }, - "defaultValue": null - }, - { - "name": "sortOrder", - "description": "", - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { "kind": "ENUM", "name": "Direction", "ofType": null } - }, - "defaultValue": null - } - ], - "interfaces": null, - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "ENUM", - "name": "SortFieldTimeline", - "description": "", - "fields": null, - "inputFields": null, - "interfaces": null, - "enumValues": [ - { "name": "title", "description": "", "isDeprecated": false, "deprecationReason": null }, - { - "name": "description", - "description": "", - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "updated", - "description": "", - "isDeprecated": false, - "deprecationReason": null - }, - { "name": "created", "description": "", "isDeprecated": false, "deprecationReason": null } - ], - "possibleTypes": null - }, - { - "kind": "OBJECT", - "name": "ResponseTimelines", - "description": "", - "fields": [ - { - "name": "timeline", - "description": "", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "LIST", - "name": null, - "ofType": { "kind": "OBJECT", "name": "TimelineResult", "ofType": null } - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "totalCount", - "description": "", - "args": [], - "type": { "kind": "SCALAR", "name": "Float", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "defaultTimelineCount", - "description": "", - "args": [], - "type": { "kind": "SCALAR", "name": "Float", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "templateTimelineCount", - "description": "", - "args": [], - "type": { "kind": "SCALAR", "name": "Float", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "elasticTemplateTimelineCount", - "description": "", - "args": [], - "type": { "kind": "SCALAR", "name": "Float", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "customTemplateTimelineCount", - "description": "", - "args": [], - "type": { "kind": "SCALAR", "name": "Float", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "favoriteCount", - "description": "", - "args": [], - "type": { "kind": "SCALAR", "name": "Float", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - } - ], - "inputFields": null, - "interfaces": [], - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "OBJECT", - "name": "Mutation", - "description": "", - "fields": [ - { - "name": "persistNote", - "description": "Persists a note", - "args": [ - { - "name": "noteId", - "description": "", - "type": { "kind": "SCALAR", "name": "ID", "ofType": null }, - "defaultValue": null - }, - { - "name": "version", - "description": "", - "type": { "kind": "SCALAR", "name": "String", "ofType": null }, - "defaultValue": null - }, - { - "name": "note", - "description": "", - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { "kind": "INPUT_OBJECT", "name": "NoteInput", "ofType": null } - }, - "defaultValue": null - } - ], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { "kind": "OBJECT", "name": "ResponseNote", "ofType": null } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "deleteNote", - "description": "", - "args": [ - { - "name": "id", - "description": "", - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "LIST", - "name": null, - "ofType": { - "kind": "NON_NULL", - "name": null, - "ofType": { "kind": "SCALAR", "name": "ID", "ofType": null } - } - } - }, - "defaultValue": null - } - ], - "type": { "kind": "SCALAR", "name": "Boolean", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "deleteNoteByTimelineId", - "description": "", - "args": [ - { - "name": "timelineId", - "description": "", - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { "kind": "SCALAR", "name": "ID", "ofType": null } - }, - "defaultValue": null - }, - { - "name": "version", - "description": "", - "type": { "kind": "SCALAR", "name": "String", "ofType": null }, - "defaultValue": null - } - ], - "type": { "kind": "SCALAR", "name": "Boolean", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "persistPinnedEventOnTimeline", - "description": "Persists a pinned event in a timeline", - "args": [ - { - "name": "pinnedEventId", - "description": "", - "type": { "kind": "SCALAR", "name": "ID", "ofType": null }, - "defaultValue": null - }, - { - "name": "eventId", - "description": "", - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { "kind": "SCALAR", "name": "ID", "ofType": null } - }, - "defaultValue": null - }, - { - "name": "timelineId", - "description": "", - "type": { "kind": "SCALAR", "name": "ID", "ofType": null }, - "defaultValue": null - } - ], - "type": { "kind": "OBJECT", "name": "PinnedEvent", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "deletePinnedEventOnTimeline", - "description": "Remove a pinned events in a timeline", - "args": [ - { - "name": "id", - "description": "", - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "LIST", - "name": null, - "ofType": { - "kind": "NON_NULL", - "name": null, - "ofType": { "kind": "SCALAR", "name": "ID", "ofType": null } - } - } - }, - "defaultValue": null - } - ], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { "kind": "SCALAR", "name": "Boolean", "ofType": null } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "deleteAllPinnedEventsOnTimeline", - "description": "Remove all pinned events in a timeline", - "args": [ - { - "name": "timelineId", - "description": "", - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { "kind": "SCALAR", "name": "ID", "ofType": null } - }, - "defaultValue": null - } - ], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { "kind": "SCALAR", "name": "Boolean", "ofType": null } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "persistTimeline", - "description": "Persists a timeline", - "args": [ - { - "name": "id", - "description": "", - "type": { "kind": "SCALAR", "name": "ID", "ofType": null }, - "defaultValue": null - }, - { - "name": "version", - "description": "", - "type": { "kind": "SCALAR", "name": "String", "ofType": null }, - "defaultValue": null - }, - { - "name": "timeline", - "description": "", - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { "kind": "INPUT_OBJECT", "name": "TimelineInput", "ofType": null } - }, - "defaultValue": null - } - ], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { "kind": "OBJECT", "name": "ResponseTimeline", "ofType": null } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "persistFavorite", - "description": "", - "args": [ - { - "name": "timelineId", - "description": "", - "type": { "kind": "SCALAR", "name": "ID", "ofType": null }, - "defaultValue": null - }, - { - "name": "templateTimelineId", - "description": "", - "type": { "kind": "SCALAR", "name": "String", "ofType": null }, - "defaultValue": null - }, - { - "name": "templateTimelineVersion", - "description": "", - "type": { "kind": "SCALAR", "name": "Int", "ofType": null }, - "defaultValue": null - }, - { - "name": "timelineType", - "description": "", - "type": { "kind": "ENUM", "name": "TimelineType", "ofType": null }, - "defaultValue": null - } - ], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { "kind": "OBJECT", "name": "ResponseFavoriteTimeline", "ofType": null } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "deleteTimeline", - "description": "", - "args": [ - { - "name": "id", - "description": "", - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "LIST", - "name": null, - "ofType": { - "kind": "NON_NULL", - "name": null, - "ofType": { "kind": "SCALAR", "name": "ID", "ofType": null } - } - } - }, - "defaultValue": null - } - ], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { "kind": "SCALAR", "name": "Boolean", "ofType": null } - }, - "isDeprecated": false, - "deprecationReason": null - } - ], - "inputFields": null, - "interfaces": [], - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "INPUT_OBJECT", - "name": "NoteInput", - "description": "", - "fields": null, - "inputFields": [ - { - "name": "eventId", - "description": "", - "type": { "kind": "SCALAR", "name": "String", "ofType": null }, - "defaultValue": null - }, - { - "name": "note", - "description": "", - "type": { "kind": "SCALAR", "name": "String", "ofType": null }, - "defaultValue": null - }, - { - "name": "timelineId", - "description": "", - "type": { "kind": "SCALAR", "name": "String", "ofType": null }, - "defaultValue": null - } - ], - "interfaces": null, - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "OBJECT", - "name": "ResponseNote", - "description": "", - "fields": [ - { - "name": "code", - "description": "", - "args": [], - "type": { "kind": "SCALAR", "name": "Float", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "message", - "description": "", - "args": [], - "type": { "kind": "SCALAR", "name": "String", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "note", - "description": "", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { "kind": "OBJECT", "name": "NoteResult", "ofType": null } - }, - "isDeprecated": false, - "deprecationReason": null - } - ], - "inputFields": null, - "interfaces": [], - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "INPUT_OBJECT", - "name": "TimelineInput", - "description": "", - "fields": null, - "inputFields": [ - { - "name": "columns", - "description": "", - "type": { - "kind": "LIST", - "name": null, - "ofType": { - "kind": "NON_NULL", - "name": null, - "ofType": { "kind": "INPUT_OBJECT", "name": "ColumnHeaderInput", "ofType": null } - } - }, - "defaultValue": null - }, - { - "name": "dataProviders", - "description": "", - "type": { - "kind": "LIST", - "name": null, - "ofType": { - "kind": "NON_NULL", - "name": null, - "ofType": { "kind": "INPUT_OBJECT", "name": "DataProviderInput", "ofType": null } - } - }, - "defaultValue": null - }, - { - "name": "description", - "description": "", - "type": { "kind": "SCALAR", "name": "String", "ofType": null }, - "defaultValue": null - }, - { - "name": "eqlOptions", - "description": "", - "type": { "kind": "INPUT_OBJECT", "name": "EqlOptionsInput", "ofType": null }, - "defaultValue": null - }, - { - "name": "eventType", - "description": "", - "type": { "kind": "SCALAR", "name": "String", "ofType": null }, - "defaultValue": null - }, - { - "name": "excludedRowRendererIds", - "description": "", - "type": { - "kind": "LIST", - "name": null, - "ofType": { - "kind": "NON_NULL", - "name": null, - "ofType": { "kind": "ENUM", "name": "RowRendererId", "ofType": null } - } - }, - "defaultValue": null - }, - { - "name": "filters", - "description": "", - "type": { - "kind": "LIST", - "name": null, - "ofType": { - "kind": "NON_NULL", - "name": null, - "ofType": { "kind": "INPUT_OBJECT", "name": "FilterTimelineInput", "ofType": null } - } - }, - "defaultValue": null - }, - { - "name": "kqlMode", - "description": "", - "type": { "kind": "SCALAR", "name": "String", "ofType": null }, - "defaultValue": null - }, - { - "name": "kqlQuery", - "description": "", - "type": { - "kind": "INPUT_OBJECT", - "name": "SerializedFilterQueryInput", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "indexNames", - "description": "", - "type": { - "kind": "LIST", - "name": null, - "ofType": { - "kind": "NON_NULL", - "name": null, - "ofType": { "kind": "SCALAR", "name": "String", "ofType": null } - } - }, - "defaultValue": null - }, - { - "name": "title", - "description": "", - "type": { "kind": "SCALAR", "name": "String", "ofType": null }, - "defaultValue": null - }, - { - "name": "templateTimelineId", - "description": "", - "type": { "kind": "SCALAR", "name": "String", "ofType": null }, - "defaultValue": null - }, - { - "name": "templateTimelineVersion", - "description": "", - "type": { "kind": "SCALAR", "name": "Int", "ofType": null }, - "defaultValue": null - }, - { - "name": "timelineType", - "description": "", - "type": { "kind": "ENUM", "name": "TimelineType", "ofType": null }, - "defaultValue": null - }, - { - "name": "dateRange", - "description": "", - "type": { "kind": "INPUT_OBJECT", "name": "DateRangePickerInput", "ofType": null }, - "defaultValue": null - }, - { - "name": "savedQueryId", - "description": "", - "type": { "kind": "SCALAR", "name": "String", "ofType": null }, - "defaultValue": null - }, - { - "name": "sort", - "description": "", - "type": { - "kind": "LIST", - "name": null, - "ofType": { - "kind": "NON_NULL", - "name": null, - "ofType": { "kind": "INPUT_OBJECT", "name": "SortTimelineInput", "ofType": null } - } - }, - "defaultValue": null - }, - { - "name": "status", - "description": "", - "type": { "kind": "ENUM", "name": "TimelineStatus", "ofType": null }, - "defaultValue": null - } - ], - "interfaces": null, - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "INPUT_OBJECT", - "name": "ColumnHeaderInput", - "description": "", - "fields": null, - "inputFields": [ - { - "name": "aggregatable", - "description": "", - "type": { "kind": "SCALAR", "name": "Boolean", "ofType": null }, - "defaultValue": null - }, - { - "name": "category", - "description": "", - "type": { "kind": "SCALAR", "name": "String", "ofType": null }, - "defaultValue": null - }, - { - "name": "columnHeaderType", - "description": "", - "type": { "kind": "SCALAR", "name": "String", "ofType": null }, - "defaultValue": null - }, - { - "name": "description", - "description": "", - "type": { "kind": "SCALAR", "name": "String", "ofType": null }, - "defaultValue": null - }, - { - "name": "example", - "description": "", - "type": { "kind": "SCALAR", "name": "String", "ofType": null }, - "defaultValue": null - }, - { - "name": "indexes", - "description": "", - "type": { - "kind": "LIST", - "name": null, - "ofType": { - "kind": "NON_NULL", - "name": null, - "ofType": { "kind": "SCALAR", "name": "String", "ofType": null } - } - }, - "defaultValue": null - }, - { - "name": "id", - "description": "", - "type": { "kind": "SCALAR", "name": "String", "ofType": null }, - "defaultValue": null - }, - { - "name": "name", - "description": "", - "type": { "kind": "SCALAR", "name": "String", "ofType": null }, - "defaultValue": null - }, - { - "name": "placeholder", - "description": "", - "type": { "kind": "SCALAR", "name": "String", "ofType": null }, - "defaultValue": null - }, - { - "name": "searchable", - "description": "", - "type": { "kind": "SCALAR", "name": "Boolean", "ofType": null }, - "defaultValue": null - }, - { - "name": "type", - "description": "", - "type": { "kind": "SCALAR", "name": "String", "ofType": null }, - "defaultValue": null - } - ], - "interfaces": null, - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "INPUT_OBJECT", - "name": "DataProviderInput", - "description": "", - "fields": null, - "inputFields": [ - { - "name": "id", - "description": "", - "type": { "kind": "SCALAR", "name": "String", "ofType": null }, - "defaultValue": null - }, - { - "name": "name", - "description": "", - "type": { "kind": "SCALAR", "name": "String", "ofType": null }, - "defaultValue": null - }, - { - "name": "enabled", - "description": "", - "type": { "kind": "SCALAR", "name": "Boolean", "ofType": null }, - "defaultValue": null - }, - { - "name": "excluded", - "description": "", - "type": { "kind": "SCALAR", "name": "Boolean", "ofType": null }, - "defaultValue": null - }, - { - "name": "kqlQuery", - "description": "", - "type": { "kind": "SCALAR", "name": "String", "ofType": null }, - "defaultValue": null - }, - { - "name": "queryMatch", - "description": "", - "type": { "kind": "INPUT_OBJECT", "name": "QueryMatchInput", "ofType": null }, - "defaultValue": null - }, - { - "name": "and", - "description": "", - "type": { - "kind": "LIST", - "name": null, - "ofType": { - "kind": "NON_NULL", - "name": null, - "ofType": { "kind": "INPUT_OBJECT", "name": "DataProviderInput", "ofType": null } - } - }, - "defaultValue": null - }, - { - "name": "type", - "description": "", - "type": { "kind": "ENUM", "name": "DataProviderType", "ofType": null }, - "defaultValue": null - } - ], - "interfaces": null, - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "INPUT_OBJECT", - "name": "QueryMatchInput", - "description": "", - "fields": null, - "inputFields": [ - { - "name": "field", - "description": "", - "type": { "kind": "SCALAR", "name": "String", "ofType": null }, - "defaultValue": null - }, - { - "name": "displayField", - "description": "", - "type": { "kind": "SCALAR", "name": "String", "ofType": null }, - "defaultValue": null - }, - { - "name": "value", - "description": "", - "type": { "kind": "SCALAR", "name": "String", "ofType": null }, - "defaultValue": null - }, - { - "name": "displayValue", - "description": "", - "type": { "kind": "SCALAR", "name": "String", "ofType": null }, - "defaultValue": null - }, - { - "name": "operator", - "description": "", - "type": { "kind": "SCALAR", "name": "String", "ofType": null }, - "defaultValue": null - } - ], - "interfaces": null, - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "INPUT_OBJECT", - "name": "EqlOptionsInput", - "description": "", - "fields": null, - "inputFields": [ - { - "name": "eventCategoryField", - "description": "", - "type": { "kind": "SCALAR", "name": "String", "ofType": null }, - "defaultValue": null - }, - { - "name": "tiebreakerField", - "description": "", - "type": { "kind": "SCALAR", "name": "String", "ofType": null }, - "defaultValue": null - }, - { - "name": "timestampField", - "description": "", - "type": { "kind": "SCALAR", "name": "String", "ofType": null }, - "defaultValue": null - }, - { - "name": "query", - "description": "", - "type": { "kind": "SCALAR", "name": "String", "ofType": null }, - "defaultValue": null - }, - { - "name": "size", - "description": "", - "type": { "kind": "SCALAR", "name": "ToAny", "ofType": null }, - "defaultValue": null - } - ], - "interfaces": null, - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "INPUT_OBJECT", - "name": "FilterTimelineInput", - "description": "", - "fields": null, - "inputFields": [ - { - "name": "exists", - "description": "", - "type": { "kind": "SCALAR", "name": "String", "ofType": null }, - "defaultValue": null - }, - { - "name": "meta", - "description": "", - "type": { "kind": "INPUT_OBJECT", "name": "FilterMetaTimelineInput", "ofType": null }, - "defaultValue": null - }, - { - "name": "match_all", - "description": "", - "type": { "kind": "SCALAR", "name": "String", "ofType": null }, - "defaultValue": null - }, - { - "name": "missing", - "description": "", - "type": { "kind": "SCALAR", "name": "String", "ofType": null }, - "defaultValue": null - }, - { - "name": "query", - "description": "", - "type": { "kind": "SCALAR", "name": "String", "ofType": null }, - "defaultValue": null - }, - { - "name": "range", - "description": "", - "type": { "kind": "SCALAR", "name": "String", "ofType": null }, - "defaultValue": null - }, - { - "name": "script", - "description": "", - "type": { "kind": "SCALAR", "name": "String", "ofType": null }, - "defaultValue": null - } - ], - "interfaces": null, - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "INPUT_OBJECT", - "name": "FilterMetaTimelineInput", - "description": "", - "fields": null, - "inputFields": [ - { - "name": "alias", - "description": "", - "type": { "kind": "SCALAR", "name": "String", "ofType": null }, - "defaultValue": null - }, - { - "name": "controlledBy", - "description": "", - "type": { "kind": "SCALAR", "name": "String", "ofType": null }, - "defaultValue": null - }, - { - "name": "disabled", - "description": "", - "type": { "kind": "SCALAR", "name": "Boolean", "ofType": null }, - "defaultValue": null - }, - { - "name": "field", - "description": "", - "type": { "kind": "SCALAR", "name": "String", "ofType": null }, - "defaultValue": null - }, - { - "name": "formattedValue", - "description": "", - "type": { "kind": "SCALAR", "name": "String", "ofType": null }, - "defaultValue": null - }, - { - "name": "index", - "description": "", - "type": { "kind": "SCALAR", "name": "String", "ofType": null }, - "defaultValue": null - }, - { - "name": "key", - "description": "", - "type": { "kind": "SCALAR", "name": "String", "ofType": null }, - "defaultValue": null - }, - { - "name": "negate", - "description": "", - "type": { "kind": "SCALAR", "name": "Boolean", "ofType": null }, - "defaultValue": null - }, - { - "name": "params", - "description": "", - "type": { "kind": "SCALAR", "name": "String", "ofType": null }, - "defaultValue": null - }, - { - "name": "type", - "description": "", - "type": { "kind": "SCALAR", "name": "String", "ofType": null }, - "defaultValue": null - }, - { - "name": "value", - "description": "", - "type": { "kind": "SCALAR", "name": "String", "ofType": null }, - "defaultValue": null - } - ], - "interfaces": null, - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "INPUT_OBJECT", - "name": "SerializedFilterQueryInput", - "description": "", - "fields": null, - "inputFields": [ - { - "name": "filterQuery", - "description": "", - "type": { "kind": "INPUT_OBJECT", "name": "SerializedKueryQueryInput", "ofType": null }, - "defaultValue": null - } - ], - "interfaces": null, - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "INPUT_OBJECT", - "name": "SerializedKueryQueryInput", - "description": "", - "fields": null, - "inputFields": [ - { - "name": "kuery", - "description": "", - "type": { "kind": "INPUT_OBJECT", "name": "KueryFilterQueryInput", "ofType": null }, - "defaultValue": null - }, - { - "name": "serializedQuery", - "description": "", - "type": { "kind": "SCALAR", "name": "String", "ofType": null }, - "defaultValue": null - } - ], - "interfaces": null, - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "INPUT_OBJECT", - "name": "KueryFilterQueryInput", - "description": "", - "fields": null, - "inputFields": [ - { - "name": "kind", - "description": "", - "type": { "kind": "SCALAR", "name": "String", "ofType": null }, - "defaultValue": null - }, - { - "name": "expression", - "description": "", - "type": { "kind": "SCALAR", "name": "String", "ofType": null }, - "defaultValue": null - } - ], - "interfaces": null, - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "INPUT_OBJECT", - "name": "DateRangePickerInput", - "description": "", - "fields": null, - "inputFields": [ - { - "name": "start", - "description": "", - "type": { "kind": "SCALAR", "name": "ToAny", "ofType": null }, - "defaultValue": null - }, - { - "name": "end", - "description": "", - "type": { "kind": "SCALAR", "name": "ToAny", "ofType": null }, - "defaultValue": null - } - ], - "interfaces": null, - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "INPUT_OBJECT", - "name": "SortTimelineInput", - "description": "", - "fields": null, - "inputFields": [ - { - "name": "columnId", - "description": "", - "type": { "kind": "SCALAR", "name": "String", "ofType": null }, - "defaultValue": null - }, - { - "name": "sortDirection", - "description": "", - "type": { "kind": "SCALAR", "name": "String", "ofType": null }, - "defaultValue": null - } - ], - "interfaces": null, - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "OBJECT", - "name": "ResponseTimeline", - "description": "", - "fields": [ - { - "name": "code", - "description": "", - "args": [], - "type": { "kind": "SCALAR", "name": "Float", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "message", - "description": "", - "args": [], - "type": { "kind": "SCALAR", "name": "String", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "timeline", - "description": "", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { "kind": "OBJECT", "name": "TimelineResult", "ofType": null } - }, - "isDeprecated": false, - "deprecationReason": null - } - ], - "inputFields": null, - "interfaces": [], - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "OBJECT", - "name": "ResponseFavoriteTimeline", - "description": "", - "fields": [ - { - "name": "code", - "description": "", - "args": [], - "type": { "kind": "SCALAR", "name": "Float", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "message", - "description": "", - "args": [], - "type": { "kind": "SCALAR", "name": "String", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "savedObjectId", - "description": "", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { "kind": "SCALAR", "name": "String", "ofType": null } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "templateTimelineId", - "description": "", - "args": [], - "type": { "kind": "SCALAR", "name": "String", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "templateTimelineVersion", - "description": "", - "args": [], - "type": { "kind": "SCALAR", "name": "Int", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "timelineType", - "description": "", - "args": [], - "type": { "kind": "ENUM", "name": "TimelineType", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "version", - "description": "", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { "kind": "SCALAR", "name": "String", "ofType": null } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "favorite", - "description": "", - "args": [], - "type": { - "kind": "LIST", - "name": null, - "ofType": { - "kind": "NON_NULL", - "name": null, - "ofType": { "kind": "OBJECT", "name": "FavoriteTimelineResult", "ofType": null } - } - }, - "isDeprecated": false, - "deprecationReason": null - } - ], - "inputFields": null, - "interfaces": [], - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "OBJECT", - "name": "__Schema", - "description": "A GraphQL Schema defines the capabilities of a GraphQL server. It exposes all available types and directives on the server, as well as the entry points for query, mutation, and subscription operations.", - "fields": [ - { - "name": "types", - "description": "A list of all types supported by this server.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "LIST", - "name": null, - "ofType": { - "kind": "NON_NULL", - "name": null, - "ofType": { "kind": "OBJECT", "name": "__Type", "ofType": null } - } - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "queryType", - "description": "The type that query operations will be rooted at.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { "kind": "OBJECT", "name": "__Type", "ofType": null } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "mutationType", - "description": "If this server supports mutation, the type that mutation operations will be rooted at.", - "args": [], - "type": { "kind": "OBJECT", "name": "__Type", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "subscriptionType", - "description": "If this server support subscription, the type that subscription operations will be rooted at.", - "args": [], - "type": { "kind": "OBJECT", "name": "__Type", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "directives", - "description": "A list of all directives supported by this server.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "LIST", - "name": null, - "ofType": { - "kind": "NON_NULL", - "name": null, - "ofType": { "kind": "OBJECT", "name": "__Directive", "ofType": null } - } - } - }, - "isDeprecated": false, - "deprecationReason": null - } - ], - "inputFields": null, - "interfaces": [], - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "OBJECT", - "name": "__Type", - "description": "The fundamental unit of any GraphQL Schema is the type. There are many kinds of types in GraphQL as represented by the `__TypeKind` enum.\n\nDepending on the kind of a type, certain fields describe information about that type. Scalar types provide no information beyond a name and description, while Enum types provide their values. Object and Interface types provide the fields they describe. Abstract types, Union and Interface, provide the Object types possible at runtime. List and NonNull types compose other types.", - "fields": [ - { - "name": "kind", - "description": null, - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { "kind": "ENUM", "name": "__TypeKind", "ofType": null } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "name", - "description": null, - "args": [], - "type": { "kind": "SCALAR", "name": "String", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "description", - "description": null, - "args": [], - "type": { "kind": "SCALAR", "name": "String", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "fields", - "description": null, - "args": [ - { - "name": "includeDeprecated", - "description": null, - "type": { "kind": "SCALAR", "name": "Boolean", "ofType": null }, - "defaultValue": "false" - } - ], - "type": { - "kind": "LIST", - "name": null, - "ofType": { - "kind": "NON_NULL", - "name": null, - "ofType": { "kind": "OBJECT", "name": "__Field", "ofType": null } - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "interfaces", - "description": null, - "args": [], - "type": { - "kind": "LIST", - "name": null, - "ofType": { - "kind": "NON_NULL", - "name": null, - "ofType": { "kind": "OBJECT", "name": "__Type", "ofType": null } - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "possibleTypes", - "description": null, - "args": [], - "type": { - "kind": "LIST", - "name": null, - "ofType": { - "kind": "NON_NULL", - "name": null, - "ofType": { "kind": "OBJECT", "name": "__Type", "ofType": null } - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "enumValues", - "description": null, - "args": [ - { - "name": "includeDeprecated", - "description": null, - "type": { "kind": "SCALAR", "name": "Boolean", "ofType": null }, - "defaultValue": "false" - } - ], - "type": { - "kind": "LIST", - "name": null, - "ofType": { - "kind": "NON_NULL", - "name": null, - "ofType": { "kind": "OBJECT", "name": "__EnumValue", "ofType": null } - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "inputFields", - "description": null, - "args": [], - "type": { - "kind": "LIST", - "name": null, - "ofType": { - "kind": "NON_NULL", - "name": null, - "ofType": { "kind": "OBJECT", "name": "__InputValue", "ofType": null } - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "ofType", - "description": null, - "args": [], - "type": { "kind": "OBJECT", "name": "__Type", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - } - ], - "inputFields": null, - "interfaces": [], - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "ENUM", - "name": "__TypeKind", - "description": "An enum describing what kind of type a given `__Type` is.", - "fields": null, - "inputFields": null, - "interfaces": null, - "enumValues": [ - { - "name": "SCALAR", - "description": "Indicates this type is a scalar.", - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "OBJECT", - "description": "Indicates this type is an object. `fields` and `interfaces` are valid fields.", - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "INTERFACE", - "description": "Indicates this type is an interface. `fields` and `possibleTypes` are valid fields.", - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "UNION", - "description": "Indicates this type is a union. `possibleTypes` is a valid field.", - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "ENUM", - "description": "Indicates this type is an enum. `enumValues` is a valid field.", - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "INPUT_OBJECT", - "description": "Indicates this type is an input object. `inputFields` is a valid field.", - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "LIST", - "description": "Indicates this type is a list. `ofType` is a valid field.", - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "NON_NULL", - "description": "Indicates this type is a non-null. `ofType` is a valid field.", - "isDeprecated": false, - "deprecationReason": null - } - ], - "possibleTypes": null - }, - { - "kind": "OBJECT", - "name": "__Field", - "description": "Object and Interface types are described by a list of Fields, each of which has a name, potentially a list of arguments, and a return type.", - "fields": [ - { - "name": "name", - "description": null, - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { "kind": "SCALAR", "name": "String", "ofType": null } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "description", - "description": null, - "args": [], - "type": { "kind": "SCALAR", "name": "String", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "args", - "description": null, - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "LIST", - "name": null, - "ofType": { - "kind": "NON_NULL", - "name": null, - "ofType": { "kind": "OBJECT", "name": "__InputValue", "ofType": null } - } - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "type", - "description": null, - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { "kind": "OBJECT", "name": "__Type", "ofType": null } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "isDeprecated", - "description": null, - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { "kind": "SCALAR", "name": "Boolean", "ofType": null } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "deprecationReason", - "description": null, - "args": [], - "type": { "kind": "SCALAR", "name": "String", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - } - ], - "inputFields": null, - "interfaces": [], - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "OBJECT", - "name": "__InputValue", - "description": "Arguments provided to Fields or Directives and the input fields of an InputObject are represented as Input Values which describe their type and optionally a default value.", - "fields": [ - { - "name": "name", - "description": null, - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { "kind": "SCALAR", "name": "String", "ofType": null } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "description", - "description": null, - "args": [], - "type": { "kind": "SCALAR", "name": "String", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "type", - "description": null, - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { "kind": "OBJECT", "name": "__Type", "ofType": null } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "defaultValue", - "description": "A GraphQL-formatted string representing the default value for this input value.", - "args": [], - "type": { "kind": "SCALAR", "name": "String", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - } - ], - "inputFields": null, - "interfaces": [], - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "OBJECT", - "name": "__EnumValue", - "description": "One possible value for a given Enum. Enum values are unique values, not a placeholder for a string or numeric value. However an Enum value is returned in a JSON response as a string.", - "fields": [ - { - "name": "name", - "description": null, - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { "kind": "SCALAR", "name": "String", "ofType": null } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "description", - "description": null, - "args": [], - "type": { "kind": "SCALAR", "name": "String", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "isDeprecated", - "description": null, - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { "kind": "SCALAR", "name": "Boolean", "ofType": null } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "deprecationReason", - "description": null, - "args": [], - "type": { "kind": "SCALAR", "name": "String", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - } - ], - "inputFields": null, - "interfaces": [], - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "OBJECT", - "name": "__Directive", - "description": "A Directive provides a way to describe alternate runtime execution and type validation behavior in a GraphQL document.\n\nIn some cases, you need to provide options to alter GraphQL's execution behavior in ways field arguments will not suffice, such as conditionally including or skipping a field. Directives provide this by describing additional information to the executor.", - "fields": [ - { - "name": "name", - "description": null, - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { "kind": "SCALAR", "name": "String", "ofType": null } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "description", - "description": null, - "args": [], - "type": { "kind": "SCALAR", "name": "String", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "locations", - "description": null, - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "LIST", - "name": null, - "ofType": { - "kind": "NON_NULL", - "name": null, - "ofType": { "kind": "ENUM", "name": "__DirectiveLocation", "ofType": null } - } - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "args", - "description": null, - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "LIST", - "name": null, - "ofType": { - "kind": "NON_NULL", - "name": null, - "ofType": { "kind": "OBJECT", "name": "__InputValue", "ofType": null } - } - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "onOperation", - "description": null, - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { "kind": "SCALAR", "name": "Boolean", "ofType": null } - }, - "isDeprecated": true, - "deprecationReason": "Use `locations`." - }, - { - "name": "onFragment", - "description": null, - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { "kind": "SCALAR", "name": "Boolean", "ofType": null } - }, - "isDeprecated": true, - "deprecationReason": "Use `locations`." - }, - { - "name": "onField", - "description": null, - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { "kind": "SCALAR", "name": "Boolean", "ofType": null } - }, - "isDeprecated": true, - "deprecationReason": "Use `locations`." - } - ], - "inputFields": null, - "interfaces": [], - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "ENUM", - "name": "__DirectiveLocation", - "description": "A Directive can be adjacent to many parts of the GraphQL language, a __DirectiveLocation describes one such possible adjacencies.", - "fields": null, - "inputFields": null, - "interfaces": null, - "enumValues": [ - { - "name": "QUERY", - "description": "Location adjacent to a query operation.", - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "MUTATION", - "description": "Location adjacent to a mutation operation.", - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "SUBSCRIPTION", - "description": "Location adjacent to a subscription operation.", - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "FIELD", - "description": "Location adjacent to a field.", - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "FRAGMENT_DEFINITION", - "description": "Location adjacent to a fragment definition.", - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "FRAGMENT_SPREAD", - "description": "Location adjacent to a fragment spread.", - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "INLINE_FRAGMENT", - "description": "Location adjacent to an inline fragment.", - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "SCHEMA", - "description": "Location adjacent to a schema definition.", - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "SCALAR", - "description": "Location adjacent to a scalar definition.", - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "OBJECT", - "description": "Location adjacent to an object type definition.", - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "FIELD_DEFINITION", - "description": "Location adjacent to a field definition.", - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "ARGUMENT_DEFINITION", - "description": "Location adjacent to an argument definition.", - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "INTERFACE", - "description": "Location adjacent to an interface definition.", - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "UNION", - "description": "Location adjacent to a union definition.", - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "ENUM", - "description": "Location adjacent to an enum definition.", - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "ENUM_VALUE", - "description": "Location adjacent to an enum value definition.", - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "INPUT_OBJECT", - "description": "Location adjacent to an input object type definition.", - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "INPUT_FIELD_DEFINITION", - "description": "Location adjacent to an input object field definition.", - "isDeprecated": false, - "deprecationReason": null - } - ], - "possibleTypes": null - }, - { - "kind": "SCALAR", - "name": "ToStringArray", - "description": "", - "fields": null, - "inputFields": null, - "interfaces": null, - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "SCALAR", - "name": "ToStringArrayNoNullable", - "description": "", - "fields": null, - "inputFields": null, - "interfaces": null, - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "OBJECT", - "name": "EventEcsFields", - "description": "", - "fields": [ - { - "name": "action", - "description": "", - "args": [], - "type": { "kind": "SCALAR", "name": "ToStringArray", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "category", - "description": "", - "args": [], - "type": { "kind": "SCALAR", "name": "ToStringArray", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "code", - "description": "", - "args": [], - "type": { "kind": "SCALAR", "name": "ToStringArray", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "created", - "description": "", - "args": [], - "type": { "kind": "SCALAR", "name": "ToDateArray", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "dataset", - "description": "", - "args": [], - "type": { "kind": "SCALAR", "name": "ToStringArray", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "duration", - "description": "", - "args": [], - "type": { "kind": "SCALAR", "name": "ToNumberArray", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "end", - "description": "", - "args": [], - "type": { "kind": "SCALAR", "name": "ToDateArray", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "hash", - "description": "", - "args": [], - "type": { "kind": "SCALAR", "name": "ToStringArray", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "id", - "description": "", - "args": [], - "type": { "kind": "SCALAR", "name": "ToStringArray", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "kind", - "description": "", - "args": [], - "type": { "kind": "SCALAR", "name": "ToStringArray", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "module", - "description": "", - "args": [], - "type": { "kind": "SCALAR", "name": "ToStringArray", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "original", - "description": "", - "args": [], - "type": { "kind": "SCALAR", "name": "ToStringArray", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "outcome", - "description": "", - "args": [], - "type": { "kind": "SCALAR", "name": "ToStringArray", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "risk_score", - "description": "", - "args": [], - "type": { "kind": "SCALAR", "name": "ToNumberArray", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "risk_score_norm", - "description": "", - "args": [], - "type": { "kind": "SCALAR", "name": "ToNumberArray", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "severity", - "description": "", - "args": [], - "type": { "kind": "SCALAR", "name": "ToNumberArray", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "start", - "description": "", - "args": [], - "type": { "kind": "SCALAR", "name": "ToDateArray", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "timezone", - "description": "", - "args": [], - "type": { "kind": "SCALAR", "name": "ToStringArray", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "type", - "description": "", - "args": [], - "type": { "kind": "SCALAR", "name": "ToStringArray", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - } - ], - "inputFields": null, - "interfaces": [], - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "SCALAR", - "name": "ToDateArray", - "description": "", - "fields": null, - "inputFields": null, - "interfaces": null, - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "SCALAR", - "name": "ToNumberArray", - "description": "", - "fields": null, - "inputFields": null, - "interfaces": null, - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "OBJECT", - "name": "Location", - "description": "", - "fields": [ - { - "name": "lon", - "description": "", - "args": [], - "type": { "kind": "SCALAR", "name": "ToNumberArray", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "lat", - "description": "", - "args": [], - "type": { "kind": "SCALAR", "name": "ToNumberArray", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - } - ], - "inputFields": null, - "interfaces": [], - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "OBJECT", - "name": "GeoEcsFields", - "description": "", - "fields": [ - { - "name": "city_name", - "description": "", - "args": [], - "type": { "kind": "SCALAR", "name": "ToStringArray", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "continent_name", - "description": "", - "args": [], - "type": { "kind": "SCALAR", "name": "ToStringArray", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "country_iso_code", - "description": "", - "args": [], - "type": { "kind": "SCALAR", "name": "ToStringArray", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "country_name", - "description": "", - "args": [], - "type": { "kind": "SCALAR", "name": "ToStringArray", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "location", - "description": "", - "args": [], - "type": { "kind": "OBJECT", "name": "Location", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "region_iso_code", - "description": "", - "args": [], - "type": { "kind": "SCALAR", "name": "ToStringArray", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "region_name", - "description": "", - "args": [], - "type": { "kind": "SCALAR", "name": "ToStringArray", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - } - ], - "inputFields": null, - "interfaces": [], - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "OBJECT", - "name": "PrimarySecondary", - "description": "", - "fields": [ - { - "name": "primary", - "description": "", - "args": [], - "type": { "kind": "SCALAR", "name": "ToStringArray", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "secondary", - "description": "", - "args": [], - "type": { "kind": "SCALAR", "name": "ToStringArray", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "type", - "description": "", - "args": [], - "type": { "kind": "SCALAR", "name": "ToStringArray", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - } - ], - "inputFields": null, - "interfaces": [], - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "OBJECT", - "name": "Summary", - "description": "", - "fields": [ - { - "name": "actor", - "description": "", - "args": [], - "type": { "kind": "OBJECT", "name": "PrimarySecondary", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "object", - "description": "", - "args": [], - "type": { "kind": "OBJECT", "name": "PrimarySecondary", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "how", - "description": "", - "args": [], - "type": { "kind": "SCALAR", "name": "ToStringArray", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "message_type", - "description": "", - "args": [], - "type": { "kind": "SCALAR", "name": "ToStringArray", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "sequence", - "description": "", - "args": [], - "type": { "kind": "SCALAR", "name": "ToStringArray", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - } - ], - "inputFields": null, - "interfaces": [], - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "OBJECT", - "name": "AgentEcsField", - "description": "", - "fields": [ - { - "name": "type", - "description": "", - "args": [], - "type": { "kind": "SCALAR", "name": "ToStringArray", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - } - ], - "inputFields": null, - "interfaces": [], - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "OBJECT", - "name": "AuditdData", - "description": "", - "fields": [ - { - "name": "acct", - "description": "", - "args": [], - "type": { "kind": "SCALAR", "name": "ToStringArray", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "terminal", - "description": "", - "args": [], - "type": { "kind": "SCALAR", "name": "ToStringArray", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "op", - "description": "", - "args": [], - "type": { "kind": "SCALAR", "name": "ToStringArray", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - } - ], - "inputFields": null, - "interfaces": [], - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "OBJECT", - "name": "AuditdEcsFields", - "description": "", - "fields": [ - { - "name": "result", - "description": "", - "args": [], - "type": { "kind": "SCALAR", "name": "ToStringArray", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "session", - "description": "", - "args": [], - "type": { "kind": "SCALAR", "name": "ToStringArray", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "data", - "description": "", - "args": [], - "type": { "kind": "OBJECT", "name": "AuditdData", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "summary", - "description": "", - "args": [], - "type": { "kind": "OBJECT", "name": "Summary", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "sequence", - "description": "", - "args": [], - "type": { "kind": "SCALAR", "name": "ToStringArray", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - } - ], - "inputFields": null, - "interfaces": [], - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "OBJECT", - "name": "OsEcsFields", - "description": "", - "fields": [ - { - "name": "platform", - "description": "", - "args": [], - "type": { "kind": "SCALAR", "name": "ToStringArray", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "name", - "description": "", - "args": [], - "type": { "kind": "SCALAR", "name": "ToStringArray", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "full", - "description": "", - "args": [], - "type": { "kind": "SCALAR", "name": "ToStringArray", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "family", - "description": "", - "args": [], - "type": { "kind": "SCALAR", "name": "ToStringArray", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "version", - "description": "", - "args": [], - "type": { "kind": "SCALAR", "name": "ToStringArray", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "kernel", - "description": "", - "args": [], - "type": { "kind": "SCALAR", "name": "ToStringArray", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - } - ], - "inputFields": null, - "interfaces": [], - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "OBJECT", - "name": "HostEcsFields", - "description": "", - "fields": [ - { - "name": "architecture", - "description": "", - "args": [], - "type": { "kind": "SCALAR", "name": "ToStringArray", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "id", - "description": "", - "args": [], - "type": { "kind": "SCALAR", "name": "ToStringArray", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "ip", - "description": "", - "args": [], - "type": { "kind": "SCALAR", "name": "ToStringArray", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "mac", - "description": "", - "args": [], - "type": { "kind": "SCALAR", "name": "ToStringArray", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "name", - "description": "", - "args": [], - "type": { "kind": "SCALAR", "name": "ToStringArray", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "os", - "description": "", - "args": [], - "type": { "kind": "OBJECT", "name": "OsEcsFields", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "type", - "description": "", - "args": [], - "type": { "kind": "SCALAR", "name": "ToStringArray", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - } - ], - "inputFields": null, - "interfaces": [], - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "OBJECT", - "name": "Thread", - "description": "", - "fields": [ - { - "name": "id", - "description": "", - "args": [], - "type": { "kind": "SCALAR", "name": "ToNumberArray", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "start", - "description": "", - "args": [], - "type": { "kind": "SCALAR", "name": "ToStringArray", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - } - ], - "inputFields": null, - "interfaces": [], - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "OBJECT", - "name": "ProcessHashData", - "description": "", - "fields": [ - { - "name": "md5", - "description": "", - "args": [], - "type": { "kind": "SCALAR", "name": "ToStringArray", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "sha1", - "description": "", - "args": [], - "type": { "kind": "SCALAR", "name": "ToStringArray", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "sha256", - "description": "", - "args": [], - "type": { "kind": "SCALAR", "name": "ToStringArray", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - } - ], - "inputFields": null, - "interfaces": [], - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "OBJECT", - "name": "ProcessEcsFields", - "description": "", - "fields": [ - { - "name": "hash", - "description": "", - "args": [], - "type": { "kind": "OBJECT", "name": "ProcessHashData", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "pid", - "description": "", - "args": [], - "type": { "kind": "SCALAR", "name": "ToNumberArray", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "name", - "description": "", - "args": [], - "type": { "kind": "SCALAR", "name": "ToStringArray", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "ppid", - "description": "", - "args": [], - "type": { "kind": "SCALAR", "name": "ToNumberArray", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "args", - "description": "", - "args": [], - "type": { "kind": "SCALAR", "name": "ToStringArray", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "entity_id", - "description": "", - "args": [], - "type": { "kind": "SCALAR", "name": "ToStringArray", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "executable", - "description": "", - "args": [], - "type": { "kind": "SCALAR", "name": "ToStringArray", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "title", - "description": "", - "args": [], - "type": { "kind": "SCALAR", "name": "ToStringArray", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "thread", - "description": "", - "args": [], - "type": { "kind": "OBJECT", "name": "Thread", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "working_directory", - "description": "", - "args": [], - "type": { "kind": "SCALAR", "name": "ToStringArray", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - } - ], - "inputFields": null, - "interfaces": [], - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "OBJECT", - "name": "SourceEcsFields", - "description": "", - "fields": [ - { - "name": "bytes", - "description": "", - "args": [], - "type": { "kind": "SCALAR", "name": "ToNumberArray", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "ip", - "description": "", - "args": [], - "type": { "kind": "SCALAR", "name": "ToStringArray", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "port", - "description": "", - "args": [], - "type": { "kind": "SCALAR", "name": "ToNumberArray", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "domain", - "description": "", - "args": [], - "type": { "kind": "SCALAR", "name": "ToStringArray", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "geo", - "description": "", - "args": [], - "type": { "kind": "OBJECT", "name": "GeoEcsFields", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "packets", - "description": "", - "args": [], - "type": { "kind": "SCALAR", "name": "ToNumberArray", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - } - ], - "inputFields": null, - "interfaces": [], - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "OBJECT", - "name": "DestinationEcsFields", - "description": "", - "fields": [ - { - "name": "bytes", - "description": "", - "args": [], - "type": { "kind": "SCALAR", "name": "ToNumberArray", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "ip", - "description": "", - "args": [], - "type": { "kind": "SCALAR", "name": "ToStringArray", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "port", - "description": "", - "args": [], - "type": { "kind": "SCALAR", "name": "ToNumberArray", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "domain", - "description": "", - "args": [], - "type": { "kind": "SCALAR", "name": "ToStringArray", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "geo", - "description": "", - "args": [], - "type": { "kind": "OBJECT", "name": "GeoEcsFields", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "packets", - "description": "", - "args": [], - "type": { "kind": "SCALAR", "name": "ToNumberArray", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - } - ], - "inputFields": null, - "interfaces": [], - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "OBJECT", - "name": "DnsQuestionData", - "description": "", - "fields": [ - { - "name": "name", - "description": "", - "args": [], - "type": { "kind": "SCALAR", "name": "ToStringArray", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "type", - "description": "", - "args": [], - "type": { "kind": "SCALAR", "name": "ToStringArray", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - } - ], - "inputFields": null, - "interfaces": [], - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "OBJECT", - "name": "DnsEcsFields", - "description": "", - "fields": [ - { - "name": "question", - "description": "", - "args": [], - "type": { "kind": "OBJECT", "name": "DnsQuestionData", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "resolved_ip", - "description": "", - "args": [], - "type": { "kind": "SCALAR", "name": "ToStringArray", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "response_code", - "description": "", - "args": [], - "type": { "kind": "SCALAR", "name": "ToStringArray", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - } - ], - "inputFields": null, - "interfaces": [], - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "OBJECT", - "name": "EndgameEcsFields", - "description": "", - "fields": [ - { - "name": "exit_code", - "description": "", - "args": [], - "type": { "kind": "SCALAR", "name": "ToNumberArray", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "file_name", - "description": "", - "args": [], - "type": { "kind": "SCALAR", "name": "ToStringArray", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "file_path", - "description": "", - "args": [], - "type": { "kind": "SCALAR", "name": "ToStringArray", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "logon_type", - "description": "", - "args": [], - "type": { "kind": "SCALAR", "name": "ToNumberArray", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "parent_process_name", - "description": "", - "args": [], - "type": { "kind": "SCALAR", "name": "ToStringArray", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "pid", - "description": "", - "args": [], - "type": { "kind": "SCALAR", "name": "ToNumberArray", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "process_name", - "description": "", - "args": [], - "type": { "kind": "SCALAR", "name": "ToStringArray", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "subject_domain_name", - "description": "", - "args": [], - "type": { "kind": "SCALAR", "name": "ToStringArray", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "subject_logon_id", - "description": "", - "args": [], - "type": { "kind": "SCALAR", "name": "ToStringArray", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "subject_user_name", - "description": "", - "args": [], - "type": { "kind": "SCALAR", "name": "ToStringArray", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "target_domain_name", - "description": "", - "args": [], - "type": { "kind": "SCALAR", "name": "ToStringArray", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "target_logon_id", - "description": "", - "args": [], - "type": { "kind": "SCALAR", "name": "ToStringArray", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "target_user_name", - "description": "", - "args": [], - "type": { "kind": "SCALAR", "name": "ToStringArray", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - } - ], - "inputFields": null, - "interfaces": [], - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "OBJECT", - "name": "SuricataAlertData", - "description": "", - "fields": [ - { - "name": "signature", - "description": "", - "args": [], - "type": { "kind": "SCALAR", "name": "ToStringArray", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "signature_id", - "description": "", - "args": [], - "type": { "kind": "SCALAR", "name": "ToNumberArray", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - } - ], - "inputFields": null, - "interfaces": [], - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "OBJECT", - "name": "SuricataEveData", - "description": "", - "fields": [ - { - "name": "alert", - "description": "", - "args": [], - "type": { "kind": "OBJECT", "name": "SuricataAlertData", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "flow_id", - "description": "", - "args": [], - "type": { "kind": "SCALAR", "name": "ToNumberArray", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "proto", - "description": "", - "args": [], - "type": { "kind": "SCALAR", "name": "ToStringArray", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - } - ], - "inputFields": null, - "interfaces": [], - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "OBJECT", - "name": "SuricataEcsFields", - "description": "", - "fields": [ - { - "name": "eve", - "description": "", - "args": [], - "type": { "kind": "OBJECT", "name": "SuricataEveData", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - } - ], - "inputFields": null, - "interfaces": [], - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "OBJECT", - "name": "TlsJa3Data", - "description": "", - "fields": [ - { - "name": "hash", - "description": "", - "args": [], - "type": { "kind": "SCALAR", "name": "ToStringArray", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - } - ], - "inputFields": null, - "interfaces": [], - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "OBJECT", - "name": "FingerprintData", - "description": "", - "fields": [ - { - "name": "sha1", - "description": "", - "args": [], - "type": { "kind": "SCALAR", "name": "ToStringArray", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - } - ], - "inputFields": null, - "interfaces": [], - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "OBJECT", - "name": "TlsClientCertificateData", - "description": "", - "fields": [ - { - "name": "fingerprint", - "description": "", - "args": [], - "type": { "kind": "OBJECT", "name": "FingerprintData", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - } - ], - "inputFields": null, - "interfaces": [], - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "OBJECT", - "name": "TlsServerCertificateData", - "description": "", - "fields": [ - { - "name": "fingerprint", - "description": "", - "args": [], - "type": { "kind": "OBJECT", "name": "FingerprintData", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - } - ], - "inputFields": null, - "interfaces": [], - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "OBJECT", - "name": "TlsFingerprintsData", - "description": "", - "fields": [ - { - "name": "ja3", - "description": "", - "args": [], - "type": { "kind": "OBJECT", "name": "TlsJa3Data", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - } - ], - "inputFields": null, - "interfaces": [], - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "OBJECT", - "name": "TlsEcsFields", - "description": "", - "fields": [ - { - "name": "client_certificate", - "description": "", - "args": [], - "type": { "kind": "OBJECT", "name": "TlsClientCertificateData", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "fingerprints", - "description": "", - "args": [], - "type": { "kind": "OBJECT", "name": "TlsFingerprintsData", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "server_certificate", - "description": "", - "args": [], - "type": { "kind": "OBJECT", "name": "TlsServerCertificateData", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - } - ], - "inputFields": null, - "interfaces": [], - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "OBJECT", - "name": "ZeekConnectionData", - "description": "", - "fields": [ - { - "name": "local_resp", - "description": "", - "args": [], - "type": { "kind": "SCALAR", "name": "ToBooleanArray", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "local_orig", - "description": "", - "args": [], - "type": { "kind": "SCALAR", "name": "ToBooleanArray", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "missed_bytes", - "description": "", - "args": [], - "type": { "kind": "SCALAR", "name": "ToNumberArray", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "state", - "description": "", - "args": [], - "type": { "kind": "SCALAR", "name": "ToStringArray", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "history", - "description": "", - "args": [], - "type": { "kind": "SCALAR", "name": "ToStringArray", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - } - ], - "inputFields": null, - "interfaces": [], - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "SCALAR", - "name": "ToBooleanArray", - "description": "", - "fields": null, - "inputFields": null, - "interfaces": null, - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "OBJECT", - "name": "ZeekNoticeData", - "description": "", - "fields": [ - { - "name": "suppress_for", - "description": "", - "args": [], - "type": { "kind": "SCALAR", "name": "ToNumberArray", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "msg", - "description": "", - "args": [], - "type": { "kind": "SCALAR", "name": "ToStringArray", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "note", - "description": "", - "args": [], - "type": { "kind": "SCALAR", "name": "ToStringArray", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "sub", - "description": "", - "args": [], - "type": { "kind": "SCALAR", "name": "ToStringArray", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "dst", - "description": "", - "args": [], - "type": { "kind": "SCALAR", "name": "ToStringArray", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "dropped", - "description": "", - "args": [], - "type": { "kind": "SCALAR", "name": "ToBooleanArray", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "peer_descr", - "description": "", - "args": [], - "type": { "kind": "SCALAR", "name": "ToStringArray", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - } - ], - "inputFields": null, - "interfaces": [], - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "OBJECT", - "name": "ZeekDnsData", - "description": "", - "fields": [ - { - "name": "AA", - "description": "", - "args": [], - "type": { "kind": "SCALAR", "name": "ToBooleanArray", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "qclass_name", - "description": "", - "args": [], - "type": { "kind": "SCALAR", "name": "ToStringArray", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "RD", - "description": "", - "args": [], - "type": { "kind": "SCALAR", "name": "ToBooleanArray", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "qtype_name", - "description": "", - "args": [], - "type": { "kind": "SCALAR", "name": "ToStringArray", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "rejected", - "description": "", - "args": [], - "type": { "kind": "SCALAR", "name": "ToBooleanArray", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "qtype", - "description": "", - "args": [], - "type": { "kind": "SCALAR", "name": "ToStringArray", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "query", - "description": "", - "args": [], - "type": { "kind": "SCALAR", "name": "ToStringArray", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "trans_id", - "description": "", - "args": [], - "type": { "kind": "SCALAR", "name": "ToNumberArray", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "qclass", - "description": "", - "args": [], - "type": { "kind": "SCALAR", "name": "ToStringArray", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "RA", - "description": "", - "args": [], - "type": { "kind": "SCALAR", "name": "ToBooleanArray", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "TC", - "description": "", - "args": [], - "type": { "kind": "SCALAR", "name": "ToBooleanArray", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - } - ], - "inputFields": null, - "interfaces": [], - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "OBJECT", - "name": "FileFields", - "description": "", - "fields": [ - { - "name": "name", - "description": "", - "args": [], - "type": { "kind": "SCALAR", "name": "ToStringArray", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "path", - "description": "", - "args": [], - "type": { "kind": "SCALAR", "name": "ToStringArray", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "target_path", - "description": "", - "args": [], - "type": { "kind": "SCALAR", "name": "ToStringArray", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "extension", - "description": "", - "args": [], - "type": { "kind": "SCALAR", "name": "ToStringArray", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "type", - "description": "", - "args": [], - "type": { "kind": "SCALAR", "name": "ToStringArray", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "device", - "description": "", - "args": [], - "type": { "kind": "SCALAR", "name": "ToStringArray", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "inode", - "description": "", - "args": [], - "type": { "kind": "SCALAR", "name": "ToStringArray", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "uid", - "description": "", - "args": [], - "type": { "kind": "SCALAR", "name": "ToStringArray", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "owner", - "description": "", - "args": [], - "type": { "kind": "SCALAR", "name": "ToStringArray", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "gid", - "description": "", - "args": [], - "type": { "kind": "SCALAR", "name": "ToStringArray", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "group", - "description": "", - "args": [], - "type": { "kind": "SCALAR", "name": "ToStringArray", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "mode", - "description": "", - "args": [], - "type": { "kind": "SCALAR", "name": "ToStringArray", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "size", - "description": "", - "args": [], - "type": { "kind": "SCALAR", "name": "ToNumberArray", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "mtime", - "description": "", - "args": [], - "type": { "kind": "SCALAR", "name": "ToDateArray", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "ctime", - "description": "", - "args": [], - "type": { "kind": "SCALAR", "name": "ToDateArray", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - } - ], - "inputFields": null, - "interfaces": [], - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "OBJECT", - "name": "ZeekHttpData", - "description": "", - "fields": [ - { - "name": "resp_mime_types", - "description": "", - "args": [], - "type": { "kind": "SCALAR", "name": "ToStringArray", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "trans_depth", - "description": "", - "args": [], - "type": { "kind": "SCALAR", "name": "ToStringArray", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "status_msg", - "description": "", - "args": [], - "type": { "kind": "SCALAR", "name": "ToStringArray", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "resp_fuids", - "description": "", - "args": [], - "type": { "kind": "SCALAR", "name": "ToStringArray", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "tags", - "description": "", - "args": [], - "type": { "kind": "SCALAR", "name": "ToStringArray", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - } - ], - "inputFields": null, - "interfaces": [], - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "OBJECT", - "name": "HttpBodyData", - "description": "", - "fields": [ - { - "name": "content", - "description": "", - "args": [], - "type": { "kind": "SCALAR", "name": "ToStringArray", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "bytes", - "description": "", - "args": [], - "type": { "kind": "SCALAR", "name": "ToNumberArray", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - } - ], - "inputFields": null, - "interfaces": [], - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "OBJECT", - "name": "HttpRequestData", - "description": "", - "fields": [ - { - "name": "method", - "description": "", - "args": [], - "type": { "kind": "SCALAR", "name": "ToStringArray", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "body", - "description": "", - "args": [], - "type": { "kind": "OBJECT", "name": "HttpBodyData", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "referrer", - "description": "", - "args": [], - "type": { "kind": "SCALAR", "name": "ToStringArray", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "bytes", - "description": "", - "args": [], - "type": { "kind": "SCALAR", "name": "ToNumberArray", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - } - ], - "inputFields": null, - "interfaces": [], - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "OBJECT", - "name": "HttpResponseData", - "description": "", - "fields": [ - { - "name": "status_code", - "description": "", - "args": [], - "type": { "kind": "SCALAR", "name": "ToNumberArray", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "body", - "description": "", - "args": [], - "type": { "kind": "OBJECT", "name": "HttpBodyData", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "bytes", - "description": "", - "args": [], - "type": { "kind": "SCALAR", "name": "ToNumberArray", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - } - ], - "inputFields": null, - "interfaces": [], - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "OBJECT", - "name": "HttpEcsFields", - "description": "", - "fields": [ - { - "name": "version", - "description": "", - "args": [], - "type": { "kind": "SCALAR", "name": "ToStringArray", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "request", - "description": "", - "args": [], - "type": { "kind": "OBJECT", "name": "HttpRequestData", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "response", - "description": "", - "args": [], - "type": { "kind": "OBJECT", "name": "HttpResponseData", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - } - ], - "inputFields": null, - "interfaces": [], - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "OBJECT", - "name": "UrlEcsFields", - "description": "", - "fields": [ - { - "name": "domain", - "description": "", - "args": [], - "type": { "kind": "SCALAR", "name": "ToStringArray", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "original", - "description": "", - "args": [], - "type": { "kind": "SCALAR", "name": "ToStringArray", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "username", - "description": "", - "args": [], - "type": { "kind": "SCALAR", "name": "ToStringArray", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "password", - "description": "", - "args": [], - "type": { "kind": "SCALAR", "name": "ToStringArray", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - } - ], - "inputFields": null, - "interfaces": [], - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "OBJECT", - "name": "ZeekFileData", - "description": "", - "fields": [ - { - "name": "session_ids", - "description": "", - "args": [], - "type": { "kind": "SCALAR", "name": "ToStringArray", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "timedout", - "description": "", - "args": [], - "type": { "kind": "SCALAR", "name": "ToBooleanArray", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "local_orig", - "description": "", - "args": [], - "type": { "kind": "SCALAR", "name": "ToBooleanArray", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "tx_host", - "description": "", - "args": [], - "type": { "kind": "SCALAR", "name": "ToStringArray", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "source", - "description": "", - "args": [], - "type": { "kind": "SCALAR", "name": "ToStringArray", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "is_orig", - "description": "", - "args": [], - "type": { "kind": "SCALAR", "name": "ToBooleanArray", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "overflow_bytes", - "description": "", - "args": [], - "type": { "kind": "SCALAR", "name": "ToNumberArray", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "sha1", - "description": "", - "args": [], - "type": { "kind": "SCALAR", "name": "ToStringArray", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "duration", - "description": "", - "args": [], - "type": { "kind": "SCALAR", "name": "ToNumberArray", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "depth", - "description": "", - "args": [], - "type": { "kind": "SCALAR", "name": "ToNumberArray", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "analyzers", - "description": "", - "args": [], - "type": { "kind": "SCALAR", "name": "ToStringArray", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "mime_type", - "description": "", - "args": [], - "type": { "kind": "SCALAR", "name": "ToStringArray", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "rx_host", - "description": "", - "args": [], - "type": { "kind": "SCALAR", "name": "ToStringArray", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "total_bytes", - "description": "", - "args": [], - "type": { "kind": "SCALAR", "name": "ToNumberArray", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "fuid", - "description": "", - "args": [], - "type": { "kind": "SCALAR", "name": "ToStringArray", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "seen_bytes", - "description": "", - "args": [], - "type": { "kind": "SCALAR", "name": "ToNumberArray", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "missing_bytes", - "description": "", - "args": [], - "type": { "kind": "SCALAR", "name": "ToNumberArray", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "md5", - "description": "", - "args": [], - "type": { "kind": "SCALAR", "name": "ToStringArray", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - } - ], - "inputFields": null, - "interfaces": [], - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "OBJECT", - "name": "ZeekSslData", - "description": "", - "fields": [ - { - "name": "cipher", - "description": "", - "args": [], - "type": { "kind": "SCALAR", "name": "ToStringArray", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "established", - "description": "", - "args": [], - "type": { "kind": "SCALAR", "name": "ToBooleanArray", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "resumed", - "description": "", - "args": [], - "type": { "kind": "SCALAR", "name": "ToBooleanArray", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "version", - "description": "", - "args": [], - "type": { "kind": "SCALAR", "name": "ToStringArray", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - } - ], - "inputFields": null, - "interfaces": [], - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "OBJECT", - "name": "ZeekEcsFields", - "description": "", - "fields": [ - { - "name": "session_id", - "description": "", - "args": [], - "type": { "kind": "SCALAR", "name": "ToStringArray", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "connection", - "description": "", - "args": [], - "type": { "kind": "OBJECT", "name": "ZeekConnectionData", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "notice", - "description": "", - "args": [], - "type": { "kind": "OBJECT", "name": "ZeekNoticeData", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "dns", - "description": "", - "args": [], - "type": { "kind": "OBJECT", "name": "ZeekDnsData", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "http", - "description": "", - "args": [], - "type": { "kind": "OBJECT", "name": "ZeekHttpData", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "files", - "description": "", - "args": [], - "type": { "kind": "OBJECT", "name": "ZeekFileData", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "ssl", - "description": "", - "args": [], - "type": { "kind": "OBJECT", "name": "ZeekSslData", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - } - ], - "inputFields": null, - "interfaces": [], - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "OBJECT", - "name": "UserEcsFields", - "description": "", - "fields": [ - { - "name": "domain", - "description": "", - "args": [], - "type": { "kind": "SCALAR", "name": "ToStringArray", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "id", - "description": "", - "args": [], - "type": { "kind": "SCALAR", "name": "ToStringArray", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "name", - "description": "", - "args": [], - "type": { "kind": "SCALAR", "name": "ToStringArray", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "full_name", - "description": "", - "args": [], - "type": { "kind": "SCALAR", "name": "ToStringArray", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "email", - "description": "", - "args": [], - "type": { "kind": "SCALAR", "name": "ToStringArray", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "hash", - "description": "", - "args": [], - "type": { "kind": "SCALAR", "name": "ToStringArray", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "group", - "description": "", - "args": [], - "type": { "kind": "SCALAR", "name": "ToStringArray", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - } - ], - "inputFields": null, - "interfaces": [], - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "OBJECT", - "name": "WinlogEcsFields", - "description": "", - "fields": [ - { - "name": "event_id", - "description": "", - "args": [], - "type": { "kind": "SCALAR", "name": "ToNumberArray", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - } - ], - "inputFields": null, - "interfaces": [], - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "OBJECT", - "name": "NetworkEcsField", - "description": "", - "fields": [ - { - "name": "bytes", - "description": "", - "args": [], - "type": { "kind": "SCALAR", "name": "ToNumberArray", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "community_id", - "description": "", - "args": [], - "type": { "kind": "SCALAR", "name": "ToStringArray", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "direction", - "description": "", - "args": [], - "type": { "kind": "SCALAR", "name": "ToStringArray", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "packets", - "description": "", - "args": [], - "type": { "kind": "SCALAR", "name": "ToNumberArray", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "protocol", - "description": "", - "args": [], - "type": { "kind": "SCALAR", "name": "ToStringArray", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "transport", - "description": "", - "args": [], - "type": { "kind": "SCALAR", "name": "ToStringArray", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - } - ], - "inputFields": null, - "interfaces": [], - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "OBJECT", - "name": "PackageEcsFields", - "description": "", - "fields": [ - { - "name": "arch", - "description": "", - "args": [], - "type": { "kind": "SCALAR", "name": "ToStringArray", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "entity_id", - "description": "", - "args": [], - "type": { "kind": "SCALAR", "name": "ToStringArray", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "name", - "description": "", - "args": [], - "type": { "kind": "SCALAR", "name": "ToStringArray", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "size", - "description": "", - "args": [], - "type": { "kind": "SCALAR", "name": "ToNumberArray", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "summary", - "description": "", - "args": [], - "type": { "kind": "SCALAR", "name": "ToStringArray", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "version", - "description": "", - "args": [], - "type": { "kind": "SCALAR", "name": "ToStringArray", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - } - ], - "inputFields": null, - "interfaces": [], - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "OBJECT", - "name": "AuditEcsFields", - "description": "", - "fields": [ - { - "name": "package", - "description": "", - "args": [], - "type": { "kind": "OBJECT", "name": "PackageEcsFields", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - } - ], - "inputFields": null, - "interfaces": [], - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "OBJECT", - "name": "SshEcsFields", - "description": "", - "fields": [ - { - "name": "method", - "description": "", - "args": [], - "type": { "kind": "SCALAR", "name": "ToStringArray", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "signature", - "description": "", - "args": [], - "type": { "kind": "SCALAR", "name": "ToStringArray", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - } - ], - "inputFields": null, - "interfaces": [], - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "OBJECT", - "name": "AuthEcsFields", - "description": "", - "fields": [ - { - "name": "ssh", - "description": "", - "args": [], - "type": { "kind": "OBJECT", "name": "SshEcsFields", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - } - ], - "inputFields": null, - "interfaces": [], - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "OBJECT", - "name": "SystemEcsField", - "description": "", - "fields": [ - { - "name": "audit", - "description": "", - "args": [], - "type": { "kind": "OBJECT", "name": "AuditEcsFields", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "auth", - "description": "", - "args": [], - "type": { "kind": "OBJECT", "name": "AuthEcsFields", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - } - ], - "inputFields": null, - "interfaces": [], - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "OBJECT", - "name": "RuleField", - "description": "", - "fields": [ - { - "name": "id", - "description": "", - "args": [], - "type": { "kind": "SCALAR", "name": "ToStringArray", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "rule_id", - "description": "", - "args": [], - "type": { "kind": "SCALAR", "name": "ToStringArray", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "false_positives", - "description": "", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "LIST", - "name": null, - "ofType": { - "kind": "NON_NULL", - "name": null, - "ofType": { "kind": "SCALAR", "name": "String", "ofType": null } - } - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "saved_id", - "description": "", - "args": [], - "type": { "kind": "SCALAR", "name": "ToStringArray", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "timeline_id", - "description": "", - "args": [], - "type": { "kind": "SCALAR", "name": "ToStringArray", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "timeline_title", - "description": "", - "args": [], - "type": { "kind": "SCALAR", "name": "ToStringArray", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "max_signals", - "description": "", - "args": [], - "type": { "kind": "SCALAR", "name": "ToNumberArray", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "risk_score", - "description": "", - "args": [], - "type": { "kind": "SCALAR", "name": "ToStringArray", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "output_index", - "description": "", - "args": [], - "type": { "kind": "SCALAR", "name": "ToStringArray", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "description", - "description": "", - "args": [], - "type": { "kind": "SCALAR", "name": "ToStringArray", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "from", - "description": "", - "args": [], - "type": { "kind": "SCALAR", "name": "ToStringArray", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "immutable", - "description": "", - "args": [], - "type": { "kind": "SCALAR", "name": "ToBooleanArray", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "index", - "description": "", - "args": [], - "type": { "kind": "SCALAR", "name": "ToStringArray", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "interval", - "description": "", - "args": [], - "type": { "kind": "SCALAR", "name": "ToStringArray", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "language", - "description": "", - "args": [], - "type": { "kind": "SCALAR", "name": "ToStringArray", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "query", - "description": "", - "args": [], - "type": { "kind": "SCALAR", "name": "ToStringArray", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "references", - "description": "", - "args": [], - "type": { "kind": "SCALAR", "name": "ToStringArray", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "severity", - "description": "", - "args": [], - "type": { "kind": "SCALAR", "name": "ToStringArray", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "tags", - "description": "", - "args": [], - "type": { "kind": "SCALAR", "name": "ToStringArray", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "threat", - "description": "", - "args": [], - "type": { "kind": "SCALAR", "name": "ToAny", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "type", - "description": "", - "args": [], - "type": { "kind": "SCALAR", "name": "ToStringArray", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "size", - "description": "", - "args": [], - "type": { "kind": "SCALAR", "name": "ToStringArray", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "to", - "description": "", - "args": [], - "type": { "kind": "SCALAR", "name": "ToStringArray", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "enabled", - "description": "", - "args": [], - "type": { "kind": "SCALAR", "name": "ToBooleanArray", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "filters", - "description": "", - "args": [], - "type": { "kind": "SCALAR", "name": "ToAny", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "created_at", - "description": "", - "args": [], - "type": { "kind": "SCALAR", "name": "ToStringArray", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "updated_at", - "description": "", - "args": [], - "type": { "kind": "SCALAR", "name": "ToStringArray", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "created_by", - "description": "", - "args": [], - "type": { "kind": "SCALAR", "name": "ToStringArray", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "updated_by", - "description": "", - "args": [], - "type": { "kind": "SCALAR", "name": "ToStringArray", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "version", - "description": "", - "args": [], - "type": { "kind": "SCALAR", "name": "ToStringArray", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "note", - "description": "", - "args": [], - "type": { "kind": "SCALAR", "name": "ToStringArray", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "threshold", - "description": "", - "args": [], - "type": { "kind": "SCALAR", "name": "ToAny", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "exceptions_list", - "description": "", - "args": [], - "type": { "kind": "SCALAR", "name": "ToAny", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - } - ], - "inputFields": null, - "interfaces": [], - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "OBJECT", - "name": "SignalField", - "description": "", - "fields": [ - { - "name": "rule", - "description": "", - "args": [], - "type": { "kind": "OBJECT", "name": "RuleField", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "original_time", - "description": "", - "args": [], - "type": { "kind": "SCALAR", "name": "ToStringArray", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "status", - "description": "", - "args": [], - "type": { "kind": "SCALAR", "name": "ToStringArray", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - } - ], - "inputFields": null, - "interfaces": [], - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "OBJECT", - "name": "RuleEcsField", - "description": "", - "fields": [ - { - "name": "reference", - "description": "", - "args": [], - "type": { "kind": "SCALAR", "name": "ToStringArray", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - } - ], - "inputFields": null, - "interfaces": [], - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "OBJECT", - "name": "ECS", - "description": "", - "fields": [ - { - "name": "_id", - "description": "", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { "kind": "SCALAR", "name": "String", "ofType": null } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "_index", - "description": "", - "args": [], - "type": { "kind": "SCALAR", "name": "String", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "agent", - "description": "", - "args": [], - "type": { "kind": "OBJECT", "name": "AgentEcsField", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "auditd", - "description": "", - "args": [], - "type": { "kind": "OBJECT", "name": "AuditdEcsFields", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "destination", - "description": "", - "args": [], - "type": { "kind": "OBJECT", "name": "DestinationEcsFields", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "dns", - "description": "", - "args": [], - "type": { "kind": "OBJECT", "name": "DnsEcsFields", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "endgame", - "description": "", - "args": [], - "type": { "kind": "OBJECT", "name": "EndgameEcsFields", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "event", - "description": "", - "args": [], - "type": { "kind": "OBJECT", "name": "EventEcsFields", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "geo", - "description": "", - "args": [], - "type": { "kind": "OBJECT", "name": "GeoEcsFields", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "host", - "description": "", - "args": [], - "type": { "kind": "OBJECT", "name": "HostEcsFields", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "network", - "description": "", - "args": [], - "type": { "kind": "OBJECT", "name": "NetworkEcsField", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "rule", - "description": "", - "args": [], - "type": { "kind": "OBJECT", "name": "RuleEcsField", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "signal", - "description": "", - "args": [], - "type": { "kind": "OBJECT", "name": "SignalField", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "source", - "description": "", - "args": [], - "type": { "kind": "OBJECT", "name": "SourceEcsFields", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "suricata", - "description": "", - "args": [], - "type": { "kind": "OBJECT", "name": "SuricataEcsFields", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "tls", - "description": "", - "args": [], - "type": { "kind": "OBJECT", "name": "TlsEcsFields", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "zeek", - "description": "", - "args": [], - "type": { "kind": "OBJECT", "name": "ZeekEcsFields", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "http", - "description": "", - "args": [], - "type": { "kind": "OBJECT", "name": "HttpEcsFields", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "url", - "description": "", - "args": [], - "type": { "kind": "OBJECT", "name": "UrlEcsFields", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "timestamp", - "description": "", - "args": [], - "type": { "kind": "SCALAR", "name": "Date", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "message", - "description": "", - "args": [], - "type": { "kind": "SCALAR", "name": "ToStringArray", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "user", - "description": "", - "args": [], - "type": { "kind": "OBJECT", "name": "UserEcsFields", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "winlog", - "description": "", - "args": [], - "type": { "kind": "OBJECT", "name": "WinlogEcsFields", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "process", - "description": "", - "args": [], - "type": { "kind": "OBJECT", "name": "ProcessEcsFields", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "file", - "description": "", - "args": [], - "type": { "kind": "OBJECT", "name": "FileFields", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "system", - "description": "", - "args": [], - "type": { "kind": "OBJECT", "name": "SystemEcsField", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - } - ], - "inputFields": null, - "interfaces": [], - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "SCALAR", - "name": "Date", - "description": "", - "fields": null, - "inputFields": null, - "interfaces": null, - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "OBJECT", - "name": "EcsEdges", - "description": "", - "fields": [ - { - "name": "node", - "description": "", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { "kind": "OBJECT", "name": "ECS", "ofType": null } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "cursor", - "description": "", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { "kind": "OBJECT", "name": "CursorType", "ofType": null } - }, - "isDeprecated": false, - "deprecationReason": null - } - ], - "inputFields": null, - "interfaces": [], - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "OBJECT", - "name": "CursorType", - "description": "", - "fields": [ - { - "name": "value", - "description": "", - "args": [], - "type": { "kind": "SCALAR", "name": "String", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "tiebreaker", - "description": "", - "args": [], - "type": { "kind": "SCALAR", "name": "String", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - } - ], - "inputFields": null, - "interfaces": [], - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "SCALAR", - "name": "ToIFieldSubTypeNonNullable", - "description": "", - "fields": null, - "inputFields": null, - "interfaces": null, - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "OBJECT", - "name": "IndexField", - "description": "A descriptor of a field in an index", - "fields": [ - { - "name": "category", - "description": "Where the field belong", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { "kind": "SCALAR", "name": "String", "ofType": null } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "example", - "description": "Example of field's value", - "args": [], - "type": { "kind": "SCALAR", "name": "String", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "indexes", - "description": "whether the field's belong to an alias index", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "LIST", - "name": null, - "ofType": { "kind": "SCALAR", "name": "String", "ofType": null } - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "name", - "description": "The name of the field", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { "kind": "SCALAR", "name": "String", "ofType": null } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "type", - "description": "The type of the field's values as recognized by Kibana", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { "kind": "SCALAR", "name": "String", "ofType": null } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "searchable", - "description": "Whether the field's values can be efficiently searched for", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { "kind": "SCALAR", "name": "Boolean", "ofType": null } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "aggregatable", - "description": "Whether the field's values can be aggregated", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { "kind": "SCALAR", "name": "Boolean", "ofType": null } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "description", - "description": "Description of the field", - "args": [], - "type": { "kind": "SCALAR", "name": "String", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "format", - "description": "", - "args": [], - "type": { "kind": "SCALAR", "name": "String", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "esTypes", - "description": "the elastic type as mapped in the index", - "args": [], - "type": { "kind": "SCALAR", "name": "ToStringArrayNoNullable", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "subType", - "description": "", - "args": [], - "type": { "kind": "SCALAR", "name": "ToIFieldSubTypeNonNullable", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - } - ], - "inputFields": null, - "interfaces": [], - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "INPUT_OBJECT", - "name": "TimerangeInput", - "description": "", - "fields": null, - "inputFields": [ - { - "name": "interval", - "description": "The interval string to use for last bucket. The format is '{value}{unit}'. For example '5m' would return the metrics for the last 5 minutes of the timespan.", - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { "kind": "SCALAR", "name": "String", "ofType": null } - }, - "defaultValue": null - }, - { - "name": "to", - "description": "The end of the timerange", - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { "kind": "SCALAR", "name": "String", "ofType": null } - }, - "defaultValue": null - }, - { - "name": "from", - "description": "The beginning of the timerange", - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { "kind": "SCALAR", "name": "String", "ofType": null } - }, - "defaultValue": null - } - ], - "interfaces": null, - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "INPUT_OBJECT", - "name": "docValueFieldsInput", - "description": "", - "fields": null, - "inputFields": [ - { - "name": "field", - "description": "", - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { "kind": "SCALAR", "name": "String", "ofType": null } - }, - "defaultValue": null - }, - { - "name": "format", - "description": "", - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { "kind": "SCALAR", "name": "String", "ofType": null } - }, - "defaultValue": null - } - ], - "interfaces": null, - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "INPUT_OBJECT", - "name": "PaginationInput", - "description": "", - "fields": null, - "inputFields": [ - { - "name": "limit", - "description": "The limit parameter allows you to configure the maximum amount of items to be returned", - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { "kind": "SCALAR", "name": "Float", "ofType": null } - }, - "defaultValue": null - }, - { - "name": "cursor", - "description": "The cursor parameter defines the next result you want to fetch", - "type": { "kind": "SCALAR", "name": "String", "ofType": null }, - "defaultValue": null - }, - { - "name": "tiebreaker", - "description": "The tiebreaker parameter allow to be more precise to fetch the next item", - "type": { "kind": "SCALAR", "name": "String", "ofType": null }, - "defaultValue": null - } - ], - "interfaces": null, - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "INPUT_OBJECT", - "name": "PaginationInputPaginated", - "description": "", - "fields": null, - "inputFields": [ - { - "name": "activePage", - "description": "The activePage parameter defines the page of results you want to fetch", - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { "kind": "SCALAR", "name": "Float", "ofType": null } - }, - "defaultValue": null - }, - { - "name": "cursorStart", - "description": "The cursorStart parameter defines the start of the results to be displayed", - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { "kind": "SCALAR", "name": "Float", "ofType": null } - }, - "defaultValue": null - }, - { - "name": "fakePossibleCount", - "description": "The fakePossibleCount parameter determines the total count in order to show 5 additional pages", - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { "kind": "SCALAR", "name": "Float", "ofType": null } - }, - "defaultValue": null - }, - { - "name": "querySize", - "description": "The querySize parameter is the number of items to be returned", - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { "kind": "SCALAR", "name": "Float", "ofType": null } - }, - "defaultValue": null - } - ], - "interfaces": null, - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "ENUM", - "name": "FlowTarget", - "description": "", - "fields": null, - "inputFields": null, - "interfaces": null, - "enumValues": [ - { "name": "client", "description": "", "isDeprecated": false, "deprecationReason": null }, - { - "name": "destination", - "description": "", - "isDeprecated": false, - "deprecationReason": null - }, - { "name": "server", "description": "", "isDeprecated": false, "deprecationReason": null }, - { "name": "source", "description": "", "isDeprecated": false, "deprecationReason": null } - ], - "possibleTypes": null - }, - { - "kind": "ENUM", - "name": "FlowTargetSourceDest", - "description": "", - "fields": null, - "inputFields": null, - "interfaces": null, - "enumValues": [ - { - "name": "destination", - "description": "", - "isDeprecated": false, - "deprecationReason": null - }, - { "name": "source", "description": "", "isDeprecated": false, "deprecationReason": null } - ], - "possibleTypes": null - }, - { - "kind": "ENUM", - "name": "FlowDirection", - "description": "", - "fields": null, - "inputFields": null, - "interfaces": null, - "enumValues": [ - { - "name": "uniDirectional", - "description": "", - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "biDirectional", - "description": "", - "isDeprecated": false, - "deprecationReason": null - } - ], - "possibleTypes": null - }, - { - "kind": "INPUT_OBJECT", - "name": "SortField", - "description": "", - "fields": null, - "inputFields": [ - { - "name": "sortFieldId", - "description": "", - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { "kind": "SCALAR", "name": "String", "ofType": null } - }, - "defaultValue": null - }, - { - "name": "direction", - "description": "", - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { "kind": "ENUM", "name": "Direction", "ofType": null } - }, - "defaultValue": null - } - ], - "interfaces": null, - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "OBJECT", - "name": "PageInfo", - "description": "", - "fields": [ - { - "name": "endCursor", - "description": "", - "args": [], - "type": { "kind": "OBJECT", "name": "CursorType", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "hasNextPage", - "description": "", - "args": [], - "type": { "kind": "SCALAR", "name": "Boolean", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - } - ], - "inputFields": null, - "interfaces": [], - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "OBJECT", - "name": "Inspect", - "description": "", - "fields": [ - { - "name": "dsl", - "description": "", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "LIST", - "name": null, - "ofType": { - "kind": "NON_NULL", - "name": null, - "ofType": { "kind": "SCALAR", "name": "String", "ofType": null } - } - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "response", - "description": "", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "LIST", - "name": null, - "ofType": { - "kind": "NON_NULL", - "name": null, - "ofType": { "kind": "SCALAR", "name": "String", "ofType": null } - } - } - }, - "isDeprecated": false, - "deprecationReason": null - } - ], - "inputFields": null, - "interfaces": [], - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "OBJECT", - "name": "PageInfoPaginated", - "description": "", - "fields": [ - { - "name": "activePage", - "description": "", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { "kind": "SCALAR", "name": "Float", "ofType": null } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "fakeTotalCount", - "description": "", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { "kind": "SCALAR", "name": "Float", "ofType": null } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "showMorePagesIndicator", - "description": "", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { "kind": "SCALAR", "name": "Boolean", "ofType": null } - }, - "isDeprecated": false, - "deprecationReason": null - } - ], - "inputFields": null, - "interfaces": [], - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "INPUT_OBJECT", - "name": "FavoriteTimelineInput", - "description": "", - "fields": null, - "inputFields": [ - { - "name": "fullName", - "description": "", - "type": { "kind": "SCALAR", "name": "String", "ofType": null }, - "defaultValue": null - }, - { - "name": "userName", - "description": "", - "type": { "kind": "SCALAR", "name": "String", "ofType": null }, - "defaultValue": null - }, - { - "name": "favoriteDate", - "description": "", - "type": { "kind": "SCALAR", "name": "Float", "ofType": null }, - "defaultValue": null - } - ], - "interfaces": null, - "enumValues": null, - "possibleTypes": null - } - ], - "directives": [ - { - "name": "skip", - "description": "Directs the executor to skip this field or fragment when the `if` argument is true.", - "locations": ["FIELD", "FRAGMENT_SPREAD", "INLINE_FRAGMENT"], - "args": [ - { - "name": "if", - "description": "Skipped when true.", - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { "kind": "SCALAR", "name": "Boolean", "ofType": null } - }, - "defaultValue": null - } - ] - }, - { - "name": "include", - "description": "Directs the executor to include this field or fragment only when the `if` argument is true.", - "locations": ["FIELD", "FRAGMENT_SPREAD", "INLINE_FRAGMENT"], - "args": [ - { - "name": "if", - "description": "Included when true.", - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { "kind": "SCALAR", "name": "Boolean", "ofType": null } - }, - "defaultValue": null - } - ] - }, - { - "name": "deprecated", - "description": "Marks an element of a GraphQL schema as no longer supported.", - "locations": ["FIELD_DEFINITION", "ENUM_VALUE"], - "args": [ - { - "name": "reason", - "description": "Explains why this element was deprecated, usually also including a suggestion for how to access supported similar data. Formatted in [Markdown](https://daringfireball.net/projects/markdown/).", - "type": { "kind": "SCALAR", "name": "String", "ofType": null }, - "defaultValue": "\"No longer supported\"" - } - ] - } - ] - } -} diff --git a/x-pack/plugins/security_solution/public/graphql/types.ts b/x-pack/plugins/security_solution/public/graphql/types.ts deleted file mode 100644 index a41111c3e123a..0000000000000 --- a/x-pack/plugins/security_solution/public/graphql/types.ts +++ /dev/null @@ -1,2435 +0,0 @@ -/* tslint:disable */ -/* eslint-disable */ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. - */ - -export type Maybe = T | null; - -export interface PageInfoNote { - pageIndex: number; - - pageSize: number; -} - -export interface SortNote { - sortField: SortFieldNote; - - sortOrder: Direction; -} - -export interface PageInfoTimeline { - pageIndex: number; - - pageSize: number; -} - -export interface SortTimeline { - sortField: SortFieldTimeline; - - sortOrder: Direction; -} - -export interface NoteInput { - eventId?: Maybe; - - note?: Maybe; - - timelineId?: Maybe; -} - -export interface TimelineInput { - columns?: Maybe; - - dataProviders?: Maybe; - - description?: Maybe; - - eqlOptions?: Maybe; - - eventType?: Maybe; - - excludedRowRendererIds?: Maybe; - - filters?: Maybe; - - kqlMode?: Maybe; - - kqlQuery?: Maybe; - - indexNames?: Maybe; - - title?: Maybe; - - templateTimelineId?: Maybe; - - templateTimelineVersion?: Maybe; - - timelineType?: Maybe; - - dateRange?: Maybe; - - savedQueryId?: Maybe; - - sort?: Maybe; - - status?: Maybe; -} - -export interface ColumnHeaderInput { - aggregatable?: Maybe; - - category?: Maybe; - - columnHeaderType?: Maybe; - - description?: Maybe; - - example?: Maybe; - - indexes?: Maybe; - - id?: Maybe; - - name?: Maybe; - - placeholder?: Maybe; - - searchable?: Maybe; - - type?: Maybe; -} - -export interface DataProviderInput { - id?: Maybe; - - name?: Maybe; - - enabled?: Maybe; - - excluded?: Maybe; - - kqlQuery?: Maybe; - - queryMatch?: Maybe; - - and?: Maybe; - - type?: Maybe; -} - -export interface QueryMatchInput { - field?: Maybe; - - displayField?: Maybe; - - value?: Maybe; - - displayValue?: Maybe; - - operator?: Maybe; -} - -export interface EqlOptionsInput { - eventCategoryField?: Maybe; - - tiebreakerField?: Maybe; - - timestampField?: Maybe; - - query?: Maybe; - - size?: Maybe; -} - -export interface FilterTimelineInput { - exists?: Maybe; - - meta?: Maybe; - - match_all?: Maybe; - - missing?: Maybe; - - query?: Maybe; - - range?: Maybe; - - script?: Maybe; -} - -export interface FilterMetaTimelineInput { - alias?: Maybe; - - controlledBy?: Maybe; - - disabled?: Maybe; - - field?: Maybe; - - formattedValue?: Maybe; - - index?: Maybe; - - key?: Maybe; - - negate?: Maybe; - - params?: Maybe; - - type?: Maybe; - - value?: Maybe; -} - -export interface SerializedFilterQueryInput { - filterQuery?: Maybe; -} - -export interface SerializedKueryQueryInput { - kuery?: Maybe; - - serializedQuery?: Maybe; -} - -export interface KueryFilterQueryInput { - kind?: Maybe; - - expression?: Maybe; -} - -export interface DateRangePickerInput { - start?: Maybe; - - end?: Maybe; -} - -export interface SortTimelineInput { - columnId?: Maybe; - - sortDirection?: Maybe; -} - -export interface TimerangeInput { - /** The interval string to use for last bucket. The format is '{value}{unit}'. For example '5m' would return the metrics for the last 5 minutes of the timespan. */ - interval: string; - /** The end of the timerange */ - to: string; - /** The beginning of the timerange */ - from: string; -} - -export interface DocValueFieldsInput { - field: string; - - format: string; -} - -export interface PaginationInput { - /** The limit parameter allows you to configure the maximum amount of items to be returned */ - limit: number; - /** The cursor parameter defines the next result you want to fetch */ - cursor?: Maybe; - /** The tiebreaker parameter allow to be more precise to fetch the next item */ - tiebreaker?: Maybe; -} - -export interface PaginationInputPaginated { - /** The activePage parameter defines the page of results you want to fetch */ - activePage: number; - /** The cursorStart parameter defines the start of the results to be displayed */ - cursorStart: number; - /** The fakePossibleCount parameter determines the total count in order to show 5 additional pages */ - fakePossibleCount: number; - /** The querySize parameter is the number of items to be returned */ - querySize: number; -} - -export interface SortField { - sortFieldId: string; - - direction: Direction; -} - -export interface FavoriteTimelineInput { - fullName?: Maybe; - - userName?: Maybe; - - favoriteDate?: Maybe; -} - -export enum SortFieldNote { - updatedBy = 'updatedBy', - updated = 'updated', -} - -export enum Direction { - asc = 'asc', - desc = 'desc', -} - -export enum TimelineType { - default = 'default', - template = 'template', -} - -export enum DataProviderType { - default = 'default', - template = 'template', -} - -export enum RowRendererId { - alerts = 'alerts', - auditd = 'auditd', - auditd_file = 'auditd_file', - library = 'library', - netflow = 'netflow', - plain = 'plain', - registry = 'registry', - suricata = 'suricata', - system = 'system', - system_dns = 'system_dns', - system_endgame_process = 'system_endgame_process', - system_file = 'system_file', - system_fim = 'system_fim', - system_security_event = 'system_security_event', - system_socket = 'system_socket', - threat_match = 'threat_match', - zeek = 'zeek', -} - -export enum TimelineStatus { - active = 'active', - draft = 'draft', - immutable = 'immutable', -} - -export enum SortFieldTimeline { - title = 'title', - description = 'description', - updated = 'updated', - created = 'created', -} - -export enum FlowTarget { - client = 'client', - destination = 'destination', - server = 'server', - source = 'source', -} - -export enum FlowTargetSourceDest { - destination = 'destination', - source = 'source', -} - -export enum FlowDirection { - uniDirectional = 'uniDirectional', - biDirectional = 'biDirectional', -} - -export type ToAny = any; - -export type ToStringArray = string[]; - -export type ToStringArrayNoNullable = any; - -export type ToDateArray = string[]; - -export type ToNumberArray = number[]; - -export type ToBooleanArray = boolean[]; - -export type Date = string; - -export type ToIFieldSubTypeNonNullable = any; - -// ==================================================== -// Scalars -// ==================================================== - -// ==================================================== -// Types -// ==================================================== - -export interface Query { - getNote: NoteResult; - - getNotesByTimelineId: NoteResult[]; - - getNotesByEventId: NoteResult[]; - - getAllNotes: ResponseNotes; - - getAllPinnedEventsByTimelineId: PinnedEvent[]; - /** Get a security data source by id */ - source: Source; - /** Get a list of all security data sources */ - allSources: Source[]; - - getOneTimeline: TimelineResult; - - getAllTimeline: ResponseTimelines; -} - -export interface NoteResult { - eventId?: Maybe; - - note?: Maybe; - - timelineId?: Maybe; - - noteId: string; - - created?: Maybe; - - createdBy?: Maybe; - - timelineVersion?: Maybe; - - updated?: Maybe; - - updatedBy?: Maybe; - - version?: Maybe; -} - -export interface ResponseNotes { - notes: NoteResult[]; - - totalCount?: Maybe; -} - -export interface PinnedEvent { - code?: Maybe; - - message?: Maybe; - - pinnedEventId: string; - - eventId?: Maybe; - - timelineId?: Maybe; - - timelineVersion?: Maybe; - - created?: Maybe; - - createdBy?: Maybe; - - updated?: Maybe; - - updatedBy?: Maybe; - - version?: Maybe; -} - -export interface Source { - /** The id of the source */ - id: string; - /** The raw configuration of the source */ - configuration: SourceConfiguration; - /** The status of the source */ - status: SourceStatus; -} - -/** A set of configuration options for a security data source */ -export interface SourceConfiguration { - /** The field mapping to use for this source */ - fields: SourceFields; -} - -/** A mapping of semantic fields to their document counterparts */ -export interface SourceFields { - /** The field to identify a container by */ - container: string; - /** The fields to identify a host by */ - host: string; - /** The fields that may contain the log event message. The first field found win. */ - message: string[]; - /** The field to identify a pod by */ - pod: string; - /** The field to use as a tiebreaker for log events that have identical timestamps */ - tiebreaker: string; - /** The field to use as a timestamp for metrics and logs */ - timestamp: string; -} - -/** The status of an infrastructure data source */ -export interface SourceStatus { - /** Whether the configured alias or wildcard pattern resolve to any auditbeat indices */ - indicesExist: boolean; - /** The list of fields defined in the index mappings */ - indexFields: string[]; -} - -export interface TimelineResult { - columns?: Maybe; - - created?: Maybe; - - createdBy?: Maybe; - - dataProviders?: Maybe; - - dateRange?: Maybe; - - description?: Maybe; - - eqlOptions?: Maybe; - - eventIdToNoteIds?: Maybe; - - eventType?: Maybe; - - excludedRowRendererIds?: Maybe; - - favorite?: Maybe; - - filters?: Maybe; - - kqlMode?: Maybe; - - kqlQuery?: Maybe; - - indexNames?: Maybe; - - notes?: Maybe; - - noteIds?: Maybe; - - pinnedEventIds?: Maybe; - - pinnedEventsSaveObject?: Maybe; - - savedQueryId?: Maybe; - - savedObjectId: string; - - sort?: Maybe; - - status?: Maybe; - - title?: Maybe; - - templateTimelineId?: Maybe; - - templateTimelineVersion?: Maybe; - - timelineType?: Maybe; - - updated?: Maybe; - - updatedBy?: Maybe; - - version: string; -} - -export interface ColumnHeaderResult { - aggregatable?: Maybe; - - category?: Maybe; - - columnHeaderType?: Maybe; - - description?: Maybe; - - example?: Maybe; - - indexes?: Maybe; - - id?: Maybe; - - name?: Maybe; - - placeholder?: Maybe; - - searchable?: Maybe; - - type?: Maybe; -} - -export interface DataProviderResult { - id?: Maybe; - - name?: Maybe; - - enabled?: Maybe; - - excluded?: Maybe; - - kqlQuery?: Maybe; - - queryMatch?: Maybe; - - type?: Maybe; - - and?: Maybe; -} - -export interface QueryMatchResult { - field?: Maybe; - - displayField?: Maybe; - - value?: Maybe; - - displayValue?: Maybe; - - operator?: Maybe; -} - -export interface DateRangePickerResult { - start?: Maybe; - - end?: Maybe; -} - -export interface EqlOptionsResult { - eventCategoryField?: Maybe; - - tiebreakerField?: Maybe; - - timestampField?: Maybe; - - query?: Maybe; - - size?: Maybe; -} - -export interface FavoriteTimelineResult { - fullName?: Maybe; - - userName?: Maybe; - - favoriteDate?: Maybe; -} - -export interface FilterTimelineResult { - exists?: Maybe; - - meta?: Maybe; - - match_all?: Maybe; - - missing?: Maybe; - - query?: Maybe; - - range?: Maybe; - - script?: Maybe; -} - -export interface FilterMetaTimelineResult { - alias?: Maybe; - - controlledBy?: Maybe; - - disabled?: Maybe; - - field?: Maybe; - - formattedValue?: Maybe; - - index?: Maybe; - - key?: Maybe; - - negate?: Maybe; - - params?: Maybe; - - type?: Maybe; - - value?: Maybe; -} - -export interface SerializedFilterQueryResult { - filterQuery?: Maybe; -} - -export interface SerializedKueryQueryResult { - kuery?: Maybe; - - serializedQuery?: Maybe; -} - -export interface KueryFilterQueryResult { - kind?: Maybe; - - expression?: Maybe; -} - -export interface ResponseTimelines { - timeline: (Maybe)[]; - - totalCount?: Maybe; - - defaultTimelineCount?: Maybe; - - templateTimelineCount?: Maybe; - - elasticTemplateTimelineCount?: Maybe; - - customTemplateTimelineCount?: Maybe; - - favoriteCount?: Maybe; -} - -export interface Mutation { - /** Persists a note */ - persistNote: ResponseNote; - - deleteNote?: Maybe; - - deleteNoteByTimelineId?: Maybe; - /** Persists a pinned event in a timeline */ - persistPinnedEventOnTimeline?: Maybe; - /** Remove a pinned events in a timeline */ - deletePinnedEventOnTimeline: boolean; - /** Remove all pinned events in a timeline */ - deleteAllPinnedEventsOnTimeline: boolean; - /** Persists a timeline */ - persistTimeline: ResponseTimeline; - - persistFavorite: ResponseFavoriteTimeline; - - deleteTimeline: boolean; -} - -export interface ResponseNote { - code?: Maybe; - - message?: Maybe; - - note: NoteResult; -} - -export interface ResponseTimeline { - code?: Maybe; - - message?: Maybe; - - timeline: TimelineResult; -} - -export interface ResponseFavoriteTimeline { - code?: Maybe; - - message?: Maybe; - - savedObjectId: string; - - templateTimelineId?: Maybe; - - templateTimelineVersion?: Maybe; - - timelineType?: Maybe; - - version: string; - - favorite?: Maybe; -} - -export interface EventEcsFields { - action?: Maybe; - - category?: Maybe; - - code?: Maybe; - - created?: Maybe; - - dataset?: Maybe; - - duration?: Maybe; - - end?: Maybe; - - hash?: Maybe; - - id?: Maybe; - - kind?: Maybe; - - module?: Maybe; - - original?: Maybe; - - outcome?: Maybe; - - risk_score?: Maybe; - - risk_score_norm?: Maybe; - - severity?: Maybe; - - start?: Maybe; - - timezone?: Maybe; - - type?: Maybe; -} - -export interface Location { - lon?: Maybe; - - lat?: Maybe; -} - -export interface GeoEcsFields { - city_name?: Maybe; - - continent_name?: Maybe; - - country_iso_code?: Maybe; - - country_name?: Maybe; - - location?: Maybe; - - region_iso_code?: Maybe; - - region_name?: Maybe; -} - -export interface PrimarySecondary { - primary?: Maybe; - - secondary?: Maybe; - - type?: Maybe; -} - -export interface Summary { - actor?: Maybe; - - object?: Maybe; - - how?: Maybe; - - message_type?: Maybe; - - sequence?: Maybe; -} - -export interface AgentEcsField { - type?: Maybe; -} - -export interface AuditdData { - acct?: Maybe; - - terminal?: Maybe; - - op?: Maybe; -} - -export interface AuditdEcsFields { - result?: Maybe; - - session?: Maybe; - - data?: Maybe; - - summary?: Maybe; - - sequence?: Maybe; -} - -export interface OsEcsFields { - platform?: Maybe; - - name?: Maybe; - - full?: Maybe; - - family?: Maybe; - - version?: Maybe; - - kernel?: Maybe; -} - -export interface HostEcsFields { - architecture?: Maybe; - - id?: Maybe; - - ip?: Maybe; - - mac?: Maybe; - - name?: Maybe; - - os?: Maybe; - - type?: Maybe; -} - -export interface Thread { - id?: Maybe; - - start?: Maybe; -} - -export interface ProcessHashData { - md5?: Maybe; - - sha1?: Maybe; - - sha256?: Maybe; -} - -export interface ProcessEcsFields { - hash?: Maybe; - - pid?: Maybe; - - name?: Maybe; - - ppid?: Maybe; - - args?: Maybe; - - entity_id?: Maybe; - - executable?: Maybe; - - title?: Maybe; - - thread?: Maybe; - - working_directory?: Maybe; -} - -export interface SourceEcsFields { - bytes?: Maybe; - - ip?: Maybe; - - port?: Maybe; - - domain?: Maybe; - - geo?: Maybe; - - packets?: Maybe; -} - -export interface DestinationEcsFields { - bytes?: Maybe; - - ip?: Maybe; - - port?: Maybe; - - domain?: Maybe; - - geo?: Maybe; - - packets?: Maybe; -} - -export interface DnsQuestionData { - name?: Maybe; - - type?: Maybe; -} - -export interface DnsEcsFields { - question?: Maybe; - - resolved_ip?: Maybe; - - response_code?: Maybe; -} - -export interface EndgameEcsFields { - exit_code?: Maybe; - - file_name?: Maybe; - - file_path?: Maybe; - - logon_type?: Maybe; - - parent_process_name?: Maybe; - - pid?: Maybe; - - process_name?: Maybe; - - subject_domain_name?: Maybe; - - subject_logon_id?: Maybe; - - subject_user_name?: Maybe; - - target_domain_name?: Maybe; - - target_logon_id?: Maybe; - - target_user_name?: Maybe; -} - -export interface SuricataAlertData { - signature?: Maybe; - - signature_id?: Maybe; -} - -export interface SuricataEveData { - alert?: Maybe; - - flow_id?: Maybe; - - proto?: Maybe; -} - -export interface SuricataEcsFields { - eve?: Maybe; -} - -export interface TlsJa3Data { - hash?: Maybe; -} - -export interface FingerprintData { - sha1?: Maybe; -} - -export interface TlsClientCertificateData { - fingerprint?: Maybe; -} - -export interface TlsServerCertificateData { - fingerprint?: Maybe; -} - -export interface TlsFingerprintsData { - ja3?: Maybe; -} - -export interface TlsEcsFields { - client_certificate?: Maybe; - - fingerprints?: Maybe; - - server_certificate?: Maybe; -} - -export interface ZeekConnectionData { - local_resp?: Maybe; - - local_orig?: Maybe; - - missed_bytes?: Maybe; - - state?: Maybe; - - history?: Maybe; -} - -export interface ZeekNoticeData { - suppress_for?: Maybe; - - msg?: Maybe; - - note?: Maybe; - - sub?: Maybe; - - dst?: Maybe; - - dropped?: Maybe; - - peer_descr?: Maybe; -} - -export interface ZeekDnsData { - AA?: Maybe; - - qclass_name?: Maybe; - - RD?: Maybe; - - qtype_name?: Maybe; - - rejected?: Maybe; - - qtype?: Maybe; - - query?: Maybe; - - trans_id?: Maybe; - - qclass?: Maybe; - - RA?: Maybe; - - TC?: Maybe; -} - -export interface FileFields { - name?: Maybe; - - path?: Maybe; - - target_path?: Maybe; - - extension?: Maybe; - - type?: Maybe; - - device?: Maybe; - - inode?: Maybe; - - uid?: Maybe; - - owner?: Maybe; - - gid?: Maybe; - - group?: Maybe; - - mode?: Maybe; - - size?: Maybe; - - mtime?: Maybe; - - ctime?: Maybe; -} - -export interface ZeekHttpData { - resp_mime_types?: Maybe; - - trans_depth?: Maybe; - - status_msg?: Maybe; - - resp_fuids?: Maybe; - - tags?: Maybe; -} - -export interface HttpBodyData { - content?: Maybe; - - bytes?: Maybe; -} - -export interface HttpRequestData { - method?: Maybe; - - body?: Maybe; - - referrer?: Maybe; - - bytes?: Maybe; -} - -export interface HttpResponseData { - status_code?: Maybe; - - body?: Maybe; - - bytes?: Maybe; -} - -export interface HttpEcsFields { - version?: Maybe; - - request?: Maybe; - - response?: Maybe; -} - -export interface UrlEcsFields { - domain?: Maybe; - - original?: Maybe; - - username?: Maybe; - - password?: Maybe; -} - -export interface ZeekFileData { - session_ids?: Maybe; - - timedout?: Maybe; - - local_orig?: Maybe; - - tx_host?: Maybe; - - source?: Maybe; - - is_orig?: Maybe; - - overflow_bytes?: Maybe; - - sha1?: Maybe; - - duration?: Maybe; - - depth?: Maybe; - - analyzers?: Maybe; - - mime_type?: Maybe; - - rx_host?: Maybe; - - total_bytes?: Maybe; - - fuid?: Maybe; - - seen_bytes?: Maybe; - - missing_bytes?: Maybe; - - md5?: Maybe; -} - -export interface ZeekSslData { - cipher?: Maybe; - - established?: Maybe; - - resumed?: Maybe; - - version?: Maybe; -} - -export interface ZeekEcsFields { - session_id?: Maybe; - - connection?: Maybe; - - notice?: Maybe; - - dns?: Maybe; - - http?: Maybe; - - files?: Maybe; - - ssl?: Maybe; -} - -export interface UserEcsFields { - domain?: Maybe; - - id?: Maybe; - - name?: Maybe; - - full_name?: Maybe; - - email?: Maybe; - - hash?: Maybe; - - group?: Maybe; -} - -export interface WinlogEcsFields { - event_id?: Maybe; -} - -export interface NetworkEcsField { - bytes?: Maybe; - - community_id?: Maybe; - - direction?: Maybe; - - packets?: Maybe; - - protocol?: Maybe; - - transport?: Maybe; -} - -export interface PackageEcsFields { - arch?: Maybe; - - entity_id?: Maybe; - - name?: Maybe; - - size?: Maybe; - - summary?: Maybe; - - version?: Maybe; -} - -export interface AuditEcsFields { - package?: Maybe; -} - -export interface SshEcsFields { - method?: Maybe; - - signature?: Maybe; -} - -export interface AuthEcsFields { - ssh?: Maybe; -} - -export interface SystemEcsField { - audit?: Maybe; - - auth?: Maybe; -} - -export interface RuleField { - id?: Maybe; - - rule_id?: Maybe; - - false_positives: string[]; - - saved_id?: Maybe; - - timeline_id?: Maybe; - - timeline_title?: Maybe; - - max_signals?: Maybe; - - risk_score?: Maybe; - - output_index?: Maybe; - - description?: Maybe; - - from?: Maybe; - - immutable?: Maybe; - - index?: Maybe; - - interval?: Maybe; - - language?: Maybe; - - query?: Maybe; - - references?: Maybe; - - severity?: Maybe; - - tags?: Maybe; - - threat?: Maybe; - - type?: Maybe; - - size?: Maybe; - - to?: Maybe; - - enabled?: Maybe; - - filters?: Maybe; - - created_at?: Maybe; - - updated_at?: Maybe; - - created_by?: Maybe; - - updated_by?: Maybe; - - version?: Maybe; - - note?: Maybe; - - threshold?: Maybe; - - exceptions_list?: Maybe; -} - -export interface SignalField { - rule?: Maybe; - - original_time?: Maybe; - - status?: Maybe; -} - -export interface RuleEcsField { - reference?: Maybe; -} - -export interface Ecs { - _id: string; - - _index?: Maybe; - - agent?: Maybe; - - auditd?: Maybe; - - destination?: Maybe; - - dns?: Maybe; - - endgame?: Maybe; - - event?: Maybe; - - geo?: Maybe; - - host?: Maybe; - - network?: Maybe; - - rule?: Maybe; - - signal?: Maybe; - - source?: Maybe; - - suricata?: Maybe; - - tls?: Maybe; - - zeek?: Maybe; - - http?: Maybe; - - url?: Maybe; - - timestamp?: Maybe; - - message?: Maybe; - - user?: Maybe; - - winlog?: Maybe; - - process?: Maybe; - - file?: Maybe; - - system?: Maybe; -} - -export interface EcsEdges { - node: Ecs; - - cursor: CursorType; -} - -export interface CursorType { - value?: Maybe; - - tiebreaker?: Maybe; -} - -/** A descriptor of a field in an index */ -export interface IndexField { - /** Where the field belong */ - category: string; - /** Example of field's value */ - example?: Maybe; - /** whether the field's belong to an alias index */ - indexes: (Maybe)[]; - /** The name of the field */ - name: string; - /** The type of the field's values as recognized by Kibana */ - type: string; - /** Whether the field's values can be efficiently searched for */ - searchable: boolean; - /** Whether the field's values can be aggregated */ - aggregatable: boolean; - /** Description of the field */ - description?: Maybe; - - format?: Maybe; - /** the elastic type as mapped in the index */ - esTypes?: Maybe; - - subType?: Maybe; -} - -export interface PageInfo { - endCursor?: Maybe; - - hasNextPage?: Maybe; -} - -export interface Inspect { - dsl: string[]; - - response: string[]; -} - -export interface PageInfoPaginated { - activePage: number; - - fakeTotalCount: number; - - showMorePagesIndicator: boolean; -} - -// ==================================================== -// Arguments -// ==================================================== - -export interface GetNoteQueryArgs { - id: string; -} -export interface GetNotesByTimelineIdQueryArgs { - timelineId: string; -} -export interface GetNotesByEventIdQueryArgs { - eventId: string; -} -export interface GetAllNotesQueryArgs { - pageInfo?: Maybe; - - search?: Maybe; - - sort?: Maybe; -} -export interface GetAllPinnedEventsByTimelineIdQueryArgs { - timelineId: string; -} -export interface SourceQueryArgs { - /** The id of the source */ - id: string; -} -export interface GetOneTimelineQueryArgs { - id: string; - - timelineType?: Maybe; -} -export interface GetAllTimelineQueryArgs { - pageInfo: PageInfoTimeline; - - search?: Maybe; - - sort?: Maybe; - - onlyUserFavorite?: Maybe; - - timelineType?: Maybe; - - status?: Maybe; -} -export interface IndicesExistSourceStatusArgs { - defaultIndex: string[]; -} -export interface IndexFieldsSourceStatusArgs { - defaultIndex: string[]; -} -export interface PersistNoteMutationArgs { - noteId?: Maybe; - - version?: Maybe; - - note: NoteInput; -} -export interface DeleteNoteMutationArgs { - id: string[]; -} -export interface DeleteNoteByTimelineIdMutationArgs { - timelineId: string; - - version?: Maybe; -} -export interface PersistPinnedEventOnTimelineMutationArgs { - pinnedEventId?: Maybe; - - eventId: string; - - timelineId?: Maybe; -} -export interface DeletePinnedEventOnTimelineMutationArgs { - id: string[]; -} -export interface DeleteAllPinnedEventsOnTimelineMutationArgs { - timelineId: string; -} -export interface PersistTimelineMutationArgs { - id?: Maybe; - - version?: Maybe; - - timeline: TimelineInput; -} -export interface PersistFavoriteMutationArgs { - timelineId?: Maybe; - - templateTimelineId?: Maybe; - - templateTimelineVersion?: Maybe; - - timelineType?: Maybe; -} -export interface DeleteTimelineMutationArgs { - id: string[]; -} - -// ==================================================== -// Documents -// ==================================================== - -export namespace GetAllTimeline { - export type Variables = { - pageInfo: PageInfoTimeline; - search?: Maybe; - sort?: Maybe; - onlyUserFavorite?: Maybe; - timelineType?: Maybe; - status?: Maybe; - }; - - export type Query = { - __typename?: 'Query'; - - getAllTimeline: GetAllTimeline; - }; - - export type GetAllTimeline = { - __typename?: 'ResponseTimelines'; - - totalCount: Maybe; - - defaultTimelineCount: Maybe; - - templateTimelineCount: Maybe; - - elasticTemplateTimelineCount: Maybe; - - customTemplateTimelineCount: Maybe; - - favoriteCount: Maybe; - - timeline: (Maybe)[]; - }; - - export type Timeline = { - __typename?: 'TimelineResult'; - - savedObjectId: string; - - description: Maybe; - - favorite: Maybe; - - eventIdToNoteIds: Maybe; - - excludedRowRendererIds: Maybe; - - notes: Maybe; - - noteIds: Maybe; - - pinnedEventIds: Maybe; - - status: Maybe; - - title: Maybe; - - timelineType: Maybe; - - templateTimelineId: Maybe; - - templateTimelineVersion: Maybe; - - created: Maybe; - - createdBy: Maybe; - - updated: Maybe; - - updatedBy: Maybe; - - version: string; - }; - - export type Favorite = { - __typename?: 'FavoriteTimelineResult'; - - fullName: Maybe; - - userName: Maybe; - - favoriteDate: Maybe; - }; - - export type EventIdToNoteIds = { - __typename?: 'NoteResult'; - - eventId: Maybe; - - note: Maybe; - - timelineId: Maybe; - - noteId: string; - - created: Maybe; - - createdBy: Maybe; - - timelineVersion: Maybe; - - updated: Maybe; - - updatedBy: Maybe; - - version: Maybe; - }; - - export type Notes = { - __typename?: 'NoteResult'; - - eventId: Maybe; - - note: Maybe; - - timelineId: Maybe; - - timelineVersion: Maybe; - - noteId: string; - - created: Maybe; - - createdBy: Maybe; - - updated: Maybe; - - updatedBy: Maybe; - - version: Maybe; - }; -} - -export namespace DeleteTimelineMutation { - export type Variables = { - id: string[]; - }; - - export type Mutation = { - __typename?: 'Mutation'; - - deleteTimeline: boolean; - }; -} - -export namespace PersistTimelineFavoriteMutation { - export type Variables = { - timelineId?: Maybe; - templateTimelineId?: Maybe; - templateTimelineVersion?: Maybe; - timelineType: TimelineType; - }; - - export type Mutation = { - __typename?: 'Mutation'; - - persistFavorite: PersistFavorite; - }; - - export type PersistFavorite = { - __typename?: 'ResponseFavoriteTimeline'; - - savedObjectId: string; - - version: string; - - favorite: Maybe; - - templateTimelineId: Maybe; - - templateTimelineVersion: Maybe; - - timelineType: Maybe; - }; - - export type Favorite = { - __typename?: 'FavoriteTimelineResult'; - - fullName: Maybe; - - userName: Maybe; - - favoriteDate: Maybe; - }; -} - -export namespace PersistTimelineNoteMutation { - export type Variables = { - noteId?: Maybe; - version?: Maybe; - note: NoteInput; - }; - - export type Mutation = { - __typename?: 'Mutation'; - - persistNote: PersistNote; - }; - - export type PersistNote = { - __typename?: 'ResponseNote'; - - code: Maybe; - - message: Maybe; - - note: Note; - }; - - export type Note = { - __typename?: 'NoteResult'; - - eventId: Maybe; - - note: Maybe; - - timelineId: Maybe; - - timelineVersion: Maybe; - - noteId: string; - - created: Maybe; - - createdBy: Maybe; - - updated: Maybe; - - updatedBy: Maybe; - - version: Maybe; - }; -} - -export namespace GetOneTimeline { - export type Variables = { - id: string; - timelineType?: Maybe; - }; - - export type Query = { - __typename?: 'Query'; - - getOneTimeline: GetOneTimeline; - }; - - export type GetOneTimeline = { - __typename?: 'TimelineResult'; - - savedObjectId: string; - - columns: Maybe; - - dataProviders: Maybe; - - dateRange: Maybe; - - description: Maybe; - - eqlOptions: Maybe; - - eventType: Maybe; - - eventIdToNoteIds: Maybe; - - excludedRowRendererIds: Maybe; - - favorite: Maybe; - - filters: Maybe; - - kqlMode: Maybe; - - kqlQuery: Maybe; - - indexNames: Maybe; - - notes: Maybe; - - noteIds: Maybe; - - pinnedEventIds: Maybe; - - pinnedEventsSaveObject: Maybe; - - status: Maybe; - - title: Maybe; - - timelineType: Maybe; - - templateTimelineId: Maybe; - - templateTimelineVersion: Maybe; - - savedQueryId: Maybe; - - sort: Maybe; - - created: Maybe; - - createdBy: Maybe; - - updated: Maybe; - - updatedBy: Maybe; - - version: string; - }; - - export type Columns = { - __typename?: 'ColumnHeaderResult'; - - aggregatable: Maybe; - - category: Maybe; - - columnHeaderType: Maybe; - - description: Maybe; - - example: Maybe; - - indexes: Maybe; - - id: Maybe; - - name: Maybe; - - searchable: Maybe; - - type: Maybe; - }; - - export type DataProviders = { - __typename?: 'DataProviderResult'; - - id: Maybe; - - name: Maybe; - - enabled: Maybe; - - excluded: Maybe; - - kqlQuery: Maybe; - - type: Maybe; - - queryMatch: Maybe; - - and: Maybe; - }; - - export type QueryMatch = { - __typename?: 'QueryMatchResult'; - - field: Maybe; - - displayField: Maybe; - - value: Maybe; - - displayValue: Maybe; - - operator: Maybe; - }; - - export type And = { - __typename?: 'DataProviderResult'; - - id: Maybe; - - name: Maybe; - - enabled: Maybe; - - excluded: Maybe; - - kqlQuery: Maybe; - - type: Maybe; - - queryMatch: Maybe<_QueryMatch>; - }; - - export type _QueryMatch = { - __typename?: 'QueryMatchResult'; - - field: Maybe; - - displayField: Maybe; - - value: Maybe; - - displayValue: Maybe; - - operator: Maybe; - }; - - export type DateRange = { - __typename?: 'DateRangePickerResult'; - - start: Maybe; - - end: Maybe; - }; - - export type EqlOptions = { - __typename?: 'EqlOptionsResult'; - - eventCategoryField: Maybe; - - tiebreakerField: Maybe; - - timestampField: Maybe; - - query: Maybe; - - size: Maybe; - }; - - export type EventIdToNoteIds = { - __typename?: 'NoteResult'; - - eventId: Maybe; - - note: Maybe; - - timelineId: Maybe; - - noteId: string; - - created: Maybe; - - createdBy: Maybe; - - timelineVersion: Maybe; - - updated: Maybe; - - updatedBy: Maybe; - - version: Maybe; - }; - - export type Favorite = { - __typename?: 'FavoriteTimelineResult'; - - fullName: Maybe; - - userName: Maybe; - - favoriteDate: Maybe; - }; - - export type Filters = { - __typename?: 'FilterTimelineResult'; - - meta: Maybe; - - query: Maybe; - - exists: Maybe; - - match_all: Maybe; - - missing: Maybe; - - range: Maybe; - - script: Maybe; - }; - - export type Meta = { - __typename?: 'FilterMetaTimelineResult'; - - alias: Maybe; - - controlledBy: Maybe; - - disabled: Maybe; - - field: Maybe; - - formattedValue: Maybe; - - index: Maybe; - - key: Maybe; - - negate: Maybe; - - params: Maybe; - - type: Maybe; - - value: Maybe; - }; - - export type KqlQuery = { - __typename?: 'SerializedFilterQueryResult'; - - filterQuery: Maybe; - }; - - export type FilterQuery = { - __typename?: 'SerializedKueryQueryResult'; - - kuery: Maybe; - - serializedQuery: Maybe; - }; - - export type Kuery = { - __typename?: 'KueryFilterQueryResult'; - - kind: Maybe; - - expression: Maybe; - }; - - export type Notes = { - __typename?: 'NoteResult'; - - eventId: Maybe; - - note: Maybe; - - timelineId: Maybe; - - timelineVersion: Maybe; - - noteId: string; - - created: Maybe; - - createdBy: Maybe; - - updated: Maybe; - - updatedBy: Maybe; - - version: Maybe; - }; - - export type PinnedEventsSaveObject = { - __typename?: 'PinnedEvent'; - - pinnedEventId: string; - - eventId: Maybe; - - timelineId: Maybe; - - created: Maybe; - - createdBy: Maybe; - - updated: Maybe; - - updatedBy: Maybe; - - version: Maybe; - }; -} - -export namespace PersistTimelineMutation { - export type Variables = { - timelineId?: Maybe; - version?: Maybe; - timeline: TimelineInput; - }; - - export type Mutation = { - __typename?: 'Mutation'; - - persistTimeline: PersistTimeline; - }; - - export type PersistTimeline = { - __typename?: 'ResponseTimeline'; - - code: Maybe; - - message: Maybe; - - timeline: Timeline; - }; - - export type Timeline = { - __typename?: 'TimelineResult'; - - savedObjectId: string; - - version: string; - - columns: Maybe; - - dataProviders: Maybe; - - description: Maybe; - - eventType: Maybe; - - excludedRowRendererIds: Maybe; - - favorite: Maybe; - - filters: Maybe; - - kqlMode: Maybe; - - kqlQuery: Maybe; - - indexNames: Maybe; - - title: Maybe; - - dateRange: Maybe; - - savedQueryId: Maybe; - - sort: Maybe; - - created: Maybe; - - createdBy: Maybe; - - updated: Maybe; - - updatedBy: Maybe; - }; - - export type Columns = { - __typename?: 'ColumnHeaderResult'; - - aggregatable: Maybe; - - category: Maybe; - - columnHeaderType: Maybe; - - description: Maybe; - - example: Maybe; - - indexes: Maybe; - - id: Maybe; - - name: Maybe; - - searchable: Maybe; - - type: Maybe; - }; - - export type DataProviders = { - __typename?: 'DataProviderResult'; - - id: Maybe; - - name: Maybe; - - enabled: Maybe; - - excluded: Maybe; - - kqlQuery: Maybe; - - type: Maybe; - - queryMatch: Maybe; - - and: Maybe; - }; - - export type QueryMatch = { - __typename?: 'QueryMatchResult'; - - field: Maybe; - - displayField: Maybe; - - value: Maybe; - - displayValue: Maybe; - - operator: Maybe; - }; - - export type And = { - __typename?: 'DataProviderResult'; - - id: Maybe; - - name: Maybe; - - enabled: Maybe; - - excluded: Maybe; - - kqlQuery: Maybe; - - type: Maybe; - - queryMatch: Maybe<_QueryMatch>; - }; - - export type _QueryMatch = { - __typename?: 'QueryMatchResult'; - - field: Maybe; - - displayField: Maybe; - - value: Maybe; - - displayValue: Maybe; - - operator: Maybe; - }; - - export type Favorite = { - __typename?: 'FavoriteTimelineResult'; - - fullName: Maybe; - - userName: Maybe; - - favoriteDate: Maybe; - }; - - export type Filters = { - __typename?: 'FilterTimelineResult'; - - meta: Maybe; - - query: Maybe; - - exists: Maybe; - - match_all: Maybe; - - missing: Maybe; - - range: Maybe; - - script: Maybe; - }; - - export type Meta = { - __typename?: 'FilterMetaTimelineResult'; - - alias: Maybe; - - controlledBy: Maybe; - - disabled: Maybe; - - field: Maybe; - - formattedValue: Maybe; - - index: Maybe; - - key: Maybe; - - negate: Maybe; - - params: Maybe; - - type: Maybe; - - value: Maybe; - }; - - export type KqlQuery = { - __typename?: 'SerializedFilterQueryResult'; - - filterQuery: Maybe; - }; - - export type FilterQuery = { - __typename?: 'SerializedKueryQueryResult'; - - kuery: Maybe; - - serializedQuery: Maybe; - }; - - export type Kuery = { - __typename?: 'KueryFilterQueryResult'; - - kind: Maybe; - - expression: Maybe; - }; - - export type DateRange = { - __typename?: 'DateRangePickerResult'; - - start: Maybe; - - end: Maybe; - }; -} - -export namespace PersistTimelinePinnedEventMutation { - export type Variables = { - pinnedEventId?: Maybe; - eventId: string; - timelineId?: Maybe; - }; - - export type Mutation = { - __typename?: 'Mutation'; - - persistPinnedEventOnTimeline: Maybe; - }; - - export type PersistPinnedEventOnTimeline = { - __typename?: 'PinnedEvent'; - - pinnedEventId: string; - - eventId: Maybe; - - timelineId: Maybe; - - timelineVersion: Maybe; - - created: Maybe; - - createdBy: Maybe; - - updated: Maybe; - - updatedBy: Maybe; - - version: Maybe; - }; -} diff --git a/x-pack/plugins/security_solution/public/hosts/components/authentications_table/index.test.tsx b/x-pack/plugins/security_solution/public/hosts/components/authentications_table/index.test.tsx index a63300738ebf0..8013208d02cc3 100644 --- a/x-pack/plugins/security_solution/public/hosts/components/authentications_table/index.test.tsx +++ b/x-pack/plugins/security_solution/public/hosts/components/authentications_table/index.test.tsx @@ -12,7 +12,6 @@ import { Provider as ReduxStoreProvider } from 'react-redux'; import '../../../common/mock/match_media'; import { - apolloClientObservable, mockGlobalState, SUB_PLUGINS_REDUCER, kibanaObservable, @@ -29,22 +28,10 @@ describe('Authentication Table Component', () => { const state: State = mockGlobalState; const { storage } = createSecuritySolutionStorageMock(); - let store = createStore( - state, - SUB_PLUGINS_REDUCER, - apolloClientObservable, - kibanaObservable, - storage - ); + let store = createStore(state, SUB_PLUGINS_REDUCER, kibanaObservable, storage); beforeEach(() => { - store = createStore( - state, - SUB_PLUGINS_REDUCER, - apolloClientObservable, - kibanaObservable, - storage - ); + store = createStore(state, SUB_PLUGINS_REDUCER, kibanaObservable, storage); }); describe('rendering', () => { diff --git a/x-pack/plugins/security_solution/public/hosts/components/hosts_table/index.test.tsx b/x-pack/plugins/security_solution/public/hosts/components/hosts_table/index.test.tsx index 613ef2c3366dc..0808238151e03 100644 --- a/x-pack/plugins/security_solution/public/hosts/components/hosts_table/index.test.tsx +++ b/x-pack/plugins/security_solution/public/hosts/components/hosts_table/index.test.tsx @@ -7,11 +7,9 @@ import { shallow } from 'enzyme'; import React from 'react'; -import { MockedProvider } from 'react-apollo/test-utils'; import '../../../common/mock/match_media'; import { - apolloClientObservable, mockGlobalState, TestProviders, SUB_PLUGINS_REDUCER, @@ -41,23 +39,11 @@ describe('Hosts Table', () => { const state: State = mockGlobalState; const { storage } = createSecuritySolutionStorageMock(); - let store = createStore( - state, - SUB_PLUGINS_REDUCER, - apolloClientObservable, - kibanaObservable, - storage - ); + let store = createStore(state, SUB_PLUGINS_REDUCER, kibanaObservable, storage); const mount = useMountAppended(); beforeEach(() => { - store = createStore( - state, - SUB_PLUGINS_REDUCER, - apolloClientObservable, - kibanaObservable, - storage - ); + store = createStore(state, SUB_PLUGINS_REDUCER, kibanaObservable, storage); }); describe('rendering', () => { @@ -86,21 +72,19 @@ describe('Hosts Table', () => { beforeEach(() => { wrapper = mount( - - - - - + + + ); }); test('Initial value of the store', () => { diff --git a/x-pack/plugins/security_solution/public/hosts/pages/hosts.test.tsx b/x-pack/plugins/security_solution/public/hosts/pages/hosts.test.tsx index ddea55158d9fd..4871cfcb069d2 100644 --- a/x-pack/plugins/security_solution/public/hosts/pages/hosts.test.tsx +++ b/x-pack/plugins/security_solution/public/hosts/pages/hosts.test.tsx @@ -12,7 +12,6 @@ import { Router } from 'react-router-dom'; import { Filter } from '../../../../../../src/plugins/data/common/es_query'; import '../../common/mock/match_media'; import { - apolloClientObservable, TestProviders, mockGlobalState, SUB_PLUGINS_REDUCER, @@ -144,13 +143,7 @@ describe('Hosts - rendering', () => { }); const myState: State = mockGlobalState; const { storage } = createSecuritySolutionStorageMock(); - const myStore = createStore( - myState, - SUB_PLUGINS_REDUCER, - apolloClientObservable, - kibanaObservable, - storage - ); + const myStore = createStore(myState, SUB_PLUGINS_REDUCER, kibanaObservable, storage); const wrapper = mount( diff --git a/x-pack/plugins/security_solution/public/hosts/store/model.ts b/x-pack/plugins/security_solution/public/hosts/store/model.ts index b610971f70305..2060d46206723 100644 --- a/x-pack/plugins/security_solution/public/hosts/store/model.ts +++ b/x-pack/plugins/security_solution/public/hosts/store/model.ts @@ -5,8 +5,8 @@ * 2.0. */ -import { HostsFields } from '../../../common/search_strategy/security_solution/hosts'; -import { Direction } from '../../graphql/types'; +import { Direction } from '../../../common/search_strategy'; +import { HostsFields } from '../../../common/search_strategy/security_solution'; export enum HostsType { page = 'page', diff --git a/x-pack/plugins/security_solution/public/lazy_application_dependencies.tsx b/x-pack/plugins/security_solution/public/lazy_application_dependencies.tsx index 0c9c74f9ebc15..536d1d084f0c5 100644 --- a/x-pack/plugins/security_solution/public/lazy_application_dependencies.tsx +++ b/x-pack/plugins/security_solution/public/lazy_application_dependencies.tsx @@ -11,8 +11,7 @@ */ import { renderApp } from './app'; -import { composeLibs } from './common/lib/compose/kibana_compose'; import { createStore, createInitialState } from './common/store'; -export { renderApp, composeLibs, createStore, createInitialState }; +export { renderApp, createStore, createInitialState }; diff --git a/x-pack/plugins/security_solution/public/management/pages/endpoint_hosts/store/selectors.ts b/x-pack/plugins/security_solution/public/management/pages/endpoint_hosts/store/selectors.ts index eec4de6400145..cd43d72dea8e2 100644 --- a/x-pack/plugins/security_solution/public/management/pages/endpoint_hosts/store/selectors.ts +++ b/x-pack/plugins/security_solution/public/management/pages/endpoint_hosts/store/selectors.ts @@ -98,6 +98,15 @@ const detailsPolicyAppliedResponse = (state: Immutable) => export const policyResponseTimestamp = (state: Immutable) => state.policyResponse && state.policyResponse['@timestamp']; +/** + * Returns the Endpoint Package Policy Revision number, which correlates to the `applied_policy_version` + * property on the endpoint policy response message. + * @param state + */ +export const policyResponseAppliedRevision = (state: Immutable): string => { + return String(state.policyResponse?.Endpoint.policy.applied.endpoint_policy_version || ''); +}; + /** * Returns the response configurations from the endpoint after a user modifies a policy. */ diff --git a/x-pack/plugins/security_solution/public/management/pages/endpoint_hosts/view/details/index.tsx b/x-pack/plugins/security_solution/public/management/pages/endpoint_hosts/view/details/index.tsx index ed68cd17fa446..e136b63579359 100644 --- a/x-pack/plugins/security_solution/public/management/pages/endpoint_hosts/view/details/index.tsx +++ b/x-pack/plugins/security_solution/public/management/pages/endpoint_hosts/view/details/index.tsx @@ -38,6 +38,7 @@ import { policyResponseTimestamp, policyVersionInfo, hostStatusInfo, + policyResponseAppliedRevision, } from '../../store/selectors'; import { EndpointDetails } from './endpoint_details'; import { PolicyResponse } from './policy_response'; @@ -149,6 +150,7 @@ const PolicyResponseFlyoutPanel = memo<{ const error = useEndpointSelector(policyResponseError); const { formatUrl } = useFormatUrl(SecurityPageName.administration); const responseTimestamp = useEndpointSelector(policyResponseTimestamp); + const responsePolicyRevisionNumber = useEndpointSelector(policyResponseAppliedRevision); const [detailsUri, detailsRoutePath] = useMemo( () => [ formatUrl( @@ -197,7 +199,14 @@ const PolicyResponseFlyoutPanel = memo<{ - + , + }} + /> {error && ( diff --git a/x-pack/plugins/security_solution/public/network/components/details/index.test.tsx b/x-pack/plugins/security_solution/public/network/components/details/index.test.tsx index 514460ffb0970..ceb89db7b0f53 100644 --- a/x-pack/plugins/security_solution/public/network/components/details/index.test.tsx +++ b/x-pack/plugins/security_solution/public/network/components/details/index.test.tsx @@ -9,10 +9,8 @@ import { shallow } from 'enzyme'; import React from 'react'; import { ActionCreator } from 'typescript-fsa'; -import { FlowTarget } from '../../../graphql/types'; import '../../../common/mock/match_media'; import { - apolloClientObservable, mockGlobalState, TestProviders, SUB_PLUGINS_REDUCER, @@ -26,27 +24,16 @@ import { IpOverview } from './index'; import { mockData } from './mock'; import { mockAnomalies } from '../../../common/components/ml/mock'; import { NarrowDateRange } from '../../../common/components/ml/types'; +import { FlowTarget } from '../../../../common/search_strategy'; describe('IP Overview Component', () => { const state: State = mockGlobalState; const { storage } = createSecuritySolutionStorageMock(); - let store = createStore( - state, - SUB_PLUGINS_REDUCER, - apolloClientObservable, - kibanaObservable, - storage - ); + let store = createStore(state, SUB_PLUGINS_REDUCER, kibanaObservable, storage); beforeEach(() => { - store = createStore( - state, - SUB_PLUGINS_REDUCER, - apolloClientObservable, - kibanaObservable, - storage - ); + store = createStore(state, SUB_PLUGINS_REDUCER, kibanaObservable, storage); }); describe('rendering', () => { diff --git a/x-pack/plugins/security_solution/public/network/components/embeddables/map_tool_tip/point_tool_tip_content.test.tsx b/x-pack/plugins/security_solution/public/network/components/embeddables/map_tool_tip/point_tool_tip_content.test.tsx index 3bbc08d593fd3..7b3f9e956c765 100644 --- a/x-pack/plugins/security_solution/public/network/components/embeddables/map_tool_tip/point_tool_tip_content.test.tsx +++ b/x-pack/plugins/security_solution/public/network/components/embeddables/map_tool_tip/point_tool_tip_content.test.tsx @@ -13,11 +13,11 @@ import { getRenderedFieldValue, PointToolTipContentComponent } from './point_too import { TestProviders } from '../../../../common/mock'; import { getEmptyStringTag } from '../../../../common/components/empty_value'; import { HostDetailsLink, NetworkDetailsLink } from '../../../../common/components/links'; -import { FlowTarget } from '../../../../graphql/types'; import { TooltipProperty, ITooltipProperty, } from '../../../../../../maps/public/classes/tooltips/tooltip_property'; +import { FlowTarget } from '../../../../../common/search_strategy'; describe('PointToolTipContent', () => { const mockFeatureProps: ITooltipProperty[] = [ diff --git a/x-pack/plugins/security_solution/public/network/components/embeddables/map_tool_tip/point_tool_tip_content.tsx b/x-pack/plugins/security_solution/public/network/components/embeddables/map_tool_tip/point_tool_tip_content.tsx index fb032d11ef98a..0fa59c6fd9e42 100644 --- a/x-pack/plugins/security_solution/public/network/components/embeddables/map_tool_tip/point_tool_tip_content.tsx +++ b/x-pack/plugins/security_solution/public/network/components/embeddables/map_tool_tip/point_tool_tip_content.tsx @@ -14,9 +14,9 @@ import { import { DescriptionListStyled } from '../../../../common/components/page'; import { HostDetailsLink, NetworkDetailsLink } from '../../../../common/components/links'; import { DefaultFieldRenderer } from '../../../../timelines/components/field_renderers/field_renderers'; -import { FlowTarget } from '../../../../graphql/types'; // eslint-disable-next-line @kbn/eslint/no-restricted-paths import { ITooltipProperty } from '../../../../../../maps/public/classes/tooltips/tooltip_property'; +import { FlowTarget } from '../../../../../common/search_strategy'; interface PointToolTipContentProps { contextId: string; diff --git a/x-pack/plugins/security_solution/public/network/components/flow_controls/flow_direction_select.test.tsx b/x-pack/plugins/security_solution/public/network/components/flow_controls/flow_direction_select.test.tsx index 49c0decbfe301..d98db616c9cde 100644 --- a/x-pack/plugins/security_solution/public/network/components/flow_controls/flow_direction_select.test.tsx +++ b/x-pack/plugins/security_solution/public/network/components/flow_controls/flow_direction_select.test.tsx @@ -7,8 +7,7 @@ import { mount, shallow } from 'enzyme'; import React from 'react'; - -import { FlowDirection } from '../../../graphql/types'; +import { FlowDirection } from '../../../../common/search_strategy'; import { FlowDirectionSelect } from './flow_direction_select'; diff --git a/x-pack/plugins/security_solution/public/network/components/flow_controls/flow_direction_select.tsx b/x-pack/plugins/security_solution/public/network/components/flow_controls/flow_direction_select.tsx index c434434f707de..12fa1e6a0d00d 100644 --- a/x-pack/plugins/security_solution/public/network/components/flow_controls/flow_direction_select.tsx +++ b/x-pack/plugins/security_solution/public/network/components/flow_controls/flow_direction_select.tsx @@ -7,8 +7,7 @@ import { EuiFilterButton, EuiFilterGroup } from '@elastic/eui'; import React from 'react'; - -import { FlowDirection } from '../../../graphql/types'; +import { FlowDirection } from '../../../../common/search_strategy'; import * as i18n from './translations'; diff --git a/x-pack/plugins/security_solution/public/network/components/flow_controls/flow_target_select.test.tsx b/x-pack/plugins/security_solution/public/network/components/flow_controls/flow_target_select.test.tsx index e8779a76626a5..918114f9e7196 100644 --- a/x-pack/plugins/security_solution/public/network/components/flow_controls/flow_target_select.test.tsx +++ b/x-pack/plugins/security_solution/public/network/components/flow_controls/flow_target_select.test.tsx @@ -8,8 +8,7 @@ import { mount, shallow } from 'enzyme'; import { clone } from 'lodash/fp'; import React from 'react'; - -import { FlowDirection, FlowTarget } from '../../../graphql/types'; +import { FlowDirection, FlowTarget } from '../../../../common/search_strategy'; import { FlowTargetSelect } from './flow_target_select'; diff --git a/x-pack/plugins/security_solution/public/network/components/flow_controls/flow_target_select.tsx b/x-pack/plugins/security_solution/public/network/components/flow_controls/flow_target_select.tsx index 5d8f33e9d7b05..723378b970df8 100644 --- a/x-pack/plugins/security_solution/public/network/components/flow_controls/flow_target_select.tsx +++ b/x-pack/plugins/security_solution/public/network/components/flow_controls/flow_target_select.tsx @@ -7,8 +7,7 @@ import { EuiSuperSelect } from '@elastic/eui'; import React from 'react'; - -import { FlowDirection, FlowTarget } from '../../../graphql/types'; +import { FlowTarget, FlowDirection } from '../../../../common/search_strategy'; import * as i18n from './translations'; diff --git a/x-pack/plugins/security_solution/public/network/components/flow_target_select_connected/index.test.tsx b/x-pack/plugins/security_solution/public/network/components/flow_target_select_connected/index.test.tsx index b1e2874d3c77b..8794d48b5aa13 100644 --- a/x-pack/plugins/security_solution/public/network/components/flow_target_select_connected/index.test.tsx +++ b/x-pack/plugins/security_solution/public/network/components/flow_target_select_connected/index.test.tsx @@ -12,7 +12,7 @@ import { MemoryRouter } from 'react-router-dom'; import '../../../common/mock/match_media'; import { TestProviders } from '../../../common/mock'; import { FlowTargetSelectConnectedComponent } from './index'; -import { FlowTarget } from '../../../graphql/types'; +import { FlowTarget } from '../../../../common/search_strategy'; describe('Flow Target Select Connected', () => { test('renders correctly against snapshot flowTarget source', () => { diff --git a/x-pack/plugins/security_solution/public/network/components/flow_target_select_connected/index.tsx b/x-pack/plugins/security_solution/public/network/components/flow_target_select_connected/index.tsx index c1568e2df21b8..5fef9833c57e2 100644 --- a/x-pack/plugins/security_solution/public/network/components/flow_target_select_connected/index.tsx +++ b/x-pack/plugins/security_solution/public/network/components/flow_target_select_connected/index.tsx @@ -11,11 +11,11 @@ import React, { useCallback } from 'react'; import { useHistory, useLocation } from 'react-router-dom'; import styled from 'styled-components'; -import { FlowDirection, FlowTarget } from '../../../graphql/types'; import * as i18nIp from '../details/translations'; import { FlowTargetSelect } from '../flow_controls/flow_target_select'; import { IpOverviewId } from '../../../timelines/components/field_renderers/field_renderers'; +import { FlowTarget, FlowDirection } from '../../../../common/search_strategy'; const SelectTypeItem = styled(EuiFlexItem)` min-width: 180px; diff --git a/x-pack/plugins/security_solution/public/network/components/kpi_network/index.test.tsx b/x-pack/plugins/security_solution/public/network/components/kpi_network/index.test.tsx index e88a7593c1a09..7f9c5b4672f9a 100644 --- a/x-pack/plugins/security_solution/public/network/components/kpi_network/index.test.tsx +++ b/x-pack/plugins/security_solution/public/network/components/kpi_network/index.test.tsx @@ -10,7 +10,6 @@ import React from 'react'; import { Provider as ReduxStoreProvider } from 'react-redux'; import { - apolloClientObservable, mockGlobalState, SUB_PLUGINS_REDUCER, kibanaObservable, @@ -33,22 +32,10 @@ describe('NetworkKpiComponent', () => { }; const { storage } = createSecuritySolutionStorageMock(); - let store = createStore( - state, - SUB_PLUGINS_REDUCER, - apolloClientObservable, - kibanaObservable, - storage - ); + let store = createStore(state, SUB_PLUGINS_REDUCER, kibanaObservable, storage); beforeEach(() => { - store = createStore( - state, - SUB_PLUGINS_REDUCER, - apolloClientObservable, - kibanaObservable, - storage - ); + store = createStore(state, SUB_PLUGINS_REDUCER, kibanaObservable, storage); }); describe('rendering', () => { diff --git a/x-pack/plugins/security_solution/public/network/components/network_dns_table/index.test.tsx b/x-pack/plugins/security_solution/public/network/components/network_dns_table/index.test.tsx index a645396063bde..7ec18c078c73d 100644 --- a/x-pack/plugins/security_solution/public/network/components/network_dns_table/index.test.tsx +++ b/x-pack/plugins/security_solution/public/network/components/network_dns_table/index.test.tsx @@ -8,12 +8,10 @@ import { shallow } from 'enzyme'; import { getOr } from 'lodash/fp'; import React from 'react'; -import { MockedProvider } from 'react-apollo/test-utils'; import { Provider as ReduxStoreProvider } from 'react-redux'; import '../../../common/mock/match_media'; import { - apolloClientObservable, mockGlobalState, TestProviders, SUB_PLUGINS_REDUCER, @@ -31,23 +29,11 @@ describe('NetworkTopNFlow Table Component', () => { const loadPage = jest.fn(); const state: State = mockGlobalState; const { storage } = createSecuritySolutionStorageMock(); - let store = createStore( - state, - SUB_PLUGINS_REDUCER, - apolloClientObservable, - kibanaObservable, - storage - ); + let store = createStore(state, SUB_PLUGINS_REDUCER, kibanaObservable, storage); const mount = useMountAppended(); beforeEach(() => { - store = createStore( - state, - SUB_PLUGINS_REDUCER, - apolloClientObservable, - kibanaObservable, - storage - ); + store = createStore(state, SUB_PLUGINS_REDUCER, kibanaObservable, storage); }); describe('rendering', () => { @@ -75,21 +61,19 @@ describe('NetworkTopNFlow Table Component', () => { describe('Sorting', () => { test('when you click on the column header, you should show the sorting icon', () => { const wrapper = mount( - - - - - + + + ); expect(store.getState().network.page.queries!.dns.sort).toEqual({ diff --git a/x-pack/plugins/security_solution/public/network/components/network_dns_table/is_ptr_included.test.tsx b/x-pack/plugins/security_solution/public/network/components/network_dns_table/is_ptr_included.test.tsx index 870de5c36afad..762cd4006002b 100644 --- a/x-pack/plugins/security_solution/public/network/components/network_dns_table/is_ptr_included.test.tsx +++ b/x-pack/plugins/security_solution/public/network/components/network_dns_table/is_ptr_included.test.tsx @@ -7,8 +7,7 @@ import { mount, shallow } from 'enzyme'; import React from 'react'; - -import { FlowDirection } from '../../../graphql/types'; +import { FlowDirection } from '../../../../common/search_strategy'; import { IsPtrIncluded } from './is_ptr_included'; diff --git a/x-pack/plugins/security_solution/public/network/components/network_http_table/index.test.tsx b/x-pack/plugins/security_solution/public/network/components/network_http_table/index.test.tsx index cbadb47c6d11a..f7f75d9f0a365 100644 --- a/x-pack/plugins/security_solution/public/network/components/network_http_table/index.test.tsx +++ b/x-pack/plugins/security_solution/public/network/components/network_http_table/index.test.tsx @@ -8,12 +8,10 @@ import { shallow } from 'enzyme'; import { getOr } from 'lodash/fp'; import React from 'react'; -import { MockedProvider } from 'react-apollo/test-utils'; import { Provider as ReduxStoreProvider } from 'react-redux'; import '../../../common/mock/match_media'; import { - apolloClientObservable, mockGlobalState, TestProviders, SUB_PLUGINS_REDUCER, @@ -34,23 +32,11 @@ describe('NetworkHttp Table Component', () => { const state: State = mockGlobalState; const { storage } = createSecuritySolutionStorageMock(); - let store = createStore( - state, - SUB_PLUGINS_REDUCER, - apolloClientObservable, - kibanaObservable, - storage - ); + let store = createStore(state, SUB_PLUGINS_REDUCER, kibanaObservable, storage); const mount = useMountAppended(); beforeEach(() => { - store = createStore( - state, - SUB_PLUGINS_REDUCER, - apolloClientObservable, - kibanaObservable, - storage - ); + store = createStore(state, SUB_PLUGINS_REDUCER, kibanaObservable, storage); }); describe('rendering', () => { @@ -78,21 +64,19 @@ describe('NetworkHttp Table Component', () => { describe('Sorting', () => { test('when you click on the column header, you should show the sorting icon', () => { const wrapper = mount( - - - - - + + + ); expect(store.getState().network.page.queries!.http.sort).toEqual({ diff --git a/x-pack/plugins/security_solution/public/network/components/network_top_countries_table/index.test.tsx b/x-pack/plugins/security_solution/public/network/components/network_top_countries_table/index.test.tsx index 8ea43d1b0c34f..c9ce204a52538 100644 --- a/x-pack/plugins/security_solution/public/network/components/network_top_countries_table/index.test.tsx +++ b/x-pack/plugins/security_solution/public/network/components/network_top_countries_table/index.test.tsx @@ -8,13 +8,11 @@ import { shallow } from 'enzyme'; import { getOr } from 'lodash/fp'; import React from 'react'; -import { MockedProvider } from 'react-apollo/test-utils'; import { Provider as ReduxStoreProvider } from 'react-redux'; import '../../../common/mock/match_media'; import { FlowTargetSourceDest } from '../../../../common/search_strategy/security_solution/network'; import { - apolloClientObservable, mockGlobalState, mockIndexPattern, TestProviders, @@ -35,22 +33,10 @@ describe('NetworkTopCountries Table Component', () => { const mount = useMountAppended(); const { storage } = createSecuritySolutionStorageMock(); - let store = createStore( - state, - SUB_PLUGINS_REDUCER, - apolloClientObservable, - kibanaObservable, - storage - ); + let store = createStore(state, SUB_PLUGINS_REDUCER, kibanaObservable, storage); beforeEach(() => { - store = createStore( - state, - SUB_PLUGINS_REDUCER, - apolloClientObservable, - kibanaObservable, - storage - ); + store = createStore(state, SUB_PLUGINS_REDUCER, kibanaObservable, storage); }); describe('rendering', () => { @@ -109,27 +95,25 @@ describe('NetworkTopCountries Table Component', () => { describe('Sorting on Table', () => { test('when you click on the column header, you should show the sorting icon', () => { const wrapper = mount( - - - - - + + + ); expect(store.getState().network.page.queries.topCountriesSource.sort).toEqual({ direction: 'desc', diff --git a/x-pack/plugins/security_solution/public/network/components/network_top_n_flow_table/index.test.tsx b/x-pack/plugins/security_solution/public/network/components/network_top_n_flow_table/index.test.tsx index 5983efad32fe2..a05277cd0513d 100644 --- a/x-pack/plugins/security_solution/public/network/components/network_top_n_flow_table/index.test.tsx +++ b/x-pack/plugins/security_solution/public/network/components/network_top_n_flow_table/index.test.tsx @@ -8,13 +8,10 @@ import { shallow } from 'enzyme'; import { getOr } from 'lodash/fp'; import React from 'react'; -import { MockedProvider } from 'react-apollo/test-utils'; import { Provider as ReduxStoreProvider } from 'react-redux'; import '../../../common/mock/match_media'; -import { FlowTargetSourceDest } from '../../../graphql/types'; import { - apolloClientObservable, mockGlobalState, TestProviders, SUB_PLUGINS_REDUCER, @@ -26,6 +23,7 @@ import { createStore, State } from '../../../common/store'; import { networkModel } from '../../store'; import { NetworkTopNFlowTable } from '.'; import { mockData } from './mock'; +import { FlowTargetSourceDest } from '../../../../common/search_strategy'; jest.mock('../../../common/components/link_to'); @@ -34,23 +32,11 @@ describe('NetworkTopNFlow Table Component', () => { const state: State = mockGlobalState; const { storage } = createSecuritySolutionStorageMock(); - let store = createStore( - state, - SUB_PLUGINS_REDUCER, - apolloClientObservable, - kibanaObservable, - storage - ); + let store = createStore(state, SUB_PLUGINS_REDUCER, kibanaObservable, storage); const mount = useMountAppended(); beforeEach(() => { - store = createStore( - state, - SUB_PLUGINS_REDUCER, - apolloClientObservable, - kibanaObservable, - storage - ); + store = createStore(state, SUB_PLUGINS_REDUCER, kibanaObservable, storage); }); describe('rendering', () => { @@ -100,22 +86,20 @@ describe('NetworkTopNFlow Table Component', () => { describe('Sorting on Table', () => { test('when you click on the column header, you should show the sorting icon', () => { const wrapper = mount( - - - - - + + + ); expect(store.getState().network.page.queries.topNFlowSource.sort).toEqual({ direction: 'desc', diff --git a/x-pack/plugins/security_solution/public/network/components/tls_table/index.test.tsx b/x-pack/plugins/security_solution/public/network/components/tls_table/index.test.tsx index f93d6d276bc6e..09b1afc5611b0 100644 --- a/x-pack/plugins/security_solution/public/network/components/tls_table/index.test.tsx +++ b/x-pack/plugins/security_solution/public/network/components/tls_table/index.test.tsx @@ -8,12 +8,10 @@ import { shallow } from 'enzyme'; import { getOr } from 'lodash/fp'; import React from 'react'; -import { MockedProvider } from 'react-apollo/test-utils'; import { Provider as ReduxStoreProvider } from 'react-redux'; import '../../../common/mock/match_media'; import { - apolloClientObservable, mockGlobalState, TestProviders, SUB_PLUGINS_REDUCER, @@ -31,23 +29,11 @@ describe('Tls Table Component', () => { const state: State = mockGlobalState; const { storage } = createSecuritySolutionStorageMock(); - let store = createStore( - state, - SUB_PLUGINS_REDUCER, - apolloClientObservable, - kibanaObservable, - storage - ); + let store = createStore(state, SUB_PLUGINS_REDUCER, kibanaObservable, storage); const mount = useMountAppended(); beforeEach(() => { - store = createStore( - state, - SUB_PLUGINS_REDUCER, - apolloClientObservable, - kibanaObservable, - storage - ); + store = createStore(state, SUB_PLUGINS_REDUCER, kibanaObservable, storage); }); describe('Rendering', () => { @@ -75,21 +61,19 @@ describe('Tls Table Component', () => { describe('Sorting on Table', () => { test('when you click on the column header, you should show the sorting icon', () => { const wrapper = mount( - - - - - + + + ); expect(store.getState().network.details.queries!.tls.sort).toEqual({ direction: 'desc', diff --git a/x-pack/plugins/security_solution/public/network/components/users_table/index.test.tsx b/x-pack/plugins/security_solution/public/network/components/users_table/index.test.tsx index 8fab7273530d2..e551dbb640751 100644 --- a/x-pack/plugins/security_solution/public/network/components/users_table/index.test.tsx +++ b/x-pack/plugins/security_solution/public/network/components/users_table/index.test.tsx @@ -8,13 +8,10 @@ import { shallow } from 'enzyme'; import { getOr } from 'lodash/fp'; import React from 'react'; -import { MockedProvider } from 'react-apollo/test-utils'; import { Provider as ReduxStoreProvider } from 'react-redux'; import '../../../common/mock/match_media'; -import { FlowTarget } from '../../../graphql/types'; import { - apolloClientObservable, mockGlobalState, TestProviders, SUB_PLUGINS_REDUCER, @@ -27,29 +24,18 @@ import { networkModel } from '../../store'; import { UsersTable } from '.'; import { mockUsersData } from './mock'; +import { FlowTarget } from '../../../../common/search_strategy'; describe('Users Table Component', () => { const loadPage = jest.fn(); const state: State = mockGlobalState; const { storage } = createSecuritySolutionStorageMock(); - let store = createStore( - state, - SUB_PLUGINS_REDUCER, - apolloClientObservable, - kibanaObservable, - storage - ); + let store = createStore(state, SUB_PLUGINS_REDUCER, kibanaObservable, storage); const mount = useMountAppended(); beforeEach(() => { - store = createStore( - state, - SUB_PLUGINS_REDUCER, - apolloClientObservable, - kibanaObservable, - storage - ); + store = createStore(state, SUB_PLUGINS_REDUCER, kibanaObservable, storage); }); describe('Rendering', () => { @@ -78,26 +64,20 @@ describe('Users Table Component', () => { describe('Sorting on Table', () => { test('when you click on the column header, you should show the sorting icon', () => { const wrapper = mount( - - - - - + + + ); expect(store.getState().network.details.queries!.users.sort).toEqual({ direction: 'asc', diff --git a/x-pack/plugins/security_solution/public/network/containers/tls/index.tsx b/x-pack/plugins/security_solution/public/network/containers/tls/index.tsx index 77f6d4575d8f7..49a7064113c30 100644 --- a/x-pack/plugins/security_solution/public/network/containers/tls/index.tsx +++ b/x-pack/plugins/security_solution/public/network/containers/tls/index.tsx @@ -15,7 +15,6 @@ import { inputsModel } from '../../../common/store'; import { useDeepEqualSelector } from '../../../common/hooks/use_selector'; import { useKibana } from '../../../common/lib/kibana'; import { createFilter } from '../../../common/containers/helpers'; -import { PageInfoPaginated, FlowTargetSourceDest } from '../../../graphql/types'; import { generateTablePaginationOptions } from '../../../common/components/paginated_table/helpers'; import { networkModel, networkSelectors } from '../../store'; import { @@ -27,6 +26,7 @@ import { isCompleteResponse, isErrorResponse } from '../../../../../../../src/pl import * as i18n from './translations'; import { getInspectResponse } from '../../../helpers'; +import { FlowTargetSourceDest, PageInfoPaginated } from '../../../../common/search_strategy'; const ID = 'networkTlsQuery'; diff --git a/x-pack/plugins/security_solution/public/network/containers/users/index.tsx b/x-pack/plugins/security_solution/public/network/containers/users/index.tsx index 515ef3b8644ab..e000981733eed 100644 --- a/x-pack/plugins/security_solution/public/network/containers/users/index.tsx +++ b/x-pack/plugins/security_solution/public/network/containers/users/index.tsx @@ -16,7 +16,6 @@ import { DEFAULT_INDEX_KEY } from '../../../../common/constants'; import { inputsModel } from '../../../common/store'; import { useKibana } from '../../../common/lib/kibana'; import { createFilter } from '../../../common/containers/helpers'; -import { PageInfoPaginated } from '../../../graphql/types'; import { generateTablePaginationOptions } from '../../../common/components/paginated_table/helpers'; import { networkSelectors } from '../../store'; import { @@ -29,6 +28,7 @@ import { isCompleteResponse, isErrorResponse } from '../../../../../../../src/pl import * as i18n from './translations'; import { getInspectResponse } from '../../../helpers'; import { InspectResponse } from '../../../types'; +import { PageInfoPaginated } from '../../../../common/search_strategy'; const ID = 'networkUsersQuery'; diff --git a/x-pack/plugins/security_solution/public/network/pages/details/index.test.tsx b/x-pack/plugins/security_solution/public/network/pages/details/index.test.tsx index 84c4e4528a12e..a9a97f6bac652 100644 --- a/x-pack/plugins/security_solution/public/network/pages/details/index.test.tsx +++ b/x-pack/plugins/security_solution/public/network/pages/details/index.test.tsx @@ -11,9 +11,7 @@ import { Router, useParams } from 'react-router-dom'; import '../../../common/mock/match_media'; import { useSourcererScope } from '../../../common/containers/sourcerer'; -import { FlowTarget } from '../../../graphql/types'; import { - apolloClientObservable, mockGlobalState, TestProviders, SUB_PLUGINS_REDUCER, @@ -23,6 +21,7 @@ import { import { useMountAppended } from '../../../common/utils/use_mount_appended'; import { createStore, State } from '../../../common/store'; import { NetworkDetails } from './index'; +import { FlowTarget } from '../../../../common/search_strategy'; jest.mock('@elastic/eui', () => { const original = jest.requireActual('@elastic/eui'); @@ -109,22 +108,10 @@ describe('Network Details', () => { const state: State = mockGlobalState; const { storage } = createSecuritySolutionStorageMock(); - let store = createStore( - state, - SUB_PLUGINS_REDUCER, - apolloClientObservable, - kibanaObservable, - storage - ); + let store = createStore(state, SUB_PLUGINS_REDUCER, kibanaObservable, storage); beforeEach(() => { - store = createStore( - state, - SUB_PLUGINS_REDUCER, - apolloClientObservable, - kibanaObservable, - storage - ); + store = createStore(state, SUB_PLUGINS_REDUCER, kibanaObservable, storage); }); test('it renders', () => { diff --git a/x-pack/plugins/security_solution/public/network/pages/details/index.tsx b/x-pack/plugins/security_solution/public/network/pages/details/index.tsx index 896eec39c125c..4cccb536c08bb 100644 --- a/x-pack/plugins/security_solution/public/network/pages/details/index.tsx +++ b/x-pack/plugins/security_solution/public/network/pages/details/index.tsx @@ -11,7 +11,11 @@ import { useDispatch } from 'react-redux'; import { useParams } from 'react-router-dom'; import { useDeepEqualSelector } from '../../../common/hooks/use_selector'; -import { FlowTarget, LastEventIndexKey } from '../../../../common/search_strategy'; +import { + FlowTarget, + FlowTargetSourceDest, + LastEventIndexKey, +} from '../../../../common/search_strategy'; import { useGlobalTime } from '../../../common/containers/use_global_time'; import { FiltersGlobal } from '../../../common/components/filters_global'; import { HeaderPage } from '../../../common/components/header_page'; @@ -26,7 +30,6 @@ import { IpOverview } from '../../components/details'; import { SiemSearchBar } from '../../../common/components/search_bar'; import { WrapperPage } from '../../../common/components/wrapper_page'; import { useNetworkDetails } from '../../containers/details'; -import { FlowTargetSourceDest } from '../../../graphql/types'; import { useKibana } from '../../../common/lib/kibana'; import { decodeIpv6 } from '../../../common/lib/helpers'; import { convertToBuildEsQuery } from '../../../common/lib/keury'; diff --git a/x-pack/plugins/security_solution/public/network/pages/index.tsx b/x-pack/plugins/security_solution/public/network/pages/index.tsx index c82b9060729c6..ddc098823470a 100644 --- a/x-pack/plugins/security_solution/public/network/pages/index.tsx +++ b/x-pack/plugins/security_solution/public/network/pages/index.tsx @@ -10,13 +10,13 @@ import { Route, Switch, RouteComponentProps, useHistory } from 'react-router-dom import { useMlCapabilities } from '../../common/components/ml/hooks/use_ml_capabilities'; import { hasMlUserPermissions } from '../../../common/machine_learning/has_ml_user_permissions'; -import { FlowTarget } from '../../graphql/types'; import { NetworkDetails } from './details'; import { Network } from './network'; import { getNetworkRoutePath } from './navigation'; import { NetworkRouteType } from './navigation/types'; import { MlNetworkConditionalContainer } from '../../common/components/ml/conditional_links/ml_network_conditional_container'; +import { FlowTarget } from '../../../common/search_strategy'; type Props = Partial> & { url: string }; diff --git a/x-pack/plugins/security_solution/public/network/pages/network.test.tsx b/x-pack/plugins/security_solution/public/network/pages/network.test.tsx index ece647e9710e0..862a4f1a56c12 100644 --- a/x-pack/plugins/security_solution/public/network/pages/network.test.tsx +++ b/x-pack/plugins/security_solution/public/network/pages/network.test.tsx @@ -15,7 +15,6 @@ import { useSourcererScope } from '../../common/containers/sourcerer'; import { TestProviders, mockGlobalState, - apolloClientObservable, SUB_PLUGINS_REDUCER, kibanaObservable, createSecuritySolutionStorageMock, @@ -146,13 +145,7 @@ describe('Network page - rendering', () => { }); const myState: State = mockGlobalState; const { storage } = createSecuritySolutionStorageMock(); - const myStore = createStore( - myState, - SUB_PLUGINS_REDUCER, - apolloClientObservable, - kibanaObservable, - storage - ); + const myStore = createStore(myState, SUB_PLUGINS_REDUCER, kibanaObservable, storage); const wrapper = mount( diff --git a/x-pack/plugins/security_solution/public/overview/components/overview_host/index.test.tsx b/x-pack/plugins/security_solution/public/overview/components/overview_host/index.test.tsx index 9199059b9790d..1295693db506f 100644 --- a/x-pack/plugins/security_solution/public/overview/components/overview_host/index.test.tsx +++ b/x-pack/plugins/security_solution/public/overview/components/overview_host/index.test.tsx @@ -11,7 +11,6 @@ import React from 'react'; import '../../../common/mock/match_media'; import { - apolloClientObservable, mockGlobalState, TestProviders, SUB_PLUGINS_REDUCER, @@ -63,23 +62,11 @@ describe('OverviewHost', () => { const state: State = mockGlobalState; const { storage } = createSecuritySolutionStorageMock(); - let store = createStore( - state, - SUB_PLUGINS_REDUCER, - apolloClientObservable, - kibanaObservable, - storage - ); + let store = createStore(state, SUB_PLUGINS_REDUCER, kibanaObservable, storage); beforeEach(() => { const myState = cloneDeep(state); - store = createStore( - myState, - SUB_PLUGINS_REDUCER, - apolloClientObservable, - kibanaObservable, - storage - ); + store = createStore(myState, SUB_PLUGINS_REDUCER, kibanaObservable, storage); }); test('it renders the expected widget title', () => { diff --git a/x-pack/plugins/security_solution/public/overview/components/overview_network/index.test.tsx b/x-pack/plugins/security_solution/public/overview/components/overview_network/index.test.tsx index ce3973e59d18b..13a9b529fdf43 100644 --- a/x-pack/plugins/security_solution/public/overview/components/overview_network/index.test.tsx +++ b/x-pack/plugins/security_solution/public/overview/components/overview_network/index.test.tsx @@ -11,7 +11,6 @@ import React from 'react'; import '../../../common/mock/match_media'; import { - apolloClientObservable, mockGlobalState, TestProviders, SUB_PLUGINS_REDUCER, @@ -73,23 +72,11 @@ describe('OverviewNetwork', () => { const state: State = mockGlobalState; const { storage } = createSecuritySolutionStorageMock(); - let store = createStore( - state, - SUB_PLUGINS_REDUCER, - apolloClientObservable, - kibanaObservable, - storage - ); + let store = createStore(state, SUB_PLUGINS_REDUCER, kibanaObservable, storage); beforeEach(() => { const myState = cloneDeep(state); - store = createStore( - myState, - SUB_PLUGINS_REDUCER, - apolloClientObservable, - kibanaObservable, - storage - ); + store = createStore(myState, SUB_PLUGINS_REDUCER, kibanaObservable, storage); }); test('it renders the expected widget title', () => { diff --git a/x-pack/plugins/security_solution/public/overview/components/recent_timelines/index.tsx b/x-pack/plugins/security_solution/public/overview/components/recent_timelines/index.tsx index 004e675cb3516..1d9b039e02258 100644 --- a/x-pack/plugins/security_solution/public/overview/components/recent_timelines/index.tsx +++ b/x-pack/plugins/security_solution/public/overview/components/recent_timelines/index.tsx @@ -5,14 +5,12 @@ * 2.0. */ -import ApolloClient from 'apollo-client'; import { EuiHorizontalRule, EuiText } from '@elastic/eui'; import React, { useCallback, useMemo, useEffect } from 'react'; import { useDispatch } from 'react-redux'; -import { TimelineType } from '../../../../common/types/timeline'; +import { SortFieldTimeline, TimelineType } from '../../../../common/types/timeline'; import { useGetAllTimeline } from '../../../timelines/containers/all'; -import { SortFieldTimeline, Direction } from '../../../graphql/types'; import { queryTimelineById, dispatchUpdateTimeline, @@ -30,15 +28,15 @@ import { SecurityPageName } from '../../../app/types'; import { APP_ID } from '../../../../common/constants'; import { useFormatUrl } from '../../../common/components/link_to'; import { LinkAnchor } from '../../../common/components/links'; +import { Direction } from '../../../../common/search_strategy'; interface Props { - apolloClient: ApolloClient<{}>; filterBy: FilterMode; } const PAGE_SIZE = 3; -const StatefulRecentTimelinesComponent: React.FC = ({ apolloClient, filterBy }) => { +const StatefulRecentTimelinesComponent: React.FC = ({ filterBy }) => { const dispatch = useDispatch(); const updateIsLoading = useCallback((payload) => dispatch(dispatchUpdateIsLoading(payload)), [ dispatch, @@ -50,14 +48,13 @@ const StatefulRecentTimelinesComponent: React.FC = ({ apolloClient, filte const onOpenTimeline: OnOpenTimeline = useCallback( ({ duplicate, timelineId }) => { queryTimelineById({ - apolloClient, duplicate, timelineId, updateIsLoading, updateTimeline, }); }, - [apolloClient, updateIsLoading, updateTimeline] + [updateIsLoading, updateTimeline] ); const goToTimelines = useCallback( diff --git a/x-pack/plugins/security_solution/public/overview/components/sidebar/sidebar.tsx b/x-pack/plugins/security_solution/public/overview/components/sidebar/sidebar.tsx index 9512a3e3c67c7..cd88b8f44dc7b 100644 --- a/x-pack/plugins/security_solution/public/overview/components/sidebar/sidebar.tsx +++ b/x-pack/plugins/security_solution/public/overview/components/sidebar/sidebar.tsx @@ -20,7 +20,6 @@ import { FilterMode as RecentCasesFilterMode } from '../recent_cases/types'; import { DEFAULT_FILTER_OPTIONS } from '../../../cases/containers/use_get_cases'; import { SidebarHeader } from '../../../common/components/sidebar_header'; import { useCurrentUser } from '../../../common/lib/kibana'; -import { useApolloClient } from '../../../common/utils/apollo_context'; import * as i18n from '../../pages/translations'; @@ -50,7 +49,6 @@ export const Sidebar = React.memo<{ setRecentTimelinesFilterBy, }) => { const currentUser = useCurrentUser(); - const apolloClient = useApolloClient(); const recentCasesFilters = useMemo( () => ( {recentTimelinesFilters} - + diff --git a/x-pack/plugins/security_solution/public/plugin.tsx b/x-pack/plugins/security_solution/public/plugin.tsx index 136df89558d53..23f3472b470b5 100644 --- a/x-pack/plugins/security_solution/public/plugin.tsx +++ b/x-pack/plugins/security_solution/public/plugin.tsx @@ -177,10 +177,9 @@ export class Plugin implements IPlugin { const [coreStart, startPlugins] = await core.getStartServices(); const { overview: subPlugin } = await this.subPlugins(); - const { renderApp, composeLibs } = await this.lazyApplicationDependencies(); + const { renderApp } = await this.lazyApplicationDependencies(); return renderApp({ - ...composeLibs(coreStart), ...params, services: await startServices, store: await this.store(coreStart, startPlugins), @@ -200,10 +199,9 @@ export class Plugin implements IPlugin { const [coreStart, startPlugins] = await core.getStartServices(); const { detections: subPlugin } = await this.subPlugins(); - const { renderApp, composeLibs } = await this.lazyApplicationDependencies(); + const { renderApp } = await this.lazyApplicationDependencies(); return renderApp({ - ...composeLibs(coreStart), ...params, services: await startServices, store: await this.store(coreStart, startPlugins), @@ -223,9 +221,8 @@ export class Plugin implements IPlugin { const [coreStart, startPlugins] = await core.getStartServices(); const { hosts: subPlugin } = await this.subPlugins(); - const { renderApp, composeLibs } = await this.lazyApplicationDependencies(); + const { renderApp } = await this.lazyApplicationDependencies(); return renderApp({ - ...composeLibs(coreStart), ...params, services: await startServices, store: await this.store(coreStart, startPlugins), @@ -245,9 +242,8 @@ export class Plugin implements IPlugin { const [coreStart, startPlugins] = await core.getStartServices(); const { network: subPlugin } = await this.subPlugins(); - const { renderApp, composeLibs } = await this.lazyApplicationDependencies(); + const { renderApp } = await this.lazyApplicationDependencies(); return renderApp({ - ...composeLibs(coreStart), ...params, services: await startServices, store: await this.store(coreStart, startPlugins), @@ -267,9 +263,8 @@ export class Plugin implements IPlugin { const [coreStart, startPlugins] = await core.getStartServices(); const { timelines: subPlugin } = await this.subPlugins(); - const { renderApp, composeLibs } = await this.lazyApplicationDependencies(); + const { renderApp } = await this.lazyApplicationDependencies(); return renderApp({ - ...composeLibs(coreStart), ...params, services: await startServices, store: await this.store(coreStart, startPlugins), @@ -289,9 +284,8 @@ export class Plugin implements IPlugin { const [coreStart, startPlugins] = await core.getStartServices(); const { cases: subPlugin } = await this.subPlugins(); - const { renderApp, composeLibs } = await this.lazyApplicationDependencies(); + const { renderApp } = await this.lazyApplicationDependencies(); return renderApp({ - ...composeLibs(coreStart), ...params, services: await startServices, store: await this.store(coreStart, startPlugins), @@ -311,9 +305,8 @@ export class Plugin implements IPlugin { const [coreStart, startPlugins] = await core.getStartServices(); const { management: managementSubPlugin } = await this.subPlugins(); - const { renderApp, composeLibs } = await this.lazyApplicationDependencies(); + const { renderApp } = await this.lazyApplicationDependencies(); return renderApp({ - ...composeLibs(coreStart), ...params, services: await startServices, store: await this.store(coreStart, startPlugins), @@ -458,7 +451,7 @@ export class Plugin implements IPlugin { const storeShowIsTrue = createStore( stateShowIsTrue, SUB_PLUGINS_REDUCER, - apolloClientObservable, kibanaObservable, storage ); diff --git a/x-pack/plugins/security_solution/public/timelines/components/open_timeline/helpers.test.ts b/x-pack/plugins/security_solution/public/timelines/components/open_timeline/helpers.test.ts index 4d1c9e8037455..1222f168b2ae9 100644 --- a/x-pack/plugins/security_solution/public/timelines/components/open_timeline/helpers.test.ts +++ b/x-pack/plugins/security_solution/public/timelines/components/open_timeline/helpers.test.ts @@ -7,9 +7,12 @@ import { cloneDeep, getOr, omit } from 'lodash/fp'; import { Dispatch } from 'redux'; -import ApolloClient from 'apollo-client'; -import { mockTimelineResults, mockTimelineResult, mockTimelineModel } from '../../../common/mock'; +import { + mockTimelineResults, + mockTimelineModel, + mockGetOneTimelineResult, +} from '../../../common/mock'; import { timelineDefaults } from '../../store/timeline/defaults'; import { setTimelineRangeDatePicker as dispatchSetTimelineRangeDatePicker } from '../../../common/store/inputs/actions'; import { @@ -47,6 +50,7 @@ import { mockTimeline as mockSelectedTimeline, mockTemplate as mockSelectedTemplate, } from './__mocks__'; +import { getTimeline } from '../../containers/api'; jest.mock('../../../common/store/inputs/actions'); jest.mock('../../../common/components/url_state/normalize_time_range.ts'); @@ -68,6 +72,8 @@ jest.mock('../../../common/utils/default_date_settings', () => { }; }); +jest.mock('../../containers/api'); + describe('helpers', () => { let mockResults: OpenTimelineResult[]; @@ -1223,12 +1229,8 @@ describe('helpers', () => { const selectedTimeline = { ...mockSelectedTimeline, }; - const apolloClient = { - query: (jest.fn().mockResolvedValue(selectedTimeline) as unknown) as ApolloClient<{}>, - }; const onOpenTimeline = jest.fn(); const args = { - apolloClient, duplicate: false, graphEventId: '', timelineId: '', @@ -1240,6 +1242,7 @@ describe('helpers', () => { }; beforeAll(async () => { + (getTimeline as jest.Mock).mockResolvedValue(selectedTimeline); await queryTimelineById<{}>((args as unknown) as QueryTimelineById<{}>); }); @@ -1255,7 +1258,7 @@ describe('helpers', () => { }); test('get timeline by Id', () => { - expect(apolloClient.query).toHaveBeenCalled(); + expect(getTimeline).toHaveBeenCalled(); }); test('Do not override daterange if TimelineStatus is active', () => { @@ -1281,11 +1284,8 @@ describe('helpers', () => { const updateIsLoading = jest.fn(); const updateTimeline = jest.fn().mockImplementation(() => jest.fn()); const selectedTimeline = { ...mockSelectedTimeline }; - const apolloClient = { - query: (jest.fn().mockResolvedValue(selectedTimeline) as unknown) as ApolloClient<{}>, - }; + const args = { - apolloClient, duplicate: false, graphEventId: '', timelineId: '', @@ -1296,6 +1296,7 @@ describe('helpers', () => { }; beforeAll(async () => { + (getTimeline as jest.Mock).mockResolvedValue(selectedTimeline); await queryTimelineById<{}>((args as unknown) as QueryTimelineById<{}>); }); @@ -1311,7 +1312,7 @@ describe('helpers', () => { }); test('get timeline by Id', () => { - expect(apolloClient.query).toHaveBeenCalled(); + expect(getTimeline).toHaveBeenCalled(); }); test('should not override daterange if TimelineStatus is active', () => { @@ -1350,12 +1351,8 @@ describe('helpers', () => { describe('open an immutable template', () => { const updateIsLoading = jest.fn(); const template = { ...mockSelectedTemplate }; - const apolloClient = { - query: (jest.fn().mockResolvedValue(template) as unknown) as ApolloClient<{}>, - }; const onOpenTimeline = jest.fn(); const args = { - apolloClient, duplicate: false, graphEventId: '', timelineId: '', @@ -1367,10 +1364,12 @@ describe('helpers', () => { }; beforeAll(async () => { + (getTimeline as jest.Mock).mockResolvedValue(template); await queryTimelineById<{}>((args as unknown) as QueryTimelineById<{}>); }); afterAll(() => { + (getTimeline as jest.Mock).mockReset(); jest.clearAllMocks(); }); @@ -1382,7 +1381,7 @@ describe('helpers', () => { }); test('get timeline by Id', () => { - expect(apolloClient.query).toHaveBeenCalled(); + expect(getTimeline).toHaveBeenCalled(); }); test('override daterange if TimelineStatus is immutable', () => { @@ -1411,14 +1410,14 @@ describe('helpers', () => { describe('omitTypenameInTimeline', () => { test('it does not modify the passed in timeline if no __typename exists', () => { - const result = omitTypenameInTimeline(mockTimelineResult); + const result = omitTypenameInTimeline(mockGetOneTimelineResult); - expect(result).toEqual(mockTimelineResult); + expect(result).toEqual(mockGetOneTimelineResult); }); test('it returns timeline with __typename removed when it exists', () => { const mockTimeline = { - ...mockTimelineResult, + ...mockGetOneTimelineResult, __typename: 'something, something', }; const result = omitTypenameInTimeline(mockTimeline); diff --git a/x-pack/plugins/security_solution/public/timelines/components/open_timeline/helpers.ts b/x-pack/plugins/security_solution/public/timelines/components/open_timeline/helpers.ts index 68f4d70c018f8..8c4eb2112640f 100644 --- a/x-pack/plugins/security_solution/public/timelines/components/open_timeline/helpers.ts +++ b/x-pack/plugins/security_solution/public/timelines/components/open_timeline/helpers.ts @@ -5,23 +5,12 @@ * 2.0. */ -import ApolloClient from 'apollo-client'; import { set } from '@elastic/safer-lodash-set/fp'; import { getOr, isEmpty } from 'lodash/fp'; import { Action } from 'typescript-fsa'; import uuid from 'uuid'; import { Dispatch } from 'redux'; import deepMerge from 'deepmerge'; -import { oneTimelineQuery } from '../../containers/one/index.gql_query'; -import { - TimelineResult, - GetOneTimeline, - NoteResult, - FilterTimelineResult, - ColumnHeaderResult, - PinnedEvent, - DataProviderResult, -} from '../../../graphql/types'; import { DataProviderType, @@ -29,6 +18,10 @@ import { TimelineStatus, TimelineType, TimelineTabs, + TimelineResult, + ColumnHeaderResult, + FilterTimelineResult, + DataProviderResult, } from '../../../../common/types/timeline'; import { @@ -66,6 +59,9 @@ import { DEFAULT_FROM_MOMENT, DEFAULT_TO_MOMENT, } from '../../../common/utils/default_date_settings'; +import { getTimeline } from '../../containers/api'; +import { PinnedEvent } from '../../../../common/types/timeline/pinned_event'; +import { NoteResult } from '../../../../common/types/timeline/note'; export const OPEN_TIMELINE_CLASS_NAME = 'open-timeline'; @@ -310,7 +306,6 @@ export const formatTimelineResultToModel = ( export interface QueryTimelineById { activeTimelineTab?: TimelineTabs; - apolloClient: ApolloClient | ApolloClient<{}> | undefined; duplicate?: boolean; graphEventId?: string; timelineId: string; @@ -329,7 +324,6 @@ export interface QueryTimelineById { export const queryTimelineById = ({ activeTimelineTab = TimelineTabs.query, - apolloClient, duplicate = false, graphEventId = '', timelineId, @@ -340,51 +334,44 @@ export const queryTimelineById = ({ updateTimeline, }: QueryTimelineById) => { updateIsLoading({ id: TimelineId.active, isLoading: true }); - if (apolloClient) { - apolloClient - .query({ - query: oneTimelineQuery, - fetchPolicy: 'no-cache', - variables: { id: timelineId }, - }) - .then((result) => { - const timelineToOpen: TimelineResult = omitTypenameInTimeline( - getOr({}, 'data.getOneTimeline', result) - ); - - const { timeline, notes } = formatTimelineResultToModel( - timelineToOpen, + Promise.resolve(getTimeline(timelineId)) + .then((result) => { + const timelineToOpen: TimelineResult = omitTypenameInTimeline( + getOr({}, 'data.getOneTimeline', result) + ); + + const { timeline, notes } = formatTimelineResultToModel( + timelineToOpen, + duplicate, + timelineType + ); + + if (onOpenTimeline != null) { + onOpenTimeline(timeline); + } else if (updateTimeline) { + const { from, to } = normalizeTimeRange({ + from: getOr(null, 'dateRange.start', timeline), + to: getOr(null, 'dateRange.end', timeline), + }); + updateTimeline({ duplicate, - timelineType - ); - - if (onOpenTimeline != null) { - onOpenTimeline(timeline); - } else if (updateTimeline) { - const { from, to } = normalizeTimeRange({ - from: getOr(null, 'dateRange.start', timeline), - to: getOr(null, 'dateRange.end', timeline), - }); - updateTimeline({ - duplicate, - from, - id: TimelineId.active, - notes, - timeline: { - ...timeline, - activeTab: activeTimelineTab, - graphEventId, - show: openTimeline, - dateRange: { start: from, end: to }, - }, - to, - })(); - } - }) - .finally(() => { - updateIsLoading({ id: TimelineId.active, isLoading: false }); - }); - } + from, + id: TimelineId.active, + notes, + timeline: { + ...timeline, + activeTab: activeTimelineTab, + graphEventId, + show: openTimeline, + dateRange: { start: from, end: to }, + }, + to, + })(); + } + }) + .finally(() => { + updateIsLoading({ id: TimelineId.active, isLoading: false }); + }); }; export const dispatchUpdateTimeline = (dispatch: Dispatch): DispatchUpdateTimeline => ({ diff --git a/x-pack/plugins/security_solution/public/timelines/components/open_timeline/index.test.tsx b/x-pack/plugins/security_solution/public/timelines/components/open_timeline/index.test.tsx index 872175de2c055..c0b451a875522 100644 --- a/x-pack/plugins/security_solution/public/timelines/components/open_timeline/index.test.tsx +++ b/x-pack/plugins/security_solution/public/timelines/components/open_timeline/index.test.tsx @@ -8,9 +8,8 @@ /* eslint-disable react/display-name */ import React from 'react'; -import { renderHook, act } from '@testing-library/react-hooks'; +import { renderHook } from '@testing-library/react-hooks'; import { mount } from 'enzyme'; -import { MockedProvider } from 'react-apollo/test-utils'; import { waitFor } from '@testing-library/react'; import { useHistory, useParams } from 'react-router-dom'; @@ -20,14 +19,13 @@ import { SecurityPageName } from '../../../app/types'; import { TimelineType } from '../../../../common/types/timeline'; import { TestProviders, mockOpenTimelineQueryResults } from '../../../common/mock'; -import { getTimelineTabsUrl } from '../../../common/components/link_to'; import { DEFAULT_SEARCH_RESULTS_PER_PAGE } from '../../pages/timelines_page'; import { useGetAllTimeline, getAllTimeline } from '../../containers/all'; import { useTimelineStatus } from './use_timeline_status'; import { NotePreviews } from './note_previews'; -import { OPEN_TIMELINE_CLASS_NAME } from './helpers'; +import { OPEN_TIMELINE_CLASS_NAME, queryTimelineById } from './helpers'; import { StatefulOpenTimeline } from '.'; import { TimelineTabsStyle } from './types'; import { @@ -35,6 +33,7 @@ import { UseTimelineTypesArgs, UseTimelineTypesResult, } from './use_timeline_types'; +import { deleteTimelinesByIds } from '../../containers/api'; jest.mock('react-router-dom', () => { const originalModule = jest.requireActual('react-router-dom'); @@ -80,6 +79,10 @@ jest.mock('./use_timeline_status', () => { }; }); +jest.mock('../../containers/api', () => ({ + deleteTimelinesByIds: jest.fn(), +})); + describe('StatefulOpenTimeline', () => { const title = 'All Timelines / Open Timelines'; let mockHistory: History[]; @@ -94,12 +97,9 @@ describe('StatefulOpenTimeline', () => { (useHistory as jest.Mock).mockReturnValue(mockHistory); ((useGetAllTimeline as unknown) as jest.Mock).mockReturnValue({ fetchAllTimeline: jest.fn(), - timelines: getAllTimeline( - '', - mockOpenTimelineQueryResults[0].result.data?.getAllTimeline?.timeline ?? [] - ), + timelines: getAllTimeline('', mockOpenTimelineQueryResults.timeline ?? []), loading: false, - totalCount: mockOpenTimelineQueryResults[0].result.data.getAllTimeline.totalCount, + totalCount: mockOpenTimelineQueryResults.totalCount, refetch: jest.fn(), }); ((useTimelineStatus as unknown) as jest.Mock).mockReturnValue({ @@ -112,23 +112,19 @@ describe('StatefulOpenTimeline', () => { }); afterEach(() => { - (getTimelineTabsUrl as jest.Mock).mockClear(); - (useParams as jest.Mock).mockClear(); - (useHistory as jest.Mock).mockClear(); + jest.clearAllMocks(); mockHistory = []; }); test('it has the expected initial state', () => { const wrapper = mount( - - - + ); @@ -175,7 +171,7 @@ describe('StatefulOpenTimeline', () => { expect(result.current.timelineType).toBe(TimelineType.template); }); - test("should land on correct templates' tab after switching tab", () => { + test("should land on correct templates' tab after switching tab", async () => { (useParams as jest.Mock).mockReturnValue({ tabName: TimelineType.template, pageName: SecurityPageName.timelines, @@ -183,21 +179,20 @@ describe('StatefulOpenTimeline', () => { const wrapper = mount( - - - + ); - wrapper - .find(`[data-test-subj="timeline-${TimelineTabsStyle.tab}-${TimelineType.template}"]`) - .first() - .simulate('click'); - act(() => { + await waitFor(() => { + wrapper + .find(`[data-test-subj="timeline-${TimelineTabsStyle.tab}-${TimelineType.template}"]`) + .first() + .simulate('click'); + expect(history.length).toBeGreaterThan(0); }); }); @@ -218,7 +213,7 @@ describe('StatefulOpenTimeline', () => { expect(result.current.timelineType).toBe(TimelineType.default); }); - test('should not change url after switching filter', () => { + test('should not change url after switching filter', async () => { (useParams as jest.Mock).mockReturnValue({ tabName: 'mockTabName', pageName: SecurityPageName.case, @@ -226,58 +221,53 @@ describe('StatefulOpenTimeline', () => { const wrapper = mount( - - - + ); - wrapper - .find( - `[data-test-subj="open-timeline-modal-body-${TimelineTabsStyle.filter}-${TimelineType.template}"]` - ) - .first() - .simulate('click'); - act(() => { + await waitFor(() => { + wrapper + .find( + `[data-test-subj="open-timeline-modal-body-${TimelineTabsStyle.filter}-${TimelineType.template}"]` + ) + .first() + .simulate('click'); expect(mockHistory.length).toEqual(0); }); }); }); describe('#onQueryChange', () => { - test('it updates the query state with the expected trimmed value when the user enters a query', () => { + test('it updates the query state with the expected trimmed value when the user enters a query', async () => { const wrapper = mount( - - - + ); - wrapper - .find('[data-test-subj="search-bar"] input') - .simulate('keyup', { key: 'Enter', target: { value: ' abcd ' } }); - expect(wrapper.find('[data-test-subj="search-row"]').first().prop('query')).toEqual('abcd'); + await waitFor(() => { + wrapper + .find('[data-test-subj="search-bar"] input') + .simulate('keyup', { key: 'Enter', target: { value: ' abcd ' } }); + expect(wrapper.find('[data-test-subj="search-row"]').first().prop('query')).toEqual('abcd'); + }); }); - test('it appends the word "with" to the Showing in Timelines message when the user enters a query', async () => { const wrapper = mount( - - - + ); @@ -295,13 +285,11 @@ describe('StatefulOpenTimeline', () => { test('echos (renders) the query when the user enters a query', async () => { const wrapper = mount( - - - + ); @@ -321,13 +309,11 @@ describe('StatefulOpenTimeline', () => { test('focuses the input when the component mounts', async () => { const wrapper = mount( - - - + ); @@ -347,13 +333,11 @@ describe('StatefulOpenTimeline', () => { const wrapper = mount( - - - + ); @@ -381,41 +365,24 @@ describe('StatefulOpenTimeline', () => { }); describe('#onDeleteSelected', () => { - // TODO - Have been skip because we need to re-implement the test as the component changed - test.skip('it invokes deleteTimelines with the selected timelines when the button is clicked', async () => { - const deleteTimelines = jest.fn(); - + test('it invokes deleteTimelines with the selected timelines when the button is clicked', async () => { const wrapper = mount( - - - + ); + wrapper.find('[data-test-subj="euiCollapsedItemActionsButton"]').first().simulate('click'); + wrapper.find('[data-test-subj="delete-timeline"]').first().simulate('click'); + wrapper.find('[data-test-subj="confirmModalConfirmButton"]').first().simulate('click'); await waitFor(() => { - wrapper - .find('.euiCheckbox__input') - .first() - .simulate('change', { target: { checked: true } }); - - wrapper.find('[data-test-subj="delete-selected"]').first().simulate('click'); + wrapper.update(); - expect(deleteTimelines).toHaveBeenCalledWith([ - 'saved-timeline-11', - 'saved-timeline-10', - 'saved-timeline-9', - 'saved-timeline-8', - 'saved-timeline-6', - 'saved-timeline-5', - 'saved-timeline-4', - 'saved-timeline-3', - 'saved-timeline-2', - ]); + expect(deleteTimelinesByIds).toHaveBeenCalled(); }); }); }); @@ -424,14 +391,12 @@ describe('StatefulOpenTimeline', () => { test('it updates the selection state when timelines are selected', async () => { const wrapper = mount( - - - + ); @@ -455,14 +420,12 @@ describe('StatefulOpenTimeline', () => { test('it updates the sort state when the user clicks on a column to sort it', () => { const wrapper = mount( - - - + ); @@ -482,14 +445,12 @@ describe('StatefulOpenTimeline', () => { test('it updates the onlyFavorites state when the user clicks the Only Favorites button', () => { const wrapper = mount( - - - + ); @@ -509,14 +470,12 @@ describe('StatefulOpenTimeline', () => { test('it updates the itemIdToExpandedNotesRowMap state when the user clicks the expand notes button', async () => { const wrapper = mount( - - - + ); @@ -538,11 +497,11 @@ describe('StatefulOpenTimeline', () => { '10849df0-7b44-11e9-a608-ab3d811609': ( ({ ...note, savedObjectId: note.noteId }) - ) + mockOpenTimelineQueryResults.timeline[0].notes != null + ? mockOpenTimelineQueryResults.timeline[0].notes.map((note) => ({ + ...note, + savedObjectId: note.noteId, + })) : [] } /> @@ -554,14 +513,12 @@ describe('StatefulOpenTimeline', () => { test('it renders the expanded notes when the expand button is clicked', async () => { const wrapper = mount( - - - + ); @@ -577,14 +534,12 @@ describe('StatefulOpenTimeline', () => { test('it has the expected initial state for openTimeline - templateTimelineFilter', () => { const wrapper = mount( - - - + ); @@ -594,14 +549,12 @@ describe('StatefulOpenTimeline', () => { test('it has the expected initial state for openTimelineModalBody - templateTimelineFilter', () => { const wrapper = mount( - - - + ); @@ -619,14 +572,12 @@ describe('StatefulOpenTimeline', () => { test('when the user deletes selected timelines, resetSelectionState is invoked to clear the selection state', async () => { const wrapper = mount( - - - + ); const getSelectedItem = (): [] => @@ -645,14 +596,12 @@ describe('StatefulOpenTimeline', () => { test('it renders the expected count of matching timelines when no query has been entered', async () => { const wrapper = mount( - - - + ); @@ -665,62 +614,51 @@ describe('StatefulOpenTimeline', () => { }); }); - // TODO - Have been skip because we need to re-implement the test as the component changed - test.skip('it invokes onOpenTimeline with the expected parameters when the hyperlink is clicked', async () => { - const onOpenTimeline = jest.fn(); - + test('it invokes onOpenTimeline with the expected parameters when the hyperlink is clicked', async () => { const wrapper = mount( - - - + ); await waitFor(() => { wrapper - .find( - `[data-test-subj="title-${ - mockOpenTimelineQueryResults[0].result.data!.getAllTimeline.timeline[0].savedObjectId - }"]` - ) + .find(`[data-test-subj="title-${mockOpenTimelineQueryResults.timeline[0].savedObjectId}"]`) .first() .simulate('click'); - expect(onOpenTimeline).toHaveBeenCalledWith({ - duplicate: false, - timelineId: mockOpenTimelineQueryResults[0].result.data!.getAllTimeline.timeline[0] - .savedObjectId, - }); + expect((queryTimelineById as jest.Mock).mock.calls[0][0].timelineId).toEqual( + mockOpenTimelineQueryResults.timeline[0].savedObjectId + ); + expect((queryTimelineById as jest.Mock).mock.calls[0][0].duplicate).toEqual(false); }); }); - // TODO - Have been skip because we need to re-implement the test as the component changed - test.skip('it invokes onOpenTimeline with the expected params when the button is clicked', async () => { - const onOpenTimeline = jest.fn(); - + test('it invokes onOpenTimeline with the expected params when the button is clicked', async () => { const wrapper = mount( - - - + ); - + wrapper.find('[data-test-subj="euiCollapsedItemActionsButton"]').first().simulate('click'); + wrapper.find('[data-test-subj="open-duplicate"]').first().simulate('click'); await waitFor(() => { - wrapper.find('[data-test-subj="open-duplicate"]').first().simulate('click'); + wrapper.update(); - expect(onOpenTimeline).toBeCalledWith({ duplicate: true, timelineId: 'saved-timeline-11' }); + expect((queryTimelineById as jest.Mock).mock.calls[0][0].timelineId).toEqual( + mockOpenTimelineQueryResults.timeline[0].savedObjectId + ); + expect((queryTimelineById as jest.Mock).mock.calls[0][0].duplicate).toEqual(true); }); }); }); diff --git a/x-pack/plugins/security_solution/public/timelines/components/open_timeline/index.tsx b/x-pack/plugins/security_solution/public/timelines/components/open_timeline/index.tsx index 523c181dfb10f..21e85fd3c5a4f 100644 --- a/x-pack/plugins/security_solution/public/timelines/components/open_timeline/index.tsx +++ b/x-pack/plugins/security_solution/public/timelines/components/open_timeline/index.tsx @@ -8,11 +8,9 @@ import React, { useEffect, useState, useCallback, useMemo } from 'react'; import { useDispatch } from 'react-redux'; -import { DeleteTimelineMutation, SortFieldTimeline, Direction } from '../../../graphql/types'; import { sourcererSelectors } from '../../../common/store'; import { useShallowEqualSelector, useDeepEqualSelector } from '../../../common/hooks/use_selector'; -import { TimelineId } from '../../../../common/types/timeline'; -import { useApolloClient } from '../../../common/utils/apollo_context'; +import { SortFieldTimeline, TimelineId } from '../../../../common/types/timeline'; import { TimelineModel } from '../../../timelines/store/timeline/model'; import { timelineSelectors } from '../../../timelines/store/timeline'; import { @@ -20,7 +18,6 @@ import { updateIsLoading as dispatchUpdateIsLoading, } from '../../../timelines/store/timeline/actions'; -import { deleteTimelineMutation } from '../../containers/delete/persist.gql_query'; import { useGetAllTimeline } from '../../containers/all'; import { defaultHeaders } from '../timeline/body/column_headers/default_headers'; @@ -47,6 +44,8 @@ import { import { DEFAULT_SORT_FIELD, DEFAULT_SORT_DIRECTION } from './constants'; import { useTimelineTypes } from './use_timeline_types'; import { useTimelineStatus } from './use_timeline_status'; +import { deleteTimelinesByIds } from '../../containers/api'; +import { Direction } from '../../../../common/search_strategy'; interface OwnProps { /** Displays open timeline in modal */ @@ -84,7 +83,6 @@ export const StatefulOpenTimelineComponent = React.memo( setImportDataModalToggle, title, }) => { - const apolloClient = useApolloClient(); const dispatch = useDispatch(); /** Required by EuiTable for expandable rows: a map of `TimelineResult.savedObjectId` to rendered notes */ const [itemIdToExpandedNotesRowMap, setItemIdToExpandedNotesRowMap] = useState< @@ -214,17 +212,10 @@ export const StatefulOpenTimelineComponent = React.memo( ); } - await apolloClient!.mutate< - DeleteTimelineMutation.Mutation, - DeleteTimelineMutation.Variables - >({ - mutation: deleteTimelineMutation, - fetchPolicy: 'no-cache', - variables: { id: timelineIds }, - }); + await deleteTimelinesByIds(timelineIds); refetch(); }, - [apolloClient, dispatch, existingIndexNames, refetch, timelineSavedObjectId] + [dispatch, existingIndexNames, refetch, timelineSavedObjectId] ); const onDeleteOneTimeline: OnDeleteOneTimeline = useCallback( @@ -291,7 +282,6 @@ export const StatefulOpenTimelineComponent = React.memo( } queryTimelineById({ - apolloClient, duplicate, onOpenTimeline, timelineId, @@ -301,7 +291,7 @@ export const StatefulOpenTimelineComponent = React.memo( }); }, // eslint-disable-next-line react-hooks/exhaustive-deps - [apolloClient, updateIsLoading, updateTimeline] + [updateIsLoading, updateTimeline] ); useEffect(() => { diff --git a/x-pack/plugins/security_solution/public/timelines/components/open_timeline/open_timeline_modal/index.test.tsx b/x-pack/plugins/security_solution/public/timelines/components/open_timeline/open_timeline_modal/index.test.tsx index 936993931da27..12da999c21fc8 100644 --- a/x-pack/plugins/security_solution/public/timelines/components/open_timeline/open_timeline_modal/index.test.tsx +++ b/x-pack/plugins/security_solution/public/timelines/components/open_timeline/open_timeline_modal/index.test.tsx @@ -7,7 +7,6 @@ import { mount } from 'enzyme'; import React, { ReactElement } from 'react'; -import { MockedProvider } from 'react-apollo/test-utils'; import { TestProviders } from '../../../../common/mock/test_providers'; import { mockOpenTimelineQueryResults } from '../../../../common/mock/timeline_results'; @@ -16,9 +15,7 @@ import { useTimelineStatus } from '../use_timeline_status'; import { OpenTimelineModal } from '.'; jest.mock('../../../../common/lib/kibana'); -jest.mock('../../../../common/utils/apollo_context', () => ({ - useApolloClient: () => ({}), -})); + jest.mock('../../../containers/all', () => { const originalModule = jest.requireActual('../../../containers/all'); return { @@ -53,13 +50,9 @@ describe('OpenTimelineModal', () => { beforeEach(() => { ((useGetAllTimeline as unknown) as jest.Mock).mockReturnValue({ fetchAllTimeline: jest.fn(), - timelines: getAllTimeline( - '', - mockOpenTimelineQueryResults[0].result.data?.getAllTimeline?.timeline ?? [] - ), + timelines: getAllTimeline('', mockOpenTimelineQueryResults.timeline ?? []), loading: false, - totalCount: mockOpenTimelineQueryResults[0].result.data.getAllTimeline.totalCount, - refetch: jest.fn(), + totalCount: mockOpenTimelineQueryResults.totalCount, }); ((useTimelineStatus as unknown) as jest.Mock).mockReturnValue({ timelineStatus: null, @@ -76,9 +69,7 @@ describe('OpenTimelineModal', () => { test('it renders the expected modal', async () => { const wrapper = mount( - - - + ); @@ -90,9 +81,7 @@ describe('OpenTimelineModal', () => { test('it installs elastic prebuilt templates', async () => { const wrapper = mount( - - - + ); diff --git a/x-pack/plugins/security_solution/public/timelines/components/open_timeline/open_timeline_modal/open_timeline_modal_button.test.tsx b/x-pack/plugins/security_solution/public/timelines/components/open_timeline/open_timeline_modal/open_timeline_modal_button.test.tsx index 62cdda6070b32..a902f4ea785c3 100644 --- a/x-pack/plugins/security_solution/public/timelines/components/open_timeline/open_timeline_modal/open_timeline_modal_button.test.tsx +++ b/x-pack/plugins/security_solution/public/timelines/components/open_timeline/open_timeline_modal/open_timeline_modal_button.test.tsx @@ -7,24 +7,15 @@ import { mount } from 'enzyme'; import React from 'react'; -import { MockedProvider } from 'react-apollo/test-utils'; import { waitFor } from '@testing-library/react'; -import { TestProviders } from '../../../../common/mock/test_providers'; -import { mockOpenTimelineQueryResults } from '../../../../common/mock/timeline_results'; import * as i18n from '../translations'; import { OpenTimelineModalButton } from './open_timeline_modal_button'; describe('OpenTimelineModalButton', () => { test('it renders the expected button text', async () => { - const wrapper = mount( - - - - - - ); + const wrapper = mount(); await waitFor(() => { wrapper.update(); @@ -38,13 +29,7 @@ describe('OpenTimelineModalButton', () => { describe('onClick prop', () => { test('it invokes onClick function provided as a prop when the button is clicked', async () => { const onClick = jest.fn(); - const wrapper = mount( - - - - - - ); + const wrapper = mount(); await waitFor(() => { wrapper.find('[data-test-subj="open-timeline-button"]').first().simulate('click'); diff --git a/x-pack/plugins/security_solution/public/timelines/components/open_timeline/types.ts b/x-pack/plugins/security_solution/public/timelines/components/open_timeline/types.ts index 47e1da2d240ea..cddf4e8d71d60 100644 --- a/x-pack/plugins/security_solution/public/timelines/components/open_timeline/types.ts +++ b/x-pack/plugins/security_solution/public/timelines/components/open_timeline/types.ts @@ -8,7 +8,7 @@ import type React from 'react'; import { AllTimelinesVariables } from '../../containers/all'; import { TimelineModel } from '../../store/timeline/model'; -import { NoteResult } from '../../../graphql/types'; +import { NoteResult } from '../../../../common/types/timeline/note'; import { TimelineTypeLiteral, TimelineTypeLiteralWithNull, diff --git a/x-pack/plugins/security_solution/public/timelines/components/side_panel/event_details/expandable_event.tsx b/x-pack/plugins/security_solution/public/timelines/components/side_panel/event_details/expandable_event.tsx index 86175c0e06ad2..d1d5bffc6bd0a 100644 --- a/x-pack/plugins/security_solution/public/timelines/components/side_panel/event_details/expandable_event.tsx +++ b/x-pack/plugins/security_solution/public/timelines/components/side_panel/event_details/expandable_event.tsx @@ -18,17 +18,12 @@ import { EuiFlexGroup, EuiFlexItem, } from '@elastic/eui'; -import React, { useMemo, useState } from 'react'; +import React, { useMemo } from 'react'; import styled from 'styled-components'; import { TimelineTabs } from '../../../../../common/types/timeline'; import { BrowserFields } from '../../../../common/containers/source'; -import { - EventDetails, - EventsViewType, - EventView, - ThreatView, -} from '../../../../common/components/event_details/event_details'; +import { EventDetails } from '../../../../common/components/event_details/event_details'; import { TimelineEventsDetailsItem } from '../../../../../common/search_strategy/timeline'; import { LineClamp } from '../../../../common/components/line_clamp'; import * as i18n from './translations'; @@ -88,9 +83,6 @@ ExpandableEventTitle.displayName = 'ExpandableEventTitle'; export const ExpandableEvent = React.memo( ({ browserFields, event, timelineId, timelineTabType, isAlert, loading, detailsData }) => { - const [eventView, setEventView] = useState(EventsViewType.summaryView); - const [threatView, setThreatView] = useState(EventsViewType.threatSummaryView); - const message = useMemo(() => { if (detailsData) { const messageField = find({ category: 'base', field: 'message' }, detailsData) as @@ -133,12 +125,8 @@ export const ExpandableEvent = React.memo( data={detailsData!} id={event.eventId!} isAlert={isAlert} - onThreatViewSelected={setThreatView} - onEventViewSelected={setEventView} - threatView={threatView} timelineId={timelineId} timelineTabType={timelineTabType} - eventView={eventView} /> diff --git a/x-pack/plugins/security_solution/public/timelines/components/side_panel/host_details/expandable_host.test.tsx b/x-pack/plugins/security_solution/public/timelines/components/side_panel/host_details/expandable_host.test.tsx index a9ab89359d0ae..c2df8959c8c94 100644 --- a/x-pack/plugins/security_solution/public/timelines/components/side_panel/host_details/expandable_host.test.tsx +++ b/x-pack/plugins/security_solution/public/timelines/components/side_panel/host_details/expandable_host.test.tsx @@ -10,7 +10,6 @@ import React from 'react'; import '../../../../common/mock/match_media'; import { - apolloClientObservable, mockGlobalState, TestProviders, SUB_PLUGINS_REDUCER, @@ -20,15 +19,6 @@ import { import { createStore, State } from '../../../../common/store'; import { ExpandableHostDetails } from './expandable_host'; -jest.mock('react-apollo', () => { - const original = jest.requireActual('react-apollo'); - return { - ...original, - // eslint-disable-next-line react/display-name - Query: () => <>, - }; -}); - describe('Expandable Host Component', () => { const state: State = { ...mockGlobalState, @@ -39,13 +29,7 @@ describe('Expandable Host Component', () => { }; const { storage } = createSecuritySolutionStorageMock(); - const store = createStore( - state, - SUB_PLUGINS_REDUCER, - apolloClientObservable, - kibanaObservable, - storage - ); + const store = createStore(state, SUB_PLUGINS_REDUCER, kibanaObservable, storage); const mockProps = { contextID: 'text-context', diff --git a/x-pack/plugins/security_solution/public/timelines/components/side_panel/index.test.tsx b/x-pack/plugins/security_solution/public/timelines/components/side_panel/index.test.tsx index 15b2b33409707..69676e58b77bd 100644 --- a/x-pack/plugins/security_solution/public/timelines/components/side_panel/index.test.tsx +++ b/x-pack/plugins/security_solution/public/timelines/components/side_panel/index.test.tsx @@ -10,7 +10,6 @@ import React from 'react'; import '../../../common/mock/match_media'; import { - apolloClientObservable, mockGlobalState, TestProviders, SUB_PLUGINS_REDUCER, @@ -21,26 +20,12 @@ import { createStore, State } from '../../../common/store'; import { DetailsPanel } from './index'; import { TimelineExpandedDetail, TimelineTabs } from '../../../../common/types/timeline'; import { FlowTarget } from '../../../../common/search_strategy/security_solution/network'; -jest.mock('react-apollo', () => { - const original = jest.requireActual('react-apollo'); - return { - ...original, - // eslint-disable-next-line react/display-name - Query: () => <>, - }; -}); describe('Details Panel Component', () => { const state: State = { ...mockGlobalState }; const { storage } = createSecuritySolutionStorageMock(); - let store = createStore( - state, - SUB_PLUGINS_REDUCER, - apolloClientObservable, - kibanaObservable, - storage - ); + let store = createStore(state, SUB_PLUGINS_REDUCER, kibanaObservable, storage); const dataLessExpandedDetail = { [TimelineTabs.query]: { @@ -89,13 +74,7 @@ describe('Details Panel Component', () => { describe('DetailsPanel: rendering', () => { beforeEach(() => { - store = createStore( - state, - SUB_PLUGINS_REDUCER, - apolloClientObservable, - kibanaObservable, - storage - ); + store = createStore(state, SUB_PLUGINS_REDUCER, kibanaObservable, storage); }); test('it should not render the DetailsPanel if no expanded detail has been set in the reducer', () => { @@ -123,13 +102,7 @@ describe('Details Panel Component', () => { describe('DetailsPanel:EventDetails: rendering', () => { beforeEach(() => { state.timeline.timelineById.test.expandedDetail = eventExpandedDetail; - store = createStore( - state, - SUB_PLUGINS_REDUCER, - apolloClientObservable, - kibanaObservable, - storage - ); + store = createStore(state, SUB_PLUGINS_REDUCER, kibanaObservable, storage); }); test('it should render the Details Panel when the panelView is set and the associated params are set', () => { @@ -167,13 +140,7 @@ describe('Details Panel Component', () => { describe('DetailsPanel:HostDetails: rendering', () => { beforeEach(() => { state.timeline.timelineById.test.expandedDetail = hostExpandedDetail; - store = createStore( - state, - SUB_PLUGINS_REDUCER, - apolloClientObservable, - kibanaObservable, - storage - ); + store = createStore(state, SUB_PLUGINS_REDUCER, kibanaObservable, storage); }); test('it should render the Host Details view in the Details Panel when the panelView is hostDetail and the hostName is set', () => { @@ -190,13 +157,7 @@ describe('Details Panel Component', () => { describe('DetailsPanel:NetworkDetails: rendering', () => { beforeEach(() => { state.timeline.timelineById.test.expandedDetail = networkExpandedDetail; - store = createStore( - state, - SUB_PLUGINS_REDUCER, - apolloClientObservable, - kibanaObservable, - storage - ); + store = createStore(state, SUB_PLUGINS_REDUCER, kibanaObservable, storage); }); test('it should render the Network Details view in the Details Panel when the panelView is networkDetail and the ip is set', () => { diff --git a/x-pack/plugins/security_solution/public/timelines/components/timeline/body/column_headers/column_header.tsx b/x-pack/plugins/security_solution/public/timelines/components/timeline/body/column_headers/column_header.tsx index 18ead2490dee3..7d203fab9e88f 100644 --- a/x-pack/plugins/security_solution/public/timelines/components/timeline/body/column_headers/column_header.tsx +++ b/x-pack/plugins/security_solution/public/timelines/components/timeline/body/column_headers/column_header.tsx @@ -19,9 +19,9 @@ import { getDraggableFieldId, } from '../../../../../common/components/drag_and_drop/helpers'; import { TimelineTabs } from '../../../../../../common/types/timeline'; +import { Direction } from '../../../../../../common/search_strategy'; import { ColumnHeaderOptions } from '../../../../../timelines/store/timeline/model'; import { OnFilterChange } from '../../events'; -import { Direction } from '../../../../../graphql/types'; import { ARIA_COLUMN_INDEX_OFFSET } from '../../helpers'; import { EventsTh, EventsThContent, EventsHeadingHandle } from '../../styles'; import { Sort } from '../sort'; diff --git a/x-pack/plugins/security_solution/public/timelines/components/timeline/body/column_headers/header/helpers.ts b/x-pack/plugins/security_solution/public/timelines/components/timeline/body/column_headers/header/helpers.ts index 85e1b52b5620b..b52fa292413df 100644 --- a/x-pack/plugins/security_solution/public/timelines/components/timeline/body/column_headers/header/helpers.ts +++ b/x-pack/plugins/security_solution/public/timelines/components/timeline/body/column_headers/header/helpers.ts @@ -5,8 +5,8 @@ * 2.0. */ +import { Direction } from '../../../../../../../common/search_strategy'; import { assertUnreachable } from '../../../../../../../common/utility_types'; -import { Direction } from '../../../../../../graphql/types'; import { ColumnHeaderOptions } from '../../../../../../timelines/store/timeline/model'; import { Sort, SortDirection } from '../../sort'; diff --git a/x-pack/plugins/security_solution/public/timelines/components/timeline/body/column_headers/header/index.test.tsx b/x-pack/plugins/security_solution/public/timelines/components/timeline/body/column_headers/header/index.test.tsx index bc4ba7fbf0ff5..b0198e60f3b9a 100644 --- a/x-pack/plugins/security_solution/public/timelines/components/timeline/body/column_headers/header/index.test.tsx +++ b/x-pack/plugins/security_solution/public/timelines/components/timeline/body/column_headers/header/index.test.tsx @@ -9,7 +9,6 @@ import { mount, shallow } from 'enzyme'; import React from 'react'; import { timelineActions } from '../../../../../store/timeline'; -import { Direction } from '../../../../../../graphql/types'; import { TestProviders } from '../../../../../../common/mock'; import { ColumnHeaderType } from '../../../../../store/timeline/model'; import { Sort } from '../../sort'; @@ -18,6 +17,7 @@ import { defaultHeaders } from '../default_headers'; import { HeaderComponent } from '.'; import { getNewSortDirectionOnClick, getNextSortDirection, getSortDirection } from './helpers'; +import { Direction } from '../../../../../../../common/search_strategy'; const mockDispatch = jest.fn(); jest.mock('react-redux', () => { diff --git a/x-pack/plugins/security_solution/public/timelines/components/timeline/body/column_headers/index.test.tsx b/x-pack/plugins/security_solution/public/timelines/components/timeline/body/column_headers/index.test.tsx index c76027e5ef78e..e900458c65572 100644 --- a/x-pack/plugins/security_solution/public/timelines/components/timeline/body/column_headers/index.test.tsx +++ b/x-pack/plugins/security_solution/public/timelines/components/timeline/body/column_headers/index.test.tsx @@ -11,7 +11,6 @@ import React from 'react'; import '../../../../../common/mock/match_media'; import { DEFAULT_ACTIONS_COLUMN_WIDTH } from '../constants'; import { defaultHeaders } from './default_headers'; -import { Direction } from '../../../../../graphql/types'; import { mockBrowserFields } from '../../../../../common/containers/source/mock'; import { Sort } from '../sort'; import { TestProviders } from '../../../../../common/mock/test_providers'; @@ -21,6 +20,7 @@ import { ColumnHeadersComponent } from '.'; import { cloneDeep } from 'lodash/fp'; import { timelineActions } from '../../../../store/timeline'; import { TimelineTabs } from '../../../../../../common/types/timeline'; +import { Direction } from '../../../../../../common/search_strategy'; const mockDispatch = jest.fn(); jest.mock('react-redux', () => { diff --git a/x-pack/plugins/security_solution/public/timelines/components/timeline/body/sort/index.ts b/x-pack/plugins/security_solution/public/timelines/components/timeline/body/sort/index.ts index 67cda060e90e4..e7c69b9229d70 100644 --- a/x-pack/plugins/security_solution/public/timelines/components/timeline/body/sort/index.ts +++ b/x-pack/plugins/security_solution/public/timelines/components/timeline/body/sort/index.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { Direction } from '../../../../../graphql/types'; +import { Direction } from '../../../../../../common/search_strategy'; import { ColumnId } from '../column_id'; /** Specifies a column's sort direction */ diff --git a/x-pack/plugins/security_solution/public/timelines/components/timeline/body/sort/sort_indicator.test.tsx b/x-pack/plugins/security_solution/public/timelines/components/timeline/body/sort/sort_indicator.test.tsx index a08e47b5cadda..56f98a6795cd1 100644 --- a/x-pack/plugins/security_solution/public/timelines/components/timeline/body/sort/sort_indicator.test.tsx +++ b/x-pack/plugins/security_solution/public/timelines/components/timeline/body/sort/sort_indicator.test.tsx @@ -7,8 +7,8 @@ import { mount, shallow } from 'enzyme'; import React from 'react'; +import { Direction } from '../../../../../../common/search_strategy'; -import { Direction } from '../../../../../graphql/types'; import * as i18n from '../translations'; import { getDirection, SortIndicator } from './sort_indicator'; diff --git a/x-pack/plugins/security_solution/public/timelines/components/timeline/body/sort/sort_indicator.tsx b/x-pack/plugins/security_solution/public/timelines/components/timeline/body/sort/sort_indicator.tsx index c7d1a1f7b6957..6af29793f9373 100644 --- a/x-pack/plugins/security_solution/public/timelines/components/timeline/body/sort/sort_indicator.tsx +++ b/x-pack/plugins/security_solution/public/timelines/components/timeline/body/sort/sort_indicator.tsx @@ -8,11 +8,11 @@ import { EuiIcon, EuiToolTip } from '@elastic/eui'; import React from 'react'; -import { Direction } from '../../../../../graphql/types'; import * as i18n from '../translations'; import { SortNumber } from './sort_number'; import { SortDirection } from '.'; +import { Direction } from '../../../../../../common/search_strategy'; enum SortDirectionIndicatorEnum { SORT_UP = 'sortUp', diff --git a/x-pack/plugins/security_solution/public/timelines/components/timeline/pinned_tab_content/index.test.tsx b/x-pack/plugins/security_solution/public/timelines/components/timeline/pinned_tab_content/index.test.tsx index 2ea2a2e401c0f..0f781b0958d02 100644 --- a/x-pack/plugins/security_solution/public/timelines/components/timeline/pinned_tab_content/index.test.tsx +++ b/x-pack/plugins/security_solution/public/timelines/components/timeline/pinned_tab_content/index.test.tsx @@ -9,7 +9,6 @@ import { shallow } from 'enzyme'; import React from 'react'; import useResizeObserver from 'use-resize-observer/polyfilled'; -import { Direction } from '../../../../graphql/types'; import { DefaultCellRenderer } from '../cell_rendering/default_cell_renderer'; import { defaultHeaders, mockTimelineData } from '../../../../common/mock'; import '../../../../common/mock/match_media'; @@ -23,6 +22,7 @@ import { useTimelineEventsDetails } from '../../../containers/details/index'; import { useSourcererScope } from '../../../../common/containers/sourcerer'; import { mockSourcererScope } from '../../../../common/containers/sourcerer/mocks'; import { PinnedTabContentComponent, Props as PinnedTabContentComponentProps } from '.'; +import { Direction } from '../../../../../common/search_strategy'; jest.mock('../../../containers/index', () => ({ useTimelineEvents: jest.fn(), diff --git a/x-pack/plugins/security_solution/public/timelines/components/timeline/properties/helpers.tsx b/x-pack/plugins/security_solution/public/timelines/components/timeline/properties/helpers.tsx index 4333f48bc2379..165de178768f2 100644 --- a/x-pack/plugins/security_solution/public/timelines/components/timeline/properties/helpers.tsx +++ b/x-pack/plugins/security_solution/public/timelines/components/timeline/properties/helpers.tsx @@ -15,7 +15,6 @@ import { timelineActions, timelineSelectors } from '../../../../timelines/store/ import { useShallowEqualSelector } from '../../../../common/hooks/use_selector'; import * as i18n from './translations'; -import { TimelineInput } from '../../../store/timeline/actions'; import { useCreateTimelineButton } from './use_create_timeline'; import { timelineDefaults } from '../../../store/timeline/defaults'; @@ -25,8 +24,6 @@ const NotesCountBadge = (styled(EuiBadge)` NotesCountBadge.displayName = 'NotesCountBadge'; -export type SaveTimeline = (args: TimelineInput) => void; - interface AddToFavoritesButtonProps { timelineId: string; } diff --git a/x-pack/plugins/security_solution/public/timelines/components/timeline/properties/new_template_timeline.test.tsx b/x-pack/plugins/security_solution/public/timelines/components/timeline/properties/new_template_timeline.test.tsx index aa667c0a8466c..1cbf7587dd29b 100644 --- a/x-pack/plugins/security_solution/public/timelines/components/timeline/properties/new_template_timeline.test.tsx +++ b/x-pack/plugins/security_solution/public/timelines/components/timeline/properties/new_template_timeline.test.tsx @@ -11,7 +11,6 @@ import { Provider as ReduxStoreProvider } from 'react-redux'; import { mockGlobalState, - apolloClientObservable, SUB_PLUGINS_REDUCER, kibanaObservable, createSecuritySolutionStorageMock, @@ -29,13 +28,7 @@ jest.mock('../../../../common/lib/kibana', () => { describe('NewTemplateTimeline', () => { const state: State = mockGlobalState; const { storage } = createSecuritySolutionStorageMock(); - const store = createStore( - state, - SUB_PLUGINS_REDUCER, - apolloClientObservable, - kibanaObservable, - storage - ); + const store = createStore(state, SUB_PLUGINS_REDUCER, kibanaObservable, storage); const mockClosePopover = jest.fn(); const mockTitle = 'NEW_TIMELINE'; let wrapper: ReactWrapper; diff --git a/x-pack/plugins/security_solution/public/timelines/components/timeline/query_tab_content/index.test.tsx b/x-pack/plugins/security_solution/public/timelines/components/timeline/query_tab_content/index.test.tsx index ede473acbfb2a..acae8c8c53cd0 100644 --- a/x-pack/plugins/security_solution/public/timelines/components/timeline/query_tab_content/index.test.tsx +++ b/x-pack/plugins/security_solution/public/timelines/components/timeline/query_tab_content/index.test.tsx @@ -9,7 +9,6 @@ import { shallow } from 'enzyme'; import React from 'react'; import useResizeObserver from 'use-resize-observer/polyfilled'; -import { Direction } from '../../../../graphql/types'; import { DefaultCellRenderer } from '../cell_rendering/default_cell_renderer'; import { defaultHeaders, mockTimelineData } from '../../../../common/mock'; import '../../../../common/mock/match_media'; @@ -25,6 +24,7 @@ import { useTimelineEvents } from '../../../containers/index'; import { useTimelineEventsDetails } from '../../../containers/details/index'; import { useSourcererScope } from '../../../../common/containers/sourcerer'; import { mockSourcererScope } from '../../../../common/containers/sourcerer/mocks'; +import { Direction } from '../../../../../common/search_strategy'; jest.mock('../../../containers/index', () => ({ useTimelineEvents: jest.fn(), diff --git a/x-pack/plugins/security_solution/public/timelines/components/timeline/selectable_timeline/index.test.tsx b/x-pack/plugins/security_solution/public/timelines/components/timeline/selectable_timeline/index.test.tsx index 3bca1c743db09..44174009d0198 100644 --- a/x-pack/plugins/security_solution/public/timelines/components/timeline/selectable_timeline/index.test.tsx +++ b/x-pack/plugins/security_solution/public/timelines/components/timeline/selectable_timeline/index.test.tsx @@ -9,9 +9,9 @@ import { EuiSelectableProps } from '@elastic/eui'; import React from 'react'; import { shallow, ShallowWrapper, mount } from 'enzyme'; -import { TimelineType } from '../../../../../common/types/timeline'; -import { SortFieldTimeline, Direction } from '../../../../graphql/types'; +import { SortFieldTimeline, TimelineType } from '../../../../../common/types/timeline'; import { SelectableTimeline, ORIGINAL_PAGE_SIZE } from './'; +import { Direction } from '../../../../../common/search_strategy'; const mockFetchAllTimeline = jest.fn(); jest.mock('../../../containers/all', () => { diff --git a/x-pack/plugins/security_solution/public/timelines/components/timeline/selectable_timeline/index.tsx b/x-pack/plugins/security_solution/public/timelines/components/timeline/selectable_timeline/index.tsx index 7ccce80bbe9a4..5692081c5ed3e 100644 --- a/x-pack/plugins/security_solution/public/timelines/components/timeline/selectable_timeline/index.tsx +++ b/x-pack/plugins/security_solution/public/timelines/components/timeline/selectable_timeline/index.tsx @@ -23,15 +23,16 @@ import styled from 'styled-components'; import { TimelineTypeLiteralWithNull, TimelineTypeLiteral, + SortFieldTimeline, } from '../../../../../common/types/timeline'; import { useGetAllTimeline } from '../../../containers/all'; -import { SortFieldTimeline, Direction } from '../../../../graphql/types'; import { isUntitled } from '../../open_timeline/helpers'; import * as i18nTimeline from '../../open_timeline/translations'; import { OpenTimelineResult } from '../../open_timeline/types'; import { getEmptyTagValue } from '../../../../common/components/empty_value'; import * as i18n from '../translations'; +import { Direction } from '../../../../../common/search_strategy'; const MyEuiFlexItem = styled(EuiFlexItem)` display: inline-block; diff --git a/x-pack/plugins/security_solution/public/timelines/containers/all/index.gql_query.ts b/x-pack/plugins/security_solution/public/timelines/containers/all/index.gql_query.ts deleted file mode 100644 index 59d8ce381446a..0000000000000 --- a/x-pack/plugins/security_solution/public/timelines/containers/all/index.gql_query.ts +++ /dev/null @@ -1,81 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. - */ - -import gql from 'graphql-tag'; - -export const allTimelinesQuery = gql` - query GetAllTimeline( - $pageInfo: PageInfoTimeline! - $search: String - $sort: SortTimeline - $onlyUserFavorite: Boolean - $timelineType: TimelineType - $status: TimelineStatus - ) { - getAllTimeline( - pageInfo: $pageInfo - search: $search - sort: $sort - onlyUserFavorite: $onlyUserFavorite - timelineType: $timelineType - status: $status - ) { - totalCount - defaultTimelineCount - templateTimelineCount - elasticTemplateTimelineCount - customTemplateTimelineCount - favoriteCount - timeline { - savedObjectId - description - favorite { - fullName - userName - favoriteDate - } - eventIdToNoteIds { - eventId - note - timelineId - noteId - created - createdBy - timelineVersion - updated - updatedBy - version - } - excludedRowRendererIds - notes { - eventId - note - timelineId - timelineVersion - noteId - created - createdBy - updated - updatedBy - version - } - noteIds - pinnedEventIds - status - title - timelineType - templateTimelineId - templateTimelineVersion - created - createdBy - updated - updatedBy - version - } - } - } -`; diff --git a/x-pack/plugins/security_solution/public/timelines/containers/all/index.tsx b/x-pack/plugins/security_solution/public/timelines/containers/all/index.tsx index 82b41a95bd537..4ba6fa8b22cd7 100644 --- a/x-pack/plugins/security_solution/public/timelines/containers/all/index.tsx +++ b/x-pack/plugins/security_solution/public/timelines/containers/all/index.tsx @@ -12,22 +12,19 @@ import { useDispatch } from 'react-redux'; import { OpenTimelineResult } from '../../components/open_timeline/types'; import { errorToToaster, useStateToaster } from '../../../common/components/toasters'; -import { - GetAllTimeline, - PageInfoTimeline, - SortTimeline, - TimelineResult, -} from '../../../graphql/types'; import { inputsActions } from '../../../common/store/inputs'; -import { useApolloClient } from '../../../common/utils/apollo_context'; -import { allTimelinesQuery } from './index.gql_query'; import * as i18n from '../../pages/translations'; import { TimelineType, TimelineTypeLiteralWithNull, TimelineStatusLiteralWithNull, + PageInfoTimeline, + TimelineResult, + SortTimeline, + GetAllTimelineVariables, } from '../../../../common/types/timeline'; +import { getAllTimelines } from '../api'; export interface AllTimelinesArgs { fetchAllTimeline: ({ @@ -100,7 +97,6 @@ export const getAllTimeline = memoizeOne( export const useGetAllTimeline = (): AllTimelinesArgs => { const dispatch = useDispatch(); - const apolloClient = useApolloClient(); const [, dispatchToaster] = useStateToaster(); const [allTimelines, setAllTimelines] = useState>({ loading: false, @@ -127,64 +123,49 @@ export const useGetAllTimeline = (): AllTimelinesArgs => { const fetchData = async () => { try { - if (apolloClient != null) { - setAllTimelines((prevState) => ({ - ...prevState, - loading: true, - })); + setAllTimelines((prevState) => ({ + ...prevState, + loading: true, + })); - const variables: GetAllTimeline.Variables = { - onlyUserFavorite, - pageInfo, - search, - sort, - status, - timelineType, - }; - const response = await apolloClient.query< - GetAllTimeline.Query, - GetAllTimeline.Variables - >({ - query: allTimelinesQuery, - fetchPolicy: 'network-only', - variables, - context: { - fetchOptions: { - abortSignal: abortCtrl.signal, - }, - }, - }); - const getAllTimelineResponse = response?.data?.getAllTimeline; - const totalCount = getAllTimelineResponse?.totalCount ?? 0; - const timelines = getAllTimelineResponse?.timeline ?? []; - const customTemplateTimelineCount = - getAllTimelineResponse?.customTemplateTimelineCount ?? 0; - const defaultTimelineCount = getAllTimelineResponse?.defaultTimelineCount ?? 0; - const elasticTemplateTimelineCount = - getAllTimelineResponse?.elasticTemplateTimelineCount ?? 0; - const templateTimelineCount = getAllTimelineResponse?.templateTimelineCount ?? 0; - const favoriteCount = getAllTimelineResponse?.favoriteCount ?? 0; - if (!didCancel) { - dispatch( - inputsActions.setQuery({ - inputId: 'global', - id: ALL_TIMELINE_QUERY_ID, - loading: false, - refetch: fetchData, - inspect: null, - }) - ); - setAllTimelines({ + const variables: GetAllTimelineVariables = { + onlyUserFavorite, + pageInfo, + search, + sort, + status, + timelineType, + }; + const getAllTimelineResponse = await getAllTimelines(variables, abortCtrl.signal); + const totalCount = getAllTimelineResponse?.totalCount ?? 0; + const timelines = getAllTimelineResponse?.timeline ?? []; + const customTemplateTimelineCount = + getAllTimelineResponse?.customTemplateTimelineCount ?? 0; + const defaultTimelineCount = getAllTimelineResponse?.defaultTimelineCount ?? 0; + const elasticTemplateTimelineCount = + getAllTimelineResponse?.elasticTemplateTimelineCount ?? 0; + const templateTimelineCount = getAllTimelineResponse?.templateTimelineCount ?? 0; + const favoriteCount = getAllTimelineResponse?.favoriteCount ?? 0; + if (!didCancel) { + dispatch( + inputsActions.setQuery({ + inputId: 'global', + id: ALL_TIMELINE_QUERY_ID, loading: false, - totalCount, - timelines: getAllTimeline(JSON.stringify(variables), timelines as TimelineResult[]), - customTemplateTimelineCount, - defaultTimelineCount, - elasticTemplateTimelineCount, - templateTimelineCount, - favoriteCount, - }); - } + refetch: fetchData, + inspect: null, + }) + ); + setAllTimelines({ + loading: false, + totalCount, + timelines: getAllTimeline(JSON.stringify(variables), timelines as TimelineResult[]), + customTemplateTimelineCount, + defaultTimelineCount, + elasticTemplateTimelineCount, + templateTimelineCount, + favoriteCount, + }); } } catch (error) { if (!didCancel) { @@ -212,7 +193,7 @@ export const useGetAllTimeline = (): AllTimelinesArgs => { abortCtrl.abort(); }; }, - [apolloClient, dispatch, dispatchToaster] + [dispatch, dispatchToaster] ); useEffect(() => { diff --git a/x-pack/plugins/security_solution/public/timelines/containers/api.ts b/x-pack/plugins/security_solution/public/timelines/containers/api.ts index 01a85f6309c3f..a6c2126f95e8d 100644 --- a/x-pack/plugins/security_solution/public/timelines/containers/api.ts +++ b/x-pack/plugins/security_solution/public/timelines/containers/api.ts @@ -21,14 +21,23 @@ import { TimelineErrorResponse, ImportTimelineResultSchema, importTimelineResultSchema, + ResponseFavoriteTimeline, + AllTimelinesResponse, + SingleTimelineResponse, + allTimelinesResponse, + responseFavoriteTimeline, + GetTimelinesArgs, + SingleTimelineResponseType, + TimelineType, } from '../../../common/types/timeline'; -import { TimelineInput, TimelineType } from '../../graphql/types'; import { TIMELINE_URL, TIMELINE_DRAFT_URL, TIMELINE_IMPORT_URL, TIMELINE_EXPORT_URL, TIMELINE_PREPACKAGED_URL, + TIMELINES_URL, + TIMELINE_FAVORITE_URL, } from '../../../common/constants'; import { KibanaServices } from '../../common/lib/kibana'; @@ -39,6 +48,7 @@ import { ImportDataProps, ImportDataResponse, } from '../../detections/containers/detection_engine/rules'; +import { TimelineInput } from '../../../common/search_strategy'; interface RequestPostTimeline { timeline: TimelineInput; @@ -52,12 +62,24 @@ interface RequestPatchTimeline extends RequestPostTimeline { type RequestPersistTimeline = RequestPostTimeline & Partial>; -const decodeTimelineResponse = (respTimeline?: TimelineResponse) => +const decodeTimelineResponse = (respTimeline?: TimelineResponse | TimelineErrorResponse) => pipe( TimelineResponseType.decode(respTimeline), fold(throwErrors(createToasterPlainError), identity) ); +const decodeSingleTimelineResponse = (respTimeline?: SingleTimelineResponse) => + pipe( + SingleTimelineResponseType.decode(respTimeline), + fold(throwErrors(createToasterPlainError), identity) + ); + +const decodeAllTimelinesResponse = (respTimeline: AllTimelinesResponse) => + pipe( + allTimelinesResponse.decode(respTimeline), + fold(throwErrors(createToasterPlainError), identity) + ); + const decodeTimelineErrorResponse = (respTimeline?: TimelineErrorResponse) => pipe( TimelineErrorResponseType.decode(respTimeline), @@ -70,10 +92,25 @@ const decodePrepackedTimelineResponse = (respTimeline?: ImportTimelineResultSche fold(throwErrors(createToasterPlainError), identity) ); -const postTimeline = async ({ timeline }: RequestPostTimeline): Promise => { +const decodeResponseFavoriteTimeline = (respTimeline?: ResponseFavoriteTimeline) => + pipe( + responseFavoriteTimeline.decode(respTimeline), + fold(throwErrors(createToasterPlainError), identity) + ); + +const postTimeline = async ({ + timeline, +}: RequestPostTimeline): Promise => { + let requestBody; + try { + requestBody = JSON.stringify({ timeline }); + } catch (err) { + return Promise.reject(new Error(`Failed to stringify query: ${JSON.stringify(err)}`)); + } + const response = await KibanaServices.get().http.post(TIMELINE_URL, { method: 'POST', - body: JSON.stringify({ timeline }), + body: requestBody, }); return decodeTimelineResponse(response); @@ -85,10 +122,16 @@ const patchTimeline = async ({ version, }: RequestPatchTimeline): Promise => { let response = null; + let requestBody = null; + try { + requestBody = JSON.stringify({ timeline, timelineId, version }); + } catch (err) { + return Promise.reject(new Error(`Failed to stringify query: ${JSON.stringify(err)}`)); + } try { response = await KibanaServices.get().http.patch(TIMELINE_URL, { method: 'PATCH', - body: JSON.stringify({ timeline, timelineId, version }), + body: requestBody, }); } catch (err) { // For Future developer @@ -106,12 +149,13 @@ export const persistTimeline = async ({ }: RequestPersistTimeline): Promise => { try { if (isEmpty(timelineId) && timeline.status === TimelineStatus.draft && timeline) { - const draftTimeline = await cleanDraftTimeline({ + const temp: TimelineResponse | TimelineErrorResponse = await cleanDraftTimeline({ timelineType: timeline.timelineType!, templateTimelineId: timeline.templateTimelineId ?? undefined, templateTimelineVersion: timeline.templateTimelineVersion ?? undefined, }); + const draftTimeline = decodeTimelineResponse(temp); const templateTimelineInfo = timeline.timelineType! === TimelineType.template ? { @@ -182,11 +226,16 @@ export const exportSelectedTimeline: ExportSelectedData = ({ filename = `timelines_export.ndjson`, ids = [], signal, -}): Promise => { - const body = ids.length > 0 ? JSON.stringify({ ids }) : undefined; +}): Promise => { + let requestBody; + try { + requestBody = ids.length > 0 ? JSON.stringify({ ids }) : undefined; + } catch (err) { + return Promise.reject(new Error(`Failed to stringify query: ${JSON.stringify(err)}`)); + } return KibanaServices.get().http.fetch(`${TIMELINE_EXPORT_URL}`, { method: 'POST', - body, + body: requestBody, query: { file_name: filename, }, @@ -216,7 +265,8 @@ export const cleanDraftTimeline = async ({ timelineType: TimelineType; templateTimelineId?: string; templateTimelineVersion?: number; -}): Promise => { +}): Promise => { + let requestBody; const templateTimelineInfo = timelineType === TimelineType.template ? { @@ -224,11 +274,16 @@ export const cleanDraftTimeline = async ({ templateTimelineVersion, } : {}; - const response = await KibanaServices.get().http.post(TIMELINE_DRAFT_URL, { - body: JSON.stringify({ + try { + requestBody = JSON.stringify({ timelineType, ...templateTimelineInfo, - }), + }); + } catch (err) { + return Promise.reject(new Error(`Failed to stringify query: ${JSON.stringify(err)}`)); + } + const response = await KibanaServices.get().http.post(TIMELINE_DRAFT_URL, { + body: requestBody, }); return decodeTimelineResponse(response); @@ -242,3 +297,94 @@ export const installPrepackedTimelines = async (): Promise { + const response = await KibanaServices.get().http.get(TIMELINE_URL, { + query: { + id, + }, + }); + + return decodeSingleTimelineResponse(response); +}; + +export const getTimelineTemplate = async (templateTimelineId: string) => { + const response = await KibanaServices.get().http.get(TIMELINE_URL, { + query: { + template_timeline_id: templateTimelineId, + }, + }); + + return decodeSingleTimelineResponse(response); +}; + +export const getAllTimelines = async (args: GetTimelinesArgs, abortSignal: AbortSignal) => { + const response = await KibanaServices.get().http.fetch(TIMELINES_URL, { + method: 'GET', + query: { + ...(args.onlyUserFavorite ? { only_user_favorite: args.onlyUserFavorite } : {}), + ...(args?.pageInfo?.pageSize ? { page_size: args.pageInfo.pageSize } : {}), + ...(args?.pageInfo?.pageIndex ? { page_index: args.pageInfo.pageIndex } : {}), + ...(args.search ? { search: args.search } : {}), + ...(args?.sort?.sortField ? { sort_field: args?.sort?.sortField } : {}), + ...(args?.sort?.sortOrder ? { sort_order: args?.sort?.sortOrder } : {}), + ...(args.status ? { status: args.status } : {}), + ...(args.timelineType ? { timeline_type: args.timelineType } : {}), + }, + signal: abortSignal, + }); + + return decodeAllTimelinesResponse(response); +}; + +export const persistFavorite = async ({ + timelineId, + templateTimelineId, + templateTimelineVersion, + timelineType, +}: { + timelineId?: string | null; + templateTimelineId?: string | null; + templateTimelineVersion?: number | null; + timelineType: TimelineType; +}) => { + let requestBody; + + try { + requestBody = JSON.stringify({ + timelineId, + templateTimelineId, + templateTimelineVersion, + timelineType, + }); + } catch (err) { + return Promise.reject(new Error(`Failed to stringify query: ${JSON.stringify(err)}`)); + } + + const response = await KibanaServices.get().http.patch( + TIMELINE_FAVORITE_URL, + { + method: 'PATCH', + body: requestBody, + } + ); + + return decodeResponseFavoriteTimeline(response); +}; + +export const deleteTimelinesByIds = async (savedObjectIds: string[]) => { + let requestBody; + + try { + requestBody = JSON.stringify({ + savedObjectIds, + }); + } catch (err) { + return Promise.reject(new Error(`Failed to stringify query: ${JSON.stringify(err)}`)); + } + const response = await KibanaServices.get().http.delete(TIMELINE_URL, { + method: 'DELETE', + body: requestBody, + }); + return response; +}; diff --git a/x-pack/plugins/security_solution/public/timelines/containers/favorite/persist.gql_query.ts b/x-pack/plugins/security_solution/public/timelines/containers/favorite/persist.gql_query.ts deleted file mode 100644 index f0e31b43af038..0000000000000 --- a/x-pack/plugins/security_solution/public/timelines/containers/favorite/persist.gql_query.ts +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. - */ - -import gql from 'graphql-tag'; - -export const persistTimelineFavoriteMutation = gql` - mutation PersistTimelineFavoriteMutation( - $timelineId: ID - $templateTimelineId: String - $templateTimelineVersion: Int - $timelineType: TimelineType! - ) { - persistFavorite( - timelineId: $timelineId - templateTimelineId: $templateTimelineId - templateTimelineVersion: $templateTimelineVersion - timelineType: $timelineType - ) { - savedObjectId - version - favorite { - fullName - userName - favoriteDate - } - templateTimelineId - templateTimelineVersion - timelineType - } - } -`; diff --git a/x-pack/plugins/security_solution/public/timelines/containers/index.tsx b/x-pack/plugins/security_solution/public/timelines/containers/index.tsx index 5f464b5ed943f..83b511f95bc2a 100644 --- a/x-pack/plugins/security_solution/public/timelines/containers/index.tsx +++ b/x-pack/plugins/security_solution/public/timelines/containers/index.tsx @@ -16,7 +16,6 @@ import { isCompleteResponse, isErrorResponse } from '../../../../../../src/plugi import { inputsModel, KueryFilterQueryKind } from '../../common/store'; import { useKibana } from '../../common/lib/kibana'; import { createFilter } from '../../common/containers/helpers'; -import { DocValueFields } from '../../common/containers/query_template'; import { timelineActions } from '../../timelines/store/timeline'; import { detectionsTimelineIds, skipQueryForDetectionsPage } from './helpers'; import { getInspectResponse } from '../../helpers'; @@ -29,6 +28,7 @@ import { TimelineEdges, TimelineItem, TimelineRequestSortField, + DocValueFields, } from '../../../common/search_strategy'; import { InspectResponse } from '../../types'; import * as i18n from './translations'; diff --git a/x-pack/plugins/security_solution/public/timelines/containers/notes/api.ts b/x-pack/plugins/security_solution/public/timelines/containers/notes/api.ts new file mode 100644 index 0000000000000..53c54f915cb8a --- /dev/null +++ b/x-pack/plugins/security_solution/public/timelines/containers/notes/api.ts @@ -0,0 +1,35 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import { NOTE_URL } from '../../../../common/constants'; +import { NoteSavedObject, SavedNote } from '../../../../common/types/timeline/note'; +import { KibanaServices } from '../../../common/lib/kibana'; + +export const persistNote = async ({ + note, + noteId, + version, + overrideOwner, +}: { + note: SavedNote; + noteId?: string | null; + version?: string | null; + overrideOwner?: boolean; +}) => { + let requestBody; + + try { + requestBody = JSON.stringify({ noteId, version, note, overrideOwner }); + } catch (err) { + return Promise.reject(new Error(`Failed to stringify query: ${JSON.stringify(err)}`)); + } + const response = await KibanaServices.get().http.patch(NOTE_URL, { + method: 'PATCH', + body: requestBody, + }); + return response; +}; diff --git a/x-pack/plugins/security_solution/public/timelines/containers/notes/persist.gql_query.ts b/x-pack/plugins/security_solution/public/timelines/containers/notes/persist.gql_query.ts deleted file mode 100644 index 5fa0d213cbd89..0000000000000 --- a/x-pack/plugins/security_solution/public/timelines/containers/notes/persist.gql_query.ts +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. - */ - -import gql from 'graphql-tag'; - -export const persistTimelineNoteMutation = gql` - mutation PersistTimelineNoteMutation($noteId: ID, $version: String, $note: NoteInput!) { - persistNote(noteId: $noteId, version: $version, note: $note) { - code - message - note { - eventId - note - timelineId - timelineVersion - noteId - created - createdBy - updated - updatedBy - version - } - } - } -`; diff --git a/x-pack/plugins/security_solution/public/timelines/containers/one/index.gql_query.ts b/x-pack/plugins/security_solution/public/timelines/containers/one/index.gql_query.ts deleted file mode 100644 index 97bae5717c7d6..0000000000000 --- a/x-pack/plugins/security_solution/public/timelines/containers/one/index.gql_query.ts +++ /dev/null @@ -1,157 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. - */ - -import gql from 'graphql-tag'; - -export const oneTimelineQuery = gql` - query GetOneTimeline($id: ID!, $timelineType: TimelineType) { - getOneTimeline(id: $id, timelineType: $timelineType) { - savedObjectId - columns { - aggregatable - category - columnHeaderType - description - example - indexes - id - name - searchable - type - } - dataProviders { - id - name - enabled - excluded - kqlQuery - type - queryMatch { - field - displayField - value - displayValue - operator - } - and { - id - name - enabled - excluded - kqlQuery - type - queryMatch { - field - displayField - value - displayValue - operator - } - } - } - dateRange { - start - end - } - description - eqlOptions { - eventCategoryField - tiebreakerField - timestampField - query - size - } - eventType - eventIdToNoteIds { - eventId - note - timelineId - noteId - created - createdBy - timelineVersion - updated - updatedBy - version - } - excludedRowRendererIds - favorite { - fullName - userName - favoriteDate - } - filters { - meta { - alias - controlledBy - disabled - field - formattedValue - index - key - negate - params - type - value - } - query - exists - match_all - missing - range - script - } - kqlMode - kqlQuery { - filterQuery { - kuery { - kind - expression - } - serializedQuery - } - } - indexNames - notes { - eventId - note - timelineId - timelineVersion - noteId - created - createdBy - updated - updatedBy - version - } - noteIds - pinnedEventIds - pinnedEventsSaveObject { - pinnedEventId - eventId - timelineId - created - createdBy - updated - updatedBy - version - } - status - title - timelineType - templateTimelineId - templateTimelineVersion - savedQueryId - sort - created - createdBy - updated - updatedBy - version - } - } -`; diff --git a/x-pack/plugins/security_solution/public/timelines/containers/persist.gql_query.ts b/x-pack/plugins/security_solution/public/timelines/containers/persist.gql_query.ts deleted file mode 100644 index ef050d806a9f2..0000000000000 --- a/x-pack/plugins/security_solution/public/timelines/containers/persist.gql_query.ts +++ /dev/null @@ -1,114 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. - */ - -import gql from 'graphql-tag'; - -export const persistTimelineMutation = gql` - mutation PersistTimelineMutation($timelineId: ID, $version: String, $timeline: TimelineInput!) { - persistTimeline(id: $timelineId, version: $version, timeline: $timeline) { - code - message - timeline { - savedObjectId - version - columns { - aggregatable - category - columnHeaderType - description - example - indexes - id - name - searchable - type - } - dataProviders { - id - name - enabled - excluded - kqlQuery - type - queryMatch { - field - displayField - value - displayValue - operator - } - and { - id - name - enabled - excluded - kqlQuery - type - queryMatch { - field - displayField - value - displayValue - operator - } - } - } - description - eventType - excludedRowRendererIds - favorite { - fullName - userName - favoriteDate - } - filters { - meta { - alias - controlledBy - disabled - field - formattedValue - index - key - negate - params - type - value - } - query - exists - match_all - missing - range - script - } - kqlMode - kqlQuery { - filterQuery { - kuery { - kind - expression - } - serializedQuery - } - } - indexNames - title - dateRange { - start - end - } - savedQueryId - sort - created - createdBy - updated - updatedBy - } - } - } -`; diff --git a/x-pack/plugins/security_solution/public/timelines/containers/pinned_event/api.ts b/x-pack/plugins/security_solution/public/timelines/containers/pinned_event/api.ts new file mode 100644 index 0000000000000..c43a16df09062 --- /dev/null +++ b/x-pack/plugins/security_solution/public/timelines/containers/pinned_event/api.ts @@ -0,0 +1,31 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ +import { PINNED_EVENT_URL } from '../../../../common/constants'; +import { PinnedEvent } from '../../../../common/types/timeline/pinned_event'; +import { KibanaServices } from '../../../common/lib/kibana'; + +export const persistPinnedEvent = async ({ + eventId, + pinnedEventId, + timelineId, +}: { + eventId: string; + pinnedEventId?: string | null; + timelineId?: string | null; +}) => { + let requestBody; + try { + requestBody = JSON.stringify({ eventId, pinnedEventId, timelineId }); + } catch (err) { + return Promise.reject(new Error(`Failed to stringify query: ${JSON.stringify(err)}`)); + } + const response = await KibanaServices.get().http.patch(PINNED_EVENT_URL, { + method: 'PATCH', + body: requestBody, + }); + return response; +}; diff --git a/x-pack/plugins/security_solution/public/timelines/containers/pinned_event/persist.gql_query.ts b/x-pack/plugins/security_solution/public/timelines/containers/pinned_event/persist.gql_query.ts deleted file mode 100644 index 5ac2e367a7ab4..0000000000000 --- a/x-pack/plugins/security_solution/public/timelines/containers/pinned_event/persist.gql_query.ts +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. - */ - -import gql from 'graphql-tag'; - -export const persistTimelinePinnedEventMutation = gql` - mutation PersistTimelinePinnedEventMutation($pinnedEventId: ID, $eventId: ID!, $timelineId: ID) { - persistPinnedEventOnTimeline( - pinnedEventId: $pinnedEventId - eventId: $eventId - timelineId: $timelineId - ) { - pinnedEventId - eventId - timelineId - timelineVersion - created - createdBy - updated - updatedBy - version - } - } -`; diff --git a/x-pack/plugins/security_solution/public/timelines/store/timeline/defaults.ts b/x-pack/plugins/security_solution/public/timelines/store/timeline/defaults.ts index df79ff1d2b309..7e76f6035f8b5 100644 --- a/x-pack/plugins/security_solution/public/timelines/store/timeline/defaults.ts +++ b/x-pack/plugins/security_solution/public/timelines/store/timeline/defaults.ts @@ -7,10 +7,10 @@ import { TimelineType, TimelineStatus, TimelineTabs } from '../../../../common/types/timeline'; -import { Direction } from '../../../graphql/types'; import { defaultHeaders } from '../../components/timeline/body/column_headers/default_headers'; import { normalizeTimeRange } from '../../../common/components/url_state/normalize_time_range'; import { SubsetTimelineModel, TimelineModel } from './model'; +import { Direction } from '../../../../common/search_strategy'; // normalizeTimeRange uses getTimeRangeSettings which cannot be used outside Kibana context if the uiSettings is not false const { from: start, to: end } = normalizeTimeRange({ from: '', to: '' }, false); diff --git a/x-pack/plugins/security_solution/public/timelines/store/timeline/epic.test.ts b/x-pack/plugins/security_solution/public/timelines/store/timeline/epic.test.ts index 0bc1c5d57fa33..c8e8e00caf530 100644 --- a/x-pack/plugins/security_solution/public/timelines/store/timeline/epic.test.ts +++ b/x-pack/plugins/security_solution/public/timelines/store/timeline/epic.test.ts @@ -6,8 +6,8 @@ */ import { Filter, esFilters } from '../../../../../../../src/plugins/data/public'; +import { Direction } from '../../../../common/search_strategy'; import { TimelineType, TimelineStatus, TimelineTabs } from '../../../../common/types/timeline'; -import { Direction } from '../../../graphql/types'; import { convertTimelineAsInput } from './epic'; import { TimelineModel } from './model'; diff --git a/x-pack/plugins/security_solution/public/timelines/store/timeline/epic.ts b/x-pack/plugins/security_solution/public/timelines/store/timeline/epic.ts index ac510401fc186..30d09da2f736d 100644 --- a/x-pack/plugins/security_solution/public/timelines/store/timeline/epic.ts +++ b/x-pack/plugins/security_solution/public/timelines/store/timeline/epic.ts @@ -35,14 +35,14 @@ import { Filter, MatchAllFilter, } from '../../../../../../.../../../src/plugins/data/public'; -import { TimelineStatus, TimelineErrorResponse } from '../../../../common/types/timeline'; -import { inputsModel } from '../../../common/store/inputs'; import { + TimelineStatus, + TimelineErrorResponse, TimelineType, - TimelineInput, ResponseTimeline, TimelineResult, -} from '../../../graphql/types'; +} from '../../../../common/types/timeline'; +import { inputsModel } from '../../../common/store/inputs'; import { addError } from '../../../common/store/app/actions'; import { persistTimeline } from '../../containers/api'; @@ -89,6 +89,7 @@ import { isNotNull } from './helpers'; import { dispatcherTimelinePersistQueue } from './epic_dispatcher_timeline_persistence_queue'; import { myEpicTimelineId } from './my_epic_timeline_id'; import { ActionTimeline, TimelineEpicDependencies } from './types'; +import { TimelineInput } from '../../../../common/search_strategy'; const timelineActionsType = [ applyKqlFilterQuery.type, @@ -133,7 +134,6 @@ export const createTimelineEpic = (): Epic< selectNotesByIdSelector, timelineByIdSelector, timelineTimeRangeSelector, - apolloClient$, kibana$, } ) => { @@ -195,8 +195,8 @@ export const createTimelineEpic = (): Epic< ), dispatcherTimelinePersistQueue.pipe( delay(500), - withLatestFrom(timeline$, apolloClient$, notes$, timelineTimeRange$), - concatMap(([objAction, timeline, apolloClient, notes, timelineTimeRange]) => { + withLatestFrom(timeline$, notes$, timelineTimeRange$), + concatMap(([objAction, timeline, notes, timelineTimeRange]) => { const action: ActionTimeline = get('action', objAction); const timelineId = myEpicTimelineId.getTimelineId(); const version = myEpicTimelineId.getTimelineVersion(); @@ -205,7 +205,6 @@ export const createTimelineEpic = (): Epic< if (timelineNoteActionsType.includes(action.type)) { return epicPersistNote( - apolloClient, action, timeline, notes, @@ -215,17 +214,9 @@ export const createTimelineEpic = (): Epic< allTimelineQuery$ ); } else if (timelinePinnedEventActionsType.includes(action.type)) { - return epicPersistPinnedEvent( - apolloClient, - action, - timeline, - action$, - timeline$, - allTimelineQuery$ - ); + return epicPersistPinnedEvent(action, timeline, action$, timeline$, allTimelineQuery$); } else if (timelineFavoriteActionsType.includes(action.type)) { return epicPersistTimelineFavorite( - apolloClient, action, timeline, action$, diff --git a/x-pack/plugins/security_solution/public/timelines/store/timeline/epic_favorite.ts b/x-pack/plugins/security_solution/public/timelines/store/timeline/epic_favorite.ts index 0e1ebf6b246e2..ae314f54715cd 100644 --- a/x-pack/plugins/security_solution/public/timelines/store/timeline/epic_favorite.ts +++ b/x-pack/plugins/security_solution/public/timelines/store/timeline/epic_favorite.ts @@ -5,16 +5,12 @@ * 2.0. */ -import { NormalizedCacheObject } from 'apollo-cache-inmemory'; -import { ApolloClient } from 'apollo-client'; import { get } from 'lodash/fp'; import { Action } from 'redux'; import { Epic } from 'redux-observable'; import { from, Observable, empty } from 'rxjs'; import { filter, mergeMap, withLatestFrom, startWith, takeUntil } from 'rxjs/operators'; -import { persistTimelineFavoriteMutation } from '../../containers/favorite/persist.gql_query'; -import { PersistTimelineFavoriteMutation, ResponseFavoriteTimeline } from '../../../graphql/types'; import { addError } from '../../../common/store/app/actions'; import { endTimelineSaving, @@ -24,16 +20,15 @@ import { showCallOutUnauthorizedMsg, } from './actions'; import { dispatcherTimelinePersistQueue } from './epic_dispatcher_timeline_persistence_queue'; -import { refetchQueries } from './refetch_queries'; import { myEpicTimelineId } from './my_epic_timeline_id'; import { ActionTimeline, TimelineById } from './types'; import { inputsModel } from '../../../common/store/inputs'; -import { TimelineType } from '../../../../common/types/timeline'; +import { ResponseFavoriteTimeline, TimelineType } from '../../../../common/types/timeline'; +import { persistFavorite } from '../../containers/api'; export const timelineFavoriteActionsType = [updateIsFavorite.type]; export const epicPersistTimelineFavorite = ( - apolloClient: ApolloClient, action: ActionTimeline, timeline: TimelineById, action$: Observable, @@ -42,19 +37,11 @@ export const epicPersistTimelineFavorite = ( // eslint-disable-next-line @typescript-eslint/no-explicit-any ): Observable => from( - apolloClient.mutate< - PersistTimelineFavoriteMutation.Mutation, - PersistTimelineFavoriteMutation.Variables - >({ - mutation: persistTimelineFavoriteMutation, - fetchPolicy: 'no-cache', - variables: { - timelineId: myEpicTimelineId.getTimelineId(), - templateTimelineId: timeline[action.payload.id].templateTimelineId, - templateTimelineVersion: timeline[action.payload.id].templateTimelineVersion, - timelineType: timeline[action.payload.id].timelineType ?? TimelineType.default, - }, - refetchQueries, + persistFavorite({ + timelineId: myEpicTimelineId.getTimelineId(), + templateTimelineId: timeline[action.payload.id].templateTimelineId, + templateTimelineVersion: timeline[action.payload.id].templateTimelineVersion, + timelineType: timeline[action.payload.id].timelineType ?? TimelineType.default, }) ).pipe( withLatestFrom(timeline$, allTimelineQuery$), diff --git a/x-pack/plugins/security_solution/public/timelines/store/timeline/epic_local_storage.test.tsx b/x-pack/plugins/security_solution/public/timelines/store/timeline/epic_local_storage.test.tsx index 0b70ba8991686..01bc589393d2e 100644 --- a/x-pack/plugins/security_solution/public/timelines/store/timeline/epic_local_storage.test.tsx +++ b/x-pack/plugins/security_solution/public/timelines/store/timeline/epic_local_storage.test.tsx @@ -14,7 +14,6 @@ import '../../../common/mock/match_media'; import { mockGlobalState, SUB_PLUGINS_REDUCER, - apolloClientObservable, TestProviders, defaultHeaders, createSecuritySolutionStorageMock, @@ -38,11 +37,11 @@ import { import { defaultRowRenderers } from '../../components/timeline/body/renderers'; import { mockDataProviders } from '../../components/timeline/data_providers/mock/mock_data_providers'; import { Sort } from '../../components/timeline/body/sort'; -import { Direction } from '../../../graphql/types'; import { addTimelineInStorage } from '../../containers/local_storage'; import { isPageTimeline } from './epic_local_storage'; import { TimelineId, TimelineStatus, TimelineTabs } from '../../../../common/types/timeline'; +import { Direction } from '../../../../common/search_strategy'; jest.mock('../../containers/local_storage'); @@ -51,13 +50,7 @@ const addTimelineInStorageMock = addTimelineInStorage as jest.Mock; describe('epicLocalStorage', () => { const state: State = mockGlobalState; const { storage } = createSecuritySolutionStorageMock(); - let store = createStore( - state, - SUB_PLUGINS_REDUCER, - apolloClientObservable, - kibanaObservable, - storage - ); + let store = createStore(state, SUB_PLUGINS_REDUCER, kibanaObservable, storage); let props = {} as QueryTabContentComponentProps; const sort: Sort[] = [ @@ -71,13 +64,7 @@ describe('epicLocalStorage', () => { const endDate = '2018-03-24T03:33:52.253Z'; beforeEach(() => { - store = createStore( - state, - SUB_PLUGINS_REDUCER, - apolloClientObservable, - kibanaObservable, - storage - ); + store = createStore(state, SUB_PLUGINS_REDUCER, kibanaObservable, storage); props = { columns: defaultHeaders, dataProviders: mockDataProviders, diff --git a/x-pack/plugins/security_solution/public/timelines/store/timeline/epic_note.ts b/x-pack/plugins/security_solution/public/timelines/store/timeline/epic_note.ts index a2d64deb4c66c..974bd9d998c0a 100644 --- a/x-pack/plugins/security_solution/public/timelines/store/timeline/epic_note.ts +++ b/x-pack/plugins/security_solution/public/timelines/store/timeline/epic_note.ts @@ -5,16 +5,12 @@ * 2.0. */ -import { ApolloClient } from 'apollo-client'; -import { NormalizedCacheObject } from 'apollo-cache-inmemory'; import { get } from 'lodash/fp'; import { Action } from 'redux'; import { Epic } from 'redux-observable'; import { from, empty, Observable } from 'rxjs'; import { filter, mergeMap, switchMap, withLatestFrom, startWith, takeUntil } from 'rxjs/operators'; -import { persistTimelineNoteMutation } from '../../../timelines/containers/notes/persist.gql_query'; -import { PersistTimelineNoteMutation, ResponseNote } from '../../../graphql/types'; import { updateNote, addError } from '../../../common/store/app/actions'; import { NotesById } from '../../../common/store/app/model'; import { inputsModel } from '../../../common/store/inputs'; @@ -28,14 +24,14 @@ import { showCallOutUnauthorizedMsg, } from './actions'; import { myEpicTimelineId } from './my_epic_timeline_id'; -import { refetchQueries } from './refetch_queries'; import { dispatcherTimelinePersistQueue } from './epic_dispatcher_timeline_persistence_queue'; import { ActionTimeline, TimelineById } from './types'; +import { persistNote } from '../../containers/notes/api'; +import { ResponseNote } from '../../../../common/types/timeline/note'; export const timelineNoteActionsType = [addNote.type, addNoteToEvent.type]; export const epicPersistNote = ( - apolloClient: ApolloClient, action: ActionTimeline, timeline: TimelineById, notes: NotesById, @@ -46,22 +42,14 @@ export const epicPersistNote = ( // eslint-disable-next-line @typescript-eslint/no-explicit-any ): Observable => from( - apolloClient.mutate< - PersistTimelineNoteMutation.Mutation, - PersistTimelineNoteMutation.Variables - >({ - mutation: persistTimelineNoteMutation, - fetchPolicy: 'no-cache', - variables: { - noteId: null, - version: null, - note: { - eventId: action.payload.eventId, - note: getNote(action.payload.noteId, notes), - timelineId: myEpicTimelineId.getTimelineId(), - }, + persistNote({ + noteId: null, + version: null, + note: { + eventId: action.payload.eventId, + note: getNote(action.payload.noteId, notes), + timelineId: myEpicTimelineId.getTimelineId(), }, - refetchQueries, }) ).pipe( withLatestFrom(timeline$, notes$, allTimelineQuery$), diff --git a/x-pack/plugins/security_solution/public/timelines/store/timeline/epic_pinned_event.ts b/x-pack/plugins/security_solution/public/timelines/store/timeline/epic_pinned_event.ts index bd5cf879d47ef..c6c348615af27 100644 --- a/x-pack/plugins/security_solution/public/timelines/store/timeline/epic_pinned_event.ts +++ b/x-pack/plugins/security_solution/public/timelines/store/timeline/epic_pinned_event.ts @@ -5,19 +5,15 @@ * 2.0. */ -import { NormalizedCacheObject } from 'apollo-cache-inmemory'; -import { ApolloClient } from 'apollo-client'; import { get, omit } from 'lodash/fp'; import { Action } from 'redux'; import { Epic } from 'redux-observable'; import { from, Observable, empty } from 'rxjs'; import { filter, mergeMap, startWith, withLatestFrom, takeUntil } from 'rxjs/operators'; -import { persistTimelinePinnedEventMutation } from '../../../timelines/containers/pinned_event/persist.gql_query'; -import { PersistTimelinePinnedEventMutation, PinnedEvent } from '../../../graphql/types'; import { addError } from '../../../common/store/app/actions'; import { inputsModel } from '../../../common/store/inputs'; - +import { PinnedEvent } from '../../../../common/types/timeline/pinned_event'; import { pinEvent, endTimelineSaving, @@ -27,14 +23,13 @@ import { showCallOutUnauthorizedMsg, } from './actions'; import { myEpicTimelineId } from './my_epic_timeline_id'; -import { refetchQueries } from './refetch_queries'; import { dispatcherTimelinePersistQueue } from './epic_dispatcher_timeline_persistence_queue'; import { ActionTimeline, TimelineById } from './types'; +import { persistPinnedEvent } from '../../containers/pinned_event/api'; export const timelinePinnedEventActionsType = [pinEvent.type, unPinEvent.type]; export const epicPersistPinnedEvent = ( - apolloClient: ApolloClient, action: ActionTimeline, timeline: TimelineById, action$: Observable, @@ -43,22 +38,13 @@ export const epicPersistPinnedEvent = ( // eslint-disable-next-line @typescript-eslint/no-explicit-any ): Observable => from( - apolloClient.mutate< - PersistTimelinePinnedEventMutation.Mutation, - PersistTimelinePinnedEventMutation.Variables - >({ - mutation: persistTimelinePinnedEventMutation, - fetchPolicy: 'no-cache', - variables: { - pinnedEventId: - timeline[action.payload.id].pinnedEventsSaveObject[action.payload.eventId] != null - ? timeline[action.payload.id].pinnedEventsSaveObject[action.payload.eventId] - .pinnedEventId - : null, - eventId: action.payload.eventId, - timelineId: myEpicTimelineId.getTimelineId(), - }, - refetchQueries, + persistPinnedEvent({ + pinnedEventId: + timeline[action.payload.id].pinnedEventsSaveObject[action.payload.eventId] != null + ? timeline[action.payload.id].pinnedEventsSaveObject[action.payload.eventId].pinnedEventId + : null, + eventId: action.payload.eventId, + timelineId: myEpicTimelineId.getTimelineId(), }) ).pipe( withLatestFrom(timeline$, allTimelineQuery$), diff --git a/x-pack/plugins/security_solution/public/timelines/store/timeline/model.ts b/x-pack/plugins/security_solution/public/timelines/store/timeline/model.ts index a899994ad4aab..faece61cf9b7e 100644 --- a/x-pack/plugins/security_solution/public/timelines/store/timeline/model.ts +++ b/x-pack/plugins/security_solution/public/timelines/store/timeline/model.ts @@ -9,7 +9,6 @@ import { Filter, IFieldSubType } from '../../../../../../../src/plugins/data/pub import { DataProvider } from '../../components/timeline/data_providers/data_provider'; import { Sort } from '../../components/timeline/body/sort'; -import { PinnedEvent } from '../../../graphql/types'; import { EqlOptionsSelected, TimelineNonEcsData, @@ -23,6 +22,7 @@ import type { RowRendererId, TimelineTabs, } from '../../../../common/types/timeline'; +import { PinnedEvent } from '../../../../common/types/timeline/pinned_event'; export const DEFAULT_PAGE_COUNT = 2; // Eui Pager will not render unless this is a minimum of 2 pages export type KqlMode = 'filter' | 'search'; diff --git a/x-pack/plugins/security_solution/public/timelines/store/timeline/reducer.test.ts b/x-pack/plugins/security_solution/public/timelines/store/timeline/reducer.test.ts index e464637c469f8..d467747346b8b 100644 --- a/x-pack/plugins/security_solution/public/timelines/store/timeline/reducer.test.ts +++ b/x-pack/plugins/security_solution/public/timelines/store/timeline/reducer.test.ts @@ -22,7 +22,6 @@ import { import { defaultColumnHeaderType } from '../../../timelines/components/timeline/body/column_headers/default_headers'; import { DEFAULT_COLUMN_MIN_WIDTH } from '../../../timelines/components/timeline/body/constants'; import { getColumnWidthFromType } from '../../../timelines/components/timeline/body/column_headers/helpers'; -import { Direction } from '../../../graphql/types'; import { defaultHeaders } from '../../../common/mock'; import { @@ -49,6 +48,7 @@ import { import { ColumnHeaderOptions, TimelineModel } from './model'; import { timelineDefaults } from './defaults'; import { TimelineById } from './types'; +import { Direction } from '../../../../common/search_strategy'; jest.mock('../../../common/components/url_state/normalize_time_range.ts'); jest.mock('../../../common/utils/default_date_settings', () => { diff --git a/x-pack/plugins/security_solution/public/timelines/store/timeline/refetch_queries.ts b/x-pack/plugins/security_solution/public/timelines/store/timeline/refetch_queries.ts deleted file mode 100644 index 962b809caf884..0000000000000 --- a/x-pack/plugins/security_solution/public/timelines/store/timeline/refetch_queries.ts +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. - */ - -import { allTimelinesQuery } from '../../../timelines/containers/all/index.gql_query'; -import { Direction } from '../../../graphql/types'; -import { DEFAULT_SORT_FIELD } from '../../../timelines/components/open_timeline/constants'; - -export const refetchQueries = [ - { - query: allTimelinesQuery, - variables: { - search: '', - pageInfo: { - pageIndex: 1, - pageSize: 10, - }, - sort: { sortField: DEFAULT_SORT_FIELD, sortOrder: Direction.desc }, - onlyUserFavorite: false, - }, - }, -]; diff --git a/x-pack/plugins/security_solution/public/timelines/store/timeline/types.ts b/x-pack/plugins/security_solution/public/timelines/store/timeline/types.ts index d227c496610c3..d4a96d036bd5f 100644 --- a/x-pack/plugins/security_solution/public/timelines/store/timeline/types.ts +++ b/x-pack/plugins/security_solution/public/timelines/store/timeline/types.ts @@ -9,7 +9,6 @@ import { Action } from 'redux'; import { Observable } from 'rxjs'; import { Storage } from '../../../../../../../src/plugins/kibana_utils/public'; -import { AppApolloClient } from '../../../common/lib/lib'; import { inputsModel } from '../../../common/store/inputs'; import { NotesById } from '../../../common/store/app/model'; @@ -56,7 +55,6 @@ export interface TimelineEpicDependencies { timelineTimeRangeSelector: (state: State) => inputsModel.TimeRange; selectAllTimelineQuery: () => (state: State, id: string) => inputsModel.GlobalQuery; selectNotesByIdSelector: (state: State) => NotesById; - apolloClient$: Observable; kibana$: Observable; storage: Storage; } diff --git a/x-pack/plugins/security_solution/public/types.ts b/x-pack/plugins/security_solution/public/types.ts index e88077679e1b6..7b9cd2f6e1db5 100644 --- a/x-pack/plugins/security_solution/public/types.ts +++ b/x-pack/plugins/security_solution/public/types.ts @@ -5,7 +5,6 @@ * 2.0. */ -import { AppFrontendLibs } from './common/lib/lib'; import { CoreStart } from '../../../../src/core/public'; import { HomePublicPluginSetup } from '../../../../src/plugins/home/public'; import { DataPublicPluginStart } from '../../../../src/plugins/data/public'; @@ -71,7 +70,7 @@ export interface PluginSetup { // eslint-disable-next-line @typescript-eslint/no-empty-interface export interface PluginStart {} -export interface AppObservableLibs extends AppFrontendLibs { +export interface AppObservableLibs { kibana: CoreStart; } diff --git a/x-pack/plugins/security_solution/scripts/combined_schema.ts b/x-pack/plugins/security_solution/scripts/combined_schema.ts deleted file mode 100644 index d6b401f58c853..0000000000000 --- a/x-pack/plugins/security_solution/scripts/combined_schema.ts +++ /dev/null @@ -1,18 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. - */ - -import { buildSchemaFromTypeDefinitions } from 'graphql-tools'; - -// eslint-disable-next-line @kbn/eslint/no-restricted-paths -import { schemas as serverSchemas } from '../server/graphql'; - -export const schemas = [...serverSchemas]; - -// this default export is used to feed the combined types to the gql-gen tool -// which generates the corresponding typescript types -// eslint-disable-next-line import/no-default-export -export default buildSchemaFromTypeDefinitions(schemas); diff --git a/x-pack/plugins/security_solution/scripts/generate_types_from_graphql.js b/x-pack/plugins/security_solution/scripts/generate_types_from_graphql.js deleted file mode 100644 index 3d371333eea8e..0000000000000 --- a/x-pack/plugins/security_solution/scripts/generate_types_from_graphql.js +++ /dev/null @@ -1,146 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. - */ - -require('../../../../src/setup_node_env'); - -const { join, resolve } = require('path'); -// eslint-disable-next-line import/no-extraneous-dependencies, import/no-unresolved -const { generate } = require('graphql-code-generator'); - -const GRAPHQL_GLOBS = [ - join('public', '**', '*.gql_query.ts{,x}'), - join('common', 'graphql', '**', '*.gql_query.ts{,x}'), -]; -const OUTPUT_INTROSPECTION_PATH = resolve('public', 'graphql', 'introspection.json'); -const OUTPUT_CLIENT_TYPES_PATH = resolve('public', 'graphql', 'types.ts'); -const OUTPUT_SERVER_TYPES_PATH = resolve('server', 'graphql', 'types.ts'); -const SCHEMA_PATH = resolve(__dirname, 'combined_schema.ts'); - -async function main() { - await generate( - { - schema: SCHEMA_PATH, - overwrite: true, - generates: { - [OUTPUT_INTROSPECTION_PATH]: { - documents: GRAPHQL_GLOBS, - primitives: { - String: 'string', - Int: 'number', - Float: 'number', - Boolean: 'boolean', - ID: 'string', - }, - config: { - namingConvention: { - typeNames: 'change-case#pascalCase', - enumValues: 'keep', - }, - contextType: 'SiemContext', - scalars: { - ToStringArray: 'string[] | string', - ToNumberArray: 'number[] | number', - ToDateArray: 'string[] | string', - ToBooleanArray: 'boolean[] | boolean', - Date: 'string', - }, - }, - plugins: ['introspection'], - }, - [OUTPUT_CLIENT_TYPES_PATH]: { - documents: GRAPHQL_GLOBS, - primitives: { - String: 'string', - Int: 'number', - Float: 'number', - Boolean: 'boolean', - ID: 'string', - }, - config: { - avoidOptionals: false, - namingConvention: { - typeNames: 'change-case#pascalCase', - enumValues: 'keep', - }, - contextType: 'SiemContext', - scalars: { - ToStringArray: 'string[]', - ToNumberArray: 'number[]', - ToDateArray: 'string[]', - ToBooleanArray: 'boolean[]', - Date: 'string', - }, - }, - plugins: [ - { - add: `/* tslint:disable */ - /* eslint-disable */ - /* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. - */ - `, - }, - 'typescript-common', - 'typescript-server', - 'typescript-client', - ], - }, - [OUTPUT_SERVER_TYPES_PATH]: { - primitives: { - String: 'string', - Int: 'number', - Float: 'number', - Boolean: 'boolean', - ID: 'string', - }, - config: { - avoidOptionals: false, - namingConvention: { - typeNames: 'change-case#pascalCase', - enumValues: 'keep', - }, - contextType: 'SiemContext', - scalars: { - ToStringArray: 'string[] | string', - ToNumberArray: 'number[] | number', - ToDateArray: 'string[] | string', - ToBooleanArray: 'boolean[] | boolean', - Date: 'string', - }, - }, - plugins: [ - { - add: ` - /* tslint:disable */ - /* eslint-disable */ - /* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. - */ - - import { SiemContext } from '../lib/types'; - `, - }, - 'typescript-common', - 'typescript-server', - 'typescript-resolvers', - ], - }, - }, - }, - true - ); -} - -if (require.main === module) { - main(); -} diff --git a/x-pack/plugins/security_solution/server/endpoint/mocks.ts b/x-pack/plugins/security_solution/server/endpoint/mocks.ts index d1911a39166dc..ba490bf362cc7 100644 --- a/x-pack/plugins/security_solution/server/endpoint/mocks.ts +++ b/x-pack/plugins/security_solution/server/endpoint/mocks.ts @@ -87,6 +87,7 @@ export const createMockEndpointAppContextServiceStartContract = (): jest.Mocked< Parameters >(), exceptionListsClient: listMock.getExceptionListClient(), + packagePolicyService: createPackagePolicyServiceMock(), }; }; diff --git a/x-pack/plugins/security_solution/server/endpoint/routes/metadata/handlers.ts b/x-pack/plugins/security_solution/server/endpoint/routes/metadata/handlers.ts index e6a676454a279..0d59ff2f4ed7b 100644 --- a/x-pack/plugins/security_solution/server/endpoint/routes/metadata/handlers.ts +++ b/x-pack/plugins/security_solution/server/endpoint/routes/metadata/handlers.ts @@ -82,6 +82,7 @@ export const getMetadataListRequestHandler = function ( const unenrolledAgentIds = await findAllUnenrolledAgentIds( agentService, + endpointAppContext.service.getPackagePolicyService()!, context.core.savedObjects.client, context.core.elasticsearch.client.asCurrentUser ); diff --git a/x-pack/plugins/security_solution/server/endpoint/routes/metadata/metadata.test.ts b/x-pack/plugins/security_solution/server/endpoint/routes/metadata/metadata.test.ts index e052a653242b7..f4698cbed6203 100644 --- a/x-pack/plugins/security_solution/server/endpoint/routes/metadata/metadata.test.ts +++ b/x-pack/plugins/security_solution/server/endpoint/routes/metadata/metadata.test.ts @@ -34,7 +34,10 @@ import { createMockPackageService, createRouteHandlerContext, } from '../../mocks'; -import { EndpointAppContextService } from '../../endpoint_app_context_services'; +import { + EndpointAppContextService, + EndpointAppContextServiceStartContract, +} from '../../endpoint_app_context_services'; import { createMockConfig } from '../../../lib/detection_engine/routes/__mocks__'; import { EndpointDocGenerator } from '../../../../common/endpoint/generate_data'; import { @@ -46,6 +49,7 @@ import { createV1SearchResponse, createV2SearchResponse } from './support/test_s import { PackageService } from '../../../../../fleet/server/services'; import { metadataTransformPrefix } from '../../../../common/endpoint/constants'; import type { SecuritySolutionPluginRouter } from '../../../types'; +import { PackagePolicyServiceInterface } from '../../../../../fleet/server'; describe('test endpoint route', () => { let routerMock: jest.Mocked; @@ -63,6 +67,7 @@ describe('test endpoint route', () => { ReturnType >['agentService']; let endpointAppContextService: EndpointAppContextService; + let startContract: EndpointAppContextServiceStartContract; const noUnenrolledAgent = { agents: [], total: 0, @@ -77,12 +82,23 @@ describe('test endpoint route', () => { mockClusterClient.asScoped.mockReturnValue(mockScopedClient); routerMock = httpServiceMock.createRouter(); mockResponse = httpServerMock.createResponseFactory(); + startContract = createMockEndpointAppContextServiceStartContract(); + + (startContract.packagePolicyService as jest.Mocked).list.mockImplementation( + () => { + return Promise.resolve({ + items: [], + total: 0, + page: 1, + perPage: 1000, + }); + } + ); }); describe('with no transform package', () => { beforeEach(() => { endpointAppContextService = new EndpointAppContextService(); - const startContract = createMockEndpointAppContextServiceStartContract(); mockPackageService = createMockPackageService(); mockPackageService.getInstalledEsAssetReferences.mockReturnValue( Promise.resolve(([] as unknown) as EsAssetReference[]) @@ -169,7 +185,6 @@ describe('test endpoint route', () => { describe('with new transform package', () => { beforeEach(() => { endpointAppContextService = new EndpointAppContextService(); - const startContract = createMockEndpointAppContextServiceStartContract(); mockPackageService = createMockPackageService(); mockPackageService.getInstalledEsAssetReferences.mockReturnValue( Promise.resolve([ diff --git a/x-pack/plugins/security_solution/server/endpoint/routes/metadata/metadata_v1.test.ts b/x-pack/plugins/security_solution/server/endpoint/routes/metadata/metadata_v1.test.ts index 97b0dd7f1509e..e3f859c26601e 100644 --- a/x-pack/plugins/security_solution/server/endpoint/routes/metadata/metadata_v1.test.ts +++ b/x-pack/plugins/security_solution/server/endpoint/routes/metadata/metadata_v1.test.ts @@ -33,7 +33,10 @@ import { createMockPackageService, createRouteHandlerContext, } from '../../mocks'; -import { EndpointAppContextService } from '../../endpoint_app_context_services'; +import { + EndpointAppContextService, + EndpointAppContextServiceStartContract, +} from '../../endpoint_app_context_services'; import { createMockConfig } from '../../../lib/detection_engine/routes/__mocks__'; import { EndpointDocGenerator } from '../../../../common/endpoint/generate_data'; import { parseExperimentalConfigValue } from '../../../../common/experimental_features'; @@ -41,6 +44,7 @@ import { Agent, EsAssetReference } from '../../../../../fleet/common/types/model import { createV1SearchResponse } from './support/test_support'; import { PackageService } from '../../../../../fleet/server/services'; import type { SecuritySolutionPluginRouter } from '../../../types'; +import { PackagePolicyServiceInterface } from '../../../../../fleet/server'; describe('test endpoint route v1', () => { let routerMock: jest.Mocked; @@ -58,6 +62,7 @@ describe('test endpoint route v1', () => { ReturnType >['agentService']; let endpointAppContextService: EndpointAppContextService; + let startContract: EndpointAppContextServiceStartContract; const noUnenrolledAgent = { agents: [], total: 0, @@ -77,10 +82,21 @@ describe('test endpoint route v1', () => { mockPackageService.getInstalledEsAssetReferences.mockReturnValue( Promise.resolve(([] as unknown) as EsAssetReference[]) ); - const startContract = createMockEndpointAppContextServiceStartContract(); + startContract = createMockEndpointAppContextServiceStartContract(); endpointAppContextService.start({ ...startContract, packageService: mockPackageService }); mockAgentService = startContract.agentService!; + (startContract.packagePolicyService as jest.Mocked).list.mockImplementation( + () => { + return Promise.resolve({ + items: [], + total: 0, + page: 1, + perPage: 1000, + }); + } + ); + registerEndpointRoutes(routerMock, { logFactory: loggingSystemMock.create(), service: endpointAppContextService, diff --git a/x-pack/plugins/security_solution/server/endpoint/routes/metadata/support/unenroll.test.ts b/x-pack/plugins/security_solution/server/endpoint/routes/metadata/support/unenroll.test.ts index 0d6d8550cb933..8efbc1940ea7d 100644 --- a/x-pack/plugins/security_solution/server/endpoint/routes/metadata/support/unenroll.test.ts +++ b/x-pack/plugins/security_solution/server/endpoint/routes/metadata/support/unenroll.test.ts @@ -12,20 +12,45 @@ import { savedObjectsClientMock, } from '../../../../../../../../src/core/server/mocks'; import { AgentService } from '../../../../../../fleet/server/services'; -import { createMockAgentService } from '../../../../../../fleet/server/mocks'; -import { Agent } from '../../../../../../fleet/common/types/models'; +import { + createMockAgentService, + createPackagePolicyServiceMock, +} from '../../../../../../fleet/server/mocks'; +import { Agent, PackagePolicy } from '../../../../../../fleet/common/types/models'; +import { PackagePolicyServiceInterface } from '../../../../../../fleet/server'; describe('test find all unenrolled Agent id', () => { let mockSavedObjectClient: jest.Mocked; let mockElasticsearchClient: jest.Mocked; let mockAgentService: jest.Mocked; + let mockPackagePolicyService: jest.Mocked; + beforeEach(() => { mockSavedObjectClient = savedObjectsClientMock.create(); mockElasticsearchClient = elasticsearchServiceMock.createClusterClient().asInternalUser; mockAgentService = createMockAgentService(); + mockPackagePolicyService = createPackagePolicyServiceMock(); }); it('can find all unerolled endpoint agent ids', async () => { + mockPackagePolicyService.list + .mockResolvedValueOnce({ + items: [ + ({ + id: '1', + policy_id: 'abc123', + } as unknown) as PackagePolicy, + ], + total: 1, + perPage: 10, + page: 1, + }) + .mockResolvedValueOnce({ + items: [], + total: 1, + perPage: 10, + page: 1, + }); mockAgentService.listAgents .mockImplementationOnce(() => Promise.resolve({ @@ -61,10 +86,24 @@ describe('test find all unenrolled Agent id', () => { ); const agentIds = await findAllUnenrolledAgentIds( mockAgentService, + mockPackagePolicyService, mockSavedObjectClient, mockElasticsearchClient ); + expect(agentIds).toBeTruthy(); expect(agentIds).toEqual(['id1', 'id2']); + + expect(mockPackagePolicyService.list).toHaveBeenNthCalledWith(1, mockSavedObjectClient, { + kuery: 'ingest-package-policies.package.name:endpoint', + page: 1, + perPage: 1000, + }); + expect(mockAgentService.listAgents).toHaveBeenNthCalledWith(1, mockElasticsearchClient, { + page: 1, + perPage: 1000, + showInactive: true, + kuery: '(active : false) OR (active: true AND NOT policy_id:("abc123"))', + }); }); }); diff --git a/x-pack/plugins/security_solution/server/endpoint/routes/metadata/support/unenroll.ts b/x-pack/plugins/security_solution/server/endpoint/routes/metadata/support/unenroll.ts index 929f2598c0a34..9b61d52c268a6 100644 --- a/x-pack/plugins/security_solution/server/endpoint/routes/metadata/support/unenroll.ts +++ b/x-pack/plugins/security_solution/server/endpoint/routes/metadata/support/unenroll.ts @@ -6,24 +6,65 @@ */ import { ElasticsearchClient, SavedObjectsClientContract } from 'kibana/server'; -import { AgentService } from '../../../../../../fleet/server'; +import { AgentService, PackagePolicyServiceInterface } from '../../../../../../fleet/server'; import { Agent } from '../../../../../../fleet/common/types/models'; +const getAllAgentPolicyIdsWithEndpoint = async ( + packagePolicyService: PackagePolicyServiceInterface, + soClient: SavedObjectsClientContract +): Promise => { + const result: string[] = []; + const perPage = 1000; + let page = 1; + let hasMore = true; + + while (hasMore) { + const endpointPoliciesResponse = await packagePolicyService.list(soClient, { + perPage, + page: page++, + kuery: 'ingest-package-policies.package.name:endpoint', + }); + if (endpointPoliciesResponse.items.length > 0) { + result.push( + ...endpointPoliciesResponse.items.map((endpointPolicy) => endpointPolicy.policy_id) + ); + } else { + hasMore = false; + } + } + + return result; +}; + export async function findAllUnenrolledAgentIds( agentService: AgentService, + packagePolicyService: PackagePolicyServiceInterface, soClient: SavedObjectsClientContract, esClient: ElasticsearchClient, pageSize: number = 1000 ): Promise { + const agentPoliciesWithEndpoint = await getAllAgentPolicyIdsWithEndpoint( + packagePolicyService, + soClient + ); + + // We want: + // 1. if no endpoint policies exist, then get all Agents + // 2. if we have a list of agent policies, then Agents that are Active and that are + // NOT enrolled with an Agent Policy that has endpoint + const kuery = + agentPoliciesWithEndpoint.length > 0 + ? `(active : false) OR (active: true AND NOT policy_id:("${agentPoliciesWithEndpoint.join( + '" OR "' + )}"))` + : undefined; + const searchOptions = (pageNum: number) => { return { page: pageNum, perPage: pageSize, showInactive: true, - // FIXME: remove temporary work-around after https://github.com/elastic/beats/pull/25070 is implemented - // makes it into a snapshot build. - // kuery: '(active : false) OR (NOT packages : "endpoint" AND active : true)', - kuery: '(active : false)', + kuery, }; }; diff --git a/x-pack/plugins/security_solution/server/graphql/ecs/resolvers.ts b/x-pack/plugins/security_solution/server/graphql/ecs/resolvers.ts deleted file mode 100644 index de9daf1178ad2..0000000000000 --- a/x-pack/plugins/security_solution/server/graphql/ecs/resolvers.ts +++ /dev/null @@ -1,107 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. - */ - -import { GraphQLScalarType, Kind } from 'graphql'; -import { isBoolean, isNumber, isObject } from 'lodash/fp'; - -/* - * serialize: gets invoked when serializing the result to send it back to a client. - * - * parseValue: gets invoked to parse client input that was passed through variables. - * - * parseLiteral: gets invoked to parse client input that was passed inline in the query. - */ - -export const toStringArrayScalar = new GraphQLScalarType({ - name: 'StringArray', - description: 'Represents value in detail item from the timeline who wants to more than one type', - serialize(value): string[] | null { - if (value == null) { - return null; - } else if (Array.isArray(value)) { - return convertArrayToString(value) as string[]; - } else if (isBoolean(value) || isNumber(value) || isObject(value)) { - return [convertToString(value)]; - } - return [value]; - }, - parseValue(value) { - return value; - }, - parseLiteral(ast) { - switch (ast.kind) { - case Kind.INT: - return parseInt(ast.value, 10); - case Kind.FLOAT: - return parseFloat(ast.value); - case Kind.STRING: - return ast.value; - case Kind.LIST: - return ast.values; - case Kind.OBJECT: - return ast.fields; - } - return null; - }, -}); -export const toStringArrayNoNullableScalar = new GraphQLScalarType({ - name: 'StringArray', - description: 'Represents value in detail item from the timeline who wants to more than one type', - serialize(value): string[] | undefined { - if (value == null) { - return undefined; - } else if (Array.isArray(value)) { - return convertArrayToString(value) as string[]; - } else if (isBoolean(value) || isNumber(value) || isObject(value)) { - return [convertToString(value)]; - } - return [value]; - }, - parseValue(value) { - return value; - }, - parseLiteral(ast) { - switch (ast.kind) { - case Kind.INT: - return parseInt(ast.value, 10); - case Kind.FLOAT: - return parseFloat(ast.value); - case Kind.STRING: - return ast.value; - case Kind.LIST: - return ast.values; - case Kind.OBJECT: - return ast.fields; - } - return undefined; - }, -}); -export const createScalarToStringArrayValueResolvers = () => ({ - ToStringArray: toStringArrayScalar, - ToStringArrayNoNullable: toStringArrayNoNullableScalar, -}); - -const convertToString = (value: object | number | boolean | string): string => { - if (isObject(value)) { - try { - return JSON.stringify(value); - } catch (_) { - return 'Invalid Object'; - } - } - return value.toString(); -}; - -// eslint-disable-next-line @typescript-eslint/no-explicit-any -const convertArrayToString = (values: any[]): string[] | string => { - if (Array.isArray(values)) { - return values - .filter((item) => item != null) - .map((item) => convertArrayToString(item)) as string[]; - } - return convertToString(values); -}; diff --git a/x-pack/plugins/security_solution/server/graphql/ecs/schema.gql.ts b/x-pack/plugins/security_solution/server/graphql/ecs/schema.gql.ts deleted file mode 100644 index 3ae501c5a167d..0000000000000 --- a/x-pack/plugins/security_solution/server/graphql/ecs/schema.gql.ts +++ /dev/null @@ -1,468 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. - */ - -import gql from 'graphql-tag'; - -export const ecsSchema = gql` - scalar ToStringArray - scalar ToStringArrayNoNullable - - type EventEcsFields { - action: ToStringArray - category: ToStringArray - code: ToStringArray - created: ToDateArray - dataset: ToStringArray - duration: ToNumberArray - end: ToDateArray - hash: ToStringArray - id: ToStringArray - kind: ToStringArray - module: ToStringArray - original: ToStringArray - outcome: ToStringArray - risk_score: ToNumberArray - risk_score_norm: ToNumberArray - severity: ToNumberArray - start: ToDateArray - timezone: ToStringArray - type: ToStringArray - } - - type Location { - lon: ToNumberArray - lat: ToNumberArray - } - - type GeoEcsFields { - city_name: ToStringArray - continent_name: ToStringArray - country_iso_code: ToStringArray - country_name: ToStringArray - location: Location - region_iso_code: ToStringArray - region_name: ToStringArray - } - - type PrimarySecondary { - primary: ToStringArray - secondary: ToStringArray - type: ToStringArray - } - - type Summary { - actor: PrimarySecondary - object: PrimarySecondary - how: ToStringArray - message_type: ToStringArray - sequence: ToStringArray - } - - type AgentEcsField { - type: ToStringArray - } - - type AuditdData { - acct: ToStringArray - terminal: ToStringArray - op: ToStringArray - } - - type AuditdEcsFields { - result: ToStringArray - session: ToStringArray - data: AuditdData - summary: Summary - sequence: ToStringArray - } - - type OsEcsFields { - platform: ToStringArray - name: ToStringArray - full: ToStringArray - family: ToStringArray - version: ToStringArray - kernel: ToStringArray - } - - type HostEcsFields { - architecture: ToStringArray - id: ToStringArray - ip: ToStringArray - mac: ToStringArray - name: ToStringArray - os: OsEcsFields - type: ToStringArray - } - - type Thread { - id: ToNumberArray - start: ToStringArray - } - - type ProcessHashData { - md5: ToStringArray - sha1: ToStringArray - sha256: ToStringArray - } - - type ProcessEcsFields { - hash: ProcessHashData - pid: ToNumberArray - name: ToStringArray - ppid: ToNumberArray - args: ToStringArray - entity_id: ToStringArray - executable: ToStringArray - title: ToStringArray - thread: Thread - working_directory: ToStringArray - } - - type SourceEcsFields { - bytes: ToNumberArray - ip: ToStringArray - port: ToNumberArray - domain: ToStringArray - geo: GeoEcsFields - packets: ToNumberArray - } - - type DestinationEcsFields { - bytes: ToNumberArray - ip: ToStringArray - port: ToNumberArray - domain: ToStringArray - geo: GeoEcsFields - packets: ToNumberArray - } - - type DnsQuestionData { - name: ToStringArray - type: ToStringArray - } - - type DnsEcsFields { - question: DnsQuestionData - resolved_ip: ToStringArray - response_code: ToStringArray - } - - type EndgameEcsFields { - exit_code: ToNumberArray - file_name: ToStringArray - file_path: ToStringArray - logon_type: ToNumberArray - parent_process_name: ToStringArray - pid: ToNumberArray - process_name: ToStringArray - subject_domain_name: ToStringArray - subject_logon_id: ToStringArray - subject_user_name: ToStringArray - target_domain_name: ToStringArray - target_logon_id: ToStringArray - target_user_name: ToStringArray - } - - type SuricataAlertData { - signature: ToStringArray - signature_id: ToNumberArray - } - - type SuricataEveData { - alert: SuricataAlertData - flow_id: ToNumberArray - proto: ToStringArray - } - - type SuricataEcsFields { - eve: SuricataEveData - } - - type TlsJa3Data { - hash: ToStringArray - } - - type FingerprintData { - sha1: ToStringArray - } - - type TlsClientCertificateData { - fingerprint: FingerprintData - } - - type TlsServerCertificateData { - fingerprint: FingerprintData - } - - type TlsFingerprintsData { - ja3: TlsJa3Data - } - - type TlsEcsFields { - client_certificate: TlsClientCertificateData - fingerprints: TlsFingerprintsData - server_certificate: TlsServerCertificateData - } - - type ZeekConnectionData { - local_resp: ToBooleanArray - local_orig: ToBooleanArray - missed_bytes: ToNumberArray - state: ToStringArray - history: ToStringArray - } - - type ZeekNoticeData { - suppress_for: ToNumberArray - msg: ToStringArray - note: ToStringArray - sub: ToStringArray - dst: ToStringArray - dropped: ToBooleanArray - peer_descr: ToStringArray - } - - type ZeekDnsData { - AA: ToBooleanArray - qclass_name: ToStringArray - RD: ToBooleanArray - qtype_name: ToStringArray - rejected: ToBooleanArray - qtype: ToStringArray - query: ToStringArray - trans_id: ToNumberArray - qclass: ToStringArray - RA: ToBooleanArray - TC: ToBooleanArray - } - - type FileFields { - name: ToStringArray - path: ToStringArray - target_path: ToStringArray - extension: ToStringArray - type: ToStringArray - device: ToStringArray - inode: ToStringArray - uid: ToStringArray - owner: ToStringArray - gid: ToStringArray - group: ToStringArray - mode: ToStringArray - size: ToNumberArray - mtime: ToDateArray - ctime: ToDateArray - } - - type ZeekHttpData { - resp_mime_types: ToStringArray - trans_depth: ToStringArray - status_msg: ToStringArray - resp_fuids: ToStringArray - tags: ToStringArray - } - - type HttpBodyData { - content: ToStringArray - bytes: ToNumberArray - } - - type HttpRequestData { - method: ToStringArray - body: HttpBodyData - referrer: ToStringArray - bytes: ToNumberArray - } - - type HttpResponseData { - status_code: ToNumberArray - body: HttpBodyData - bytes: ToNumberArray - } - - type HttpEcsFields { - version: ToStringArray - request: HttpRequestData - response: HttpResponseData - } - - type UrlEcsFields { - domain: ToStringArray - original: ToStringArray - username: ToStringArray - password: ToStringArray - } - - type ZeekFileData { - session_ids: ToStringArray - timedout: ToBooleanArray - local_orig: ToBooleanArray - tx_host: ToStringArray - source: ToStringArray - is_orig: ToBooleanArray - overflow_bytes: ToNumberArray - sha1: ToStringArray - duration: ToNumberArray - depth: ToNumberArray - analyzers: ToStringArray - mime_type: ToStringArray - rx_host: ToStringArray - total_bytes: ToNumberArray - fuid: ToStringArray - seen_bytes: ToNumberArray - missing_bytes: ToNumberArray - md5: ToStringArray - } - - type ZeekSslData { - cipher: ToStringArray - established: ToBooleanArray - resumed: ToBooleanArray - version: ToStringArray - } - - type ZeekEcsFields { - session_id: ToStringArray - connection: ZeekConnectionData - notice: ZeekNoticeData - dns: ZeekDnsData - http: ZeekHttpData - files: ZeekFileData - ssl: ZeekSslData - } - - type UserEcsFields { - domain: ToStringArray - id: ToStringArray - name: ToStringArray - full_name: ToStringArray - email: ToStringArray - hash: ToStringArray - group: ToStringArray - } - - type WinlogEcsFields { - event_id: ToNumberArray - } - - type NetworkEcsField { - bytes: ToNumberArray - community_id: ToStringArray - direction: ToStringArray - packets: ToNumberArray - protocol: ToStringArray - transport: ToStringArray - } - - type PackageEcsFields { - arch: ToStringArray - entity_id: ToStringArray - name: ToStringArray - size: ToNumberArray - summary: ToStringArray - version: ToStringArray - } - - type AuditEcsFields { - package: PackageEcsFields - } - - type SshEcsFields { - method: ToStringArray - signature: ToStringArray - } - - type AuthEcsFields { - ssh: SshEcsFields - } - - type SystemEcsField { - audit: AuditEcsFields - auth: AuthEcsFields - } - - type RuleField { - id: ToStringArray - rule_id: ToStringArray - false_positives: [String!]! - saved_id: ToStringArray - timeline_id: ToStringArray - timeline_title: ToStringArray - max_signals: ToNumberArray - risk_score: ToStringArray - output_index: ToStringArray - description: ToStringArray - from: ToStringArray - immutable: ToBooleanArray - index: ToStringArray - interval: ToStringArray - language: ToStringArray - query: ToStringArray - references: ToStringArray - severity: ToStringArray - tags: ToStringArray - threat: ToAny - type: ToStringArray - size: ToStringArray - to: ToStringArray - enabled: ToBooleanArray - filters: ToAny - created_at: ToStringArray - updated_at: ToStringArray - created_by: ToStringArray - updated_by: ToStringArray - version: ToStringArray - note: ToStringArray - threshold: ToAny - exceptions_list: ToAny - } - - type SignalField { - rule: RuleField - original_time: ToStringArray - status: ToStringArray - } - - type RuleEcsField { - reference: ToStringArray - } - - type ECS { - _id: String! - _index: String - agent: AgentEcsField - auditd: AuditdEcsFields - destination: DestinationEcsFields - dns: DnsEcsFields - endgame: EndgameEcsFields - event: EventEcsFields - geo: GeoEcsFields - host: HostEcsFields - network: NetworkEcsField - rule: RuleEcsField - signal: SignalField - source: SourceEcsFields - suricata: SuricataEcsFields - tls: TlsEcsFields - zeek: ZeekEcsFields - http: HttpEcsFields - url: UrlEcsFields - timestamp: Date - message: ToStringArray - user: UserEcsFields - winlog: WinlogEcsFields - process: ProcessEcsFields - file: FileFields - system: SystemEcsField - } - - type EcsEdges { - node: ECS! - cursor: CursorType! - } -`; diff --git a/x-pack/plugins/security_solution/server/graphql/hosts/schema.gql.ts b/x-pack/plugins/security_solution/server/graphql/hosts/schema.gql.ts deleted file mode 100644 index c3a5c4e3b23cf..0000000000000 --- a/x-pack/plugins/security_solution/server/graphql/hosts/schema.gql.ts +++ /dev/null @@ -1,124 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. - */ - -import gql from 'graphql-tag'; - -export const hostsSchema = gql` - type OsFields { - platform: String - name: String - full: String - family: String - version: String - kernel: String - } - - type HostFields { - architecture: String - id: String - ip: [String] - mac: [String] - name: String - os: OsFields - type: String - } - - type AgentFields { - id: String - } - - type CloudInstance { - id: [String] - } - - type CloudMachine { - type: [String] - } - - type CloudFields { - instance: CloudInstance - machine: CloudMachine - provider: [String] - region: [String] - } - - enum HostPolicyResponseActionStatus { - success - failure - warning - unsupported - } - - type EndpointFields { - endpointPolicy: String - sensorVersion: String - policyStatus: HostPolicyResponseActionStatus - } - - type HostItem { - _id: String - agent: AgentFields - cloud: CloudFields - endpoint: EndpointFields - host: HostEcsFields - inspect: Inspect - lastSeen: Date - } - - type HostsEdges { - node: HostItem! - cursor: CursorType! - } - - type HostsData { - edges: [HostsEdges!]! - totalCount: Float! - pageInfo: PageInfoPaginated! - inspect: Inspect - } - - type FirstLastSeenHost { - inspect: Inspect - firstSeen: Date - lastSeen: Date - } - - enum HostsFields { - hostName - lastSeen - } - - input HostsSortField { - field: HostsFields! - direction: Direction! - } - - extend type Source { - "Gets Hosts based on timerange and specified criteria, or all events in the timerange if no criteria is specified" - Hosts( - id: String - timerange: TimerangeInput! - pagination: PaginationInputPaginated! - sort: HostsSortField! - filterQuery: String - defaultIndex: [String!]! - docValueFields: [docValueFieldsInput!]! - ): HostsData! - HostOverview( - id: String - hostName: String! - timerange: TimerangeInput! - defaultIndex: [String!]! - ): HostItem! - HostFirstLastSeen( - id: String - hostName: String! - defaultIndex: [String!]! - docValueFields: [docValueFieldsInput!]! - ): FirstLastSeenHost! - } -`; diff --git a/x-pack/plugins/security_solution/server/graphql/index.ts b/x-pack/plugins/security_solution/server/graphql/index.ts deleted file mode 100644 index ba3a1371f1829..0000000000000 --- a/x-pack/plugins/security_solution/server/graphql/index.ts +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. - */ - -import { rootSchema } from '../../common/graphql/root'; -import { sharedSchema } from '../../common/graphql/shared'; - -import { ecsSchema } from './ecs'; -import { dateSchema } from './scalar_date'; -import { noteSchema } from './note'; -import { pinnedEventSchema } from './pinned_event'; -import { toAnySchema } from './scalar_to_any'; -import { toBooleanSchema } from './scalar_to_boolean_array'; -import { toDateSchema } from './scalar_to_date_array'; -import { toNumberSchema } from './scalar_to_number_array'; -import { sourceStatusSchema } from './source_status'; -import { sourcesSchema } from './sources'; -import { timelineSchema } from './timeline'; -export const schemas = [ - ecsSchema, - dateSchema, - toAnySchema, - toNumberSchema, - toDateSchema, - toBooleanSchema, - noteSchema, - pinnedEventSchema, - rootSchema, - sourcesSchema, - sourceStatusSchema, - sharedSchema, - timelineSchema, -]; diff --git a/x-pack/plugins/security_solution/server/graphql/note/resolvers.ts b/x-pack/plugins/security_solution/server/graphql/note/resolvers.ts deleted file mode 100644 index 383522bc06bdd..0000000000000 --- a/x-pack/plugins/security_solution/server/graphql/note/resolvers.ts +++ /dev/null @@ -1,93 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. - */ - -import { AppResolverWithFields, AppResolverOf } from '../../lib/framework'; -import { MutationResolvers, QueryResolvers } from '../types'; -import { Notes } from '../../lib/timeline/saved_object/notes'; - -export type QueryNoteResolver = AppResolverOf; - -export type QueryAllNoteResolver = AppResolverWithFields< - QueryResolvers.GetAllNotesResolver, - 'totalCount' | 'Note' ->; - -export type QueryNotesByTimelineIdResolver = AppResolverOf; - -export type QueryNotesByEventIdResolver = AppResolverOf; - -export type MutationNoteResolver = AppResolverOf< - MutationResolvers.PersistNoteResolver ->; - -export type MutationDeleteNoteResolver = AppResolverOf; - -export type MutationDeleteNoteByTimelineIdResolver = AppResolverOf; - -interface NoteResolversDeps { - note: Notes; -} - -export const createNoteResolvers = ( - libs: NoteResolversDeps -): { - Query: { - getNote: QueryNoteResolver; - getAllNotes: QueryAllNoteResolver; - getNotesByEventId: QueryNotesByEventIdResolver; - getNotesByTimelineId: QueryNotesByTimelineIdResolver; - }; - Mutation: { - deleteNote: MutationDeleteNoteResolver; - deleteNoteByTimelineId: MutationDeleteNoteByTimelineIdResolver; - persistNote: MutationNoteResolver; - }; -} => ({ - Query: { - async getNote(root, args, { req }) { - return libs.note.getNote(req, args.id); - }, - async getAllNotes(root, args, { req }) { - return libs.note.getAllNotes( - req, - args.pageInfo || null, - args.search || null, - args.sort || null - ); - }, - async getNotesByEventId(root, args, { req }) { - return libs.note.getNotesByEventId(req, args.eventId); - }, - async getNotesByTimelineId(root, args, { req }) { - return libs.note.getNotesByTimelineId(req, args.timelineId); - }, - }, - Mutation: { - async deleteNote(root, args, { req }) { - await libs.note.deleteNote(req, args.id); - - return true; - }, - async deleteNoteByTimelineId(root, args, { req }) { - await libs.note.deleteNoteByTimelineId(req, args.timelineId); - - return true; - }, - async persistNote(root, args, { req }) { - return libs.note.persistNote( - req, - args.noteId || null, - args.version || null, - { - ...args.note, - timelineId: args.note.timelineId || null, - }, - true - ); - }, - }, -}); diff --git a/x-pack/plugins/security_solution/server/graphql/note/schema.gql.ts b/x-pack/plugins/security_solution/server/graphql/note/schema.gql.ts deleted file mode 100644 index bd791b734ff24..0000000000000 --- a/x-pack/plugins/security_solution/server/graphql/note/schema.gql.ts +++ /dev/null @@ -1,82 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. - */ - -import gql from 'graphql-tag'; - -const note = ` - eventId: String - note: String - timelineId: String -`; - -export const noteSchema = gql` - ############### - #### INPUT #### - ############### - - input NoteInput { - ${note} - } - - input PageInfoNote { - pageIndex: Float! - pageSize: Float! - } - - enum SortFieldNote { - updatedBy - updated - } - - input SortNote { - sortField: SortFieldNote! - sortOrder: Direction! - } - - ############### - #### QUERY #### - ############### - type NoteResult { - ${note} - noteId: String! - created: Float - createdBy: String - timelineVersion: String - updated: Float - updatedBy: String - version: String - } - - type ResponseNote { - code: Float - message: String - note: NoteResult! - } - - type ResponseNotes { - notes: [NoteResult!]! - totalCount: Float - } - - ######################### - #### Mutation/Query #### - ######################### - - extend type Query { - getNote(id: ID!): NoteResult! - getNotesByTimelineId(timelineId: ID!): [NoteResult!]! - getNotesByEventId(eventId: ID!): [NoteResult!]! - getAllNotes(pageInfo: PageInfoNote, search: String, sort: SortNote): ResponseNotes! - } - - extend type Mutation { - "Persists a note" - persistNote(noteId: ID, version: String, note: NoteInput!): ResponseNote! - deleteNote(id: [ID!]!):Boolean - deleteNoteByTimelineId(timelineId: ID!, version: String):Boolean - } -`; diff --git a/x-pack/plugins/security_solution/server/graphql/pinned_event/index.ts b/x-pack/plugins/security_solution/server/graphql/pinned_event/index.ts deleted file mode 100644 index b1018025b3d73..0000000000000 --- a/x-pack/plugins/security_solution/server/graphql/pinned_event/index.ts +++ /dev/null @@ -1,9 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. - */ - -export { createPinnedEventResolvers } from './resolvers'; -export { pinnedEventSchema } from './schema.gql'; diff --git a/x-pack/plugins/security_solution/server/graphql/pinned_event/resolvers.ts b/x-pack/plugins/security_solution/server/graphql/pinned_event/resolvers.ts deleted file mode 100644 index de1a40d9118c7..0000000000000 --- a/x-pack/plugins/security_solution/server/graphql/pinned_event/resolvers.ts +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. - */ - -import { AppResolverOf } from '../../lib/framework'; -import { MutationResolvers, QueryResolvers } from '../types'; -import { PinnedEvent } from '../../lib/timeline/saved_object/pinned_events'; - -export type QueryAllPinnedEventsByTimelineIdResolver = AppResolverOf; - -export type MutationPinnedEventResolver = AppResolverOf; - -export type MutationDeletePinnedEventOnTimelineResolver = AppResolverOf; - -export type MutationDeleteAllPinnedEventsOnTimelineResolver = AppResolverOf; - -interface TimelineResolversDeps { - pinnedEvent: PinnedEvent; -} - -export const createPinnedEventResolvers = ( - libs: TimelineResolversDeps -): { - Query: { - getAllPinnedEventsByTimelineId: QueryAllPinnedEventsByTimelineIdResolver; - }; - Mutation: { - persistPinnedEventOnTimeline: MutationPinnedEventResolver; - deletePinnedEventOnTimeline: MutationDeletePinnedEventOnTimelineResolver; - deleteAllPinnedEventsOnTimeline: MutationDeleteAllPinnedEventsOnTimelineResolver; - }; -} => ({ - Query: { - async getAllPinnedEventsByTimelineId(root, args, { req }) { - return libs.pinnedEvent.getAllPinnedEventsByTimelineId(req, args.timelineId); - }, - }, - Mutation: { - async persistPinnedEventOnTimeline(root, args, { req }) { - return libs.pinnedEvent.persistPinnedEventOnTimeline( - req, - args.pinnedEventId || null, - args.eventId, - args.timelineId || null - ); - }, - async deletePinnedEventOnTimeline(root, args, { req }) { - await libs.pinnedEvent.deletePinnedEventOnTimeline(req, args.id); - return true; - }, - async deleteAllPinnedEventsOnTimeline(root, args, { req }) { - await libs.pinnedEvent.deleteAllPinnedEventsOnTimeline(req, args.timelineId); - return true; - }, - }, -}); diff --git a/x-pack/plugins/security_solution/server/graphql/pinned_event/schema.gql.ts b/x-pack/plugins/security_solution/server/graphql/pinned_event/schema.gql.ts deleted file mode 100644 index 2e1cb29cf9d78..0000000000000 --- a/x-pack/plugins/security_solution/server/graphql/pinned_event/schema.gql.ts +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. - */ - -import gql from 'graphql-tag'; - -export const pinnedEventSchema = gql` - ######################### - #### Mutation/Query #### - ######################### - - type PinnedEvent { - code: Float - message: String - pinnedEventId: ID! - eventId: ID - timelineId: ID - timelineVersion: String - created: Float - createdBy: String - updated: Float - updatedBy: String - version: String - } - - extend type Query { - getAllPinnedEventsByTimelineId(timelineId: ID!): [PinnedEvent!]! - } - - extend type Mutation { - "Persists a pinned event in a timeline" - persistPinnedEventOnTimeline(pinnedEventId: ID, eventId: ID!, timelineId: ID): PinnedEvent - "Remove a pinned events in a timeline" - deletePinnedEventOnTimeline(id: [ID!]!): Boolean! - "Remove all pinned events in a timeline" - deleteAllPinnedEventsOnTimeline(timelineId: ID!): Boolean! - } -`; diff --git a/x-pack/plugins/security_solution/server/graphql/scalar_date/index.ts b/x-pack/plugins/security_solution/server/graphql/scalar_date/index.ts deleted file mode 100644 index 6e3fb5adbb687..0000000000000 --- a/x-pack/plugins/security_solution/server/graphql/scalar_date/index.ts +++ /dev/null @@ -1,9 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. - */ - -export { createScalarDateResolvers } from './resolvers'; -export { dateSchema } from './schema.gql'; diff --git a/x-pack/plugins/security_solution/server/graphql/scalar_date/resolvers.test.ts b/x-pack/plugins/security_solution/server/graphql/scalar_date/resolvers.test.ts deleted file mode 100644 index 4c421af560180..0000000000000 --- a/x-pack/plugins/security_solution/server/graphql/scalar_date/resolvers.test.ts +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. - */ - -import { IntValueNode, StringValueNode } from 'graphql'; - -import { dateScalar } from './resolvers'; - -describe('Test ScalarDate Resolver', () => { - describe('#serialize', () => { - test('Make sure that an epoch date number is serialized', () => { - const date = dateScalar.serialize(1514782800000); - expect(date).toEqual('2018-01-01T05:00:00.000Z'); - }); - - test('Make sure that a date string is serialized', () => { - const date = dateScalar.serialize('2018-01-01T05:00:00.000Z'); - expect(date).toEqual('2018-01-01T05:00:00.000Z'); - }); - }); - - describe('#parseValue', () => { - test('Make sure that an epoch date number passes through parseValue', () => { - const date = dateScalar.parseValue(1514782800000); - expect(date).toEqual(1514782800000); - }); - - test('Make sure that a date string passes through parseValue', () => { - const date = dateScalar.parseValue('2018-01-01T05:00:00.000Z'); - expect(date).toEqual('2018-01-01T05:00:00.000Z'); - }); - }); - - describe('#parseLiteral', () => { - test('Make sure that an epoch date string passes through parseLiteral', () => { - const valueNode: IntValueNode = { - kind: 'IntValue', - value: '1514782800000', - }; - const date = dateScalar.parseLiteral(valueNode); - expect(date).toEqual(1514782800000); - }); - - test('Make sure that a date string passes through parseLiteral', () => { - const valueNode: StringValueNode = { - kind: 'StringValue', - value: '2018-01-01T05:00:00.000Z', - }; - const date = dateScalar.parseLiteral(valueNode); - expect(date).toEqual('2018-01-01T05:00:00.000Z'); - }); - }); -}); diff --git a/x-pack/plugins/security_solution/server/graphql/scalar_date/resolvers.ts b/x-pack/plugins/security_solution/server/graphql/scalar_date/resolvers.ts deleted file mode 100644 index fe55cc949af48..0000000000000 --- a/x-pack/plugins/security_solution/server/graphql/scalar_date/resolvers.ts +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. - */ - -import { GraphQLScalarType, Kind } from 'graphql'; - -export const dateScalar = new GraphQLScalarType({ - name: 'Date', - description: - 'Represents a Date for either an ES formatted date string or epoch string ISO8601 formatted', - serialize(value): string { - return Number.isNaN(Date.parse(value)) ? new Date(value).toISOString() : value; - }, - parseValue(value) { - return value; - }, - parseLiteral(ast) { - switch (ast.kind) { - case Kind.INT: - return parseInt(ast.value, 10); - case Kind.STRING: - return ast.value; - } - return null; - }, -}); - -export const createScalarDateResolvers = () => ({ - Date: dateScalar, -}); diff --git a/x-pack/plugins/security_solution/server/graphql/scalar_to_any/index.ts b/x-pack/plugins/security_solution/server/graphql/scalar_to_any/index.ts deleted file mode 100644 index 0a26a1a59816a..0000000000000 --- a/x-pack/plugins/security_solution/server/graphql/scalar_to_any/index.ts +++ /dev/null @@ -1,9 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. - */ - -export { createScalarToAnyValueResolvers } from './resolvers'; -export { toAnySchema } from './schema.gql'; diff --git a/x-pack/plugins/security_solution/server/graphql/scalar_to_any/resolvers.ts b/x-pack/plugins/security_solution/server/graphql/scalar_to_any/resolvers.ts deleted file mode 100644 index 37903617989e6..0000000000000 --- a/x-pack/plugins/security_solution/server/graphql/scalar_to_any/resolvers.ts +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. - */ - -import { isObject } from 'lodash/fp'; -import { GraphQLScalarType, Kind } from 'graphql'; - -/* - * serialize: gets invoked when serializing the result to send it back to a client. - * - * parseValue: gets invoked to parse client input that was passed through variables. - * - * parseLiteral: gets invoked to parse client input that was passed inline in the query. - */ - -export const toAnyScalar = new GraphQLScalarType({ - name: 'Any', - description: 'Represents any type', - serialize(value): unknown { - if (value == null) { - return null; - } - try { - const maybeObj = JSON.parse(value); - if (isObject(maybeObj)) { - return maybeObj; - } else { - return value; - } - } catch (e) { - return value; - } - }, - parseValue(value) { - return value; - }, - parseLiteral(ast) { - switch (ast.kind) { - case Kind.BOOLEAN: - return ast.value; - case Kind.INT: - return ast.value; - case Kind.FLOAT: - return ast.value; - case Kind.STRING: - return ast.value; - case Kind.LIST: - return ast.values; - case Kind.OBJECT: - return ast.fields; - } - return null; - }, -}); - -export const createScalarToAnyValueResolvers = () => ({ - ToAny: toAnyScalar, -}); diff --git a/x-pack/plugins/security_solution/server/graphql/scalar_to_boolean_array/index.ts b/x-pack/plugins/security_solution/server/graphql/scalar_to_boolean_array/index.ts deleted file mode 100644 index df362871fd5a6..0000000000000 --- a/x-pack/plugins/security_solution/server/graphql/scalar_to_boolean_array/index.ts +++ /dev/null @@ -1,9 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. - */ - -export { createScalarToBooleanArrayValueResolvers } from './resolvers'; -export { toBooleanSchema } from './schema.gql'; diff --git a/x-pack/plugins/security_solution/server/graphql/scalar_to_boolean_array/resolvers.test.ts b/x-pack/plugins/security_solution/server/graphql/scalar_to_boolean_array/resolvers.test.ts deleted file mode 100644 index 247ed3a0d0911..0000000000000 --- a/x-pack/plugins/security_solution/server/graphql/scalar_to_boolean_array/resolvers.test.ts +++ /dev/null @@ -1,119 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. - */ - -import { toBooleanArrayScalar } from './resolvers'; - -describe('Test ToBooleanArray Scalar Resolver', () => { - describe('#serialize', () => { - test('Test Null Boolean', () => { - expect(toBooleanArrayScalar.serialize(null)).toEqual(null); - }); - - test('Test Undefined Boolean', () => { - expect(toBooleanArrayScalar.serialize(undefined)).toEqual(null); - }); - - test('Test NaN Number', () => { - expect(toBooleanArrayScalar.serialize(NaN)).toEqual([false]); - }); - - test('Test Basic false Boolean', () => { - expect(toBooleanArrayScalar.serialize(false)).toEqual([false]); - }); - - test('Test Basic true Boolean', () => { - expect(toBooleanArrayScalar.serialize(true)).toEqual([true]); - }); - - test('Test Basic false Boolean string', () => { - expect(toBooleanArrayScalar.serialize('false')).toEqual([false]); - }); - - test('Test Basic true Boolean string', () => { - expect(toBooleanArrayScalar.serialize('true')).toEqual([true]); - }); - - test('Test Basic true Boolean string with weird letters', () => { - expect(toBooleanArrayScalar.serialize('tRuE')).toEqual([true]); - }); - - test('Test Basic true Boolean string with just the letter T', () => { - expect(toBooleanArrayScalar.serialize('T')).toEqual([true]); - }); - - test('Test Basic true Boolean string with just the letter t', () => { - expect(toBooleanArrayScalar.serialize('t')).toEqual([true]); - }); - - test('Test string with gibberish returning false', () => { - expect(toBooleanArrayScalar.serialize('some gibberish')).toEqual([false]); - }); - - test('Test Basic false Boolean in array', () => { - expect(toBooleanArrayScalar.serialize([false])).toEqual([false]); - }); - - test('Test Basic true Boolean in array', () => { - expect(toBooleanArrayScalar.serialize([true])).toEqual([true]); - }); - - test('Test Basic false Boolean string in array', () => { - expect(toBooleanArrayScalar.serialize(['false'])).toEqual([false]); - }); - - test('Test Basic true Boolean string in array', () => { - expect(toBooleanArrayScalar.serialize(['true'])).toEqual([true]); - }); - - test('Test number with 0 returning false', () => { - expect(toBooleanArrayScalar.serialize(0)).toEqual([false]); - }); - - test('Test number with 1 returning returning true', () => { - expect(toBooleanArrayScalar.serialize(1)).toEqual([true]); - }); - - test('Test array with 0 and 1 returning true and false', () => { - expect(toBooleanArrayScalar.serialize([0, 1, 1, 0, 1])).toEqual([ - false, - true, - true, - false, - true, - ]); - }); - - test('Test Simple Object returning false', () => { - expect(toBooleanArrayScalar.serialize({})).toEqual([false]); - }); - - test('Test Simple Circular Reference returning false', () => { - const circularReference = { myself: {} }; - circularReference.myself = circularReference; - expect(toBooleanArrayScalar.serialize(circularReference)).toEqual([false]); - }); - - test('Test Array of Strings with some numbers, a null, and some text and a boolean', () => { - expect( - toBooleanArrayScalar.serialize([ - 5, - 'you', - '1', - 'he', - '20', - 'we', - null, - '22', - 'they', - 'True', - 'T', - 't', - ]) - ).toEqual([true, false, false, false, false, false, false, false, true, true, true]); - }); - }); -}); diff --git a/x-pack/plugins/security_solution/server/graphql/scalar_to_boolean_array/resolvers.ts b/x-pack/plugins/security_solution/server/graphql/scalar_to_boolean_array/resolvers.ts deleted file mode 100644 index b1aefd3188ef6..0000000000000 --- a/x-pack/plugins/security_solution/server/graphql/scalar_to_boolean_array/resolvers.ts +++ /dev/null @@ -1,76 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. - */ - -import { GraphQLScalarType, Kind } from 'graphql'; -import { isNumber, isObject, isString } from 'lodash/fp'; - -/* - * serialize: gets invoked when serializing the result to send it back to a client. - * - * parseValue: gets invoked to parse client input that was passed through variables. - * - * parseLiteral: gets invoked to parse client input that was passed inline in the query. - */ - -export const toBooleanArrayScalar = new GraphQLScalarType({ - name: 'BooleanArray', - description: 'Represents value in detail item from the timeline who wants to more than one type', - serialize(value): boolean[] | null { - if (value == null) { - return null; - } else if (Array.isArray(value)) { - return convertArrayToBoolean(value) as boolean[]; - } else if (isString(value) || isObject(value) || isNumber(value)) { - return [convertToBoolean(value)]; - } - return [value]; - }, - parseValue(value) { - return value; - }, - parseLiteral(ast) { - switch (ast.kind) { - case Kind.BOOLEAN: - return ast.value; - case Kind.INT: - return ast.value; - case Kind.FLOAT: - return ast.value; - case Kind.STRING: - return ast.value; - case Kind.LIST: - return ast.values; - case Kind.OBJECT: - return ast.fields; - } - return null; - }, -}); - -export const createScalarToBooleanArrayValueResolvers = () => ({ - ToBooleanArray: toBooleanArrayScalar, -}); - -const convertToBoolean = (value: object | number | boolean | string): boolean => { - if (isObject(value)) { - return false; - } else if (isString(value)) { - return value.toLowerCase() === 'true' || value.toLowerCase() === 't' ? true : false; - } else { - return Boolean(value); - } -}; - -// eslint-disable-next-line @typescript-eslint/no-explicit-any -const convertArrayToBoolean = (values: any[]): boolean[] | boolean => { - if (Array.isArray(values)) { - return values - .filter((item) => item != null) - .map((item) => convertArrayToBoolean(item)) as boolean[]; - } - return convertToBoolean(values); -}; diff --git a/x-pack/plugins/security_solution/server/graphql/scalar_to_date_array/index.ts b/x-pack/plugins/security_solution/server/graphql/scalar_to_date_array/index.ts deleted file mode 100644 index 53b8c2c4caa0c..0000000000000 --- a/x-pack/plugins/security_solution/server/graphql/scalar_to_date_array/index.ts +++ /dev/null @@ -1,9 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. - */ - -export { createScalarToDateArrayValueResolvers } from './resolvers'; -export { toDateSchema } from './schema.gql'; diff --git a/x-pack/plugins/security_solution/server/graphql/scalar_to_date_array/resolvers.test.ts b/x-pack/plugins/security_solution/server/graphql/scalar_to_date_array/resolvers.test.ts deleted file mode 100644 index 109fbb9e42005..0000000000000 --- a/x-pack/plugins/security_solution/server/graphql/scalar_to_date_array/resolvers.test.ts +++ /dev/null @@ -1,94 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. - */ - -import { toDateArrayScalar } from './resolvers'; - -describe('Test ToDateArray Scalar Resolver', () => { - describe('#serialize', () => { - test('Test Null Number', () => { - expect(toDateArrayScalar.serialize(null)).toEqual(null); - }); - - test('Test Undefined Number', () => { - expect(toDateArrayScalar.serialize(undefined)).toEqual(null); - }); - - test('Test NaN Number', () => { - expect(toDateArrayScalar.serialize(NaN)).toEqual([NaN]); - }); - - test('Test Basic Date String', () => { - expect(toDateArrayScalar.serialize('2019-04-16T03:14:13.704Z')).toEqual([ - '2019-04-16T03:14:13.704Z', - ]); - }); - - test('Test Basic Date Number as String', () => { - expect(toDateArrayScalar.serialize('1555384642768')).toEqual(['2019-04-16T03:17:22.768Z']); - }); - - test('Test Basic Date String in an array', () => { - expect(toDateArrayScalar.serialize(['2019-04-16T03:14:13.704Z'])).toEqual([ - '2019-04-16T03:14:13.704Z', - ]); - }); - - test('Test Two Basic Date Strings in an array', () => { - expect( - toDateArrayScalar.serialize(['2019-04-16T03:14:13.704Z', '2019-05-16T03:14:13.704Z']) - ).toEqual(['2019-04-16T03:14:13.704Z', '2019-05-16T03:14:13.704Z']); - }); - - test('Test Basic Numbers in an array', () => { - expect(toDateArrayScalar.serialize([1555384642768, 1555384453704])).toEqual([ - '2019-04-16T03:17:22.768Z', - '2019-04-16T03:14:13.704Z', - ]); - }); - - test('Mix of Basic Numbers and strings in an array', () => { - expect( - toDateArrayScalar.serialize([1555384642768, '2019-05-16T03:14:13.704Z', 1555384453704]) - ).toEqual([ - '2019-04-16T03:17:22.768Z', - '2019-05-16T03:14:13.704Z', - '2019-04-16T03:14:13.704Z', - ]); - }); - - test('Test Simple Object', () => { - expect(toDateArrayScalar.serialize({})).toEqual(['invalid date']); - }); - - test('Test Simple Circular Reference', () => { - const circularReference = { myself: {} }; - circularReference.myself = circularReference; - expect(toDateArrayScalar.serialize(circularReference)).toEqual(['invalid date']); - }); - - test('Test Array of Strings with some numbers, a null, and some text', () => { - expect( - toDateArrayScalar.serialize([ - '1555384453704', - 'you', - 1555384642768, - 'he', - 'we', - null, - 'they', - ]) - ).toEqual([ - '2019-04-16T03:14:13.704Z', - 'you', - '2019-04-16T03:17:22.768Z', - 'he', - 'we', - 'they', - ]); - }); - }); -}); diff --git a/x-pack/plugins/security_solution/server/graphql/scalar_to_date_array/resolvers.ts b/x-pack/plugins/security_solution/server/graphql/scalar_to_date_array/resolvers.ts deleted file mode 100644 index 532e520e4045e..0000000000000 --- a/x-pack/plugins/security_solution/server/graphql/scalar_to_date_array/resolvers.ts +++ /dev/null @@ -1,70 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. - */ - -import { GraphQLScalarType, Kind } from 'graphql'; -import { isBoolean, isNumber, isObject, isString } from 'lodash/fp'; - -/* - * serialize: gets invoked when serializing the result to send it back to a client. - * - * parseValue: gets invoked to parse client input that was passed through variables. - * - * parseLiteral: gets invoked to parse client input that was passed inline in the query. - */ - -export const toDateArrayScalar = new GraphQLScalarType({ - name: 'DateArray', - description: 'Represents value in detail item from the timeline who wants to more than one type', - serialize(value): string[] | null { - if (value == null) { - return null; - } else if (Array.isArray(value)) { - return convertArrayToDate(value) as string[]; - } else if (isBoolean(value) || isString(value) || isObject(value)) { - return [convertToDate(value)]; - } - return [value]; - }, - parseValue(value) { - return value; - }, - parseLiteral(ast) { - switch (ast.kind) { - case Kind.INT: - return parseInt(ast.value, 10); - case Kind.STRING: - return ast.value; - } - return null; - }, -}); - -export const createScalarToDateArrayValueResolvers = () => ({ - ToDateArray: toDateArrayScalar, -}); - -const convertToDate = (value: object | number | boolean | string): string => { - if (isNumber(value)) { - return new Date(value).toISOString(); - } else if (isObject(value)) { - return 'invalid date'; - } else if (isString(value) && !isNaN(+value)) { - return new Date(+value).toISOString(); - } else { - return String(value); - } -}; - -// eslint-disable-next-line @typescript-eslint/no-explicit-any -const convertArrayToDate = (values: any[]): string[] | string => { - if (Array.isArray(values)) { - return values - .filter((item) => item != null) - .map((item) => convertArrayToDate(item)) as string[]; - } - return convertToDate(values); -}; diff --git a/x-pack/plugins/security_solution/server/graphql/scalar_to_number_array/index.ts b/x-pack/plugins/security_solution/server/graphql/scalar_to_number_array/index.ts deleted file mode 100644 index 070c09181c2c5..0000000000000 --- a/x-pack/plugins/security_solution/server/graphql/scalar_to_number_array/index.ts +++ /dev/null @@ -1,9 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. - */ - -export { createScalarToNumberArrayValueResolvers } from './resolvers'; -export { toNumberSchema } from './schema.gql'; diff --git a/x-pack/plugins/security_solution/server/graphql/scalar_to_number_array/resolvers.test.ts b/x-pack/plugins/security_solution/server/graphql/scalar_to_number_array/resolvers.test.ts deleted file mode 100644 index a37ae25ec5e04..0000000000000 --- a/x-pack/plugins/security_solution/server/graphql/scalar_to_number_array/resolvers.test.ts +++ /dev/null @@ -1,76 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. - */ - -import { toNumberArrayScalar } from './resolvers'; - -describe('Test ToNumberArray Scalar Resolver', () => { - describe('#serialize', () => { - test('Test Null Number', () => { - expect(toNumberArrayScalar.serialize(null)).toEqual(null); - }); - - test('Test Undefined Number', () => { - expect(toNumberArrayScalar.serialize(undefined)).toEqual(null); - }); - - test('Test NaN Number', () => { - expect(toNumberArrayScalar.serialize(NaN)).toEqual([NaN]); - }); - - test('Test Basic Number', () => { - expect(toNumberArrayScalar.serialize(5)).toEqual([5]); - }); - - test('Test Basic Number in an array', () => { - expect(toNumberArrayScalar.serialize([5])).toEqual([5]); - }); - - test('Test Two Basic Numbers in an array', () => { - expect(toNumberArrayScalar.serialize([5, 3])).toEqual([5, 3]); - }); - - test('Test Basic String', () => { - expect(toNumberArrayScalar.serialize('33')).toEqual([33]); - }); - - test('Test Two Basic Strings in an array', () => { - expect(toNumberArrayScalar.serialize(['33', '44'])).toEqual([33, 44]); - }); - - test('Test Two Basic Strings and a piece of text in an array', () => { - expect(toNumberArrayScalar.serialize(['33', 'orange', '44'])).toEqual([33, NaN, 44]); - }); - - test('Test Basic Object to return NaN', () => { - expect(toNumberArrayScalar.serialize({ hello: 'test' })).toEqual([NaN]); - }); - - test('Test more complicated Object to return NaN', () => { - expect( - toNumberArrayScalar.serialize({ - hello: 'test', - me: 40, - you: ['32', '34', null], - others: [{ age: 78, name: 'unknown', lucky: true }], - isNull: null, - }) - ).toEqual([NaN]); - }); - - test('Test Array of Strings with some numbers, a null, and some text', () => { - expect( - toNumberArrayScalar.serialize(['5', 'you', '3', 'he', '20', 'we', null, '22', 'they']) - ).toEqual([5, NaN, 3, NaN, 20, NaN, 22, NaN]); - }); - - test('Test Simple Circular Reference', () => { - const circularReference = { myself: {} }; - circularReference.myself = circularReference; - expect(toNumberArrayScalar.serialize(circularReference)).toEqual([NaN]); - }); - }); -}); diff --git a/x-pack/plugins/security_solution/server/graphql/scalar_to_number_array/resolvers.ts b/x-pack/plugins/security_solution/server/graphql/scalar_to_number_array/resolvers.ts deleted file mode 100644 index 9ec6de45ae48b..0000000000000 --- a/x-pack/plugins/security_solution/server/graphql/scalar_to_number_array/resolvers.ts +++ /dev/null @@ -1,74 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. - */ - -import { GraphQLScalarType, Kind } from 'graphql'; -import { isBoolean, isNumber, isObject, isString } from 'lodash/fp'; - -/* - * serialize: gets invoked when serializing the result to send it back to a client. - * - * parseValue: gets invoked to parse client input that was passed through variables. - * - * parseLiteral: gets invoked to parse client input that was passed inline in the query. - */ - -export const toNumberArrayScalar = new GraphQLScalarType({ - name: 'NumberArray', - description: 'Represents value in detail item from the timeline who wants to more than one type', - serialize(value): number[] | null { - if (value == null) { - return null; - } else if (Array.isArray(value)) { - return convertArrayToNumber(value) as number[]; - } else if (isBoolean(value) || isString(value) || isObject(value)) { - return [convertToNumber(value)]; - } - return [value]; - }, - parseValue(value) { - return value; - }, - parseLiteral(ast) { - switch (ast.kind) { - case Kind.INT: - return ast.value; - case Kind.FLOAT: - return ast.value; - case Kind.STRING: - return parseFloat(ast.value); - case Kind.LIST: - return ast.values; - case Kind.OBJECT: - return ast.fields; - } - return null; - }, -}); - -export const createScalarToNumberArrayValueResolvers = () => ({ - ToNumberArray: toNumberArrayScalar, -}); - -const convertToNumber = (value: object | number | boolean | string): number => { - if (isNumber(value)) { - return value; - } else if (isString(value)) { - return parseFloat(value); - } else { - return NaN; - } -}; - -// eslint-disable-next-line @typescript-eslint/no-explicit-any -const convertArrayToNumber = (values: any[]): number[] | number => { - if (Array.isArray(values)) { - return values - .filter((item) => item != null) - .map((item) => convertArrayToNumber(item)) as number[]; - } - return convertToNumber(values); -}; diff --git a/x-pack/plugins/security_solution/server/graphql/scalar_to_number_array/schema.gql.ts b/x-pack/plugins/security_solution/server/graphql/scalar_to_number_array/schema.gql.ts deleted file mode 100644 index 514af67f109e6..0000000000000 --- a/x-pack/plugins/security_solution/server/graphql/scalar_to_number_array/schema.gql.ts +++ /dev/null @@ -1,12 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. - */ - -import gql from 'graphql-tag'; - -export const toNumberSchema = gql` - scalar ToNumberArray -`; diff --git a/x-pack/plugins/security_solution/server/graphql/source_status/index.ts b/x-pack/plugins/security_solution/server/graphql/source_status/index.ts deleted file mode 100644 index fef667075145a..0000000000000 --- a/x-pack/plugins/security_solution/server/graphql/source_status/index.ts +++ /dev/null @@ -1,9 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. - */ - -export { createSourceStatusResolvers } from './resolvers'; -export { sourceStatusSchema } from './schema.gql'; diff --git a/x-pack/plugins/security_solution/server/graphql/source_status/resolvers.test.ts b/x-pack/plugins/security_solution/server/graphql/source_status/resolvers.test.ts deleted file mode 100644 index 86c641dfb13b6..0000000000000 --- a/x-pack/plugins/security_solution/server/graphql/source_status/resolvers.test.ts +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. - */ - -import { filterIndexes } from './resolvers'; - -describe('resolvers', () => { - test('it should filter single index that has an empty string', () => { - const emptyArray = filterIndexes(['']); - expect(emptyArray).toEqual([]); - }); - - test('it should filter single index that has blanks within it', () => { - const emptyArray = filterIndexes([' ']); - expect(emptyArray).toEqual([]); - }); - - test('it should filter indexes that has an empty string and a valid index', () => { - const emptyArray = filterIndexes(['', 'valid-index']); - expect(emptyArray).toEqual(['valid-index']); - }); - - test('it should filter indexes that have blanks within them and a valid index', () => { - const emptyArray = filterIndexes([' ', 'valid-index']); - expect(emptyArray).toEqual(['valid-index']); - }); - - test('it should filter single index that has _all within it', () => { - const emptyArray = filterIndexes(['_all']); - expect(emptyArray).toEqual([]); - }); - - test('it should filter single index that has _all within it surrounded by spaces', () => { - const emptyArray = filterIndexes([' _all ']); - expect(emptyArray).toEqual([]); - }); - - test('it should filter indexes that _all within them and a valid index', () => { - const emptyArray = filterIndexes(['_all', 'valid-index']); - expect(emptyArray).toEqual(['valid-index']); - }); - - test('it should filter indexes that _all surrounded with spaces within them and a valid index', () => { - const emptyArray = filterIndexes([' _all ', 'valid-index']); - expect(emptyArray).toEqual(['valid-index']); - }); -}); diff --git a/x-pack/plugins/security_solution/server/graphql/source_status/resolvers.ts b/x-pack/plugins/security_solution/server/graphql/source_status/resolvers.ts deleted file mode 100644 index 038f981a2f389..0000000000000 --- a/x-pack/plugins/security_solution/server/graphql/source_status/resolvers.ts +++ /dev/null @@ -1,99 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. - */ - -import { GraphQLScalarType, Kind } from 'graphql'; -import { SourceStatusResolvers } from '../../graphql/types'; -import { AppResolverOf, ChildResolverOf } from '../../lib/framework'; -import { IndexFields } from '../../lib/index_fields'; -import { SourceStatus } from '../../lib/source_status'; -import { QuerySourceResolver } from '../sources/resolvers'; -import { IFieldSubType } from '../../../../../../src/plugins/data/common/index_patterns/types'; - -export type SourceStatusIndicesExistResolver = ChildResolverOf< - AppResolverOf, - QuerySourceResolver ->; - -export type SourceStatusIndexFieldsResolver = ChildResolverOf< - AppResolverOf, - QuerySourceResolver ->; - -export const createSourceStatusResolvers = (libs: { - sourceStatus: SourceStatus; - fields: IndexFields; -}): { - SourceStatus: { - indicesExist: SourceStatusIndicesExistResolver; - indexFields: SourceStatusIndexFieldsResolver; - }; -} => ({ - SourceStatus: { - async indicesExist(_, args, { req }) { - const indexes = filterIndexes(args.defaultIndex); - if (indexes.length !== 0) { - return libs.sourceStatus.hasIndices(req, indexes); - } else { - return false; - } - }, - async indexFields(_, args, { req }) { - const indexes = filterIndexes(args.defaultIndex); - if (indexes.length !== 0) { - return libs.fields.getFields(req, indexes); - } else { - return []; - } - }, - }, -}); - -/** - * Given a set of indexes this will remove anything that is: - * - blank or empty strings are removed as not valid indexes - * - _all is removed as that is not a valid index - * @param indexes Indexes with invalid values removed - */ -export const filterIndexes = (indexes: string[]): string[] => - indexes.filter((index) => index.trim() !== '' && index.trim() !== '_all'); - -export const toIFieldSubTypeNonNullableScalar = new GraphQLScalarType({ - name: 'IFieldSubType', - description: 'Represents value in index pattern field item', - serialize(value): IFieldSubType | undefined { - if (value == null) { - return undefined; - } - - return { - multi: value.multi ?? undefined, - nested: value.nested ?? undefined, - }; - }, - parseValue(value) { - return value; - }, - parseLiteral(ast) { - switch (ast.kind) { - case Kind.INT: - return undefined; - case Kind.FLOAT: - return undefined; - case Kind.STRING: - return undefined; - case Kind.LIST: - return undefined; - case Kind.OBJECT: - return ast; - } - return undefined; - }, -}); - -export const createScalarToIFieldSubTypeNonNullableScalarResolvers = () => ({ - ToIFieldSubTypeNonNullable: toIFieldSubTypeNonNullableScalar, -}); diff --git a/x-pack/plugins/security_solution/server/graphql/source_status/schema.gql.ts b/x-pack/plugins/security_solution/server/graphql/source_status/schema.gql.ts deleted file mode 100644 index c1fd7b24e6dcb..0000000000000 --- a/x-pack/plugins/security_solution/server/graphql/source_status/schema.gql.ts +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. - */ - -import gql from 'graphql-tag'; - -export const sourceStatusSchema = gql` - scalar ToIFieldSubTypeNonNullable - - "A descriptor of a field in an index" - type IndexField { - "Where the field belong" - category: String! - "Example of field's value" - example: String - "whether the field's belong to an alias index" - indexes: [String]! - "The name of the field" - name: String! - "The type of the field's values as recognized by Kibana" - type: String! - "Whether the field's values can be efficiently searched for" - searchable: Boolean! - "Whether the field's values can be aggregated" - aggregatable: Boolean! - "Description of the field" - description: String - format: String - "the elastic type as mapped in the index" - esTypes: ToStringArrayNoNullable - subType: ToIFieldSubTypeNonNullable - } - - extend type SourceStatus { - "Whether the configured alias or wildcard pattern resolve to any auditbeat indices" - indicesExist(defaultIndex: [String!]!): Boolean! - "The list of fields defined in the index mappings" - indexFields(defaultIndex: [String!]!): [String!]! - } -`; diff --git a/x-pack/plugins/security_solution/server/graphql/sources/index.ts b/x-pack/plugins/security_solution/server/graphql/sources/index.ts deleted file mode 100644 index 583918fa014c7..0000000000000 --- a/x-pack/plugins/security_solution/server/graphql/sources/index.ts +++ /dev/null @@ -1,9 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. - */ - -export { createSourcesResolvers } from './resolvers'; -export { sourcesSchema } from './schema.gql'; diff --git a/x-pack/plugins/security_solution/server/graphql/sources/resolvers.ts b/x-pack/plugins/security_solution/server/graphql/sources/resolvers.ts deleted file mode 100644 index 8ae30c17560f0..0000000000000 --- a/x-pack/plugins/security_solution/server/graphql/sources/resolvers.ts +++ /dev/null @@ -1,72 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. - */ - -import { QueryResolvers, SourceResolvers } from '../../graphql/types'; -import { - AppResolverOf, - AppResolverWithFields, - ChildResolverOf, - ResultOf, -} from '../../lib/framework'; -import { SourceStatus } from '../../lib/source_status'; -import { Sources } from '../../lib/sources'; - -export type QuerySourceResolver = AppResolverWithFields< - QueryResolvers.SourceResolver, - 'id' | 'configuration' ->; - -export type QueryAllSourcesResolver = AppResolverWithFields< - QueryResolvers.AllSourcesResolver, - 'id' | 'configuration' ->; - -export type SourceStatusResolver = ChildResolverOf< - AppResolverOf>>, - QuerySourceResolver ->; - -export interface SourcesResolversDeps { - sources: Sources; - sourceStatus: SourceStatus; -} - -export const createSourcesResolvers = ( - libs: SourcesResolversDeps -): { - Query: { - source: QuerySourceResolver; - allSources: QueryAllSourcesResolver; - }; - Source: { - status: SourceStatusResolver; - }; -} => ({ - Query: { - async source(root, args) { - const requestedSourceConfiguration = await libs.sources.getConfiguration(args.id); - - return { - id: args.id, - configuration: requestedSourceConfiguration, - }; - }, - async allSources() { - const sourceConfigurations = await libs.sources.getAllConfigurations(); - - return Object.entries(sourceConfigurations).map(([sourceName, sourceConfiguration]) => ({ - id: sourceName, - configuration: sourceConfiguration, - })); - }, - }, - Source: { - async status(source) { - return source; - }, - }, -}); diff --git a/x-pack/plugins/security_solution/server/graphql/sources/schema.gql.ts b/x-pack/plugins/security_solution/server/graphql/sources/schema.gql.ts deleted file mode 100644 index 6b5b12a1e92a4..0000000000000 --- a/x-pack/plugins/security_solution/server/graphql/sources/schema.gql.ts +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. - */ - -import gql from 'graphql-tag'; - -export const sourcesSchema = gql` - extend type Query { - "Get a security data source by id" - source("The id of the source" id: ID!): Source! - "Get a list of all security data sources" - allSources: [Source!]! - } - - type Source { - "The id of the source" - id: ID! - "The raw configuration of the source" - configuration: SourceConfiguration! - "The status of the source" - status: SourceStatus! - } - - "The status of an infrastructure data source" - type SourceStatus - - "A set of configuration options for a security data source" - type SourceConfiguration { - "The field mapping to use for this source" - fields: SourceFields! - } - - "A mapping of semantic fields to their document counterparts" - type SourceFields { - "The field to identify a container by" - container: String! - "The fields to identify a host by" - host: String! - "The fields that may contain the log event message. The first field found win." - message: [String!]! - "The field to identify a pod by" - pod: String! - "The field to use as a tiebreaker for log events that have identical timestamps" - tiebreaker: String! - "The field to use as a timestamp for metrics and logs" - timestamp: String! - } -`; diff --git a/x-pack/plugins/security_solution/server/graphql/timeline/index.ts b/x-pack/plugins/security_solution/server/graphql/timeline/index.ts deleted file mode 100644 index ef78a0e8b8bdd..0000000000000 --- a/x-pack/plugins/security_solution/server/graphql/timeline/index.ts +++ /dev/null @@ -1,9 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. - */ - -export { createTimelineResolvers } from './resolvers'; -export { timelineSchema } from './schema.gql'; diff --git a/x-pack/plugins/security_solution/server/graphql/timeline/resolvers.ts b/x-pack/plugins/security_solution/server/graphql/timeline/resolvers.ts deleted file mode 100644 index 8aa08eda95923..0000000000000 --- a/x-pack/plugins/security_solution/server/graphql/timeline/resolvers.ts +++ /dev/null @@ -1,85 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. - */ - -import { AppResolverWithFields, AppResolverOf } from '../../lib/framework'; -import { MutationResolvers, QueryResolvers } from '../types'; -import { Timeline } from '../../lib/timeline/saved_object/timelines'; -import { TimelineType } from '../../../common/types/timeline'; - -export type QueryTimelineResolver = AppResolverOf; - -export type QueryAllTimelineResolver = AppResolverWithFields< - QueryResolvers.GetAllTimelineResolver, - 'totalCount' | 'timeline' ->; - -export type MutationTimelineResolver = AppResolverOf< - MutationResolvers.PersistTimelineResolver ->; - -export type MutationDeleteTimelineResolver = AppResolverOf; - -export type MutationFavoriteResolver = AppResolverOf; - -interface TimelineResolversDeps { - timeline: Timeline; -} - -export const createTimelineResolvers = ( - libs: TimelineResolversDeps -): { - Query: { - getOneTimeline: QueryTimelineResolver; - getAllTimeline: QueryAllTimelineResolver; - }; - Mutation: { - deleteTimeline: MutationDeleteTimelineResolver; - persistTimeline: MutationTimelineResolver; - persistFavorite: MutationFavoriteResolver; - }; -} => ({ - Query: { - async getOneTimeline(root, args, { req }) { - return libs.timeline.getTimeline(req, args.id, args.timelineType); - }, - async getAllTimeline(root, args, { req }) { - return libs.timeline.getAllTimeline( - req, - args.onlyUserFavorite || null, - args.pageInfo, - args.search || null, - args.sort || null, - args.status || null, - args.timelineType || null - ); - }, - }, - Mutation: { - async deleteTimeline(root, args, { req }) { - await libs.timeline.deleteTimeline(req, args.id); - - return true; - }, - async persistFavorite(root, args, { req }) { - return libs.timeline.persistFavorite( - req, - args.timelineId || null, - args.templateTimelineId || null, - args.templateTimelineVersion || null, - args.timelineType || TimelineType.default - ); - }, - async persistTimeline(root, args, { req }) { - return libs.timeline.persistTimeline( - req, - args.id || null, - args.version || null, - args.timeline - ); - }, - }, -}); diff --git a/x-pack/plugins/security_solution/server/graphql/timeline/schema.gql.ts b/x-pack/plugins/security_solution/server/graphql/timeline/schema.gql.ts deleted file mode 100644 index 98e7103e61224..0000000000000 --- a/x-pack/plugins/security_solution/server/graphql/timeline/schema.gql.ts +++ /dev/null @@ -1,352 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. - */ - -import gql from 'graphql-tag'; - -const columnHeader = ` - aggregatable: Boolean - category: String - columnHeaderType: String - description: String - example: String - indexes: [String!] - id: String - name: String - placeholder: String - searchable: Boolean - type: String -`; - -const eqlOptions = ` - eventCategoryField: String - tiebreakerField: String - timestampField: String - query: String - size: ToAny -`; - -const queryMatch = ` - field: String - displayField: String - value: String - displayValue: String - operator: String -`; - -const kueryFilterQuery = ` - kind: String - expression: String -`; - -const dateRange = ` - start: ToAny - end: ToAny -`; - -const favoriteTimeline = ` - fullName: String - userName: String - favoriteDate: Float -`; - -const sortTimeline = ` - columnId: String - sortDirection: String -`; - -const filtersMetaTimeline = ` - alias: String - controlledBy: String - disabled: Boolean - field: String - formattedValue: String - index: String - key: String - negate: Boolean - params: String - type: String - value: String -`; - -export const timelineSchema = gql` - ############### - #### INPUT #### - ############### - - input ColumnHeaderInput { - ${columnHeader} - } - - input QueryMatchInput { - ${queryMatch} - } - - input DataProviderInput { - id: String - name: String - enabled: Boolean - excluded: Boolean - kqlQuery: String - queryMatch: QueryMatchInput - and: [DataProviderInput!] - type: DataProviderType - } - - enum DataProviderType { - default - template - } - - input KueryFilterQueryInput { - ${kueryFilterQuery} - } - - input SerializedKueryQueryInput { - kuery: KueryFilterQueryInput - serializedQuery: String - } - - input SerializedFilterQueryInput { - filterQuery: SerializedKueryQueryInput - } - - input DateRangePickerInput { - ${dateRange} - } - - input FavoriteTimelineInput { - ${favoriteTimeline} - } - - input SortTimelineInput { - ${sortTimeline} - } - - input FilterMetaTimelineInput { - ${filtersMetaTimeline} - } - - input EqlOptionsInput { - ${eqlOptions} - } - - input FilterTimelineInput { - exists: String - meta: FilterMetaTimelineInput - match_all: String - missing: String - query: String - range: String - script: String - } - - enum TimelineType { - default - template - } - - enum TimelineStatus { - active - draft - immutable - } - - enum RowRendererId { - alerts - auditd - auditd_file - library - netflow - plain - registry - suricata - system - system_dns - system_endgame_process - system_file - system_fim - system_security_event - system_socket - threat_match - zeek - } - - input TimelineInput { - columns: [ColumnHeaderInput!] - dataProviders: [DataProviderInput!] - description: String - eqlOptions: EqlOptionsInput - eventType: String - excludedRowRendererIds: [RowRendererId!] - filters: [FilterTimelineInput!] - kqlMode: String - kqlQuery: SerializedFilterQueryInput - indexNames: [String!] - title: String - templateTimelineId: String - templateTimelineVersion: Int - timelineType: TimelineType - dateRange: DateRangePickerInput - savedQueryId: String - sort: [SortTimelineInput!] - status: TimelineStatus - } - - input PageInfoTimeline { - pageIndex: Float! - pageSize: Float! - } - - enum SortFieldTimeline { - title - description - updated - created - } - - input SortTimeline { - sortField: SortFieldTimeline! - sortOrder: Direction! - } - - ############### - #### QUERY #### - ############### - type ColumnHeaderResult { - ${columnHeader} - } - - type QueryMatchResult { - ${queryMatch} - } - - type DataProviderResult { - id: String - name: String - enabled: Boolean - excluded: Boolean - kqlQuery: String - queryMatch: QueryMatchResult - type: DataProviderType - and: [DataProviderResult!] - } - - type KueryFilterQueryResult { - ${kueryFilterQuery} - } - - type SerializedKueryQueryResult { - kuery: KueryFilterQueryResult - serializedQuery: String - } - - type SerializedFilterQueryResult { - filterQuery: SerializedKueryQueryResult - } - - type DateRangePickerResult { - ${dateRange} - } - - type FavoriteTimelineResult { - ${favoriteTimeline} - } - - type FilterMetaTimelineResult { - ${filtersMetaTimeline} - } - - type EqlOptionsResult { - ${eqlOptions} - } - - type FilterTimelineResult { - exists: String - meta: FilterMetaTimelineResult - match_all: String - missing: String - query: String - range: String - script: String - } - - type TimelineResult { - columns: [ColumnHeaderResult!] - created: Float - createdBy: String - dataProviders: [DataProviderResult!] - dateRange: DateRangePickerResult - description: String - eqlOptions: EqlOptionsResult - eventIdToNoteIds: [NoteResult!] - eventType: String - excludedRowRendererIds: [RowRendererId!] - favorite: [FavoriteTimelineResult!] - filters: [FilterTimelineResult!] - kqlMode: String - kqlQuery: SerializedFilterQueryResult - indexNames: [String!] - notes: [NoteResult!] - noteIds: [String!] - pinnedEventIds: [String!] - pinnedEventsSaveObject: [PinnedEvent!] - savedQueryId: String - savedObjectId: String! - sort: ToAny - status: TimelineStatus - title: String - templateTimelineId: String - templateTimelineVersion: Int - timelineType: TimelineType - updated: Float - updatedBy: String - version: String! - } - - type ResponseTimeline { - code: Float - message: String - timeline: TimelineResult! - } - - type ResponseFavoriteTimeline { - code: Float - message: String - savedObjectId: String! - templateTimelineId: String - templateTimelineVersion: Int - timelineType: TimelineType - version: String! - favorite: [FavoriteTimelineResult!] - } - - type ResponseTimelines { - timeline: [TimelineResult]! - totalCount: Float - defaultTimelineCount: Float - templateTimelineCount: Float - elasticTemplateTimelineCount: Float - customTemplateTimelineCount: Float - favoriteCount: Float - } - - ######################### - #### Mutation/Query #### - ######################### - - extend type Query { - getOneTimeline(id: ID!, timelineType: TimelineType): TimelineResult! - getAllTimeline(pageInfo: PageInfoTimeline!, search: String, sort: SortTimeline, onlyUserFavorite: Boolean, timelineType: TimelineType, status: TimelineStatus): ResponseTimelines! - } - - extend type Mutation { - "Persists a timeline" - persistTimeline(id: ID, version: String, timeline: TimelineInput!): ResponseTimeline! - persistFavorite(timelineId: ID, templateTimelineId: String, templateTimelineVersion: Int, timelineType: TimelineType): ResponseFavoriteTimeline! - deleteTimeline(id: [ID!]!): Boolean! - } -`; diff --git a/x-pack/plugins/security_solution/server/graphql/types.ts b/x-pack/plugins/security_solution/server/graphql/types.ts deleted file mode 100644 index a60a6dd6093d1..0000000000000 --- a/x-pack/plugins/security_solution/server/graphql/types.ts +++ /dev/null @@ -1,5706 +0,0 @@ -/* tslint:disable */ -/* eslint-disable */ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. - */ - -import { SiemContext } from '../lib/types'; - -export type Maybe = T | null; - -export interface PageInfoNote { - pageIndex: number; - - pageSize: number; -} - -export interface SortNote { - sortField: SortFieldNote; - - sortOrder: Direction; -} - -export interface PageInfoTimeline { - pageIndex: number; - - pageSize: number; -} - -export interface SortTimeline { - sortField: SortFieldTimeline; - - sortOrder: Direction; -} - -export interface NoteInput { - eventId?: Maybe; - - note?: Maybe; - - timelineId?: Maybe; -} - -export interface TimelineInput { - columns?: Maybe; - - dataProviders?: Maybe; - - description?: Maybe; - - eqlOptions?: Maybe; - - eventType?: Maybe; - - excludedRowRendererIds?: Maybe; - - filters?: Maybe; - - kqlMode?: Maybe; - - kqlQuery?: Maybe; - - indexNames?: Maybe; - - title?: Maybe; - - templateTimelineId?: Maybe; - - templateTimelineVersion?: Maybe; - - timelineType?: Maybe; - - dateRange?: Maybe; - - savedQueryId?: Maybe; - - sort?: Maybe; - - status?: Maybe; -} - -export interface ColumnHeaderInput { - aggregatable?: Maybe; - - category?: Maybe; - - columnHeaderType?: Maybe; - - description?: Maybe; - - example?: Maybe; - - indexes?: Maybe; - - id?: Maybe; - - name?: Maybe; - - placeholder?: Maybe; - - searchable?: Maybe; - - type?: Maybe; -} - -export interface DataProviderInput { - id?: Maybe; - - name?: Maybe; - - enabled?: Maybe; - - excluded?: Maybe; - - kqlQuery?: Maybe; - - queryMatch?: Maybe; - - and?: Maybe; - - type?: Maybe; -} - -export interface QueryMatchInput { - field?: Maybe; - - displayField?: Maybe; - - value?: Maybe; - - displayValue?: Maybe; - - operator?: Maybe; -} - -export interface EqlOptionsInput { - eventCategoryField?: Maybe; - - tiebreakerField?: Maybe; - - timestampField?: Maybe; - - query?: Maybe; - - size?: Maybe; -} - -export interface FilterTimelineInput { - exists?: Maybe; - - meta?: Maybe; - - match_all?: Maybe; - - missing?: Maybe; - - query?: Maybe; - - range?: Maybe; - - script?: Maybe; -} - -export interface FilterMetaTimelineInput { - alias?: Maybe; - - controlledBy?: Maybe; - - disabled?: Maybe; - - field?: Maybe; - - formattedValue?: Maybe; - - index?: Maybe; - - key?: Maybe; - - negate?: Maybe; - - params?: Maybe; - - type?: Maybe; - - value?: Maybe; -} - -export interface SerializedFilterQueryInput { - filterQuery?: Maybe; -} - -export interface SerializedKueryQueryInput { - kuery?: Maybe; - - serializedQuery?: Maybe; -} - -export interface KueryFilterQueryInput { - kind?: Maybe; - - expression?: Maybe; -} - -export interface DateRangePickerInput { - start?: Maybe; - - end?: Maybe; -} - -export interface SortTimelineInput { - columnId?: Maybe; - - sortDirection?: Maybe; -} - -export interface TimerangeInput { - /** The interval string to use for last bucket. The format is '{value}{unit}'. For example '5m' would return the metrics for the last 5 minutes of the timespan. */ - interval: string; - /** The end of the timerange */ - to: string; - /** The beginning of the timerange */ - from: string; -} - -export interface DocValueFieldsInput { - field: string; - - format: string; -} - -export interface PaginationInput { - /** The limit parameter allows you to configure the maximum amount of items to be returned */ - limit: number; - /** The cursor parameter defines the next result you want to fetch */ - cursor?: Maybe; - /** The tiebreaker parameter allow to be more precise to fetch the next item */ - tiebreaker?: Maybe; -} - -export interface PaginationInputPaginated { - /** The activePage parameter defines the page of results you want to fetch */ - activePage: number; - /** The cursorStart parameter defines the start of the results to be displayed */ - cursorStart: number; - /** The fakePossibleCount parameter determines the total count in order to show 5 additional pages */ - fakePossibleCount: number; - /** The querySize parameter is the number of items to be returned */ - querySize: number; -} - -export interface SortField { - sortFieldId: string; - - direction: Direction; -} - -export interface FavoriteTimelineInput { - fullName?: Maybe; - - userName?: Maybe; - - favoriteDate?: Maybe; -} - -export enum SortFieldNote { - updatedBy = 'updatedBy', - updated = 'updated', -} - -export enum Direction { - asc = 'asc', - desc = 'desc', -} - -export enum TimelineType { - default = 'default', - template = 'template', -} - -export enum DataProviderType { - default = 'default', - template = 'template', -} - -export enum RowRendererId { - alerts = 'alerts', - auditd = 'auditd', - auditd_file = 'auditd_file', - library = 'library', - netflow = 'netflow', - plain = 'plain', - registry = 'registry', - suricata = 'suricata', - system = 'system', - system_dns = 'system_dns', - system_endgame_process = 'system_endgame_process', - system_file = 'system_file', - system_fim = 'system_fim', - system_security_event = 'system_security_event', - system_socket = 'system_socket', - threat_match = 'threat_match', - zeek = 'zeek', -} - -export enum TimelineStatus { - active = 'active', - draft = 'draft', - immutable = 'immutable', -} - -export enum SortFieldTimeline { - title = 'title', - description = 'description', - updated = 'updated', - created = 'created', -} - -export enum FlowTarget { - client = 'client', - destination = 'destination', - server = 'server', - source = 'source', -} - -export enum FlowTargetSourceDest { - destination = 'destination', - source = 'source', -} - -export enum FlowDirection { - uniDirectional = 'uniDirectional', - biDirectional = 'biDirectional', -} - -export type ToAny = any; - -export type ToStringArray = string[] | string; - -export type ToStringArrayNoNullable = any; - -export type ToDateArray = string[] | string; - -export type ToNumberArray = number[] | number; - -export type ToBooleanArray = boolean[] | boolean; - -export type Date = string; - -export type ToIFieldSubTypeNonNullable = any; - -// ==================================================== -// Scalars -// ==================================================== - -// ==================================================== -// Types -// ==================================================== - -export interface Query { - getNote: NoteResult; - - getNotesByTimelineId: NoteResult[]; - - getNotesByEventId: NoteResult[]; - - getAllNotes: ResponseNotes; - - getAllPinnedEventsByTimelineId: PinnedEvent[]; - /** Get a security data source by id */ - source: Source; - /** Get a list of all security data sources */ - allSources: Source[]; - - getOneTimeline: TimelineResult; - - getAllTimeline: ResponseTimelines; -} - -export interface NoteResult { - eventId?: Maybe; - - note?: Maybe; - - timelineId?: Maybe; - - noteId: string; - - created?: Maybe; - - createdBy?: Maybe; - - timelineVersion?: Maybe; - - updated?: Maybe; - - updatedBy?: Maybe; - - version?: Maybe; -} - -export interface ResponseNotes { - notes: NoteResult[]; - - totalCount?: Maybe; -} - -export interface PinnedEvent { - code?: Maybe; - - message?: Maybe; - - pinnedEventId: string; - - eventId?: Maybe; - - timelineId?: Maybe; - - timelineVersion?: Maybe; - - created?: Maybe; - - createdBy?: Maybe; - - updated?: Maybe; - - updatedBy?: Maybe; - - version?: Maybe; -} - -export interface Source { - /** The id of the source */ - id: string; - /** The raw configuration of the source */ - configuration: SourceConfiguration; - /** The status of the source */ - status: SourceStatus; -} - -/** A set of configuration options for a security data source */ -export interface SourceConfiguration { - /** The field mapping to use for this source */ - fields: SourceFields; -} - -/** A mapping of semantic fields to their document counterparts */ -export interface SourceFields { - /** The field to identify a container by */ - container: string; - /** The fields to identify a host by */ - host: string; - /** The fields that may contain the log event message. The first field found win. */ - message: string[]; - /** The field to identify a pod by */ - pod: string; - /** The field to use as a tiebreaker for log events that have identical timestamps */ - tiebreaker: string; - /** The field to use as a timestamp for metrics and logs */ - timestamp: string; -} - -/** The status of an infrastructure data source */ -export interface SourceStatus { - /** Whether the configured alias or wildcard pattern resolve to any auditbeat indices */ - indicesExist: boolean; - /** The list of fields defined in the index mappings */ - indexFields: string[]; -} - -export interface TimelineResult { - columns?: Maybe; - - created?: Maybe; - - createdBy?: Maybe; - - dataProviders?: Maybe; - - dateRange?: Maybe; - - description?: Maybe; - - eqlOptions?: Maybe; - - eventIdToNoteIds?: Maybe; - - eventType?: Maybe; - - excludedRowRendererIds?: Maybe; - - favorite?: Maybe; - - filters?: Maybe; - - kqlMode?: Maybe; - - kqlQuery?: Maybe; - - indexNames?: Maybe; - - notes?: Maybe; - - noteIds?: Maybe; - - pinnedEventIds?: Maybe; - - pinnedEventsSaveObject?: Maybe; - - savedQueryId?: Maybe; - - savedObjectId: string; - - sort?: Maybe; - - status?: Maybe; - - title?: Maybe; - - templateTimelineId?: Maybe; - - templateTimelineVersion?: Maybe; - - timelineType?: Maybe; - - updated?: Maybe; - - updatedBy?: Maybe; - - version: string; -} - -export interface ColumnHeaderResult { - aggregatable?: Maybe; - - category?: Maybe; - - columnHeaderType?: Maybe; - - description?: Maybe; - - example?: Maybe; - - indexes?: Maybe; - - id?: Maybe; - - name?: Maybe; - - placeholder?: Maybe; - - searchable?: Maybe; - - type?: Maybe; -} - -export interface DataProviderResult { - id?: Maybe; - - name?: Maybe; - - enabled?: Maybe; - - excluded?: Maybe; - - kqlQuery?: Maybe; - - queryMatch?: Maybe; - - type?: Maybe; - - and?: Maybe; -} - -export interface QueryMatchResult { - field?: Maybe; - - displayField?: Maybe; - - value?: Maybe; - - displayValue?: Maybe; - - operator?: Maybe; -} - -export interface DateRangePickerResult { - start?: Maybe; - - end?: Maybe; -} - -export interface EqlOptionsResult { - eventCategoryField?: Maybe; - - tiebreakerField?: Maybe; - - timestampField?: Maybe; - - query?: Maybe; - - size?: Maybe; -} - -export interface FavoriteTimelineResult { - fullName?: Maybe; - - userName?: Maybe; - - favoriteDate?: Maybe; -} - -export interface FilterTimelineResult { - exists?: Maybe; - - meta?: Maybe; - - match_all?: Maybe; - - missing?: Maybe; - - query?: Maybe; - - range?: Maybe; - - script?: Maybe; -} - -export interface FilterMetaTimelineResult { - alias?: Maybe; - - controlledBy?: Maybe; - - disabled?: Maybe; - - field?: Maybe; - - formattedValue?: Maybe; - - index?: Maybe; - - key?: Maybe; - - negate?: Maybe; - - params?: Maybe; - - type?: Maybe; - - value?: Maybe; -} - -export interface SerializedFilterQueryResult { - filterQuery?: Maybe; -} - -export interface SerializedKueryQueryResult { - kuery?: Maybe; - - serializedQuery?: Maybe; -} - -export interface KueryFilterQueryResult { - kind?: Maybe; - - expression?: Maybe; -} - -export interface ResponseTimelines { - timeline: (Maybe)[]; - - totalCount?: Maybe; - - defaultTimelineCount?: Maybe; - - templateTimelineCount?: Maybe; - - elasticTemplateTimelineCount?: Maybe; - - customTemplateTimelineCount?: Maybe; - - favoriteCount?: Maybe; -} - -export interface Mutation { - /** Persists a note */ - persistNote: ResponseNote; - - deleteNote?: Maybe; - - deleteNoteByTimelineId?: Maybe; - /** Persists a pinned event in a timeline */ - persistPinnedEventOnTimeline?: Maybe; - /** Remove a pinned events in a timeline */ - deletePinnedEventOnTimeline: boolean; - /** Remove all pinned events in a timeline */ - deleteAllPinnedEventsOnTimeline: boolean; - /** Persists a timeline */ - persistTimeline: ResponseTimeline; - - persistFavorite: ResponseFavoriteTimeline; - - deleteTimeline: boolean; -} - -export interface ResponseNote { - code?: Maybe; - - message?: Maybe; - - note: NoteResult; -} - -export interface ResponseTimeline { - code?: Maybe; - - message?: Maybe; - - timeline: TimelineResult; -} - -export interface ResponseFavoriteTimeline { - code?: Maybe; - - message?: Maybe; - - savedObjectId: string; - - templateTimelineId?: Maybe; - - templateTimelineVersion?: Maybe; - - timelineType?: Maybe; - - version: string; - - favorite?: Maybe; -} - -export interface EventEcsFields { - action?: Maybe; - - category?: Maybe; - - code?: Maybe; - - created?: Maybe; - - dataset?: Maybe; - - duration?: Maybe; - - end?: Maybe; - - hash?: Maybe; - - id?: Maybe; - - kind?: Maybe; - - module?: Maybe; - - original?: Maybe; - - outcome?: Maybe; - - risk_score?: Maybe; - - risk_score_norm?: Maybe; - - severity?: Maybe; - - start?: Maybe; - - timezone?: Maybe; - - type?: Maybe; -} - -export interface Location { - lon?: Maybe; - - lat?: Maybe; -} - -export interface GeoEcsFields { - city_name?: Maybe; - - continent_name?: Maybe; - - country_iso_code?: Maybe; - - country_name?: Maybe; - - location?: Maybe; - - region_iso_code?: Maybe; - - region_name?: Maybe; -} - -export interface PrimarySecondary { - primary?: Maybe; - - secondary?: Maybe; - - type?: Maybe; -} - -export interface Summary { - actor?: Maybe; - - object?: Maybe; - - how?: Maybe; - - message_type?: Maybe; - - sequence?: Maybe; -} - -export interface AgentEcsField { - type?: Maybe; -} - -export interface AuditdData { - acct?: Maybe; - - terminal?: Maybe; - - op?: Maybe; -} - -export interface AuditdEcsFields { - result?: Maybe; - - session?: Maybe; - - data?: Maybe; - - summary?: Maybe; - - sequence?: Maybe; -} - -export interface OsEcsFields { - platform?: Maybe; - - name?: Maybe; - - full?: Maybe; - - family?: Maybe; - - version?: Maybe; - - kernel?: Maybe; -} - -export interface HostEcsFields { - architecture?: Maybe; - - id?: Maybe; - - ip?: Maybe; - - mac?: Maybe; - - name?: Maybe; - - os?: Maybe; - - type?: Maybe; -} - -export interface Thread { - id?: Maybe; - - start?: Maybe; -} - -export interface ProcessHashData { - md5?: Maybe; - - sha1?: Maybe; - - sha256?: Maybe; -} - -export interface ProcessEcsFields { - hash?: Maybe; - - pid?: Maybe; - - name?: Maybe; - - ppid?: Maybe; - - args?: Maybe; - - entity_id?: Maybe; - - executable?: Maybe; - - title?: Maybe; - - thread?: Maybe; - - working_directory?: Maybe; -} - -export interface SourceEcsFields { - bytes?: Maybe; - - ip?: Maybe; - - port?: Maybe; - - domain?: Maybe; - - geo?: Maybe; - - packets?: Maybe; -} - -export interface DestinationEcsFields { - bytes?: Maybe; - - ip?: Maybe; - - port?: Maybe; - - domain?: Maybe; - - geo?: Maybe; - - packets?: Maybe; -} - -export interface DnsQuestionData { - name?: Maybe; - - type?: Maybe; -} - -export interface DnsEcsFields { - question?: Maybe; - - resolved_ip?: Maybe; - - response_code?: Maybe; -} - -export interface EndgameEcsFields { - exit_code?: Maybe; - - file_name?: Maybe; - - file_path?: Maybe; - - logon_type?: Maybe; - - parent_process_name?: Maybe; - - pid?: Maybe; - - process_name?: Maybe; - - subject_domain_name?: Maybe; - - subject_logon_id?: Maybe; - - subject_user_name?: Maybe; - - target_domain_name?: Maybe; - - target_logon_id?: Maybe; - - target_user_name?: Maybe; -} - -export interface SuricataAlertData { - signature?: Maybe; - - signature_id?: Maybe; -} - -export interface SuricataEveData { - alert?: Maybe; - - flow_id?: Maybe; - - proto?: Maybe; -} - -export interface SuricataEcsFields { - eve?: Maybe; -} - -export interface TlsJa3Data { - hash?: Maybe; -} - -export interface FingerprintData { - sha1?: Maybe; -} - -export interface TlsClientCertificateData { - fingerprint?: Maybe; -} - -export interface TlsServerCertificateData { - fingerprint?: Maybe; -} - -export interface TlsFingerprintsData { - ja3?: Maybe; -} - -export interface TlsEcsFields { - client_certificate?: Maybe; - - fingerprints?: Maybe; - - server_certificate?: Maybe; -} - -export interface ZeekConnectionData { - local_resp?: Maybe; - - local_orig?: Maybe; - - missed_bytes?: Maybe; - - state?: Maybe; - - history?: Maybe; -} - -export interface ZeekNoticeData { - suppress_for?: Maybe; - - msg?: Maybe; - - note?: Maybe; - - sub?: Maybe; - - dst?: Maybe; - - dropped?: Maybe; - - peer_descr?: Maybe; -} - -export interface ZeekDnsData { - AA?: Maybe; - - qclass_name?: Maybe; - - RD?: Maybe; - - qtype_name?: Maybe; - - rejected?: Maybe; - - qtype?: Maybe; - - query?: Maybe; - - trans_id?: Maybe; - - qclass?: Maybe; - - RA?: Maybe; - - TC?: Maybe; -} - -export interface FileFields { - name?: Maybe; - - path?: Maybe; - - target_path?: Maybe; - - extension?: Maybe; - - type?: Maybe; - - device?: Maybe; - - inode?: Maybe; - - uid?: Maybe; - - owner?: Maybe; - - gid?: Maybe; - - group?: Maybe; - - mode?: Maybe; - - size?: Maybe; - - mtime?: Maybe; - - ctime?: Maybe; -} - -export interface ZeekHttpData { - resp_mime_types?: Maybe; - - trans_depth?: Maybe; - - status_msg?: Maybe; - - resp_fuids?: Maybe; - - tags?: Maybe; -} - -export interface HttpBodyData { - content?: Maybe; - - bytes?: Maybe; -} - -export interface HttpRequestData { - method?: Maybe; - - body?: Maybe; - - referrer?: Maybe; - - bytes?: Maybe; -} - -export interface HttpResponseData { - status_code?: Maybe; - - body?: Maybe; - - bytes?: Maybe; -} - -export interface HttpEcsFields { - version?: Maybe; - - request?: Maybe; - - response?: Maybe; -} - -export interface UrlEcsFields { - domain?: Maybe; - - original?: Maybe; - - username?: Maybe; - - password?: Maybe; -} - -export interface ZeekFileData { - session_ids?: Maybe; - - timedout?: Maybe; - - local_orig?: Maybe; - - tx_host?: Maybe; - - source?: Maybe; - - is_orig?: Maybe; - - overflow_bytes?: Maybe; - - sha1?: Maybe; - - duration?: Maybe; - - depth?: Maybe; - - analyzers?: Maybe; - - mime_type?: Maybe; - - rx_host?: Maybe; - - total_bytes?: Maybe; - - fuid?: Maybe; - - seen_bytes?: Maybe; - - missing_bytes?: Maybe; - - md5?: Maybe; -} - -export interface ZeekSslData { - cipher?: Maybe; - - established?: Maybe; - - resumed?: Maybe; - - version?: Maybe; -} - -export interface ZeekEcsFields { - session_id?: Maybe; - - connection?: Maybe; - - notice?: Maybe; - - dns?: Maybe; - - http?: Maybe; - - files?: Maybe; - - ssl?: Maybe; -} - -export interface UserEcsFields { - domain?: Maybe; - - id?: Maybe; - - name?: Maybe; - - full_name?: Maybe; - - email?: Maybe; - - hash?: Maybe; - - group?: Maybe; -} - -export interface WinlogEcsFields { - event_id?: Maybe; -} - -export interface NetworkEcsField { - bytes?: Maybe; - - community_id?: Maybe; - - direction?: Maybe; - - packets?: Maybe; - - protocol?: Maybe; - - transport?: Maybe; -} - -export interface PackageEcsFields { - arch?: Maybe; - - entity_id?: Maybe; - - name?: Maybe; - - size?: Maybe; - - summary?: Maybe; - - version?: Maybe; -} - -export interface AuditEcsFields { - package?: Maybe; -} - -export interface SshEcsFields { - method?: Maybe; - - signature?: Maybe; -} - -export interface AuthEcsFields { - ssh?: Maybe; -} - -export interface SystemEcsField { - audit?: Maybe; - - auth?: Maybe; -} - -export interface RuleField { - id?: Maybe; - - rule_id?: Maybe; - - false_positives: string[]; - - saved_id?: Maybe; - - timeline_id?: Maybe; - - timeline_title?: Maybe; - - max_signals?: Maybe; - - risk_score?: Maybe; - - output_index?: Maybe; - - description?: Maybe; - - from?: Maybe; - - immutable?: Maybe; - - index?: Maybe; - - interval?: Maybe; - - language?: Maybe; - - query?: Maybe; - - references?: Maybe; - - severity?: Maybe; - - tags?: Maybe; - - threat?: Maybe; - - type?: Maybe; - - size?: Maybe; - - to?: Maybe; - - enabled?: Maybe; - - filters?: Maybe; - - created_at?: Maybe; - - updated_at?: Maybe; - - created_by?: Maybe; - - updated_by?: Maybe; - - version?: Maybe; - - note?: Maybe; - - threshold?: Maybe; - - exceptions_list?: Maybe; -} - -export interface SignalField { - rule?: Maybe; - - original_time?: Maybe; - - status?: Maybe; -} - -export interface RuleEcsField { - reference?: Maybe; -} - -export interface Ecs { - _id: string; - - _index?: Maybe; - - agent?: Maybe; - - auditd?: Maybe; - - destination?: Maybe; - - dns?: Maybe; - - endgame?: Maybe; - - event?: Maybe; - - geo?: Maybe; - - host?: Maybe; - - network?: Maybe; - - rule?: Maybe; - - signal?: Maybe; - - source?: Maybe; - - suricata?: Maybe; - - tls?: Maybe; - - zeek?: Maybe; - - http?: Maybe; - - url?: Maybe; - - timestamp?: Maybe; - - message?: Maybe; - - user?: Maybe; - - winlog?: Maybe; - - process?: Maybe; - - file?: Maybe; - - system?: Maybe; -} - -export interface EcsEdges { - node: Ecs; - - cursor: CursorType; -} - -export interface CursorType { - value?: Maybe; - - tiebreaker?: Maybe; -} - -/** A descriptor of a field in an index */ -export interface IndexField { - /** Where the field belong */ - category: string; - /** Example of field's value */ - example?: Maybe; - /** whether the field's belong to an alias index */ - indexes: (Maybe)[]; - /** The name of the field */ - name: string; - /** The type of the field's values as recognized by Kibana */ - type: string; - /** Whether the field's values can be efficiently searched for */ - searchable: boolean; - /** Whether the field's values can be aggregated */ - aggregatable: boolean; - /** Description of the field */ - description?: Maybe; - - format?: Maybe; - /** the elastic type as mapped in the index */ - esTypes?: Maybe; - - subType?: Maybe; -} - -export interface PageInfo { - endCursor?: Maybe; - - hasNextPage?: Maybe; -} - -export interface Inspect { - dsl: string[]; - - response: string[]; -} - -export interface PageInfoPaginated { - activePage: number; - - fakeTotalCount: number; - - showMorePagesIndicator: boolean; -} - -// ==================================================== -// Arguments -// ==================================================== - -export interface GetNoteQueryArgs { - id: string; -} -export interface GetNotesByTimelineIdQueryArgs { - timelineId: string; -} -export interface GetNotesByEventIdQueryArgs { - eventId: string; -} -export interface GetAllNotesQueryArgs { - pageInfo?: Maybe; - - search?: Maybe; - - sort?: Maybe; -} -export interface GetAllPinnedEventsByTimelineIdQueryArgs { - timelineId: string; -} -export interface SourceQueryArgs { - /** The id of the source */ - id: string; -} -export interface GetOneTimelineQueryArgs { - id: string; - - timelineType?: Maybe; -} -export interface GetAllTimelineQueryArgs { - pageInfo: PageInfoTimeline; - - search?: Maybe; - - sort?: Maybe; - - onlyUserFavorite?: Maybe; - - timelineType?: Maybe; - - status?: Maybe; -} -export interface IndicesExistSourceStatusArgs { - defaultIndex: string[]; -} -export interface IndexFieldsSourceStatusArgs { - defaultIndex: string[]; -} -export interface PersistNoteMutationArgs { - noteId?: Maybe; - - version?: Maybe; - - note: NoteInput; -} -export interface DeleteNoteMutationArgs { - id: string[]; -} -export interface DeleteNoteByTimelineIdMutationArgs { - timelineId: string; - - version?: Maybe; -} -export interface PersistPinnedEventOnTimelineMutationArgs { - pinnedEventId?: Maybe; - - eventId: string; - - timelineId?: Maybe; -} -export interface DeletePinnedEventOnTimelineMutationArgs { - id: string[]; -} -export interface DeleteAllPinnedEventsOnTimelineMutationArgs { - timelineId: string; -} -export interface PersistTimelineMutationArgs { - id?: Maybe; - - version?: Maybe; - - timeline: TimelineInput; -} -export interface PersistFavoriteMutationArgs { - timelineId?: Maybe; - - templateTimelineId?: Maybe; - - templateTimelineVersion?: Maybe; - - timelineType?: Maybe; -} -export interface DeleteTimelineMutationArgs { - id: string[]; -} - -import { GraphQLResolveInfo, GraphQLScalarType, GraphQLScalarTypeConfig } from 'graphql'; - -export type Resolver = ( - parent: Parent, - args: Args, - context: TContext, - info: GraphQLResolveInfo -) => Promise | Result; - -export interface ISubscriptionResolverObject { - subscribe( - parent: P, - args: Args, - context: TContext, - info: GraphQLResolveInfo - ): AsyncIterator | Promise>; - resolve?( - parent: P, - args: Args, - context: TContext, - info: GraphQLResolveInfo - ): R | Result | Promise; -} - -export type SubscriptionResolver = - | ((...args: any[]) => ISubscriptionResolverObject) - | ISubscriptionResolverObject; - -export type TypeResolveFn = ( - parent: Parent, - context: TContext, - info: GraphQLResolveInfo -) => Maybe; - -export type NextResolverFn = () => Promise; - -export type DirectiveResolverFn = ( - next: NextResolverFn, - source: any, - args: TArgs, - context: TContext, - info: GraphQLResolveInfo -) => TResult | Promise; - -export namespace QueryResolvers { - export interface Resolvers { - getNote?: GetNoteResolver; - - getNotesByTimelineId?: GetNotesByTimelineIdResolver; - - getNotesByEventId?: GetNotesByEventIdResolver; - - getAllNotes?: GetAllNotesResolver; - - getAllPinnedEventsByTimelineId?: GetAllPinnedEventsByTimelineIdResolver< - PinnedEvent[], - TypeParent, - TContext - >; - /** Get a security data source by id */ - source?: SourceResolver; - /** Get a list of all security data sources */ - allSources?: AllSourcesResolver; - - getOneTimeline?: GetOneTimelineResolver; - - getAllTimeline?: GetAllTimelineResolver; - } - - export type GetNoteResolver = Resolver< - R, - Parent, - TContext, - GetNoteArgs - >; - export interface GetNoteArgs { - id: string; - } - - export type GetNotesByTimelineIdResolver< - R = NoteResult[], - Parent = {}, - TContext = SiemContext - > = Resolver; - export interface GetNotesByTimelineIdArgs { - timelineId: string; - } - - export type GetNotesByEventIdResolver< - R = NoteResult[], - Parent = {}, - TContext = SiemContext - > = Resolver; - export interface GetNotesByEventIdArgs { - eventId: string; - } - - export type GetAllNotesResolver< - R = ResponseNotes, - Parent = {}, - TContext = SiemContext - > = Resolver; - export interface GetAllNotesArgs { - pageInfo?: Maybe; - - search?: Maybe; - - sort?: Maybe; - } - - export type GetAllPinnedEventsByTimelineIdResolver< - R = PinnedEvent[], - Parent = {}, - TContext = SiemContext - > = Resolver; - export interface GetAllPinnedEventsByTimelineIdArgs { - timelineId: string; - } - - export type SourceResolver = Resolver< - R, - Parent, - TContext, - SourceArgs - >; - export interface SourceArgs { - /** The id of the source */ - id: string; - } - - export type AllSourcesResolver = Resolver< - R, - Parent, - TContext - >; - export type GetOneTimelineResolver< - R = TimelineResult, - Parent = {}, - TContext = SiemContext - > = Resolver; - export interface GetOneTimelineArgs { - id: string; - - timelineType?: Maybe; - } - - export type GetAllTimelineResolver< - R = ResponseTimelines, - Parent = {}, - TContext = SiemContext - > = Resolver; - export interface GetAllTimelineArgs { - pageInfo: PageInfoTimeline; - - search?: Maybe; - - sort?: Maybe; - - onlyUserFavorite?: Maybe; - - timelineType?: Maybe; - - status?: Maybe; - } -} - -export namespace NoteResultResolvers { - export interface Resolvers { - eventId?: EventIdResolver, TypeParent, TContext>; - - note?: NoteResolver, TypeParent, TContext>; - - timelineId?: TimelineIdResolver, TypeParent, TContext>; - - noteId?: NoteIdResolver; - - created?: CreatedResolver, TypeParent, TContext>; - - createdBy?: CreatedByResolver, TypeParent, TContext>; - - timelineVersion?: TimelineVersionResolver, TypeParent, TContext>; - - updated?: UpdatedResolver, TypeParent, TContext>; - - updatedBy?: UpdatedByResolver, TypeParent, TContext>; - - version?: VersionResolver, TypeParent, TContext>; - } - - export type EventIdResolver< - R = Maybe, - Parent = NoteResult, - TContext = SiemContext - > = Resolver; - export type NoteResolver< - R = Maybe, - Parent = NoteResult, - TContext = SiemContext - > = Resolver; - export type TimelineIdResolver< - R = Maybe, - Parent = NoteResult, - TContext = SiemContext - > = Resolver; - export type NoteIdResolver = Resolver< - R, - Parent, - TContext - >; - export type CreatedResolver< - R = Maybe, - Parent = NoteResult, - TContext = SiemContext - > = Resolver; - export type CreatedByResolver< - R = Maybe, - Parent = NoteResult, - TContext = SiemContext - > = Resolver; - export type TimelineVersionResolver< - R = Maybe, - Parent = NoteResult, - TContext = SiemContext - > = Resolver; - export type UpdatedResolver< - R = Maybe, - Parent = NoteResult, - TContext = SiemContext - > = Resolver; - export type UpdatedByResolver< - R = Maybe, - Parent = NoteResult, - TContext = SiemContext - > = Resolver; - export type VersionResolver< - R = Maybe, - Parent = NoteResult, - TContext = SiemContext - > = Resolver; -} - -export namespace ResponseNotesResolvers { - export interface Resolvers { - notes?: NotesResolver; - - totalCount?: TotalCountResolver, TypeParent, TContext>; - } - - export type NotesResolver< - R = NoteResult[], - Parent = ResponseNotes, - TContext = SiemContext - > = Resolver; - export type TotalCountResolver< - R = Maybe, - Parent = ResponseNotes, - TContext = SiemContext - > = Resolver; -} - -export namespace PinnedEventResolvers { - export interface Resolvers { - code?: CodeResolver, TypeParent, TContext>; - - message?: MessageResolver, TypeParent, TContext>; - - pinnedEventId?: PinnedEventIdResolver; - - eventId?: EventIdResolver, TypeParent, TContext>; - - timelineId?: TimelineIdResolver, TypeParent, TContext>; - - timelineVersion?: TimelineVersionResolver, TypeParent, TContext>; - - created?: CreatedResolver, TypeParent, TContext>; - - createdBy?: CreatedByResolver, TypeParent, TContext>; - - updated?: UpdatedResolver, TypeParent, TContext>; - - updatedBy?: UpdatedByResolver, TypeParent, TContext>; - - version?: VersionResolver, TypeParent, TContext>; - } - - export type CodeResolver< - R = Maybe, - Parent = PinnedEvent, - TContext = SiemContext - > = Resolver; - export type MessageResolver< - R = Maybe, - Parent = PinnedEvent, - TContext = SiemContext - > = Resolver; - export type PinnedEventIdResolver< - R = string, - Parent = PinnedEvent, - TContext = SiemContext - > = Resolver; - export type EventIdResolver< - R = Maybe, - Parent = PinnedEvent, - TContext = SiemContext - > = Resolver; - export type TimelineIdResolver< - R = Maybe, - Parent = PinnedEvent, - TContext = SiemContext - > = Resolver; - export type TimelineVersionResolver< - R = Maybe, - Parent = PinnedEvent, - TContext = SiemContext - > = Resolver; - export type CreatedResolver< - R = Maybe, - Parent = PinnedEvent, - TContext = SiemContext - > = Resolver; - export type CreatedByResolver< - R = Maybe, - Parent = PinnedEvent, - TContext = SiemContext - > = Resolver; - export type UpdatedResolver< - R = Maybe, - Parent = PinnedEvent, - TContext = SiemContext - > = Resolver; - export type UpdatedByResolver< - R = Maybe, - Parent = PinnedEvent, - TContext = SiemContext - > = Resolver; - export type VersionResolver< - R = Maybe, - Parent = PinnedEvent, - TContext = SiemContext - > = Resolver; -} - -export namespace SourceResolvers { - export interface Resolvers { - /** The id of the source */ - id?: IdResolver; - /** The raw configuration of the source */ - configuration?: ConfigurationResolver; - /** The status of the source */ - status?: StatusResolver; - } - - export type IdResolver = Resolver< - R, - Parent, - TContext - >; - export type ConfigurationResolver< - R = SourceConfiguration, - Parent = Source, - TContext = SiemContext - > = Resolver; - export type StatusResolver = Resolver< - R, - Parent, - TContext - >; -} -/** A set of configuration options for a security data source */ -export namespace SourceConfigurationResolvers { - export interface Resolvers { - /** The field mapping to use for this source */ - fields?: FieldsResolver; - } - - export type FieldsResolver< - R = SourceFields, - Parent = SourceConfiguration, - TContext = SiemContext - > = Resolver; -} -/** A mapping of semantic fields to their document counterparts */ -export namespace SourceFieldsResolvers { - export interface Resolvers { - /** The field to identify a container by */ - container?: ContainerResolver; - /** The fields to identify a host by */ - host?: HostResolver; - /** The fields that may contain the log event message. The first field found win. */ - message?: MessageResolver; - /** The field to identify a pod by */ - pod?: PodResolver; - /** The field to use as a tiebreaker for log events that have identical timestamps */ - tiebreaker?: TiebreakerResolver; - /** The field to use as a timestamp for metrics and logs */ - timestamp?: TimestampResolver; - } - - export type ContainerResolver< - R = string, - Parent = SourceFields, - TContext = SiemContext - > = Resolver; - export type HostResolver = Resolver< - R, - Parent, - TContext - >; - export type MessageResolver< - R = string[], - Parent = SourceFields, - TContext = SiemContext - > = Resolver; - export type PodResolver = Resolver< - R, - Parent, - TContext - >; - export type TiebreakerResolver< - R = string, - Parent = SourceFields, - TContext = SiemContext - > = Resolver; - export type TimestampResolver< - R = string, - Parent = SourceFields, - TContext = SiemContext - > = Resolver; -} -/** The status of an infrastructure data source */ -export namespace SourceStatusResolvers { - export interface Resolvers { - /** Whether the configured alias or wildcard pattern resolve to any auditbeat indices */ - indicesExist?: IndicesExistResolver; - /** The list of fields defined in the index mappings */ - indexFields?: IndexFieldsResolver; - } - - export type IndicesExistResolver< - R = boolean, - Parent = SourceStatus, - TContext = SiemContext - > = Resolver; - export interface IndicesExistArgs { - defaultIndex: string[]; - } - - export type IndexFieldsResolver< - R = string[], - Parent = SourceStatus, - TContext = SiemContext - > = Resolver; - export interface IndexFieldsArgs { - defaultIndex: string[]; - } -} - -export namespace TimelineResultResolvers { - export interface Resolvers { - columns?: ColumnsResolver, TypeParent, TContext>; - - created?: CreatedResolver, TypeParent, TContext>; - - createdBy?: CreatedByResolver, TypeParent, TContext>; - - dataProviders?: DataProvidersResolver, TypeParent, TContext>; - - dateRange?: DateRangeResolver, TypeParent, TContext>; - - description?: DescriptionResolver, TypeParent, TContext>; - - eqlOptions?: EqlOptionsResolver, TypeParent, TContext>; - - eventIdToNoteIds?: EventIdToNoteIdsResolver, TypeParent, TContext>; - - eventType?: EventTypeResolver, TypeParent, TContext>; - - excludedRowRendererIds?: ExcludedRowRendererIdsResolver< - Maybe, - TypeParent, - TContext - >; - - favorite?: FavoriteResolver, TypeParent, TContext>; - - filters?: FiltersResolver, TypeParent, TContext>; - - kqlMode?: KqlModeResolver, TypeParent, TContext>; - - kqlQuery?: KqlQueryResolver, TypeParent, TContext>; - - indexNames?: IndexNamesResolver, TypeParent, TContext>; - - notes?: NotesResolver, TypeParent, TContext>; - - noteIds?: NoteIdsResolver, TypeParent, TContext>; - - pinnedEventIds?: PinnedEventIdsResolver, TypeParent, TContext>; - - pinnedEventsSaveObject?: PinnedEventsSaveObjectResolver< - Maybe, - TypeParent, - TContext - >; - - savedQueryId?: SavedQueryIdResolver, TypeParent, TContext>; - - savedObjectId?: SavedObjectIdResolver; - - sort?: SortResolver, TypeParent, TContext>; - - status?: StatusResolver, TypeParent, TContext>; - - title?: TitleResolver, TypeParent, TContext>; - - templateTimelineId?: TemplateTimelineIdResolver, TypeParent, TContext>; - - templateTimelineVersion?: TemplateTimelineVersionResolver, TypeParent, TContext>; - - timelineType?: TimelineTypeResolver, TypeParent, TContext>; - - updated?: UpdatedResolver, TypeParent, TContext>; - - updatedBy?: UpdatedByResolver, TypeParent, TContext>; - - version?: VersionResolver; - } - - export type ColumnsResolver< - R = Maybe, - Parent = TimelineResult, - TContext = SiemContext - > = Resolver; - export type CreatedResolver< - R = Maybe, - Parent = TimelineResult, - TContext = SiemContext - > = Resolver; - export type CreatedByResolver< - R = Maybe, - Parent = TimelineResult, - TContext = SiemContext - > = Resolver; - export type DataProvidersResolver< - R = Maybe, - Parent = TimelineResult, - TContext = SiemContext - > = Resolver; - export type DateRangeResolver< - R = Maybe, - Parent = TimelineResult, - TContext = SiemContext - > = Resolver; - export type DescriptionResolver< - R = Maybe, - Parent = TimelineResult, - TContext = SiemContext - > = Resolver; - export type EqlOptionsResolver< - R = Maybe, - Parent = TimelineResult, - TContext = SiemContext - > = Resolver; - export type EventIdToNoteIdsResolver< - R = Maybe, - Parent = TimelineResult, - TContext = SiemContext - > = Resolver; - export type EventTypeResolver< - R = Maybe, - Parent = TimelineResult, - TContext = SiemContext - > = Resolver; - export type ExcludedRowRendererIdsResolver< - R = Maybe, - Parent = TimelineResult, - TContext = SiemContext - > = Resolver; - export type FavoriteResolver< - R = Maybe, - Parent = TimelineResult, - TContext = SiemContext - > = Resolver; - export type FiltersResolver< - R = Maybe, - Parent = TimelineResult, - TContext = SiemContext - > = Resolver; - export type KqlModeResolver< - R = Maybe, - Parent = TimelineResult, - TContext = SiemContext - > = Resolver; - export type KqlQueryResolver< - R = Maybe, - Parent = TimelineResult, - TContext = SiemContext - > = Resolver; - export type IndexNamesResolver< - R = Maybe, - Parent = TimelineResult, - TContext = SiemContext - > = Resolver; - export type NotesResolver< - R = Maybe, - Parent = TimelineResult, - TContext = SiemContext - > = Resolver; - export type NoteIdsResolver< - R = Maybe, - Parent = TimelineResult, - TContext = SiemContext - > = Resolver; - export type PinnedEventIdsResolver< - R = Maybe, - Parent = TimelineResult, - TContext = SiemContext - > = Resolver; - export type PinnedEventsSaveObjectResolver< - R = Maybe, - Parent = TimelineResult, - TContext = SiemContext - > = Resolver; - export type SavedQueryIdResolver< - R = Maybe, - Parent = TimelineResult, - TContext = SiemContext - > = Resolver; - export type SavedObjectIdResolver< - R = string, - Parent = TimelineResult, - TContext = SiemContext - > = Resolver; - export type SortResolver< - R = Maybe, - Parent = TimelineResult, - TContext = SiemContext - > = Resolver; - export type StatusResolver< - R = Maybe, - Parent = TimelineResult, - TContext = SiemContext - > = Resolver; - export type TitleResolver< - R = Maybe, - Parent = TimelineResult, - TContext = SiemContext - > = Resolver; - export type TemplateTimelineIdResolver< - R = Maybe, - Parent = TimelineResult, - TContext = SiemContext - > = Resolver; - export type TemplateTimelineVersionResolver< - R = Maybe, - Parent = TimelineResult, - TContext = SiemContext - > = Resolver; - export type TimelineTypeResolver< - R = Maybe, - Parent = TimelineResult, - TContext = SiemContext - > = Resolver; - export type UpdatedResolver< - R = Maybe, - Parent = TimelineResult, - TContext = SiemContext - > = Resolver; - export type UpdatedByResolver< - R = Maybe, - Parent = TimelineResult, - TContext = SiemContext - > = Resolver; - export type VersionResolver< - R = string, - Parent = TimelineResult, - TContext = SiemContext - > = Resolver; -} - -export namespace ColumnHeaderResultResolvers { - export interface Resolvers { - aggregatable?: AggregatableResolver, TypeParent, TContext>; - - category?: CategoryResolver, TypeParent, TContext>; - - columnHeaderType?: ColumnHeaderTypeResolver, TypeParent, TContext>; - - description?: DescriptionResolver, TypeParent, TContext>; - - example?: ExampleResolver, TypeParent, TContext>; - - indexes?: IndexesResolver, TypeParent, TContext>; - - id?: IdResolver, TypeParent, TContext>; - - name?: NameResolver, TypeParent, TContext>; - - placeholder?: PlaceholderResolver, TypeParent, TContext>; - - searchable?: SearchableResolver, TypeParent, TContext>; - - type?: TypeResolver, TypeParent, TContext>; - } - - export type AggregatableResolver< - R = Maybe, - Parent = ColumnHeaderResult, - TContext = SiemContext - > = Resolver; - export type CategoryResolver< - R = Maybe, - Parent = ColumnHeaderResult, - TContext = SiemContext - > = Resolver; - export type ColumnHeaderTypeResolver< - R = Maybe, - Parent = ColumnHeaderResult, - TContext = SiemContext - > = Resolver; - export type DescriptionResolver< - R = Maybe, - Parent = ColumnHeaderResult, - TContext = SiemContext - > = Resolver; - export type ExampleResolver< - R = Maybe, - Parent = ColumnHeaderResult, - TContext = SiemContext - > = Resolver; - export type IndexesResolver< - R = Maybe, - Parent = ColumnHeaderResult, - TContext = SiemContext - > = Resolver; - export type IdResolver< - R = Maybe, - Parent = ColumnHeaderResult, - TContext = SiemContext - > = Resolver; - export type NameResolver< - R = Maybe, - Parent = ColumnHeaderResult, - TContext = SiemContext - > = Resolver; - export type PlaceholderResolver< - R = Maybe, - Parent = ColumnHeaderResult, - TContext = SiemContext - > = Resolver; - export type SearchableResolver< - R = Maybe, - Parent = ColumnHeaderResult, - TContext = SiemContext - > = Resolver; - export type TypeResolver< - R = Maybe, - Parent = ColumnHeaderResult, - TContext = SiemContext - > = Resolver; -} - -export namespace DataProviderResultResolvers { - export interface Resolvers { - id?: IdResolver, TypeParent, TContext>; - - name?: NameResolver, TypeParent, TContext>; - - enabled?: EnabledResolver, TypeParent, TContext>; - - excluded?: ExcludedResolver, TypeParent, TContext>; - - kqlQuery?: KqlQueryResolver, TypeParent, TContext>; - - queryMatch?: QueryMatchResolver, TypeParent, TContext>; - - type?: TypeResolver, TypeParent, TContext>; - - and?: AndResolver, TypeParent, TContext>; - } - - export type IdResolver< - R = Maybe, - Parent = DataProviderResult, - TContext = SiemContext - > = Resolver; - export type NameResolver< - R = Maybe, - Parent = DataProviderResult, - TContext = SiemContext - > = Resolver; - export type EnabledResolver< - R = Maybe, - Parent = DataProviderResult, - TContext = SiemContext - > = Resolver; - export type ExcludedResolver< - R = Maybe, - Parent = DataProviderResult, - TContext = SiemContext - > = Resolver; - export type KqlQueryResolver< - R = Maybe, - Parent = DataProviderResult, - TContext = SiemContext - > = Resolver; - export type QueryMatchResolver< - R = Maybe, - Parent = DataProviderResult, - TContext = SiemContext - > = Resolver; - export type TypeResolver< - R = Maybe, - Parent = DataProviderResult, - TContext = SiemContext - > = Resolver; - export type AndResolver< - R = Maybe, - Parent = DataProviderResult, - TContext = SiemContext - > = Resolver; -} - -export namespace QueryMatchResultResolvers { - export interface Resolvers { - field?: FieldResolver, TypeParent, TContext>; - - displayField?: DisplayFieldResolver, TypeParent, TContext>; - - value?: ValueResolver, TypeParent, TContext>; - - displayValue?: DisplayValueResolver, TypeParent, TContext>; - - operator?: OperatorResolver, TypeParent, TContext>; - } - - export type FieldResolver< - R = Maybe, - Parent = QueryMatchResult, - TContext = SiemContext - > = Resolver; - export type DisplayFieldResolver< - R = Maybe, - Parent = QueryMatchResult, - TContext = SiemContext - > = Resolver; - export type ValueResolver< - R = Maybe, - Parent = QueryMatchResult, - TContext = SiemContext - > = Resolver; - export type DisplayValueResolver< - R = Maybe, - Parent = QueryMatchResult, - TContext = SiemContext - > = Resolver; - export type OperatorResolver< - R = Maybe, - Parent = QueryMatchResult, - TContext = SiemContext - > = Resolver; -} - -export namespace DateRangePickerResultResolvers { - export interface Resolvers { - start?: StartResolver, TypeParent, TContext>; - - end?: EndResolver, TypeParent, TContext>; - } - - export type StartResolver< - R = Maybe, - Parent = DateRangePickerResult, - TContext = SiemContext - > = Resolver; - export type EndResolver< - R = Maybe, - Parent = DateRangePickerResult, - TContext = SiemContext - > = Resolver; -} - -export namespace EqlOptionsResultResolvers { - export interface Resolvers { - eventCategoryField?: EventCategoryFieldResolver, TypeParent, TContext>; - - tiebreakerField?: TiebreakerFieldResolver, TypeParent, TContext>; - - timestampField?: TimestampFieldResolver, TypeParent, TContext>; - - query?: QueryResolver, TypeParent, TContext>; - - size?: SizeResolver, TypeParent, TContext>; - } - - export type EventCategoryFieldResolver< - R = Maybe, - Parent = EqlOptionsResult, - TContext = SiemContext - > = Resolver; - export type TiebreakerFieldResolver< - R = Maybe, - Parent = EqlOptionsResult, - TContext = SiemContext - > = Resolver; - export type TimestampFieldResolver< - R = Maybe, - Parent = EqlOptionsResult, - TContext = SiemContext - > = Resolver; - export type QueryResolver< - R = Maybe, - Parent = EqlOptionsResult, - TContext = SiemContext - > = Resolver; - export type SizeResolver< - R = Maybe, - Parent = EqlOptionsResult, - TContext = SiemContext - > = Resolver; -} - -export namespace FavoriteTimelineResultResolvers { - export interface Resolvers { - fullName?: FullNameResolver, TypeParent, TContext>; - - userName?: UserNameResolver, TypeParent, TContext>; - - favoriteDate?: FavoriteDateResolver, TypeParent, TContext>; - } - - export type FullNameResolver< - R = Maybe, - Parent = FavoriteTimelineResult, - TContext = SiemContext - > = Resolver; - export type UserNameResolver< - R = Maybe, - Parent = FavoriteTimelineResult, - TContext = SiemContext - > = Resolver; - export type FavoriteDateResolver< - R = Maybe, - Parent = FavoriteTimelineResult, - TContext = SiemContext - > = Resolver; -} - -export namespace FilterTimelineResultResolvers { - export interface Resolvers { - exists?: ExistsResolver, TypeParent, TContext>; - - meta?: MetaResolver, TypeParent, TContext>; - - match_all?: MatchAllResolver, TypeParent, TContext>; - - missing?: MissingResolver, TypeParent, TContext>; - - query?: QueryResolver, TypeParent, TContext>; - - range?: RangeResolver, TypeParent, TContext>; - - script?: ScriptResolver, TypeParent, TContext>; - } - - export type ExistsResolver< - R = Maybe, - Parent = FilterTimelineResult, - TContext = SiemContext - > = Resolver; - export type MetaResolver< - R = Maybe, - Parent = FilterTimelineResult, - TContext = SiemContext - > = Resolver; - export type MatchAllResolver< - R = Maybe, - Parent = FilterTimelineResult, - TContext = SiemContext - > = Resolver; - export type MissingResolver< - R = Maybe, - Parent = FilterTimelineResult, - TContext = SiemContext - > = Resolver; - export type QueryResolver< - R = Maybe, - Parent = FilterTimelineResult, - TContext = SiemContext - > = Resolver; - export type RangeResolver< - R = Maybe, - Parent = FilterTimelineResult, - TContext = SiemContext - > = Resolver; - export type ScriptResolver< - R = Maybe, - Parent = FilterTimelineResult, - TContext = SiemContext - > = Resolver; -} - -export namespace FilterMetaTimelineResultResolvers { - export interface Resolvers { - alias?: AliasResolver, TypeParent, TContext>; - - controlledBy?: ControlledByResolver, TypeParent, TContext>; - - disabled?: DisabledResolver, TypeParent, TContext>; - - field?: FieldResolver, TypeParent, TContext>; - - formattedValue?: FormattedValueResolver, TypeParent, TContext>; - - index?: IndexResolver, TypeParent, TContext>; - - key?: KeyResolver, TypeParent, TContext>; - - negate?: NegateResolver, TypeParent, TContext>; - - params?: ParamsResolver, TypeParent, TContext>; - - type?: TypeResolver, TypeParent, TContext>; - - value?: ValueResolver, TypeParent, TContext>; - } - - export type AliasResolver< - R = Maybe, - Parent = FilterMetaTimelineResult, - TContext = SiemContext - > = Resolver; - export type ControlledByResolver< - R = Maybe, - Parent = FilterMetaTimelineResult, - TContext = SiemContext - > = Resolver; - export type DisabledResolver< - R = Maybe, - Parent = FilterMetaTimelineResult, - TContext = SiemContext - > = Resolver; - export type FieldResolver< - R = Maybe, - Parent = FilterMetaTimelineResult, - TContext = SiemContext - > = Resolver; - export type FormattedValueResolver< - R = Maybe, - Parent = FilterMetaTimelineResult, - TContext = SiemContext - > = Resolver; - export type IndexResolver< - R = Maybe, - Parent = FilterMetaTimelineResult, - TContext = SiemContext - > = Resolver; - export type KeyResolver< - R = Maybe, - Parent = FilterMetaTimelineResult, - TContext = SiemContext - > = Resolver; - export type NegateResolver< - R = Maybe, - Parent = FilterMetaTimelineResult, - TContext = SiemContext - > = Resolver; - export type ParamsResolver< - R = Maybe, - Parent = FilterMetaTimelineResult, - TContext = SiemContext - > = Resolver; - export type TypeResolver< - R = Maybe, - Parent = FilterMetaTimelineResult, - TContext = SiemContext - > = Resolver; - export type ValueResolver< - R = Maybe, - Parent = FilterMetaTimelineResult, - TContext = SiemContext - > = Resolver; -} - -export namespace SerializedFilterQueryResultResolvers { - export interface Resolvers { - filterQuery?: FilterQueryResolver, TypeParent, TContext>; - } - - export type FilterQueryResolver< - R = Maybe, - Parent = SerializedFilterQueryResult, - TContext = SiemContext - > = Resolver; -} - -export namespace SerializedKueryQueryResultResolvers { - export interface Resolvers { - kuery?: KueryResolver, TypeParent, TContext>; - - serializedQuery?: SerializedQueryResolver, TypeParent, TContext>; - } - - export type KueryResolver< - R = Maybe, - Parent = SerializedKueryQueryResult, - TContext = SiemContext - > = Resolver; - export type SerializedQueryResolver< - R = Maybe, - Parent = SerializedKueryQueryResult, - TContext = SiemContext - > = Resolver; -} - -export namespace KueryFilterQueryResultResolvers { - export interface Resolvers { - kind?: KindResolver, TypeParent, TContext>; - - expression?: ExpressionResolver, TypeParent, TContext>; - } - - export type KindResolver< - R = Maybe, - Parent = KueryFilterQueryResult, - TContext = SiemContext - > = Resolver; - export type ExpressionResolver< - R = Maybe, - Parent = KueryFilterQueryResult, - TContext = SiemContext - > = Resolver; -} - -export namespace ResponseTimelinesResolvers { - export interface Resolvers { - timeline?: TimelineResolver<(Maybe)[], TypeParent, TContext>; - - totalCount?: TotalCountResolver, TypeParent, TContext>; - - defaultTimelineCount?: DefaultTimelineCountResolver, TypeParent, TContext>; - - templateTimelineCount?: TemplateTimelineCountResolver, TypeParent, TContext>; - - elasticTemplateTimelineCount?: ElasticTemplateTimelineCountResolver< - Maybe, - TypeParent, - TContext - >; - - customTemplateTimelineCount?: CustomTemplateTimelineCountResolver< - Maybe, - TypeParent, - TContext - >; - - favoriteCount?: FavoriteCountResolver, TypeParent, TContext>; - } - - export type TimelineResolver< - R = (Maybe)[], - Parent = ResponseTimelines, - TContext = SiemContext - > = Resolver; - export type TotalCountResolver< - R = Maybe, - Parent = ResponseTimelines, - TContext = SiemContext - > = Resolver; - export type DefaultTimelineCountResolver< - R = Maybe, - Parent = ResponseTimelines, - TContext = SiemContext - > = Resolver; - export type TemplateTimelineCountResolver< - R = Maybe, - Parent = ResponseTimelines, - TContext = SiemContext - > = Resolver; - export type ElasticTemplateTimelineCountResolver< - R = Maybe, - Parent = ResponseTimelines, - TContext = SiemContext - > = Resolver; - export type CustomTemplateTimelineCountResolver< - R = Maybe, - Parent = ResponseTimelines, - TContext = SiemContext - > = Resolver; - export type FavoriteCountResolver< - R = Maybe, - Parent = ResponseTimelines, - TContext = SiemContext - > = Resolver; -} - -export namespace MutationResolvers { - export interface Resolvers { - /** Persists a note */ - persistNote?: PersistNoteResolver; - - deleteNote?: DeleteNoteResolver, TypeParent, TContext>; - - deleteNoteByTimelineId?: DeleteNoteByTimelineIdResolver, TypeParent, TContext>; - /** Persists a pinned event in a timeline */ - persistPinnedEventOnTimeline?: PersistPinnedEventOnTimelineResolver< - Maybe, - TypeParent, - TContext - >; - /** Remove a pinned events in a timeline */ - deletePinnedEventOnTimeline?: DeletePinnedEventOnTimelineResolver< - boolean, - TypeParent, - TContext - >; - /** Remove all pinned events in a timeline */ - deleteAllPinnedEventsOnTimeline?: DeleteAllPinnedEventsOnTimelineResolver< - boolean, - TypeParent, - TContext - >; - /** Persists a timeline */ - persistTimeline?: PersistTimelineResolver; - - persistFavorite?: PersistFavoriteResolver; - - deleteTimeline?: DeleteTimelineResolver; - } - - export type PersistNoteResolver = Resolver< - R, - Parent, - TContext, - PersistNoteArgs - >; - export interface PersistNoteArgs { - noteId?: Maybe; - - version?: Maybe; - - note: NoteInput; - } - - export type DeleteNoteResolver< - R = Maybe, - Parent = {}, - TContext = SiemContext - > = Resolver; - export interface DeleteNoteArgs { - id: string[]; - } - - export type DeleteNoteByTimelineIdResolver< - R = Maybe, - Parent = {}, - TContext = SiemContext - > = Resolver; - export interface DeleteNoteByTimelineIdArgs { - timelineId: string; - - version?: Maybe; - } - - export type PersistPinnedEventOnTimelineResolver< - R = Maybe, - Parent = {}, - TContext = SiemContext - > = Resolver; - export interface PersistPinnedEventOnTimelineArgs { - pinnedEventId?: Maybe; - - eventId: string; - - timelineId?: Maybe; - } - - export type DeletePinnedEventOnTimelineResolver< - R = boolean, - Parent = {}, - TContext = SiemContext - > = Resolver; - export interface DeletePinnedEventOnTimelineArgs { - id: string[]; - } - - export type DeleteAllPinnedEventsOnTimelineResolver< - R = boolean, - Parent = {}, - TContext = SiemContext - > = Resolver; - export interface DeleteAllPinnedEventsOnTimelineArgs { - timelineId: string; - } - - export type PersistTimelineResolver< - R = ResponseTimeline, - Parent = {}, - TContext = SiemContext - > = Resolver; - export interface PersistTimelineArgs { - id?: Maybe; - - version?: Maybe; - - timeline: TimelineInput; - } - - export type PersistFavoriteResolver< - R = ResponseFavoriteTimeline, - Parent = {}, - TContext = SiemContext - > = Resolver; - export interface PersistFavoriteArgs { - timelineId?: Maybe; - - templateTimelineId?: Maybe; - - templateTimelineVersion?: Maybe; - - timelineType?: Maybe; - } - - export type DeleteTimelineResolver = Resolver< - R, - Parent, - TContext, - DeleteTimelineArgs - >; - export interface DeleteTimelineArgs { - id: string[]; - } -} - -export namespace ResponseNoteResolvers { - export interface Resolvers { - code?: CodeResolver, TypeParent, TContext>; - - message?: MessageResolver, TypeParent, TContext>; - - note?: NoteResolver; - } - - export type CodeResolver< - R = Maybe, - Parent = ResponseNote, - TContext = SiemContext - > = Resolver; - export type MessageResolver< - R = Maybe, - Parent = ResponseNote, - TContext = SiemContext - > = Resolver; - export type NoteResolver< - R = NoteResult, - Parent = ResponseNote, - TContext = SiemContext - > = Resolver; -} - -export namespace ResponseTimelineResolvers { - export interface Resolvers { - code?: CodeResolver, TypeParent, TContext>; - - message?: MessageResolver, TypeParent, TContext>; - - timeline?: TimelineResolver; - } - - export type CodeResolver< - R = Maybe, - Parent = ResponseTimeline, - TContext = SiemContext - > = Resolver; - export type MessageResolver< - R = Maybe, - Parent = ResponseTimeline, - TContext = SiemContext - > = Resolver; - export type TimelineResolver< - R = TimelineResult, - Parent = ResponseTimeline, - TContext = SiemContext - > = Resolver; -} - -export namespace ResponseFavoriteTimelineResolvers { - export interface Resolvers { - code?: CodeResolver, TypeParent, TContext>; - - message?: MessageResolver, TypeParent, TContext>; - - savedObjectId?: SavedObjectIdResolver; - - templateTimelineId?: TemplateTimelineIdResolver, TypeParent, TContext>; - - templateTimelineVersion?: TemplateTimelineVersionResolver, TypeParent, TContext>; - - timelineType?: TimelineTypeResolver, TypeParent, TContext>; - - version?: VersionResolver; - - favorite?: FavoriteResolver, TypeParent, TContext>; - } - - export type CodeResolver< - R = Maybe, - Parent = ResponseFavoriteTimeline, - TContext = SiemContext - > = Resolver; - export type MessageResolver< - R = Maybe, - Parent = ResponseFavoriteTimeline, - TContext = SiemContext - > = Resolver; - export type SavedObjectIdResolver< - R = string, - Parent = ResponseFavoriteTimeline, - TContext = SiemContext - > = Resolver; - export type TemplateTimelineIdResolver< - R = Maybe, - Parent = ResponseFavoriteTimeline, - TContext = SiemContext - > = Resolver; - export type TemplateTimelineVersionResolver< - R = Maybe, - Parent = ResponseFavoriteTimeline, - TContext = SiemContext - > = Resolver; - export type TimelineTypeResolver< - R = Maybe, - Parent = ResponseFavoriteTimeline, - TContext = SiemContext - > = Resolver; - export type VersionResolver< - R = string, - Parent = ResponseFavoriteTimeline, - TContext = SiemContext - > = Resolver; - export type FavoriteResolver< - R = Maybe, - Parent = ResponseFavoriteTimeline, - TContext = SiemContext - > = Resolver; -} - -export namespace EventEcsFieldsResolvers { - export interface Resolvers { - action?: ActionResolver, TypeParent, TContext>; - - category?: CategoryResolver, TypeParent, TContext>; - - code?: CodeResolver, TypeParent, TContext>; - - created?: CreatedResolver, TypeParent, TContext>; - - dataset?: DatasetResolver, TypeParent, TContext>; - - duration?: DurationResolver, TypeParent, TContext>; - - end?: EndResolver, TypeParent, TContext>; - - hash?: HashResolver, TypeParent, TContext>; - - id?: IdResolver, TypeParent, TContext>; - - kind?: KindResolver, TypeParent, TContext>; - - module?: ModuleResolver, TypeParent, TContext>; - - original?: OriginalResolver, TypeParent, TContext>; - - outcome?: OutcomeResolver, TypeParent, TContext>; - - risk_score?: RiskScoreResolver, TypeParent, TContext>; - - risk_score_norm?: RiskScoreNormResolver, TypeParent, TContext>; - - severity?: SeverityResolver, TypeParent, TContext>; - - start?: StartResolver, TypeParent, TContext>; - - timezone?: TimezoneResolver, TypeParent, TContext>; - - type?: TypeResolver, TypeParent, TContext>; - } - - export type ActionResolver< - R = Maybe, - Parent = EventEcsFields, - TContext = SiemContext - > = Resolver; - export type CategoryResolver< - R = Maybe, - Parent = EventEcsFields, - TContext = SiemContext - > = Resolver; - export type CodeResolver< - R = Maybe, - Parent = EventEcsFields, - TContext = SiemContext - > = Resolver; - export type CreatedResolver< - R = Maybe, - Parent = EventEcsFields, - TContext = SiemContext - > = Resolver; - export type DatasetResolver< - R = Maybe, - Parent = EventEcsFields, - TContext = SiemContext - > = Resolver; - export type DurationResolver< - R = Maybe, - Parent = EventEcsFields, - TContext = SiemContext - > = Resolver; - export type EndResolver< - R = Maybe, - Parent = EventEcsFields, - TContext = SiemContext - > = Resolver; - export type HashResolver< - R = Maybe, - Parent = EventEcsFields, - TContext = SiemContext - > = Resolver; - export type IdResolver< - R = Maybe, - Parent = EventEcsFields, - TContext = SiemContext - > = Resolver; - export type KindResolver< - R = Maybe, - Parent = EventEcsFields, - TContext = SiemContext - > = Resolver; - export type ModuleResolver< - R = Maybe, - Parent = EventEcsFields, - TContext = SiemContext - > = Resolver; - export type OriginalResolver< - R = Maybe, - Parent = EventEcsFields, - TContext = SiemContext - > = Resolver; - export type OutcomeResolver< - R = Maybe, - Parent = EventEcsFields, - TContext = SiemContext - > = Resolver; - export type RiskScoreResolver< - R = Maybe, - Parent = EventEcsFields, - TContext = SiemContext - > = Resolver; - export type RiskScoreNormResolver< - R = Maybe, - Parent = EventEcsFields, - TContext = SiemContext - > = Resolver; - export type SeverityResolver< - R = Maybe, - Parent = EventEcsFields, - TContext = SiemContext - > = Resolver; - export type StartResolver< - R = Maybe, - Parent = EventEcsFields, - TContext = SiemContext - > = Resolver; - export type TimezoneResolver< - R = Maybe, - Parent = EventEcsFields, - TContext = SiemContext - > = Resolver; - export type TypeResolver< - R = Maybe, - Parent = EventEcsFields, - TContext = SiemContext - > = Resolver; -} - -export namespace LocationResolvers { - export interface Resolvers { - lon?: LonResolver, TypeParent, TContext>; - - lat?: LatResolver, TypeParent, TContext>; - } - - export type LonResolver< - R = Maybe, - Parent = Location, - TContext = SiemContext - > = Resolver; - export type LatResolver< - R = Maybe, - Parent = Location, - TContext = SiemContext - > = Resolver; -} - -export namespace GeoEcsFieldsResolvers { - export interface Resolvers { - city_name?: CityNameResolver, TypeParent, TContext>; - - continent_name?: ContinentNameResolver, TypeParent, TContext>; - - country_iso_code?: CountryIsoCodeResolver, TypeParent, TContext>; - - country_name?: CountryNameResolver, TypeParent, TContext>; - - location?: LocationResolver, TypeParent, TContext>; - - region_iso_code?: RegionIsoCodeResolver, TypeParent, TContext>; - - region_name?: RegionNameResolver, TypeParent, TContext>; - } - - export type CityNameResolver< - R = Maybe, - Parent = GeoEcsFields, - TContext = SiemContext - > = Resolver; - export type ContinentNameResolver< - R = Maybe, - Parent = GeoEcsFields, - TContext = SiemContext - > = Resolver; - export type CountryIsoCodeResolver< - R = Maybe, - Parent = GeoEcsFields, - TContext = SiemContext - > = Resolver; - export type CountryNameResolver< - R = Maybe, - Parent = GeoEcsFields, - TContext = SiemContext - > = Resolver; - export type LocationResolver< - R = Maybe, - Parent = GeoEcsFields, - TContext = SiemContext - > = Resolver; - export type RegionIsoCodeResolver< - R = Maybe, - Parent = GeoEcsFields, - TContext = SiemContext - > = Resolver; - export type RegionNameResolver< - R = Maybe, - Parent = GeoEcsFields, - TContext = SiemContext - > = Resolver; -} - -export namespace PrimarySecondaryResolvers { - export interface Resolvers { - primary?: PrimaryResolver, TypeParent, TContext>; - - secondary?: SecondaryResolver, TypeParent, TContext>; - - type?: TypeResolver, TypeParent, TContext>; - } - - export type PrimaryResolver< - R = Maybe, - Parent = PrimarySecondary, - TContext = SiemContext - > = Resolver; - export type SecondaryResolver< - R = Maybe, - Parent = PrimarySecondary, - TContext = SiemContext - > = Resolver; - export type TypeResolver< - R = Maybe, - Parent = PrimarySecondary, - TContext = SiemContext - > = Resolver; -} - -export namespace SummaryResolvers { - export interface Resolvers { - actor?: ActorResolver, TypeParent, TContext>; - - object?: ObjectResolver, TypeParent, TContext>; - - how?: HowResolver, TypeParent, TContext>; - - message_type?: MessageTypeResolver, TypeParent, TContext>; - - sequence?: SequenceResolver, TypeParent, TContext>; - } - - export type ActorResolver< - R = Maybe, - Parent = Summary, - TContext = SiemContext - > = Resolver; - export type ObjectResolver< - R = Maybe, - Parent = Summary, - TContext = SiemContext - > = Resolver; - export type HowResolver< - R = Maybe, - Parent = Summary, - TContext = SiemContext - > = Resolver; - export type MessageTypeResolver< - R = Maybe, - Parent = Summary, - TContext = SiemContext - > = Resolver; - export type SequenceResolver< - R = Maybe, - Parent = Summary, - TContext = SiemContext - > = Resolver; -} - -export namespace AgentEcsFieldResolvers { - export interface Resolvers { - type?: TypeResolver, TypeParent, TContext>; - } - - export type TypeResolver< - R = Maybe, - Parent = AgentEcsField, - TContext = SiemContext - > = Resolver; -} - -export namespace AuditdDataResolvers { - export interface Resolvers { - acct?: AcctResolver, TypeParent, TContext>; - - terminal?: TerminalResolver, TypeParent, TContext>; - - op?: OpResolver, TypeParent, TContext>; - } - - export type AcctResolver< - R = Maybe, - Parent = AuditdData, - TContext = SiemContext - > = Resolver; - export type TerminalResolver< - R = Maybe, - Parent = AuditdData, - TContext = SiemContext - > = Resolver; - export type OpResolver< - R = Maybe, - Parent = AuditdData, - TContext = SiemContext - > = Resolver; -} - -export namespace AuditdEcsFieldsResolvers { - export interface Resolvers { - result?: ResultResolver, TypeParent, TContext>; - - session?: SessionResolver, TypeParent, TContext>; - - data?: DataResolver, TypeParent, TContext>; - - summary?: SummaryResolver, TypeParent, TContext>; - - sequence?: SequenceResolver, TypeParent, TContext>; - } - - export type ResultResolver< - R = Maybe, - Parent = AuditdEcsFields, - TContext = SiemContext - > = Resolver; - export type SessionResolver< - R = Maybe, - Parent = AuditdEcsFields, - TContext = SiemContext - > = Resolver; - export type DataResolver< - R = Maybe, - Parent = AuditdEcsFields, - TContext = SiemContext - > = Resolver; - export type SummaryResolver< - R = Maybe, - Parent = AuditdEcsFields, - TContext = SiemContext - > = Resolver; - export type SequenceResolver< - R = Maybe, - Parent = AuditdEcsFields, - TContext = SiemContext - > = Resolver; -} - -export namespace OsEcsFieldsResolvers { - export interface Resolvers { - platform?: PlatformResolver, TypeParent, TContext>; - - name?: NameResolver, TypeParent, TContext>; - - full?: FullResolver, TypeParent, TContext>; - - family?: FamilyResolver, TypeParent, TContext>; - - version?: VersionResolver, TypeParent, TContext>; - - kernel?: KernelResolver, TypeParent, TContext>; - } - - export type PlatformResolver< - R = Maybe, - Parent = OsEcsFields, - TContext = SiemContext - > = Resolver; - export type NameResolver< - R = Maybe, - Parent = OsEcsFields, - TContext = SiemContext - > = Resolver; - export type FullResolver< - R = Maybe, - Parent = OsEcsFields, - TContext = SiemContext - > = Resolver; - export type FamilyResolver< - R = Maybe, - Parent = OsEcsFields, - TContext = SiemContext - > = Resolver; - export type VersionResolver< - R = Maybe, - Parent = OsEcsFields, - TContext = SiemContext - > = Resolver; - export type KernelResolver< - R = Maybe, - Parent = OsEcsFields, - TContext = SiemContext - > = Resolver; -} - -export namespace HostEcsFieldsResolvers { - export interface Resolvers { - architecture?: ArchitectureResolver, TypeParent, TContext>; - - id?: IdResolver, TypeParent, TContext>; - - ip?: IpResolver, TypeParent, TContext>; - - mac?: MacResolver, TypeParent, TContext>; - - name?: NameResolver, TypeParent, TContext>; - - os?: OsResolver, TypeParent, TContext>; - - type?: TypeResolver, TypeParent, TContext>; - } - - export type ArchitectureResolver< - R = Maybe, - Parent = HostEcsFields, - TContext = SiemContext - > = Resolver; - export type IdResolver< - R = Maybe, - Parent = HostEcsFields, - TContext = SiemContext - > = Resolver; - export type IpResolver< - R = Maybe, - Parent = HostEcsFields, - TContext = SiemContext - > = Resolver; - export type MacResolver< - R = Maybe, - Parent = HostEcsFields, - TContext = SiemContext - > = Resolver; - export type NameResolver< - R = Maybe, - Parent = HostEcsFields, - TContext = SiemContext - > = Resolver; - export type OsResolver< - R = Maybe, - Parent = HostEcsFields, - TContext = SiemContext - > = Resolver; - export type TypeResolver< - R = Maybe, - Parent = HostEcsFields, - TContext = SiemContext - > = Resolver; -} - -export namespace ThreadResolvers { - export interface Resolvers { - id?: IdResolver, TypeParent, TContext>; - - start?: StartResolver, TypeParent, TContext>; - } - - export type IdResolver< - R = Maybe, - Parent = Thread, - TContext = SiemContext - > = Resolver; - export type StartResolver< - R = Maybe, - Parent = Thread, - TContext = SiemContext - > = Resolver; -} - -export namespace ProcessHashDataResolvers { - export interface Resolvers { - md5?: Md5Resolver, TypeParent, TContext>; - - sha1?: Sha1Resolver, TypeParent, TContext>; - - sha256?: Sha256Resolver, TypeParent, TContext>; - } - - export type Md5Resolver< - R = Maybe, - Parent = ProcessHashData, - TContext = SiemContext - > = Resolver; - export type Sha1Resolver< - R = Maybe, - Parent = ProcessHashData, - TContext = SiemContext - > = Resolver; - export type Sha256Resolver< - R = Maybe, - Parent = ProcessHashData, - TContext = SiemContext - > = Resolver; -} - -export namespace ProcessEcsFieldsResolvers { - export interface Resolvers { - hash?: HashResolver, TypeParent, TContext>; - - pid?: PidResolver, TypeParent, TContext>; - - name?: NameResolver, TypeParent, TContext>; - - ppid?: PpidResolver, TypeParent, TContext>; - - args?: ArgsResolver, TypeParent, TContext>; - - entity_id?: EntityIdResolver, TypeParent, TContext>; - - executable?: ExecutableResolver, TypeParent, TContext>; - - title?: TitleResolver, TypeParent, TContext>; - - thread?: ThreadResolver, TypeParent, TContext>; - - working_directory?: WorkingDirectoryResolver, TypeParent, TContext>; - } - - export type HashResolver< - R = Maybe, - Parent = ProcessEcsFields, - TContext = SiemContext - > = Resolver; - export type PidResolver< - R = Maybe, - Parent = ProcessEcsFields, - TContext = SiemContext - > = Resolver; - export type NameResolver< - R = Maybe, - Parent = ProcessEcsFields, - TContext = SiemContext - > = Resolver; - export type PpidResolver< - R = Maybe, - Parent = ProcessEcsFields, - TContext = SiemContext - > = Resolver; - export type ArgsResolver< - R = Maybe, - Parent = ProcessEcsFields, - TContext = SiemContext - > = Resolver; - export type EntityIdResolver< - R = Maybe, - Parent = ProcessEcsFields, - TContext = SiemContext - > = Resolver; - export type ExecutableResolver< - R = Maybe, - Parent = ProcessEcsFields, - TContext = SiemContext - > = Resolver; - export type TitleResolver< - R = Maybe, - Parent = ProcessEcsFields, - TContext = SiemContext - > = Resolver; - export type ThreadResolver< - R = Maybe, - Parent = ProcessEcsFields, - TContext = SiemContext - > = Resolver; - export type WorkingDirectoryResolver< - R = Maybe, - Parent = ProcessEcsFields, - TContext = SiemContext - > = Resolver; -} - -export namespace SourceEcsFieldsResolvers { - export interface Resolvers { - bytes?: BytesResolver, TypeParent, TContext>; - - ip?: IpResolver, TypeParent, TContext>; - - port?: PortResolver, TypeParent, TContext>; - - domain?: DomainResolver, TypeParent, TContext>; - - geo?: GeoResolver, TypeParent, TContext>; - - packets?: PacketsResolver, TypeParent, TContext>; - } - - export type BytesResolver< - R = Maybe, - Parent = SourceEcsFields, - TContext = SiemContext - > = Resolver; - export type IpResolver< - R = Maybe, - Parent = SourceEcsFields, - TContext = SiemContext - > = Resolver; - export type PortResolver< - R = Maybe, - Parent = SourceEcsFields, - TContext = SiemContext - > = Resolver; - export type DomainResolver< - R = Maybe, - Parent = SourceEcsFields, - TContext = SiemContext - > = Resolver; - export type GeoResolver< - R = Maybe, - Parent = SourceEcsFields, - TContext = SiemContext - > = Resolver; - export type PacketsResolver< - R = Maybe, - Parent = SourceEcsFields, - TContext = SiemContext - > = Resolver; -} - -export namespace DestinationEcsFieldsResolvers { - export interface Resolvers { - bytes?: BytesResolver, TypeParent, TContext>; - - ip?: IpResolver, TypeParent, TContext>; - - port?: PortResolver, TypeParent, TContext>; - - domain?: DomainResolver, TypeParent, TContext>; - - geo?: GeoResolver, TypeParent, TContext>; - - packets?: PacketsResolver, TypeParent, TContext>; - } - - export type BytesResolver< - R = Maybe, - Parent = DestinationEcsFields, - TContext = SiemContext - > = Resolver; - export type IpResolver< - R = Maybe, - Parent = DestinationEcsFields, - TContext = SiemContext - > = Resolver; - export type PortResolver< - R = Maybe, - Parent = DestinationEcsFields, - TContext = SiemContext - > = Resolver; - export type DomainResolver< - R = Maybe, - Parent = DestinationEcsFields, - TContext = SiemContext - > = Resolver; - export type GeoResolver< - R = Maybe, - Parent = DestinationEcsFields, - TContext = SiemContext - > = Resolver; - export type PacketsResolver< - R = Maybe, - Parent = DestinationEcsFields, - TContext = SiemContext - > = Resolver; -} - -export namespace DnsQuestionDataResolvers { - export interface Resolvers { - name?: NameResolver, TypeParent, TContext>; - - type?: TypeResolver, TypeParent, TContext>; - } - - export type NameResolver< - R = Maybe, - Parent = DnsQuestionData, - TContext = SiemContext - > = Resolver; - export type TypeResolver< - R = Maybe, - Parent = DnsQuestionData, - TContext = SiemContext - > = Resolver; -} - -export namespace DnsEcsFieldsResolvers { - export interface Resolvers { - question?: QuestionResolver, TypeParent, TContext>; - - resolved_ip?: ResolvedIpResolver, TypeParent, TContext>; - - response_code?: ResponseCodeResolver, TypeParent, TContext>; - } - - export type QuestionResolver< - R = Maybe, - Parent = DnsEcsFields, - TContext = SiemContext - > = Resolver; - export type ResolvedIpResolver< - R = Maybe, - Parent = DnsEcsFields, - TContext = SiemContext - > = Resolver; - export type ResponseCodeResolver< - R = Maybe, - Parent = DnsEcsFields, - TContext = SiemContext - > = Resolver; -} - -export namespace EndgameEcsFieldsResolvers { - export interface Resolvers { - exit_code?: ExitCodeResolver, TypeParent, TContext>; - - file_name?: FileNameResolver, TypeParent, TContext>; - - file_path?: FilePathResolver, TypeParent, TContext>; - - logon_type?: LogonTypeResolver, TypeParent, TContext>; - - parent_process_name?: ParentProcessNameResolver, TypeParent, TContext>; - - pid?: PidResolver, TypeParent, TContext>; - - process_name?: ProcessNameResolver, TypeParent, TContext>; - - subject_domain_name?: SubjectDomainNameResolver, TypeParent, TContext>; - - subject_logon_id?: SubjectLogonIdResolver, TypeParent, TContext>; - - subject_user_name?: SubjectUserNameResolver, TypeParent, TContext>; - - target_domain_name?: TargetDomainNameResolver, TypeParent, TContext>; - - target_logon_id?: TargetLogonIdResolver, TypeParent, TContext>; - - target_user_name?: TargetUserNameResolver, TypeParent, TContext>; - } - - export type ExitCodeResolver< - R = Maybe, - Parent = EndgameEcsFields, - TContext = SiemContext - > = Resolver; - export type FileNameResolver< - R = Maybe, - Parent = EndgameEcsFields, - TContext = SiemContext - > = Resolver; - export type FilePathResolver< - R = Maybe, - Parent = EndgameEcsFields, - TContext = SiemContext - > = Resolver; - export type LogonTypeResolver< - R = Maybe, - Parent = EndgameEcsFields, - TContext = SiemContext - > = Resolver; - export type ParentProcessNameResolver< - R = Maybe, - Parent = EndgameEcsFields, - TContext = SiemContext - > = Resolver; - export type PidResolver< - R = Maybe, - Parent = EndgameEcsFields, - TContext = SiemContext - > = Resolver; - export type ProcessNameResolver< - R = Maybe, - Parent = EndgameEcsFields, - TContext = SiemContext - > = Resolver; - export type SubjectDomainNameResolver< - R = Maybe, - Parent = EndgameEcsFields, - TContext = SiemContext - > = Resolver; - export type SubjectLogonIdResolver< - R = Maybe, - Parent = EndgameEcsFields, - TContext = SiemContext - > = Resolver; - export type SubjectUserNameResolver< - R = Maybe, - Parent = EndgameEcsFields, - TContext = SiemContext - > = Resolver; - export type TargetDomainNameResolver< - R = Maybe, - Parent = EndgameEcsFields, - TContext = SiemContext - > = Resolver; - export type TargetLogonIdResolver< - R = Maybe, - Parent = EndgameEcsFields, - TContext = SiemContext - > = Resolver; - export type TargetUserNameResolver< - R = Maybe, - Parent = EndgameEcsFields, - TContext = SiemContext - > = Resolver; -} - -export namespace SuricataAlertDataResolvers { - export interface Resolvers { - signature?: SignatureResolver, TypeParent, TContext>; - - signature_id?: SignatureIdResolver, TypeParent, TContext>; - } - - export type SignatureResolver< - R = Maybe, - Parent = SuricataAlertData, - TContext = SiemContext - > = Resolver; - export type SignatureIdResolver< - R = Maybe, - Parent = SuricataAlertData, - TContext = SiemContext - > = Resolver; -} - -export namespace SuricataEveDataResolvers { - export interface Resolvers { - alert?: AlertResolver, TypeParent, TContext>; - - flow_id?: FlowIdResolver, TypeParent, TContext>; - - proto?: ProtoResolver, TypeParent, TContext>; - } - - export type AlertResolver< - R = Maybe, - Parent = SuricataEveData, - TContext = SiemContext - > = Resolver; - export type FlowIdResolver< - R = Maybe, - Parent = SuricataEveData, - TContext = SiemContext - > = Resolver; - export type ProtoResolver< - R = Maybe, - Parent = SuricataEveData, - TContext = SiemContext - > = Resolver; -} - -export namespace SuricataEcsFieldsResolvers { - export interface Resolvers { - eve?: EveResolver, TypeParent, TContext>; - } - - export type EveResolver< - R = Maybe, - Parent = SuricataEcsFields, - TContext = SiemContext - > = Resolver; -} - -export namespace TlsJa3DataResolvers { - export interface Resolvers { - hash?: HashResolver, TypeParent, TContext>; - } - - export type HashResolver< - R = Maybe, - Parent = TlsJa3Data, - TContext = SiemContext - > = Resolver; -} - -export namespace FingerprintDataResolvers { - export interface Resolvers { - sha1?: Sha1Resolver, TypeParent, TContext>; - } - - export type Sha1Resolver< - R = Maybe, - Parent = FingerprintData, - TContext = SiemContext - > = Resolver; -} - -export namespace TlsClientCertificateDataResolvers { - export interface Resolvers { - fingerprint?: FingerprintResolver, TypeParent, TContext>; - } - - export type FingerprintResolver< - R = Maybe, - Parent = TlsClientCertificateData, - TContext = SiemContext - > = Resolver; -} - -export namespace TlsServerCertificateDataResolvers { - export interface Resolvers { - fingerprint?: FingerprintResolver, TypeParent, TContext>; - } - - export type FingerprintResolver< - R = Maybe, - Parent = TlsServerCertificateData, - TContext = SiemContext - > = Resolver; -} - -export namespace TlsFingerprintsDataResolvers { - export interface Resolvers { - ja3?: Ja3Resolver, TypeParent, TContext>; - } - - export type Ja3Resolver< - R = Maybe, - Parent = TlsFingerprintsData, - TContext = SiemContext - > = Resolver; -} - -export namespace TlsEcsFieldsResolvers { - export interface Resolvers { - client_certificate?: ClientCertificateResolver< - Maybe, - TypeParent, - TContext - >; - - fingerprints?: FingerprintsResolver, TypeParent, TContext>; - - server_certificate?: ServerCertificateResolver< - Maybe, - TypeParent, - TContext - >; - } - - export type ClientCertificateResolver< - R = Maybe, - Parent = TlsEcsFields, - TContext = SiemContext - > = Resolver; - export type FingerprintsResolver< - R = Maybe, - Parent = TlsEcsFields, - TContext = SiemContext - > = Resolver; - export type ServerCertificateResolver< - R = Maybe, - Parent = TlsEcsFields, - TContext = SiemContext - > = Resolver; -} - -export namespace ZeekConnectionDataResolvers { - export interface Resolvers { - local_resp?: LocalRespResolver, TypeParent, TContext>; - - local_orig?: LocalOrigResolver, TypeParent, TContext>; - - missed_bytes?: MissedBytesResolver, TypeParent, TContext>; - - state?: StateResolver, TypeParent, TContext>; - - history?: HistoryResolver, TypeParent, TContext>; - } - - export type LocalRespResolver< - R = Maybe, - Parent = ZeekConnectionData, - TContext = SiemContext - > = Resolver; - export type LocalOrigResolver< - R = Maybe, - Parent = ZeekConnectionData, - TContext = SiemContext - > = Resolver; - export type MissedBytesResolver< - R = Maybe, - Parent = ZeekConnectionData, - TContext = SiemContext - > = Resolver; - export type StateResolver< - R = Maybe, - Parent = ZeekConnectionData, - TContext = SiemContext - > = Resolver; - export type HistoryResolver< - R = Maybe, - Parent = ZeekConnectionData, - TContext = SiemContext - > = Resolver; -} - -export namespace ZeekNoticeDataResolvers { - export interface Resolvers { - suppress_for?: SuppressForResolver, TypeParent, TContext>; - - msg?: MsgResolver, TypeParent, TContext>; - - note?: NoteResolver, TypeParent, TContext>; - - sub?: SubResolver, TypeParent, TContext>; - - dst?: DstResolver, TypeParent, TContext>; - - dropped?: DroppedResolver, TypeParent, TContext>; - - peer_descr?: PeerDescrResolver, TypeParent, TContext>; - } - - export type SuppressForResolver< - R = Maybe, - Parent = ZeekNoticeData, - TContext = SiemContext - > = Resolver; - export type MsgResolver< - R = Maybe, - Parent = ZeekNoticeData, - TContext = SiemContext - > = Resolver; - export type NoteResolver< - R = Maybe, - Parent = ZeekNoticeData, - TContext = SiemContext - > = Resolver; - export type SubResolver< - R = Maybe, - Parent = ZeekNoticeData, - TContext = SiemContext - > = Resolver; - export type DstResolver< - R = Maybe, - Parent = ZeekNoticeData, - TContext = SiemContext - > = Resolver; - export type DroppedResolver< - R = Maybe, - Parent = ZeekNoticeData, - TContext = SiemContext - > = Resolver; - export type PeerDescrResolver< - R = Maybe, - Parent = ZeekNoticeData, - TContext = SiemContext - > = Resolver; -} - -export namespace ZeekDnsDataResolvers { - export interface Resolvers { - AA?: AaResolver, TypeParent, TContext>; - - qclass_name?: QclassNameResolver, TypeParent, TContext>; - - RD?: RdResolver, TypeParent, TContext>; - - qtype_name?: QtypeNameResolver, TypeParent, TContext>; - - rejected?: RejectedResolver, TypeParent, TContext>; - - qtype?: QtypeResolver, TypeParent, TContext>; - - query?: QueryResolver, TypeParent, TContext>; - - trans_id?: TransIdResolver, TypeParent, TContext>; - - qclass?: QclassResolver, TypeParent, TContext>; - - RA?: RaResolver, TypeParent, TContext>; - - TC?: TcResolver, TypeParent, TContext>; - } - - export type AaResolver< - R = Maybe, - Parent = ZeekDnsData, - TContext = SiemContext - > = Resolver; - export type QclassNameResolver< - R = Maybe, - Parent = ZeekDnsData, - TContext = SiemContext - > = Resolver; - export type RdResolver< - R = Maybe, - Parent = ZeekDnsData, - TContext = SiemContext - > = Resolver; - export type QtypeNameResolver< - R = Maybe, - Parent = ZeekDnsData, - TContext = SiemContext - > = Resolver; - export type RejectedResolver< - R = Maybe, - Parent = ZeekDnsData, - TContext = SiemContext - > = Resolver; - export type QtypeResolver< - R = Maybe, - Parent = ZeekDnsData, - TContext = SiemContext - > = Resolver; - export type QueryResolver< - R = Maybe, - Parent = ZeekDnsData, - TContext = SiemContext - > = Resolver; - export type TransIdResolver< - R = Maybe, - Parent = ZeekDnsData, - TContext = SiemContext - > = Resolver; - export type QclassResolver< - R = Maybe, - Parent = ZeekDnsData, - TContext = SiemContext - > = Resolver; - export type RaResolver< - R = Maybe, - Parent = ZeekDnsData, - TContext = SiemContext - > = Resolver; - export type TcResolver< - R = Maybe, - Parent = ZeekDnsData, - TContext = SiemContext - > = Resolver; -} - -export namespace FileFieldsResolvers { - export interface Resolvers { - name?: NameResolver, TypeParent, TContext>; - - path?: PathResolver, TypeParent, TContext>; - - target_path?: TargetPathResolver, TypeParent, TContext>; - - extension?: ExtensionResolver, TypeParent, TContext>; - - type?: TypeResolver, TypeParent, TContext>; - - device?: DeviceResolver, TypeParent, TContext>; - - inode?: InodeResolver, TypeParent, TContext>; - - uid?: UidResolver, TypeParent, TContext>; - - owner?: OwnerResolver, TypeParent, TContext>; - - gid?: GidResolver, TypeParent, TContext>; - - group?: GroupResolver, TypeParent, TContext>; - - mode?: ModeResolver, TypeParent, TContext>; - - size?: SizeResolver, TypeParent, TContext>; - - mtime?: MtimeResolver, TypeParent, TContext>; - - ctime?: CtimeResolver, TypeParent, TContext>; - } - - export type NameResolver< - R = Maybe, - Parent = FileFields, - TContext = SiemContext - > = Resolver; - export type PathResolver< - R = Maybe, - Parent = FileFields, - TContext = SiemContext - > = Resolver; - export type TargetPathResolver< - R = Maybe, - Parent = FileFields, - TContext = SiemContext - > = Resolver; - export type ExtensionResolver< - R = Maybe, - Parent = FileFields, - TContext = SiemContext - > = Resolver; - export type TypeResolver< - R = Maybe, - Parent = FileFields, - TContext = SiemContext - > = Resolver; - export type DeviceResolver< - R = Maybe, - Parent = FileFields, - TContext = SiemContext - > = Resolver; - export type InodeResolver< - R = Maybe, - Parent = FileFields, - TContext = SiemContext - > = Resolver; - export type UidResolver< - R = Maybe, - Parent = FileFields, - TContext = SiemContext - > = Resolver; - export type OwnerResolver< - R = Maybe, - Parent = FileFields, - TContext = SiemContext - > = Resolver; - export type GidResolver< - R = Maybe, - Parent = FileFields, - TContext = SiemContext - > = Resolver; - export type GroupResolver< - R = Maybe, - Parent = FileFields, - TContext = SiemContext - > = Resolver; - export type ModeResolver< - R = Maybe, - Parent = FileFields, - TContext = SiemContext - > = Resolver; - export type SizeResolver< - R = Maybe, - Parent = FileFields, - TContext = SiemContext - > = Resolver; - export type MtimeResolver< - R = Maybe, - Parent = FileFields, - TContext = SiemContext - > = Resolver; - export type CtimeResolver< - R = Maybe, - Parent = FileFields, - TContext = SiemContext - > = Resolver; -} - -export namespace ZeekHttpDataResolvers { - export interface Resolvers { - resp_mime_types?: RespMimeTypesResolver, TypeParent, TContext>; - - trans_depth?: TransDepthResolver, TypeParent, TContext>; - - status_msg?: StatusMsgResolver, TypeParent, TContext>; - - resp_fuids?: RespFuidsResolver, TypeParent, TContext>; - - tags?: TagsResolver, TypeParent, TContext>; - } - - export type RespMimeTypesResolver< - R = Maybe, - Parent = ZeekHttpData, - TContext = SiemContext - > = Resolver; - export type TransDepthResolver< - R = Maybe, - Parent = ZeekHttpData, - TContext = SiemContext - > = Resolver; - export type StatusMsgResolver< - R = Maybe, - Parent = ZeekHttpData, - TContext = SiemContext - > = Resolver; - export type RespFuidsResolver< - R = Maybe, - Parent = ZeekHttpData, - TContext = SiemContext - > = Resolver; - export type TagsResolver< - R = Maybe, - Parent = ZeekHttpData, - TContext = SiemContext - > = Resolver; -} - -export namespace HttpBodyDataResolvers { - export interface Resolvers { - content?: ContentResolver, TypeParent, TContext>; - - bytes?: BytesResolver, TypeParent, TContext>; - } - - export type ContentResolver< - R = Maybe, - Parent = HttpBodyData, - TContext = SiemContext - > = Resolver; - export type BytesResolver< - R = Maybe, - Parent = HttpBodyData, - TContext = SiemContext - > = Resolver; -} - -export namespace HttpRequestDataResolvers { - export interface Resolvers { - method?: MethodResolver, TypeParent, TContext>; - - body?: BodyResolver, TypeParent, TContext>; - - referrer?: ReferrerResolver, TypeParent, TContext>; - - bytes?: BytesResolver, TypeParent, TContext>; - } - - export type MethodResolver< - R = Maybe, - Parent = HttpRequestData, - TContext = SiemContext - > = Resolver; - export type BodyResolver< - R = Maybe, - Parent = HttpRequestData, - TContext = SiemContext - > = Resolver; - export type ReferrerResolver< - R = Maybe, - Parent = HttpRequestData, - TContext = SiemContext - > = Resolver; - export type BytesResolver< - R = Maybe, - Parent = HttpRequestData, - TContext = SiemContext - > = Resolver; -} - -export namespace HttpResponseDataResolvers { - export interface Resolvers { - status_code?: StatusCodeResolver, TypeParent, TContext>; - - body?: BodyResolver, TypeParent, TContext>; - - bytes?: BytesResolver, TypeParent, TContext>; - } - - export type StatusCodeResolver< - R = Maybe, - Parent = HttpResponseData, - TContext = SiemContext - > = Resolver; - export type BodyResolver< - R = Maybe, - Parent = HttpResponseData, - TContext = SiemContext - > = Resolver; - export type BytesResolver< - R = Maybe, - Parent = HttpResponseData, - TContext = SiemContext - > = Resolver; -} - -export namespace HttpEcsFieldsResolvers { - export interface Resolvers { - version?: VersionResolver, TypeParent, TContext>; - - request?: RequestResolver, TypeParent, TContext>; - - response?: ResponseResolver, TypeParent, TContext>; - } - - export type VersionResolver< - R = Maybe, - Parent = HttpEcsFields, - TContext = SiemContext - > = Resolver; - export type RequestResolver< - R = Maybe, - Parent = HttpEcsFields, - TContext = SiemContext - > = Resolver; - export type ResponseResolver< - R = Maybe, - Parent = HttpEcsFields, - TContext = SiemContext - > = Resolver; -} - -export namespace UrlEcsFieldsResolvers { - export interface Resolvers { - domain?: DomainResolver, TypeParent, TContext>; - - original?: OriginalResolver, TypeParent, TContext>; - - username?: UsernameResolver, TypeParent, TContext>; - - password?: PasswordResolver, TypeParent, TContext>; - } - - export type DomainResolver< - R = Maybe, - Parent = UrlEcsFields, - TContext = SiemContext - > = Resolver; - export type OriginalResolver< - R = Maybe, - Parent = UrlEcsFields, - TContext = SiemContext - > = Resolver; - export type UsernameResolver< - R = Maybe, - Parent = UrlEcsFields, - TContext = SiemContext - > = Resolver; - export type PasswordResolver< - R = Maybe, - Parent = UrlEcsFields, - TContext = SiemContext - > = Resolver; -} - -export namespace ZeekFileDataResolvers { - export interface Resolvers { - session_ids?: SessionIdsResolver, TypeParent, TContext>; - - timedout?: TimedoutResolver, TypeParent, TContext>; - - local_orig?: LocalOrigResolver, TypeParent, TContext>; - - tx_host?: TxHostResolver, TypeParent, TContext>; - - source?: SourceResolver, TypeParent, TContext>; - - is_orig?: IsOrigResolver, TypeParent, TContext>; - - overflow_bytes?: OverflowBytesResolver, TypeParent, TContext>; - - sha1?: Sha1Resolver, TypeParent, TContext>; - - duration?: DurationResolver, TypeParent, TContext>; - - depth?: DepthResolver, TypeParent, TContext>; - - analyzers?: AnalyzersResolver, TypeParent, TContext>; - - mime_type?: MimeTypeResolver, TypeParent, TContext>; - - rx_host?: RxHostResolver, TypeParent, TContext>; - - total_bytes?: TotalBytesResolver, TypeParent, TContext>; - - fuid?: FuidResolver, TypeParent, TContext>; - - seen_bytes?: SeenBytesResolver, TypeParent, TContext>; - - missing_bytes?: MissingBytesResolver, TypeParent, TContext>; - - md5?: Md5Resolver, TypeParent, TContext>; - } - - export type SessionIdsResolver< - R = Maybe, - Parent = ZeekFileData, - TContext = SiemContext - > = Resolver; - export type TimedoutResolver< - R = Maybe, - Parent = ZeekFileData, - TContext = SiemContext - > = Resolver; - export type LocalOrigResolver< - R = Maybe, - Parent = ZeekFileData, - TContext = SiemContext - > = Resolver; - export type TxHostResolver< - R = Maybe, - Parent = ZeekFileData, - TContext = SiemContext - > = Resolver; - export type SourceResolver< - R = Maybe, - Parent = ZeekFileData, - TContext = SiemContext - > = Resolver; - export type IsOrigResolver< - R = Maybe, - Parent = ZeekFileData, - TContext = SiemContext - > = Resolver; - export type OverflowBytesResolver< - R = Maybe, - Parent = ZeekFileData, - TContext = SiemContext - > = Resolver; - export type Sha1Resolver< - R = Maybe, - Parent = ZeekFileData, - TContext = SiemContext - > = Resolver; - export type DurationResolver< - R = Maybe, - Parent = ZeekFileData, - TContext = SiemContext - > = Resolver; - export type DepthResolver< - R = Maybe, - Parent = ZeekFileData, - TContext = SiemContext - > = Resolver; - export type AnalyzersResolver< - R = Maybe, - Parent = ZeekFileData, - TContext = SiemContext - > = Resolver; - export type MimeTypeResolver< - R = Maybe, - Parent = ZeekFileData, - TContext = SiemContext - > = Resolver; - export type RxHostResolver< - R = Maybe, - Parent = ZeekFileData, - TContext = SiemContext - > = Resolver; - export type TotalBytesResolver< - R = Maybe, - Parent = ZeekFileData, - TContext = SiemContext - > = Resolver; - export type FuidResolver< - R = Maybe, - Parent = ZeekFileData, - TContext = SiemContext - > = Resolver; - export type SeenBytesResolver< - R = Maybe, - Parent = ZeekFileData, - TContext = SiemContext - > = Resolver; - export type MissingBytesResolver< - R = Maybe, - Parent = ZeekFileData, - TContext = SiemContext - > = Resolver; - export type Md5Resolver< - R = Maybe, - Parent = ZeekFileData, - TContext = SiemContext - > = Resolver; -} - -export namespace ZeekSslDataResolvers { - export interface Resolvers { - cipher?: CipherResolver, TypeParent, TContext>; - - established?: EstablishedResolver, TypeParent, TContext>; - - resumed?: ResumedResolver, TypeParent, TContext>; - - version?: VersionResolver, TypeParent, TContext>; - } - - export type CipherResolver< - R = Maybe, - Parent = ZeekSslData, - TContext = SiemContext - > = Resolver; - export type EstablishedResolver< - R = Maybe, - Parent = ZeekSslData, - TContext = SiemContext - > = Resolver; - export type ResumedResolver< - R = Maybe, - Parent = ZeekSslData, - TContext = SiemContext - > = Resolver; - export type VersionResolver< - R = Maybe, - Parent = ZeekSslData, - TContext = SiemContext - > = Resolver; -} - -export namespace ZeekEcsFieldsResolvers { - export interface Resolvers { - session_id?: SessionIdResolver, TypeParent, TContext>; - - connection?: ConnectionResolver, TypeParent, TContext>; - - notice?: NoticeResolver, TypeParent, TContext>; - - dns?: DnsResolver, TypeParent, TContext>; - - http?: HttpResolver, TypeParent, TContext>; - - files?: FilesResolver, TypeParent, TContext>; - - ssl?: SslResolver, TypeParent, TContext>; - } - - export type SessionIdResolver< - R = Maybe, - Parent = ZeekEcsFields, - TContext = SiemContext - > = Resolver; - export type ConnectionResolver< - R = Maybe, - Parent = ZeekEcsFields, - TContext = SiemContext - > = Resolver; - export type NoticeResolver< - R = Maybe, - Parent = ZeekEcsFields, - TContext = SiemContext - > = Resolver; - export type DnsResolver< - R = Maybe, - Parent = ZeekEcsFields, - TContext = SiemContext - > = Resolver; - export type HttpResolver< - R = Maybe, - Parent = ZeekEcsFields, - TContext = SiemContext - > = Resolver; - export type FilesResolver< - R = Maybe, - Parent = ZeekEcsFields, - TContext = SiemContext - > = Resolver; - export type SslResolver< - R = Maybe, - Parent = ZeekEcsFields, - TContext = SiemContext - > = Resolver; -} - -export namespace UserEcsFieldsResolvers { - export interface Resolvers { - domain?: DomainResolver, TypeParent, TContext>; - - id?: IdResolver, TypeParent, TContext>; - - name?: NameResolver, TypeParent, TContext>; - - full_name?: FullNameResolver, TypeParent, TContext>; - - email?: EmailResolver, TypeParent, TContext>; - - hash?: HashResolver, TypeParent, TContext>; - - group?: GroupResolver, TypeParent, TContext>; - } - - export type DomainResolver< - R = Maybe, - Parent = UserEcsFields, - TContext = SiemContext - > = Resolver; - export type IdResolver< - R = Maybe, - Parent = UserEcsFields, - TContext = SiemContext - > = Resolver; - export type NameResolver< - R = Maybe, - Parent = UserEcsFields, - TContext = SiemContext - > = Resolver; - export type FullNameResolver< - R = Maybe, - Parent = UserEcsFields, - TContext = SiemContext - > = Resolver; - export type EmailResolver< - R = Maybe, - Parent = UserEcsFields, - TContext = SiemContext - > = Resolver; - export type HashResolver< - R = Maybe, - Parent = UserEcsFields, - TContext = SiemContext - > = Resolver; - export type GroupResolver< - R = Maybe, - Parent = UserEcsFields, - TContext = SiemContext - > = Resolver; -} - -export namespace WinlogEcsFieldsResolvers { - export interface Resolvers { - event_id?: EventIdResolver, TypeParent, TContext>; - } - - export type EventIdResolver< - R = Maybe, - Parent = WinlogEcsFields, - TContext = SiemContext - > = Resolver; -} - -export namespace NetworkEcsFieldResolvers { - export interface Resolvers { - bytes?: BytesResolver, TypeParent, TContext>; - - community_id?: CommunityIdResolver, TypeParent, TContext>; - - direction?: DirectionResolver, TypeParent, TContext>; - - packets?: PacketsResolver, TypeParent, TContext>; - - protocol?: ProtocolResolver, TypeParent, TContext>; - - transport?: TransportResolver, TypeParent, TContext>; - } - - export type BytesResolver< - R = Maybe, - Parent = NetworkEcsField, - TContext = SiemContext - > = Resolver; - export type CommunityIdResolver< - R = Maybe, - Parent = NetworkEcsField, - TContext = SiemContext - > = Resolver; - export type DirectionResolver< - R = Maybe, - Parent = NetworkEcsField, - TContext = SiemContext - > = Resolver; - export type PacketsResolver< - R = Maybe, - Parent = NetworkEcsField, - TContext = SiemContext - > = Resolver; - export type ProtocolResolver< - R = Maybe, - Parent = NetworkEcsField, - TContext = SiemContext - > = Resolver; - export type TransportResolver< - R = Maybe, - Parent = NetworkEcsField, - TContext = SiemContext - > = Resolver; -} - -export namespace PackageEcsFieldsResolvers { - export interface Resolvers { - arch?: ArchResolver, TypeParent, TContext>; - - entity_id?: EntityIdResolver, TypeParent, TContext>; - - name?: NameResolver, TypeParent, TContext>; - - size?: SizeResolver, TypeParent, TContext>; - - summary?: SummaryResolver, TypeParent, TContext>; - - version?: VersionResolver, TypeParent, TContext>; - } - - export type ArchResolver< - R = Maybe, - Parent = PackageEcsFields, - TContext = SiemContext - > = Resolver; - export type EntityIdResolver< - R = Maybe, - Parent = PackageEcsFields, - TContext = SiemContext - > = Resolver; - export type NameResolver< - R = Maybe, - Parent = PackageEcsFields, - TContext = SiemContext - > = Resolver; - export type SizeResolver< - R = Maybe, - Parent = PackageEcsFields, - TContext = SiemContext - > = Resolver; - export type SummaryResolver< - R = Maybe, - Parent = PackageEcsFields, - TContext = SiemContext - > = Resolver; - export type VersionResolver< - R = Maybe, - Parent = PackageEcsFields, - TContext = SiemContext - > = Resolver; -} - -export namespace AuditEcsFieldsResolvers { - export interface Resolvers { - package?: PackageResolver, TypeParent, TContext>; - } - - export type PackageResolver< - R = Maybe, - Parent = AuditEcsFields, - TContext = SiemContext - > = Resolver; -} - -export namespace SshEcsFieldsResolvers { - export interface Resolvers { - method?: MethodResolver, TypeParent, TContext>; - - signature?: SignatureResolver, TypeParent, TContext>; - } - - export type MethodResolver< - R = Maybe, - Parent = SshEcsFields, - TContext = SiemContext - > = Resolver; - export type SignatureResolver< - R = Maybe, - Parent = SshEcsFields, - TContext = SiemContext - > = Resolver; -} - -export namespace AuthEcsFieldsResolvers { - export interface Resolvers { - ssh?: SshResolver, TypeParent, TContext>; - } - - export type SshResolver< - R = Maybe, - Parent = AuthEcsFields, - TContext = SiemContext - > = Resolver; -} - -export namespace SystemEcsFieldResolvers { - export interface Resolvers { - audit?: AuditResolver, TypeParent, TContext>; - - auth?: AuthResolver, TypeParent, TContext>; - } - - export type AuditResolver< - R = Maybe, - Parent = SystemEcsField, - TContext = SiemContext - > = Resolver; - export type AuthResolver< - R = Maybe, - Parent = SystemEcsField, - TContext = SiemContext - > = Resolver; -} - -export namespace RuleFieldResolvers { - export interface Resolvers { - id?: IdResolver, TypeParent, TContext>; - - rule_id?: RuleIdResolver, TypeParent, TContext>; - - false_positives?: FalsePositivesResolver; - - saved_id?: SavedIdResolver, TypeParent, TContext>; - - timeline_id?: TimelineIdResolver, TypeParent, TContext>; - - timeline_title?: TimelineTitleResolver, TypeParent, TContext>; - - max_signals?: MaxSignalsResolver, TypeParent, TContext>; - - risk_score?: RiskScoreResolver, TypeParent, TContext>; - - output_index?: OutputIndexResolver, TypeParent, TContext>; - - description?: DescriptionResolver, TypeParent, TContext>; - - from?: FromResolver, TypeParent, TContext>; - - immutable?: ImmutableResolver, TypeParent, TContext>; - - index?: IndexResolver, TypeParent, TContext>; - - interval?: IntervalResolver, TypeParent, TContext>; - - language?: LanguageResolver, TypeParent, TContext>; - - query?: QueryResolver, TypeParent, TContext>; - - references?: ReferencesResolver, TypeParent, TContext>; - - severity?: SeverityResolver, TypeParent, TContext>; - - tags?: TagsResolver, TypeParent, TContext>; - - threat?: ThreatResolver, TypeParent, TContext>; - - type?: TypeResolver, TypeParent, TContext>; - - size?: SizeResolver, TypeParent, TContext>; - - to?: ToResolver, TypeParent, TContext>; - - enabled?: EnabledResolver, TypeParent, TContext>; - - filters?: FiltersResolver, TypeParent, TContext>; - - created_at?: CreatedAtResolver, TypeParent, TContext>; - - updated_at?: UpdatedAtResolver, TypeParent, TContext>; - - created_by?: CreatedByResolver, TypeParent, TContext>; - - updated_by?: UpdatedByResolver, TypeParent, TContext>; - - version?: VersionResolver, TypeParent, TContext>; - - note?: NoteResolver, TypeParent, TContext>; - - threshold?: ThresholdResolver, TypeParent, TContext>; - - exceptions_list?: ExceptionsListResolver, TypeParent, TContext>; - } - - export type IdResolver< - R = Maybe, - Parent = RuleField, - TContext = SiemContext - > = Resolver; - export type RuleIdResolver< - R = Maybe, - Parent = RuleField, - TContext = SiemContext - > = Resolver; - export type FalsePositivesResolver< - R = string[], - Parent = RuleField, - TContext = SiemContext - > = Resolver; - export type SavedIdResolver< - R = Maybe, - Parent = RuleField, - TContext = SiemContext - > = Resolver; - export type TimelineIdResolver< - R = Maybe, - Parent = RuleField, - TContext = SiemContext - > = Resolver; - export type TimelineTitleResolver< - R = Maybe, - Parent = RuleField, - TContext = SiemContext - > = Resolver; - export type MaxSignalsResolver< - R = Maybe, - Parent = RuleField, - TContext = SiemContext - > = Resolver; - export type RiskScoreResolver< - R = Maybe, - Parent = RuleField, - TContext = SiemContext - > = Resolver; - export type OutputIndexResolver< - R = Maybe, - Parent = RuleField, - TContext = SiemContext - > = Resolver; - export type DescriptionResolver< - R = Maybe, - Parent = RuleField, - TContext = SiemContext - > = Resolver; - export type FromResolver< - R = Maybe, - Parent = RuleField, - TContext = SiemContext - > = Resolver; - export type ImmutableResolver< - R = Maybe, - Parent = RuleField, - TContext = SiemContext - > = Resolver; - export type IndexResolver< - R = Maybe, - Parent = RuleField, - TContext = SiemContext - > = Resolver; - export type IntervalResolver< - R = Maybe, - Parent = RuleField, - TContext = SiemContext - > = Resolver; - export type LanguageResolver< - R = Maybe, - Parent = RuleField, - TContext = SiemContext - > = Resolver; - export type QueryResolver< - R = Maybe, - Parent = RuleField, - TContext = SiemContext - > = Resolver; - export type ReferencesResolver< - R = Maybe, - Parent = RuleField, - TContext = SiemContext - > = Resolver; - export type SeverityResolver< - R = Maybe, - Parent = RuleField, - TContext = SiemContext - > = Resolver; - export type TagsResolver< - R = Maybe, - Parent = RuleField, - TContext = SiemContext - > = Resolver; - export type ThreatResolver< - R = Maybe, - Parent = RuleField, - TContext = SiemContext - > = Resolver; - export type TypeResolver< - R = Maybe, - Parent = RuleField, - TContext = SiemContext - > = Resolver; - export type SizeResolver< - R = Maybe, - Parent = RuleField, - TContext = SiemContext - > = Resolver; - export type ToResolver< - R = Maybe, - Parent = RuleField, - TContext = SiemContext - > = Resolver; - export type EnabledResolver< - R = Maybe, - Parent = RuleField, - TContext = SiemContext - > = Resolver; - export type FiltersResolver< - R = Maybe, - Parent = RuleField, - TContext = SiemContext - > = Resolver; - export type CreatedAtResolver< - R = Maybe, - Parent = RuleField, - TContext = SiemContext - > = Resolver; - export type UpdatedAtResolver< - R = Maybe, - Parent = RuleField, - TContext = SiemContext - > = Resolver; - export type CreatedByResolver< - R = Maybe, - Parent = RuleField, - TContext = SiemContext - > = Resolver; - export type UpdatedByResolver< - R = Maybe, - Parent = RuleField, - TContext = SiemContext - > = Resolver; - export type VersionResolver< - R = Maybe, - Parent = RuleField, - TContext = SiemContext - > = Resolver; - export type NoteResolver< - R = Maybe, - Parent = RuleField, - TContext = SiemContext - > = Resolver; - export type ThresholdResolver< - R = Maybe, - Parent = RuleField, - TContext = SiemContext - > = Resolver; - export type ExceptionsListResolver< - R = Maybe, - Parent = RuleField, - TContext = SiemContext - > = Resolver; -} - -export namespace SignalFieldResolvers { - export interface Resolvers { - rule?: RuleResolver, TypeParent, TContext>; - - original_time?: OriginalTimeResolver, TypeParent, TContext>; - - status?: StatusResolver, TypeParent, TContext>; - } - - export type RuleResolver< - R = Maybe, - Parent = SignalField, - TContext = SiemContext - > = Resolver; - export type OriginalTimeResolver< - R = Maybe, - Parent = SignalField, - TContext = SiemContext - > = Resolver; - export type StatusResolver< - R = Maybe, - Parent = SignalField, - TContext = SiemContext - > = Resolver; -} - -export namespace RuleEcsFieldResolvers { - export interface Resolvers { - reference?: ReferenceResolver, TypeParent, TContext>; - } - - export type ReferenceResolver< - R = Maybe, - Parent = RuleEcsField, - TContext = SiemContext - > = Resolver; -} - -export namespace EcsResolvers { - export interface Resolvers { - _id?: _IdResolver; - - _index?: _IndexResolver, TypeParent, TContext>; - - agent?: AgentResolver, TypeParent, TContext>; - - auditd?: AuditdResolver, TypeParent, TContext>; - - destination?: DestinationResolver, TypeParent, TContext>; - - dns?: DnsResolver, TypeParent, TContext>; - - endgame?: EndgameResolver, TypeParent, TContext>; - - event?: EventResolver, TypeParent, TContext>; - - geo?: GeoResolver, TypeParent, TContext>; - - host?: HostResolver, TypeParent, TContext>; - - network?: NetworkResolver, TypeParent, TContext>; - - rule?: RuleResolver, TypeParent, TContext>; - - signal?: SignalResolver, TypeParent, TContext>; - - source?: SourceResolver, TypeParent, TContext>; - - suricata?: SuricataResolver, TypeParent, TContext>; - - tls?: TlsResolver, TypeParent, TContext>; - - zeek?: ZeekResolver, TypeParent, TContext>; - - http?: HttpResolver, TypeParent, TContext>; - - url?: UrlResolver, TypeParent, TContext>; - - timestamp?: TimestampResolver, TypeParent, TContext>; - - message?: MessageResolver, TypeParent, TContext>; - - user?: UserResolver, TypeParent, TContext>; - - winlog?: WinlogResolver, TypeParent, TContext>; - - process?: ProcessResolver, TypeParent, TContext>; - - file?: FileResolver, TypeParent, TContext>; - - system?: SystemResolver, TypeParent, TContext>; - } - - export type _IdResolver = Resolver< - R, - Parent, - TContext - >; - export type _IndexResolver, Parent = Ecs, TContext = SiemContext> = Resolver< - R, - Parent, - TContext - >; - export type AgentResolver< - R = Maybe, - Parent = Ecs, - TContext = SiemContext - > = Resolver; - export type AuditdResolver< - R = Maybe, - Parent = Ecs, - TContext = SiemContext - > = Resolver; - export type DestinationResolver< - R = Maybe, - Parent = Ecs, - TContext = SiemContext - > = Resolver; - export type DnsResolver, Parent = Ecs, TContext = SiemContext> = Resolver< - R, - Parent, - TContext - >; - export type EndgameResolver< - R = Maybe, - Parent = Ecs, - TContext = SiemContext - > = Resolver; - export type EventResolver< - R = Maybe, - Parent = Ecs, - TContext = SiemContext - > = Resolver; - export type GeoResolver, Parent = Ecs, TContext = SiemContext> = Resolver< - R, - Parent, - TContext - >; - export type HostResolver< - R = Maybe, - Parent = Ecs, - TContext = SiemContext - > = Resolver; - export type NetworkResolver< - R = Maybe, - Parent = Ecs, - TContext = SiemContext - > = Resolver; - export type RuleResolver< - R = Maybe, - Parent = Ecs, - TContext = SiemContext - > = Resolver; - export type SignalResolver< - R = Maybe, - Parent = Ecs, - TContext = SiemContext - > = Resolver; - export type SourceResolver< - R = Maybe, - Parent = Ecs, - TContext = SiemContext - > = Resolver; - export type SuricataResolver< - R = Maybe, - Parent = Ecs, - TContext = SiemContext - > = Resolver; - export type TlsResolver, Parent = Ecs, TContext = SiemContext> = Resolver< - R, - Parent, - TContext - >; - export type ZeekResolver< - R = Maybe, - Parent = Ecs, - TContext = SiemContext - > = Resolver; - export type HttpResolver< - R = Maybe, - Parent = Ecs, - TContext = SiemContext - > = Resolver; - export type UrlResolver, Parent = Ecs, TContext = SiemContext> = Resolver< - R, - Parent, - TContext - >; - export type TimestampResolver, Parent = Ecs, TContext = SiemContext> = Resolver< - R, - Parent, - TContext - >; - export type MessageResolver< - R = Maybe, - Parent = Ecs, - TContext = SiemContext - > = Resolver; - export type UserResolver< - R = Maybe, - Parent = Ecs, - TContext = SiemContext - > = Resolver; - export type WinlogResolver< - R = Maybe, - Parent = Ecs, - TContext = SiemContext - > = Resolver; - export type ProcessResolver< - R = Maybe, - Parent = Ecs, - TContext = SiemContext - > = Resolver; - export type FileResolver, Parent = Ecs, TContext = SiemContext> = Resolver< - R, - Parent, - TContext - >; - export type SystemResolver< - R = Maybe, - Parent = Ecs, - TContext = SiemContext - > = Resolver; -} - -export namespace EcsEdgesResolvers { - export interface Resolvers { - node?: NodeResolver; - - cursor?: CursorResolver; - } - - export type NodeResolver = Resolver< - R, - Parent, - TContext - >; - export type CursorResolver = Resolver< - R, - Parent, - TContext - >; -} - -export namespace CursorTypeResolvers { - export interface Resolvers { - value?: ValueResolver, TypeParent, TContext>; - - tiebreaker?: TiebreakerResolver, TypeParent, TContext>; - } - - export type ValueResolver< - R = Maybe, - Parent = CursorType, - TContext = SiemContext - > = Resolver; - export type TiebreakerResolver< - R = Maybe, - Parent = CursorType, - TContext = SiemContext - > = Resolver; -} -/** A descriptor of a field in an index */ -export namespace IndexFieldResolvers { - export interface Resolvers { - /** Where the field belong */ - category?: CategoryResolver; - /** Example of field's value */ - example?: ExampleResolver, TypeParent, TContext>; - /** whether the field's belong to an alias index */ - indexes?: IndexesResolver<(Maybe)[], TypeParent, TContext>; - /** The name of the field */ - name?: NameResolver; - /** The type of the field's values as recognized by Kibana */ - type?: TypeResolver; - /** Whether the field's values can be efficiently searched for */ - searchable?: SearchableResolver; - /** Whether the field's values can be aggregated */ - aggregatable?: AggregatableResolver; - /** Description of the field */ - description?: DescriptionResolver, TypeParent, TContext>; - - format?: FormatResolver, TypeParent, TContext>; - /** the elastic type as mapped in the index */ - esTypes?: EsTypesResolver, TypeParent, TContext>; - - subType?: SubTypeResolver, TypeParent, TContext>; - } - - export type CategoryResolver = Resolver< - R, - Parent, - TContext - >; - export type ExampleResolver< - R = Maybe, - Parent = IndexField, - TContext = SiemContext - > = Resolver; - export type IndexesResolver< - R = (Maybe)[], - Parent = IndexField, - TContext = SiemContext - > = Resolver; - export type NameResolver = Resolver< - R, - Parent, - TContext - >; - export type TypeResolver = Resolver< - R, - Parent, - TContext - >; - export type SearchableResolver< - R = boolean, - Parent = IndexField, - TContext = SiemContext - > = Resolver; - export type AggregatableResolver< - R = boolean, - Parent = IndexField, - TContext = SiemContext - > = Resolver; - export type DescriptionResolver< - R = Maybe, - Parent = IndexField, - TContext = SiemContext - > = Resolver; - export type FormatResolver< - R = Maybe, - Parent = IndexField, - TContext = SiemContext - > = Resolver; - export type EsTypesResolver< - R = Maybe, - Parent = IndexField, - TContext = SiemContext - > = Resolver; - export type SubTypeResolver< - R = Maybe, - Parent = IndexField, - TContext = SiemContext - > = Resolver; -} - -export namespace PageInfoResolvers { - export interface Resolvers { - endCursor?: EndCursorResolver, TypeParent, TContext>; - - hasNextPage?: HasNextPageResolver, TypeParent, TContext>; - } - - export type EndCursorResolver< - R = Maybe, - Parent = PageInfo, - TContext = SiemContext - > = Resolver; - export type HasNextPageResolver< - R = Maybe, - Parent = PageInfo, - TContext = SiemContext - > = Resolver; -} - -export namespace InspectResolvers { - export interface Resolvers { - dsl?: DslResolver; - - response?: ResponseResolver; - } - - export type DslResolver = Resolver< - R, - Parent, - TContext - >; - export type ResponseResolver = Resolver< - R, - Parent, - TContext - >; -} - -export namespace PageInfoPaginatedResolvers { - export interface Resolvers { - activePage?: ActivePageResolver; - - fakeTotalCount?: FakeTotalCountResolver; - - showMorePagesIndicator?: ShowMorePagesIndicatorResolver; - } - - export type ActivePageResolver< - R = number, - Parent = PageInfoPaginated, - TContext = SiemContext - > = Resolver; - export type FakeTotalCountResolver< - R = number, - Parent = PageInfoPaginated, - TContext = SiemContext - > = Resolver; - export type ShowMorePagesIndicatorResolver< - R = boolean, - Parent = PageInfoPaginated, - TContext = SiemContext - > = Resolver; -} - -/** Directs the executor to skip this field or fragment when the `if` argument is true. */ -export type SkipDirectiveResolver = DirectiveResolverFn< - Result, - SkipDirectiveArgs, - SiemContext ->; -export interface SkipDirectiveArgs { - /** Skipped when true. */ - if: boolean; -} - -/** Directs the executor to include this field or fragment only when the `if` argument is true. */ -export type IncludeDirectiveResolver = DirectiveResolverFn< - Result, - IncludeDirectiveArgs, - SiemContext ->; -export interface IncludeDirectiveArgs { - /** Included when true. */ - if: boolean; -} - -/** Marks an element of a GraphQL schema as no longer supported. */ -export type DeprecatedDirectiveResolver = DirectiveResolverFn< - Result, - DeprecatedDirectiveArgs, - SiemContext ->; -export interface DeprecatedDirectiveArgs { - /** Explains why this element was deprecated, usually also including a suggestion for how to access supported similar data. Formatted in [Markdown](https://daringfireball.net/projects/markdown/). */ - reason?: string; -} - -export interface ToAnyScalarConfig extends GraphQLScalarTypeConfig { - name: 'ToAny'; -} -export interface ToStringArrayScalarConfig extends GraphQLScalarTypeConfig { - name: 'ToStringArray'; -} -export interface ToStringArrayNoNullableScalarConfig - extends GraphQLScalarTypeConfig { - name: 'ToStringArrayNoNullable'; -} -export interface ToDateArrayScalarConfig extends GraphQLScalarTypeConfig { - name: 'ToDateArray'; -} -export interface ToNumberArrayScalarConfig extends GraphQLScalarTypeConfig { - name: 'ToNumberArray'; -} -export interface ToBooleanArrayScalarConfig extends GraphQLScalarTypeConfig { - name: 'ToBooleanArray'; -} -export interface DateScalarConfig extends GraphQLScalarTypeConfig { - name: 'Date'; -} -export interface ToIFieldSubTypeNonNullableScalarConfig - extends GraphQLScalarTypeConfig { - name: 'ToIFieldSubTypeNonNullable'; -} - -export type IResolvers = { - Query?: QueryResolvers.Resolvers; - NoteResult?: NoteResultResolvers.Resolvers; - ResponseNotes?: ResponseNotesResolvers.Resolvers; - PinnedEvent?: PinnedEventResolvers.Resolvers; - Source?: SourceResolvers.Resolvers; - SourceConfiguration?: SourceConfigurationResolvers.Resolvers; - SourceFields?: SourceFieldsResolvers.Resolvers; - SourceStatus?: SourceStatusResolvers.Resolvers; - TimelineResult?: TimelineResultResolvers.Resolvers; - ColumnHeaderResult?: ColumnHeaderResultResolvers.Resolvers; - DataProviderResult?: DataProviderResultResolvers.Resolvers; - QueryMatchResult?: QueryMatchResultResolvers.Resolvers; - DateRangePickerResult?: DateRangePickerResultResolvers.Resolvers; - EqlOptionsResult?: EqlOptionsResultResolvers.Resolvers; - FavoriteTimelineResult?: FavoriteTimelineResultResolvers.Resolvers; - FilterTimelineResult?: FilterTimelineResultResolvers.Resolvers; - FilterMetaTimelineResult?: FilterMetaTimelineResultResolvers.Resolvers; - SerializedFilterQueryResult?: SerializedFilterQueryResultResolvers.Resolvers; - SerializedKueryQueryResult?: SerializedKueryQueryResultResolvers.Resolvers; - KueryFilterQueryResult?: KueryFilterQueryResultResolvers.Resolvers; - ResponseTimelines?: ResponseTimelinesResolvers.Resolvers; - Mutation?: MutationResolvers.Resolvers; - ResponseNote?: ResponseNoteResolvers.Resolvers; - ResponseTimeline?: ResponseTimelineResolvers.Resolvers; - ResponseFavoriteTimeline?: ResponseFavoriteTimelineResolvers.Resolvers; - EventEcsFields?: EventEcsFieldsResolvers.Resolvers; - Location?: LocationResolvers.Resolvers; - GeoEcsFields?: GeoEcsFieldsResolvers.Resolvers; - PrimarySecondary?: PrimarySecondaryResolvers.Resolvers; - Summary?: SummaryResolvers.Resolvers; - AgentEcsField?: AgentEcsFieldResolvers.Resolvers; - AuditdData?: AuditdDataResolvers.Resolvers; - AuditdEcsFields?: AuditdEcsFieldsResolvers.Resolvers; - OsEcsFields?: OsEcsFieldsResolvers.Resolvers; - HostEcsFields?: HostEcsFieldsResolvers.Resolvers; - Thread?: ThreadResolvers.Resolvers; - ProcessHashData?: ProcessHashDataResolvers.Resolvers; - ProcessEcsFields?: ProcessEcsFieldsResolvers.Resolvers; - SourceEcsFields?: SourceEcsFieldsResolvers.Resolvers; - DestinationEcsFields?: DestinationEcsFieldsResolvers.Resolvers; - DnsQuestionData?: DnsQuestionDataResolvers.Resolvers; - DnsEcsFields?: DnsEcsFieldsResolvers.Resolvers; - EndgameEcsFields?: EndgameEcsFieldsResolvers.Resolvers; - SuricataAlertData?: SuricataAlertDataResolvers.Resolvers; - SuricataEveData?: SuricataEveDataResolvers.Resolvers; - SuricataEcsFields?: SuricataEcsFieldsResolvers.Resolvers; - TlsJa3Data?: TlsJa3DataResolvers.Resolvers; - FingerprintData?: FingerprintDataResolvers.Resolvers; - TlsClientCertificateData?: TlsClientCertificateDataResolvers.Resolvers; - TlsServerCertificateData?: TlsServerCertificateDataResolvers.Resolvers; - TlsFingerprintsData?: TlsFingerprintsDataResolvers.Resolvers; - TlsEcsFields?: TlsEcsFieldsResolvers.Resolvers; - ZeekConnectionData?: ZeekConnectionDataResolvers.Resolvers; - ZeekNoticeData?: ZeekNoticeDataResolvers.Resolvers; - ZeekDnsData?: ZeekDnsDataResolvers.Resolvers; - FileFields?: FileFieldsResolvers.Resolvers; - ZeekHttpData?: ZeekHttpDataResolvers.Resolvers; - HttpBodyData?: HttpBodyDataResolvers.Resolvers; - HttpRequestData?: HttpRequestDataResolvers.Resolvers; - HttpResponseData?: HttpResponseDataResolvers.Resolvers; - HttpEcsFields?: HttpEcsFieldsResolvers.Resolvers; - UrlEcsFields?: UrlEcsFieldsResolvers.Resolvers; - ZeekFileData?: ZeekFileDataResolvers.Resolvers; - ZeekSslData?: ZeekSslDataResolvers.Resolvers; - ZeekEcsFields?: ZeekEcsFieldsResolvers.Resolvers; - UserEcsFields?: UserEcsFieldsResolvers.Resolvers; - WinlogEcsFields?: WinlogEcsFieldsResolvers.Resolvers; - NetworkEcsField?: NetworkEcsFieldResolvers.Resolvers; - PackageEcsFields?: PackageEcsFieldsResolvers.Resolvers; - AuditEcsFields?: AuditEcsFieldsResolvers.Resolvers; - SshEcsFields?: SshEcsFieldsResolvers.Resolvers; - AuthEcsFields?: AuthEcsFieldsResolvers.Resolvers; - SystemEcsField?: SystemEcsFieldResolvers.Resolvers; - RuleField?: RuleFieldResolvers.Resolvers; - SignalField?: SignalFieldResolvers.Resolvers; - RuleEcsField?: RuleEcsFieldResolvers.Resolvers; - Ecs?: EcsResolvers.Resolvers; - EcsEdges?: EcsEdgesResolvers.Resolvers; - CursorType?: CursorTypeResolvers.Resolvers; - IndexField?: IndexFieldResolvers.Resolvers; - PageInfo?: PageInfoResolvers.Resolvers; - Inspect?: InspectResolvers.Resolvers; - PageInfoPaginated?: PageInfoPaginatedResolvers.Resolvers; - ToAny?: GraphQLScalarType; - ToStringArray?: GraphQLScalarType; - ToStringArrayNoNullable?: GraphQLScalarType; - ToDateArray?: GraphQLScalarType; - ToNumberArray?: GraphQLScalarType; - ToBooleanArray?: GraphQLScalarType; - Date?: GraphQLScalarType; - ToIFieldSubTypeNonNullable?: GraphQLScalarType; -} & { [typeName: string]: never }; - -export type IDirectiveResolvers = { - skip?: SkipDirectiveResolver; - include?: IncludeDirectiveResolver; - deprecated?: DeprecatedDirectiveResolver; -} & { [directiveName: string]: never }; diff --git a/x-pack/plugins/security_solution/server/init_server.ts b/x-pack/plugins/security_solution/server/init_server.ts deleted file mode 100644 index d2810bf71f8ae..0000000000000 --- a/x-pack/plugins/security_solution/server/init_server.ts +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. - */ - -import { IResolvers, makeExecutableSchema } from 'graphql-tools'; - -import { schemas } from './graphql'; -import { createScalarToStringArrayValueResolvers } from './graphql/ecs'; -import { createNoteResolvers } from './graphql/note'; -import { createPinnedEventResolvers } from './graphql/pinned_event'; -import { createScalarDateResolvers } from './graphql/scalar_date'; -import { createScalarToAnyValueResolvers } from './graphql/scalar_to_any'; -import { createScalarToBooleanArrayValueResolvers } from './graphql/scalar_to_boolean_array'; -import { createScalarToDateArrayValueResolvers } from './graphql/scalar_to_date_array'; -import { createScalarToNumberArrayValueResolvers } from './graphql/scalar_to_number_array'; -import { createSourceStatusResolvers } from './graphql/source_status'; -import { createSourcesResolvers } from './graphql/sources'; -import { createTimelineResolvers } from './graphql/timeline'; -import { AppBackendLibs } from './lib/types'; - -export const initServer = (libs: AppBackendLibs) => { - const schema = makeExecutableSchema({ - resolvers: [ - createNoteResolvers(libs) as IResolvers, - createPinnedEventResolvers(libs) as IResolvers, - createSourcesResolvers(libs) as IResolvers, - createScalarToStringArrayValueResolvers() as IResolvers, - createScalarDateResolvers() as IResolvers, - createScalarToDateArrayValueResolvers() as IResolvers, - createScalarToAnyValueResolvers() as IResolvers, - createScalarToBooleanArrayValueResolvers() as IResolvers, - createScalarToNumberArrayValueResolvers() as IResolvers, - createSourcesResolvers(libs) as IResolvers, - createSourceStatusResolvers(libs) as IResolvers, - createTimelineResolvers(libs) as IResolvers, - ], - typeDefs: schemas, - }); - - libs.framework.registerGraphQLEndpoint('/api/solutions/security/graphql', schema); -}; diff --git a/x-pack/plugins/security_solution/server/lib/compose/kibana.ts b/x-pack/plugins/security_solution/server/lib/compose/kibana.ts index 01318c87f8b3f..9be922ecf8db2 100644 --- a/x-pack/plugins/security_solution/server/lib/compose/kibana.ts +++ b/x-pack/plugins/security_solution/server/lib/compose/kibana.ts @@ -23,7 +23,7 @@ export function compose( plugins: SetupPlugins, endpointContext: EndpointAppContext ): AppBackendLibs { - const framework = new KibanaBackendFrameworkAdapter(core, plugins); + const framework = new KibanaBackendFrameworkAdapter(); const sources = new Sources(new ConfigurationSourcesAdapter()); const sourceStatus = new SourceStatus(new ElasticsearchSourceStatusAdapter(framework)); diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/routes/index/__snapshots__/get_signals_template.test.ts.snap b/x-pack/plugins/security_solution/server/lib/detection_engine/routes/index/__snapshots__/get_signals_template.test.ts.snap new file mode 100644 index 0000000000000..1abe55b782c32 --- /dev/null +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/routes/index/__snapshots__/get_signals_template.test.ts.snap @@ -0,0 +1,4472 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`get_signals_template it should match snapshot 1`] = ` +Object { + "index_patterns": Array [ + "test-index-*", + ], + "mappings": Object { + "_meta": Object { + "version": 35, + }, + "dynamic": false, + "properties": Object { + "@timestamp": Object { + "type": "date", + }, + "agent": Object { + "properties": Object { + "build": Object { + "properties": Object { + "original": Object { + "ignore_above": 1024, + "type": "keyword", + }, + }, + }, + "ephemeral_id": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "id": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "name": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "type": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "version": Object { + "ignore_above": 1024, + "type": "keyword", + }, + }, + }, + "as": Object { + "properties": Object { + "number": Object { + "type": "long", + }, + "organization": Object { + "properties": Object { + "name": Object { + "fields": Object { + "text": Object { + "norms": false, + "type": "text", + }, + }, + "ignore_above": 1024, + "type": "keyword", + }, + }, + }, + }, + }, + "client": Object { + "properties": Object { + "address": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "as": Object { + "properties": Object { + "number": Object { + "type": "long", + }, + "organization": Object { + "properties": Object { + "name": Object { + "fields": Object { + "text": Object { + "norms": false, + "type": "text", + }, + }, + "ignore_above": 1024, + "type": "keyword", + }, + }, + }, + }, + }, + "bytes": Object { + "type": "long", + }, + "domain": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "geo": Object { + "properties": Object { + "city_name": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "continent_code": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "continent_name": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "country_iso_code": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "country_name": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "location": Object { + "type": "geo_point", + }, + "name": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "postal_code": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "region_iso_code": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "region_name": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "timezone": Object { + "ignore_above": 1024, + "type": "keyword", + }, + }, + }, + "ip": Object { + "type": "ip", + }, + "mac": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "nat": Object { + "properties": Object { + "ip": Object { + "type": "ip", + }, + "port": Object { + "type": "long", + }, + }, + }, + "packets": Object { + "type": "long", + }, + "port": Object { + "type": "long", + }, + "registered_domain": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "subdomain": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "top_level_domain": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "user": Object { + "properties": Object { + "domain": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "email": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "full_name": Object { + "fields": Object { + "text": Object { + "norms": false, + "type": "text", + }, + }, + "ignore_above": 1024, + "type": "keyword", + }, + "group": Object { + "properties": Object { + "domain": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "id": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "name": Object { + "ignore_above": 1024, + "type": "keyword", + }, + }, + }, + "hash": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "id": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "name": Object { + "fields": Object { + "text": Object { + "norms": false, + "type": "text", + }, + }, + "ignore_above": 1024, + "type": "keyword", + }, + "roles": Object { + "ignore_above": 1024, + "type": "keyword", + }, + }, + }, + }, + }, + "cloud": Object { + "properties": Object { + "account": Object { + "properties": Object { + "id": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "name": Object { + "ignore_above": 1024, + "type": "keyword", + }, + }, + }, + "availability_zone": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "instance": Object { + "properties": Object { + "id": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "name": Object { + "ignore_above": 1024, + "type": "keyword", + }, + }, + }, + "machine": Object { + "properties": Object { + "type": Object { + "ignore_above": 1024, + "type": "keyword", + }, + }, + }, + "project": Object { + "properties": Object { + "id": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "name": Object { + "ignore_above": 1024, + "type": "keyword", + }, + }, + }, + "provider": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "region": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "service": Object { + "properties": Object { + "name": Object { + "ignore_above": 1024, + "type": "keyword", + }, + }, + }, + }, + }, + "code_signature": Object { + "properties": Object { + "exists": Object { + "type": "boolean", + }, + "status": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "subject_name": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "trusted": Object { + "type": "boolean", + }, + "valid": Object { + "type": "boolean", + }, + }, + }, + "container": Object { + "properties": Object { + "id": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "image": Object { + "properties": Object { + "name": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "tag": Object { + "ignore_above": 1024, + "type": "keyword", + }, + }, + }, + "labels": Object { + "type": "object", + }, + "name": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "runtime": Object { + "ignore_above": 1024, + "type": "keyword", + }, + }, + }, + "destination": Object { + "properties": Object { + "address": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "as": Object { + "properties": Object { + "number": Object { + "type": "long", + }, + "organization": Object { + "properties": Object { + "name": Object { + "fields": Object { + "text": Object { + "norms": false, + "type": "text", + }, + }, + "ignore_above": 1024, + "type": "keyword", + }, + }, + }, + }, + }, + "bytes": Object { + "type": "long", + }, + "domain": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "geo": Object { + "properties": Object { + "city_name": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "continent_code": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "continent_name": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "country_iso_code": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "country_name": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "location": Object { + "type": "geo_point", + }, + "name": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "postal_code": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "region_iso_code": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "region_name": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "timezone": Object { + "ignore_above": 1024, + "type": "keyword", + }, + }, + }, + "ip": Object { + "type": "ip", + }, + "mac": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "nat": Object { + "properties": Object { + "ip": Object { + "type": "ip", + }, + "port": Object { + "type": "long", + }, + }, + }, + "packets": Object { + "type": "long", + }, + "port": Object { + "type": "long", + }, + "registered_domain": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "subdomain": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "top_level_domain": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "user": Object { + "properties": Object { + "domain": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "email": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "full_name": Object { + "fields": Object { + "text": Object { + "norms": false, + "type": "text", + }, + }, + "ignore_above": 1024, + "type": "keyword", + }, + "group": Object { + "properties": Object { + "domain": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "id": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "name": Object { + "ignore_above": 1024, + "type": "keyword", + }, + }, + }, + "hash": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "id": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "name": Object { + "fields": Object { + "text": Object { + "norms": false, + "type": "text", + }, + }, + "ignore_above": 1024, + "type": "keyword", + }, + "roles": Object { + "ignore_above": 1024, + "type": "keyword", + }, + }, + }, + }, + }, + "dll": Object { + "properties": Object { + "code_signature": Object { + "properties": Object { + "exists": Object { + "type": "boolean", + }, + "signing_id": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "status": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "subject_name": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "team_id": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "trusted": Object { + "type": "boolean", + }, + "valid": Object { + "type": "boolean", + }, + }, + }, + "hash": Object { + "properties": Object { + "md5": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "sha1": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "sha256": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "sha512": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "ssdeep": Object { + "ignore_above": 1024, + "type": "keyword", + }, + }, + }, + "name": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "path": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "pe": Object { + "properties": Object { + "architecture": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "company": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "description": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "file_version": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "imphash": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "original_file_name": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "product": Object { + "ignore_above": 1024, + "type": "keyword", + }, + }, + }, + }, + }, + "dns": Object { + "properties": Object { + "answers": Object { + "properties": Object { + "class": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "data": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "name": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "ttl": Object { + "type": "long", + }, + "type": Object { + "ignore_above": 1024, + "type": "keyword", + }, + }, + "type": "object", + }, + "header_flags": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "id": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "op_code": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "question": Object { + "properties": Object { + "class": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "name": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "registered_domain": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "subdomain": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "top_level_domain": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "type": Object { + "ignore_above": 1024, + "type": "keyword", + }, + }, + }, + "resolved_ip": Object { + "type": "ip", + }, + "response_code": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "type": Object { + "ignore_above": 1024, + "type": "keyword", + }, + }, + }, + "ecs": Object { + "properties": Object { + "version": Object { + "ignore_above": 1024, + "type": "keyword", + }, + }, + }, + "error": Object { + "properties": Object { + "code": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "id": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "message": Object { + "norms": false, + "type": "text", + }, + "stack_trace": Object { + "doc_values": false, + "fields": Object { + "text": Object { + "norms": false, + "type": "text", + }, + }, + "ignore_above": 1024, + "index": false, + "type": "keyword", + }, + "type": Object { + "ignore_above": 1024, + "type": "keyword", + }, + }, + }, + "event": Object { + "properties": Object { + "action": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "category": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "code": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "created": Object { + "type": "date", + }, + "dataset": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "duration": Object { + "type": "long", + }, + "end": Object { + "type": "date", + }, + "hash": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "id": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "ingested": Object { + "type": "date", + }, + "kind": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "module": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "original": Object { + "doc_values": false, + "ignore_above": 1024, + "index": false, + "type": "keyword", + }, + "outcome": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "provider": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "reason": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "reference": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "risk_score": Object { + "type": "float", + }, + "risk_score_norm": Object { + "type": "float", + }, + "sequence": Object { + "type": "long", + }, + "severity": Object { + "type": "long", + }, + "start": Object { + "type": "date", + }, + "timezone": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "type": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "url": Object { + "ignore_above": 1024, + "type": "keyword", + }, + }, + }, + "file": Object { + "properties": Object { + "accessed": Object { + "type": "date", + }, + "attributes": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "code_signature": Object { + "properties": Object { + "exists": Object { + "type": "boolean", + }, + "signing_id": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "status": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "subject_name": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "team_id": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "trusted": Object { + "type": "boolean", + }, + "valid": Object { + "type": "boolean", + }, + }, + }, + "created": Object { + "type": "date", + }, + "ctime": Object { + "type": "date", + }, + "device": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "directory": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "drive_letter": Object { + "ignore_above": 1, + "type": "keyword", + }, + "extension": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "gid": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "group": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "hash": Object { + "properties": Object { + "md5": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "sha1": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "sha256": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "sha512": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "ssdeep": Object { + "ignore_above": 1024, + "type": "keyword", + }, + }, + }, + "inode": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "mime_type": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "mode": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "mtime": Object { + "type": "date", + }, + "name": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "owner": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "path": Object { + "fields": Object { + "text": Object { + "norms": false, + "type": "text", + }, + }, + "ignore_above": 1024, + "type": "keyword", + }, + "pe": Object { + "properties": Object { + "architecture": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "company": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "description": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "file_version": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "imphash": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "original_file_name": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "product": Object { + "ignore_above": 1024, + "type": "keyword", + }, + }, + }, + "size": Object { + "type": "long", + }, + "target_path": Object { + "fields": Object { + "text": Object { + "norms": false, + "type": "text", + }, + }, + "ignore_above": 1024, + "type": "keyword", + }, + "type": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "uid": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "x509": Object { + "properties": Object { + "alternative_names": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "issuer": Object { + "properties": Object { + "common_name": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "country": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "distinguished_name": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "locality": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "organization": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "organizational_unit": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "state_or_province": Object { + "ignore_above": 1024, + "type": "keyword", + }, + }, + }, + "not_after": Object { + "type": "date", + }, + "not_before": Object { + "type": "date", + }, + "public_key_algorithm": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "public_key_curve": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "public_key_exponent": Object { + "doc_values": false, + "index": false, + "type": "long", + }, + "public_key_size": Object { + "type": "long", + }, + "serial_number": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "signature_algorithm": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "subject": Object { + "properties": Object { + "common_name": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "country": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "distinguished_name": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "locality": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "organization": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "organizational_unit": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "state_or_province": Object { + "ignore_above": 1024, + "type": "keyword", + }, + }, + }, + "version_number": Object { + "ignore_above": 1024, + "type": "keyword", + }, + }, + }, + }, + }, + "geo": Object { + "properties": Object { + "city_name": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "continent_name": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "country_iso_code": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "country_name": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "location": Object { + "type": "geo_point", + }, + "name": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "region_iso_code": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "region_name": Object { + "ignore_above": 1024, + "type": "keyword", + }, + }, + }, + "group": Object { + "properties": Object { + "domain": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "id": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "name": Object { + "ignore_above": 1024, + "type": "keyword", + }, + }, + }, + "hash": Object { + "properties": Object { + "md5": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "sha1": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "sha256": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "sha512": Object { + "ignore_above": 1024, + "type": "keyword", + }, + }, + }, + "host": Object { + "properties": Object { + "architecture": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "cpu": Object { + "properties": Object { + "usage": Object { + "scaling_factor": 1000, + "type": "scaled_float", + }, + }, + }, + "disk": Object { + "properties": Object { + "read": Object { + "properties": Object { + "bytes": Object { + "type": "long", + }, + }, + }, + "write": Object { + "properties": Object { + "bytes": Object { + "type": "long", + }, + }, + }, + }, + }, + "domain": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "geo": Object { + "properties": Object { + "city_name": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "continent_code": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "continent_name": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "country_iso_code": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "country_name": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "location": Object { + "type": "geo_point", + }, + "name": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "postal_code": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "region_iso_code": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "region_name": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "timezone": Object { + "ignore_above": 1024, + "type": "keyword", + }, + }, + }, + "hostname": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "id": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "ip": Object { + "type": "ip", + }, + "mac": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "name": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "network": Object { + "properties": Object { + "egress": Object { + "properties": Object { + "bytes": Object { + "type": "long", + }, + "packets": Object { + "type": "long", + }, + }, + }, + "ingress": Object { + "properties": Object { + "bytes": Object { + "type": "long", + }, + "packets": Object { + "type": "long", + }, + }, + }, + }, + }, + "os": Object { + "properties": Object { + "family": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "full": Object { + "fields": Object { + "text": Object { + "norms": false, + "type": "text", + }, + }, + "ignore_above": 1024, + "type": "keyword", + }, + "kernel": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "name": Object { + "fields": Object { + "text": Object { + "norms": false, + "type": "text", + }, + }, + "ignore_above": 1024, + "type": "keyword", + }, + "platform": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "type": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "version": Object { + "ignore_above": 1024, + "type": "keyword", + }, + }, + }, + "type": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "uptime": Object { + "type": "long", + }, + "user": Object { + "properties": Object { + "domain": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "email": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "full_name": Object { + "fields": Object { + "text": Object { + "norms": false, + "type": "text", + }, + }, + "ignore_above": 1024, + "type": "keyword", + }, + "group": Object { + "properties": Object { + "domain": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "id": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "name": Object { + "ignore_above": 1024, + "type": "keyword", + }, + }, + }, + "hash": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "id": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "name": Object { + "fields": Object { + "text": Object { + "norms": false, + "type": "text", + }, + }, + "ignore_above": 1024, + "type": "keyword", + }, + "roles": Object { + "ignore_above": 1024, + "type": "keyword", + }, + }, + }, + }, + }, + "http": Object { + "properties": Object { + "request": Object { + "properties": Object { + "body": Object { + "properties": Object { + "bytes": Object { + "type": "long", + }, + "content": Object { + "fields": Object { + "text": Object { + "norms": false, + "type": "text", + }, + }, + "ignore_above": 1024, + "type": "keyword", + }, + }, + }, + "bytes": Object { + "type": "long", + }, + "id": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "method": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "mime_type": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "referrer": Object { + "ignore_above": 1024, + "type": "keyword", + }, + }, + }, + "response": Object { + "properties": Object { + "body": Object { + "properties": Object { + "bytes": Object { + "type": "long", + }, + "content": Object { + "fields": Object { + "text": Object { + "norms": false, + "type": "text", + }, + }, + "ignore_above": 1024, + "type": "keyword", + }, + }, + }, + "bytes": Object { + "type": "long", + }, + "mime_type": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "status_code": Object { + "type": "long", + }, + }, + }, + "version": Object { + "ignore_above": 1024, + "type": "keyword", + }, + }, + }, + "interface": Object { + "properties": Object { + "alias": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "id": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "name": Object { + "ignore_above": 1024, + "type": "keyword", + }, + }, + }, + "labels": Object { + "type": "object", + }, + "log": Object { + "properties": Object { + "file": Object { + "properties": Object { + "path": Object { + "ignore_above": 1024, + "type": "keyword", + }, + }, + }, + "level": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "logger": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "origin": Object { + "properties": Object { + "file": Object { + "properties": Object { + "line": Object { + "type": "integer", + }, + "name": Object { + "ignore_above": 1024, + "type": "keyword", + }, + }, + }, + "function": Object { + "ignore_above": 1024, + "type": "keyword", + }, + }, + }, + "original": Object { + "doc_values": false, + "ignore_above": 1024, + "index": false, + "type": "keyword", + }, + "syslog": Object { + "properties": Object { + "facility": Object { + "properties": Object { + "code": Object { + "type": "long", + }, + "name": Object { + "ignore_above": 1024, + "type": "keyword", + }, + }, + }, + "priority": Object { + "type": "long", + }, + "severity": Object { + "properties": Object { + "code": Object { + "type": "long", + }, + "name": Object { + "ignore_above": 1024, + "type": "keyword", + }, + }, + }, + }, + "type": "object", + }, + }, + }, + "message": Object { + "norms": false, + "type": "text", + }, + "network": Object { + "properties": Object { + "application": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "bytes": Object { + "type": "long", + }, + "community_id": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "direction": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "forwarded_ip": Object { + "type": "ip", + }, + "iana_number": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "inner": Object { + "properties": Object { + "vlan": Object { + "properties": Object { + "id": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "name": Object { + "ignore_above": 1024, + "type": "keyword", + }, + }, + }, + }, + "type": "object", + }, + "name": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "packets": Object { + "type": "long", + }, + "protocol": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "transport": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "type": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "vlan": Object { + "properties": Object { + "id": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "name": Object { + "ignore_above": 1024, + "type": "keyword", + }, + }, + }, + }, + }, + "observer": Object { + "properties": Object { + "egress": Object { + "properties": Object { + "interface": Object { + "properties": Object { + "alias": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "id": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "name": Object { + "ignore_above": 1024, + "type": "keyword", + }, + }, + }, + "vlan": Object { + "properties": Object { + "id": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "name": Object { + "ignore_above": 1024, + "type": "keyword", + }, + }, + }, + "zone": Object { + "ignore_above": 1024, + "type": "keyword", + }, + }, + "type": "object", + }, + "geo": Object { + "properties": Object { + "city_name": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "continent_code": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "continent_name": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "country_iso_code": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "country_name": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "location": Object { + "type": "geo_point", + }, + "name": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "postal_code": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "region_iso_code": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "region_name": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "timezone": Object { + "ignore_above": 1024, + "type": "keyword", + }, + }, + }, + "hostname": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "ingress": Object { + "properties": Object { + "interface": Object { + "properties": Object { + "alias": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "id": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "name": Object { + "ignore_above": 1024, + "type": "keyword", + }, + }, + }, + "vlan": Object { + "properties": Object { + "id": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "name": Object { + "ignore_above": 1024, + "type": "keyword", + }, + }, + }, + "zone": Object { + "ignore_above": 1024, + "type": "keyword", + }, + }, + "type": "object", + }, + "ip": Object { + "type": "ip", + }, + "mac": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "name": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "os": Object { + "properties": Object { + "family": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "full": Object { + "fields": Object { + "text": Object { + "norms": false, + "type": "text", + }, + }, + "ignore_above": 1024, + "type": "keyword", + }, + "kernel": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "name": Object { + "fields": Object { + "text": Object { + "norms": false, + "type": "text", + }, + }, + "ignore_above": 1024, + "type": "keyword", + }, + "platform": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "type": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "version": Object { + "ignore_above": 1024, + "type": "keyword", + }, + }, + }, + "product": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "serial_number": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "type": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "vendor": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "version": Object { + "ignore_above": 1024, + "type": "keyword", + }, + }, + }, + "organization": Object { + "properties": Object { + "id": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "name": Object { + "fields": Object { + "text": Object { + "norms": false, + "type": "text", + }, + }, + "ignore_above": 1024, + "type": "keyword", + }, + }, + }, + "os": Object { + "properties": Object { + "family": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "full": Object { + "fields": Object { + "text": Object { + "norms": false, + "type": "text", + }, + }, + "ignore_above": 1024, + "type": "keyword", + }, + "kernel": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "name": Object { + "fields": Object { + "text": Object { + "norms": false, + "type": "text", + }, + }, + "ignore_above": 1024, + "type": "keyword", + }, + "platform": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "version": Object { + "ignore_above": 1024, + "type": "keyword", + }, + }, + }, + "package": Object { + "properties": Object { + "architecture": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "build_version": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "checksum": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "description": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "install_scope": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "installed": Object { + "type": "date", + }, + "license": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "name": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "path": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "reference": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "size": Object { + "type": "long", + }, + "type": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "version": Object { + "ignore_above": 1024, + "type": "keyword", + }, + }, + }, + "pe": Object { + "properties": Object { + "company": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "description": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "file_version": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "original_file_name": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "product": Object { + "ignore_above": 1024, + "type": "keyword", + }, + }, + }, + "process": Object { + "properties": Object { + "args": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "args_count": Object { + "type": "long", + }, + "code_signature": Object { + "properties": Object { + "exists": Object { + "type": "boolean", + }, + "signing_id": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "status": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "subject_name": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "team_id": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "trusted": Object { + "type": "boolean", + }, + "valid": Object { + "type": "boolean", + }, + }, + }, + "command_line": Object { + "fields": Object { + "text": Object { + "norms": false, + "type": "text", + }, + }, + "ignore_above": 1024, + "type": "keyword", + }, + "entity_id": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "executable": Object { + "fields": Object { + "text": Object { + "norms": false, + "type": "text", + }, + }, + "ignore_above": 1024, + "type": "keyword", + }, + "exit_code": Object { + "type": "long", + }, + "hash": Object { + "properties": Object { + "md5": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "sha1": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "sha256": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "sha512": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "ssdeep": Object { + "ignore_above": 1024, + "type": "keyword", + }, + }, + }, + "name": Object { + "fields": Object { + "text": Object { + "norms": false, + "type": "text", + }, + }, + "ignore_above": 1024, + "type": "keyword", + }, + "parent": Object { + "properties": Object { + "args": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "args_count": Object { + "type": "long", + }, + "code_signature": Object { + "properties": Object { + "exists": Object { + "type": "boolean", + }, + "signing_id": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "status": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "subject_name": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "team_id": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "trusted": Object { + "type": "boolean", + }, + "valid": Object { + "type": "boolean", + }, + }, + }, + "command_line": Object { + "fields": Object { + "text": Object { + "norms": false, + "type": "text", + }, + }, + "ignore_above": 1024, + "type": "keyword", + }, + "entity_id": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "executable": Object { + "fields": Object { + "text": Object { + "norms": false, + "type": "text", + }, + }, + "ignore_above": 1024, + "type": "keyword", + }, + "exit_code": Object { + "type": "long", + }, + "hash": Object { + "properties": Object { + "md5": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "sha1": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "sha256": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "sha512": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "ssdeep": Object { + "ignore_above": 1024, + "type": "keyword", + }, + }, + }, + "name": Object { + "fields": Object { + "text": Object { + "norms": false, + "type": "text", + }, + }, + "ignore_above": 1024, + "type": "keyword", + }, + "pe": Object { + "properties": Object { + "architecture": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "company": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "description": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "file_version": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "imphash": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "original_file_name": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "product": Object { + "ignore_above": 1024, + "type": "keyword", + }, + }, + }, + "pgid": Object { + "type": "long", + }, + "pid": Object { + "type": "long", + }, + "ppid": Object { + "type": "long", + }, + "start": Object { + "type": "date", + }, + "thread": Object { + "properties": Object { + "id": Object { + "type": "long", + }, + "name": Object { + "ignore_above": 1024, + "type": "keyword", + }, + }, + }, + "title": Object { + "fields": Object { + "text": Object { + "norms": false, + "type": "text", + }, + }, + "ignore_above": 1024, + "type": "keyword", + }, + "uptime": Object { + "type": "long", + }, + "working_directory": Object { + "fields": Object { + "text": Object { + "norms": false, + "type": "text", + }, + }, + "ignore_above": 1024, + "type": "keyword", + }, + }, + }, + "pe": Object { + "properties": Object { + "architecture": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "company": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "description": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "file_version": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "imphash": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "original_file_name": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "product": Object { + "ignore_above": 1024, + "type": "keyword", + }, + }, + }, + "pgid": Object { + "type": "long", + }, + "pid": Object { + "type": "long", + }, + "ppid": Object { + "type": "long", + }, + "start": Object { + "type": "date", + }, + "thread": Object { + "properties": Object { + "id": Object { + "type": "long", + }, + "name": Object { + "ignore_above": 1024, + "type": "keyword", + }, + }, + }, + "title": Object { + "fields": Object { + "text": Object { + "norms": false, + "type": "text", + }, + }, + "ignore_above": 1024, + "type": "keyword", + }, + "uptime": Object { + "type": "long", + }, + "working_directory": Object { + "fields": Object { + "text": Object { + "norms": false, + "type": "text", + }, + }, + "ignore_above": 1024, + "type": "keyword", + }, + }, + }, + "registry": Object { + "properties": Object { + "data": Object { + "properties": Object { + "bytes": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "strings": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "type": Object { + "ignore_above": 1024, + "type": "keyword", + }, + }, + }, + "hive": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "key": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "path": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "value": Object { + "ignore_above": 1024, + "type": "keyword", + }, + }, + }, + "related": Object { + "properties": Object { + "hash": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "hosts": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "ip": Object { + "type": "ip", + }, + "user": Object { + "ignore_above": 1024, + "type": "keyword", + }, + }, + }, + "rule": Object { + "properties": Object { + "author": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "category": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "description": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "id": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "license": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "name": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "reference": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "ruleset": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "uuid": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "version": Object { + "ignore_above": 1024, + "type": "keyword", + }, + }, + }, + "server": Object { + "properties": Object { + "address": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "as": Object { + "properties": Object { + "number": Object { + "type": "long", + }, + "organization": Object { + "properties": Object { + "name": Object { + "fields": Object { + "text": Object { + "norms": false, + "type": "text", + }, + }, + "ignore_above": 1024, + "type": "keyword", + }, + }, + }, + }, + }, + "bytes": Object { + "type": "long", + }, + "domain": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "geo": Object { + "properties": Object { + "city_name": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "continent_code": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "continent_name": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "country_iso_code": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "country_name": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "location": Object { + "type": "geo_point", + }, + "name": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "postal_code": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "region_iso_code": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "region_name": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "timezone": Object { + "ignore_above": 1024, + "type": "keyword", + }, + }, + }, + "ip": Object { + "type": "ip", + }, + "mac": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "nat": Object { + "properties": Object { + "ip": Object { + "type": "ip", + }, + "port": Object { + "type": "long", + }, + }, + }, + "packets": Object { + "type": "long", + }, + "port": Object { + "type": "long", + }, + "registered_domain": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "subdomain": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "top_level_domain": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "user": Object { + "properties": Object { + "domain": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "email": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "full_name": Object { + "fields": Object { + "text": Object { + "norms": false, + "type": "text", + }, + }, + "ignore_above": 1024, + "type": "keyword", + }, + "group": Object { + "properties": Object { + "domain": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "id": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "name": Object { + "ignore_above": 1024, + "type": "keyword", + }, + }, + }, + "hash": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "id": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "name": Object { + "fields": Object { + "text": Object { + "norms": false, + "type": "text", + }, + }, + "ignore_above": 1024, + "type": "keyword", + }, + "roles": Object { + "ignore_above": 1024, + "type": "keyword", + }, + }, + }, + }, + }, + "service": Object { + "properties": Object { + "ephemeral_id": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "id": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "name": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "node": Object { + "properties": Object { + "name": Object { + "ignore_above": 1024, + "type": "keyword", + }, + }, + }, + "state": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "type": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "version": Object { + "ignore_above": 1024, + "type": "keyword", + }, + }, + }, + "signal": Object { + "properties": Object { + "_meta": Object { + "properties": Object { + "version": Object { + "type": "long", + }, + }, + }, + "ancestors": Object { + "properties": Object { + "depth": Object { + "type": "long", + }, + "id": Object { + "type": "keyword", + }, + "index": Object { + "type": "keyword", + }, + "rule": Object { + "type": "keyword", + }, + "type": Object { + "type": "keyword", + }, + }, + }, + "depth": Object { + "type": "integer", + }, + "group": Object { + "properties": Object { + "id": Object { + "type": "keyword", + }, + "index": Object { + "type": "integer", + }, + }, + }, + "original_event": Object { + "properties": Object { + "action": Object { + "type": "keyword", + }, + "category": Object { + "type": "keyword", + }, + "code": Object { + "type": "keyword", + }, + "created": Object { + "type": "date", + }, + "dataset": Object { + "type": "keyword", + }, + "duration": Object { + "type": "long", + }, + "end": Object { + "type": "date", + }, + "hash": Object { + "type": "keyword", + }, + "id": Object { + "type": "keyword", + }, + "kind": Object { + "type": "keyword", + }, + "module": Object { + "type": "keyword", + }, + "original": Object { + "doc_values": false, + "index": false, + "type": "keyword", + }, + "outcome": Object { + "type": "keyword", + }, + "provider": Object { + "type": "keyword", + }, + "risk_score": Object { + "type": "float", + }, + "risk_score_norm": Object { + "type": "float", + }, + "sequence": Object { + "type": "long", + }, + "severity": Object { + "type": "long", + }, + "start": Object { + "type": "date", + }, + "timezone": Object { + "type": "keyword", + }, + "type": Object { + "type": "keyword", + }, + }, + }, + "original_signal": Object { + "dynamic": false, + "enabled": false, + "type": "object", + }, + "original_time": Object { + "type": "date", + }, + "parent": Object { + "properties": Object { + "depth": Object { + "type": "long", + }, + "id": Object { + "type": "keyword", + }, + "index": Object { + "type": "keyword", + }, + "rule": Object { + "type": "keyword", + }, + "type": Object { + "type": "keyword", + }, + }, + }, + "parents": Object { + "properties": Object { + "depth": Object { + "type": "long", + }, + "id": Object { + "type": "keyword", + }, + "index": Object { + "type": "keyword", + }, + "rule": Object { + "type": "keyword", + }, + "type": Object { + "type": "keyword", + }, + }, + }, + "rule": Object { + "properties": Object { + "author": Object { + "type": "keyword", + }, + "building_block_type": Object { + "type": "keyword", + }, + "created_at": Object { + "type": "date", + }, + "created_by": Object { + "type": "keyword", + }, + "description": Object { + "type": "keyword", + }, + "enabled": Object { + "type": "keyword", + }, + "false_positives": Object { + "type": "keyword", + }, + "filters": Object { + "type": "object", + }, + "from": Object { + "type": "keyword", + }, + "id": Object { + "type": "keyword", + }, + "immutable": Object { + "type": "keyword", + }, + "index": Object { + "type": "keyword", + }, + "interval": Object { + "type": "keyword", + }, + "language": Object { + "type": "keyword", + }, + "license": Object { + "type": "keyword", + }, + "max_signals": Object { + "type": "keyword", + }, + "name": Object { + "type": "keyword", + }, + "note": Object { + "type": "text", + }, + "output_index": Object { + "type": "keyword", + }, + "query": Object { + "type": "keyword", + }, + "references": Object { + "type": "keyword", + }, + "risk_score": Object { + "type": "float", + }, + "risk_score_mapping": Object { + "properties": Object { + "field": Object { + "type": "keyword", + }, + "operator": Object { + "type": "keyword", + }, + "value": Object { + "type": "keyword", + }, + }, + }, + "rule_id": Object { + "type": "keyword", + }, + "rule_name_override": Object { + "type": "keyword", + }, + "saved_id": Object { + "type": "keyword", + }, + "severity": Object { + "type": "keyword", + }, + "severity_mapping": Object { + "properties": Object { + "field": Object { + "type": "keyword", + }, + "operator": Object { + "type": "keyword", + }, + "severity": Object { + "type": "keyword", + }, + "value": Object { + "type": "keyword", + }, + }, + }, + "size": Object { + "type": "keyword", + }, + "tags": Object { + "type": "keyword", + }, + "threat": Object { + "properties": Object { + "framework": Object { + "type": "keyword", + }, + "tactic": Object { + "properties": Object { + "id": Object { + "type": "keyword", + }, + "name": Object { + "type": "keyword", + }, + "reference": Object { + "type": "keyword", + }, + }, + }, + "technique": Object { + "properties": Object { + "id": Object { + "type": "keyword", + }, + "name": Object { + "type": "keyword", + }, + "reference": Object { + "type": "keyword", + }, + "subtechnique": Object { + "properties": Object { + "id": Object { + "type": "keyword", + }, + "name": Object { + "type": "keyword", + }, + "reference": Object { + "type": "keyword", + }, + }, + }, + }, + }, + }, + }, + "threat_filters": Object { + "type": "object", + }, + "threat_index": Object { + "type": "keyword", + }, + "threat_indicator_path": Object { + "type": "keyword", + }, + "threat_language": Object { + "type": "keyword", + }, + "threat_mapping": Object { + "properties": Object { + "entries": Object { + "properties": Object { + "field": Object { + "type": "keyword", + }, + "type": Object { + "type": "keyword", + }, + "value": Object { + "type": "keyword", + }, + }, + }, + }, + }, + "threat_query": Object { + "type": "keyword", + }, + "threshold": Object { + "properties": Object { + "field": Object { + "type": "keyword", + }, + "value": Object { + "type": "float", + }, + }, + }, + "timeline_id": Object { + "type": "keyword", + }, + "timeline_title": Object { + "type": "keyword", + }, + "timestamp_override": Object { + "type": "keyword", + }, + "to": Object { + "type": "keyword", + }, + "type": Object { + "type": "keyword", + }, + "updated_at": Object { + "type": "date", + }, + "updated_by": Object { + "type": "keyword", + }, + "version": Object { + "type": "keyword", + }, + }, + }, + "status": Object { + "type": "keyword", + }, + "threshold_count": Object { + "type": "float", + }, + "threshold_result": Object { + "properties": Object { + "cardinality": Object { + "properties": Object { + "field": Object { + "type": "keyword", + }, + "value": Object { + "type": "long", + }, + }, + }, + "count": Object { + "type": "long", + }, + "from": Object { + "type": "date", + }, + "terms": Object { + "properties": Object { + "field": Object { + "type": "keyword", + }, + "value": Object { + "type": "keyword", + }, + }, + }, + }, + }, + }, + }, + "source": Object { + "properties": Object { + "address": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "as": Object { + "properties": Object { + "number": Object { + "type": "long", + }, + "organization": Object { + "properties": Object { + "name": Object { + "fields": Object { + "text": Object { + "norms": false, + "type": "text", + }, + }, + "ignore_above": 1024, + "type": "keyword", + }, + }, + }, + }, + }, + "bytes": Object { + "type": "long", + }, + "domain": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "geo": Object { + "properties": Object { + "city_name": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "continent_code": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "continent_name": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "country_iso_code": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "country_name": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "location": Object { + "type": "geo_point", + }, + "name": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "postal_code": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "region_iso_code": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "region_name": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "timezone": Object { + "ignore_above": 1024, + "type": "keyword", + }, + }, + }, + "ip": Object { + "type": "ip", + }, + "mac": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "nat": Object { + "properties": Object { + "ip": Object { + "type": "ip", + }, + "port": Object { + "type": "long", + }, + }, + }, + "packets": Object { + "type": "long", + }, + "port": Object { + "type": "long", + }, + "registered_domain": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "subdomain": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "top_level_domain": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "user": Object { + "properties": Object { + "domain": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "email": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "full_name": Object { + "fields": Object { + "text": Object { + "norms": false, + "type": "text", + }, + }, + "ignore_above": 1024, + "type": "keyword", + }, + "group": Object { + "properties": Object { + "domain": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "id": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "name": Object { + "ignore_above": 1024, + "type": "keyword", + }, + }, + }, + "hash": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "id": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "name": Object { + "fields": Object { + "text": Object { + "norms": false, + "type": "text", + }, + }, + "ignore_above": 1024, + "type": "keyword", + }, + "roles": Object { + "ignore_above": 1024, + "type": "keyword", + }, + }, + }, + }, + }, + "span": Object { + "properties": Object { + "id": Object { + "ignore_above": 1024, + "type": "keyword", + }, + }, + }, + "tags": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "threat": Object { + "properties": Object { + "framework": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "indicator": Object { + "properties": Object { + "as": Object { + "properties": Object { + "number": Object { + "type": "long", + }, + "organization": Object { + "properties": Object { + "name": Object { + "fields": Object { + "text": Object { + "norms": false, + "type": "text", + }, + }, + "ignore_above": 1024, + "type": "keyword", + }, + }, + }, + }, + }, + "confidence": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "dataset": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "description": Object { + "type": "wildcard", + }, + "domain": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "email": Object { + "properties": Object { + "address": Object { + "ignore_above": 1024, + "type": "keyword", + }, + }, + }, + "event": Object { + "properties": Object { + "action": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "category": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "code": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "created": Object { + "type": "date", + }, + "dataset": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "duration": Object { + "type": "long", + }, + "end": Object { + "type": "date", + }, + "hash": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "id": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "ingested": Object { + "type": "date", + }, + "kind": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "module": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "original": Object { + "doc_values": false, + "ignore_above": 1024, + "index": false, + "type": "keyword", + }, + "outcome": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "provider": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "reason": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "reference": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "risk_score": Object { + "type": "float", + }, + "risk_score_norm": Object { + "type": "float", + }, + "sequence": Object { + "type": "long", + }, + "severity": Object { + "type": "long", + }, + "start": Object { + "type": "date", + }, + "timezone": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "type": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "url": Object { + "ignore_above": 1024, + "type": "keyword", + }, + }, + }, + "first_seen": Object { + "type": "date", + }, + "geo": Object { + "properties": Object { + "city_name": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "continent_name": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "country_iso_code": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "country_name": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "location": Object { + "type": "geo_point", + }, + "name": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "region_iso_code": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "region_name": Object { + "ignore_above": 1024, + "type": "keyword", + }, + }, + }, + "ip": Object { + "type": "ip", + }, + "last_seen": Object { + "type": "date", + }, + "marking": Object { + "properties": Object { + "tlp": Object { + "ignore_above": 1024, + "type": "keyword", + }, + }, + }, + "matched": Object { + "properties": Object { + "atomic": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "field": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "type": Object { + "ignore_above": 1024, + "type": "keyword", + }, + }, + }, + "module": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "port": Object { + "type": "long", + }, + "provider": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "scanner_stats": Object { + "type": "long", + }, + "sightings": Object { + "type": "long", + }, + "type": Object { + "ignore_above": 1024, + "type": "keyword", + }, + }, + "type": "nested", + }, + "tactic": Object { + "properties": Object { + "id": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "name": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "reference": Object { + "ignore_above": 1024, + "type": "keyword", + }, + }, + }, + "technique": Object { + "properties": Object { + "id": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "name": Object { + "fields": Object { + "text": Object { + "norms": false, + "type": "text", + }, + }, + "ignore_above": 1024, + "type": "keyword", + }, + "reference": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "subtechnique": Object { + "properties": Object { + "id": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "name": Object { + "fields": Object { + "text": Object { + "norms": false, + "type": "text", + }, + }, + "ignore_above": 1024, + "type": "keyword", + }, + "reference": Object { + "ignore_above": 1024, + "type": "keyword", + }, + }, + }, + }, + }, + }, + }, + "tls": Object { + "properties": Object { + "cipher": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "client": Object { + "properties": Object { + "certificate": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "certificate_chain": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "hash": Object { + "properties": Object { + "md5": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "sha1": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "sha256": Object { + "ignore_above": 1024, + "type": "keyword", + }, + }, + }, + "issuer": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "ja3": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "not_after": Object { + "type": "date", + }, + "not_before": Object { + "type": "date", + }, + "server_name": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "subject": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "supported_ciphers": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "x509": Object { + "properties": Object { + "alternative_names": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "issuer": Object { + "properties": Object { + "common_name": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "country": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "distinguished_name": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "locality": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "organization": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "organizational_unit": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "state_or_province": Object { + "ignore_above": 1024, + "type": "keyword", + }, + }, + }, + "not_after": Object { + "type": "date", + }, + "not_before": Object { + "type": "date", + }, + "public_key_algorithm": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "public_key_curve": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "public_key_exponent": Object { + "doc_values": false, + "index": false, + "type": "long", + }, + "public_key_size": Object { + "type": "long", + }, + "serial_number": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "signature_algorithm": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "subject": Object { + "properties": Object { + "common_name": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "country": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "distinguished_name": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "locality": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "organization": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "organizational_unit": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "state_or_province": Object { + "ignore_above": 1024, + "type": "keyword", + }, + }, + }, + "version_number": Object { + "ignore_above": 1024, + "type": "keyword", + }, + }, + }, + }, + }, + "curve": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "established": Object { + "type": "boolean", + }, + "next_protocol": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "resumed": Object { + "type": "boolean", + }, + "server": Object { + "properties": Object { + "certificate": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "certificate_chain": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "hash": Object { + "properties": Object { + "md5": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "sha1": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "sha256": Object { + "ignore_above": 1024, + "type": "keyword", + }, + }, + }, + "issuer": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "ja3s": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "not_after": Object { + "type": "date", + }, + "not_before": Object { + "type": "date", + }, + "subject": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "x509": Object { + "properties": Object { + "alternative_names": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "issuer": Object { + "properties": Object { + "common_name": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "country": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "distinguished_name": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "locality": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "organization": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "organizational_unit": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "state_or_province": Object { + "ignore_above": 1024, + "type": "keyword", + }, + }, + }, + "not_after": Object { + "type": "date", + }, + "not_before": Object { + "type": "date", + }, + "public_key_algorithm": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "public_key_curve": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "public_key_exponent": Object { + "doc_values": false, + "index": false, + "type": "long", + }, + "public_key_size": Object { + "type": "long", + }, + "serial_number": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "signature_algorithm": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "subject": Object { + "properties": Object { + "common_name": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "country": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "distinguished_name": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "locality": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "organization": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "organizational_unit": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "state_or_province": Object { + "ignore_above": 1024, + "type": "keyword", + }, + }, + }, + "version_number": Object { + "ignore_above": 1024, + "type": "keyword", + }, + }, + }, + }, + }, + "version": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "version_protocol": Object { + "ignore_above": 1024, + "type": "keyword", + }, + }, + }, + "trace": Object { + "properties": Object { + "id": Object { + "ignore_above": 1024, + "type": "keyword", + }, + }, + }, + "transaction": Object { + "properties": Object { + "id": Object { + "ignore_above": 1024, + "type": "keyword", + }, + }, + }, + "url": Object { + "properties": Object { + "domain": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "extension": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "fragment": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "full": Object { + "fields": Object { + "text": Object { + "norms": false, + "type": "text", + }, + }, + "ignore_above": 1024, + "type": "keyword", + }, + "original": Object { + "fields": Object { + "text": Object { + "norms": false, + "type": "text", + }, + }, + "ignore_above": 1024, + "type": "keyword", + }, + "password": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "path": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "port": Object { + "type": "long", + }, + "query": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "registered_domain": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "scheme": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "subdomain": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "top_level_domain": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "username": Object { + "ignore_above": 1024, + "type": "keyword", + }, + }, + }, + "user": Object { + "properties": Object { + "changes": Object { + "properties": Object { + "domain": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "email": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "full_name": Object { + "fields": Object { + "text": Object { + "norms": false, + "type": "text", + }, + }, + "ignore_above": 1024, + "type": "keyword", + }, + "group": Object { + "properties": Object { + "domain": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "id": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "name": Object { + "ignore_above": 1024, + "type": "keyword", + }, + }, + }, + "hash": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "id": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "name": Object { + "fields": Object { + "text": Object { + "norms": false, + "type": "text", + }, + }, + "ignore_above": 1024, + "type": "keyword", + }, + "roles": Object { + "ignore_above": 1024, + "type": "keyword", + }, + }, + }, + "domain": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "effective": Object { + "properties": Object { + "domain": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "email": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "full_name": Object { + "fields": Object { + "text": Object { + "norms": false, + "type": "text", + }, + }, + "ignore_above": 1024, + "type": "keyword", + }, + "group": Object { + "properties": Object { + "domain": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "id": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "name": Object { + "ignore_above": 1024, + "type": "keyword", + }, + }, + }, + "hash": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "id": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "name": Object { + "fields": Object { + "text": Object { + "norms": false, + "type": "text", + }, + }, + "ignore_above": 1024, + "type": "keyword", + }, + "roles": Object { + "ignore_above": 1024, + "type": "keyword", + }, + }, + }, + "email": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "full_name": Object { + "fields": Object { + "text": Object { + "norms": false, + "type": "text", + }, + }, + "ignore_above": 1024, + "type": "keyword", + }, + "group": Object { + "properties": Object { + "domain": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "id": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "name": Object { + "ignore_above": 1024, + "type": "keyword", + }, + }, + }, + "hash": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "id": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "name": Object { + "fields": Object { + "text": Object { + "norms": false, + "type": "text", + }, + }, + "ignore_above": 1024, + "type": "keyword", + }, + "roles": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "target": Object { + "properties": Object { + "domain": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "email": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "full_name": Object { + "fields": Object { + "text": Object { + "norms": false, + "type": "text", + }, + }, + "ignore_above": 1024, + "type": "keyword", + }, + "group": Object { + "properties": Object { + "domain": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "id": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "name": Object { + "ignore_above": 1024, + "type": "keyword", + }, + }, + }, + "hash": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "id": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "name": Object { + "fields": Object { + "text": Object { + "norms": false, + "type": "text", + }, + }, + "ignore_above": 1024, + "type": "keyword", + }, + "roles": Object { + "ignore_above": 1024, + "type": "keyword", + }, + }, + }, + }, + }, + "user_agent": Object { + "properties": Object { + "device": Object { + "properties": Object { + "name": Object { + "ignore_above": 1024, + "type": "keyword", + }, + }, + }, + "name": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "original": Object { + "fields": Object { + "text": Object { + "norms": false, + "type": "text", + }, + }, + "ignore_above": 1024, + "type": "keyword", + }, + "os": Object { + "properties": Object { + "family": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "full": Object { + "fields": Object { + "text": Object { + "norms": false, + "type": "text", + }, + }, + "ignore_above": 1024, + "type": "keyword", + }, + "kernel": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "name": Object { + "fields": Object { + "text": Object { + "norms": false, + "type": "text", + }, + }, + "ignore_above": 1024, + "type": "keyword", + }, + "platform": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "type": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "version": Object { + "ignore_above": 1024, + "type": "keyword", + }, + }, + }, + "version": Object { + "ignore_above": 1024, + "type": "keyword", + }, + }, + }, + "vlan": Object { + "properties": Object { + "id": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "name": Object { + "ignore_above": 1024, + "type": "keyword", + }, + }, + }, + "vulnerability": Object { + "properties": Object { + "category": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "classification": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "description": Object { + "fields": Object { + "text": Object { + "norms": false, + "type": "text", + }, + }, + "ignore_above": 1024, + "type": "keyword", + }, + "enumeration": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "id": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "reference": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "report_id": Object { + "ignore_above": 1024, + "type": "keyword", + }, + "scanner": Object { + "properties": Object { + "vendor": Object { + "ignore_above": 1024, + "type": "keyword", + }, + }, + }, + "score": Object { + "properties": Object { + "base": Object { + "type": "float", + }, + "environmental": Object { + "type": "float", + }, + "temporal": Object { + "type": "float", + }, + "version": Object { + "ignore_above": 1024, + "type": "keyword", + }, + }, + }, + "severity": Object { + "ignore_above": 1024, + "type": "keyword", + }, + }, + }, + }, + }, + "settings": Object { + "index": Object { + "lifecycle": Object { + "name": "test-index", + "rollover_alias": "test-index", + }, + }, + "mapping": Object { + "total_fields": Object { + "limit": 10000, + }, + }, + }, + "version": 35, +} +`; diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/routes/index/ecs_mapping.json b/x-pack/plugins/security_solution/server/lib/detection_engine/routes/index/ecs_mapping.json index 70b62d569b9d3..2967f4cb725e7 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/routes/index/ecs_mapping.json +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/routes/index/ecs_mapping.json @@ -1,12 +1,37 @@ { + "index_patterns": [ + "try-ecs-*" + ], "mappings": { - "dynamic": false, + "_meta": { + "version": "1.9.0" + }, + "date_detection": false, + "dynamic_templates": [ + { + "strings_as_keyword": { + "mapping": { + "ignore_above": 1024, + "type": "keyword" + }, + "match_mapping_type": "string" + } + } + ], "properties": { "@timestamp": { "type": "date" }, "agent": { "properties": { + "build": { + "properties": { + "original": { + "ignore_above": 1024, + "type": "keyword" + } + } + }, "ephemeral_id": { "ignore_above": 1024, "type": "keyword" @@ -29,27 +54,6 @@ } } }, - "as": { - "properties": { - "number": { - "type": "long" - }, - "organization": { - "properties": { - "name": { - "fields": { - "text": { - "norms": false, - "type": "text" - } - }, - "ignore_above": 1024, - "type": "keyword" - } - } - } - } - }, "client": { "properties": { "address": { @@ -90,6 +94,10 @@ "ignore_above": 1024, "type": "keyword" }, + "continent_code": { + "ignore_above": 1024, + "type": "keyword" + }, "continent_name": { "ignore_above": 1024, "type": "keyword" @@ -109,6 +117,10 @@ "ignore_above": 1024, "type": "keyword" }, + "postal_code": { + "ignore_above": 1024, + "type": "keyword" + }, "region_iso_code": { "ignore_above": 1024, "type": "keyword" @@ -116,6 +128,10 @@ "region_name": { "ignore_above": 1024, "type": "keyword" + }, + "timezone": { + "ignore_above": 1024, + "type": "keyword" } } }, @@ -146,6 +162,10 @@ "ignore_above": 1024, "type": "keyword" }, + "subdomain": { + "ignore_above": 1024, + "type": "keyword" + }, "top_level_domain": { "ignore_above": 1024, "type": "keyword" @@ -203,6 +223,10 @@ }, "ignore_above": 1024, "type": "keyword" + }, + "roles": { + "ignore_above": 1024, + "type": "keyword" } } } @@ -215,6 +239,10 @@ "id": { "ignore_above": 1024, "type": "keyword" + }, + "name": { + "ignore_above": 1024, + "type": "keyword" } } }, @@ -242,6 +270,18 @@ } } }, + "project": { + "properties": { + "id": { + "ignore_above": 1024, + "type": "keyword" + }, + "name": { + "ignore_above": 1024, + "type": "keyword" + } + } + }, "provider": { "ignore_above": 1024, "type": "keyword" @@ -249,27 +289,14 @@ "region": { "ignore_above": 1024, "type": "keyword" - } - } - }, - "code_signature": { - "properties": { - "exists": { - "type": "boolean" - }, - "status": { - "ignore_above": 1024, - "type": "keyword" - }, - "subject_name": { - "ignore_above": 1024, - "type": "keyword" - }, - "trusted": { - "type": "boolean" }, - "valid": { - "type": "boolean" + "service": { + "properties": { + "name": { + "ignore_above": 1024, + "type": "keyword" + } + } } } }, @@ -344,6 +371,10 @@ "ignore_above": 1024, "type": "keyword" }, + "continent_code": { + "ignore_above": 1024, + "type": "keyword" + }, "continent_name": { "ignore_above": 1024, "type": "keyword" @@ -363,6 +394,10 @@ "ignore_above": 1024, "type": "keyword" }, + "postal_code": { + "ignore_above": 1024, + "type": "keyword" + }, "region_iso_code": { "ignore_above": 1024, "type": "keyword" @@ -370,6 +405,10 @@ "region_name": { "ignore_above": 1024, "type": "keyword" + }, + "timezone": { + "ignore_above": 1024, + "type": "keyword" } } }, @@ -400,6 +439,10 @@ "ignore_above": 1024, "type": "keyword" }, + "subdomain": { + "ignore_above": 1024, + "type": "keyword" + }, "top_level_domain": { "ignore_above": 1024, "type": "keyword" @@ -457,6 +500,10 @@ }, "ignore_above": 1024, "type": "keyword" + }, + "roles": { + "ignore_above": 1024, + "type": "keyword" } } } @@ -469,6 +516,10 @@ "exists": { "type": "boolean" }, + "signing_id": { + "ignore_above": 1024, + "type": "keyword" + }, "status": { "ignore_above": 1024, "type": "keyword" @@ -477,6 +528,10 @@ "ignore_above": 1024, "type": "keyword" }, + "team_id": { + "ignore_above": 1024, + "type": "keyword" + }, "trusted": { "type": "boolean" }, @@ -502,6 +557,10 @@ "sha512": { "ignore_above": 1024, "type": "keyword" + }, + "ssdeep": { + "ignore_above": 1024, + "type": "keyword" } } }, @@ -515,6 +574,10 @@ }, "pe": { "properties": { + "architecture": { + "ignore_above": 1024, + "type": "keyword" + }, "company": { "ignore_above": 1024, "type": "keyword" @@ -527,6 +590,10 @@ "ignore_above": 1024, "type": "keyword" }, + "imphash": { + "ignore_above": 1024, + "type": "keyword" + }, "original_file_name": { "ignore_above": 1024, "type": "keyword" @@ -718,6 +785,10 @@ "ignore_above": 1024, "type": "keyword" }, + "reason": { + "ignore_above": 1024, + "type": "keyword" + }, "reference": { "ignore_above": 1024, "type": "keyword" @@ -765,6 +836,10 @@ "exists": { "type": "boolean" }, + "signing_id": { + "ignore_above": 1024, + "type": "keyword" + }, "status": { "ignore_above": 1024, "type": "keyword" @@ -773,6 +848,10 @@ "ignore_above": 1024, "type": "keyword" }, + "team_id": { + "ignore_above": 1024, + "type": "keyword" + }, "trusted": { "type": "boolean" }, @@ -828,6 +907,10 @@ "sha512": { "ignore_above": 1024, "type": "keyword" + }, + "ssdeep": { + "ignore_above": 1024, + "type": "keyword" } } }, @@ -866,6 +949,10 @@ }, "pe": { "properties": { + "architecture": { + "ignore_above": 1024, + "type": "keyword" + }, "company": { "ignore_above": 1024, "type": "keyword" @@ -878,6 +965,10 @@ "ignore_above": 1024, "type": "keyword" }, + "imphash": { + "ignore_above": 1024, + "type": "keyword" + }, "original_file_name": { "ignore_above": 1024, "type": "keyword" @@ -908,41 +999,112 @@ "uid": { "ignore_above": 1024, "type": "keyword" - } - } - }, - "geo": { - "properties": { - "city_name": { - "ignore_above": 1024, - "type": "keyword" - }, - "continent_name": { - "ignore_above": 1024, - "type": "keyword" - }, - "country_iso_code": { - "ignore_above": 1024, - "type": "keyword" - }, - "country_name": { - "ignore_above": 1024, - "type": "keyword" - }, - "location": { - "type": "geo_point" - }, - "name": { - "ignore_above": 1024, - "type": "keyword" - }, - "region_iso_code": { - "ignore_above": 1024, - "type": "keyword" }, - "region_name": { - "ignore_above": 1024, - "type": "keyword" + "x509": { + "properties": { + "alternative_names": { + "ignore_above": 1024, + "type": "keyword" + }, + "issuer": { + "properties": { + "common_name": { + "ignore_above": 1024, + "type": "keyword" + }, + "country": { + "ignore_above": 1024, + "type": "keyword" + }, + "distinguished_name": { + "ignore_above": 1024, + "type": "keyword" + }, + "locality": { + "ignore_above": 1024, + "type": "keyword" + }, + "organization": { + "ignore_above": 1024, + "type": "keyword" + }, + "organizational_unit": { + "ignore_above": 1024, + "type": "keyword" + }, + "state_or_province": { + "ignore_above": 1024, + "type": "keyword" + } + } + }, + "not_after": { + "type": "date" + }, + "not_before": { + "type": "date" + }, + "public_key_algorithm": { + "ignore_above": 1024, + "type": "keyword" + }, + "public_key_curve": { + "ignore_above": 1024, + "type": "keyword" + }, + "public_key_exponent": { + "doc_values": false, + "index": false, + "type": "long" + }, + "public_key_size": { + "type": "long" + }, + "serial_number": { + "ignore_above": 1024, + "type": "keyword" + }, + "signature_algorithm": { + "ignore_above": 1024, + "type": "keyword" + }, + "subject": { + "properties": { + "common_name": { + "ignore_above": 1024, + "type": "keyword" + }, + "country": { + "ignore_above": 1024, + "type": "keyword" + }, + "distinguished_name": { + "ignore_above": 1024, + "type": "keyword" + }, + "locality": { + "ignore_above": 1024, + "type": "keyword" + }, + "organization": { + "ignore_above": 1024, + "type": "keyword" + }, + "organizational_unit": { + "ignore_above": 1024, + "type": "keyword" + }, + "state_or_province": { + "ignore_above": 1024, + "type": "keyword" + } + } + }, + "version_number": { + "ignore_above": 1024, + "type": "keyword" + } + } } } }, @@ -962,42 +1124,52 @@ } } }, - "hash": { - "properties": { - "md5": { - "ignore_above": 1024, - "type": "keyword" - }, - "sha1": { - "ignore_above": 1024, - "type": "keyword" - }, - "sha256": { - "ignore_above": 1024, - "type": "keyword" - }, - "sha512": { - "ignore_above": 1024, - "type": "keyword" - } - } - }, "host": { "properties": { "architecture": { "ignore_above": 1024, "type": "keyword" }, - "domain": { - "ignore_above": 1024, - "type": "keyword" + "cpu": { + "properties": { + "usage": { + "scaling_factor": 1000, + "type": "scaled_float" + } + } }, - "geo": { + "disk": { + "properties": { + "read": { + "properties": { + "bytes": { + "type": "long" + } + } + }, + "write": { + "properties": { + "bytes": { + "type": "long" + } + } + } + } + }, + "domain": { + "ignore_above": 1024, + "type": "keyword" + }, + "geo": { "properties": { "city_name": { "ignore_above": 1024, "type": "keyword" }, + "continent_code": { + "ignore_above": 1024, + "type": "keyword" + }, "continent_name": { "ignore_above": 1024, "type": "keyword" @@ -1017,6 +1189,10 @@ "ignore_above": 1024, "type": "keyword" }, + "postal_code": { + "ignore_above": 1024, + "type": "keyword" + }, "region_iso_code": { "ignore_above": 1024, "type": "keyword" @@ -1024,6 +1200,10 @@ "region_name": { "ignore_above": 1024, "type": "keyword" + }, + "timezone": { + "ignore_above": 1024, + "type": "keyword" } } }, @@ -1046,6 +1226,30 @@ "ignore_above": 1024, "type": "keyword" }, + "network": { + "properties": { + "egress": { + "properties": { + "bytes": { + "type": "long" + }, + "packets": { + "type": "long" + } + } + }, + "ingress": { + "properties": { + "bytes": { + "type": "long" + }, + "packets": { + "type": "long" + } + } + } + } + }, "os": { "properties": { "family": { @@ -1080,6 +1284,10 @@ "ignore_above": 1024, "type": "keyword" }, + "type": { + "ignore_above": 1024, + "type": "keyword" + }, "version": { "ignore_above": 1024, "type": "keyword" @@ -1146,6 +1354,10 @@ }, "ignore_above": 1024, "type": "keyword" + }, + "roles": { + "ignore_above": 1024, + "type": "keyword" } } } @@ -1175,10 +1387,18 @@ "bytes": { "type": "long" }, + "id": { + "ignore_above": 1024, + "type": "keyword" + }, "method": { "ignore_above": 1024, "type": "keyword" }, + "mime_type": { + "ignore_above": 1024, + "type": "keyword" + }, "referrer": { "ignore_above": 1024, "type": "keyword" @@ -1207,6 +1427,10 @@ "bytes": { "type": "long" }, + "mime_type": { + "ignore_above": 1024, + "type": "keyword" + }, "status_code": { "type": "long" } @@ -1218,27 +1442,19 @@ } } }, - "interface": { - "properties": { - "alias": { - "ignore_above": 1024, - "type": "keyword" - }, - "id": { - "ignore_above": 1024, - "type": "keyword" - }, - "name": { - "ignore_above": 1024, - "type": "keyword" - } - } - }, "labels": { "type": "object" }, "log": { "properties": { + "file": { + "properties": { + "path": { + "ignore_above": 1024, + "type": "keyword" + } + } + }, "level": { "ignore_above": 1024, "type": "keyword" @@ -1427,6 +1643,10 @@ "ignore_above": 1024, "type": "keyword" }, + "continent_code": { + "ignore_above": 1024, + "type": "keyword" + }, "continent_name": { "ignore_above": 1024, "type": "keyword" @@ -1446,6 +1666,10 @@ "ignore_above": 1024, "type": "keyword" }, + "postal_code": { + "ignore_above": 1024, + "type": "keyword" + }, "region_iso_code": { "ignore_above": 1024, "type": "keyword" @@ -1453,6 +1677,10 @@ "region_name": { "ignore_above": 1024, "type": "keyword" + }, + "timezone": { + "ignore_above": 1024, + "type": "keyword" } } }, @@ -1542,6 +1770,10 @@ "ignore_above": 1024, "type": "keyword" }, + "type": { + "ignore_above": 1024, + "type": "keyword" + }, "version": { "ignore_above": 1024, "type": "keyword" @@ -1588,46 +1820,6 @@ } } }, - "os": { - "properties": { - "family": { - "ignore_above": 1024, - "type": "keyword" - }, - "full": { - "fields": { - "text": { - "norms": false, - "type": "text" - } - }, - "ignore_above": 1024, - "type": "keyword" - }, - "kernel": { - "ignore_above": 1024, - "type": "keyword" - }, - "name": { - "fields": { - "text": { - "norms": false, - "type": "text" - } - }, - "ignore_above": 1024, - "type": "keyword" - }, - "platform": { - "ignore_above": 1024, - "type": "keyword" - }, - "version": { - "ignore_above": 1024, - "type": "keyword" - } - } - }, "package": { "properties": { "architecture": { @@ -1682,30 +1874,6 @@ } } }, - "pe": { - "properties": { - "company": { - "ignore_above": 1024, - "type": "keyword" - }, - "description": { - "ignore_above": 1024, - "type": "keyword" - }, - "file_version": { - "ignore_above": 1024, - "type": "keyword" - }, - "original_file_name": { - "ignore_above": 1024, - "type": "keyword" - }, - "product": { - "ignore_above": 1024, - "type": "keyword" - } - } - }, "process": { "properties": { "args": { @@ -1720,6 +1888,10 @@ "exists": { "type": "boolean" }, + "signing_id": { + "ignore_above": 1024, + "type": "keyword" + }, "status": { "ignore_above": 1024, "type": "keyword" @@ -1728,6 +1900,10 @@ "ignore_above": 1024, "type": "keyword" }, + "team_id": { + "ignore_above": 1024, + "type": "keyword" + }, "trusted": { "type": "boolean" }, @@ -1780,6 +1956,10 @@ "sha512": { "ignore_above": 1024, "type": "keyword" + }, + "ssdeep": { + "ignore_above": 1024, + "type": "keyword" } } }, @@ -1807,6 +1987,10 @@ "exists": { "type": "boolean" }, + "signing_id": { + "ignore_above": 1024, + "type": "keyword" + }, "status": { "ignore_above": 1024, "type": "keyword" @@ -1815,6 +1999,10 @@ "ignore_above": 1024, "type": "keyword" }, + "team_id": { + "ignore_above": 1024, + "type": "keyword" + }, "trusted": { "type": "boolean" }, @@ -1867,6 +2055,10 @@ "sha512": { "ignore_above": 1024, "type": "keyword" + }, + "ssdeep": { + "ignore_above": 1024, + "type": "keyword" } } }, @@ -1880,6 +2072,38 @@ "ignore_above": 1024, "type": "keyword" }, + "pe": { + "properties": { + "architecture": { + "ignore_above": 1024, + "type": "keyword" + }, + "company": { + "ignore_above": 1024, + "type": "keyword" + }, + "description": { + "ignore_above": 1024, + "type": "keyword" + }, + "file_version": { + "ignore_above": 1024, + "type": "keyword" + }, + "imphash": { + "ignore_above": 1024, + "type": "keyword" + }, + "original_file_name": { + "ignore_above": 1024, + "type": "keyword" + }, + "product": { + "ignore_above": 1024, + "type": "keyword" + } + } + }, "pgid": { "type": "long" }, @@ -1930,6 +2154,10 @@ }, "pe": { "properties": { + "architecture": { + "ignore_above": 1024, + "type": "keyword" + }, "company": { "ignore_above": 1024, "type": "keyword" @@ -1942,6 +2170,10 @@ "ignore_above": 1024, "type": "keyword" }, + "imphash": { + "ignore_above": 1024, + "type": "keyword" + }, "original_file_name": { "ignore_above": 1024, "type": "keyword" @@ -2042,6 +2274,10 @@ "ignore_above": 1024, "type": "keyword" }, + "hosts": { + "ignore_above": 1024, + "type": "keyword" + }, "ip": { "type": "ip" }, @@ -2135,6 +2371,10 @@ "ignore_above": 1024, "type": "keyword" }, + "continent_code": { + "ignore_above": 1024, + "type": "keyword" + }, "continent_name": { "ignore_above": 1024, "type": "keyword" @@ -2154,6 +2394,10 @@ "ignore_above": 1024, "type": "keyword" }, + "postal_code": { + "ignore_above": 1024, + "type": "keyword" + }, "region_iso_code": { "ignore_above": 1024, "type": "keyword" @@ -2161,6 +2405,10 @@ "region_name": { "ignore_above": 1024, "type": "keyword" + }, + "timezone": { + "ignore_above": 1024, + "type": "keyword" } } }, @@ -2191,6 +2439,10 @@ "ignore_above": 1024, "type": "keyword" }, + "subdomain": { + "ignore_above": 1024, + "type": "keyword" + }, "top_level_domain": { "ignore_above": 1024, "type": "keyword" @@ -2248,6 +2500,10 @@ }, "ignore_above": 1024, "type": "keyword" + }, + "roles": { + "ignore_above": 1024, + "type": "keyword" } } } @@ -2329,6 +2585,10 @@ "ignore_above": 1024, "type": "keyword" }, + "continent_code": { + "ignore_above": 1024, + "type": "keyword" + }, "continent_name": { "ignore_above": 1024, "type": "keyword" @@ -2348,6 +2608,10 @@ "ignore_above": 1024, "type": "keyword" }, + "postal_code": { + "ignore_above": 1024, + "type": "keyword" + }, "region_iso_code": { "ignore_above": 1024, "type": "keyword" @@ -2355,6 +2619,10 @@ "region_name": { "ignore_above": 1024, "type": "keyword" + }, + "timezone": { + "ignore_above": 1024, + "type": "keyword" } } }, @@ -2385,6 +2653,10 @@ "ignore_above": 1024, "type": "keyword" }, + "subdomain": { + "ignore_above": 1024, + "type": "keyword" + }, "top_level_domain": { "ignore_above": 1024, "type": "keyword" @@ -2442,11 +2714,23 @@ }, "ignore_above": 1024, "type": "keyword" + }, + "roles": { + "ignore_above": 1024, + "type": "keyword" } } } } }, + "span": { + "properties": { + "id": { + "ignore_above": 1024, + "type": "keyword" + } + } + }, "tags": { "ignore_above": 1024, "type": "keyword" @@ -2457,147 +2741,9 @@ "ignore_above": 1024, "type": "keyword" }, - "indicator": { - "type": "nested", + "tactic": { "properties": { - "as": { - "properties": { - "number": { - "type": "long" - }, - "organization": { - "properties": { - "name": { - "fields": { - "text": { - "norms": false, - "type": "text" - } - }, - "ignore_above": 1024, - "type": "keyword" - } - } - } - } - }, - "confidence": { - "ignore_above": 1024, - "type": "keyword" - }, - "dataset": { - "ignore_above": 1024, - "type": "keyword" - }, - "description": { - "type": "wildcard" - }, - "domain": { - "ignore_above": 1024, - "type": "keyword" - }, - "email": { - "properties": { - "address": { - "ignore_above": 1024, - "type": "keyword" - } - } - }, - "first_seen": { - "type": "date" - }, - "geo": { - "properties": { - "city_name": { - "ignore_above": 1024, - "type": "keyword" - }, - "continent_name": { - "ignore_above": 1024, - "type": "keyword" - }, - "country_iso_code": { - "ignore_above": 1024, - "type": "keyword" - }, - "country_name": { - "ignore_above": 1024, - "type": "keyword" - }, - "location": { - "type": "geo_point" - }, - "name": { - "ignore_above": 1024, - "type": "keyword" - }, - "region_iso_code": { - "ignore_above": 1024, - "type": "keyword" - }, - "region_name": { - "ignore_above": 1024, - "type": "keyword" - } - } - }, - "ip": { - "type": "ip" - }, - "last_seen": { - "type": "date" - }, - "marking": { - "properties": { - "tlp": { - "ignore_above": 1024, - "type": "keyword" - } - } - }, - "matched": { - "properties": { - "atomic": { - "ignore_above": 1024, - "type": "keyword" - }, - "field": { - "ignore_above": 1024, - "type": "keyword" - }, - "type": { - "ignore_above": 1024, - "type": "keyword" - } - } - }, - "module": { - "ignore_above": 1024, - "type": "keyword" - }, - "port": { - "type": "long" - }, - "provider": { - "ignore_above": 1024, - "type": "keyword" - }, - "scanner_stats": { - "type": "long" - }, - "sightings": { - "type": "long" - }, - "type": { - "ignore_above": 1024, - "type": "keyword" - } - } - }, - "tactic": { - "properties": { - "id": { + "id": { "ignore_above": 1024, "type": "keyword" }, @@ -2630,6 +2776,28 @@ "reference": { "ignore_above": 1024, "type": "keyword" + }, + "subtechnique": { + "properties": { + "id": { + "ignore_above": 1024, + "type": "keyword" + }, + "name": { + "fields": { + "text": { + "norms": false, + "type": "text" + } + }, + "ignore_above": 1024, + "type": "keyword" + }, + "reference": { + "ignore_above": 1024, + "type": "keyword" + } + } } } } @@ -2692,6 +2860,112 @@ "supported_ciphers": { "ignore_above": 1024, "type": "keyword" + }, + "x509": { + "properties": { + "alternative_names": { + "ignore_above": 1024, + "type": "keyword" + }, + "issuer": { + "properties": { + "common_name": { + "ignore_above": 1024, + "type": "keyword" + }, + "country": { + "ignore_above": 1024, + "type": "keyword" + }, + "distinguished_name": { + "ignore_above": 1024, + "type": "keyword" + }, + "locality": { + "ignore_above": 1024, + "type": "keyword" + }, + "organization": { + "ignore_above": 1024, + "type": "keyword" + }, + "organizational_unit": { + "ignore_above": 1024, + "type": "keyword" + }, + "state_or_province": { + "ignore_above": 1024, + "type": "keyword" + } + } + }, + "not_after": { + "type": "date" + }, + "not_before": { + "type": "date" + }, + "public_key_algorithm": { + "ignore_above": 1024, + "type": "keyword" + }, + "public_key_curve": { + "ignore_above": 1024, + "type": "keyword" + }, + "public_key_exponent": { + "doc_values": false, + "index": false, + "type": "long" + }, + "public_key_size": { + "type": "long" + }, + "serial_number": { + "ignore_above": 1024, + "type": "keyword" + }, + "signature_algorithm": { + "ignore_above": 1024, + "type": "keyword" + }, + "subject": { + "properties": { + "common_name": { + "ignore_above": 1024, + "type": "keyword" + }, + "country": { + "ignore_above": 1024, + "type": "keyword" + }, + "distinguished_name": { + "ignore_above": 1024, + "type": "keyword" + }, + "locality": { + "ignore_above": 1024, + "type": "keyword" + }, + "organization": { + "ignore_above": 1024, + "type": "keyword" + }, + "organizational_unit": { + "ignore_above": 1024, + "type": "keyword" + }, + "state_or_province": { + "ignore_above": 1024, + "type": "keyword" + } + } + }, + "version_number": { + "ignore_above": 1024, + "type": "keyword" + } + } } } }, @@ -2752,6 +3026,112 @@ "subject": { "ignore_above": 1024, "type": "keyword" + }, + "x509": { + "properties": { + "alternative_names": { + "ignore_above": 1024, + "type": "keyword" + }, + "issuer": { + "properties": { + "common_name": { + "ignore_above": 1024, + "type": "keyword" + }, + "country": { + "ignore_above": 1024, + "type": "keyword" + }, + "distinguished_name": { + "ignore_above": 1024, + "type": "keyword" + }, + "locality": { + "ignore_above": 1024, + "type": "keyword" + }, + "organization": { + "ignore_above": 1024, + "type": "keyword" + }, + "organizational_unit": { + "ignore_above": 1024, + "type": "keyword" + }, + "state_or_province": { + "ignore_above": 1024, + "type": "keyword" + } + } + }, + "not_after": { + "type": "date" + }, + "not_before": { + "type": "date" + }, + "public_key_algorithm": { + "ignore_above": 1024, + "type": "keyword" + }, + "public_key_curve": { + "ignore_above": 1024, + "type": "keyword" + }, + "public_key_exponent": { + "doc_values": false, + "index": false, + "type": "long" + }, + "public_key_size": { + "type": "long" + }, + "serial_number": { + "ignore_above": 1024, + "type": "keyword" + }, + "signature_algorithm": { + "ignore_above": 1024, + "type": "keyword" + }, + "subject": { + "properties": { + "common_name": { + "ignore_above": 1024, + "type": "keyword" + }, + "country": { + "ignore_above": 1024, + "type": "keyword" + }, + "distinguished_name": { + "ignore_above": 1024, + "type": "keyword" + }, + "locality": { + "ignore_above": 1024, + "type": "keyword" + }, + "organization": { + "ignore_above": 1024, + "type": "keyword" + }, + "organizational_unit": { + "ignore_above": 1024, + "type": "keyword" + }, + "state_or_province": { + "ignore_above": 1024, + "type": "keyword" + } + } + }, + "version_number": { + "ignore_above": 1024, + "type": "keyword" + } + } } } }, @@ -2838,6 +3218,10 @@ "ignore_above": 1024, "type": "keyword" }, + "subdomain": { + "ignore_above": 1024, + "type": "keyword" + }, "top_level_domain": { "ignore_above": 1024, "type": "keyword" @@ -2850,10 +3234,130 @@ }, "user": { "properties": { + "changes": { + "properties": { + "domain": { + "ignore_above": 1024, + "type": "keyword" + }, + "email": { + "ignore_above": 1024, + "type": "keyword" + }, + "full_name": { + "fields": { + "text": { + "norms": false, + "type": "text" + } + }, + "ignore_above": 1024, + "type": "keyword" + }, + "group": { + "properties": { + "domain": { + "ignore_above": 1024, + "type": "keyword" + }, + "id": { + "ignore_above": 1024, + "type": "keyword" + }, + "name": { + "ignore_above": 1024, + "type": "keyword" + } + } + }, + "hash": { + "ignore_above": 1024, + "type": "keyword" + }, + "id": { + "ignore_above": 1024, + "type": "keyword" + }, + "name": { + "fields": { + "text": { + "norms": false, + "type": "text" + } + }, + "ignore_above": 1024, + "type": "keyword" + }, + "roles": { + "ignore_above": 1024, + "type": "keyword" + } + } + }, "domain": { "ignore_above": 1024, "type": "keyword" }, + "effective": { + "properties": { + "domain": { + "ignore_above": 1024, + "type": "keyword" + }, + "email": { + "ignore_above": 1024, + "type": "keyword" + }, + "full_name": { + "fields": { + "text": { + "norms": false, + "type": "text" + } + }, + "ignore_above": 1024, + "type": "keyword" + }, + "group": { + "properties": { + "domain": { + "ignore_above": 1024, + "type": "keyword" + }, + "id": { + "ignore_above": 1024, + "type": "keyword" + }, + "name": { + "ignore_above": 1024, + "type": "keyword" + } + } + }, + "hash": { + "ignore_above": 1024, + "type": "keyword" + }, + "id": { + "ignore_above": 1024, + "type": "keyword" + }, + "name": { + "fields": { + "text": { + "norms": false, + "type": "text" + } + }, + "ignore_above": 1024, + "type": "keyword" + }, + "roles": { + "ignore_above": 1024, + "type": "keyword" + } + } + }, "email": { "ignore_above": 1024, "type": "keyword" @@ -2901,6 +3405,70 @@ }, "ignore_above": 1024, "type": "keyword" + }, + "roles": { + "ignore_above": 1024, + "type": "keyword" + }, + "target": { + "properties": { + "domain": { + "ignore_above": 1024, + "type": "keyword" + }, + "email": { + "ignore_above": 1024, + "type": "keyword" + }, + "full_name": { + "fields": { + "text": { + "norms": false, + "type": "text" + } + }, + "ignore_above": 1024, + "type": "keyword" + }, + "group": { + "properties": { + "domain": { + "ignore_above": 1024, + "type": "keyword" + }, + "id": { + "ignore_above": 1024, + "type": "keyword" + }, + "name": { + "ignore_above": 1024, + "type": "keyword" + } + } + }, + "hash": { + "ignore_above": 1024, + "type": "keyword" + }, + "id": { + "ignore_above": 1024, + "type": "keyword" + }, + "name": { + "fields": { + "text": { + "norms": false, + "type": "text" + } + }, + "ignore_above": 1024, + "type": "keyword" + }, + "roles": { + "ignore_above": 1024, + "type": "keyword" + } + } } } }, @@ -2962,6 +3530,10 @@ "ignore_above": 1024, "type": "keyword" }, + "type": { + "ignore_above": 1024, + "type": "keyword" + }, "version": { "ignore_above": 1024, "type": "keyword" @@ -2974,18 +3546,6 @@ } } }, - "vlan": { - "properties": { - "id": { - "ignore_above": 1024, - "type": "keyword" - }, - "name": { - "ignore_above": 1024, - "type": "keyword" - } - } - }, "vulnerability": { "properties": { "category": { diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/routes/index/get_signals_template.test.ts b/x-pack/plugins/security_solution/server/lib/detection_engine/routes/index/get_signals_template.test.ts index 7139734f6f82f..9c39ad4ee3598 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/routes/index/get_signals_template.test.ts +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/routes/index/get_signals_template.test.ts @@ -42,4 +42,9 @@ describe('get_signals_template', () => { const template = getSignalsTemplate('test-index'); expect(template.settings.mapping.total_fields.limit).toBeGreaterThanOrEqual(10000); }); + + test('it should match snapshot', () => { + const template = getSignalsTemplate('test-index'); + expect(template).toMatchSnapshot(); + }); }); diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/routes/index/get_signals_template.ts b/x-pack/plugins/security_solution/server/lib/detection_engine/routes/index/get_signals_template.ts index 326d5777543be..0318218ed5900 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/routes/index/get_signals_template.ts +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/routes/index/get_signals_template.ts @@ -7,6 +7,7 @@ import signalsMapping from './signals_mapping.json'; import ecsMapping from './ecs_mapping.json'; +import otherMapping from './other_mappings.json'; /** @constant @@ -21,7 +22,7 @@ import ecsMapping from './ecs_mapping.json'; incremented by 10 in order to add "room" for the aforementioned patch release */ -export const SIGNALS_TEMPLATE_VERSION = 26; +export const SIGNALS_TEMPLATE_VERSION = 35; export const MIN_EQL_RULE_INDEX_VERSION = 2; export const getSignalsTemplate = (index: string) => { @@ -41,18 +42,19 @@ export const getSignalsTemplate = (index: string) => { }, index_patterns: [`${index}-*`], mappings: { - ...ecsMapping.mappings, + dynamic: false, properties: { ...ecsMapping.mappings.properties, + ...otherMapping.mappings.properties, signal: signalsMapping.mappings.properties.signal, threat: { ...ecsMapping.mappings.properties.threat, properties: { ...ecsMapping.mappings.properties.threat.properties, indicator: { - ...ecsMapping.mappings.properties.threat.properties.indicator, + ...otherMapping.mappings.properties.threat.properties.indicator, properties: { - ...ecsMapping.mappings.properties.threat.properties.indicator.properties, + ...otherMapping.mappings.properties.threat.properties.indicator.properties, event: ecsMapping.mappings.properties.event, }, }, diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/routes/index/other_mappings.json b/x-pack/plugins/security_solution/server/lib/detection_engine/routes/index/other_mappings.json new file mode 100644 index 0000000000000..43bc1a548a6af --- /dev/null +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/routes/index/other_mappings.json @@ -0,0 +1,337 @@ +{ + "mappings": { + "properties": { + "as": { + "properties": { + "number": { + "type": "long" + }, + "organization": { + "properties": { + "name": { + "fields": { + "text": { + "norms": false, + "type": "text" + } + }, + "ignore_above": 1024, + "type": "keyword" + } + } + } + } + }, + "code_signature": { + "properties": { + "exists": { + "type": "boolean" + }, + "status": { + "ignore_above": 1024, + "type": "keyword" + }, + "subject_name": { + "ignore_above": 1024, + "type": "keyword" + }, + "trusted": { + "type": "boolean" + }, + "valid": { + "type": "boolean" + } + } + }, + "geo": { + "properties": { + "city_name": { + "ignore_above": 1024, + "type": "keyword" + }, + "continent_name": { + "ignore_above": 1024, + "type": "keyword" + }, + "country_iso_code": { + "ignore_above": 1024, + "type": "keyword" + }, + "country_name": { + "ignore_above": 1024, + "type": "keyword" + }, + "location": { + "type": "geo_point" + }, + "name": { + "ignore_above": 1024, + "type": "keyword" + }, + "region_iso_code": { + "ignore_above": 1024, + "type": "keyword" + }, + "region_name": { + "ignore_above": 1024, + "type": "keyword" + } + } + }, + "hash": { + "properties": { + "md5": { + "ignore_above": 1024, + "type": "keyword" + }, + "sha1": { + "ignore_above": 1024, + "type": "keyword" + }, + "sha256": { + "ignore_above": 1024, + "type": "keyword" + }, + "sha512": { + "ignore_above": 1024, + "type": "keyword" + } + } + }, + "interface": { + "properties": { + "alias": { + "ignore_above": 1024, + "type": "keyword" + }, + "id": { + "ignore_above": 1024, + "type": "keyword" + }, + "name": { + "ignore_above": 1024, + "type": "keyword" + } + } + }, + "os": { + "properties": { + "family": { + "ignore_above": 1024, + "type": "keyword" + }, + "full": { + "fields": { + "text": { + "norms": false, + "type": "text" + } + }, + "ignore_above": 1024, + "type": "keyword" + }, + "kernel": { + "ignore_above": 1024, + "type": "keyword" + }, + "name": { + "fields": { + "text": { + "norms": false, + "type": "text" + } + }, + "ignore_above": 1024, + "type": "keyword" + }, + "platform": { + "ignore_above": 1024, + "type": "keyword" + }, + "version": { + "ignore_above": 1024, + "type": "keyword" + } + } + }, + "pe": { + "properties": { + "company": { + "ignore_above": 1024, + "type": "keyword" + }, + "description": { + "ignore_above": 1024, + "type": "keyword" + }, + "file_version": { + "ignore_above": 1024, + "type": "keyword" + }, + "original_file_name": { + "ignore_above": 1024, + "type": "keyword" + }, + "product": { + "ignore_above": 1024, + "type": "keyword" + } + } + }, + "threat": { + "properties": { + "indicator": { + "type": "nested", + "properties": { + "as": { + "properties": { + "number": { + "type": "long" + }, + "organization": { + "properties": { + "name": { + "fields": { + "text": { + "norms": false, + "type": "text" + } + }, + "ignore_above": 1024, + "type": "keyword" + } + } + } + } + }, + "confidence": { + "ignore_above": 1024, + "type": "keyword" + }, + "dataset": { + "ignore_above": 1024, + "type": "keyword" + }, + "description": { + "type": "wildcard" + }, + "domain": { + "ignore_above": 1024, + "type": "keyword" + }, + "email": { + "properties": { + "address": { + "ignore_above": 1024, + "type": "keyword" + } + } + }, + "first_seen": { + "type": "date" + }, + "geo": { + "properties": { + "city_name": { + "ignore_above": 1024, + "type": "keyword" + }, + "continent_name": { + "ignore_above": 1024, + "type": "keyword" + }, + "country_iso_code": { + "ignore_above": 1024, + "type": "keyword" + }, + "country_name": { + "ignore_above": 1024, + "type": "keyword" + }, + "location": { + "type": "geo_point" + }, + "name": { + "ignore_above": 1024, + "type": "keyword" + }, + "region_iso_code": { + "ignore_above": 1024, + "type": "keyword" + }, + "region_name": { + "ignore_above": 1024, + "type": "keyword" + } + } + }, + "ip": { + "type": "ip" + }, + "last_seen": { + "type": "date" + }, + "marking": { + "properties": { + "tlp": { + "ignore_above": 1024, + "type": "keyword" + } + } + }, + "matched": { + "properties": { + "atomic": { + "ignore_above": 1024, + "type": "keyword" + }, + "field": { + "ignore_above": 1024, + "type": "keyword" + }, + "type": { + "ignore_above": 1024, + "type": "keyword" + } + } + }, + "module": { + "ignore_above": 1024, + "type": "keyword" + }, + "port": { + "type": "long" + }, + "provider": { + "ignore_above": 1024, + "type": "keyword" + }, + "scanner_stats": { + "type": "long" + }, + "sightings": { + "type": "long" + }, + "type": { + "ignore_above": 1024, + "type": "keyword" + } + } + } + } + }, + "vlan": { + "properties": { + "id": { + "ignore_above": 1024, + "type": "keyword" + }, + "name": { + "ignore_above": 1024, + "type": "keyword" + } + } + } + } + } +} diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/scripts/timelines/delete_timeline_by_timeline_id.sh b/x-pack/plugins/security_solution/server/lib/detection_engine/scripts/timelines/delete_timeline_by_timeline_id.sh index 6271fd69cca5e..844ff61c4cd89 100755 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/scripts/timelines/delete_timeline_by_timeline_id.sh +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/scripts/timelines/delete_timeline_by_timeline_id.sh @@ -17,6 +17,6 @@ curl -s -k \ -H "Content-Type: application/json" \ -H 'kbn-xsrf: 123' \ -u ${ELASTICSEARCH_USERNAME}:${ELASTICSEARCH_PASSWORD} \ - -X POST "${KIBANA_URL}${SPACE_URL}/api/solutions/security/graphql" \ - -d '{"operationName":"DeleteTimelineMutation","variables":{"id":["'$1'"]},"query":"mutation DeleteTimelineMutation($id: [ID!]!) {\n deleteTimeline(id: $id)\n}\n"}' + -X DELETE "${KIBANA_URL}${SPACE_URL}/api/timeline" \ + -d '{"savedObjectIds": ["'$1'"]}' diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/scripts/timelines/find_timeline_by_filter.sh b/x-pack/plugins/security_solution/server/lib/detection_engine/scripts/timelines/find_timeline_by_filter.sh index 721f3d888727e..d3b67120772f4 100755 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/scripts/timelines/find_timeline_by_filter.sh +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/scripts/timelines/find_timeline_by_filter.sh @@ -15,7 +15,7 @@ STATUS=${1:-active} TIMELINE_TYPE=${2:-default} # Example get all timelines: -# sh ./timelines/find_timeline_by_filter.sh active +# sh ./timelines/find_timeline_by_filter.sh active default # Example get all prepackaged timeline templates: # ./timelines/find_timeline_by_filter.sh immutable template @@ -27,8 +27,7 @@ curl -s -k \ -H "Content-Type: application/json" \ -H 'kbn-xsrf: 123' \ -u ${ELASTICSEARCH_USERNAME}:${ELASTICSEARCH_PASSWORD} \ - -X POST "${KIBANA_URL}${SPACE_URL}/api/solutions/security/graphql" \ - -d '{"operationName":"GetAllTimeline","variables":{"onlyUserFavorite":false,"pageInfo":{"pageIndex":1,"pageSize":10},"search":"","sort":{"sortField":"updated","sortOrder":"desc"},"status":"'$STATUS'","timelineType":"'$TIMELINE_TYPE'"},"query":"query GetAllTimeline($pageInfo: PageInfoTimeline!, $search: String, $sort: SortTimeline, $onlyUserFavorite: Boolean, $timelineType: TimelineType, $status: TimelineStatus) {\n getAllTimeline(pageInfo: $pageInfo, search: $search, sort: $sort, onlyUserFavorite: $onlyUserFavorite, timelineType: $timelineType, status: $status) {\n totalCount\n defaultTimelineCount\n templateTimelineCount\n elasticTemplateTimelineCount\n customTemplateTimelineCount\n favoriteCount\n timeline {\n savedObjectId\n description\n favorite {\n fullName\n userName\n favoriteDate\n __typename\n }\n eventIdToNoteIds {\n eventId\n note\n timelineId\n noteId\n created\n createdBy\n timelineVersion\n updated\n updatedBy\n version\n __typename\n }\n notes {\n eventId\n note\n timelineId\n timelineVersion\n noteId\n created\n createdBy\n updated\n updatedBy\n version\n __typename\n }\n noteIds\n pinnedEventIds\n status\n title\n timelineType\n templateTimelineId\n templateTimelineVersion\n created\n createdBy\n updated\n updatedBy\n version\n __typename\n }\n __typename\n }\n}\n"}' \ + -X GET "${KIBANA_URL}${SPACE_URL}/api/timelines?only_user_favorite=false&status=$STATUS&timeline_type=$TIMELINE_TYPE" \ | jq . diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/scripts/timelines/get_all_timelines.sh b/x-pack/plugins/security_solution/server/lib/detection_engine/scripts/timelines/get_all_timelines.sh index fdf3488ab7c9d..d07f47db6b3a4 100755 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/scripts/timelines/get_all_timelines.sh +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/scripts/timelines/get_all_timelines.sh @@ -16,5 +16,5 @@ curl -s -k \ -H "Content-Type: application/json" \ -H 'kbn-xsrf: 123' \ -u ${ELASTICSEARCH_USERNAME}:${ELASTICSEARCH_PASSWORD} \ - -X GET "${KIBANA_URL}${SPACE_URL}/api/timeline" \ + -X GET "${KIBANA_URL}${SPACE_URL}/api/timelines" \ | jq . diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/signals/__mocks__/es_results.ts b/x-pack/plugins/security_solution/server/lib/detection_engine/signals/__mocks__/es_results.ts index 2ef72c22bbecf..1590a4f0fbb04 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/signals/__mocks__/es_results.ts +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/signals/__mocks__/es_results.ts @@ -115,6 +115,7 @@ export const sampleDocNoSortIdNoVersion = (someUuid: string = sampleIdGuid): Sig export const sampleDocWithSortId = ( someUuid: string = sampleIdGuid, + sortIds: string[] = ['1234567891111', '2233447556677'], ip?: string | string[], destIp?: string | string[] ): SignalSourceHit => ({ @@ -139,7 +140,7 @@ export const sampleDocWithSortId = ( 'source.ip': ip ? (Array.isArray(ip) ? ip : [ip]) : ['127.0.0.1'], 'destination.ip': destIp ? (Array.isArray(destIp) ? destIp : [destIp]) : ['127.0.0.1'], }, - sort: ['1234567891111'], + sort: sortIds, }); export const sampleDocNoSortId = ( @@ -630,7 +631,8 @@ export const repeatedSearchResultsWithSortId = ( pageSize: number, guids: string[], ips?: Array, - destIps?: Array + destIps?: Array, + sortIds?: string[] ): SignalSearchResponse => ({ took: 10, timed_out: false, @@ -646,6 +648,7 @@ export const repeatedSearchResultsWithSortId = ( hits: Array.from({ length: pageSize }).map((x, index) => ({ ...sampleDocWithSortId( guids[index], + sortIds, ips ? ips[index] : '127.0.0.1', destIps ? destIps[index] : '127.0.0.1' ), diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/signals/build_events_query.test.ts b/x-pack/plugins/security_solution/server/lib/detection_engine/signals/build_events_query.test.ts index 4b74f865c6a53..3f4a17dc091ab 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/signals/build_events_query.test.ts +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/signals/build_events_query.test.ts @@ -15,9 +15,8 @@ describe('create_signals', () => { to: 'today', filter: {}, size: 100, - searchAfterSortId: undefined, + searchAfterSortIds: undefined, timestampOverride: undefined, - excludeDocsWithTimestampOverride: false, }); expect(query).toEqual({ allow_no_indices: true, @@ -39,12 +38,19 @@ describe('create_signals', () => { bool: { filter: [ { - range: { - '@timestamp': { - gte: 'now-5m', - lte: 'today', - format: 'strict_date_optional_time', - }, + bool: { + minimum_should_match: 1, + should: [ + { + range: { + '@timestamp': { + gte: 'now-5m', + lte: 'today', + format: 'strict_date_optional_time', + }, + }, + }, + ], }, }, ], @@ -73,16 +79,16 @@ describe('create_signals', () => { }, }); }); - test('if searchAfterSortId is an empty string it should not be included', () => { + + test('it builds a now-5m up to today filter with timestampOverride', () => { const query = buildEventsSearchQuery({ index: ['auditbeat-*'], from: 'now-5m', to: 'today', filter: {}, size: 100, - searchAfterSortId: '', - timestampOverride: undefined, - excludeDocsWithTimestampOverride: false, + searchAfterSortIds: undefined, + timestampOverride: 'event.ingested', }); expect(query).toEqual({ allow_no_indices: true, @@ -91,6 +97,10 @@ describe('create_signals', () => { ignore_unavailable: true, body: { docvalue_fields: [ + { + field: 'event.ingested', + format: 'strict_date_optional_time', + }, { field: '@timestamp', format: 'strict_date_optional_time', @@ -104,12 +114,43 @@ describe('create_signals', () => { bool: { filter: [ { - range: { - '@timestamp': { - gte: 'now-5m', - lte: 'today', - format: 'strict_date_optional_time', - }, + bool: { + should: [ + { + range: { + 'event.ingested': { + gte: 'now-5m', + lte: 'today', + format: 'strict_date_optional_time', + }, + }, + }, + { + bool: { + filter: [ + { + range: { + '@timestamp': { + gte: 'now-5m', + lte: 'today', + format: 'strict_date_optional_time', + }, + }, + }, + { + bool: { + must_not: { + exists: { + field: 'event.ingested', + }, + }, + }, + }, + ], + }, + }, + ], + minimum_should_match: 1, }, }, ], @@ -128,6 +169,12 @@ describe('create_signals', () => { }, ], sort: [ + { + 'event.ingested': { + order: 'asc', + unmapped_type: 'date', + }, + }, { '@timestamp': { order: 'asc', @@ -138,7 +185,8 @@ describe('create_signals', () => { }, }); }); - test('if searchAfterSortId is a valid sortId string', () => { + + test('if searchAfterSortIds is a valid sortId string', () => { const fakeSortId = '123456789012'; const query = buildEventsSearchQuery({ index: ['auditbeat-*'], @@ -146,9 +194,8 @@ describe('create_signals', () => { to: 'today', filter: {}, size: 100, - searchAfterSortId: fakeSortId, + searchAfterSortIds: [fakeSortId], timestampOverride: undefined, - excludeDocsWithTimestampOverride: false, }); expect(query).toEqual({ allow_no_indices: true, @@ -170,12 +217,19 @@ describe('create_signals', () => { bool: { filter: [ { - range: { - '@timestamp': { - gte: 'now-5m', - lte: 'today', - format: 'strict_date_optional_time', - }, + bool: { + minimum_should_match: 1, + should: [ + { + range: { + '@timestamp': { + gte: 'now-5m', + lte: 'today', + format: 'strict_date_optional_time', + }, + }, + }, + ], }, }, ], @@ -205,7 +259,7 @@ describe('create_signals', () => { }, }); }); - test('if searchAfterSortId is a valid sortId number', () => { + test('if searchAfterSortIds is a valid sortId number', () => { const fakeSortIdNumber = 123456789012; const query = buildEventsSearchQuery({ index: ['auditbeat-*'], @@ -213,9 +267,8 @@ describe('create_signals', () => { to: 'today', filter: {}, size: 100, - searchAfterSortId: fakeSortIdNumber, + searchAfterSortIds: [fakeSortIdNumber], timestampOverride: undefined, - excludeDocsWithTimestampOverride: false, }); expect(query).toEqual({ allow_no_indices: true, @@ -237,12 +290,19 @@ describe('create_signals', () => { bool: { filter: [ { - range: { - '@timestamp': { - gte: 'now-5m', - lte: 'today', - format: 'strict_date_optional_time', - }, + bool: { + minimum_should_match: 1, + should: [ + { + range: { + '@timestamp': { + gte: 'now-5m', + lte: 'today', + format: 'strict_date_optional_time', + }, + }, + }, + ], }, }, ], @@ -279,9 +339,8 @@ describe('create_signals', () => { to: 'today', filter: {}, size: 100, - searchAfterSortId: undefined, + searchAfterSortIds: undefined, timestampOverride: undefined, - excludeDocsWithTimestampOverride: false, }); expect(query).toEqual({ allow_no_indices: true, @@ -303,12 +362,19 @@ describe('create_signals', () => { bool: { filter: [ { - range: { - '@timestamp': { - gte: 'now-5m', - lte: 'today', - format: 'strict_date_optional_time', - }, + bool: { + minimum_should_match: 1, + should: [ + { + range: { + '@timestamp': { + gte: 'now-5m', + lte: 'today', + format: 'strict_date_optional_time', + }, + }, + }, + ], }, }, ], @@ -352,9 +418,8 @@ describe('create_signals', () => { to: 'today', filter: {}, size: 100, - searchAfterSortId: undefined, + searchAfterSortIds: undefined, timestampOverride: undefined, - excludeDocsWithTimestampOverride: false, }); expect(query).toEqual({ allow_no_indices: true, @@ -371,12 +436,19 @@ describe('create_signals', () => { bool: { filter: [ { - range: { - '@timestamp': { - gte: 'now-5m', - lte: 'today', - format: 'strict_date_optional_time', - }, + bool: { + minimum_should_match: 1, + should: [ + { + range: { + '@timestamp': { + gte: 'now-5m', + lte: 'today', + format: 'strict_date_optional_time', + }, + }, + }, + ], }, }, ], diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/signals/build_events_query.ts b/x-pack/plugins/security_solution/server/lib/detection_engine/signals/build_events_query.ts index e086c862262c1..86fb51e4785ad 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/signals/build_events_query.ts +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/signals/build_events_query.ts @@ -5,6 +5,8 @@ * 2.0. */ import type { estypes } from '@elastic/elasticsearch'; +import { SortResults } from '@elastic/elasticsearch/api/types'; +import { isEmpty } from 'lodash'; import { SortOrderOrUndefined, TimestampOverrideOrUndefined, @@ -18,9 +20,8 @@ interface BuildEventsSearchQuery { filter?: estypes.QueryContainer; size: number; sortOrder?: SortOrderOrUndefined; - searchAfterSortId: string | number | undefined; + searchAfterSortIds: SortResults | undefined; timestampOverride: TimestampOverrideOrUndefined; - excludeDocsWithTimestampOverride: boolean; } export const buildEventsSearchQuery = ({ @@ -30,10 +31,9 @@ export const buildEventsSearchQuery = ({ to, filter, size, - searchAfterSortId, + searchAfterSortIds, sortOrder, timestampOverride, - excludeDocsWithTimestampOverride, }: BuildEventsSearchQuery) => { const defaultTimeFields = ['@timestamp']; const timestamps = @@ -43,36 +43,62 @@ export const buildEventsSearchQuery = ({ format: 'strict_date_optional_time', })); - const sortField = - timestampOverride != null && !excludeDocsWithTimestampOverride - ? timestampOverride - : '@timestamp'; + const rangeFilter: estypes.QueryContainer[] = + timestampOverride != null + ? [ + { + range: { + [timestampOverride]: { + lte: to, + gte: from, + format: 'strict_date_optional_time', + }, + }, + }, + { + bool: { + filter: [ + { + range: { + '@timestamp': { + lte: to, + gte: from, + // @ts-expect-error + format: 'strict_date_optional_time', + }, + }, + }, + { + bool: { + must_not: { + exists: { + field: timestampOverride, + }, + }, + }, + }, + ], + }, + }, + ] + : [ + { + range: { + '@timestamp': { + lte: to, + gte: from, + format: 'strict_date_optional_time', + }, + }, + }, + ]; - const rangeFilter: estypes.QueryContainer[] = [ - { - range: { - [sortField]: { - lte: to, - gte: from, - format: 'strict_date_optional_time', - }, - }, - }, + const filterWithTime: estypes.QueryContainer[] = [ + // but tests contain undefined, so I suppose it's desired behaviour + // @ts-expect-error undefined in not assignable to QueryContainer + filter, + { bool: { filter: [{ bool: { should: [...rangeFilter], minimum_should_match: 1 } }] } }, ]; - if (excludeDocsWithTimestampOverride) { - rangeFilter.push({ - bool: { - must_not: { - exists: { - field: timestampOverride, - }, - }, - }, - }); - } - // @ts-expect-error undefined in not assignable to QueryContainer - // but tests contain undefined, so I suppose it's desired behaviour - const filterWithTime: estypes.QueryContainer[] = [filter, { bool: { filter: rangeFilter } }]; const searchQuery = { allow_no_indices: true, @@ -99,22 +125,39 @@ export const buildEventsSearchQuery = ({ ], ...(aggregations ? { aggregations } : {}), sort: [ - { - [sortField]: { - order: sortOrder ?? 'asc', - unmapped_type: 'date', - }, - }, + ...(timestampOverride != null + ? [ + { + [timestampOverride]: { + order: sortOrder ?? 'asc', + unmapped_type: 'date', + }, + }, + { + '@timestamp': { + order: sortOrder ?? 'asc', + unmapped_type: 'date', + }, + }, + ] + : [ + { + '@timestamp': { + order: sortOrder ?? 'asc', + unmapped_type: 'date', + }, + }, + ]), ], }, }; - if (searchAfterSortId) { + if (searchAfterSortIds != null && !isEmpty(searchAfterSortIds)) { return { ...searchQuery, body: { ...searchQuery.body, - search_after: [searchAfterSortId], + search_after: searchAfterSortIds, }, }; } diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/signals/filters/create_field_and_set_tuples.test.ts b/x-pack/plugins/security_solution/server/lib/detection_engine/signals/filters/create_field_and_set_tuples.test.ts index aac0f47c28295..3fa5d1178b3ec 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/signals/filters/create_field_and_set_tuples.test.ts +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/signals/filters/create_field_and_set_tuples.test.ts @@ -17,7 +17,7 @@ import { buildRuleMessageMock as buildRuleMessage } from '../rule_messages.mock' describe('filterEventsAgainstList', () => { let listClient = listMock.getListClient(); let exceptionItem = getExceptionListItemSchemaMock(); - let events = [sampleDocWithSortId('123', '1.1.1.1')]; + let events = [sampleDocWithSortId('123', undefined, '1.1.1.1')]; beforeEach(() => { jest.clearAllMocks(); @@ -44,7 +44,7 @@ describe('filterEventsAgainstList', () => { }, ], }; - events = [sampleDocWithSortId('123', '1.1.1.1')]; + events = [sampleDocWithSortId('123', undefined, '1.1.1.1')]; }); afterEach(() => { @@ -111,7 +111,7 @@ describe('filterEventsAgainstList', () => { }); test('it returns a single matched set as a JSON.stringify() set from the "events"', async () => { - events = [sampleDocWithSortId('123', '1.1.1.1')]; + events = [sampleDocWithSortId('123', undefined, '1.1.1.1')]; (exceptionItem.entries[0] as EntryList).field = 'source.ip'; const [{ matchedSet }] = await createFieldAndSetTuples({ listClient, @@ -124,7 +124,10 @@ describe('filterEventsAgainstList', () => { }); test('it returns two matched sets as a JSON.stringify() set from the "events"', async () => { - events = [sampleDocWithSortId('123', '1.1.1.1'), sampleDocWithSortId('456', '2.2.2.2')]; + events = [ + sampleDocWithSortId('123', undefined, '1.1.1.1'), + sampleDocWithSortId('456', undefined, '2.2.2.2'), + ]; (exceptionItem.entries[0] as EntryList).field = 'source.ip'; const [{ matchedSet }] = await createFieldAndSetTuples({ listClient, @@ -137,7 +140,7 @@ describe('filterEventsAgainstList', () => { }); test('it returns an array as a set as a JSON.stringify() array from the "events"', async () => { - events = [sampleDocWithSortId('123', ['1.1.1.1', '2.2.2.2'])]; + events = [sampleDocWithSortId('123', undefined, ['1.1.1.1', '2.2.2.2'])]; (exceptionItem.entries[0] as EntryList).field = 'source.ip'; const [{ matchedSet }] = await createFieldAndSetTuples({ listClient, @@ -150,7 +153,10 @@ describe('filterEventsAgainstList', () => { }); test('it returns 2 fields when given two exception list items', async () => { - events = [sampleDocWithSortId('123', '1.1.1.1'), sampleDocWithSortId('456', '2.2.2.2')]; + events = [ + sampleDocWithSortId('123', undefined, '1.1.1.1'), + sampleDocWithSortId('456', undefined, '2.2.2.2'), + ]; exceptionItem.entries = [ { field: 'source.ip', @@ -182,7 +188,10 @@ describe('filterEventsAgainstList', () => { }); test('it returns two matched sets from two different events, one excluded, and one included', async () => { - events = [sampleDocWithSortId('123', '1.1.1.1'), sampleDocWithSortId('456', '2.2.2.2')]; + events = [ + sampleDocWithSortId('123', undefined, '1.1.1.1'), + sampleDocWithSortId('456', undefined, '2.2.2.2'), + ]; exceptionItem.entries = [ { field: 'source.ip', @@ -215,7 +224,10 @@ describe('filterEventsAgainstList', () => { }); test('it returns two fields from two different events', async () => { - events = [sampleDocWithSortId('123', '1.1.1.1'), sampleDocWithSortId('456', '2.2.2.2')]; + events = [ + sampleDocWithSortId('123', undefined, '1.1.1.1'), + sampleDocWithSortId('456', undefined, '2.2.2.2'), + ]; exceptionItem.entries = [ { field: 'source.ip', @@ -249,8 +261,8 @@ describe('filterEventsAgainstList', () => { test('it returns two matches from two different events', async () => { events = [ - sampleDocWithSortId('123', '1.1.1.1', '3.3.3.3'), - sampleDocWithSortId('456', '2.2.2.2', '5.5.5.5'), + sampleDocWithSortId('123', undefined, '1.1.1.1', '3.3.3.3'), + sampleDocWithSortId('456', undefined, '2.2.2.2', '5.5.5.5'), ]; exceptionItem.entries = [ { diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/signals/filters/create_set_to_filter_against.test.ts b/x-pack/plugins/security_solution/server/lib/detection_engine/signals/filters/create_set_to_filter_against.test.ts index aae4a7aae2b9e..743218f9ed940 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/signals/filters/create_set_to_filter_against.test.ts +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/signals/filters/create_set_to_filter_against.test.ts @@ -14,7 +14,7 @@ import { buildRuleMessageMock as buildRuleMessage } from '../rule_messages.mock' describe('createSetToFilterAgainst', () => { let listClient = listMock.getListClient(); - let events = [sampleDocWithSortId('123', '1.1.1.1')]; + let events = [sampleDocWithSortId('123', undefined, '1.1.1.1')]; beforeEach(() => { jest.clearAllMocks(); @@ -27,7 +27,7 @@ describe('createSetToFilterAgainst', () => { })) ) ); - events = [sampleDocWithSortId('123', '1.1.1.1')]; + events = [sampleDocWithSortId('123', undefined, '1.1.1.1')]; }); afterEach(() => { @@ -49,7 +49,7 @@ describe('createSetToFilterAgainst', () => { }); test('it returns 1 field if the list returns a single item', async () => { - events = [sampleDocWithSortId('123', '1.1.1.1')]; + events = [sampleDocWithSortId('123', undefined, '1.1.1.1')]; const field = await createSetToFilterAgainst({ events, field: 'source.ip', @@ -68,7 +68,10 @@ describe('createSetToFilterAgainst', () => { }); test('it returns 2 fields if the list returns 2 items', async () => { - events = [sampleDocWithSortId('123', '1.1.1.1'), sampleDocWithSortId('123', '2.2.2.2')]; + events = [ + sampleDocWithSortId('123', undefined, '1.1.1.1'), + sampleDocWithSortId('123', undefined, '2.2.2.2'), + ]; const field = await createSetToFilterAgainst({ events, field: 'source.ip', @@ -87,7 +90,10 @@ describe('createSetToFilterAgainst', () => { }); test('it returns 0 fields if the field does not match up to a valid field within the event', async () => { - events = [sampleDocWithSortId('123', '1.1.1.1'), sampleDocWithSortId('123', '2.2.2.2')]; + events = [ + sampleDocWithSortId('123', undefined, '1.1.1.1'), + sampleDocWithSortId('123', undefined, '2.2.2.2'), + ]; const field = await createSetToFilterAgainst({ events, field: 'nonexistent.field', // field does not exist diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/signals/filters/filter_events.test.ts b/x-pack/plugins/security_solution/server/lib/detection_engine/signals/filters/filter_events.test.ts index eb5c69e8abfe8..45a058b55d84b 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/signals/filters/filter_events.test.ts +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/signals/filters/filter_events.test.ts @@ -14,7 +14,7 @@ import { FieldSet } from './types'; describe('filterEvents', () => { let listClient = listMock.getListClient(); - let events = [sampleDocWithSortId('123', '1.1.1.1')]; + let events = [sampleDocWithSortId('123', undefined, '1.1.1.1')]; beforeEach(() => { jest.clearAllMocks(); @@ -27,7 +27,7 @@ describe('filterEvents', () => { })) ) ); - events = [sampleDocWithSortId('123', '1.1.1.1')]; + events = [sampleDocWithSortId('123', undefined, '1.1.1.1')]; }); afterEach(() => { @@ -35,7 +35,7 @@ describe('filterEvents', () => { }); test('it filters out the event if it is "included"', () => { - events = [sampleDocWithSortId('123', '1.1.1.1')]; + events = [sampleDocWithSortId('123', undefined, '1.1.1.1')]; const fieldAndSetTuples: FieldSet[] = [ { field: 'source.ip', @@ -51,7 +51,7 @@ describe('filterEvents', () => { }); test('it does not filter out the event if it is "excluded"', () => { - events = [sampleDocWithSortId('123', '1.1.1.1')]; + events = [sampleDocWithSortId('123', undefined, '1.1.1.1')]; const fieldAndSetTuples: FieldSet[] = [ { field: 'source.ip', @@ -67,7 +67,7 @@ describe('filterEvents', () => { }); test('it does NOT filter out the event if the field is not found', () => { - events = [sampleDocWithSortId('123', '1.1.1.1')]; + events = [sampleDocWithSortId('123', undefined, '1.1.1.1')]; const fieldAndSetTuples: FieldSet[] = [ { field: 'madeup.nonexistent', // field does not exist @@ -83,7 +83,10 @@ describe('filterEvents', () => { }); test('it does NOT filter out the event if it is in both an inclusion and exclusion list', () => { - events = [sampleDocWithSortId('123', '1.1.1.1'), sampleDocWithSortId('123', '2.2.2.2')]; + events = [ + sampleDocWithSortId('123', undefined, '1.1.1.1'), + sampleDocWithSortId('123', undefined, '2.2.2.2'), + ]; const fieldAndSetTuples: FieldSet[] = [ { field: 'source.ip', diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/signals/search_after_bulk_create.test.ts b/x-pack/plugins/security_solution/server/lib/detection_engine/signals/search_after_bulk_create.test.ts index 9d9eefe844532..0c7723b6f4cc2 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/signals/search_after_bulk_create.test.ts +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/signals/search_after_bulk_create.test.ts @@ -426,6 +426,84 @@ describe('searchAfterAndBulkCreate', () => { expect(lastLookBackDate).toEqual(new Date('2020-04-20T21:27:45+0000')); }); + test('should return success when empty string sortId present', async () => { + mockService.scopedClusterClient.asCurrentUser.bulk.mockResolvedValueOnce( + elasticsearchClientMock.createSuccessTransportRequestPromise({ + took: 100, + errors: false, + items: [ + { + create: { + _id: someGuids[0], + _index: 'myfakeindex', + status: 201, + }, + }, + { + create: { + _id: someGuids[1], + _index: 'myfakeindex', + status: 201, + }, + }, + { + create: { + _id: someGuids[2], + _index: 'myfakeindex', + status: 201, + }, + }, + { + create: { + _id: someGuids[3], + _index: 'myfakeindex', + status: 201, + }, + }, + ], + }) + ); + mockService.scopedClusterClient.asCurrentUser.search + .mockResolvedValueOnce( + elasticsearchClientMock.createSuccessTransportRequestPromise( + repeatedSearchResultsWithSortId( + 4, + 4, + someGuids.slice(0, 3), + ['1.1.1.1', '2.2.2.2', '2.2.2.2', '2.2.2.2'], + // this is the case we are testing, if we receive an empty string for one of the sort ids. + ['', '2222222222222'] + ) + ) + ) + .mockResolvedValueOnce( + elasticsearchClientMock.createSuccessTransportRequestPromise( + sampleDocSearchResultsNoSortIdNoHits() + ) + ); + + const { success, createdSignalsCount, lastLookBackDate } = await searchAfterAndBulkCreate({ + ruleSO, + tuples, + listClient, + exceptionsList: [], + services: mockService, + logger: mockLogger, + eventsTelemetry: undefined, + id: sampleRuleGuid, + inputIndexPattern, + signalsIndex: DEFAULT_SIGNALS_INDEX, + pageSize: 1, + filter: undefined, + refresh: false, + buildRuleMessage, + }); + expect(success).toEqual(true); + expect(mockService.scopedClusterClient.asCurrentUser.search).toHaveBeenCalledTimes(2); + expect(createdSignalsCount).toEqual(4); + expect(lastLookBackDate).toEqual(new Date('2020-04-20T21:27:45+0000')); + }); + test('should return success when all search results are in the allowlist and no sortId present', async () => { const searchListItems: SearchListItemArraySchema = [ { ...getSearchListItemResponseMock(), value: ['1.1.1.1'] }, diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/signals/search_after_bulk_create.ts b/x-pack/plugins/security_solution/server/lib/detection_engine/signals/search_after_bulk_create.ts index 0bc0039b54dba..08f8abe384d0f 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/signals/search_after_bulk_create.ts +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/signals/search_after_bulk_create.ts @@ -5,9 +5,8 @@ * 2.0. */ -/* eslint-disable complexity */ - import { identity } from 'lodash'; +import { SortResults } from '@elastic/elasticsearch/api/types'; import { singleSearchAfter } from './single_search_after'; import { singleBulkCreate } from './single_bulk_create'; import { filterEventsAgainstList } from './filters/filter_events_against_list'; @@ -19,6 +18,7 @@ import { createTotalHitsFromSearchResult, mergeReturns, mergeSearchResults, + getSafeSortIds, } from './utils'; import { SearchAfterAndBulkCreateParams, SearchAfterAndBulkCreateReturnType } from './types'; @@ -44,10 +44,8 @@ export const searchAfterAndBulkCreate = async ({ let toReturn = createSearchAfterReturnType(); // sortId tells us where to start our next consecutive search_after query - let sortId: string | undefined; + let sortIds: SortResults | undefined; let hasSortId = true; // default to true so we execute the search on initial run - let backupSortId: string | undefined; - let hasBackupSortId = ruleParams.timestampOverride ? true : false; // signalsCreatedCount keeps track of how many signals we have created, // to ensure we don't exceed maxSignals @@ -69,60 +67,12 @@ export const searchAfterAndBulkCreate = async ({ while (signalsCreatedCount < tuple.maxSignals) { try { let mergedSearchResults = createSearchResultReturnType(); - logger.debug(buildRuleMessage(`sortIds: ${sortId}`)); - - // if there is a timestampOverride param we always want to do a secondary search against @timestamp - if (ruleParams.timestampOverride != null && hasBackupSortId) { - // only execute search if we have something to sort on or if it is the first search - const { - searchResult: searchResultB, - searchDuration: searchDurationB, - searchErrors: searchErrorsB, - } = await singleSearchAfter({ - buildRuleMessage, - searchAfterSortId: backupSortId, - index: inputIndexPattern, - from: tuple.from.toISOString(), - to: tuple.to.toISOString(), - services, - logger, - // @ts-expect-error please, declare a type explicitly instead of unknown - filter, - pageSize: Math.ceil(Math.min(tuple.maxSignals, pageSize)), - timestampOverride: ruleParams.timestampOverride, - excludeDocsWithTimestampOverride: true, - }); - - // call this function setSortIdOrExit() - const lastSortId = searchResultB?.hits?.hits[searchResultB.hits.hits.length - 1]?.sort; - if (lastSortId != null && lastSortId.length !== 0) { - // @ts-expect-error @elastic/elasticsearch SortResults contains null not assignable to backupSortId - backupSortId = lastSortId[0]; - hasBackupSortId = true; - } else { - logger.debug(buildRuleMessage('backupSortIds was empty on searchResultB')); - hasBackupSortId = false; - } - - mergedSearchResults = mergeSearchResults([mergedSearchResults, searchResultB]); - - toReturn = mergeReturns([ - toReturn, - createSearchAfterReturnTypeFromResponse({ - searchResult: mergedSearchResults, - timestampOverride: undefined, - }), - createSearchAfterReturnType({ - searchAfterTimes: [searchDurationB], - errors: searchErrorsB, - }), - ]); - } + logger.debug(buildRuleMessage(`sortIds: ${sortIds}`)); if (hasSortId) { const { searchResult, searchDuration, searchErrors } = await singleSearchAfter({ buildRuleMessage, - searchAfterSortId: sortId, + searchAfterSortIds: sortIds, index: inputIndexPattern, from: tuple.from.toISOString(), to: tuple.to.toISOString(), @@ -132,7 +82,6 @@ export const searchAfterAndBulkCreate = async ({ filter, pageSize: Math.ceil(Math.min(tuple.maxSignals, pageSize)), timestampOverride: ruleParams.timestampOverride, - excludeDocsWithTimestampOverride: false, }); mergedSearchResults = mergeSearchResults([mergedSearchResults, searchResult]); toReturn = mergeReturns([ @@ -147,10 +96,11 @@ export const searchAfterAndBulkCreate = async ({ }), ]); - const lastSortId = searchResult.hits.hits[searchResult.hits.hits.length - 1]?.sort; - if (lastSortId != null && lastSortId.length !== 0) { - // @ts-expect-error @elastic/elasticsearch SortResults contains null not assignable to sortId - sortId = lastSortId[0]; + const lastSortIds = getSafeSortIds( + searchResult.hits.hits[searchResult.hits.hits.length - 1]?.sort + ); + if (lastSortIds != null && lastSortIds.length !== 0) { + sortIds = lastSortIds; hasSortId = true; } else { hasSortId = false; @@ -236,7 +186,7 @@ export const searchAfterAndBulkCreate = async ({ sendAlertTelemetryEvents(logger, eventsTelemetry, filteredEvents, buildRuleMessage); } - if (!hasSortId && !hasBackupSortId) { + if (!hasSortId) { logger.debug(buildRuleMessage('ran out of sort ids to sort on')); break; } diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/signals/single_search_after.test.ts b/x-pack/plugins/security_solution/server/lib/detection_engine/signals/single_search_after.test.ts index cbffac6e7b455..a40459d312b9f 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/signals/single_search_after.test.ts +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/signals/single_search_after.test.ts @@ -34,7 +34,7 @@ describe('singleSearchAfter', () => { elasticsearchClientMock.createSuccessTransportRequestPromise(sampleDocSearchResultsNoSortId()) ); const { searchResult } = await singleSearchAfter({ - searchAfterSortId: undefined, + searchAfterSortIds: undefined, index: [], from: 'now-360s', to: 'now', @@ -44,7 +44,6 @@ describe('singleSearchAfter', () => { filter: undefined, timestampOverride: undefined, buildRuleMessage, - excludeDocsWithTimestampOverride: false, }); expect(searchResult).toEqual(sampleDocSearchResultsNoSortId()); }); @@ -53,7 +52,7 @@ describe('singleSearchAfter', () => { elasticsearchClientMock.createSuccessTransportRequestPromise(sampleDocSearchResultsNoSortId()) ); const { searchErrors } = await singleSearchAfter({ - searchAfterSortId: undefined, + searchAfterSortIds: undefined, index: [], from: 'now-360s', to: 'now', @@ -63,7 +62,6 @@ describe('singleSearchAfter', () => { filter: undefined, timestampOverride: undefined, buildRuleMessage, - excludeDocsWithTimestampOverride: false, }); expect(searchErrors).toEqual([]); }); @@ -104,7 +102,7 @@ describe('singleSearchAfter', () => { }) ); const { searchErrors } = await singleSearchAfter({ - searchAfterSortId: undefined, + searchAfterSortIds: undefined, index: [], from: 'now-360s', to: 'now', @@ -114,21 +112,20 @@ describe('singleSearchAfter', () => { filter: undefined, timestampOverride: undefined, buildRuleMessage, - excludeDocsWithTimestampOverride: false, }); expect(searchErrors).toEqual([ 'index: "index-123" reason: "some reason" type: "some type" caused by reason: "some reason" caused by type: "some type"', ]); }); test('if singleSearchAfter works with a given sort id', async () => { - const searchAfterSortId = '1234567891111'; + const searchAfterSortIds = ['1234567891111']; mockService.scopedClusterClient.asCurrentUser.search.mockResolvedValueOnce( elasticsearchClientMock.createSuccessTransportRequestPromise( sampleDocSearchResultsWithSortId() ) ); const { searchResult } = await singleSearchAfter({ - searchAfterSortId, + searchAfterSortIds, index: [], from: 'now-360s', to: 'now', @@ -138,18 +135,17 @@ describe('singleSearchAfter', () => { filter: undefined, timestampOverride: undefined, buildRuleMessage, - excludeDocsWithTimestampOverride: false, }); expect(searchResult).toEqual(sampleDocSearchResultsWithSortId()); }); test('if singleSearchAfter throws error', async () => { - const searchAfterSortId = '1234567891111'; + const searchAfterSortIds = ['1234567891111']; mockService.scopedClusterClient.asCurrentUser.search.mockResolvedValueOnce( elasticsearchClientMock.createErrorTransportRequestPromise(new Error('Fake Error')) ); await expect( singleSearchAfter({ - searchAfterSortId, + searchAfterSortIds, index: [], from: 'now-360s', to: 'now', @@ -159,7 +155,6 @@ describe('singleSearchAfter', () => { filter: undefined, timestampOverride: undefined, buildRuleMessage, - excludeDocsWithTimestampOverride: false, }) ).rejects.toThrow('Fake Error'); }); diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/signals/single_search_after.ts b/x-pack/plugins/security_solution/server/lib/detection_engine/signals/single_search_after.ts index 9dcec1861f15d..57ed05bcb27cf 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/signals/single_search_after.ts +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/signals/single_search_after.ts @@ -6,6 +6,7 @@ */ import type { estypes } from '@elastic/elasticsearch'; import { performance } from 'perf_hooks'; +import { SearchRequest, SortResults } from '@elastic/elasticsearch/api/types'; import { AlertInstanceContext, AlertInstanceState, @@ -23,7 +24,7 @@ import { interface SingleSearchAfterParams { aggregations?: Record; - searchAfterSortId: string | undefined; + searchAfterSortIds: SortResults | undefined; index: string[]; from: string; to: string; @@ -34,13 +35,12 @@ interface SingleSearchAfterParams { filter?: estypes.QueryContainer; timestampOverride: TimestampOverrideOrUndefined; buildRuleMessage: BuildRuleMessage; - excludeDocsWithTimestampOverride: boolean; } // utilize search_after for paging results into bulk. export const singleSearchAfter = async ({ aggregations, - searchAfterSortId, + searchAfterSortIds, index, from, to, @@ -51,7 +51,6 @@ export const singleSearchAfter = async ({ sortOrder, timestampOverride, buildRuleMessage, - excludeDocsWithTimestampOverride, }: SingleSearchAfterParams): Promise<{ searchResult: SignalSearchResponse; searchDuration: string; @@ -66,15 +65,16 @@ export const singleSearchAfter = async ({ filter, size: pageSize, sortOrder, - searchAfterSortId, + searchAfterSortIds, timestampOverride, - excludeDocsWithTimestampOverride, }); const start = performance.now(); const { body: nextSearchAfterResult, - } = await services.scopedClusterClient.asCurrentUser.search(searchAfterQuery); + } = await services.scopedClusterClient.asCurrentUser.search( + searchAfterQuery as SearchRequest + ); const end = performance.now(); const searchErrors = createErrorsFromShard({ errors: nextSearchAfterResult._shards.failures ?? [], diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/signals/threshold/find_previous_threshold_signals.ts b/x-pack/plugins/security_solution/server/lib/detection_engine/signals/threshold/find_previous_threshold_signals.ts index 06e718b646ffa..1a2bfbf3a962d 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/signals/threshold/find_previous_threshold_signals.ts +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/signals/threshold/find_previous_threshold_signals.ts @@ -71,7 +71,7 @@ export const findPreviousThresholdSignals = async ({ }; return singleSearchAfter({ - searchAfterSortId: undefined, + searchAfterSortIds: undefined, timestampOverride, index: indexPattern, from, @@ -81,6 +81,5 @@ export const findPreviousThresholdSignals = async ({ filter, pageSize: 10000, // TODO: multiple pages? buildRuleMessage, - excludeDocsWithTimestampOverride: false, }); }; diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/signals/threshold/find_threshold_signals.ts b/x-pack/plugins/security_solution/server/lib/detection_engine/signals/threshold/find_threshold_signals.ts index 33ffa5b71a65c..986393d6d3454 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/signals/threshold/find_threshold_signals.ts +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/signals/threshold/find_threshold_signals.ts @@ -141,6 +141,5 @@ export const findThresholdSignals = async ({ pageSize: 1, sortOrder: 'desc', buildRuleMessage, - excludeDocsWithTimestampOverride: false, }); }; diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/signals/utils.ts b/x-pack/plugins/security_solution/server/lib/detection_engine/signals/utils.ts index 54ed44956c8b3..bd37cf62c74b0 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/signals/utils.ts +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/signals/utils.ts @@ -13,6 +13,7 @@ import type { estypes } from '@elastic/elasticsearch'; import { isEmpty, partition } from 'lodash'; import { ApiResponse, Context } from '@elastic/elasticsearch/lib/Transport'; +import { SortResults } from '@elastic/elasticsearch/api/types'; import { TimestampOverrideOrUndefined, Privilege, @@ -846,3 +847,25 @@ export const isThreatParams = (params: RuleParams): params is ThreatRuleParams = params.type === 'threat_match'; export const isMachineLearningParams = (params: RuleParams): params is MachineLearningRuleParams => params.type === 'machine_learning'; + +/** + * Prevent javascript from returning Number.MAX_SAFE_INTEGER when Elasticsearch expects + * Java's Long.MAX_VALUE. This happens when sorting fields by date which are + * unmapped in the provided index + * + * Ref: https://github.com/elastic/elasticsearch/issues/28806#issuecomment-369303620 + * + * return stringified Long.MAX_VALUE if we receive Number.MAX_SAFE_INTEGER + * @param sortIds SortResults | undefined + * @returns SortResults + */ +export const getSafeSortIds = (sortIds: SortResults | undefined) => { + return sortIds?.map((sortId) => { + // haven't determined when we would receive a null value for a sort id + // but in case we do, default to sending the stringified Java max_int + if (sortId == null || sortId === '' || sortId >= Number.MAX_SAFE_INTEGER) { + return '9223372036854775807'; + } + return sortId; + }); +}; diff --git a/x-pack/plugins/security_solution/server/lib/framework/kibana_framework_adapter.ts b/x-pack/plugins/security_solution/server/lib/framework/kibana_framework_adapter.ts index 6306b26161b38..56c1c802fdd68 100644 --- a/x-pack/plugins/security_solution/server/lib/framework/kibana_framework_adapter.ts +++ b/x-pack/plugins/security_solution/server/lib/framework/kibana_framework_adapter.ts @@ -5,21 +5,10 @@ * 2.0. */ -import { GraphQLSchema } from 'graphql'; -import { runHttpQuery } from 'apollo-server-core'; -import { schema as configSchema } from '@kbn/config-schema'; -import type { - CoreSetup, - KibanaResponseFactory, - KibanaRequest, -} from '../../../../../../src/core/server'; +import type { KibanaRequest } from '../../../../../../src/core/server'; import { IndexPatternsFetcher, UI_SETTINGS } from '../../../../../../src/plugins/data/server'; import { AuthenticatedUser } from '../../../../security/common/model'; -import { SetupPlugins } from '../../plugin'; -import type { - SecuritySolutionRequestHandlerContext, - SecuritySolutionPluginRouter, -} from '../../types'; +import type { SecuritySolutionRequestHandlerContext } from '../../types'; import { FrameworkAdapter, @@ -27,17 +16,8 @@ import { FrameworkRequest, internalFrameworkRequest, } from './types'; -import { buildSiemResponse } from '../detection_engine/routes/utils'; export class KibanaBackendFrameworkAdapter implements FrameworkAdapter { - private router: SecuritySolutionPluginRouter; - private security: SetupPlugins['security']; - - constructor(core: CoreSetup, plugins: SetupPlugins) { - this.router = core.http.createRouter(); - this.security = plugins.security; - } - public async callWithRequest( req: FrameworkRequest, endpoint: string, @@ -60,67 +40,6 @@ export class KibanaBackendFrameworkAdapter implements FrameworkAdapter { }); } - public registerGraphQLEndpoint(routePath: string, schema: GraphQLSchema): void { - this.router.post( - { - path: routePath, - validate: { body: configSchema.object({}, { unknowns: 'allow' }) }, - options: { - tags: ['access:securitySolution'], - }, - }, - async (context, request, response) => { - try { - const user = await this.getCurrentUserInfo(request); - const gqlResponse = await runHttpQuery([request], { - method: 'POST', - options: (req: KibanaRequest) => ({ - context: { req: wrapRequest(req, context, user) }, - schema, - }), - query: request.body, - }); - - return response.ok({ - body: gqlResponse, - headers: { - 'content-type': 'application/json', - }, - }); - } catch (error) { - return this.handleError(error, response); - } - } - ); - } - - private async getCurrentUserInfo(request: KibanaRequest): Promise { - try { - const user = (await this.security?.authc.getCurrentUser(request)) ?? null; - return user; - } catch { - return null; - } - } - - // eslint-disable-next-line @typescript-eslint/no-explicit-any - private handleError(error: any, response: KibanaResponseFactory) { - const siemResponse = buildSiemResponse(response); - - if (error.name === 'HttpQueryError') { - return siemResponse.error({ - statusCode: error.statusCode, - headers: error.headers, - body: error.message, - }); - } - - return siemResponse.error({ - statusCode: 500, - body: error.message, - }); - } - public getIndexPatternsService(request: FrameworkRequest): FrameworkIndexPatternsService { return new IndexPatternsFetcher(request.context.core.elasticsearch.client.asCurrentUser, true); } diff --git a/x-pack/plugins/security_solution/server/lib/framework/types.ts b/x-pack/plugins/security_solution/server/lib/framework/types.ts index b3f55a7a0ffa2..6665468a27125 100644 --- a/x-pack/plugins/security_solution/server/lib/framework/types.ts +++ b/x-pack/plugins/security_solution/server/lib/framework/types.ts @@ -6,27 +6,23 @@ */ import { IndicesGetMappingParams } from 'elasticsearch'; -import { GraphQLSchema } from 'graphql'; import { KibanaRequest } from '../../../../../../src/core/server'; import { AuthenticatedUser } from '../../../../security/common/model'; import { ESQuery } from '../../../common/typed_json'; import type { SecuritySolutionRequestHandlerContext } from '../../types'; import { + DocValueFieldsInput, PaginationInput, PaginationInputPaginated, SortField, - SourceConfiguration, TimerangeInput, - DocValueFieldsInput, -} from '../../graphql/types'; - -export * from '../../utils/typed_resolvers'; +} from '../../../common/search_strategy'; +import { SourceConfiguration } from '../sources'; export const internalFrameworkRequest = Symbol('internalFrameworkRequest'); export interface FrameworkAdapter { - registerGraphQLEndpoint(routePath: string, schema: GraphQLSchema): void; callWithRequest( req: FrameworkRequest, method: 'search', diff --git a/x-pack/plugins/security_solution/server/lib/telemetry/sender.test.ts b/x-pack/plugins/security_solution/server/lib/telemetry/sender.test.ts index b32d2a6542f4a..f620027409d26 100644 --- a/x-pack/plugins/security_solution/server/lib/telemetry/sender.test.ts +++ b/x-pack/plugins/security_solution/server/lib/telemetry/sender.test.ts @@ -38,6 +38,7 @@ describe('TelemetryEventsSender', () => { id: 'X', name: 'Y', ruleset: 'Z', + version: '100', }, file: { size: 3, @@ -97,6 +98,7 @@ describe('TelemetryEventsSender', () => { id: 'X', name: 'Y', ruleset: 'Z', + version: '100', }, file: { size: 3, @@ -253,6 +255,57 @@ describe('allowlistEventFields', () => { }); }); + it('filters arrays of objects', () => { + const event = { + a: [ + { + a1: 'a1', + }, + ], + b: { + b1: 'b1', + }, + c: [ + { + d: 'd1', + e: 'e1', + f: 'f1', + }, + { + d: 'd2', + e: 'e2', + f: 'f2', + }, + { + d: 'd3', + e: 'e3', + f: 'f3', + }, + ], + }; + expect(copyAllowlistedFields(allowlist, event)).toStrictEqual({ + a: [ + { + a1: 'a1', + }, + ], + b: { + b1: 'b1', + }, + c: [ + { + d: 'd1', + }, + { + d: 'd2', + }, + { + d: 'd3', + }, + ], + }); + }); + it("doesn't create empty objects", () => { const event = { a: 'a', diff --git a/x-pack/plugins/security_solution/server/lib/telemetry/sender.ts b/x-pack/plugins/security_solution/server/lib/telemetry/sender.ts index 7d723c578e3d0..b47edbb21d178 100644 --- a/x-pack/plugins/security_solution/server/lib/telemetry/sender.ts +++ b/x-pack/plugins/security_solution/server/lib/telemetry/sender.ts @@ -21,16 +21,8 @@ import { } from '../../../../task_manager/server'; import { TelemetryDiagTask } from './task'; -export type SearchTypes = - | string - | string[] - | number - | number[] - | boolean - | boolean[] - | object - | object[] - | undefined; +type BaseSearchTypes = string | number | boolean | object; +export type SearchTypes = BaseSearchTypes | BaseSearchTypes[] | undefined; export interface TelemetryEvent { [key: string]: SearchTypes; @@ -294,8 +286,8 @@ interface AllowlistFields { } // Allow list process fields within events. This includes "process" and "Target.process".' -/* eslint-disable @typescript-eslint/naming-convention */ const allowlistProcessFields: AllowlistFields = { + args: true, name: true, executable: true, command_line: true, @@ -306,28 +298,59 @@ const allowlistProcessFields: AllowlistFields = { architecture: true, code_signature: true, dll: true, + malware_signature: true, token: { integrity_level_name: true, }, }, - parent: { + thread: true, +}; + +// Allow list for event-related fields, which can also be nested under events[] +const allowlistBaseEventFields: AllowlistFields = { + dll: { name: true, - executable: true, - command_line: true, + path: true, + code_signature: true, + malware_signature: true, + }, + event: true, + file: { + name: true, + path: true, + size: true, + created: true, + accessed: true, + mtime: true, + directory: true, hash: true, Ext: { - architecture: true, code_signature: true, - dll: true, - token: { - integrity_level_name: true, - }, + malware_classification: true, + malware_signature: true, + quarantine_result: true, + quarantine_message: true, + }, + }, + process: { + parent: allowlistProcessFields, + ...allowlistProcessFields, + }, + network: { + direction: true, + }, + registry: { + hive: true, + key: true, + path: true, + value: true, + }, + Target: { + process: { + parent: allowlistProcessFields, + ...allowlistProcessFields, }, - uptime: true, - pid: true, - ppid: true, }, - thread: true, }; // Allow list for the data we include in the events. True means that it is deep-cloned @@ -337,41 +360,24 @@ const allowlistEventFields: AllowlistFields = { '@timestamp': true, agent: true, Endpoint: true, + /* eslint-disable @typescript-eslint/naming-convention */ Memory_protection: true, Ransomware: true, data_stream: true, ecs: true, elastic: true, - event: true, + // behavioral protection re-nests some field sets under events.* + events: allowlistBaseEventFields, rule: { id: true, name: true, ruleset: true, - }, - file: { - name: true, - path: true, - size: true, - created: true, - accessed: true, - mtime: true, - directory: true, - hash: true, - Ext: { - code_signature: true, - malware_classification: true, - malware_signature: true, - quarantine_result: true, - quarantine_message: true, - }, + version: true, }, host: { os: true, }, - process: allowlistProcessFields, - Target: { - process: allowlistProcessFields, - }, + ...allowlistBaseEventFields, }; export function copyAllowlistedFields( @@ -383,6 +389,12 @@ export function copyAllowlistedFields( if (eventValue !== null && eventValue !== undefined) { if (allowValue === true) { return { ...newEvent, [allowKey]: eventValue }; + } else if (typeof allowValue === 'object' && Array.isArray(eventValue)) { + const subValues = eventValue.filter((v) => typeof v === 'object'); + return { + ...newEvent, + [allowKey]: subValues.map((v) => copyAllowlistedFields(allowValue, v as TelemetryEvent)), + }; } else if (typeof allowValue === 'object' && typeof eventValue === 'object') { const values = copyAllowlistedFields(allowValue, eventValue as TelemetryEvent); return { diff --git a/x-pack/plugins/security_solution/server/lib/timeline/__mocks__/request_responses.ts b/x-pack/plugins/security_solution/server/lib/timeline/__mocks__/request_responses.ts index 2cdcb92baed08..cda97954563f3 100644 --- a/x-pack/plugins/security_solution/server/lib/timeline/__mocks__/request_responses.ts +++ b/x-pack/plugins/security_solution/server/lib/timeline/__mocks__/request_responses.ts @@ -19,11 +19,7 @@ import { SavedTimeline, TimelineType, TimelineStatus } from '../../../../common/ import { requestMock } from '../../detection_engine/routes/__mocks__'; -import { - patchTimelineSchema, - createTimelineSchema, - GetTimelineByIdSchemaQuery, -} from '../schemas/timelines'; +import { patchTimelineSchema, createTimelineSchema, GetTimelineQuery } from '../schemas/timelines'; import { getReadables } from '../utils/common'; @@ -185,7 +181,7 @@ export const cleanDraftTimelinesRequest = (timelineType: TimelineType) => }, }); -export const getTimelineRequest = (query?: GetTimelineByIdSchemaQuery) => +export const getTimelineRequest = (query?: GetTimelineQuery) => requestMock.create({ method: 'get', path: TIMELINE_URL, diff --git a/x-pack/plugins/security_solution/server/lib/timeline/routes/README.md b/x-pack/plugins/security_solution/server/lib/timeline/routes/README.md index ee57d5bb3d031..defbf8be8b7c3 100644 --- a/x-pack/plugins/security_solution/server/lib/timeline/routes/README.md +++ b/x-pack/plugins/security_solution/server/lib/timeline/routes/README.md @@ -619,5 +619,817 @@ kbn-version: 8.0.0 } ``` +## Get timelines / timeline templates api + +#### GET /api/timelines + + +##### Authorization + +Type: Basic Auth +username: Your Kibana username +password: Your Kibana password + + +##### Request header + +``` +Content-Type: application/json +kbn-version: 8.0.0 +``` + +##### Query params + +optional: +only_user_favorite={boolean} +page_index={number} +page_size={number} +search={string} +sort_field={title|description|updated|created} +sort_order={asc|desc} +status={active|draft|immutable} +timeline_type={default|template} + +##### example +api/timelines?page_size=10&page_index=1&sort_field=updated&sort_order=desc&timeline_type=default + +##### Response + +```json +{ + "totalCount": 2, + "timeline": [ + { + "savedObjectId": "de9a3620-8e23-11eb-ad8a-a192243e45e8", + "version": "WzM1NzQ4NywzXQ==", + "columns": [ + { + "columnHeaderType": "not-filtered", + "id": "@timestamp", + "type": "number" + }, + { + "columnHeaderType": "not-filtered", + "id": "message" + }, + { + "columnHeaderType": "not-filtered", + "id": "event.category" + }, + { + "columnHeaderType": "not-filtered", + "id": "event.action" + }, + { + "columnHeaderType": "not-filtered", + "id": "host.name" + }, + { + "columnHeaderType": "not-filtered", + "id": "source.ip" + }, + { + "columnHeaderType": "not-filtered", + "id": "destination.ip" + }, + { + "columnHeaderType": "not-filtered", + "id": "user.name" + } + ], + "dataProviders": [ + { + "excluded": false, + "and": [], + "kqlQuery": "", + "name": "", + "queryMatch": { + "field": "host.name", + "value": "", + "operator": ":*" + }, + "id": "timeline-1-db9f4fc8-9420-420e-8e67-b12dd36691f6", + "type": "default", + "enabled": true + } + ], + "description": "", + "eqlOptions": { + "tiebreakerField": "", + "size": 100, + "query": "", + "eventCategoryField": "event.category", + "timestampField": "@timestamp" + }, + "eventType": "all", + "excludedRowRendererIds": [], + "filters": [], + "kqlMode": "filter", + "kqlQuery": { + "filterQuery": null + }, + "indexNames": [ + ".siem-signals-angelachuang-default", + "auditbeat-*", + "endgame-*", + "filebeat-*", + "logs-*", + "packetbeat-*", + "winlogbeat-*" + ], + "title": "timeline - Duplicate", + "timelineType": "default", + "templateTimelineVersion": null, + "templateTimelineId": null, + "dateRange": { + "start": "2021-03-25T05:38:55.593Z", + "end": "2021-03-26T15:59:59.999Z" + }, + "savedQueryId": null, + "sort": [ + { + "columnType": "number", + "sortDirection": "desc", + "columnId": "@timestamp" + } + ], + "status": "active", + "created": 1616757027458, + "createdBy": "angela", + "updated": 1616758738320, + "updatedBy": "angela", + "favorite": [], + "eventIdToNoteIds": [ + { + "noteId": "e6f3a9a0-8e23-11eb-ad8a-a192243e45e8", + "version": "WzM1NzQ4MywzXQ==", + "eventId": "QN84bngBYJMSg9tnAi1V", + "note": "note!", + "timelineId": "de9a3620-8e23-11eb-ad8a-a192243e45e8", + "created": 1616757041466, + "createdBy": "angela", + "updated": 1616757041466, + "updatedBy": "angela" + } + ], + "noteIds": [ + "221524f0-8e24-11eb-ad8a-a192243e45e8" + ], + "notes": [ + { + "noteId": "e6f3a9a0-8e23-11eb-ad8a-a192243e45e8", + "version": "WzM1NzQ4MywzXQ==", + "eventId": "QN84bngBYJMSg9tnAi1V", + "note": "note!", + "timelineId": "de9a3620-8e23-11eb-ad8a-a192243e45e8", + "created": 1616757041466, + "createdBy": "angela", + "updated": 1616757041466, + "updatedBy": "angela" + }, + { + "noteId": "221524f0-8e24-11eb-ad8a-a192243e45e8", + "version": "WzM1NzQ4NiwzXQ==", + "note": "global note!", + "timelineId": "de9a3620-8e23-11eb-ad8a-a192243e45e8", + "created": 1616757140671, + "createdBy": "angela", + "updated": 1616757140671, + "updatedBy": "angela" + } + ], + "pinnedEventIds": [ + "QN84bngBYJMSg9tnAi1V", + "P984bngBYJMSg9tnAi1V" + ], + "pinnedEventsSaveObject": [ + { + "pinnedEventId": "e85339a0-8e23-11eb-ad8a-a192243e45e8", + "version": "WzM1NzQ4NCwzXQ==", + "eventId": "QN84bngBYJMSg9tnAi1V", + "timelineId": "de9a3620-8e23-11eb-ad8a-a192243e45e8", + "created": 1616757043770, + "createdBy": "angela", + "updated": 1616757043770, + "updatedBy": "angela" + }, + { + "pinnedEventId": "2945cfe0-8e24-11eb-ad8a-a192243e45e8", + "version": "WzM1NzQ4NSwzXQ==", + "eventId": "P984bngBYJMSg9tnAi1V", + "timelineId": "de9a3620-8e23-11eb-ad8a-a192243e45e8", + "created": 1616757152734, + "createdBy": "angela", + "updated": 1616757152734, + "updatedBy": "angela" + } + ] + }, + { + "savedObjectId": "48870270-8e1f-11eb-9cbd-7f6324a02fb7", + "version": "WzM1NzQ4MiwzXQ==", + "columns": [ + { + "columnHeaderType": "not-filtered", + "id": "@timestamp", + "type": "number" + }, + { + "columnHeaderType": "not-filtered", + "id": "message" + }, + { + "columnHeaderType": "not-filtered", + "id": "event.category" + }, + { + "columnHeaderType": "not-filtered", + "id": "event.action" + }, + { + "columnHeaderType": "not-filtered", + "id": "host.name" + }, + { + "columnHeaderType": "not-filtered", + "id": "source.ip" + }, + { + "columnHeaderType": "not-filtered", + "id": "destination.ip" + }, + { + "columnHeaderType": "not-filtered", + "id": "user.name" + } + ], + "dataProviders": [ + { + "excluded": false, + "and": [], + "kqlQuery": "", + "name": "", + "queryMatch": { + "field": "host.name", + "value": "", + "operator": ":*" + }, + "id": "timeline-1-db9f4fc8-9420-420e-8e67-b12dd36691f6", + "type": "default", + "enabled": true + } + ], + "description": "", + "eventType": "all", + "filters": [], + "kqlMode": "filter", + "timelineType": "default", + "kqlQuery": { + "filterQuery": null + }, + "title": "timeline", + "sort": [ + { + "columnType": "number", + "sortDirection": "desc", + "columnId": "@timestamp" + } + ], + "status": "active", + "created": 1616755057686, + "createdBy": "angela", + "updated": 1616756755376, + "updatedBy": "angela", + "templateTimelineId": null, + "templateTimelineVersion": null, + "excludedRowRendererIds": [], + "dateRange": { + "start": "2021-03-25T16:00:00.000Z", + "end": "2021-03-26T15:59:59.999Z" + }, + "indexNames": [ + "auditbeat-*", + "endgame-*", + "filebeat-*", + "logs-*", + "packetbeat-*", + "winlogbeat-*", + ".siem-signals-angelachuang-default" + ], + "eqlOptions": { + "tiebreakerField": "", + "size": 100, + "query": "", + "eventCategoryField": "event.category", + "timestampField": "@timestamp" + }, + "savedQueryId": null, + "favorite": [ + { + "favoriteDate": 1616756755376, + "keySearch": "YW5nZWxh", + "fullName": "Angela", + "userName": "angela" + } + ], + "eventIdToNoteIds": [], + "noteIds": [], + "notes": [], + "pinnedEventIds": [], + "pinnedEventsSaveObject": [] + } + ], + "defaultTimelineCount": 2, + "templateTimelineCount": 4, + "elasticTemplateTimelineCount": 3, + "customTemplateTimelineCount": 1, + "favoriteCount": 1 +} +``` + +## Get timeline api + +#### GET /api/id?id={savedObjectId} + +##### Authorization + +Type: Basic Auth +username: Your Kibana username +password: Your Kibana password + + +##### Request header + +``` +Content-Type: application/json +kbn-version: 8.0.0 +``` + +##### Response +```json +{ + "data": { + "getOneTimeline": { + "savedObjectId": "48870270-8e1f-11eb-9cbd-7f6324a02fb7", + "version": "WzM1NzQ4MiwzXQ==", + "columns": [ + { + "columnHeaderType": "not-filtered", + "id": "@timestamp", + "type": "number" + }, + { + "columnHeaderType": "not-filtered", + "id": "message" + }, + { + "columnHeaderType": "not-filtered", + "id": "event.category" + }, + { + "columnHeaderType": "not-filtered", + "id": "event.action" + }, + { + "columnHeaderType": "not-filtered", + "id": "host.name" + }, + { + "columnHeaderType": "not-filtered", + "id": "source.ip" + }, + { + "columnHeaderType": "not-filtered", + "id": "destination.ip" + }, + { + "columnHeaderType": "not-filtered", + "id": "user.name" + } + ], + "dataProviders": [ + { + "excluded": false, + "and": [], + "kqlQuery": "", + "name": "", + "queryMatch": { + "field": "host.name", + "value": "", + "operator": ":*" + }, + "id": "timeline-1-db9f4fc8-9420-420e-8e67-b12dd36691f6", + "type": "default", + "enabled": true + } + ], + "description": "", + "eventType": "all", + "filters": [], + "kqlMode": "filter", + "timelineType": "default", + "kqlQuery": { + "filterQuery": null + }, + "title": "timeline", + "sort": [ + { + "columnType": "number", + "sortDirection": "desc", + "columnId": "@timestamp" + } + ], + "status": "active", + "created": 1616755057686, + "createdBy": "angela", + "updated": 1616756755376, + "updatedBy": "angela", + "templateTimelineId": null, + "templateTimelineVersion": null, + "excludedRowRendererIds": [], + "dateRange": { + "start": "2021-03-25T16:00:00.000Z", + "end": "2021-03-26T15:59:59.999Z" + }, + "indexNames": [ + "auditbeat-*", + "endgame-*", + "filebeat-*", + "logs-*", + "packetbeat-*", + "winlogbeat-*", + ".siem-signals-angelachuang-default" + ], + "eqlOptions": { + "tiebreakerField": "", + "size": 100, + "query": "", + "eventCategoryField": "event.category", + "timestampField": "@timestamp" + }, + "savedQueryId": null, + "favorite": [ + { + "favoriteDate": 1616756755376, + "keySearch": "YW5nZWxh", + "fullName": "Angela", + "userName": "angela" + } + ], + "eventIdToNoteIds": [], + "noteIds": [], + "notes": [], + "pinnedEventIds": [], + "pinnedEventsSaveObject": [] + } + } +} +``` + + +## Get timeline template api + +#### GET /api/timeline?template_timeline_id={templateTimelineId} + +##### Authorization + +Type: Basic Auth +username: Your Kibana username +password: Your Kibana password + + +##### Request header + +``` +Content-Type: application/json +kbn-version: 8.0.0 +``` + +##### Response +```json +{ + "data": { + "getOneTimeline": { + "savedObjectId": "bf662160-9788-11eb-8277-3516cc4109c3", + "version": "WzM1NzU2MCwzXQ==", + "columns": [ + { + "columnHeaderType": "not-filtered", + "id": "@timestamp" + }, + { + "columnHeaderType": "not-filtered", + "id": "signal.rule.description" + }, + { + "columnHeaderType": "not-filtered", + "id": "event.action" + }, + { + "columnHeaderType": "not-filtered", + "id": "process.name" + }, + { + "aggregatable": true, + "description": "The working directory of the process.", + "columnHeaderType": "not-filtered", + "id": "process.working_directory", + "category": "process", + "type": "string", + "example": "/home/alice" + }, + { + "aggregatable": true, + "description": "Array of process arguments, starting with the absolute path to\nthe executable.\n\nMay be filtered to protect sensitive information.", + "columnHeaderType": "not-filtered", + "id": "process.args", + "category": "process", + "type": "string", + "example": "[\"/usr/bin/ssh\",\"-l\",\"user\",\"10.0.0.16\"]" + }, + { + "columnHeaderType": "not-filtered", + "id": "process.pid" + }, + { + "aggregatable": true, + "description": "Absolute path to the process executable.", + "columnHeaderType": "not-filtered", + "id": "process.parent.executable", + "category": "process", + "type": "string", + "example": "/usr/bin/ssh" + }, + { + "aggregatable": true, + "description": "Array of process arguments.\n\nMay be filtered to protect sensitive information.", + "columnHeaderType": "not-filtered", + "id": "process.parent.args", + "category": "process", + "type": "string", + "example": "[\"ssh\",\"-l\",\"user\",\"10.0.0.16\"]" + }, + { + "aggregatable": true, + "description": "Process id.", + "columnHeaderType": "not-filtered", + "id": "process.parent.pid", + "category": "process", + "type": "number", + "example": "4242" + }, + { + "aggregatable": true, + "description": "Short name or login of the user.", + "columnHeaderType": "not-filtered", + "id": "user.name", + "category": "user", + "type": "string", + "example": "albert" + }, + { + "aggregatable": true, + "description": "Name of the host.\n\nIt can contain what `hostname` returns on Unix systems, the fully qualified\ndomain name, or a name specified by the user. The sender decides which value\nto use.", + "columnHeaderType": "not-filtered", + "id": "host.name", + "category": "host", + "type": "string" + } + ], + "dataProviders": [ + { + "excluded": false, + "and": [], + "kqlQuery": "", + "name": "{process.name}", + "queryMatch": { + "displayValue": null, + "field": "process.name", + "displayField": null, + "value": "{process.name}", + "operator": ":" + }, + "id": "timeline-1-8622010a-61fb-490d-b162-beac9c36a853", + "type": "template", + "enabled": true + } + ], + "description": "", + "eqlOptions": { + "eventCategoryField": "event.category", + "tiebreakerField": "", + "timestampField": "@timestamp", + "query": "", + "size": 100 + }, + "eventType": "all", + "excludedRowRendererIds": [], + "filters": [], + "kqlMode": "filter", + "kqlQuery": { + "filterQuery": { + "kuery": { + "kind": "kuery", + "expression": "" + }, + "serializedQuery": "" + } + }, + "indexNames": [], + "title": "Generic Process Timeline - Duplicate", + "timelineType": "template", + "templateTimelineVersion": 1, + "templateTimelineId": "94dd7443-97ea-4461-864d-fa96803ec111", + "dateRange": { + "start": "2021-04-06T07:57:57.922Z", + "end": "2021-04-07T07:57:57.922Z" + }, + "savedQueryId": null, + "sort": [ + { + "sortDirection": "desc", + "columnId": "@timestamp" + } + ], + "status": "active", + "created": 1617789914742, + "createdBy": "angela", + "updated": 1617790158569, + "updatedBy": "angela", + "favorite": [ + { + "favoriteDate": 1617790158569, + "keySearch": "YW5nZWxh", + "fullName": "Angela", + "userName": "angela" + } + ], + "eventIdToNoteIds": [], + "noteIds": [], + "notes": [], + "pinnedEventIds": [], + "pinnedEventsSaveObject": [] + } + } +} +``` + +## Delete timeline api + +#### DELETE /api/timeline + +##### Authorization + +Type: Basic Auth +username: Your Kibana username +password: Your Kibana password + + +##### Request header + +``` + +Content-Type: application/json + +kbn-version: 8.0.0 + +``` + +##### Request body + +```json +{ + "savedObjectIds": [savedObjectId1, savedObjectId2] +} +``` + +##### Response +```json +{"data":{"deleteTimeline":true}} +``` + +## Persist note api + +#### POST /api/note + +##### Authorization + +Type: Basic Auth +username: Your Kibana username +password: Your Kibana password + + +##### Request header + +``` +Content-Type: application/json +kbn-version: 8.0.0 +``` + +##### Request body + +```json +{ + "note": { + "timelineId": {timeline id that the note is linked to}, + "eventId" (optional): {event id the note is linked to. Not available is it is a global note}, + "note"(optional): {note content}, + }, + "noteId"(optional): note savedObjectId, + "version" (optional): note savedObjectVersion +} +``` +##### Example +```json +{ + "noteId": null, + "version": null, + "note": { + "eventId": "Q9tqqXgBc4D54_cxJnHV", + "note": "note", + "timelineId": "1ec3b430-908e-11eb-94fa-c9122cbc0213" + } +} +``` + +##### Response +``` +{ + "data": { + "persistNote": { + "code": 200, + "message": "success", + "note": { + "noteId": "fe8f6980-97ad-11eb-862e-850f4426d3d0", + "version": "WzM1MDAyNSwzXQ==", + "eventId": "UNtqqXgBc4D54_cxIGi-", + "note": "event note", + "timelineId": "1ec3b430-908e-11eb-94fa-c9122cbc0213", + "created": 1617805912088, + "createdBy": "angela", + "updated": 1617805912088, + "updatedBy": "angela" + } + } + } +} +``` + +## Persist pinned event api + +#### POST /api/pinned_event + +##### Authorization + +Type: Basic Auth +username: Your Kibana username +password: Your Kibana password + + +##### Request header + +``` +Content-Type: application/json +kbn-version: 8.0.0 +``` + +##### Request body + +```json +{ + "eventId": {event which is pinned} + "pinnedEventId" (optional): {pinned event savedObjectId} + "timelineId": {timeline which this pinned event is linked to} +} +``` + +##### example + +``` +{ + "eventId":"UdtqqXgBc4D54_cxIGi", + "pinnedEventId":null, + "timelineId":"1ec3b430-908e-11eb-94fa-c9122cbc0213" +} +``` + +##### Response +```json +{ + "data": { + "persistPinnedEventOnTimeline": { + "pinnedEventId": "5b8f1720-97ae-11eb-862e-850f4426d3d0", + "version": "WzM1MDA1OSwzXQ==", + "eventId": "UdtqqXgBc4D54_cxIGi-", + "timelineId": "1ec3b430-908e-11eb-94fa-c9122cbc0213", + "created": 1617806068114, + "createdBy": "angela", + "updated": 1617806068114, + "updatedBy": "angela" + } + } +} +``` + diff --git a/x-pack/plugins/security_solution/server/lib/timeline/routes/notes/index.ts b/x-pack/plugins/security_solution/server/lib/timeline/routes/notes/index.ts new file mode 100644 index 0000000000000..2b8b6eb55fd94 --- /dev/null +++ b/x-pack/plugins/security_solution/server/lib/timeline/routes/notes/index.ts @@ -0,0 +1,8 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +export { persistNoteRoute } from './persist_note'; diff --git a/x-pack/plugins/security_solution/server/lib/timeline/routes/notes/persist_note.ts b/x-pack/plugins/security_solution/server/lib/timeline/routes/notes/persist_note.ts new file mode 100644 index 0000000000000..cb7d984ade40b --- /dev/null +++ b/x-pack/plugins/security_solution/server/lib/timeline/routes/notes/persist_note.ts @@ -0,0 +1,69 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import type { SecuritySolutionPluginRouter } from '../../../../types'; + +import { NOTE_URL } from '../../../../../common/constants'; + +import { SetupPlugins } from '../../../../plugin'; +import { buildRouteValidationWithExcess } from '../../../../utils/build_validation/route_validation'; +import { ConfigType } from '../../../..'; + +import { transformError, buildSiemResponse } from '../../../detection_engine/routes/utils'; + +import { buildFrameworkRequest } from '../../utils/common'; +import { persistNoteSchema } from '../../schemas/notes'; +import { persistNote } from '../../saved_object/notes'; + +export const persistNoteRoute = ( + router: SecuritySolutionPluginRouter, + config: ConfigType, + security: SetupPlugins['security'] +) => { + router.patch( + { + path: NOTE_URL, + validate: { + body: buildRouteValidationWithExcess(persistNoteSchema), + }, + options: { + tags: ['access:securitySolution'], + }, + }, + async (context, request, response) => { + const siemResponse = buildSiemResponse(response); + + try { + const frameworkRequest = await buildFrameworkRequest(context, security, request); + const { note } = request.body; + const noteId = request.body?.noteId ?? null; + const version = request.body?.version ?? null; + + const res = await persistNote( + frameworkRequest, + noteId, + version, + { + ...note, + timelineId: note.timelineId || null, + }, + true + ); + + return response.ok({ + body: { data: { persistNote: res } }, + }); + } catch (err) { + const error = transformError(err); + return siemResponse.error({ + body: error.message, + statusCode: error.statusCode, + }); + } + } + ); +}; diff --git a/x-pack/plugins/security_solution/server/lib/timeline/routes/pinned_events/index.ts b/x-pack/plugins/security_solution/server/lib/timeline/routes/pinned_events/index.ts new file mode 100644 index 0000000000000..448906196e34a --- /dev/null +++ b/x-pack/plugins/security_solution/server/lib/timeline/routes/pinned_events/index.ts @@ -0,0 +1,8 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +export { persistPinnedEventRoute } from './persist_pinned_event'; diff --git a/x-pack/plugins/security_solution/server/lib/timeline/routes/pinned_events/persist_pinned_event.ts b/x-pack/plugins/security_solution/server/lib/timeline/routes/pinned_events/persist_pinned_event.ts new file mode 100644 index 0000000000000..53ac002721c6e --- /dev/null +++ b/x-pack/plugins/security_solution/server/lib/timeline/routes/pinned_events/persist_pinned_event.ts @@ -0,0 +1,65 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import type { SecuritySolutionPluginRouter } from '../../../../types'; + +import { PINNED_EVENT_URL } from '../../../../../common/constants'; + +import { SetupPlugins } from '../../../../plugin'; +import { buildRouteValidationWithExcess } from '../../../../utils/build_validation/route_validation'; +import { ConfigType } from '../../../..'; + +import { transformError, buildSiemResponse } from '../../../detection_engine/routes/utils'; + +import { buildFrameworkRequest } from '../../utils/common'; +import { persistPinnedEventSchema } from '../../schemas/pinned_events'; +import { persistPinnedEventOnTimeline } from '../../saved_object/pinned_events'; + +export const persistPinnedEventRoute = ( + router: SecuritySolutionPluginRouter, + config: ConfigType, + security: SetupPlugins['security'] +) => { + router.patch( + { + path: PINNED_EVENT_URL, + validate: { + body: buildRouteValidationWithExcess(persistPinnedEventSchema), + }, + options: { + tags: ['access:securitySolution'], + }, + }, + async (context, request, response) => { + const siemResponse = buildSiemResponse(response); + + try { + const frameworkRequest = await buildFrameworkRequest(context, security, request); + const { eventId } = request.body; + const pinnedEventId = request.body?.pinnedEventId ?? null; + const timelineId = request.body?.timelineId ?? null; + + const res = await persistPinnedEventOnTimeline( + frameworkRequest, + pinnedEventId, + eventId, + timelineId + ); + + return response.ok({ + body: { data: { persistPinnedEventOnTimeline: res } }, + }); + } catch (err) { + const error = transformError(err); + return siemResponse.error({ + body: error.message, + statusCode: error.statusCode, + }); + } + } + ); +}; diff --git a/x-pack/plugins/security_solution/server/lib/timeline/routes/timelines/create_timelines/helpers.ts b/x-pack/plugins/security_solution/server/lib/timeline/routes/timelines/create_timelines/helpers.ts index 626f3cbed5b77..e202230bf5cce 100644 --- a/x-pack/plugins/security_solution/server/lib/timeline/routes/timelines/create_timelines/helpers.ts +++ b/x-pack/plugins/security_solution/server/lib/timeline/routes/timelines/create_timelines/helpers.ts @@ -10,9 +10,9 @@ import { isEmpty } from 'lodash/fp'; import moment from 'moment'; import { timeline as timelineLib, pinnedEvent as pinnedEventLib } from '../../../saved_object'; import { FrameworkRequest } from '../../../../framework'; -import { SavedTimeline } from '../../../../../../common/types/timeline'; -import { NoteResult, ResponseTimeline } from '../../../../../graphql/types'; +import { ResponseTimeline, SavedTimeline } from '../../../../../../common/types/timeline'; import { persistNotes } from '../../../saved_object/notes/persist_notes'; +import { NoteResult } from '../../../../../../common/types/timeline/note'; interface CreateTimelineProps { frameworkRequest: FrameworkRequest; diff --git a/x-pack/plugins/security_solution/server/lib/timeline/routes/timelines/delete_timelines/index.ts b/x-pack/plugins/security_solution/server/lib/timeline/routes/timelines/delete_timelines/index.ts new file mode 100644 index 0000000000000..7617881b90b7f --- /dev/null +++ b/x-pack/plugins/security_solution/server/lib/timeline/routes/timelines/delete_timelines/index.ts @@ -0,0 +1,51 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import { buildRouteValidationWithExcess } from '../../../../../utils/build_validation/route_validation'; +import { ConfigType } from '../../../../..'; +import { deleteTimelinesSchema } from '../../../schemas/timelines/delete_timelines_schema'; +import { SecuritySolutionPluginRouter } from '../../../../../types'; +import { SetupPlugins } from '../../../../../plugin'; +import { TIMELINE_URL } from '../../../../../../common/constants'; +import { transformError, buildSiemResponse } from '../../../../detection_engine/routes/utils'; +import { buildFrameworkRequest } from '../../../utils/common'; +import { deleteTimeline } from '../../../saved_object/timelines'; + +export const deleteTimelinesRoute = ( + router: SecuritySolutionPluginRouter, + config: ConfigType, + security: SetupPlugins['security'] +) => { + router.delete( + { + path: TIMELINE_URL, + validate: { + body: buildRouteValidationWithExcess(deleteTimelinesSchema), + }, + options: { + tags: ['access:securitySolution'], + }, + }, + async (context, request, response) => { + const siemResponse = buildSiemResponse(response); + + try { + const frameworkRequest = await buildFrameworkRequest(context, security, request); + const { savedObjectIds } = request.body; + + await deleteTimeline(frameworkRequest, savedObjectIds); + return response.ok({ body: { data: { deleteTimeline: true } } }); + } catch (err) { + const error = transformError(err); + return siemResponse.error({ + body: error.message, + statusCode: error.statusCode, + }); + } + } + ); +}; diff --git a/x-pack/plugins/security_solution/server/lib/timeline/routes/timelines/get_timeline/index.test.ts b/x-pack/plugins/security_solution/server/lib/timeline/routes/timelines/get_timeline/index.test.ts index 8c559daa93da9..13a3a3909095a 100644 --- a/x-pack/plugins/security_solution/server/lib/timeline/routes/timelines/get_timeline/index.test.ts +++ b/x-pack/plugins/security_solution/server/lib/timeline/routes/timelines/get_timeline/index.test.ts @@ -12,11 +12,7 @@ import { requestContextMock, createMockConfig, } from '../../../../detection_engine/routes/__mocks__'; -import { - getTimelineOrNull, - getTimelineTemplateOrNull, - getAllTimeline, -} from '../../../saved_object/timelines'; +import { getTimelineOrNull, getTimelineTemplateOrNull } from '../../../saved_object/timelines'; import { mockGetCurrentUser } from '../../../__mocks__/import_timelines'; import { getTimelineRequest } from '../../../__mocks__/request_responses'; @@ -66,11 +62,8 @@ describe('get timeline', () => { expect((getTimelineOrNull as jest.Mock).mock.calls[0][1]).toEqual(id); }); - test('should call getAllTimeline if nither templateTimelineId nor id is given', async () => { - (getAllTimeline as jest.Mock).mockResolvedValue({ totalCount: 3 }); - - await server.inject(getTimelineRequest(), context); - - expect(getAllTimeline as jest.Mock).toHaveBeenCalledTimes(2); + test('should throw error message if nither templateTimelineId nor id is given', async () => { + const res = await server.inject(getTimelineRequest(), context); + expect(res.body.message).toEqual('please provide id or template_timeline_id'); }); }); diff --git a/x-pack/plugins/security_solution/server/lib/timeline/routes/timelines/get_timeline/index.ts b/x-pack/plugins/security_solution/server/lib/timeline/routes/timelines/get_timeline/index.ts index f49110d105765..8d94cd2ef2cce 100644 --- a/x-pack/plugins/security_solution/server/lib/timeline/routes/timelines/get_timeline/index.ts +++ b/x-pack/plugins/security_solution/server/lib/timeline/routes/timelines/get_timeline/index.ts @@ -16,13 +16,8 @@ import { buildRouteValidationWithExcess } from '../../../../../utils/build_valid import { buildSiemResponse, transformError } from '../../../../detection_engine/routes/utils'; import { buildFrameworkRequest } from '../../../utils/common'; -import { getTimelineByIdSchemaQuery } from '../../../schemas/timelines'; -import { - getTimelineTemplateOrNull, - getTimelineOrNull, - getAllTimeline, -} from '../../../saved_object/timelines'; -import { TimelineStatus } from '../../../../../../common/types/timeline'; +import { getTimelineQuerySchema } from '../../../schemas/timelines'; +import { getTimelineTemplateOrNull, getTimelineOrNull } from '../../../saved_object/timelines'; export const getTimelineRoute = ( router: SecuritySolutionPluginRouter, @@ -31,8 +26,10 @@ export const getTimelineRoute = ( ) => { router.get( { - path: `${TIMELINE_URL}`, - validate: { query: buildRouteValidationWithExcess(getTimelineByIdSchemaQuery) }, + path: TIMELINE_URL, + validate: { + query: buildRouteValidationWithExcess(getTimelineQuerySchema), + }, options: { tags: ['access:securitySolution'], }, @@ -42,34 +39,18 @@ export const getTimelineRoute = ( const frameworkRequest = await buildFrameworkRequest(context, security, request); const query = request.query ?? {}; const { template_timeline_id: templateTimelineId, id } = query; + let res = null; + if (templateTimelineId != null && id == null) { res = await getTimelineTemplateOrNull(frameworkRequest, templateTimelineId); } else if (templateTimelineId == null && id != null) { res = await getTimelineOrNull(frameworkRequest, id); - } else if (templateTimelineId == null && id == null) { - const tempResult = await getAllTimeline( - frameworkRequest, - false, - { pageSize: 1, pageIndex: 1 }, - null, - null, - TimelineStatus.active, - null - ); - - res = await getAllTimeline( - frameworkRequest, - false, - { pageSize: tempResult?.totalCount ?? 0, pageIndex: 1 }, - null, - null, - TimelineStatus.active, - null - ); + } else { + throw new Error('please provide id or template_timeline_id'); } - return response.ok({ body: res ?? {} }); + return response.ok({ body: res ? { data: { getOneTimeline: res } } : {} }); } catch (err) { const error = transformError(err); const siemResponse = buildSiemResponse(response); diff --git a/x-pack/plugins/security_solution/server/lib/timeline/routes/timelines/get_timelines/index.test.ts b/x-pack/plugins/security_solution/server/lib/timeline/routes/timelines/get_timelines/index.test.ts new file mode 100644 index 0000000000000..a29902934172f --- /dev/null +++ b/x-pack/plugins/security_solution/server/lib/timeline/routes/timelines/get_timelines/index.test.ts @@ -0,0 +1,58 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import { SecurityPluginSetup } from '../../../../../../../security/server'; + +import { + serverMock, + requestContextMock, + createMockConfig, +} from '../../../../detection_engine/routes/__mocks__'; +import { getAllTimeline } from '../../../saved_object/timelines'; + +import { mockGetCurrentUser } from '../../../__mocks__/import_timelines'; +import { getTimelineRequest } from '../../../__mocks__/request_responses'; + +import { getTimelinesRoute } from '.'; + +jest.mock('../../../saved_object/timelines', () => ({ + getAllTimeline: jest.fn(), +})); + +describe('get all timelines', () => { + let server: ReturnType; + let securitySetup: SecurityPluginSetup; + let { context } = requestContextMock.createTools(); + + beforeEach(() => { + jest.resetModules(); + jest.resetAllMocks(); + + server = serverMock.create(); + context = requestContextMock.createTools().context; + + securitySetup = ({ + authc: { + getCurrentUser: jest.fn().mockReturnValue(mockGetCurrentUser), + }, + authz: {}, + } as unknown) as SecurityPluginSetup; + + getTimelinesRoute(server.router, createMockConfig(), securitySetup); + }); + + test('should get the total count', async () => { + await server.inject(getTimelineRequest(), context); + expect((getAllTimeline as jest.Mock).mock.calls[0][2]).toEqual({ pageSize: 1, pageIndex: 1 }); + }); + + test('should get all timelines with total count', async () => { + (getAllTimeline as jest.Mock).mockResolvedValue({ totalCount: 100 }); + await server.inject(getTimelineRequest(), context); + expect((getAllTimeline as jest.Mock).mock.calls[1][2]).toEqual({ pageSize: 100, pageIndex: 1 }); + }); +}); diff --git a/x-pack/plugins/security_solution/server/lib/timeline/routes/timelines/get_timelines/index.ts b/x-pack/plugins/security_solution/server/lib/timeline/routes/timelines/get_timelines/index.ts new file mode 100644 index 0000000000000..51a02db681b0c --- /dev/null +++ b/x-pack/plugins/security_solution/server/lib/timeline/routes/timelines/get_timelines/index.ts @@ -0,0 +1,103 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ +import Boom from '@hapi/boom'; + +import { pipe } from 'fp-ts/lib/pipeable'; +import { fold } from 'fp-ts/lib/Either'; +import { identity } from 'fp-ts/lib/function'; + +import type { SecuritySolutionPluginRouter } from '../../../../../types'; +import { TIMELINES_URL } from '../../../../../../common/constants'; + +import { ConfigType } from '../../../../..'; +import { SetupPlugins } from '../../../../../plugin'; + +import { buildSiemResponse, transformError } from '../../../../detection_engine/routes/utils'; + +import { buildFrameworkRequest, escapeHatch, throwErrors } from '../../../utils/common'; +import { getAllTimeline } from '../../../saved_object/timelines'; +import { getTimelinesQuerySchema } from '../../../schemas/timelines'; + +export const getTimelinesRoute = ( + router: SecuritySolutionPluginRouter, + config: ConfigType, + security: SetupPlugins['security'] +) => { + router.get( + { + path: TIMELINES_URL, + validate: { + query: escapeHatch, + }, + options: { + tags: ['access:securitySolution'], + }, + }, + async (context, request, response) => { + try { + const frameworkRequest = await buildFrameworkRequest(context, security, request); + const queryParams = pipe( + getTimelinesQuerySchema.decode(request.query), + fold(throwErrors(Boom.badRequest), identity) + ); + const onlyUserFavorite = queryParams?.only_user_favorite === 'true' ? true : false; + const pageSize = queryParams?.page_size ? parseInt(queryParams.page_size, 10) : null; + const pageIndex = queryParams?.page_index ? parseInt(queryParams.page_index, 10) : null; + const search = queryParams?.search ?? null; + const sortField = queryParams?.sort_field ?? null; + const sortOrder = queryParams?.sort_order ?? null; + const status = queryParams?.status ?? null; + const timelineType = queryParams?.timeline_type ?? null; + const sort = + sortField && sortOrder + ? { + sortField, + sortOrder, + } + : null; + let res = null; + let totalCount = null; + + if (pageSize == null && pageIndex == null) { + const allActiveTimelines = await getAllTimeline( + frameworkRequest, + false, + { pageSize: 1, pageIndex: 1 }, + null, + null, + null, + null + ); + totalCount = allActiveTimelines.totalCount; + } + + res = await getAllTimeline( + frameworkRequest, + onlyUserFavorite, + { + pageSize: pageSize ?? totalCount ?? 1, + pageIndex: pageIndex ?? 1, + }, + search, + sort, + status, + timelineType + ); + + return response.ok({ body: res ?? {} }); + } catch (err) { + const error = transformError(err); + const siemResponse = buildSiemResponse(response); + + return siemResponse.error({ + body: error.message, + statusCode: error.statusCode, + }); + } + } + ); +}; diff --git a/x-pack/plugins/security_solution/server/lib/timeline/routes/timelines/import_timelines/create_timelines_stream_from_ndjson.ts b/x-pack/plugins/security_solution/server/lib/timeline/routes/timelines/import_timelines/create_timelines_stream_from_ndjson.ts index 1184629e47e87..aeb7463377b1f 100644 --- a/x-pack/plugins/security_solution/server/lib/timeline/routes/timelines/import_timelines/create_timelines_stream_from_ndjson.ts +++ b/x-pack/plugins/security_solution/server/lib/timeline/routes/timelines/import_timelines/create_timelines_stream_from_ndjson.ts @@ -9,7 +9,6 @@ import * as rt from 'io-ts'; import { Transform } from 'stream'; import { pipe } from 'fp-ts/lib/pipeable'; import { fold } from 'fp-ts/lib/Either'; -import { failure } from 'io-ts/lib/PathReporter'; import { identity } from 'fp-ts/lib/function'; import { createConcatStream, createSplitStream, createMapStream } from '@kbn/utils'; import { @@ -21,15 +20,12 @@ import { import { ImportTimelineResponse } from './types'; import { ImportTimelinesSchemaRt } from '../../../schemas/timelines/import_timelines_schema'; import { BadRequestError } from '../../../../detection_engine/errors/bad_request_error'; +import { throwErrors } from '../../../utils/common'; type ErrorFactory = (message: string) => Error; export const createPlainError = (message: string) => new Error(message); -export const throwErrors = (createError: ErrorFactory) => (errors: rt.Errors) => { - throw createError(failure(errors).join('\n')); -}; - export const decodeOrThrow = ( runtimeType: rt.Type, createError: ErrorFactory = createPlainError diff --git a/x-pack/plugins/security_solution/server/lib/timeline/routes/timelines/import_timelines/helpers.ts b/x-pack/plugins/security_solution/server/lib/timeline/routes/timelines/import_timelines/helpers.ts index 21ff77e1edbdd..a19276652e78b 100644 --- a/x-pack/plugins/security_solution/server/lib/timeline/routes/timelines/import_timelines/helpers.ts +++ b/x-pack/plugins/security_solution/server/lib/timeline/routes/timelines/import_timelines/helpers.ts @@ -131,6 +131,7 @@ export const importTimelines = async ( timelineType, version, } = parsedTimeline; + const parsedTimelineObject = omit(timelineSavedObjectOmittedFields, parsedTimeline); let newTimeline = null; try { diff --git a/x-pack/plugins/security_solution/server/lib/timeline/routes/timelines/import_timelines/types.ts b/x-pack/plugins/security_solution/server/lib/timeline/routes/timelines/import_timelines/types.ts index cc4221cba1098..2cec338555b30 100644 --- a/x-pack/plugins/security_solution/server/lib/timeline/routes/timelines/import_timelines/types.ts +++ b/x-pack/plugins/security_solution/server/lib/timeline/routes/timelines/import_timelines/types.ts @@ -7,9 +7,9 @@ import { BulkError } from '../../../../detection_engine/routes/utils'; import { SavedTimeline } from '../../../../../../common/types/timeline'; -import { NoteResult } from '../../../../../graphql/types'; import { HapiReadableStream } from '../../../../detection_engine/rules/types'; import { TimelineStatusActions } from '../../../utils/common'; +import { NoteResult } from '../../../../../../common/types/timeline/note'; export type ImportedTimeline = SavedTimeline & { savedObjectId: string | null; diff --git a/x-pack/plugins/security_solution/server/lib/timeline/routes/timelines/index.ts b/x-pack/plugins/security_solution/server/lib/timeline/routes/timelines/index.ts new file mode 100644 index 0000000000000..ebd0dbba7d197 --- /dev/null +++ b/x-pack/plugins/security_solution/server/lib/timeline/routes/timelines/index.ts @@ -0,0 +1,14 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ +export { createTimelinesRoute } from './create_timelines'; +export { deleteTimelinesRoute } from './delete_timelines'; +export { exportTimelinesRoute } from './export_timelines'; +export { getTimelineRoute } from './get_timeline'; +export { getTimelinesRoute } from './get_timelines'; +export { importTimelinesRoute } from './import_timelines'; +export { patchTimelinesRoute } from './patch_timelines'; +export { persistFavoriteRoute } from './persist_favorite'; diff --git a/x-pack/plugins/security_solution/server/lib/timeline/routes/timelines/patch_timelines/index.test.ts b/x-pack/plugins/security_solution/server/lib/timeline/routes/timelines/patch_timelines/index.test.ts index 8f583dbcc05a8..e0cd1a166dd43 100644 --- a/x-pack/plugins/security_solution/server/lib/timeline/routes/timelines/patch_timelines/index.test.ts +++ b/x-pack/plugins/security_solution/server/lib/timeline/routes/timelines/patch_timelines/index.test.ts @@ -86,8 +86,8 @@ describe('update timelines', () => { }; }); - const updateTimelinesRoute = jest.requireActual('./index').updateTimelinesRoute; - updateTimelinesRoute(server.router, createMockConfig(), securitySetup); + const patchTimelinesRoute = jest.requireActual('./index').patchTimelinesRoute; + patchTimelinesRoute(server.router, createMockConfig(), securitySetup); const mockRequest = getUpdateTimelinesRequest(updateTimelineWithTimelineId); await server.inject(mockRequest, context); @@ -150,8 +150,8 @@ describe('update timelines', () => { }; }); - const updateTimelinesRoute = jest.requireActual('./index').updateTimelinesRoute; - updateTimelinesRoute(server.router, createMockConfig(), securitySetup); + const patchTimelinesRoute = jest.requireActual('./index').patchTimelinesRoute; + patchTimelinesRoute(server.router, createMockConfig(), securitySetup); }); test('returns error message', async () => { @@ -194,8 +194,8 @@ describe('update timelines', () => { }; }); - const updateTimelinesRoute = jest.requireActual('./index').updateTimelinesRoute; - updateTimelinesRoute(server.router, createMockConfig(), securitySetup); + const patchTimelinesRoute = jest.requireActual('./index').patchTimelinesRoute; + patchTimelinesRoute(server.router, createMockConfig(), securitySetup); const mockRequest = getUpdateTimelinesRequest(updateTemplateTimelineWithTimelineId); await server.inject(mockRequest, context); @@ -270,8 +270,8 @@ describe('update timelines', () => { }; }); - const updateTimelinesRoute = jest.requireActual('./index').updateTimelinesRoute; - updateTimelinesRoute(server.router, createMockConfig(), securitySetup); + const patchTimelinesRoute = jest.requireActual('./index').patchTimelinesRoute; + patchTimelinesRoute(server.router, createMockConfig(), securitySetup); }); test('returns error message', async () => { diff --git a/x-pack/plugins/security_solution/server/lib/timeline/routes/timelines/patch_timelines/index.ts b/x-pack/plugins/security_solution/server/lib/timeline/routes/timelines/patch_timelines/index.ts index 61880789eca84..b0142625f5e08 100644 --- a/x-pack/plugins/security_solution/server/lib/timeline/routes/timelines/patch_timelines/index.ts +++ b/x-pack/plugins/security_solution/server/lib/timeline/routes/timelines/patch_timelines/index.ts @@ -20,7 +20,7 @@ import { buildFrameworkRequest, TimelineStatusActions } from '../../../utils/com import { createTimelines } from '../create_timelines'; import { CompareTimelinesStatus } from '../../../utils/compare_timelines_status'; -export const updateTimelinesRoute = ( +export const patchTimelinesRoute = ( router: SecuritySolutionPluginRouter, config: ConfigType, security: SetupPlugins['security'] diff --git a/x-pack/plugins/security_solution/server/lib/timeline/routes/timelines/persist_favorite/index.ts b/x-pack/plugins/security_solution/server/lib/timeline/routes/timelines/persist_favorite/index.ts new file mode 100644 index 0000000000000..2cc3888696248 --- /dev/null +++ b/x-pack/plugins/security_solution/server/lib/timeline/routes/timelines/persist_favorite/index.ts @@ -0,0 +1,74 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import type { SecuritySolutionPluginRouter } from '../../../../../types'; + +import { TIMELINE_FAVORITE_URL } from '../../../../../../common/constants'; + +import { SetupPlugins } from '../../../../../plugin'; +import { buildRouteValidationWithExcess } from '../../../../../utils/build_validation/route_validation'; +import { ConfigType } from '../../../../..'; + +import { transformError, buildSiemResponse } from '../../../../detection_engine/routes/utils'; + +import { buildFrameworkRequest } from '../../../utils/common'; +import { persistFavorite } from '../../../saved_object/timelines'; +import { TimelineType } from '../../../../../../common/types/timeline'; +import { persistFavoriteSchema } from '../../../schemas/timelines/persist_favorite_schema'; + +export const persistFavoriteRoute = ( + router: SecuritySolutionPluginRouter, + config: ConfigType, + security: SetupPlugins['security'] +) => { + router.patch( + { + path: TIMELINE_FAVORITE_URL, + validate: { + body: buildRouteValidationWithExcess(persistFavoriteSchema), + }, + options: { + tags: ['access:securitySolution'], + }, + }, + async (context, request, response) => { + const siemResponse = buildSiemResponse(response); + + try { + const frameworkRequest = await buildFrameworkRequest(context, security, request); + const { + timelineId, + templateTimelineId, + templateTimelineVersion, + timelineType, + } = request.body; + + const timeline = await persistFavorite( + frameworkRequest, + timelineId || null, + templateTimelineId || null, + templateTimelineVersion || null, + timelineType || TimelineType.default + ); + + return response.ok({ + body: { + data: { + persistFavorite: timeline, + }, + }, + }); + } catch (err) { + const error = transformError(err); + return siemResponse.error({ + body: error.message, + statusCode: error.statusCode, + }); + } + } + ); +}; diff --git a/x-pack/plugins/security_solution/server/lib/timeline/saved_object/notes/get_overridable_note.ts b/x-pack/plugins/security_solution/server/lib/timeline/saved_object/notes/get_overridable_note.ts index 1ff1c37a16357..6feca76ff53a9 100644 --- a/x-pack/plugins/security_solution/server/lib/timeline/saved_object/notes/get_overridable_note.ts +++ b/x-pack/plugins/security_solution/server/lib/timeline/saved_object/notes/get_overridable_note.ts @@ -5,11 +5,15 @@ * 2.0. */ -import { SavedNote } from '../../../../../common/types/timeline/note'; -import { NoteResult } from '../../../../graphql/types'; +import { NoteResult, SavedNote } from '../../../../../common/types/timeline/note'; import { FrameworkRequest } from '../../../framework'; import { getNote } from './saved_object'; +/** + * When importing timeline with an existing note by others, we don't want override the owner. + * In this case we can set overrideOwner to false to keep the original author + */ + export const getOverridableNote = async ( frameworkRequest: FrameworkRequest, note: NoteResult, diff --git a/x-pack/plugins/security_solution/server/lib/timeline/saved_object/notes/index.ts b/x-pack/plugins/security_solution/server/lib/timeline/saved_object/notes/index.ts index 9addf0f80e124..34914517da683 100644 --- a/x-pack/plugins/security_solution/server/lib/timeline/saved_object/notes/index.ts +++ b/x-pack/plugins/security_solution/server/lib/timeline/saved_object/notes/index.ts @@ -6,8 +6,14 @@ */ import { FrameworkRequest } from '../../../framework'; -import { PageInfoNote, ResponseNote, ResponseNotes, SortNote } from '../../../../graphql/types'; -import { SavedNote, NoteSavedObject } from '../../../../../common/types/timeline/note'; +import { + SavedNote, + NoteSavedObject, + PageInfoNote, + SortNote, + ResponseNotes, + ResponseNote, +} from '../../../../../common/types/timeline/note'; export * from './saved_object'; export interface Notes { diff --git a/x-pack/plugins/security_solution/server/lib/timeline/saved_object/notes/persist_notes.ts b/x-pack/plugins/security_solution/server/lib/timeline/saved_object/notes/persist_notes.ts index 7f6a355f43df0..58b4e33444d94 100644 --- a/x-pack/plugins/security_solution/server/lib/timeline/saved_object/notes/persist_notes.ts +++ b/x-pack/plugins/security_solution/server/lib/timeline/saved_object/notes/persist_notes.ts @@ -6,9 +6,9 @@ */ import { FrameworkRequest } from '../../../framework'; -import { NoteResult } from '../../../../graphql/types'; import { persistNote } from './saved_object'; import { getOverridableNote } from './get_overridable_note'; +import { NoteResult } from '../../../../../common/types/timeline/note'; export const persistNotes = async ( frameworkRequest: FrameworkRequest, diff --git a/x-pack/plugins/security_solution/server/lib/timeline/saved_object/notes/saved_object.ts b/x-pack/plugins/security_solution/server/lib/timeline/saved_object/notes/saved_object.ts index 8016fdf12881d..91caaa8cc8a8b 100644 --- a/x-pack/plugins/security_solution/server/lib/timeline/saved_object/notes/saved_object.ts +++ b/x-pack/plugins/security_solution/server/lib/timeline/saved_object/notes/saved_object.ts @@ -20,14 +20,12 @@ import { SavedNote, NoteSavedObjectRuntimeType, NoteSavedObject, -} from '../../../../../common/types/timeline/note'; -import { PageInfoNote, - ResponseNote, - ResponseNotes, SortNote, NoteResult, -} from '../../../../graphql/types'; + ResponseNotes, + ResponseNote, +} from '../../../../../common/types/timeline/note'; import { FrameworkRequest } from '../../../framework'; import { noteSavedObjectType } from '../../saved_object_mappings/notes'; import { convertSavedObjectToSavedTimeline, pickSavedTimeline } from '../timelines'; diff --git a/x-pack/plugins/security_solution/server/lib/timeline/saved_object/pinned_events/index.ts b/x-pack/plugins/security_solution/server/lib/timeline/saved_object/pinned_events/index.ts index 6467d1d43d807..b3d262b13cbf3 100644 --- a/x-pack/plugins/security_solution/server/lib/timeline/saved_object/pinned_events/index.ts +++ b/x-pack/plugins/security_solution/server/lib/timeline/saved_object/pinned_events/index.ts @@ -18,14 +18,11 @@ import { PinnedEventSavedObject, PinnedEventSavedObjectRuntimeType, SavedPinnedEvent, + PinnedEvent as PinnedEventResponse, } from '../../../../../common/types/timeline/pinned_event'; +import { PageInfoNote, SortNote } from '../../../../../common/types/timeline/note'; import { FrameworkRequest } from '../../../framework'; -import { - PageInfoNote, - SortNote, - PinnedEvent as PinnedEventResponse, -} from '../../../../graphql/types'; import { pickSavedTimeline } from '../../saved_object/timelines'; import { convertSavedObjectToSavedTimeline } from '../timelines'; import { pinnedEventSavedObjectType } from '../../saved_object_mappings/pinned_events'; diff --git a/x-pack/plugins/security_solution/server/lib/timeline/saved_object/timelines/index.test.ts b/x-pack/plugins/security_solution/server/lib/timeline/saved_object/timelines/index.test.ts index 61e25d419a0e4..1136753bc8316 100644 --- a/x-pack/plugins/security_solution/server/lib/timeline/saved_object/timelines/index.test.ts +++ b/x-pack/plugins/security_solution/server/lib/timeline/saved_object/timelines/index.test.ts @@ -8,15 +8,11 @@ import { FrameworkRequest } from '../../../framework'; import { mockGetTimelineValue, mockSavedObject } from '../../__mocks__/import_timelines'; -import { - convertStringToBase64, - getExistingPrepackagedTimelines, - getAllTimeline, - AllTimelinesResponse, -} from '.'; +import { convertStringToBase64, getExistingPrepackagedTimelines, getAllTimeline } from '.'; import { convertSavedObjectToSavedTimeline } from './convert_saved_object_to_savedtimeline'; import { getNotesByTimelineId } from '../notes/saved_object'; import { getAllPinnedEventsByTimelineId } from '../pinned_events'; +import { AllTimelinesResponse } from '../../../../../common/types/timeline'; jest.mock('./convert_saved_object_to_savedtimeline', () => ({ convertSavedObjectToSavedTimeline: jest.fn(), diff --git a/x-pack/plugins/security_solution/server/lib/timeline/saved_object/timelines/index.ts b/x-pack/plugins/security_solution/server/lib/timeline/saved_object/timelines/index.ts index 0f624ef5420bc..8904a9103bc02 100644 --- a/x-pack/plugins/security_solution/server/lib/timeline/saved_object/timelines/index.ts +++ b/x-pack/plugins/security_solution/server/lib/timeline/saved_object/timelines/index.ts @@ -12,22 +12,21 @@ import { UNAUTHENTICATED_USER } from '../../../../../common/constants'; import { NoteSavedObject } from '../../../../../common/types/timeline/note'; import { PinnedEventSavedObject } from '../../../../../common/types/timeline/pinned_event'; import { + AllTimelinesResponse, + ExportTimelineNotFoundError, + PageInfoTimeline, + ResponseTimelines, + ResponseFavoriteTimeline, + ResponseTimeline, SavedTimeline, + SortTimeline, TimelineSavedObject, TimelineTypeLiteralWithNull, - ExportTimelineNotFoundError, TimelineStatusLiteralWithNull, -} from '../../../../../common/types/timeline'; -import { - ResponseTimeline, - PageInfoTimeline, - SortTimeline, - ResponseFavoriteTimeline, - TimelineResult, TimelineType, TimelineStatus, - Maybe, -} from '../../../../graphql/types'; + TimelineResult, +} from '../../../../../common/types/timeline'; import { FrameworkRequest } from '../../../framework'; import * as note from '../notes/saved_object'; import * as pinnedEvent from '../pinned_events'; @@ -36,22 +35,10 @@ import { pickSavedTimeline } from './pick_saved_timeline'; import { timelineSavedObjectType } from '../../saved_object_mappings/'; import { draftTimelineDefaults } from '../../utils/default_timeline'; import { AuthenticatedUser } from '../../../../../../security/server'; +import { Maybe } from '../../../../../common/search_strategy'; export { pickSavedTimeline } from './pick_saved_timeline'; export { convertSavedObjectToSavedTimeline } from './convert_saved_object_to_savedtimeline'; -interface ResponseTimelines { - timeline: TimelineSavedObject[]; - totalCount: number; -} - -export interface AllTimelinesResponse extends ResponseTimelines { - defaultTimelineCount: number; - templateTimelineCount: number; - elasticTemplateTimelineCount: number; - customTemplateTimelineCount: number; - favoriteCount: number; -} - export interface ResponseTemplateTimeline { code?: Maybe; diff --git a/x-pack/plugins/security_solution/server/lib/timeline/schemas/notes/index.ts b/x-pack/plugins/security_solution/server/lib/timeline/schemas/notes/index.ts index de1e357896353..b2fc7a0beb065 100644 --- a/x-pack/plugins/security_solution/server/lib/timeline/schemas/notes/index.ts +++ b/x-pack/plugins/security_solution/server/lib/timeline/schemas/notes/index.ts @@ -11,3 +11,14 @@ import { SavedNoteRuntimeType } from '../../../../../common/types/timeline/note' export const eventNotes = unionWithNullType(runtimeTypes.array(SavedNoteRuntimeType)); export const globalNotes = unionWithNullType(runtimeTypes.array(SavedNoteRuntimeType)); + +export const persistNoteSchema = runtimeTypes.intersection([ + runtimeTypes.type({ + note: SavedNoteRuntimeType, + }), + runtimeTypes.partial({ + overrideOwner: unionWithNullType(runtimeTypes.boolean), + noteId: unionWithNullType(runtimeTypes.string), + version: unionWithNullType(runtimeTypes.string), + }), +]); diff --git a/x-pack/plugins/security_solution/server/lib/timeline/schemas/pinned_events/index.ts b/x-pack/plugins/security_solution/server/lib/timeline/schemas/pinned_events/index.ts index 29afda10dce80..e0bd1f95f5953 100644 --- a/x-pack/plugins/security_solution/server/lib/timeline/schemas/pinned_events/index.ts +++ b/x-pack/plugins/security_solution/server/lib/timeline/schemas/pinned_events/index.ts @@ -9,3 +9,12 @@ import * as runtimeTypes from 'io-ts'; import { unionWithNullType } from '../../../../../common/utility_types'; export const pinnedEventIds = unionWithNullType(runtimeTypes.array(runtimeTypes.string)); +export const persistPinnedEventSchema = runtimeTypes.intersection([ + runtimeTypes.type({ + eventId: runtimeTypes.string, + }), + runtimeTypes.partial({ + pinnedEventId: unionWithNullType(runtimeTypes.string), + timelineId: unionWithNullType(runtimeTypes.string), + }), +]); diff --git a/x-pack/plugins/security_solution/server/lib/timeline/schemas/timelines/delete_timelines_schema.ts b/x-pack/plugins/security_solution/server/lib/timeline/schemas/timelines/delete_timelines_schema.ts new file mode 100644 index 0000000000000..4aadb73283676 --- /dev/null +++ b/x-pack/plugins/security_solution/server/lib/timeline/schemas/timelines/delete_timelines_schema.ts @@ -0,0 +1,12 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import * as rt from 'io-ts'; + +export const deleteTimelinesSchema = rt.type({ + savedObjectIds: rt.array(rt.string), +}); diff --git a/x-pack/plugins/security_solution/server/lib/timeline/schemas/timelines/get_timeline_by_id_schema.ts b/x-pack/plugins/security_solution/server/lib/timeline/schemas/timelines/get_timeline_schema.ts similarity index 70% rename from x-pack/plugins/security_solution/server/lib/timeline/schemas/timelines/get_timeline_by_id_schema.ts rename to x-pack/plugins/security_solution/server/lib/timeline/schemas/timelines/get_timeline_schema.ts index 4e6102e2d87e4..cca6886f42025 100644 --- a/x-pack/plugins/security_solution/server/lib/timeline/schemas/timelines/get_timeline_by_id_schema.ts +++ b/x-pack/plugins/security_solution/server/lib/timeline/schemas/timelines/get_timeline_schema.ts @@ -7,9 +7,9 @@ import * as rt from 'io-ts'; -export const getTimelineByIdSchemaQuery = rt.partial({ +export const getTimelineQuerySchema = rt.partial({ template_timeline_id: rt.string, id: rt.string, }); -export type GetTimelineByIdSchemaQuery = rt.TypeOf; +export type GetTimelineQuery = rt.TypeOf; diff --git a/x-pack/plugins/security_solution/server/lib/timeline/schemas/timelines/get_timelines_schema.ts b/x-pack/plugins/security_solution/server/lib/timeline/schemas/timelines/get_timelines_schema.ts new file mode 100644 index 0000000000000..7353741128435 --- /dev/null +++ b/x-pack/plugins/security_solution/server/lib/timeline/schemas/timelines/get_timelines_schema.ts @@ -0,0 +1,41 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import * as rt from 'io-ts'; +import { + direction, + sortFieldTimeline, + TimelineStatusLiteralRt, + TimelineTypeLiteralRt, +} from '../../../../../common/types/timeline'; +import { unionWithNullType } from '../../../../../common/utility_types'; + +const BoolFromString = rt.union([rt.literal('true'), rt.literal('false')]); + +export const getTimelinesQuerySchema = rt.partial({ + only_user_favorite: unionWithNullType(BoolFromString), + page_index: unionWithNullType(rt.string), + page_size: unionWithNullType(rt.string), + search: unionWithNullType(rt.string), + sort_field: sortFieldTimeline, + sort_order: direction, + status: unionWithNullType(TimelineStatusLiteralRt), + timeline_type: unionWithNullType(TimelineTypeLiteralRt), +}); + +export const getTimelinesArgsSchema = rt.partial({ + onlyUserFavorite: unionWithNullType(BoolFromString), + pageIndex: unionWithNullType(rt.string), + pageSize: unionWithNullType(rt.string), + search: unionWithNullType(rt.string), + sortField: sortFieldTimeline, + sortOrder: direction, + status: unionWithNullType(TimelineStatusLiteralRt), + timelineType: unionWithNullType(TimelineTypeLiteralRt), +}); + +export type GetTimelinesArgs = rt.TypeOf; diff --git a/x-pack/plugins/security_solution/server/lib/timeline/schemas/timelines/index.ts b/x-pack/plugins/security_solution/server/lib/timeline/schemas/timelines/index.ts index e85ae2ab4ae86..a88d6a6741517 100644 --- a/x-pack/plugins/security_solution/server/lib/timeline/schemas/timelines/index.ts +++ b/x-pack/plugins/security_solution/server/lib/timeline/schemas/timelines/index.ts @@ -6,5 +6,6 @@ */ export * from './create_timelines_schema'; export * from './export_timelines_schema'; -export * from './get_timeline_by_id_schema'; +export * from './get_timeline_schema'; +export * from './get_timelines_schema'; export * from './patch_timelines_schema'; diff --git a/x-pack/plugins/security_solution/server/lib/timeline/schemas/timelines/persist_favorite_schema.ts b/x-pack/plugins/security_solution/server/lib/timeline/schemas/timelines/persist_favorite_schema.ts new file mode 100644 index 0000000000000..9b96e8ce0ca18 --- /dev/null +++ b/x-pack/plugins/security_solution/server/lib/timeline/schemas/timelines/persist_favorite_schema.ts @@ -0,0 +1,18 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import * as rt from 'io-ts'; + +import { TimelineTypeLiteralRt } from '../../../../../common/types/timeline'; +import { unionWithNullType } from '../../../../../common/utility_types'; + +export const persistFavoriteSchema = rt.type({ + timelineId: unionWithNullType(rt.string), + templateTimelineId: unionWithNullType(rt.string), + templateTimelineVersion: unionWithNullType(rt.number), + timelineType: unionWithNullType(TimelineTypeLiteralRt), +}); diff --git a/x-pack/plugins/security_solution/server/lib/timeline/utils/common.ts b/x-pack/plugins/security_solution/server/lib/timeline/utils/common.ts index 443742ae88f0d..18fa84c9cf3ae 100644 --- a/x-pack/plugins/security_solution/server/lib/timeline/utils/common.ts +++ b/x-pack/plugins/security_solution/server/lib/timeline/utils/common.ts @@ -4,12 +4,14 @@ * 2.0; you may not use this file except in compliance with the Elastic License * 2.0. */ - +import * as rt from 'io-ts'; import { set } from '@elastic/safer-lodash-set/fp'; import readline from 'readline'; import fs from 'fs'; import { Readable } from 'stream'; import { createListStream } from '@kbn/utils'; +import { schema } from '@kbn/config-schema'; +import { isObject } from 'lodash/fp'; import { KibanaRequest } from 'src/core/server'; import { SetupPlugins } from '../../../plugin'; @@ -36,6 +38,37 @@ export const buildFrameworkRequest = async ( ); }; +export const escapeHatch = schema.object({}, { unknowns: 'allow' }); + +export const formatErrors = (errors: rt.Errors): string[] => { + const err = errors.map((error) => { + if (error.message != null) { + return error.message; + } else { + const keyContext = error.context + .filter( + (entry) => entry.key != null && !Number.isInteger(+entry.key) && entry.key.trim() !== '' + ) + .map((entry) => entry.key) + .join(','); + + const nameContext = error.context.find((entry) => entry.type?.name?.length > 0); + const suppliedValue = + keyContext !== '' ? keyContext : nameContext != null ? nameContext.type.name : ''; + const value = isObject(error.value) ? JSON.stringify(error.value) : error.value; + return `Invalid value "${value}" supplied to "${suppliedValue}"`; + } + }); + + return [...new Set(err)]; +}; + +type ErrorFactory = (message: string) => Error; + +export const throwErrors = (createError: ErrorFactory) => (errors: rt.Errors) => { + throw createError(formatErrors(errors).join('\n')); +}; + export const getReadables = (dataPath: string): Promise => new Promise((resolved, reject) => { const contents: string[] = []; diff --git a/x-pack/plugins/security_solution/server/plugin.ts b/x-pack/plugins/security_solution/server/plugin.ts index 003ba4c8cf190..2b5a25ec1b316 100644 --- a/x-pack/plugins/security_solution/server/plugin.ts +++ b/x-pack/plugins/security_solution/server/plugin.ts @@ -36,7 +36,6 @@ import { SpacesPluginSetup as SpacesSetup } from '../../spaces/server'; import { ILicense, LicensingPluginStart } from '../../licensing/server'; import { FleetStartContract } from '../../fleet/server'; import { TaskManagerSetupContract, TaskManagerStartContract } from '../../task_manager/server'; -import { initServer } from './init_server'; import { compose } from './lib/compose/kibana'; import { initRoutes } from './routes'; import { isAlertExecutor } from './lib/detection_engine/signals/types'; @@ -175,6 +174,7 @@ export class Plugin implements IPlugin { const securitySolutionSearchStrategy = securitySolutionSearchStrategyProvider(depsStart.data); diff --git a/x-pack/plugins/security_solution/server/routes/index.ts b/x-pack/plugins/security_solution/server/routes/index.ts index 488816cc6ad90..54090dc886ceb 100644 --- a/x-pack/plugins/security_solution/server/routes/index.ts +++ b/x-pack/plugins/security_solution/server/routes/index.ts @@ -33,16 +33,26 @@ import { importRulesRoute } from '../lib/detection_engine/routes/rules/import_ru import { exportRulesRoute } from '../lib/detection_engine/routes/rules/export_rules_route'; import { findRulesStatusesRoute } from '../lib/detection_engine/routes/rules/find_rules_status_route'; import { getPrepackagedRulesStatusRoute } from '../lib/detection_engine/routes/rules/get_prepackaged_rules_status_route'; -import { importTimelinesRoute } from '../lib/timeline/routes/timelines/import_timelines'; -import { exportTimelinesRoute } from '../lib/timeline/routes/timelines/export_timelines'; -import { createTimelinesRoute } from '../lib/timeline/routes/timelines/create_timelines'; -import { updateTimelinesRoute } from '../lib/timeline/routes/timelines/patch_timelines'; +import { + createTimelinesRoute, + deleteTimelinesRoute, + exportTimelinesRoute, + getTimelineRoute, + getTimelinesRoute, + importTimelinesRoute, + patchTimelinesRoute, + persistFavoriteRoute, +} from '../lib/timeline/routes/timelines'; import { getDraftTimelinesRoute } from '../lib/timeline/routes/draft_timelines/get_draft_timelines'; import { cleanDraftTimelinesRoute } from '../lib/timeline/routes/draft_timelines/clean_draft_timelines'; + +import { persistNoteRoute } from '../lib/timeline/routes/notes'; + +import { persistPinnedEventRoute } from '../lib/timeline/routes/pinned_events'; + import { SetupPlugins } from '../plugin'; import { ConfigType } from '../config'; import { installPrepackedTimelinesRoute } from '../lib/timeline/routes/prepackaged_timelines/install_prepackaged_timelines'; -import { getTimelineRoute } from '../lib/timeline/routes/timelines/get_timeline'; export const initRoutes = ( router: SecuritySolutionPluginRouter, @@ -68,7 +78,7 @@ export const initRoutes = ( deleteRulesBulkRoute(router); createTimelinesRoute(router, config, security); - updateTimelinesRoute(router, config, security); + patchTimelinesRoute(router, config, security); importRulesRoute(router, config, ml); exportRulesRoute(router, config); @@ -76,10 +86,16 @@ export const initRoutes = ( exportTimelinesRoute(router, config, security); getDraftTimelinesRoute(router, config, security); getTimelineRoute(router, config, security); + getTimelinesRoute(router, config, security); cleanDraftTimelinesRoute(router, config, security); + deleteTimelinesRoute(router, config, security); + persistFavoriteRoute(router, config, security); installPrepackedTimelinesRoute(router, config, security); + persistNoteRoute(router, config, security); + persistPinnedEventRoute(router, config, security); + findRulesStatusesRoute(router); // Detection Engine Signals routes that have the REST endpoints of /api/detection_engine/signals diff --git a/x-pack/plugins/security_solution/server/search_strategy/security_solution/index.ts b/x-pack/plugins/security_solution/server/search_strategy/security_solution/index.ts index 358c6591ea66e..2980f63df8a67 100644 --- a/x-pack/plugins/security_solution/server/search_strategy/security_solution/index.ts +++ b/x-pack/plugins/security_solution/server/search_strategy/security_solution/index.ts @@ -11,7 +11,7 @@ import { PluginStart, shimHitsTotal, } from '../../../../../../src/plugins/data/server'; -import { ENHANCED_ES_SEARCH_STRATEGY } from '../../../../data_enhanced/common'; +import { ENHANCED_ES_SEARCH_STRATEGY } from '../../../../../../src/plugins/data/common'; import { FactoryQueryTypes, StrategyResponseType, diff --git a/x-pack/plugins/security_solution/server/search_strategy/timeline/eql/__mocks__/index.ts b/x-pack/plugins/security_solution/server/search_strategy/timeline/eql/__mocks__/index.ts index 9f9aa182ca0f7..a3499b5855f50 100644 --- a/x-pack/plugins/security_solution/server/search_strategy/timeline/eql/__mocks__/index.ts +++ b/x-pack/plugins/security_solution/server/search_strategy/timeline/eql/__mocks__/index.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { EqlSearchStrategyResponse } from '../../../../../../data_enhanced/common'; +import { EqlSearchStrategyResponse } from '../../../../../../../../src/plugins/data/common'; import { EqlSearchResponse } from '../../../../../common/detection_engine/types'; export const sequenceResponse = ({ diff --git a/x-pack/plugins/security_solution/server/search_strategy/timeline/eql/helpers.ts b/x-pack/plugins/security_solution/server/search_strategy/timeline/eql/helpers.ts index ea744d17e1262..65be9a773adb9 100644 --- a/x-pack/plugins/security_solution/server/search_strategy/timeline/eql/helpers.ts +++ b/x-pack/plugins/security_solution/server/search_strategy/timeline/eql/helpers.ts @@ -6,7 +6,7 @@ */ import { isEmpty } from 'lodash/fp'; -import { EqlSearchStrategyResponse } from '../../../../../data_enhanced/common'; +import { EqlSearchStrategyResponse } from '../../../../../../../src/plugins/data/common'; import { DEFAULT_MAX_TABLE_QUERY_SIZE } from '../../../../common/constants'; import { EqlSearchResponse, EqlSequence } from '../../../../common/detection_engine/types'; import { EventHit, TimelineEdges } from '../../../../common/search_strategy'; diff --git a/x-pack/plugins/security_solution/server/search_strategy/timeline/eql/index.ts b/x-pack/plugins/security_solution/server/search_strategy/timeline/eql/index.ts index 249f5582d2a39..56e5bd63d6b23 100644 --- a/x-pack/plugins/security_solution/server/search_strategy/timeline/eql/index.ts +++ b/x-pack/plugins/security_solution/server/search_strategy/timeline/eql/index.ts @@ -14,7 +14,7 @@ import { import { EqlSearchStrategyResponse, EQL_SEARCH_STRATEGY, -} from '../../../../../data_enhanced/common'; +} from '../../../../../../../src/plugins/data/common'; import { EqlSearchResponse } from '../../../../common/detection_engine/types'; import { TimelineEqlRequestOptions, diff --git a/x-pack/plugins/security_solution/server/search_strategy/timeline/index.ts b/x-pack/plugins/security_solution/server/search_strategy/timeline/index.ts index 438d3dca3bf3f..4dfa9831f9e6e 100644 --- a/x-pack/plugins/security_solution/server/search_strategy/timeline/index.ts +++ b/x-pack/plugins/security_solution/server/search_strategy/timeline/index.ts @@ -11,7 +11,7 @@ import { PluginStart, shimHitsTotal, } from '../../../../../../src/plugins/data/server'; -import { ENHANCED_ES_SEARCH_STRATEGY } from '../../../../data_enhanced/common'; +import { ENHANCED_ES_SEARCH_STRATEGY } from '../../../../../../src/plugins/data/common'; import { TimelineFactoryQueryTypes, TimelineStrategyResponseType, diff --git a/x-pack/plugins/security_solution/server/usage/collector.ts b/x-pack/plugins/security_solution/server/usage/collector.ts index 53fa1a1571835..ffb42ff724370 100644 --- a/x-pack/plugins/security_solution/server/usage/collector.ts +++ b/x-pack/plugins/security_solution/server/usage/collector.ts @@ -33,6 +33,7 @@ export const registerCollector: RegisterCollector = ({ core, endpointAppContext, kibanaIndex, + signalsIndex, ml, usageCollection, }) => { @@ -65,6 +66,163 @@ export const registerCollector: RegisterCollector = ({ }, }, detectionMetrics: { + detection_rules: { + detection_rule_usage: { + query: { + enabled: { type: 'long', _meta: { description: 'Number of query rules enabled' } }, + disabled: { type: 'long', _meta: { description: 'Number of query rules disabled' } }, + alerts: { + type: 'long', + _meta: { description: 'Number of alerts generated by query rules' }, + }, + cases: { + type: 'long', + _meta: { description: 'Number of cases attached to query detection rule alerts' }, + }, + }, + threshold: { + enabled: { + type: 'long', + _meta: { description: 'Number of threshold rules enabled' }, + }, + disabled: { + type: 'long', + _meta: { description: 'Number of threshold rules disabled' }, + }, + alerts: { + type: 'long', + _meta: { description: 'Number of alerts generated by threshold rules' }, + }, + cases: { + type: 'long', + _meta: { + description: 'Number of cases attached to threshold detection rule alerts', + }, + }, + }, + eql: { + enabled: { type: 'long', _meta: { description: 'Number of eql rules enabled' } }, + disabled: { type: 'long', _meta: { description: 'Number of eql rules disabled' } }, + alerts: { + type: 'long', + _meta: { description: 'Number of alerts generated by eql rules' }, + }, + cases: { + type: 'long', + _meta: { description: 'Number of cases attached to eql detection rule alerts' }, + }, + }, + machine_learning: { + enabled: { + type: 'long', + _meta: { description: 'Number of machine_learning rules enabled' }, + }, + disabled: { + type: 'long', + _meta: { description: 'Number of machine_learning rules disabled' }, + }, + alerts: { + type: 'long', + _meta: { description: 'Number of alerts generated by machine_learning rules' }, + }, + cases: { + type: 'long', + _meta: { + description: 'Number of cases attached to machine_learning detection rule alerts', + }, + }, + }, + threat_match: { + enabled: { + type: 'long', + _meta: { description: 'Number of threat_match rules enabled' }, + }, + disabled: { + type: 'long', + _meta: { description: 'Number of threat_match rules disabled' }, + }, + alerts: { + type: 'long', + _meta: { description: 'Number of alerts generated by threat_match rules' }, + }, + cases: { + type: 'long', + _meta: { + description: 'Number of cases attached to threat_match detection rule alerts', + }, + }, + }, + elastic_total: { + enabled: { type: 'long', _meta: { description: 'Number of elastic rules enabled' } }, + disabled: { + type: 'long', + _meta: { description: 'Number of elastic rules disabled' }, + }, + alerts: { + type: 'long', + _meta: { description: 'Number of alerts generated by elastic rules' }, + }, + cases: { + type: 'long', + _meta: { description: 'Number of cases attached to elastic detection rule alerts' }, + }, + }, + custom_total: { + enabled: { type: 'long', _meta: { description: 'Number of custom rules enabled' } }, + disabled: { type: 'long', _meta: { description: 'Number of custom rules disabled' } }, + alerts: { + type: 'long', + _meta: { description: 'Number of alerts generated by custom rules' }, + }, + cases: { + type: 'long', + _meta: { description: 'Number of cases attached to custom detection rule alerts' }, + }, + }, + }, + detection_rule_detail: { + type: 'array', + items: { + rule_name: { + type: 'keyword', + _meta: { description: 'The name of the detection rule' }, + }, + rule_id: { + type: 'keyword', + _meta: { description: 'The UUID id of the detection rule' }, + }, + rule_type: { + type: 'keyword', + _meta: { description: 'The type of detection rule. ie eql, query...' }, + }, + rule_version: { type: 'long', _meta: { description: 'The version of the rule' } }, + enabled: { + type: 'boolean', + _meta: { description: 'If the detection rule has been enabled by the user' }, + }, + elastic_rule: { + type: 'boolean', + _meta: { description: 'If the detection rule has been authored by Elastic' }, + }, + created_on: { + type: 'keyword', + _meta: { description: 'When the detection rule was created on the cluster' }, + }, + updated_on: { + type: 'keyword', + _meta: { description: 'When the detection rule was updated on the cluster' }, + }, + alert_count_daily: { + type: 'long', + _meta: { description: 'The number of daily alerts generated by a rule' }, + }, + cases_count_daily: { + type: 'long', + _meta: { description: 'The number of daily cases generated by a rule' }, + }, + }, + }, + }, ml_jobs: { type: 'array', items: { @@ -89,7 +247,6 @@ export const registerCollector: RegisterCollector = ({ peak_model_bytes: { type: 'long' }, }, timing_stats: { - average_bucket_processing_time_ms: { type: 'long' }, bucket_count: { type: 'long' }, exponential_average_bucket_processing_time_ms: { type: 'long' }, exponential_average_bucket_processing_time_per_hour_ms: { type: 'long' }, @@ -132,13 +289,13 @@ export const registerCollector: RegisterCollector = ({ }, }, }, - isReady: () => kibanaIndex.length > 0, + isReady: () => true, fetch: async ({ esClient }: CollectorFetchContext): Promise => { const internalSavedObjectsClient = await getInternalSavedObjectsClient(core); const savedObjectsClient = (internalSavedObjectsClient as unknown) as SavedObjectsClientContract; const [detections, detectionMetrics, endpoints] = await Promise.allSettled([ fetchDetectionsUsage(kibanaIndex, esClient, ml, savedObjectsClient), - fetchDetectionsMetrics(ml, savedObjectsClient), + fetchDetectionsMetrics(kibanaIndex, signalsIndex, esClient, ml, savedObjectsClient), getEndpointTelemetryFromFleet(savedObjectsClient, endpointAppContext, esClient), ]); diff --git a/x-pack/plugins/security_solution/server/usage/detections/dectections_metrics_helpers.test.ts b/x-pack/plugins/security_solution/server/usage/detections/dectections_metrics_helpers.test.ts new file mode 100644 index 0000000000000..bd470ccabbfed --- /dev/null +++ b/x-pack/plugins/security_solution/server/usage/detections/dectections_metrics_helpers.test.ts @@ -0,0 +1,147 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import { initialDetectionRulesUsage, updateDetectionRuleUsage } from './detections_metrics_helpers'; +import { DetectionRuleMetric, DetectionRulesTypeUsage } from './index'; +import { v4 as uuid } from 'uuid'; + +const createStubRule = ( + ruleType: string, + enabled: boolean, + elasticRule: boolean, + alertCount: number, + caseCount: number +): DetectionRuleMetric => ({ + rule_name: uuid(), + rule_id: uuid(), + rule_type: ruleType, + enabled, + elastic_rule: elasticRule, + created_on: uuid(), + updated_on: uuid(), + alert_count_daily: alertCount, + cases_count_daily: caseCount, +}); + +describe('Detections Usage and Metrics', () => { + describe('Update metrics with rule information', () => { + it('Should update elastic and eql rule metric total', async () => { + const initialUsage: DetectionRulesTypeUsage = initialDetectionRulesUsage; + const stubRule = createStubRule('eql', true, true, 1, 1); + const usage = updateDetectionRuleUsage(stubRule, initialUsage); + + expect(usage).toEqual( + expect.objectContaining({ + custom_total: { + alerts: 0, + cases: 0, + disabled: 0, + enabled: 0, + }, + elastic_total: { + alerts: 1, + cases: 1, + disabled: 0, + enabled: 1, + }, + eql: { + alerts: 1, + cases: 1, + disabled: 0, + enabled: 1, + }, + machine_learning: { + alerts: 0, + cases: 0, + disabled: 0, + enabled: 0, + }, + query: { + alerts: 0, + cases: 0, + disabled: 0, + enabled: 0, + }, + threat_match: { + alerts: 0, + cases: 0, + disabled: 0, + enabled: 0, + }, + threshold: { + alerts: 0, + cases: 0, + disabled: 0, + enabled: 0, + }, + }) + ); + }); + + it('Should update based on multiple metrics', async () => { + const initialUsage: DetectionRulesTypeUsage = initialDetectionRulesUsage; + const stubEqlRule = createStubRule('eql', true, true, 1, 1); + const stubQueryRuleOne = createStubRule('query', true, true, 5, 2); + const stubQueryRuleTwo = createStubRule('query', true, false, 5, 2); + const stubMachineLearningOne = createStubRule('machine_learning', false, false, 0, 10); + const stubMachineLearningTwo = createStubRule('machine_learning', true, true, 22, 44); + + let usage = updateDetectionRuleUsage(stubEqlRule, initialUsage); + usage = updateDetectionRuleUsage(stubQueryRuleOne, usage); + usage = updateDetectionRuleUsage(stubQueryRuleTwo, usage); + usage = updateDetectionRuleUsage(stubMachineLearningOne, usage); + usage = updateDetectionRuleUsage(stubMachineLearningTwo, usage); + + expect(usage).toEqual( + expect.objectContaining({ + custom_total: { + alerts: 5, + cases: 12, + disabled: 1, + enabled: 1, + }, + elastic_total: { + alerts: 28, + cases: 47, + disabled: 0, + enabled: 3, + }, + eql: { + alerts: 1, + cases: 1, + disabled: 0, + enabled: 1, + }, + machine_learning: { + alerts: 22, + cases: 54, + disabled: 1, + enabled: 1, + }, + query: { + alerts: 10, + cases: 4, + disabled: 0, + enabled: 2, + }, + threat_match: { + alerts: 0, + cases: 0, + disabled: 0, + enabled: 0, + }, + threshold: { + alerts: 0, + cases: 0, + disabled: 0, + enabled: 0, + }, + }) + ); + }); + }); +}); diff --git a/x-pack/plugins/security_solution/server/usage/detections/detection_telemetry_helpers.ts b/x-pack/plugins/security_solution/server/usage/detections/detection_telemetry_helpers.ts new file mode 100644 index 0000000000000..bc1e734e4cc3a --- /dev/null +++ b/x-pack/plugins/security_solution/server/usage/detections/detection_telemetry_helpers.ts @@ -0,0 +1,46 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import { INTERNAL_IMMUTABLE_KEY } from '../../../common/constants'; + +export const isElasticRule = (tags: string[] = []) => + tags.includes(`${INTERNAL_IMMUTABLE_KEY}:true`); + +interface RuleSearchBody { + query: { + bool: { + filter: { + term: { [key: string]: string }; + }; + }; + }; +} + +export interface RuleSearchParams { + body: RuleSearchBody; + filterPath: string[]; + ignoreUnavailable: boolean; + index: string; + size: number; +} + +export interface RuleSearchResult { + alert: { + name: string; + enabled: boolean; + tags: string[]; + createdAt: string; + updatedAt: string; + params: DetectionRuleParms; + }; +} + +interface DetectionRuleParms { + ruleId: string; + version: string; + type: string; +} diff --git a/x-pack/plugins/security_solution/server/usage/detections/detections.mocks.ts b/x-pack/plugins/security_solution/server/usage/detections/detections.mocks.ts index f7fa59958abae..f90841ff4e596 100644 --- a/x-pack/plugins/security_solution/server/usage/detections/detections.mocks.ts +++ b/x-pack/plugins/security_solution/server/usage/detections/detections.mocks.ts @@ -302,3 +302,179 @@ export const getMockMlDatafeedStatsResponse = () => ({ }, ], }); + +export const getMockRuleSearchResponse = (immutableTag: string = '__internal_immutable:true') => ({ + took: 2, + timed_out: false, + _shards: { + total: 1, + successful: 1, + skipped: 0, + failed: 0, + }, + hits: { + total: { + value: 1093, + relation: 'eq', + }, + max_score: 0, + hits: [ + { + _index: '.kibanaindex', + _id: 'alert:6eecd8c2-8bfb-11eb-afbe-1b7a66309c6d', + _score: 0, + _source: { + alert: { + name: 'Azure Diagnostic Settings Deletion', + tags: [ + 'Elastic', + 'Cloud', + 'Azure', + 'Continuous Monitoring', + 'SecOps', + 'Monitoring', + '__internal_rule_id:5370d4cd-2bb3-4d71-abf5-1e1d0ff5a2de', + `${immutableTag}`, + ], + alertTypeId: 'siem.signals', + consumer: 'siem', + params: { + author: ['Elastic'], + description: + 'Identifies the deletion of diagnostic settings in Azure, which send platform logs and metrics to different destinations. An adversary may delete diagnostic settings in an attempt to evade defenses.', + ruleId: '5370d4cd-2bb3-4d71-abf5-1e1d0ff5a2de', + index: ['filebeat-*', 'logs-azure*'], + falsePositives: [ + 'Deletion of diagnostic settings may be done by a system or network administrator. Verify whether the username, hostname, and/or resource name should be making changes in your environment. Diagnostic settings deletion from unfamiliar users or hosts should be investigated. If known behavior is causing false positives, it can be exempted from the rule.', + ], + from: 'now-25m', + immutable: true, + query: + 'event.dataset:azure.activitylogs and azure.activitylogs.operation_name:"MICROSOFT.INSIGHTS/DIAGNOSTICSETTINGS/DELETE" and event.outcome:(Success or success)', + language: 'kuery', + license: 'Elastic License v2', + outputIndex: '.siem-signals', + maxSignals: 100, + riskScore: 47, + timestampOverride: 'event.ingested', + to: 'now', + type: 'query', + references: [ + 'https://docs.microsoft.com/en-us/azure/azure-monitor/platform/diagnostic-settings', + ], + note: 'The Azure Filebeat module must be enabled to use this rule.', + version: 4, + exceptionsList: [], + }, + schedule: { + interval: '5m', + }, + enabled: false, + actions: [], + throttle: null, + notifyWhen: 'onActiveAlert', + apiKeyOwner: null, + apiKey: null, + createdBy: 'user', + updatedBy: 'user', + createdAt: '2021-03-23T17:15:59.634Z', + updatedAt: '2021-03-23T17:15:59.634Z', + muteAll: false, + mutedInstanceIds: [], + executionStatus: { + status: 'pending', + lastExecutionDate: '2021-03-23T17:15:59.634Z', + error: null, + }, + meta: { + versionApiKeyLastmodified: '8.0.0', + }, + }, + type: 'alert', + references: [], + migrationVersion: { + alert: '7.13.0', + }, + coreMigrationVersion: '8.0.0', + updated_at: '2021-03-23T17:15:59.634Z', + }, + }, + ], + }, +}); + +export const getMockRuleAlertsResponse = (docCount: number) => ({ + took: 7, + timed_out: false, + _shards: { + total: 1, + successful: 1, + skipped: 0, + failed: 0, + }, + hits: { + total: { + value: 7322, + relation: 'eq', + }, + max_score: null, + hits: [], + }, + aggregations: { + detectionAlerts: { + doc_count_error_upper_bound: 0, + sum_other_doc_count: 0, + buckets: [ + { + key: '6eecd8c2-8bfb-11eb-afbe-1b7a66309c6d', + doc_count: docCount, + }, + ], + }, + }, +}); + +export const getMockAlertCasesResponse = () => ({ + page: 1, + per_page: 10000, + total: 4, + saved_objects: [ + { + type: 'cases-comments', + id: '3bb5cc10-9249-11eb-85b7-254c8af1a983', + attributes: { + associationType: 'case', + type: 'alert', + alertId: '54802763917f521249c9f68d0d4be0c26cc538404c26dfed1ae7dcfa94ea2226', + index: '.siem-signals-default-000001', + rule: { + id: '6eecd8c2-8bfb-11eb-afbe-1b7a66309c6d', + name: 'Azure Diagnostic Settings Deletion', + }, + created_at: '2021-03-31T17:47:59.449Z', + created_by: { + email: '', + full_name: '', + username: '', + }, + pushed_at: null, + pushed_by: null, + updated_at: null, + updated_by: null, + }, + references: [ + { + type: 'cases', + name: 'associated-cases', + id: '3a3a4fa0-9249-11eb-85b7-254c8af1a983', + }, + ], + migrationVersion: {}, + coreMigrationVersion: '8.0.0', + updated_at: '2021-03-31T17:47:59.818Z', + version: 'WzI3MDIyODMsNF0=', + namespaces: ['default'], + score: 0, + }, + ], +}); diff --git a/x-pack/plugins/security_solution/server/usage/detections/detections.test.ts b/x-pack/plugins/security_solution/server/usage/detections/detections.test.ts index 64a33068ad686..9241186bb6d9c 100644 --- a/x-pack/plugins/security_solution/server/usage/detections/detections.test.ts +++ b/x-pack/plugins/security_solution/server/usage/detections/detections.test.ts @@ -5,8 +5,11 @@ * 2.0. */ -import { ElasticsearchClient, SavedObjectsClientContract } from '../../../../../../src/core/server'; -import { elasticsearchServiceMock } from '../../../../../../src/core/server/mocks'; +import { ElasticsearchClient } from '../../../../../../src/core/server'; +import { + elasticsearchServiceMock, + savedObjectsClientMock, +} from '../../../../../../src/core/server/mocks'; import { mlServicesMock } from '../../lib/machine_learning/mocks'; import { getMockJobSummaryResponse, @@ -15,12 +18,16 @@ import { getMockMlJobDetailsResponse, getMockMlJobStatsResponse, getMockMlDatafeedStatsResponse, + getMockRuleSearchResponse, + getMockRuleAlertsResponse, + getMockAlertCasesResponse, } from './detections.mocks'; import { fetchDetectionsUsage, fetchDetectionsMetrics } from './index'; +const savedObjectsClient = savedObjectsClientMock.create(); + describe('Detections Usage and Metrics', () => { let esClientMock: jest.Mocked; - let savedObjectsClientMock: jest.Mocked; let mlMock: ReturnType; describe('fetchDetectionsUsage()', () => { @@ -30,7 +37,7 @@ describe('Detections Usage and Metrics', () => { }); it('returns zeroed counts if both calls are empty', async () => { - const result = await fetchDetectionsUsage('', esClientMock, mlMock, savedObjectsClientMock); + const result = await fetchDetectionsUsage('', esClientMock, mlMock, savedObjectsClient); expect(result).toEqual({ detection_rules: { @@ -59,7 +66,7 @@ describe('Detections Usage and Metrics', () => { it('tallies rules data given rules results', async () => { (esClientMock.search as jest.Mock).mockResolvedValue({ body: getMockRulesResponse() }); - const result = await fetchDetectionsUsage('', esClientMock, mlMock, savedObjectsClientMock); + const result = await fetchDetectionsUsage('', esClientMock, mlMock, savedObjectsClient); expect(result).toEqual( expect.objectContaining({ @@ -87,7 +94,7 @@ describe('Detections Usage and Metrics', () => { jobsSummary: mockJobSummary, }); - const result = await fetchDetectionsUsage('', esClientMock, mlMock, savedObjectsClientMock); + const result = await fetchDetectionsUsage('', esClientMock, mlMock, savedObjectsClient); expect(result).toEqual( expect.objectContaining({ @@ -106,8 +113,285 @@ describe('Detections Usage and Metrics', () => { }); }); + describe('getDetectionRuleMetrics()', () => { + beforeEach(() => { + esClientMock = elasticsearchServiceMock.createClusterClient().asInternalUser; + mlMock = mlServicesMock.createSetupContract(); + }); + + it('returns zeroed counts if calls are empty', async () => { + const result = await fetchDetectionsMetrics('', '', esClientMock, mlMock, savedObjectsClient); + + expect(result).toEqual( + expect.objectContaining({ + detection_rules: { + detection_rule_detail: [], + detection_rule_usage: { + query: { + enabled: 0, + disabled: 0, + alerts: 0, + cases: 0, + }, + threshold: { + enabled: 0, + disabled: 0, + alerts: 0, + cases: 0, + }, + eql: { + enabled: 0, + disabled: 0, + alerts: 0, + cases: 0, + }, + machine_learning: { + enabled: 0, + disabled: 0, + alerts: 0, + cases: 0, + }, + threat_match: { + enabled: 0, + disabled: 0, + alerts: 0, + cases: 0, + }, + elastic_total: { + enabled: 0, + disabled: 0, + alerts: 0, + cases: 0, + }, + custom_total: { + enabled: 0, + disabled: 0, + alerts: 0, + cases: 0, + }, + }, + }, + ml_jobs: [], + }) + ); + }); + + it('returns information with rule, alerts and cases', async () => { + (esClientMock.search as jest.Mock) + .mockReturnValueOnce({ body: getMockRuleSearchResponse() }) + .mockReturnValue({ body: getMockRuleAlertsResponse(3400) }); + (savedObjectsClient.find as jest.Mock).mockReturnValue(getMockAlertCasesResponse()); + + const result = await fetchDetectionsMetrics('', '', esClientMock, mlMock, savedObjectsClient); + + expect(result).toEqual( + expect.objectContaining({ + detection_rules: { + detection_rule_detail: [ + { + alert_count_daily: 3400, + cases_count_daily: 1, + created_on: '2021-03-23T17:15:59.634Z', + elastic_rule: true, + enabled: false, + rule_id: '6eecd8c2-8bfb-11eb-afbe-1b7a66309c6d', + rule_name: 'Azure Diagnostic Settings Deletion', + rule_type: 'query', + rule_version: 4, + updated_on: '2021-03-23T17:15:59.634Z', + }, + ], + detection_rule_usage: { + custom_total: { + alerts: 0, + cases: 0, + disabled: 0, + enabled: 0, + }, + elastic_total: { + alerts: 3400, + cases: 1, + disabled: 1, + enabled: 0, + }, + eql: { + alerts: 0, + cases: 0, + disabled: 0, + enabled: 0, + }, + machine_learning: { + alerts: 0, + cases: 0, + disabled: 0, + enabled: 0, + }, + query: { + alerts: 3400, + cases: 1, + disabled: 1, + enabled: 0, + }, + threat_match: { + alerts: 0, + cases: 0, + disabled: 0, + enabled: 0, + }, + threshold: { + alerts: 0, + cases: 0, + disabled: 0, + enabled: 0, + }, + }, + }, + ml_jobs: [], + }) + ); + }); + + it('returns information with on non elastic prebuilt rule', async () => { + (esClientMock.search as jest.Mock) + .mockReturnValueOnce({ body: getMockRuleSearchResponse('not_immutable') }) + .mockReturnValue({ body: getMockRuleAlertsResponse(800) }); + (savedObjectsClient.find as jest.Mock).mockReturnValue(getMockAlertCasesResponse()); + + const result = await fetchDetectionsMetrics('', '', esClientMock, mlMock, savedObjectsClient); + + expect(result).toEqual( + expect.objectContaining({ + detection_rules: { + detection_rule_detail: [], // *should not* contain custom detection rule details + detection_rule_usage: { + custom_total: { + alerts: 800, + cases: 1, + disabled: 1, + enabled: 0, + }, + elastic_total: { + alerts: 0, + cases: 0, + disabled: 0, + enabled: 0, + }, + eql: { + alerts: 0, + cases: 0, + disabled: 0, + enabled: 0, + }, + machine_learning: { + alerts: 0, + cases: 0, + disabled: 0, + enabled: 0, + }, + query: { + alerts: 800, + cases: 1, + disabled: 1, + enabled: 0, + }, + threat_match: { + alerts: 0, + cases: 0, + disabled: 0, + enabled: 0, + }, + threshold: { + alerts: 0, + cases: 0, + disabled: 0, + enabled: 0, + }, + }, + }, + ml_jobs: [], + }) + ); + }); + + it('returns information with rule, no alerts and no cases', async () => { + (esClientMock.search as jest.Mock) + .mockReturnValueOnce({ body: getMockRuleSearchResponse() }) + .mockReturnValue({ body: getMockRuleAlertsResponse(0) }); + (savedObjectsClient.find as jest.Mock).mockReturnValue(getMockAlertCasesResponse()); + + const result = await fetchDetectionsMetrics('', '', esClientMock, mlMock, savedObjectsClient); + + expect(result).toEqual( + expect.objectContaining({ + detection_rules: { + detection_rule_detail: [ + { + alert_count_daily: 0, + cases_count_daily: 1, + created_on: '2021-03-23T17:15:59.634Z', + elastic_rule: true, + enabled: false, + rule_id: '6eecd8c2-8bfb-11eb-afbe-1b7a66309c6d', + rule_name: 'Azure Diagnostic Settings Deletion', + rule_type: 'query', + rule_version: 4, + updated_on: '2021-03-23T17:15:59.634Z', + }, + ], + detection_rule_usage: { + custom_total: { + alerts: 0, + cases: 0, + disabled: 0, + enabled: 0, + }, + elastic_total: { + alerts: 0, + cases: 1, + disabled: 1, + enabled: 0, + }, + eql: { + alerts: 0, + cases: 0, + disabled: 0, + enabled: 0, + }, + machine_learning: { + alerts: 0, + cases: 0, + disabled: 0, + enabled: 0, + }, + query: { + alerts: 0, + cases: 1, + disabled: 1, + enabled: 0, + }, + threat_match: { + alerts: 0, + cases: 0, + disabled: 0, + enabled: 0, + }, + threshold: { + alerts: 0, + cases: 0, + disabled: 0, + enabled: 0, + }, + }, + }, + ml_jobs: [], + }) + ); + }); + }); + describe('fetchDetectionsMetrics()', () => { beforeEach(() => { + esClientMock = elasticsearchServiceMock.createClusterClient().asInternalUser; mlMock = mlServicesMock.createSetupContract(); }); @@ -116,7 +400,7 @@ describe('Detections Usage and Metrics', () => { jobs: null, jobStats: null, } as unknown) as ReturnType); - const result = await fetchDetectionsMetrics(mlMock, savedObjectsClientMock); + const result = await fetchDetectionsMetrics('', '', esClientMock, mlMock, savedObjectsClient); expect(result).toEqual( expect.objectContaining({ @@ -138,7 +422,7 @@ describe('Detections Usage and Metrics', () => { datafeedStats: mockDatafeedStatsResponse, } as unknown) as ReturnType); - const result = await fetchDetectionsMetrics(mlMock, savedObjectsClientMock); + const result = await fetchDetectionsMetrics('', '', esClientMock, mlMock, savedObjectsClient); expect(result).toEqual( expect.objectContaining({ @@ -177,7 +461,6 @@ describe('Detections Usage and Metrics', () => { datafeed_id: 'datafeed-high_distinct_count_error_message', state: 'stopped', timing_stats: { - average_search_time_per_bucket_ms: 360.7927310729215, bucket_count: 8612, exponential_average_search_time_per_hour_ms: 86145.39799630083, search_count: 7202, diff --git a/x-pack/plugins/security_solution/server/usage/detections/detections_metrics_helpers.ts b/x-pack/plugins/security_solution/server/usage/detections/detections_metrics_helpers.ts new file mode 100644 index 0000000000000..97fc8c2884289 --- /dev/null +++ b/x-pack/plugins/security_solution/server/usage/detections/detections_metrics_helpers.ts @@ -0,0 +1,378 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import { + ElasticsearchClient, + KibanaRequest, + SavedObjectsClientContract, +} from '../../../../../../src/core/server'; +import { + AlertsAggregationResponse, + CasesSavedObject, + DetectionRulesTypeUsage, + DetectionRuleMetric, + DetectionRuleAdoption, + MlJobMetric, +} from './index'; +import { SIGNALS_ID } from '../../../common/constants'; +import { DatafeedStats, Job, MlPluginSetup } from '../../../../ml/server'; +import { isElasticRule, RuleSearchParams, RuleSearchResult } from './detection_telemetry_helpers'; + +/** + * Default detection rule usage count, split by type + elastic/custom + */ +export const initialDetectionRulesUsage: DetectionRulesTypeUsage = { + query: { + enabled: 0, + disabled: 0, + alerts: 0, + cases: 0, + }, + threshold: { + enabled: 0, + disabled: 0, + alerts: 0, + cases: 0, + }, + eql: { + enabled: 0, + disabled: 0, + alerts: 0, + cases: 0, + }, + machine_learning: { + enabled: 0, + disabled: 0, + alerts: 0, + cases: 0, + }, + threat_match: { + enabled: 0, + disabled: 0, + alerts: 0, + cases: 0, + }, + elastic_total: { + enabled: 0, + disabled: 0, + alerts: 0, + cases: 0, + }, + custom_total: { + enabled: 0, + disabled: 0, + alerts: 0, + cases: 0, + }, +}; + +/* eslint-disable complexity */ +export const updateDetectionRuleUsage = ( + detectionRuleMetric: DetectionRuleMetric, + usage: DetectionRulesTypeUsage +): DetectionRulesTypeUsage => { + let updatedUsage = usage; + + if (detectionRuleMetric.rule_type === 'query') { + updatedUsage = { + ...usage, + query: { + ...usage.query, + enabled: detectionRuleMetric.enabled ? usage.query.enabled + 1 : usage.query.enabled, + disabled: !detectionRuleMetric.enabled ? usage.query.disabled + 1 : usage.query.disabled, + alerts: usage.query.alerts + detectionRuleMetric.alert_count_daily, + cases: usage.query.cases + detectionRuleMetric.cases_count_daily, + }, + }; + } else if (detectionRuleMetric.rule_type === 'threshold') { + updatedUsage = { + ...usage, + threshold: { + ...usage.threshold, + enabled: detectionRuleMetric.enabled + ? usage.threshold.enabled + 1 + : usage.threshold.enabled, + disabled: !detectionRuleMetric.enabled + ? usage.threshold.disabled + 1 + : usage.threshold.disabled, + alerts: usage.threshold.alerts + detectionRuleMetric.alert_count_daily, + cases: usage.threshold.cases + detectionRuleMetric.cases_count_daily, + }, + }; + } else if (detectionRuleMetric.rule_type === 'eql') { + updatedUsage = { + ...usage, + eql: { + ...usage.eql, + enabled: detectionRuleMetric.enabled ? usage.eql.enabled + 1 : usage.eql.enabled, + disabled: !detectionRuleMetric.enabled ? usage.eql.disabled + 1 : usage.eql.disabled, + alerts: usage.eql.alerts + detectionRuleMetric.alert_count_daily, + cases: usage.eql.cases + detectionRuleMetric.cases_count_daily, + }, + }; + } else if (detectionRuleMetric.rule_type === 'machine_learning') { + updatedUsage = { + ...usage, + machine_learning: { + ...usage.machine_learning, + enabled: detectionRuleMetric.enabled + ? usage.machine_learning.enabled + 1 + : usage.machine_learning.enabled, + disabled: !detectionRuleMetric.enabled + ? usage.machine_learning.disabled + 1 + : usage.machine_learning.disabled, + alerts: usage.machine_learning.alerts + detectionRuleMetric.alert_count_daily, + cases: usage.machine_learning.cases + detectionRuleMetric.cases_count_daily, + }, + }; + } else if (detectionRuleMetric.rule_type === 'threat_match') { + updatedUsage = { + ...usage, + threat_match: { + ...usage.threat_match, + enabled: detectionRuleMetric.enabled + ? usage.threat_match.enabled + 1 + : usage.threat_match.enabled, + disabled: !detectionRuleMetric.enabled + ? usage.threat_match.disabled + 1 + : usage.threat_match.disabled, + alerts: usage.threat_match.alerts + detectionRuleMetric.alert_count_daily, + cases: usage.threat_match.cases + detectionRuleMetric.cases_count_daily, + }, + }; + } + + if (detectionRuleMetric.elastic_rule) { + updatedUsage = { + ...updatedUsage, + elastic_total: { + ...updatedUsage.elastic_total, + enabled: detectionRuleMetric.enabled + ? updatedUsage.elastic_total.enabled + 1 + : updatedUsage.elastic_total.enabled, + disabled: !detectionRuleMetric.enabled + ? updatedUsage.elastic_total.disabled + 1 + : updatedUsage.elastic_total.disabled, + alerts: updatedUsage.elastic_total.alerts + detectionRuleMetric.alert_count_daily, + cases: updatedUsage.elastic_total.cases + detectionRuleMetric.cases_count_daily, + }, + }; + } else { + updatedUsage = { + ...updatedUsage, + custom_total: { + ...updatedUsage.custom_total, + enabled: detectionRuleMetric.enabled + ? updatedUsage.custom_total.enabled + 1 + : updatedUsage.custom_total.enabled, + disabled: !detectionRuleMetric.enabled + ? updatedUsage.custom_total.disabled + 1 + : updatedUsage.custom_total.disabled, + alerts: updatedUsage.custom_total.alerts + detectionRuleMetric.alert_count_daily, + cases: updatedUsage.custom_total.cases + detectionRuleMetric.cases_count_daily, + }, + }; + } + + return updatedUsage; +}; + +export const getDetectionRuleMetrics = async ( + kibanaIndex: string, + signalsIndex: string, + esClient: ElasticsearchClient, + savedObjectClient: SavedObjectsClientContract +): Promise => { + let rulesUsage: DetectionRulesTypeUsage = initialDetectionRulesUsage; + const ruleSearchOptions: RuleSearchParams = { + body: { query: { bool: { filter: { term: { 'alert.alertTypeId': SIGNALS_ID } } } } }, + filterPath: [], + ignoreUnavailable: true, + index: kibanaIndex, + size: 1, + }; + + try { + const { body: ruleResults } = await esClient.search(ruleSearchOptions); + const { body: detectionAlertsResp } = (await esClient.search({ + index: `${signalsIndex}*`, + size: 0, + body: { + aggs: { + detectionAlerts: { + terms: { field: 'signal.rule.id.keyword' }, + }, + }, + query: { + bool: { + filter: [ + { + range: { + '@timestamp': { + gte: 'now-24h', + lte: 'now', + }, + }, + }, + ], + }, + }, + }, + })) as { body: AlertsAggregationResponse }; + + const cases = await savedObjectClient.find({ + type: 'cases-comments', + fields: [], + page: 1, + perPage: 10_000, + filter: 'cases-comments.attributes.type: alert', + }); + + const casesCache = cases.saved_objects.reduce((cache, { attributes: casesObject }) => { + const ruleId = casesObject.rule.id; + + const cacheCount = cache.get(ruleId); + if (cacheCount === undefined) { + cache.set(ruleId, 1); + } else { + cache.set(ruleId, cacheCount + 1); + } + return cache; + }, new Map()); + + const alertBuckets = detectionAlertsResp.aggregations?.detectionAlerts?.buckets ?? []; + + const alertsCache = new Map(); + alertBuckets.map((bucket) => alertsCache.set(bucket.key, bucket.doc_count)); + + if (ruleResults.hits?.hits?.length > 0) { + const ruleObjects = ruleResults.hits.hits.map((hit) => { + const ruleId = hit._id.split(':')[1]; + const isElastic = isElasticRule(hit._source?.alert.tags); + return { + rule_name: hit._source?.alert.name, + rule_id: ruleId, + rule_type: hit._source?.alert.params.type, + rule_version: hit._source?.alert.params.version, + enabled: hit._source?.alert.enabled, + elastic_rule: isElastic, + created_on: hit._source?.alert.createdAt, + updated_on: hit._source?.alert.updatedAt, + alert_count_daily: alertsCache.get(ruleId) || 0, + cases_count_daily: casesCache.get(ruleId) || 0, + } as DetectionRuleMetric; + }); + + // Only bring back rule detail on elastic prepackaged detection rules + const elasticRuleObjects = ruleObjects.filter((hit) => hit.elastic_rule === true); + + rulesUsage = ruleObjects.reduce((usage, rule) => { + return updateDetectionRuleUsage(rule, usage); + }, rulesUsage); + + return { + detection_rule_detail: elasticRuleObjects, + detection_rule_usage: rulesUsage, + }; + } + } catch (e) { + // ignore failure, usage will be zeroed + } + + return { + detection_rule_detail: [], + detection_rule_usage: rulesUsage, + }; +}; + +export const getMlJobMetrics = async ( + ml: MlPluginSetup | undefined, + savedObjectClient: SavedObjectsClientContract +): Promise => { + if (ml) { + try { + const fakeRequest = { headers: {} } as KibanaRequest; + const jobsType = 'security'; + const securityJobStats = await ml + .anomalyDetectorsProvider(fakeRequest, savedObjectClient) + .jobStats(jobsType); + + const jobDetails = await ml + .anomalyDetectorsProvider(fakeRequest, savedObjectClient) + .jobs(jobsType); + + const jobDetailsCache = new Map(); + jobDetails.jobs.forEach((detail) => jobDetailsCache.set(detail.job_id, detail)); + + const datafeedStats = await ml + .anomalyDetectorsProvider(fakeRequest, savedObjectClient) + .datafeedStats(); + + const datafeedStatsCache = new Map(); + datafeedStats.datafeeds.forEach((datafeedStat) => + datafeedStatsCache.set(`${datafeedStat.datafeed_id}`, datafeedStat) + ); + + return securityJobStats.jobs.map((stat) => { + const jobId = stat.job_id; + const jobDetail = jobDetailsCache.get(stat.job_id); + const datafeed = datafeedStatsCache.get(`datafeed-${jobId}`); + + return { + job_id: jobId, + open_time: stat.open_time, + create_time: jobDetail?.create_time, + finished_time: jobDetail?.finished_time, + state: stat.state, + data_counts: { + bucket_count: stat.data_counts.bucket_count, + empty_bucket_count: stat.data_counts.empty_bucket_count, + input_bytes: stat.data_counts.input_bytes, + input_record_count: stat.data_counts.input_record_count, + last_data_time: stat.data_counts.last_data_time, + processed_record_count: stat.data_counts.processed_record_count, + }, + model_size_stats: { + bucket_allocation_failures_count: + stat.model_size_stats.bucket_allocation_failures_count, + memory_status: stat.model_size_stats.memory_status, + model_bytes: stat.model_size_stats.model_bytes, + model_bytes_exceeded: stat.model_size_stats.model_bytes_exceeded, + model_bytes_memory_limit: stat.model_size_stats.model_bytes_memory_limit, + peak_model_bytes: stat.model_size_stats.peak_model_bytes, + }, + timing_stats: { + average_bucket_processing_time_ms: stat.timing_stats.average_bucket_processing_time_ms, + bucket_count: stat.timing_stats.bucket_count, + exponential_average_bucket_processing_time_ms: + stat.timing_stats.exponential_average_bucket_processing_time_ms, + exponential_average_bucket_processing_time_per_hour_ms: + stat.timing_stats.exponential_average_bucket_processing_time_per_hour_ms, + maximum_bucket_processing_time_ms: stat.timing_stats.maximum_bucket_processing_time_ms, + minimum_bucket_processing_time_ms: stat.timing_stats.minimum_bucket_processing_time_ms, + total_bucket_processing_time_ms: stat.timing_stats.total_bucket_processing_time_ms, + }, + datafeed: { + datafeed_id: datafeed?.datafeed_id, + state: datafeed?.state, + timing_stats: { + bucket_count: datafeed?.timing_stats.bucket_count, + exponential_average_search_time_per_hour_ms: + datafeed?.timing_stats.exponential_average_search_time_per_hour_ms, + search_count: datafeed?.timing_stats.search_count, + total_search_time_ms: datafeed?.timing_stats.total_search_time_ms, + }, + }, + } as MlJobMetric; + }); + } catch (e) { + // ignore failure, usage will be zeroed + } + } + + return []; +}; diff --git a/x-pack/plugins/security_solution/server/usage/detections/detections_helpers.ts b/x-pack/plugins/security_solution/server/usage/detections/detections_usage_helpers.ts similarity index 51% rename from x-pack/plugins/security_solution/server/usage/detections/detections_helpers.ts rename to x-pack/plugins/security_solution/server/usage/detections/detections_usage_helpers.ts index 211c477027eec..3c666d4d21780 100644 --- a/x-pack/plugins/security_solution/server/usage/detections/detections_helpers.ts +++ b/x-pack/plugins/security_solution/server/usage/detections/detections_usage_helpers.ts @@ -7,42 +7,21 @@ import { ElasticsearchClient, - SavedObjectsClientContract, KibanaRequest, + SavedObjectsClientContract, } from '../../../../../../src/core/server'; -import { MlPluginSetup } from '../../../../ml/server'; -import { SIGNALS_ID, INTERNAL_IMMUTABLE_KEY } from '../../../common/constants'; -import { DetectionRulesUsage, MlJobsUsage, MlJobMetric } from './index'; +import { SIGNALS_ID } from '../../../common/constants'; import { isJobStarted } from '../../../common/machine_learning/helpers'; import { isSecurityJob } from '../../../common/machine_learning/is_security_job'; +import { MlPluginSetup } from '../../../../ml/server'; +import { DetectionRulesUsage, MlJobsUsage } from './index'; +import { isElasticRule, RuleSearchParams, RuleSearchResult } from './detection_telemetry_helpers'; interface DetectionsMetric { isElastic: boolean; isEnabled: boolean; } -interface RuleSearchBody { - query: { - bool: { - filter: { - term: { [key: string]: string }; - }; - }; - }; -} -interface RuleSearchParams { - body: RuleSearchBody; - filterPath: string[]; - ignoreUnavailable: boolean; - index: string; - size: number; -} -interface RuleSearchResult { - alert: { enabled: boolean; tags: string[] }; -} - -const isElasticRule = (tags: string[]) => tags.includes(`${INTERNAL_IMMUTABLE_KEY}:true`); - /** * Default detection rule usage count */ @@ -170,7 +149,6 @@ export const getRulesUsage = async ( if (ruleResults.hits?.hits?.length > 0) { rulesUsage = ruleResults.hits.hits.reduce((usage, hit) => { - // @ts-expect-error _source is optional const isElastic = isElasticRule(hit._source?.alert.tags); const isEnabled = Boolean(hit._source?.alert.enabled); @@ -211,93 +189,3 @@ export const getMlJobsUsage = async ( return jobsUsage; }; - -export const getMlJobMetrics = async ( - ml: MlPluginSetup | undefined, - savedObjectClient: SavedObjectsClientContract -): Promise => { - if (ml) { - try { - const fakeRequest = { headers: {} } as KibanaRequest; - const jobsType = 'security'; - const securityJobStats = await ml - .anomalyDetectorsProvider(fakeRequest, savedObjectClient) - .jobStats(jobsType); - - const jobDetails = await ml - .anomalyDetectorsProvider(fakeRequest, savedObjectClient) - .jobs(jobsType); - - const jobDetailsCache = new Map(); - jobDetails.jobs.forEach((detail) => jobDetailsCache.set(detail.job_id, detail)); - - const datafeedStats = await ml - .anomalyDetectorsProvider(fakeRequest, savedObjectClient) - .datafeedStats(); - - const datafeedStatsCache = new Map(); - datafeedStats.datafeeds.forEach((datafeedStat) => - datafeedStatsCache.set(`${datafeedStat.datafeed_id}`, datafeedStat) - ); - - return securityJobStats.jobs.map((stat) => { - const jobId = stat.job_id; - const jobDetail = jobDetailsCache.get(stat.job_id); - const datafeed = datafeedStatsCache.get(`datafeed-${jobId}`); - - return { - job_id: jobId, - open_time: stat.open_time, - create_time: jobDetail?.create_time, - finished_time: jobDetail?.finished_time, - state: stat.state, - data_counts: { - bucket_count: stat.data_counts.bucket_count, - empty_bucket_count: stat.data_counts.empty_bucket_count, - input_bytes: stat.data_counts.input_bytes, - input_record_count: stat.data_counts.input_record_count, - last_data_time: stat.data_counts.last_data_time, - processed_record_count: stat.data_counts.processed_record_count, - }, - model_size_stats: { - bucket_allocation_failures_count: - stat.model_size_stats.bucket_allocation_failures_count, - memory_status: stat.model_size_stats.memory_status, - model_bytes: stat.model_size_stats.model_bytes, - model_bytes_exceeded: stat.model_size_stats.model_bytes_exceeded, - model_bytes_memory_limit: stat.model_size_stats.model_bytes_memory_limit, - peak_model_bytes: stat.model_size_stats.peak_model_bytes, - }, - timing_stats: { - average_bucket_processing_time_ms: stat.timing_stats.average_bucket_processing_time_ms, - bucket_count: stat.timing_stats.bucket_count, - exponential_average_bucket_processing_time_ms: - stat.timing_stats.exponential_average_bucket_processing_time_ms, - exponential_average_bucket_processing_time_per_hour_ms: - stat.timing_stats.exponential_average_bucket_processing_time_per_hour_ms, - maximum_bucket_processing_time_ms: stat.timing_stats.maximum_bucket_processing_time_ms, - minimum_bucket_processing_time_ms: stat.timing_stats.minimum_bucket_processing_time_ms, - total_bucket_processing_time_ms: stat.timing_stats.total_bucket_processing_time_ms, - }, - datafeed: { - datafeed_id: datafeed?.datafeed_id, - state: datafeed?.state, - timing_stats: { - average_search_time_per_bucket_ms: - datafeed?.timing_stats.average_search_time_per_bucket_ms, - bucket_count: datafeed?.timing_stats.bucket_count, - exponential_average_search_time_per_hour_ms: - datafeed?.timing_stats.exponential_average_search_time_per_hour_ms, - search_count: datafeed?.timing_stats.search_count, - total_search_time_ms: datafeed?.timing_stats.total_search_time_ms, - }, - }, - } as MlJobMetric; - }); - } catch (e) { - // ignore failure, usage will be zeroed - } - } - - return []; -}; diff --git a/x-pack/plugins/security_solution/server/usage/detections/index.ts b/x-pack/plugins/security_solution/server/usage/detections/index.ts index 39c8f3159fe03..cc831b0b3b366 100644 --- a/x-pack/plugins/security_solution/server/usage/detections/index.ts +++ b/x-pack/plugins/security_solution/server/usage/detections/index.ts @@ -8,11 +8,15 @@ import { ElasticsearchClient, SavedObjectsClientContract } from '../../../../../../src/core/server'; import { getMlJobsUsage, - getMlJobMetrics, getRulesUsage, initialRulesUsage, initialMlJobsUsage, -} from './detections_helpers'; +} from './detections_usage_helpers'; +import { + getMlJobMetrics, + getDetectionRuleMetrics, + initialDetectionRulesUsage, +} from './detections_metrics_helpers'; import { MlPluginSetup } from '../../../../ml/server'; interface FeatureUsage { @@ -20,6 +24,23 @@ interface FeatureUsage { disabled: number; } +interface FeatureTypeUsage { + enabled: number; + disabled: number; + alerts: number; + cases: number; +} + +export interface DetectionRulesTypeUsage { + query: FeatureTypeUsage; + threshold: FeatureTypeUsage; + eql: FeatureTypeUsage; + machine_learning: FeatureTypeUsage; + threat_match: FeatureTypeUsage; + elastic_total: FeatureTypeUsage; + custom_total: FeatureTypeUsage; +} + export interface DetectionRulesUsage { custom: FeatureUsage; elastic: FeatureUsage; @@ -37,6 +58,7 @@ export interface DetectionsUsage { export interface DetectionMetrics { ml_jobs: MlJobMetric[]; + detection_rules: DetectionRuleAdoption; } export interface MlJobDataCount { @@ -58,7 +80,6 @@ export interface MlJobModelSize { } export interface MlTimingStats { - average_bucket_processing_time_ms: number; bucket_count: number; exponential_average_bucket_processing_time_ms: number; exponential_average_bucket_processing_time_per_hour_ms: number; @@ -76,6 +97,45 @@ export interface MlJobMetric { timing_stats: MlTimingStats; } +export interface DetectionRuleMetric { + rule_name: string; + rule_id: string; + rule_type: string; + enabled: boolean; + elastic_rule: boolean; + created_on: string; + updated_on: string; + alert_count_daily: number; + cases_count_daily: number; +} + +export interface DetectionRuleAdoption { + detection_rule_detail: DetectionRuleMetric[]; + detection_rule_usage: DetectionRulesTypeUsage; +} + +export interface AlertsAggregationResponse { + hits: { + total: { value: number }; + }; + aggregations: { + [aggName: string]: { + buckets: Array<{ key: string; doc_count: number }>; + }; + }; +} + +export interface CasesSavedObject { + associationType: string; + type: string; + alertId: string; + index: string; + rule: { + id: string; + name: string; + }; +} + export const defaultDetectionsUsage = { detection_rules: initialRulesUsage, ml_jobs: initialMlJobsUsage, @@ -99,12 +159,22 @@ export const fetchDetectionsUsage = async ( }; export const fetchDetectionsMetrics = async ( + kibanaIndex: string, + signalsIndex: string, + esClient: ElasticsearchClient, ml: MlPluginSetup | undefined, savedObjectClient: SavedObjectsClientContract ): Promise => { - const [mlJobMetrics] = await Promise.allSettled([getMlJobMetrics(ml, savedObjectClient)]); + const [mlJobMetrics, detectionRuleMetrics] = await Promise.allSettled([ + getMlJobMetrics(ml, savedObjectClient), + getDetectionRuleMetrics(kibanaIndex, signalsIndex, esClient, savedObjectClient), + ]); return { ml_jobs: mlJobMetrics.status === 'fulfilled' ? mlJobMetrics.value : [], + detection_rules: + detectionRuleMetrics.status === 'fulfilled' + ? detectionRuleMetrics.value + : { detection_rule_detail: [], detection_rule_usage: initialDetectionRulesUsage }, }; }; diff --git a/x-pack/plugins/security_solution/server/usage/types.ts b/x-pack/plugins/security_solution/server/usage/types.ts index c06c8a4722cd7..4e1e647952a72 100644 --- a/x-pack/plugins/security_solution/server/usage/types.ts +++ b/x-pack/plugins/security_solution/server/usage/types.ts @@ -11,6 +11,7 @@ import { SetupPlugins } from '../plugin'; export type CollectorDependencies = { kibanaIndex: string; + signalsIndex: string; core: CoreSetup; endpointAppContext: EndpointAppContext; } & Pick; diff --git a/x-pack/plugins/security_solution/server/utils/build_query/create_options.test.ts b/x-pack/plugins/security_solution/server/utils/build_query/create_options.test.ts deleted file mode 100644 index 4697f02ad5486..0000000000000 --- a/x-pack/plugins/security_solution/server/utils/build_query/create_options.test.ts +++ /dev/null @@ -1,176 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. - */ - -import { omit } from 'lodash/fp'; - -import { DEFAULT_INDEX_PATTERN } from '../../../common/constants'; -import { Direction } from '../../graphql/types'; -import { RequestOptions } from '../../lib/framework'; - -import { Args, Configuration, createOptions, FieldNodes } from './create_options'; - -describe('createOptions', () => { - let source: Configuration; - let args: Args; - let info: FieldNodes; - beforeEach(() => { - source = { - configuration: { - fields: { - host: 'host-1', - container: 'container-1', - message: ['message-1'], - pod: 'pod-1', - tiebreaker: 'tiebreaker', - timestamp: 'timestamp-1', - }, - }, - }; - args = { - defaultIndex: DEFAULT_INDEX_PATTERN, - pagination: { - limit: 5, - }, - docValueFields: [ - { - field: '@timestamp', - format: 'date_time', - }, - { - field: 'event.end', - format: 'date_time', - }, - ], - timerange: { - from: '2020-07-08T08:00:00.000Z', - to: '2020-07-08T20:00:00.000Z', - interval: '12 hours ago', - }, - sortField: { sortFieldId: 'sort-1', direction: Direction.asc }, - }; - info = { - fieldNodes: [ - { - name: { - kind: 'Name', - value: 'value-1', - }, - kind: 'Field', - }, - ], - }; - }); - - test('should create options given all input including sort field', () => { - const options = createOptions(source, args, info); - const expected: RequestOptions = { - defaultIndex: DEFAULT_INDEX_PATTERN, - sourceConfiguration: { - fields: { - host: 'host-1', - container: 'container-1', - message: ['message-1'], - pod: 'pod-1', - tiebreaker: 'tiebreaker', - timestamp: 'timestamp-1', - }, - }, - sortField: { sortFieldId: 'sort-1', direction: Direction.asc }, - pagination: { - limit: 5, - }, - filterQuery: {}, - docValueFields: [ - { - field: '@timestamp', - format: 'date_time', - }, - { - field: 'event.end', - format: 'date_time', - }, - ], - fields: [], - timerange: { - from: '2020-07-08T08:00:00.000Z', - to: '2020-07-08T20:00:00.000Z', - interval: '12 hours ago', - }, - }; - expect(options).toEqual(expected); - }); - - test('should create options given all input except sorting', () => { - const argsWithoutSort: Args = omit('sortField', args); - const options = createOptions(source, argsWithoutSort, info); - const expected: RequestOptions = { - defaultIndex: DEFAULT_INDEX_PATTERN, - sourceConfiguration: { - fields: { - host: 'host-1', - container: 'container-1', - message: ['message-1'], - pod: 'pod-1', - tiebreaker: 'tiebreaker', - timestamp: 'timestamp-1', - }, - }, - pagination: { - limit: 5, - }, - filterQuery: {}, - docValueFields: [ - { - field: '@timestamp', - format: 'date_time', - }, - { - field: 'event.end', - format: 'date_time', - }, - ], - fields: [], - timerange: { - from: '2020-07-08T08:00:00.000Z', - to: '2020-07-08T20:00:00.000Z', - interval: '12 hours ago', - }, - }; - expect(options).toEqual(expected); - }); - - test('should create options given all input except docValueFields', () => { - const argsWithoutSort: Args = omit('docValueFields', args); - const options = createOptions(source, argsWithoutSort, info); - const expected: RequestOptions = { - defaultIndex: DEFAULT_INDEX_PATTERN, - sourceConfiguration: { - fields: { - host: 'host-1', - container: 'container-1', - message: ['message-1'], - pod: 'pod-1', - tiebreaker: 'tiebreaker', - timestamp: 'timestamp-1', - }, - }, - sortField: { sortFieldId: 'sort-1', direction: Direction.asc }, - pagination: { - limit: 5, - }, - filterQuery: {}, - docValueFields: [], - fields: [], - timerange: { - from: '2020-07-08T08:00:00.000Z', - to: '2020-07-08T20:00:00.000Z', - interval: '12 hours ago', - }, - }; - expect(options).toEqual(expected); - }); -}); diff --git a/x-pack/plugins/security_solution/server/utils/build_query/create_options.ts b/x-pack/plugins/security_solution/server/utils/build_query/create_options.ts deleted file mode 100644 index a882b20f59f47..0000000000000 --- a/x-pack/plugins/security_solution/server/utils/build_query/create_options.ts +++ /dev/null @@ -1,88 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. - */ - -import { GraphQLResolveInfo } from 'graphql'; -import { getOr } from 'lodash/fp'; - -import { - PaginationInput, - PaginationInputPaginated, - SortField, - Source, - TimerangeInput, - DocValueFieldsInput, -} from '../../graphql/types'; -import { RequestOptions, RequestOptionsPaginated } from '../../lib/framework'; -import { parseFilterQuery } from '../serialized_query'; - -import { getFields } from '.'; - -export type Configuration = Pick; - -export type FieldNodes = Pick; - -// TODO: Once all the widgets are using sortField, this will be swapped out -// for a generic type Similar to EventsSourceArgs that all GraphQL is using -// and sortField won't be optional and might support multi-sort -export interface Args { - timerange?: TimerangeInput | null; - pagination?: PaginationInput | null; - filterQuery?: string | null; - sortField?: SortField | null; - defaultIndex: string[]; - docValueFields?: DocValueFieldsInput[]; -} -export interface ArgsPaginated { - timerange?: TimerangeInput | null; - pagination?: PaginationInputPaginated | null; - filterQuery?: string | null; - sortField?: SortField | null; - defaultIndex: string[]; - docValueFields?: DocValueFieldsInput[]; -} - -export const createOptions = ( - source: Configuration, - args: Args, - info: FieldNodes, - fieldReplacement: string = 'edges.node.' -): RequestOptions => { - const fields = getFields(getOr([], 'fieldNodes[0]', info)); - return { - defaultIndex: args.defaultIndex, - docValueFields: args.docValueFields ?? [], - sourceConfiguration: source.configuration, - timerange: args.timerange!, - pagination: args.pagination!, - sortField: args.sortField!, - filterQuery: parseFilterQuery(args.filterQuery || ''), - fields: fields - .filter((field) => !field.includes('__typename')) - .map((field) => field.replace(fieldReplacement, '')), - }; -}; - -export const createOptionsPaginated = ( - source: Configuration, - args: ArgsPaginated, - info: FieldNodes, - fieldReplacement: string = 'edges.node.' -): RequestOptionsPaginated => { - const fields = getFields(getOr([], 'fieldNodes[0]', info)); - return { - defaultIndex: args.defaultIndex, - docValueFields: args.docValueFields ?? [], - sourceConfiguration: source.configuration, - timerange: args.timerange!, - pagination: args.pagination!, - sortField: args.sortField!, - filterQuery: parseFilterQuery(args.filterQuery || ''), - fields: fields - .filter((field) => !field.includes('__typename')) - .map((field) => field.replace(fieldReplacement, '')), - }; -}; diff --git a/x-pack/plugins/security_solution/server/utils/build_query/field.mock.ts b/x-pack/plugins/security_solution/server/utils/build_query/field.mock.ts deleted file mode 100644 index 3c8d1b4c1d6b3..0000000000000 --- a/x-pack/plugins/security_solution/server/utils/build_query/field.mock.ts +++ /dev/null @@ -1,172 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. - */ - -import { FieldNode } from 'graphql'; - -export const mockFields: FieldNode = { - kind: 'Field', - name: { - kind: 'Name', - value: 'Hosts', - }, - selectionSet: { - kind: 'SelectionSet', - selections: [ - { - kind: 'Field', - name: { - kind: 'Name', - value: 'totalCount', - }, - arguments: [], - directives: [], - }, - { - kind: 'Field', - name: { - kind: 'Name', - value: 'edges', - }, - arguments: [], - directives: [], - selectionSet: { - kind: 'SelectionSet', - selections: [ - { - kind: 'Field', - name: { - kind: 'Name', - value: 'host', - }, - arguments: [], - directives: [], - selectionSet: { - kind: 'SelectionSet', - selections: [ - { - kind: 'Field', - name: { - kind: 'Name', - value: '_id', - }, - arguments: [], - directives: [], - }, - { - kind: 'Field', - name: { - kind: 'Name', - value: 'name', - }, - arguments: [], - directives: [], - }, - { - kind: 'Field', - name: { - kind: 'Name', - value: 'os', - }, - arguments: [], - directives: [], - }, - { - kind: 'Field', - name: { - kind: 'Name', - value: 'version', - }, - arguments: [], - directives: [], - }, - { - kind: 'Field', - name: { - kind: 'Name', - value: 'firstSeen', - }, - arguments: [], - directives: [], - }, - ], - }, - }, - { - kind: 'Field', - name: { - kind: 'Name', - value: 'cursor', - }, - arguments: [], - directives: [], - selectionSet: { - kind: 'SelectionSet', - selections: [ - { - kind: 'Field', - name: { - kind: 'Name', - value: 'value', - }, - arguments: [], - directives: [], - }, - ], - }, - }, - ], - }, - }, - { - kind: 'Field', - name: { - kind: 'Name', - value: 'pageInfo', - }, - arguments: [], - directives: [], - selectionSet: { - kind: 'SelectionSet', - selections: [ - { - kind: 'Field', - name: { - kind: 'Name', - value: 'endCursor', - }, - arguments: [], - directives: [], - selectionSet: { - kind: 'SelectionSet', - selections: [ - { - kind: 'Field', - name: { - kind: 'Name', - value: 'value', - }, - arguments: [], - directives: [], - }, - ], - }, - }, - { - kind: 'Field', - name: { - kind: 'Name', - value: 'hasNextPage', - }, - arguments: [], - directives: [], - }, - ], - }, - }, - ], - }, -}; diff --git a/x-pack/plugins/security_solution/server/utils/build_query/fields.test.ts b/x-pack/plugins/security_solution/server/utils/build_query/fields.test.ts deleted file mode 100644 index b34a3f7ed63a6..0000000000000 --- a/x-pack/plugins/security_solution/server/utils/build_query/fields.test.ts +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. - */ - -import { mockFields } from './field.mock'; -import { getFields } from './fields'; - -describe('the ConfigurationSourcesAdapter', () => { - test('adds the default source when no sources are configured', async () => { - const expectedData = [ - 'totalCount', - 'edges.host._id', - 'edges.host.name', - 'edges.host.os', - 'edges.host.version', - 'edges.host.firstSeen', - 'edges.cursor.value', - 'pageInfo.endCursor.value', - 'pageInfo.hasNextPage', - ]; - - expect(getFields(mockFields)).toEqual(expectedData); - }); -}); diff --git a/x-pack/plugins/security_solution/server/utils/build_query/fields.ts b/x-pack/plugins/security_solution/server/utils/build_query/fields.ts deleted file mode 100644 index da7fb1e2af819..0000000000000 --- a/x-pack/plugins/security_solution/server/utils/build_query/fields.ts +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. - */ - -import { FieldNode, SelectionNode, SelectionSetNode } from 'graphql'; -import { isEmpty } from 'lodash/fp'; - -export const getFields = ( - data: SelectionSetNode | FieldNode, - fields: string[] = [], - postFields: string[] = [] -): string[] => { - if (data.kind === 'Field' && data.selectionSet && !isEmpty(data.selectionSet.selections)) { - return getFields(data.selectionSet, fields); - } else if (data.kind === 'SelectionSet') { - return data.selections.reduce((res: string[], item: SelectionNode) => { - if (item.kind === 'Field') { - const field: FieldNode = item as FieldNode; - if (field.name.kind === 'Name' && field.name.value.includes('kpi')) { - return [...res, field.name.value]; - } else if (field.selectionSet && !isEmpty(field.selectionSet.selections)) { - return getFields(field.selectionSet, res, postFields.concat(field.name.value)); - } - return [...res, [...postFields, field.name.value].join('.')]; - } - return res; - }, fields as string[]); - } - - return fields; -}; diff --git a/x-pack/plugins/security_solution/server/utils/build_query/index.ts b/x-pack/plugins/security_solution/server/utils/build_query/index.ts index 7e06b6dbaa89a..61c4831f7f72f 100644 --- a/x-pack/plugins/security_solution/server/utils/build_query/index.ts +++ b/x-pack/plugins/security_solution/server/utils/build_query/index.ts @@ -5,7 +5,6 @@ * 2.0. */ -export * from './fields'; export * from './filters'; export * from './merge_fields_with_hits'; export * from './calculate_timeseries_interval'; diff --git a/x-pack/plugins/security_solution/server/utils/serialized_query.ts b/x-pack/plugins/security_solution/server/utils/serialized_query.ts index d323e4a8ed8f5..fb5009eefa318 100644 --- a/x-pack/plugins/security_solution/server/utils/serialized_query.ts +++ b/x-pack/plugins/security_solution/server/utils/serialized_query.ts @@ -5,7 +5,6 @@ * 2.0. */ -import { UserInputError } from 'apollo-server-errors'; import { isEmpty, isPlainObject, isString } from 'lodash/fp'; import { JsonObject } from '../../../../../src/plugins/kibana_utils/common'; @@ -25,9 +24,8 @@ export const parseFilterQuery = (filterQuery: string): JsonObject => { } return {}; } catch (err) { - throw new UserInputError(`Failed to parse query: ${err}`, { - query: filterQuery, - originalError: err, - }); + throw new Error( + `Failed to parse query: ${JSON.stringify(err)}, query: ${JSON.stringify(filterQuery)}` + ); } }; diff --git a/x-pack/plugins/security_solution/server/utils/typed_resolvers.ts b/x-pack/plugins/security_solution/server/utils/typed_resolvers.ts deleted file mode 100644 index 96156797892dc..0000000000000 --- a/x-pack/plugins/security_solution/server/utils/typed_resolvers.ts +++ /dev/null @@ -1,108 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. - */ - -import { GraphQLResolveInfo } from 'graphql'; - -// eslint-disable-next-line @typescript-eslint/no-explicit-any -export type Resolver = ( - parent: Parent, - args: Args, - context: TContext, - info: GraphQLResolveInfo -) => Promise | Result; - -type ResolverResult = R | Promise; - -type AppResolverResult = - | Promise - | Promise<{ [P in keyof R]: () => Promise }> - | { [P in keyof R]: () => Promise } - | { [P in keyof R]: () => R[P] } - | R; - -export type ResultOf = Resolver_ extends Resolver> - ? Result - : never; - -export type SubsetResolverWithFields = R extends Resolver< - Array, - infer ParentInArray, - infer ContextInArray, - infer ArgsInArray -> - ? Resolver< - Array>>, - ParentInArray, - ContextInArray, - ArgsInArray - > - : R extends Resolver - ? Resolver>, Parent, Context, Args> - : never; - -export type SubsetResolverWithoutFields = R extends Resolver< - Array, - infer ParentInArray, - infer ContextInArray, - infer ArgsInArray -> - ? Resolver< - Array>>, - ParentInArray, - ContextInArray, - ArgsInArray - > - : R extends Resolver - ? Resolver>, Parent, Context, Args> - : never; - -export type ResolverWithParent = Resolver_ extends Resolver< - infer Result, - // eslint-disable-next-line @typescript-eslint/no-explicit-any - any, - infer Context, - infer Args -> - ? Resolver - : never; - -// eslint-disable-next-line @typescript-eslint/no-explicit-any -export type AppResolver = Resolver< - AppResolverResult, - Parent, - Context, - Args ->; - -export type AppResolverOf = Resolver_ extends Resolver< - ResolverResult, - never, - infer ContextWithNeverParent, - infer ArgsWithNeverParent -> - ? AppResolver - : Resolver_ extends Resolver< - ResolverResult, - infer Parent, - infer Context, - infer Args - > - ? AppResolver - : never; - -export type AppResolverWithFields = AppResolverOf< - SubsetResolverWithFields ->; - -export type AppResolverWithoutFields = AppResolverOf< - SubsetResolverWithoutFields ->; - -export type ChildResolverOf = ResolverWithParent< - Resolver_, - ResultOf ->; diff --git a/x-pack/plugins/snapshot_restore/public/application/sections/home/_home.scss b/x-pack/plugins/snapshot_restore/public/application/sections/home/_home.scss index 468ada5c2712a..f9bdaf2bf4b1a 100644 --- a/x-pack/plugins/snapshot_restore/public/application/sections/home/_home.scss +++ b/x-pack/plugins/snapshot_restore/public/application/sections/home/_home.scss @@ -29,18 +29,3 @@ display: flex; } } - -/* - * Wraps long snapshot name with ellipsis when it is rendered with an icon - */ -.snapshotRestorePolicyTableSnapshotFailureContainer { - max-width: 200px; - > .euiFlexItem:last-child { - min-width: 0; - .euiText { - white-space: nowrap; - overflow: hidden; - text-overflow: ellipsis; - } - } -} diff --git a/x-pack/plugins/snapshot_restore/public/application/sections/home/policy_list/policy_table/policy_table.tsx b/x-pack/plugins/snapshot_restore/public/application/sections/home/policy_list/policy_table/policy_table.tsx index 830b9985f86fd..92ee611df61b7 100644 --- a/x-pack/plugins/snapshot_restore/public/application/sections/home/policy_list/policy_table/policy_table.tsx +++ b/x-pack/plugins/snapshot_restore/public/application/sections/home/policy_list/policy_table/policy_table.tsx @@ -117,11 +117,7 @@ export const PolicyTable: React.FunctionComponent = ({ // Alert user if last snapshot failed if (lastSuccess && lastFailure && lastFailure.time > lastSuccess.time) { return ( - + ', '/', '?']; +export const INVALID_NAME_CHARS = ['"', '*', '\\', '<', '|', ',', '>', '/', '?', '#']; const isStringEmpty = (str: string | null): boolean => { return str ? !Boolean(str.trim()) : true; diff --git a/x-pack/plugins/stack_alerts/server/alert_types/es_query/alert_type.ts b/x-pack/plugins/stack_alerts/server/alert_types/es_query/alert_type.ts index 990ab9c1f6002..ece193e07d776 100644 --- a/x-pack/plugins/stack_alerts/server/alert_types/es_query/alert_type.ts +++ b/x-pack/plugins/stack_alerts/server/alert_types/es_query/alert_type.ts @@ -216,46 +216,47 @@ export function getAlertType( const { body: searchResult } = await esClient.search(query); - if (searchResult.hits.hits.length > 0) { - const numMatches = (searchResult.hits.total as estypes.TotalHits).value; - logger.debug(`alert ${ES_QUERY_ID}:${alertId} "${name}" query has ${numMatches} matches`); - - // apply the alert condition - const conditionMet = compareFn(numMatches, params.threshold); - - if (conditionMet) { - const humanFn = i18n.translate( - 'xpack.stackAlerts.esQuery.alertTypeContextConditionsDescription', - { - defaultMessage: `Number of matching documents is {thresholdComparator} {threshold}`, - values: { - thresholdComparator: getHumanReadableComparator(params.thresholdComparator), - threshold: params.threshold.join(' and '), - }, - } - ); - - const baseContext: EsQueryAlertActionContext = { - date: new Date().toISOString(), - value: numMatches, - conditions: humanFn, - hits: searchResult.hits.hits, - }; - - const actionContext = addMessages(options, baseContext, params); - const alertInstance = options.services.alertInstanceFactory(ConditionMetAlertInstanceId); - alertInstance - // store the params we would need to recreate the query that led to this alert instance - .replaceState({ latestTimestamp: timestamp, dateStart, dateEnd }) - .scheduleActions(ActionGroupId, actionContext); - - // update the timestamp based on the current search results - const firstValidTimefieldSort = getValidTimefieldSort( - searchResult.hits.hits.find((hit) => getValidTimefieldSort(hit.sort))?.sort - ); - if (firstValidTimefieldSort) { - timestamp = firstValidTimefieldSort; + logger.debug( + `alert ${ES_QUERY_ID}:${alertId} "${name}" result - ${JSON.stringify(searchResult)}` + ); + + const numMatches = (searchResult.hits.total as estypes.TotalHits).value; + + // apply the alert condition + const conditionMet = compareFn(numMatches, params.threshold); + + if (conditionMet) { + const humanFn = i18n.translate( + 'xpack.stackAlerts.esQuery.alertTypeContextConditionsDescription', + { + defaultMessage: `Number of matching documents is {thresholdComparator} {threshold}`, + values: { + thresholdComparator: getHumanReadableComparator(params.thresholdComparator), + threshold: params.threshold.join(' and '), + }, } + ); + + const baseContext: EsQueryAlertActionContext = { + date: new Date().toISOString(), + value: numMatches, + conditions: humanFn, + hits: searchResult.hits.hits, + }; + + const actionContext = addMessages(options, baseContext, params); + const alertInstance = options.services.alertInstanceFactory(ConditionMetAlertInstanceId); + alertInstance + // store the params we would need to recreate the query that led to this alert instance + .replaceState({ latestTimestamp: timestamp, dateStart, dateEnd }) + .scheduleActions(ActionGroupId, actionContext); + + // update the timestamp based on the current search results + const firstValidTimefieldSort = getValidTimefieldSort( + searchResult.hits.hits.find((hit) => getValidTimefieldSort(hit.sort))?.sort + ); + if (firstValidTimefieldSort) { + timestamp = firstValidTimefieldSort; } } diff --git a/x-pack/plugins/task_manager/server/index.ts b/x-pack/plugins/task_manager/server/index.ts index a34f5a87fddbe..9d2f8f4189ae1 100644 --- a/x-pack/plugins/task_manager/server/index.ts +++ b/x-pack/plugins/task_manager/server/index.ts @@ -20,6 +20,7 @@ export { RunContext, } from './task'; +export { asInterval } from './lib/intervals'; export { isUnrecoverableError, throwUnrecoverableError } from './task_running'; export { diff --git a/x-pack/plugins/task_manager/server/mocks.ts b/x-pack/plugins/task_manager/server/mocks.ts index 3a45cefd9bda5..c713e1e98a1e3 100644 --- a/x-pack/plugins/task_manager/server/mocks.ts +++ b/x-pack/plugins/task_manager/server/mocks.ts @@ -9,6 +9,7 @@ import { TaskManagerSetupContract, TaskManagerStartContract } from './plugin'; const createSetupMock = () => { const mock: jest.Mocked = { + index: '.kibana_task_manager', addMiddleware: jest.fn(), registerTaskDefinitions: jest.fn(), }; diff --git a/x-pack/plugins/task_manager/server/plugin.ts b/x-pack/plugins/task_manager/server/plugin.ts index 507a021214a90..51199da26ee7d 100644 --- a/x-pack/plugins/task_manager/server/plugin.ts +++ b/x-pack/plugins/task_manager/server/plugin.ts @@ -28,10 +28,13 @@ import { TaskScheduling } from './task_scheduling'; import { healthRoute } from './routes'; import { createMonitoringStats, MonitoringStats } from './monitoring'; -export type TaskManagerSetupContract = { addMiddleware: (middleware: Middleware) => void } & Pick< - TaskTypeDictionary, - 'registerTaskDefinitions' ->; +export type TaskManagerSetupContract = { + /** + * @deprecated + */ + index: string; + addMiddleware: (middleware: Middleware) => void; +} & Pick; export type TaskManagerStartContract = Pick< TaskScheduling, @@ -95,6 +98,7 @@ export class TaskManagerPlugin }); return { + index: this.config.index, addMiddleware: (middleware: Middleware) => { this.assertStillInSetup('add Middleware'); this.middleware = addMiddlewareToChain(this.middleware, middleware); diff --git a/x-pack/plugins/telemetry_collection_xpack/schema/xpack_plugins.json b/x-pack/plugins/telemetry_collection_xpack/schema/xpack_plugins.json index 1d1cd8c0c7667..50933335710da 100644 --- a/x-pack/plugins/telemetry_collection_xpack/schema/xpack_plugins.json +++ b/x-pack/plugins/telemetry_collection_xpack/schema/xpack_plugins.json @@ -325,6 +325,9 @@ "nodejs": { "type": "long" }, + "php": { + "type": "long" + }, "python": { "type": "long" }, @@ -791,6 +794,90 @@ } } }, + "php": { + "properties": { + "agent": { + "properties": { + "version": { + "type": "array", + "items": { + "type": "keyword" + } + } + } + }, + "service": { + "properties": { + "framework": { + "properties": { + "name": { + "type": "array", + "items": { + "type": "keyword" + } + }, + "version": { + "type": "array", + "items": { + "type": "keyword" + } + }, + "composite": { + "type": "array", + "items": { + "type": "keyword" + } + } + } + }, + "language": { + "properties": { + "name": { + "type": "array", + "items": { + "type": "keyword" + } + }, + "version": { + "type": "array", + "items": { + "type": "keyword" + } + }, + "composite": { + "type": "array", + "items": { + "type": "keyword" + } + } + } + }, + "runtime": { + "properties": { + "name": { + "type": "array", + "items": { + "type": "keyword" + } + }, + "version": { + "type": "array", + "items": { + "type": "keyword" + } + }, + "composite": { + "type": "array", + "items": { + "type": "keyword" + } + } + } + } + } + } + } + }, "python": { "properties": { "agent": { @@ -1578,25 +1665,40 @@ "workpads": { "properties": { "total": { - "type": "long" + "type": "long", + "_meta": { + "description": "The total number of Canvas Workpads in the cluster" + } } } }, "pages": { "properties": { "total": { - "type": "long" + "type": "long", + "_meta": { + "description": "The total number of pages across all Canvas Workpads" + } }, "per_workpad": { "properties": { "avg": { - "type": "float" + "type": "float", + "_meta": { + "description": "The average number of pages across all Canvas Workpads" + } }, "min": { - "type": "long" + "type": "long", + "_meta": { + "description": "The minimum number of pages found in a Canvas Workpad" + } }, "max": { - "type": "long" + "type": "long", + "_meta": { + "description": "The maximum number of pages found in a Canvas Workpad" + } } } } @@ -1605,18 +1707,30 @@ "elements": { "properties": { "total": { - "type": "long" + "type": "long", + "_meta": { + "description": "The total number of elements across all Canvas Workpads" + } }, "per_page": { "properties": { "avg": { - "type": "float" + "type": "float", + "_meta": { + "description": "The average number of elements per page across all Canvas Workpads" + } }, "min": { - "type": "long" + "type": "long", + "_meta": { + "description": "The minimum number of elements on a page across all Canvas Workpads" + } }, "max": { - "type": "long" + "type": "long", + "_meta": { + "description": "The maximum number of elements on a page across all Canvas Workpads" + } } } } @@ -1625,24 +1739,57 @@ "functions": { "properties": { "total": { - "type": "long" + "type": "long", + "_meta": { + "description": "The total number of functions in use across all Canvas Workpads" + } }, "in_use": { "type": "array", "items": { - "type": "keyword" + "type": "keyword", + "_meta": { + "description": "A function in use in any Canvas Workpad" + } + } + }, + "in_use_30d": { + "type": "array", + "items": { + "type": "keyword", + "_meta": { + "description": "A function in use in a Canvas Workpad that has been modified in the last 30 days" + } + } + }, + "in_use_90d": { + "type": "array", + "items": { + "type": "keyword", + "_meta": { + "description": "A function in use in a Canvas Workpad that has been modified in the last 90 days" + } } }, "per_element": { "properties": { "avg": { - "type": "float" + "type": "float", + "_meta": { + "description": "Average number of functions used per element across all Canvas Workpads" + } }, "min": { - "type": "long" + "type": "long", + "_meta": { + "description": "The minimum number of functions used in an element across all Canvas Workpads" + } }, "max": { - "type": "long" + "type": "long", + "_meta": { + "description": "The maximum number of functions used in an element across all Canvas Workpads" + } } } } @@ -1651,18 +1798,30 @@ "variables": { "properties": { "total": { - "type": "long" + "type": "long", + "_meta": { + "description": "The total number of variables defined across all Canvas Workpads" + } }, "per_workpad": { "properties": { "avg": { - "type": "float" + "type": "float", + "_meta": { + "description": "The average number of variables set per Canvas Workpad" + } }, "min": { - "type": "long" + "type": "long", + "_meta": { + "description": "The minimum number variables set across all Canvas Workpads" + } }, "max": { - "type": "long" + "type": "long", + "_meta": { + "description": "The maximum number of variables set across all Canvas Workpads" + } } } } @@ -1671,25 +1830,40 @@ "custom_elements": { "properties": { "count": { - "type": "long" + "type": "long", + "_meta": { + "description": "The total number of custom Canvas elements" + } }, "elements": { "properties": { "min": { - "type": "long" + "type": "long", + "_meta": { + "description": "The minimum number of elements used across all Canvas Custom Elements" + } }, "max": { - "type": "long" + "type": "long", + "_meta": { + "description": "The maximum number of elements used across all Canvas Custom Elements" + } }, "avg": { - "type": "float" + "type": "float", + "_meta": { + "description": "The average number of elements used in Canvas Custom Element" + } } } }, "functions_in_use": { "type": "array", "items": { - "type": "keyword" + "type": "keyword", + "_meta": { + "description": "The functions in use by Canvas Custom Elements" + } } } } @@ -2558,105 +2732,771 @@ "timeCaptured": { "type": "date" }, - "attributesPerMap": { + "layerTypes": { "properties": { - "dataSourcesCount": { + "ems_basemap": { "properties": { "min": { - "type": "long" + "type": "long", + "_meta": { + "description": "min number of ems basemap layers per map" + } }, "max": { - "type": "long" + "type": "long", + "_meta": { + "description": "max number of ems basemap layers per map" + } }, "avg": { - "type": "float" + "type": "float", + "_meta": { + "description": "avg number of ems basemap layers per map" + } + }, + "total": { + "type": "long", + "_meta": { + "description": "total number of ems basemap layers in cluster" + } } } }, - "layersCount": { + "ems_region": { "properties": { "min": { - "type": "long" + "type": "long", + "_meta": { + "description": "min number of ems file layers per map" + } }, "max": { - "type": "long" + "type": "long", + "_meta": { + "description": "max number of ems file layers per map" + } }, "avg": { - "type": "float" + "type": "float", + "_meta": { + "description": "avg number of ems file layers per map" + } + }, + "total": { + "type": "long", + "_meta": { + "description": "total number of file layers in cluster" + } } } }, - "layerTypesCount": { + "es_agg_clusters": { "properties": { - "DYNAMIC_KEY": { - "properties": { - "min": { - "type": "long" - }, - "max": { - "type": "long" - }, - "avg": { - "type": "float" - } + "min": { + "type": "long", + "_meta": { + "description": "min number of es cluster layers per map" + } + }, + "max": { + "type": "long", + "_meta": { + "description": "max number of es cluster layers per map" + } + }, + "avg": { + "type": "float", + "_meta": { + "description": "avg number of es cluster layers per map" + } + }, + "total": { + "type": "long", + "_meta": { + "description": "total number of es cluster layers in cluster" } } } }, - "emsVectorLayersCount": { + "es_agg_grids": { "properties": { - "DYNAMIC_KEY": { - "properties": { - "min": { - "type": "long" - }, - "max": { - "type": "long" - }, - "avg": { - "type": "float" - } + "min": { + "type": "long", + "_meta": { + "description": "min number of es grid layers per map" + } + }, + "max": { + "type": "long", + "_meta": { + "description": "max number of es grid layers per map" + } + }, + "avg": { + "type": "float", + "_meta": { + "description": "avg number of es grid layers per map" + } + }, + "total": { + "type": "long", + "_meta": { + "description": "total number of es grid layers in cluster" } } } - } - } - } - } - }, - "kibana_settings": { - "properties": { - "xpack": { - "properties": { - "default_admin_email": { - "type": "text" - } - } - } - } - }, - "monitoring": { - "properties": { - "hasMonitoringData": { - "type": "boolean" - }, - "clusters": { - "type": "array", - "items": { - "properties": { - "license": { - "type": "keyword" - }, - "clusterUuid": { - "type": "keyword" - }, - "metricbeatUsed": { - "type": "boolean" - }, - "elasticsearch": { - "properties": { - "enabled": { - "type": "boolean" + }, + "es_agg_heatmap": { + "properties": { + "min": { + "type": "long", + "_meta": { + "description": "min number of es heatmap layers per map" + } + }, + "max": { + "type": "long", + "_meta": { + "description": "max number of es heatmap layers per map" + } + }, + "avg": { + "type": "float", + "_meta": { + "description": "avg number of es heatmap layers per map" + } + }, + "total": { + "type": "long", + "_meta": { + "description": "total number of es heatmap layers in cluster" + } + } + } + }, + "es_top_hits": { + "properties": { + "min": { + "type": "long", + "_meta": { + "description": "min number of es top hits layers per map" + } + }, + "max": { + "type": "long", + "_meta": { + "description": "max number of es top hits layers per map" + } + }, + "avg": { + "type": "float", + "_meta": { + "description": "avg number of es top hits layers per map" + } + }, + "total": { + "type": "long", + "_meta": { + "description": "total number of es top hits layers in cluster" + } + } + } + }, + "es_docs": { + "properties": { + "min": { + "type": "long", + "_meta": { + "description": "min number of es document layers per map" + } + }, + "max": { + "type": "long", + "_meta": { + "description": "max number of es document layers per map" + } + }, + "avg": { + "type": "float", + "_meta": { + "description": "avg number of es document layers per map" + } + }, + "total": { + "type": "long", + "_meta": { + "description": "total number of es document layers in cluster" + } + } + } + }, + "es_point_to_point": { + "properties": { + "min": { + "type": "long", + "_meta": { + "description": "min number of es point-to-point layers per map" + } + }, + "max": { + "type": "long", + "_meta": { + "description": "max number of es point-to-point layers per map" + } + }, + "avg": { + "type": "float", + "_meta": { + "description": "avg number of es point-to-point layers per map" + } + }, + "total": { + "type": "long", + "_meta": { + "description": "total number of es point-to-point layers in cluster" + } + } + } + }, + "es_tracks": { + "properties": { + "min": { + "type": "long", + "_meta": { + "description": "min number of es track layers per map" + } + }, + "max": { + "type": "long", + "_meta": { + "description": "max number of es track layers per map" + } + }, + "avg": { + "type": "float", + "_meta": { + "description": "avg number of es track layers per map" + } + }, + "total": { + "type": "long", + "_meta": { + "description": "total number of es track layers in cluster" + } + } + } + }, + "kbn_region": { + "properties": { + "min": { + "type": "long", + "_meta": { + "description": "min number of kbn region layers per map" + } + }, + "max": { + "type": "long", + "_meta": { + "description": "max number of kbn region layers per map" + } + }, + "avg": { + "type": "float", + "_meta": { + "description": "avg number of kbn region layers per map" + } + }, + "total": { + "type": "long", + "_meta": { + "description": "total number of kbn region layers in cluster" + } + } + } + }, + "kbn_tms_raster": { + "properties": { + "min": { + "type": "long", + "_meta": { + "description": "min number of kbn tms layers per map" + } + }, + "max": { + "type": "long", + "_meta": { + "description": "max number of kbn tms layers per map" + } + }, + "avg": { + "type": "float", + "_meta": { + "description": "avg number of kbn tms layers per map" + } + }, + "total": { + "type": "long", + "_meta": { + "description": "total number of kbn tms layers in cluster" + } + } + } + }, + "ux_tms_mvt": { + "properties": { + "min": { + "type": "long", + "_meta": { + "description": "min number of ux tms-mvt layers per map" + } + }, + "max": { + "type": "long", + "_meta": { + "description": "max number of ux tms-mvt layers per map" + } + }, + "avg": { + "type": "float", + "_meta": { + "description": "avg number of ux tms-mvt layers per map" + } + }, + "total": { + "type": "long", + "_meta": { + "description": "total number of ux tms-mvt layers in cluster" + } + } + } + }, + "ux_tms_raster": { + "properties": { + "min": { + "type": "long", + "_meta": { + "description": "min number of ux tms-raster layers per map" + } + }, + "max": { + "type": "long", + "_meta": { + "description": "max number of ux tms-raster layers per map" + } + }, + "avg": { + "type": "float", + "_meta": { + "description": "avg number of ux tms-raster layers per map" + } + }, + "total": { + "type": "long", + "_meta": { + "description": "total number of ux-tms raster layers in cluster" + } + } + } + }, + "ux_wms": { + "properties": { + "min": { + "type": "long", + "_meta": { + "description": "min number of ux wms layers per map" + } + }, + "max": { + "type": "long", + "_meta": { + "description": "max number of ux wms layers per map" + } + }, + "avg": { + "type": "float", + "_meta": { + "description": "avg number of ux wms layers per map" + } + }, + "total": { + "type": "long", + "_meta": { + "description": "total number of ux wms layers in cluster" + } + } + } + } + } + }, + "scalingOptions": { + "properties": { + "limit": { + "properties": { + "min": { + "type": "long", + "_meta": { + "description": "min number of es doc layers with limit scaling option per map" + } + }, + "max": { + "type": "long", + "_meta": { + "description": "max number of es doc layers with limit scaling option per map" + } + }, + "avg": { + "type": "float", + "_meta": { + "description": "avg number of es doc layers with limit scaling option per map" + } + }, + "total": { + "type": "long", + "_meta": { + "description": "total number of es doc layers with limit scaling option in cluster" + } + } + } + }, + "clusters": { + "properties": { + "min": { + "type": "long", + "_meta": { + "description": "min number of es doc layers with blended scaling option per map" + } + }, + "max": { + "type": "long", + "_meta": { + "description": "max number of es doc layers with blended scaling option per map" + } + }, + "avg": { + "type": "float", + "_meta": { + "description": "avg number of es doc layers with blended scaling option per map" + } + }, + "total": { + "type": "long", + "_meta": { + "description": "total number of es doc layers with blended scaling option in cluster" + } + } + } + }, + "mvt": { + "properties": { + "min": { + "type": "long", + "_meta": { + "description": "min number of es doc layers with mvt scaling option per map" + } + }, + "max": { + "type": "long", + "_meta": { + "description": "max number of es doc layers with mvt scaling option per map" + } + }, + "avg": { + "type": "float", + "_meta": { + "description": "avg number of es doc layers with mvt scaling option per map" + } + }, + "total": { + "type": "long", + "_meta": { + "description": "total number of es doc layers with mvt scaling option in cluster" + } + } + } + } + } + }, + "joins": { + "properties": { + "term": { + "properties": { + "min": { + "type": "long", + "_meta": { + "description": "min number of layers with term joins per map" + } + }, + "max": { + "type": "long", + "_meta": { + "description": "max number of layers with term joins per map" + } + }, + "avg": { + "type": "float", + "_meta": { + "description": "avg number of layers with term joins per map" + } + }, + "total": { + "type": "long", + "_meta": { + "description": "total number of layers with term joins in cluster" + } + } + } + } + } + }, + "basemaps": { + "properties": { + "auto": { + "properties": { + "min": { + "type": "long", + "_meta": { + "description": "min number of ems basemap layers with auto-style per map" + } + }, + "max": { + "type": "long", + "_meta": { + "description": "max number of ems basemap layers with auto-style per map" + } + }, + "avg": { + "type": "float", + "_meta": { + "description": "avg number of ems basemap layers with auto-style per map" + } + }, + "total": { + "type": "long", + "_meta": { + "description": "total number of ems basemap layers with auto-style in cluster" + } + } + } + }, + "dark": { + "properties": { + "min": { + "type": "long", + "_meta": { + "description": "min number of ems basemap layers with dark-style per map" + } + }, + "max": { + "type": "long", + "_meta": { + "description": "max number of ems basemap layers with dark-style per map" + } + }, + "avg": { + "type": "float", + "_meta": { + "description": "avg number of ems basemap layers with dark-style per map" + } + }, + "total": { + "type": "long", + "_meta": { + "description": "total number of ems basemap layers with dark-style in cluster" + } + } + } + }, + "roadmap": { + "properties": { + "min": { + "type": "long", + "_meta": { + "description": "min number of ems basemap layers with roadmap-style per map" + } + }, + "max": { + "type": "long", + "_meta": { + "description": "max number of ems basemap layers with roadmap-style per map" + } + }, + "avg": { + "type": "float", + "_meta": { + "description": "avg number of ems basemap layers with roadmap-style per map" + } + }, + "total": { + "type": "long", + "_meta": { + "description": "total number of ems basemap layers with roadmap-style in cluster" + } + } + } + }, + "roadmap_desaturated": { + "properties": { + "min": { + "type": "long", + "_meta": { + "description": "min number of ems basemap layers with desaturated-style per map" + } + }, + "max": { + "type": "long", + "_meta": { + "description": "max number of ems basemap layers with desaturated-style per map" + } + }, + "avg": { + "type": "float", + "_meta": { + "description": "avg number of ems basemap layers with desaturated-style per map" + } + }, + "total": { + "type": "long", + "_meta": { + "description": "total number of ems basemap layers with desaturated-style in cluster" + } + } + } + } + } + }, + "attributesPerMap": { + "properties": { + "dataSourcesCount": { + "properties": { + "min": { + "type": "long" + }, + "max": { + "type": "long" + }, + "avg": { + "type": "float" + } + } + }, + "layersCount": { + "properties": { + "min": { + "type": "long" + }, + "max": { + "type": "long" + }, + "avg": { + "type": "float" + } + } + }, + "layerTypesCount": { + "properties": { + "DYNAMIC_KEY": { + "properties": { + "min": { + "type": "long" + }, + "max": { + "type": "long" + }, + "avg": { + "type": "float" + } + } + } + } + }, + "emsVectorLayersCount": { + "properties": { + "DYNAMIC_KEY": { + "properties": { + "min": { + "type": "long" + }, + "max": { + "type": "long" + }, + "avg": { + "type": "float" + } + } + } + } + } + } + } + } + }, + "ml": { + "properties": { + "alertRules": { + "properties": { + "xpack.ml.anomaly_detection_alert": { + "properties": { + "count_by_result_type": { + "properties": { + "record": { + "type": "long", + "_meta": { + "description": "total number of alerting rules using record result type" + } + }, + "influencer": { + "type": "long", + "_meta": { + "description": "total number of alerting rules using influencer result type" + } + }, + "bucket": { + "type": "long", + "_meta": { + "description": "total number of alerting rules using bucket result type" + } + } + } + } + } + } + } + } + } + }, + "kibana_settings": { + "properties": { + "xpack": { + "properties": { + "default_admin_email": { + "type": "text" + } + } + } + } + }, + "monitoring": { + "properties": { + "hasMonitoringData": { + "type": "boolean" + }, + "clusters": { + "type": "array", + "items": { + "properties": { + "license": { + "type": "keyword" + }, + "clusterUuid": { + "type": "keyword" + }, + "metricbeatUsed": { + "type": "boolean" + }, + "elasticsearch": { + "properties": { + "enabled": { + "type": "boolean" }, "count": { "type": "long" @@ -3738,6 +4578,277 @@ }, "detectionMetrics": { "properties": { + "detection_rules": { + "properties": { + "detection_rule_usage": { + "properties": { + "query": { + "properties": { + "enabled": { + "type": "long", + "_meta": { + "description": "Number of query rules enabled" + } + }, + "disabled": { + "type": "long", + "_meta": { + "description": "Number of query rules disabled" + } + }, + "alerts": { + "type": "long", + "_meta": { + "description": "Number of alerts generated by query rules" + } + }, + "cases": { + "type": "long", + "_meta": { + "description": "Number of cases attached to query detection rule alerts" + } + } + } + }, + "threshold": { + "properties": { + "enabled": { + "type": "long", + "_meta": { + "description": "Number of threshold rules enabled" + } + }, + "disabled": { + "type": "long", + "_meta": { + "description": "Number of threshold rules disabled" + } + }, + "alerts": { + "type": "long", + "_meta": { + "description": "Number of alerts generated by threshold rules" + } + }, + "cases": { + "type": "long", + "_meta": { + "description": "Number of cases attached to threshold detection rule alerts" + } + } + } + }, + "eql": { + "properties": { + "enabled": { + "type": "long", + "_meta": { + "description": "Number of eql rules enabled" + } + }, + "disabled": { + "type": "long", + "_meta": { + "description": "Number of eql rules disabled" + } + }, + "alerts": { + "type": "long", + "_meta": { + "description": "Number of alerts generated by eql rules" + } + }, + "cases": { + "type": "long", + "_meta": { + "description": "Number of cases attached to eql detection rule alerts" + } + } + } + }, + "machine_learning": { + "properties": { + "enabled": { + "type": "long", + "_meta": { + "description": "Number of machine_learning rules enabled" + } + }, + "disabled": { + "type": "long", + "_meta": { + "description": "Number of machine_learning rules disabled" + } + }, + "alerts": { + "type": "long", + "_meta": { + "description": "Number of alerts generated by machine_learning rules" + } + }, + "cases": { + "type": "long", + "_meta": { + "description": "Number of cases attached to machine_learning detection rule alerts" + } + } + } + }, + "threat_match": { + "properties": { + "enabled": { + "type": "long", + "_meta": { + "description": "Number of threat_match rules enabled" + } + }, + "disabled": { + "type": "long", + "_meta": { + "description": "Number of threat_match rules disabled" + } + }, + "alerts": { + "type": "long", + "_meta": { + "description": "Number of alerts generated by threat_match rules" + } + }, + "cases": { + "type": "long", + "_meta": { + "description": "Number of cases attached to threat_match detection rule alerts" + } + } + } + }, + "elastic_total": { + "properties": { + "enabled": { + "type": "long", + "_meta": { + "description": "Number of elastic rules enabled" + } + }, + "disabled": { + "type": "long", + "_meta": { + "description": "Number of elastic rules disabled" + } + }, + "alerts": { + "type": "long", + "_meta": { + "description": "Number of alerts generated by elastic rules" + } + }, + "cases": { + "type": "long", + "_meta": { + "description": "Number of cases attached to elastic detection rule alerts" + } + } + } + }, + "custom_total": { + "properties": { + "enabled": { + "type": "long", + "_meta": { + "description": "Number of custom rules enabled" + } + }, + "disabled": { + "type": "long", + "_meta": { + "description": "Number of custom rules disabled" + } + }, + "alerts": { + "type": "long", + "_meta": { + "description": "Number of alerts generated by custom rules" + } + }, + "cases": { + "type": "long", + "_meta": { + "description": "Number of cases attached to custom detection rule alerts" + } + } + } + } + } + }, + "detection_rule_detail": { + "type": "array", + "items": { + "properties": { + "rule_name": { + "type": "keyword", + "_meta": { + "description": "The name of the detection rule" + } + }, + "rule_id": { + "type": "keyword", + "_meta": { + "description": "The UUID id of the detection rule" + } + }, + "rule_type": { + "type": "keyword", + "_meta": { + "description": "The type of detection rule. ie eql, query..." + } + }, + "rule_version": { + "type": "long", + "_meta": { + "description": "The version of the rule" + } + }, + "enabled": { + "type": "boolean", + "_meta": { + "description": "If the detection rule has been enabled by the user" + } + }, + "elastic_rule": { + "type": "boolean", + "_meta": { + "description": "If the detection rule has been authored by Elastic" + } + }, + "created_on": { + "type": "keyword", + "_meta": { + "description": "When the detection rule was created on the cluster" + } + }, + "updated_on": { + "type": "keyword", + "_meta": { + "description": "When the detection rule was updated on the cluster" + } + }, + "alert_count_daily": { + "type": "long", + "_meta": { + "description": "The number of daily alerts generated by a rule" + } + }, + "cases_count_daily": { + "type": "long", + "_meta": { + "description": "The number of daily cases generated by a rule" + } + } + } + } + } + } + }, "ml_jobs": { "type": "array", "items": { @@ -3800,9 +4911,6 @@ }, "timing_stats": { "properties": { - "average_bucket_processing_time_ms": { - "type": "long" - }, "bucket_count": { "type": "long" }, diff --git a/x-pack/plugins/transform/common/api_schemas/field_histograms.ts b/x-pack/plugins/transform/common/api_schemas/field_histograms.ts index 9f6f4c15d803a..5a808ab9788b1 100644 --- a/x-pack/plugins/transform/common/api_schemas/field_histograms.ts +++ b/x-pack/plugins/transform/common/api_schemas/field_histograms.ts @@ -16,7 +16,7 @@ export const fieldHistogramsRequestSchema = schema.object({ query: schema.any(), /** The fields to return histogram data. */ fields: schema.arrayOf(schema.any()), - /** Optional runtime mappings */ + /** Optional runtime fields */ runtimeMappings: runtimeMappingsSchema, /** Number of documents to be collected in the sample processed on each shard, or -1 for no sampling. */ samplerShardSize: schema.number(), diff --git a/x-pack/plugins/transform/public/app/common/request.test.ts b/x-pack/plugins/transform/public/app/common/request.test.ts index f25fedb7aaba3..6a64c6af6428f 100644 --- a/x-pack/plugins/transform/public/app/common/request.test.ts +++ b/x-pack/plugins/transform/public/app/common/request.test.ts @@ -266,7 +266,7 @@ describe('Transform: Common', () => { }); }); - test('getCreateTransformRequestBody() with runtime mappings', () => { + test('getCreateTransformRequestBody() with runtime fields', () => { const runtimeMappings = { rt_bytes_bigger: { type: 'double', diff --git a/x-pack/plugins/transform/public/app/sections/create_transform/components/advanced_pivot_editor_switch/advanced_pivot_editor_switch.tsx b/x-pack/plugins/transform/public/app/sections/create_transform/components/advanced_pivot_editor_switch/advanced_pivot_editor_switch.tsx index 3883be6a8bfa8..900af603266b8 100644 --- a/x-pack/plugins/transform/public/app/sections/create_transform/components/advanced_pivot_editor_switch/advanced_pivot_editor_switch.tsx +++ b/x-pack/plugins/transform/public/app/sections/create_transform/components/advanced_pivot_editor_switch/advanced_pivot_editor_switch.tsx @@ -26,9 +26,6 @@ export const AdvancedPivotEditorSwitch: FC = ({ isAdvancedPivotEditorApplyButtonEnabled, }, }, - pivotConfig: { - actions: { setAggList, setGroupByList }, - }, }) => { return ( diff --git a/x-pack/plugins/transform/public/app/sections/create_transform/components/advanced_query_editor_switch/advanced_query_editor_switch.tsx b/x-pack/plugins/transform/public/app/sections/create_transform/components/advanced_query_editor_switch/advanced_query_editor_switch.tsx index aedd4a2450f54..43c6684a5a2bc 100644 --- a/x-pack/plugins/transform/public/app/sections/create_transform/components/advanced_query_editor_switch/advanced_query_editor_switch.tsx +++ b/x-pack/plugins/transform/public/app/sections/create_transform/components/advanced_query_editor_switch/advanced_query_editor_switch.tsx @@ -27,6 +27,8 @@ export const AdvancedQueryEditorSwitch: FC = ({ isAdvancedSourceEditorEnabled, isAdvancedSourceEditorSwitchModalVisible, sourceConfigUpdated, + advancedEditorSourceConfigLastApplied, + advancedEditorSourceConfig, }, }, searchBar: { @@ -53,7 +55,11 @@ export const AdvancedQueryEditorSwitch: FC = ({ )} checked={isAdvancedSourceEditorEnabled} onChange={() => { - if (isAdvancedSourceEditorEnabled && sourceConfigUpdated) { + if ( + isAdvancedSourceEditorEnabled && + (sourceConfigUpdated || + advancedEditorSourceConfig !== advancedEditorSourceConfigLastApplied) + ) { setAdvancedSourceEditorSwitchModalVisible(true); return; } diff --git a/x-pack/plugins/transform/public/app/sections/create_transform/components/advanced_runtime_mappings_editor_switch/advanced_runtime_mappings_editor_switch.tsx b/x-pack/plugins/transform/public/app/sections/create_transform/components/advanced_runtime_mappings_editor_switch/advanced_runtime_mappings_editor_switch.tsx index be297c10a8f88..2ee8bc9995df6 100644 --- a/x-pack/plugins/transform/public/app/sections/create_transform/components/advanced_runtime_mappings_editor_switch/advanced_runtime_mappings_editor_switch.tsx +++ b/x-pack/plugins/transform/public/app/sections/create_transform/components/advanced_runtime_mappings_editor_switch/advanced_runtime_mappings_editor_switch.tsx @@ -8,35 +8,58 @@ import React, { FC } from 'react'; import { EuiSwitch } from '@elastic/eui'; import { i18n } from '@kbn/i18n'; -import { StepDefineFormHook } from '../step_define'; +import { SwitchModal } from './switch_modal'; +import { useAdvancedRuntimeMappingsEditor } from '../step_define/hooks/use_advanced_runtime_mappings_editor'; -export const AdvancedRuntimeMappingsEditorSwitch: FC< - StepDefineFormHook['runtimeMappingsEditor'] -> = (props) => { +type Props = ReturnType; +export const AdvancedRuntimeMappingsEditorSwitch: FC = (props) => { const { - actions: { setRuntimeMappingsUpdated, toggleRuntimeMappingsEditor }, - state: { isRuntimeMappingsEditorEnabled }, + actions: { toggleRuntimeMappingsEditor, setRuntimeMappingsEditorSwitchModalVisible }, + state: { + isRuntimeMappingsEditorEnabled, + isRuntimeMappingsEditorSwitchModalVisible, + advancedEditorRuntimeMappingsLastApplied, + advancedRuntimeMappingsConfig, + }, } = props; // If switching to KQL after updating via editor - reset search const toggleEditorHandler = (reset = false) => { - if (reset === true) { - setRuntimeMappingsUpdated(false); - } toggleRuntimeMappingsEditor(reset); }; return ( - + { + if ( + isRuntimeMappingsEditorEnabled && + advancedRuntimeMappingsConfig !== advancedEditorRuntimeMappingsLastApplied + ) { + setRuntimeMappingsEditorSwitchModalVisible(true); + return; + } + + toggleEditorHandler(); + }} + data-test-subj="transformAdvancedRuntimeMappingsEditorSwitch" + /> + {isRuntimeMappingsEditorSwitchModalVisible && ( + setRuntimeMappingsEditorSwitchModalVisible(false)} + onConfirm={() => { + setRuntimeMappingsEditorSwitchModalVisible(false); + toggleEditorHandler(true); + }} + /> )} - checked={isRuntimeMappingsEditorEnabled} - onChange={() => toggleEditorHandler()} - data-test-subj="transformAdvancedRuntimeMappingsEditorSwitch" - /> + ); }; diff --git a/x-pack/plugins/transform/public/app/sections/create_transform/components/advanced_runtime_mappings_editor_switch/switch_modal.tsx b/x-pack/plugins/transform/public/app/sections/create_transform/components/advanced_runtime_mappings_editor_switch/switch_modal.tsx new file mode 100644 index 0000000000000..ff08ab37bb3e6 --- /dev/null +++ b/x-pack/plugins/transform/public/app/sections/create_transform/components/advanced_runtime_mappings_editor_switch/switch_modal.tsx @@ -0,0 +1,53 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import React, { FC } from 'react'; +import { EuiConfirmModal } from '@elastic/eui'; +import { i18n } from '@kbn/i18n'; + +interface Props { + onCancel: () => void; + onConfirm: () => void; +} + +const modalTitle = i18n.translate('xpack.transform.stepDefineForm.runtimeEditorSwitchModalTitle', { + defaultMessage: 'Edits will be lost', +}); + +const cancelButtonText = i18n.translate( + 'xpack.transform.stepDefineForm.runtimeEditorSwitchModalCancelButtonText', + { + defaultMessage: 'Cancel', + } +); + +const applyChangesText = i18n.translate( + 'xpack.transform.stepDefineForm.runtimeEditorSwitchModalConfirmButtonText', + { + defaultMessage: 'Close editor', + } +); +const modalMessage = i18n.translate( + 'xpack.transform.stepDefineForm.runtimeEditorSwitchModalBodyText', + { + defaultMessage: `The changes in the advanced editor haven't been applied yet. By closing the editor you will lose your edits.`, + } +); + +export const SwitchModal: FC = ({ onCancel, onConfirm }) => ( + +

    {modalMessage}

    +
    +); diff --git a/x-pack/plugins/transform/public/app/sections/create_transform/components/advanced_runtime_mappings_settings/advanced_runtime_mappings_settings.tsx b/x-pack/plugins/transform/public/app/sections/create_transform/components/advanced_runtime_mappings_settings/advanced_runtime_mappings_settings.tsx index 7965db99b335b..29e341fdaeaea 100644 --- a/x-pack/plugins/transform/public/app/sections/create_transform/components/advanced_runtime_mappings_settings/advanced_runtime_mappings_settings.tsx +++ b/x-pack/plugins/transform/public/app/sections/create_transform/components/advanced_runtime_mappings_settings/advanced_runtime_mappings_settings.tsx @@ -29,9 +29,9 @@ import { isPivotAggConfigWithUiSupport } from '../../../../common/pivot_group_by const advancedEditorsSidebarWidth = '220px'; const COPY_TO_CLIPBOARD_RUNTIME_MAPPINGS = i18n.translate( - 'xpack.transform.indexPreview.copyRuntimeMappingsClipboardTooltip', + 'xpack.transform.indexPreview.copyRuntimeFieldsClipboardTooltip', { - defaultMessage: 'Copy Dev Console statement of the runtime mappings to the clipboard.', + defaultMessage: 'Copy Dev Console statement of the runtime fields to the clipboard.', } ); @@ -87,15 +87,15 @@ export const AdvancedRuntimeMappingsSettings: FC = (props) = {runtimeMappings !== undefined && Object.keys(runtimeMappings).length > 0 ? ( = (props) = ) : ( )} @@ -145,10 +145,10 @@ export const AdvancedRuntimeMappingsSettings: FC = (props) = {i18n.translate( - 'xpack.transform.stepDefineForm.advancedRuntimeMappingsEditorHelpText', + 'xpack.transform.stepDefineForm.advancedRuntimeFieldsEditorHelpText', { defaultMessage: - 'The advanced editor allows you to edit the runtime mappings of the transform configuration.', + 'The advanced editor allows you to edit the runtime fields of the transform configuration.', } )} diff --git a/x-pack/plugins/transform/public/app/sections/create_transform/components/step_define/common/apply_transform_config_to_define_state.ts b/x-pack/plugins/transform/public/app/sections/create_transform/components/step_define/common/apply_transform_config_to_define_state.ts index 6298874a20366..497f37036725c 100644 --- a/x-pack/plugins/transform/public/app/sections/create_transform/components/step_define/common/apply_transform_config_to_define_state.ts +++ b/x-pack/plugins/transform/public/app/sections/create_transform/components/step_define/common/apply_transform_config_to_define_state.ts @@ -37,7 +37,7 @@ export function applyTransformConfigToDefineState( transformConfig?: TransformBaseConfig, indexPattern?: StepDefineFormProps['searchItems']['indexPattern'] ): StepDefineExposedState { - // apply runtime mappings from both the index pattern and inline configurations + // apply runtime fields from both the index pattern and inline configurations state.runtimeMappings = getCombinedRuntimeMappings( indexPattern, transformConfig?.source?.runtime_mappings diff --git a/x-pack/plugins/transform/public/app/sections/create_transform/components/step_define/common/filter_agg/components/filter_agg_form.tsx b/x-pack/plugins/transform/public/app/sections/create_transform/components/step_define/common/filter_agg/components/filter_agg_form.tsx index 9b349541a78a3..e3e767a81b01d 100644 --- a/x-pack/plugins/transform/public/app/sections/create_transform/components/step_define/common/filter_agg/components/filter_agg_form.tsx +++ b/x-pack/plugins/transform/public/app/sections/create_transform/components/step_define/common/filter_agg/components/filter_agg_form.tsx @@ -39,7 +39,7 @@ export function getSupportedFilterAggs( ]; } - throw new Error(`The field ${fieldName} does not exist in the index or runtime mappings`); + throw new Error(`The field ${fieldName} does not exist in the index or runtime fields`); } /** diff --git a/x-pack/plugins/transform/public/app/sections/create_transform/components/step_define/hooks/use_advanced_runtime_mappings_editor.ts b/x-pack/plugins/transform/public/app/sections/create_transform/components/step_define/hooks/use_advanced_runtime_mappings_editor.ts index 2ad7c4344a101..dd58456e15adb 100644 --- a/x-pack/plugins/transform/public/app/sections/create_transform/components/step_define/hooks/use_advanced_runtime_mappings_editor.ts +++ b/x-pack/plugins/transform/public/app/sections/create_transform/components/step_define/hooks/use_advanced_runtime_mappings_editor.ts @@ -62,11 +62,8 @@ export const useAdvancedRuntimeMappingsEditor = (defaults: StepDefineExposedStat const toggleRuntimeMappingsEditor = (reset = false) => { if (reset === true) { setRuntimeMappingsUpdated(false); + setAdvancedRuntimeMappingsConfig(advancedEditorRuntimeMappingsLastApplied); } - if (isRuntimeMappingsEditorEnabled === false) { - setAdvancedEditorRuntimeMappingsLastApplied(advancedRuntimeMappingsConfig); - } - setRuntimeMappingsEditorEnabled(!isRuntimeMappingsEditorEnabled); setRuntimeMappingsEditorApplyButtonEnabled(false); }; diff --git a/x-pack/plugins/transform/public/app/sections/create_transform/components/step_define/hooks/use_step_define_form.ts b/x-pack/plugins/transform/public/app/sections/create_transform/components/step_define/hooks/use_step_define_form.ts index 0ceea070df1b6..b56df5e395c88 100644 --- a/x-pack/plugins/transform/public/app/sections/create_transform/components/step_define/hooks/use_step_define_form.ts +++ b/x-pack/plugins/transform/public/app/sections/create_transform/components/step_define/hooks/use_step_define_form.ts @@ -51,7 +51,7 @@ export const useStepDefineForm = ({ overrides, onChange, searchItems }: StepDefi // source config hook const advancedSourceEditor = useAdvancedSourceEditor(defaults, previewRequest); - // runtime mappings config hook + // runtime fields config hook const runtimeMappingsEditor = useAdvancedRuntimeMappingsEditor(defaults); useEffect(() => { diff --git a/x-pack/plugins/translations/translations/ja-JP.json b/x-pack/plugins/translations/translations/ja-JP.json index 74803fda8df5c..a4fb733d20c62 100644 --- a/x-pack/plugins/translations/translations/ja-JP.json +++ b/x-pack/plugins/translations/translations/ja-JP.json @@ -368,7 +368,6 @@ "core.chrome.legacyBrowserWarning": "ご使用のブラウザが Kibana のセキュリティ要件を満たしていません。", "core.euiBasicTable.selectAllRows": "すべての行を選択", "core.euiBasicTable.selectThisRow": "この行を選択", - "core.euiBasicTable.tableDescription": "以下は {itemCount} 件のアイテムの表です。", "core.euiBottomBar.screenReaderAnnouncement": "ドキュメントの最後にページレベルのコントロールと共に開く新しいメニューがあります。", "core.euiBreadcrumbs.collapsedBadge.ariaLabel": "すべてのブレッドクラムを表示", "core.euiCardSelect.select": "選択してください", @@ -398,14 +397,12 @@ "core.euiColumnSortingDraggable.toggleLegend": "フィールドの並び替え方法を選択:", "core.euiComboBoxOptionsList.allOptionsSelected": "利用可能なオプションをすべて選択しました", "core.euiComboBoxOptionsList.alreadyAdded": "{label} はすでに追加されています", - "core.euiComboBoxOptionsList.createCustomOption": "{searchValue} をカスタムオプションとして追加するには、{key} を押してください。", "core.euiComboBoxOptionsList.loadingOptions": "オプションを読み込み中", "core.euiComboBoxOptionsList.noAvailableOptions": "利用可能なオプションがありません", "core.euiComboBoxOptionsList.noMatchingOptions": "{searchValue} はどのオプションにも一致していません", "core.euiComboBoxPill.removeSelection": "グループの選択項目から {children} を削除してください", "core.euiCommonlyUsedTimeRanges.legend": "頻繁に使用", "core.euiDataGrid.screenReaderNotice": "セルにはインタラクティブコンテンツが含まれます。", - "core.euiDataGridCell.expandButtonTitle": "クリックするか enter を押すと、セルのコンテンツとインタラクトできます。", "core.euiDataGridSchema.booleanSortTextAsc": "True-False", "core.euiDataGridSchema.booleanSortTextDesc": "False-True", "core.euiDataGridSchema.currencySortTextAsc": "低-高", @@ -427,10 +424,6 @@ "core.euiImage.openImage": "全画面 {alt} 画像を開く", "core.euiLink.external.ariaLabel": "外部リンク", "core.euiModal.closeModal": "このモーダルウィンドウを閉じます", - "core.euiPagination.jumpToLastPage": "最後のページ {pageCount} に移動します", - "core.euiPagination.nextPage": "次のページ", - "core.euiPagination.pageOfTotal": "{total} ページ中 {page} ページ目", - "core.euiPagination.previousPage": "前のページ", "core.euiPopover.screenReaderAnnouncement": "これはダイアログです。ダイアログを閉じるには、 escape を押してください。", "core.euiQuickSelect.applyButton": "適用", "core.euiQuickSelect.fullDescription": "現在 {timeTense} {timeValue} {timeUnit}に設定されています。", @@ -455,12 +448,6 @@ "core.euiSelectable.noAvailableOptions": "利用可能なオプションがありません", "core.euiSelectable.noMatchingOptions": "{searchValue} はどのオプションにも一致していません", "core.euiStat.loadingText": "統計を読み込み中です", - "core.euiStep.ariaLabel": "{stepStatus}", - "core.euiStepHorizontal.buttonTitle": "ステップ {step}:{title}{titleAppendix}", - "core.euiStepHorizontal.step": "手順", - "core.euiStepNumber.hasErrors": "エラーがあります", - "core.euiStepNumber.hasWarnings": "警告があります", - "core.euiStepNumber.isComplete": "完了", "core.euiStyleSelector.buttonText": "密度", "core.euiSuperDatePicker.showDatesButtonLabel": "日付を表示", "core.euiSuperSelect.screenReaderAnnouncement": "{optionsCount} 件のアイテムのフォームセレクターを使用しています。1 つのオプションを選択する必要があります。上下の矢印キーで移動するか、Esc キーで閉じます。", @@ -529,15 +516,11 @@ "core.ui_settings.params.maxCellHeightText": "表のセルが使用する高さの上限です。この切り捨てを無効にするには0に設定します", "core.ui_settings.params.maxCellHeightTitle": "表のセルの高さの上限", "core.ui_settings.params.notifications.banner.markdownLinkText": "マークダウン対応", - "core.ui_settings.params.notifications.bannerLifetimeText": "バナー通知が画面に表示される時間 (ミリ秒単位) です。{infinityValue}に設定すると、カウントダウンが無効になります。", "core.ui_settings.params.notifications.bannerLifetimeTitle": "バナー通知時間", "core.ui_settings.params.notifications.bannerText": "すべてのユーザーへの一時的な通知を目的としたカスタムバナーです。{markdownLink}", "core.ui_settings.params.notifications.bannerTitle": "カスタムバナー通知", - "core.ui_settings.params.notifications.errorLifetimeText": "エラー通知が画面に表示される時間 (ミリ秒単位) です。{infinityValue}に設定すると、無効になります。", "core.ui_settings.params.notifications.errorLifetimeTitle": "エラー通知時間", - "core.ui_settings.params.notifications.infoLifetimeText": "情報通知が画面に表示される時間 (ミリ秒単位) です。{infinityValue}に設定すると、無効になります。", "core.ui_settings.params.notifications.infoLifetimeTitle": "情報通知時間", - "core.ui_settings.params.notifications.warningLifetimeText": "警告通知が画面に表示される時間 (ミリ秒単位) です。{infinityValue}に設定すると、無効になります。", "core.ui_settings.params.notifications.warningLifetimeTitle": "警告通知時間", "core.ui_settings.params.storeUrlText": "URLが長くなりすぎるためブラウザーが対応できない場合があります。セッションストレージにURLの一部を保存することでこの問題に対処できるかどうかをテストしています。結果を教えてください!", "core.ui_settings.params.storeUrlTitle": "セッションストレージにURLを格納", @@ -2808,7 +2791,6 @@ "indexPatternManagement.editIndexPattern.scripted.table.nameHeader": "名前", "indexPatternManagement.editIndexPattern.scripted.table.scriptDescription": "フィールドのスクリプトです", "indexPatternManagement.editIndexPattern.scripted.table.scriptHeader": "スクリプト", - "indexPatternManagement.editIndexPattern.scriptedHeader": "スクリプトフィールド", "indexPatternManagement.editIndexPattern.scriptedLabel": "ビジュアライゼーションにスクリプトフィールドを使用し、ドキュメントに表示させることができます。ただし、スクリプトフィールドは検索できません。", "indexPatternManagement.editIndexPattern.setDefaultAria": "デフォルトのインデックスに設定します。", "indexPatternManagement.editIndexPattern.setDefaultTooltip": "デフォルトのインデックスに設定します。", @@ -2826,7 +2808,6 @@ "indexPatternManagement.editIndexPattern.source.table.matchesHeader": "一致", "indexPatternManagement.editIndexPattern.source.table.notMatchedLabel": "ソースフィルターが既知のフィールドと一致しません。", "indexPatternManagement.editIndexPattern.source.table.saveAria": "保存", - "indexPatternManagement.editIndexPattern.sourceHeader": "フィールドフィルター", "indexPatternManagement.editIndexPattern.sourceLabel": "フィールドフィルターは、ドキュメントの取得時に 1 つまたは複数のフィールドを除外するのに使用される場合もあります。これは Discover アプリでのドキュメントの表示中、またはダッシュボードアプリの保存された検索の結果を表示する表で起こります。ドキュメントに大きなフィールドや重要ではないフィールドが含まれている場合、この程度の低いレベルでフィルターにより除外すると良いかもしれません。", "indexPatternManagement.editIndexPattern.sourcePlaceholder": "フィールドフィルター、ワイルドカード使用可 (例:「user*」と入力して「user」で始まるフィールドをフィルタリング) ", "indexPatternManagement.editIndexPattern.tabs.fieldsHeader": "フィールド", @@ -2904,8 +2885,6 @@ "indexPatternManagement.testScript.resultsTitle": "結果を表示", "indexPatternManagement.testScript.submitButtonLabel": "スクリプトを実行", "indexPatternManagement.typeLabel": "型", - "indexPatternManagement.warningCallOut.descriptionLabel": "計算値の表示と集約にスクリプトフィールドが使用できます。そのため非常に遅い場合があり、適切に行わないとKibanaが使用できなくなる可能性もあります。この場合安全策はありません。入力ミスがあると、あちこちに予期せぬ例外が起こります!", - "indexPatternManagement.warningCallOutHeader": "十分ご注意ください", "indexPatternManagement.warningCallOutLabel.callOutDetail": "スクリプトフィールドを使う前に、{scripFields}と{scriptsInAggregation}についてよく理解するようにしてください。", "indexPatternManagement.warningCallOutLabel.scripFieldsLink": "スクリプトフィールド", "indexPatternManagement.warningCallOutLabel.scriptsInAggregationLink": "集約におけるスクリプト", @@ -8672,7 +8651,6 @@ "xpack.fleet.settings.elasticHostError": "無効なURL", "xpack.fleet.settings.elasticsearchUrlLabel": "Elasticsearch URL", "xpack.fleet.settings.flyoutTitle": "Fleet 設定", - "xpack.fleet.settings.globalOutputTitle": "グローバル出力", "xpack.fleet.settings.invalidYamlFormatErrorMessage": "無効なYAML形式:{reason}", "xpack.fleet.settings.saveButtonLabel": "設定を保存", "xpack.fleet.settings.success.message": "設定が保存されました", @@ -11094,7 +11072,6 @@ "xpack.infra.sourceConfiguration.hostNameFieldDescription": "ホストの識別に使用されるフィールドです", "xpack.infra.sourceConfiguration.hostNameFieldLabel": "ホスト名", "xpack.infra.sourceConfiguration.indicesSectionTitle": "インデックス", - "xpack.infra.sourceConfiguration.logColumnListEmptyErrorMessage": "ログ列リストは未入力のままにできません。", "xpack.infra.sourceConfiguration.logColumnsSectionTitle": "ログ列", "xpack.infra.sourceConfiguration.logIndicesDescription": "ログデータを含む一致するインデックスのインデックスパターンです", "xpack.infra.sourceConfiguration.logIndicesLabel": "ログインデックス", @@ -13621,8 +13598,6 @@ "xpack.ml.datavisualizer.dataGrid.showDistributionsAriaLabel": "分布を表示", "xpack.ml.datavisualizer.dataGrid.typeColumnName": "型", "xpack.ml.datavisualizer.dataLoader.internalServerErrorMessage": "インデックス {index} のデータの読み込み中にエラーが発生。{message}。リクエストがタイムアウトした可能性があります。小さなサンプルサイズを使うか、時間範囲を狭めてみてください。", - "xpack.ml.dataVisualizer.fileBased.fieldNameSelect": "フィールド名", - "xpack.ml.dataVisualizer.fileBased.fieldTypeSelect": "フィールド型", "xpack.ml.dataVisualizer.fileBasedLabel": "ファイル", "xpack.ml.dataVisualizer.indexBased.fieldNameSelect": "フィールド名", "xpack.ml.dataVisualizer.indexBased.fieldTypeSelect": "フィールド型", @@ -13799,163 +13774,6 @@ "xpack.ml.fieldTypeIcon.numberTypeAriaLabel": "数字タイプ", "xpack.ml.fieldTypeIcon.textTypeAriaLabel": "テキストタイプ", "xpack.ml.fieldTypeIcon.unknownTypeAriaLabel": "不明なタイプ", - "xpack.ml.fileDatavisualizer.aboutPanel.analyzingDataTitle": "データを分析中", - "xpack.ml.fileDatavisualizer.aboutPanel.selectOrDragAndDropFileDescription": "ファイルを選択するかドラッグ &amp; ドロップしてください", - "xpack.ml.fileDatavisualizer.addCombinedFieldsLabel": "結合されたフィールドを追加", - "xpack.ml.fileDatavisualizer.advancedImportSettings.createIndexPatternLabel": "インデックスパターンを作成", - "xpack.ml.fileDatavisualizer.advancedImportSettings.indexNameAriaLabel": "インデックス名、必須フィールド", - "xpack.ml.fileDatavisualizer.advancedImportSettings.indexNameLabel": "インデックス名", - "xpack.ml.fileDatavisualizer.advancedImportSettings.indexNamePlaceholder": "インデックス名", - "xpack.ml.fileDatavisualizer.advancedImportSettings.indexPatternNameLabel": "インデックスパターン名", - "xpack.ml.fileDatavisualizer.advancedImportSettings.indexSettingsLabel": "インデックス設定", - "xpack.ml.fileDatavisualizer.advancedImportSettings.ingestPipelineLabel": "パイプラインを投入", - "xpack.ml.fileDatavisualizer.advancedImportSettings.mappingsLabel": "マッピング", - "xpack.ml.fileDatavisualizer.analysisSummary.analyzedLinesNumberTitle": "分析した行数", - "xpack.ml.fileDatavisualizer.analysisSummary.delimiterTitle": "区切り記号", - "xpack.ml.fileDatavisualizer.analysisSummary.formatTitle": "フォーマット", - "xpack.ml.fileDatavisualizer.analysisSummary.grokPatternTitle": "Grok パターン", - "xpack.ml.fileDatavisualizer.analysisSummary.hasHeaderRowTitle": "ヘッダー行があります", - "xpack.ml.fileDatavisualizer.analysisSummary.summaryTitle": "まとめ", - "xpack.ml.fileDatavisualizer.analysisSummary.timeFieldTitle": "時間フィールド", - "xpack.ml.fileDatavisualizer.bottomBar.backButtonLabel": "戻る", - "xpack.ml.fileDatavisualizer.bottomBar.cancelButtonLabel": "キャンセル", - "xpack.ml.fileDatavisualizer.bottomBar.missingImportPrivilegesMessage": "データインポートを有効にするには、ingest_adminロールが必要です", - "xpack.ml.fileDatavisualizer.bottomBar.readMode.cancelButtonLabel": "キャンセル", - "xpack.ml.fileDatavisualizer.bottomBar.readMode.importButtonLabel": "インポート", - "xpack.ml.fileDatavisualizer.combinedFieldsForm.mappingsParseError": "マッピングのパース中にエラーが発生しました:{error}", - "xpack.ml.fileDatavisualizer.combinedFieldsForm.pipelineParseError": "パイプラインのパース中にエラーが発生しました:{error}", - "xpack.ml.fileDatavisualizer.combinedFieldsLabel": "結合されたフィールド", - "xpack.ml.fileDatavisualizer.combinedFieldsReadOnlyHelpTextLabel": "詳細タグで結合されたフィールドを編集", - "xpack.ml.fileDatavisualizer.combinedFieldsReadOnlyLabel": "結合されたフィールド", - "xpack.ml.fileDatavisualizer.editFlyout.applyOverrideSettingsButtonLabel": "適用", - "xpack.ml.fileDatavisualizer.editFlyout.closeOverrideSettingsButtonLabel": "閉じる", - "xpack.ml.fileDatavisualizer.editFlyout.overrides.customDelimiterFormRowLabel": "カスタム区切り記号", - "xpack.ml.fileDatavisualizer.editFlyout.overrides.customTimestampFormatErrorMessage": "タイムスタンプのフォーマットは、これらの Java 日付/時刻フォーマットの組み合わせでなければなりません:\n yy, yyyy, M, MM, MMM, MMMM, d, dd, EEE, EEEE, H, HH, h, mm, ss, S-SSSSSSSSS, a, XX, XXX, zzz", - "xpack.ml.fileDatavisualizer.editFlyout.overrides.customTimestampFormatFormRowLabel": "カスタムタイムスタンプフォーマット", - "xpack.ml.fileDatavisualizer.editFlyout.overrides.dataFormatFormRowLabel": "データフォーマット", - "xpack.ml.fileDatavisualizer.editFlyout.overrides.delimiterFormRowLabel": "区切り記号", - "xpack.ml.fileDatavisualizer.editFlyout.overrides.editFieldNamesTitle": "フィールド名の編集", - "xpack.ml.fileDatavisualizer.editFlyout.overrides.grokPatternFormRowLabel": "Grok パターン", - "xpack.ml.fileDatavisualizer.editFlyout.overrides.hasHeaderRowLabel": "ヘッダー行があります", - "xpack.ml.fileDatavisualizer.editFlyout.overrides.linesToSampleErrorMessage": "値は {min} よりも大きく {max} 以下でなければなりません", - "xpack.ml.fileDatavisualizer.editFlyout.overrides.linesToSampleFormRowLabel": "サンプルする行数", - "xpack.ml.fileDatavisualizer.editFlyout.overrides.quoteCharacterFormRowLabel": "引用符", - "xpack.ml.fileDatavisualizer.editFlyout.overrides.timeFieldFormRowLabel": "時間フィールド", - "xpack.ml.fileDatavisualizer.editFlyout.overrides.timestampEmptyValidationErrorMessage": "タイムスタンプフォーマットにタイムフォーマット文字グループがありません {timestampFormat}", - "xpack.ml.fileDatavisualizer.editFlyout.overrides.timestampFormatFormRowLabel": "タイムスタンプフォーマット", - "xpack.ml.fileDatavisualizer.editFlyout.overrides.timestampFormatHelpText": "対応フォーマットの詳細をご覧ください", - "xpack.ml.fileDatavisualizer.editFlyout.overrides.timestampLetterSValidationErrorMessage": "{format} の文字 { length, plural, one { {lg} } other { グループ {lg} } } は、ss と {sep} からの区切りで始まっていないため、サポートされていません", - "xpack.ml.fileDatavisualizer.editFlyout.overrides.timestampLetterValidationErrorMessage": "{format} の文字 { length, plural, one { {lg} } other { グループ {lg} } } はサポートされていません", - "xpack.ml.fileDatavisualizer.editFlyout.overrides.timestampQuestionMarkValidationErrorMessage": "タイムスタンプフォーマット {timestampFormat} は、疑問符 ({fieldPlaceholder}) が含まれているためサポートされていません", - "xpack.ml.fileDatavisualizer.editFlyout.overrides.trimFieldsLabel": "フィールドを切り抜く", - "xpack.ml.fileDatavisualizer.editFlyout.overrideSettingsTitle": "上書き設定", - "xpack.ml.fileDatavisualizer.experimentalBadge.experimentalLabel": "実験的", - "xpack.ml.fileDatavisualizer.explanationFlyout.closeButton": "閉じる", - "xpack.ml.fileDatavisualizer.explanationFlyout.content": "分析結果を生成した論理ステップ。", - "xpack.ml.fileDatavisualizer.explanationFlyout.title": "分析説明", - "xpack.ml.fileDatavisualizer.fieldStatsCard.maxTitle": "最高", - "xpack.ml.fileDatavisualizer.fieldStatsCard.medianTitle": "中間", - "xpack.ml.fileDatavisualizer.fieldStatsCard.minTitle": "分", - "xpack.ml.fileDatavisualizer.fileBeatConfig.paths": "ファイルのパスをここに追加してください", - "xpack.ml.fileDatavisualizer.fileBeatConfigFlyout.closeButton": "閉じる", - "xpack.ml.fileDatavisualizer.fileBeatConfigFlyout.copyButton": "クリップボードにコピー", - "xpack.ml.fileDatavisualizer.fileContents.fileContentsTitle": "ファイルコンテンツ", - "xpack.ml.fileDatavisualizer.fileDatavisualizerView.xmlNotCurrentlySupportedErrorMessage": "XML は現在サポートされていません", - "xpack.ml.fileDatavisualizer.fileErrorCallouts.applyOverridesDescription": "ファイル形式やタイムスタンプ形式などこのデータに関する何らかの情報がある場合は、初期オーバーライドを追加すると、残りの構造を推論するのに役立つことがあります。", - "xpack.ml.fileDatavisualizer.fileErrorCallouts.fileCouldNotBeReadTitle": "ファイル構造を決定できません", - "xpack.ml.fileDatavisualizer.fileErrorCallouts.fileSizeExceedsAllowedSizeByDiffFormatErrorMessage": "アップロードするよう選択されたファイルのサイズが {diffFormatted} に許可された最大サイズの {maxFileSizeFormatted} を超えています", - "xpack.ml.fileDatavisualizer.fileErrorCallouts.fileSizeExceedsAllowedSizeErrorMessage": "アップロードするよう選択されたファイルのサイズは {fileSizeFormatted} で、許可された最大サイズの {maxFileSizeFormatted} を超えています。", - "xpack.ml.fileDatavisualizer.fileErrorCallouts.fileSizeTooLargeTitle": "ファイルサイズが大きすぎます。", - "xpack.ml.fileDatavisualizer.fileErrorCallouts.overrideButton": "上書き設定を適用", - "xpack.ml.fileDatavisualizer.fileErrorCallouts.revertingToPreviousSettingsDescription": "以前の設定に戻しています。", - "xpack.ml.fileDatavisualizer.geoPointCombinedFieldLabel": "地理ポイントフィールドを追加", - "xpack.ml.fileDatavisualizer.geoPointForm.geoPointFieldAriaLabel": "地理ポイントフィールド、必須フィールド", - "xpack.ml.fileDatavisualizer.geoPointForm.geoPointFieldLabel": "地理ポイントフィールド", - "xpack.ml.fileDatavisualizer.geoPointForm.latFieldLabel": "緯度フィールド", - "xpack.ml.fileDatavisualizer.geoPointForm.lonFieldLabel": "経度フィールド", - "xpack.ml.fileDatavisualizer.geoPointForm.submitButtonLabel": "追加", - "xpack.ml.fileDatavisualizer.importErrors.checkingPermissionErrorMessage": "パーミッションエラーをインポートします", - "xpack.ml.fileDatavisualizer.importErrors.creatingIndexErrorMessage": "インデックスの作成中にエラーが発生しました", - "xpack.ml.fileDatavisualizer.importErrors.creatingIndexPatternErrorMessage": "インデックスパターンの作成中にエラーが発生しました", - "xpack.ml.fileDatavisualizer.importErrors.creatingIngestPipelineErrorMessage": "投入パイプラインの作成中にエラーが発生しました", - "xpack.ml.fileDatavisualizer.importErrors.defaultErrorMessage": "エラー", - "xpack.ml.fileDatavisualizer.importErrors.moreButtonLabel": "詳細", - "xpack.ml.fileDatavisualizer.importErrors.parsingJSONErrorMessage": "JSON のパース中にエラーが発生しました", - "xpack.ml.fileDatavisualizer.importErrors.readingFileErrorMessage": "ファイルの読み込み中にエラーが発生しました", - "xpack.ml.fileDatavisualizer.importErrors.unknownErrorMessage": "不明なエラー", - "xpack.ml.fileDatavisualizer.importErrors.uploadingDataErrorMessage": "データのアップロード中にエラーが発生しました", - "xpack.ml.fileDatavisualizer.importProgress.createIndexPatternTitle": "インデックスパターンを作成", - "xpack.ml.fileDatavisualizer.importProgress.createIndexTitle": "インデックスの作成", - "xpack.ml.fileDatavisualizer.importProgress.createIngestPipelineTitle": "投入パイプラインの作成", - "xpack.ml.fileDatavisualizer.importProgress.creatingIndexPatternDescription": "インデックスパターンを作成中です", - "xpack.ml.fileDatavisualizer.importProgress.creatingIndexPatternTitle": "インデックスパターンを作成中です", - "xpack.ml.fileDatavisualizer.importProgress.creatingIndexTitle": "インデックスを作成中です", - "xpack.ml.fileDatavisualizer.importProgress.creatingIngestPipelineTitle": "投入パイプラインを作成中", - "xpack.ml.fileDatavisualizer.importProgress.dataUploadedTitle": "データがアップロードされました", - "xpack.ml.fileDatavisualizer.importProgress.fileProcessedTitle": "ファイルが処理されました", - "xpack.ml.fileDatavisualizer.importProgress.indexCreatedTitle": "インデックスが作成されました", - "xpack.ml.fileDatavisualizer.importProgress.indexPatternCreatedTitle": "インデックスパターンが作成されました", - "xpack.ml.fileDatavisualizer.importProgress.ingestPipelineCreatedTitle": "投入パイプラインが作成されました", - "xpack.ml.fileDatavisualizer.importProgress.processFileTitle": "ファイルの処理", - "xpack.ml.fileDatavisualizer.importProgress.processingFileTitle": "ファイルを処理中", - "xpack.ml.fileDatavisualizer.importProgress.processingImportedFileDescription": "インポートするファイルを処理中", - "xpack.ml.fileDatavisualizer.importProgress.stepTwoCreatingIndexDescription": "インデックスを作成中です", - "xpack.ml.fileDatavisualizer.importProgress.stepTwoCreatingIndexIngestPipelineDescription": "インデックスと投入パイプラインを作成中です", - "xpack.ml.fileDatavisualizer.importProgress.uploadDataTitle": "データのアップロード", - "xpack.ml.fileDatavisualizer.importProgress.uploadingDataDescription": "データをアップロード中です", - "xpack.ml.fileDatavisualizer.importProgress.uploadingDataTitle": "データをアップロード中です", - "xpack.ml.fileDatavisualizer.importSettings.advancedTabName": "高度な設定", - "xpack.ml.fileDatavisualizer.importSettings.simpleTabName": "シンプル", - "xpack.ml.fileDatavisualizer.importSummary.documentsCouldNotBeImportedDescription": "{importFailuresLength}/{docCount} 個のドキュメントをインポートできませんでした。行が Grok パターンと一致していないことが原因の可能性があります。", - "xpack.ml.fileDatavisualizer.importSummary.documentsCouldNotBeImportedTitle": "ドキュメントの一部をインポートできませんでした。", - "xpack.ml.fileDatavisualizer.importSummary.documentsIngestedTitle": "ドキュメントが投入されました", - "xpack.ml.fileDatavisualizer.importSummary.failedDocumentsButtonLabel": "失敗したドキュメント", - "xpack.ml.fileDatavisualizer.importSummary.failedDocumentsTitle": "失敗したドキュメント", - "xpack.ml.fileDatavisualizer.importSummary.importCompleteTitle": "インポート完了", - "xpack.ml.fileDatavisualizer.importSummary.indexPatternTitle": "インデックスパターン", - "xpack.ml.fileDatavisualizer.importSummary.indexTitle": "インデックス", - "xpack.ml.fileDatavisualizer.importSummary.ingestPipelineTitle": "パイプラインを投入", - "xpack.ml.fileDatavisualizer.importView.experimentalFeatureTooltip": "実験的機能。フィードバックをお待ちしています。", - "xpack.ml.fileDatavisualizer.importView.importButtonLabel": "インポート", - "xpack.ml.fileDatavisualizer.importView.importDataTitle": "データのインポート", - "xpack.ml.fileDatavisualizer.importView.importPermissionError": "インデックス {index} にデータを作成またはインポートするパーミッションがありません。", - "xpack.ml.fileDatavisualizer.importView.indexNameAlreadyExistsErrorMessage": "インデックス名がすでに存在します", - "xpack.ml.fileDatavisualizer.importView.indexNameContainsIllegalCharactersErrorMessage": "インデックス名に許可されていない文字が含まれています。", - "xpack.ml.fileDatavisualizer.importView.indexPatternDoesNotMatchIndexNameErrorMessage": "インデックスパターンがインデックス名と一致しません", - "xpack.ml.fileDatavisualizer.importView.indexPatternNameAlreadyExistsErrorMessage": "インデックスパターン名がすでに存在します", - "xpack.ml.fileDatavisualizer.importView.parseMappingsError": "マッピングのパース中にエラーが発生しました:", - "xpack.ml.fileDatavisualizer.importView.parsePipelineError": "投入パイプラインのパース中にエラーが発生しました:", - "xpack.ml.fileDatavisualizer.importView.parseSettingsError": "設定のパース中にエラーが発生しました:", - "xpack.ml.fileDatavisualizer.importView.resetButtonLabel": "リセット", - "xpack.ml.fileDatavisualizer.nameCollisionMsg": "「{name}」はすでに存在します。一意の名前を入力してください。", - "xpack.ml.fileDatavisualizer.removeCombinedFieldsLabel": "結合されたフィールドを削除", - "xpack.ml.fileDatavisualizer.resultsLinks.createNewMLJobTitle": "新規 ML ジョブの作成", - "xpack.ml.fileDatavisualizer.resultsLinks.fileBeatConfig": "Filebeat 構成を作成", - "xpack.ml.fileDatavisualizer.resultsLinks.fileBeatConfigBottomText": "{password} が {user} ユーザーのパスワードである場合、{esUrl} は Elasticsearch の URL です。", - "xpack.ml.fileDatavisualizer.resultsLinks.fileBeatConfigBottomTextNoUsername": "{esUrl} が Elasticsearch の URL である場合", - "xpack.ml.fileDatavisualizer.resultsLinks.fileBeatConfigTitle": "Filebeat 構成", - "xpack.ml.fileDatavisualizer.resultsLinks.fileBeatConfigTopText1": "Filebeat を使用して {index} インデックスに追加データをアップロードできます。", - "xpack.ml.fileDatavisualizer.resultsLinks.fileBeatConfigTopText2": "{filebeatYml} を修正して接続情報を設定します。", - "xpack.ml.fileDatavisualizer.resultsLinks.indexManagementTitle": "インデックス管理", - "xpack.ml.fileDatavisualizer.resultsLinks.indexPatternManagementTitle": "インデックスパターン管理", - "xpack.ml.fileDatavisualizer.resultsLinks.openInDataVisualizerTitle": "データビジュアライザーを開く", - "xpack.ml.fileDatavisualizer.resultsLinks.viewIndexInDiscoverTitle": "インデックスを Discover で表示", - "xpack.ml.fileDatavisualizer.resultsView.analysisExplanationButtonLabel": "分析説明", - "xpack.ml.fileDatavisualizer.resultsView.fileStatsName": "ファイル統計", - "xpack.ml.fileDatavisualizer.resultsView.overrideSettingsButtonLabel": "上書き設定", - "xpack.ml.fileDatavisualizer.simpleImportSettings.createIndexPatternLabel": "インデックスパターンを作成", - "xpack.ml.fileDatavisualizer.simpleImportSettings.indexNameAriaLabel": "インデックス名、必須フィールド", - "xpack.ml.fileDatavisualizer.simpleImportSettings.indexNameFormRowLabel": "インデックス名", - "xpack.ml.fileDatavisualizer.simpleImportSettings.indexNamePlaceholder": "インデックス名", - "xpack.ml.fileDatavisualizer.welcomeContent.delimitedTextFilesDescription": "CSV や TSV などの区切られたテキストファイル", - "xpack.ml.fileDatavisualizer.welcomeContent.experimentalFeatureDescription": "これは実験的な機能です。フィードバックがありますか?{githubLink}で問題を報告してください。", - "xpack.ml.fileDatavisualizer.welcomeContent.experimentalFeatureTooltip": "実験的機能。フィードバックをお待ちしています。", - "xpack.ml.fileDatavisualizer.welcomeContent.logFilesWithCommonFormatDescription": "タイムスタンプの一般的フォーマットのログファイル", - "xpack.ml.fileDatavisualizer.welcomeContent.newlineDelimitedJsonDescription": "改行区切りの JSON", - "xpack.ml.fileDatavisualizer.welcomeContent.supportedFileFormatDescription": "ファイルデータビジュアライザーはこれらのファイル形式をサポートしています:", - "xpack.ml.fileDatavisualizer.welcomeContent.uploadedFilesAllowedSizeDescription": "最大{maxFileSize}のファイルをアップロードできます。", - "xpack.ml.fileDatavisualizer.welcomeContent.visualizeDataFromLogFileDescription": "ファイルデータビジュアライザーは、ログファイルのフィールドとメトリックの理解に役立ちます。ファイルをアップロードして、データを分析し、 Elasticsearch インデックスにインポートするか選択できます。", - "xpack.ml.fileDatavisualizer.welcomeContent.visualizeDataFromLogFileTitle": "ログファイルのデータを可視化 {experimentalBadge}", "xpack.ml.fileDataVisualizerDescription": "CSV、NDJSON、またはログファイルをインポートします。", "xpack.ml.fileDataVisualizerTitle": "ファイルをアップロード", "xpack.ml.formatters.metricChangeDescription.actualSameAsTypicalDescription": "実際値が通常値と同じ", @@ -14012,7 +13830,6 @@ "xpack.ml.jobSelector.filterBar.invalidSearchErrorMessage": "無効な検索:{errorMessage}", "xpack.ml.jobSelector.flyoutTitle": "ジョブの選択", "xpack.ml.jobSelector.formControlLabel": "ジョブまたはグループを選択", - "xpack.ml.jobSelector.groupOptionsLabel": "グループ", "xpack.ml.jobSelector.groupsTab": "グループ", "xpack.ml.jobSelector.hideBarBadges": "非表示", "xpack.ml.jobSelector.hideFlyoutBadges": "非表示", @@ -18342,8 +18159,6 @@ "xpack.securitySolution.containers.detectionEngine.createPrePackagedTimelineSuccesDescription": "Elasticから事前にパッケージ化されているタイムラインテンプレートをインストールしました", "xpack.securitySolution.containers.detectionEngine.rulesAndTimelines": "ルールとタイムラインを取得できませんでした", "xpack.securitySolution.containers.detectionEngine.tagFetchFailDescription": "タグを取得できませんでした", - "xpack.securitySolution.containers.errors.dataFetchFailureTitle": "データの取得に失敗", - "xpack.securitySolution.containers.errors.networkFailureTitle": "ネットワーク障害", "xpack.securitySolution.containers.errors.stopJobFailureTitle": "ジョブ停止エラー", "xpack.securitySolution.customizeEventRenderers.customizeEventRenderersDescription": "イベントレンダラーは、イベントで最も関連性が高い詳細情報を自動的に表示し、ストーリーを明らかにします", "xpack.securitySolution.customizeEventRenderers.customizeEventRenderersTitle": "イベントレンダラーのカスタマイズ", @@ -18511,7 +18326,6 @@ "xpack.securitySolution.detectionEngine.createRule.stepDefineRule.indicesHelperDescription": "このルールを実行するElasticsearchインデックスのパターンを入力します。デフォルトでは、セキュリティソリューション詳細設定で定義されたインデックスパターンが含まれます。", "xpack.securitySolution.detectionEngine.createRule.stepDefineRule.machineLearningJobIdHelpText": "手始めに使えるように、一般的なジョブがいくつか提供されています。独自のカスタムジョブを追加するには、{machineLearning} アプリケーションでジョブに「security」のグループを割り当て、ここに表示されるようにします。", "xpack.securitySolution.detectionEngine.createRule.stepDefineRule.machineLearningJobIdRequired": "機械学習ジョブが必要です。", - "xpack.securitySolution.detectionEngine.createRule.stepDefineRule.mlEnableJobWarningTitle": "このMLジョブは現在実行されていません。このルールを有効にする前に、このジョブを「MLジョブ設定」で実行するように設定してください。", "xpack.securitySolution.detectionEngine.createRule.stepDefineRule.mlJobSelectPlaceholderText": "ジョブを選択してください", "xpack.securitySolution.detectionEngine.createRule.stepDefineRule.outputIndiceNameFieldRequiredError": "インデックスパターンが最低1つ必要です。", "xpack.securitySolution.detectionEngine.createRule.stepDefineRule.referencesUrlInvalidError": "URLの形式が無効です", @@ -21758,7 +21572,6 @@ "xpack.transform.groupByLabelForm.editIntervalAriaLabel": "間隔を編集", "xpack.transform.home.breadcrumbTitle": "変換", "xpack.transform.indexPreview.copyClipboardTooltip": "インデックスプレビューの開発コンソールステートメントをクリップボードにコピーします。", - "xpack.transform.indexPreview.copyRuntimeMappingsClipboardTooltip": "ランタイムマッピングの開発コンソールステートメントをクリップボードにコピーします。", "xpack.transform.latestPreview.latestPreviewIncompleteConfigCalloutBody": "1 つ以上の一意キーと並べ替えフィールドを選択してください。", "xpack.transform.licenseCheckErrorMessage": "ライセンス確認失敗", "xpack.transform.list.emptyPromptButtonText": "初めての変換を作成してみましょう。", @@ -21818,14 +21631,12 @@ "xpack.transform.stepDefineForm.advancedEditorHelpText": "詳細エディターでは、変換のピボット構成を編集できます。", "xpack.transform.stepDefineForm.advancedEditorHelpTextLink": "使用可能なオプションの詳細を確認してください。", "xpack.transform.stepDefineForm.advancedEditorLabel": "ピボット構成オブジェクト", - "xpack.transform.stepDefineForm.advancedEditorRuntimeMappingsSwitchLabel": "ランタイムマッピングの編集", "xpack.transform.stepDefineForm.advancedEditorSourceConfigSwitchLabel": "JSONクエリを編集", "xpack.transform.stepDefineForm.advancedEditorSwitchLabel": "JSON構成を編集", "xpack.transform.stepDefineForm.advancedEditorSwitchModalBodyText": "詳細エディターの変更は適用されませんでした。詳細エディターを無効にすると、編集内容が失われます。", "xpack.transform.stepDefineForm.advancedEditorSwitchModalCancelButtonText": "キャンセル", "xpack.transform.stepDefineForm.advancedEditorSwitchModalConfirmButtonText": "詳細エディターを無効にする", "xpack.transform.stepDefineForm.advancedEditorSwitchModalTitle": "適用されていない変更", - "xpack.transform.stepDefineForm.advancedRuntimeMappingsEditorHelpText": "高度なエディターでは、変換構成のランタイムマッピングを編集できます。", "xpack.transform.stepDefineForm.advancedSourceEditorApplyButtonText": "変更を適用", "xpack.transform.stepDefineForm.advancedSourceEditorAriaLabel": "クエリの詳細エディター", "xpack.transform.stepDefineForm.advancedSourceEditorHelpText": "高度なエディターでは、変換構成のソースクエリ句を編集できます。", @@ -21851,8 +21662,6 @@ "xpack.transform.stepDefineForm.pivotLabel": "ピボット", "xpack.transform.stepDefineForm.queryPlaceholderKql": "例:{example}", "xpack.transform.stepDefineForm.queryPlaceholderLucene": "例:{example}", - "xpack.transform.stepDefineForm.runtimeMappingsLabel": "ランタイムマッピング", - "xpack.transform.stepDefineForm.runtimeMappingsListLabel": "{runtimeFields}", "xpack.transform.stepDefineForm.savedSearchLabel": "保存検索", "xpack.transform.stepDefineForm.sortFieldOptionsEmptyError": "並べ替えの条件にする日付フィールドがありません。別のフィールド型を使用するには、構成をクリップボードにコピーして、コンソールで変換を作成し続けます。", "xpack.transform.stepDefineForm.sortHelpText": "最新のドキュメントを特定するために使用する日付フィールドを選択してます。", diff --git a/x-pack/plugins/translations/translations/zh-CN.json b/x-pack/plugins/translations/translations/zh-CN.json index ef6d8f9707553..c8f0f91108440 100644 --- a/x-pack/plugins/translations/translations/zh-CN.json +++ b/x-pack/plugins/translations/translations/zh-CN.json @@ -371,7 +371,6 @@ "core.chrome.legacyBrowserWarning": "您的浏览器不满足 Kibana 的安全要求。", "core.euiBasicTable.selectAllRows": "选择所有行", "core.euiBasicTable.selectThisRow": "选择此行", - "core.euiBasicTable.tableDescription": "以下是包含 {itemCount} 个项的列表。", "core.euiBottomBar.screenReaderAnnouncement": "会有新的菜单打开,其中页面级别控件位于文档的结尾。", "core.euiBreadcrumbs.collapsedBadge.ariaLabel": "显示所有痕迹导航", "core.euiCardSelect.select": "选择", @@ -401,14 +400,12 @@ "core.euiColumnSortingDraggable.toggleLegend": "为字段选择排序方法:", "core.euiComboBoxOptionsList.allOptionsSelected": "您已选择所有可用选项", "core.euiComboBoxOptionsList.alreadyAdded": "{label} 已添加", - "core.euiComboBoxOptionsList.createCustomOption": "按 {key} 键将 {searchValue} 添加为自定义选项", "core.euiComboBoxOptionsList.loadingOptions": "正在加载选项", "core.euiComboBoxOptionsList.noAvailableOptions": "没有任何可用选项", "core.euiComboBoxOptionsList.noMatchingOptions": "{searchValue} 不匹配任何选项", "core.euiComboBoxPill.removeSelection": "将 {children} 从此组中的选择移除", "core.euiCommonlyUsedTimeRanges.legend": "常用", "core.euiDataGrid.screenReaderNotice": "单元格包含交互内容。", - "core.euiDataGridCell.expandButtonTitle": "单击或按 Enter 键以便与单元格内容进行交互", "core.euiDataGridSchema.booleanSortTextAsc": "True-False", "core.euiDataGridSchema.booleanSortTextDesc": "False-True", "core.euiDataGridSchema.currencySortTextAsc": "低-高", @@ -430,10 +427,6 @@ "core.euiImage.openImage": "打开全屏 {alt} 图像", "core.euiLink.external.ariaLabel": "外部链接", "core.euiModal.closeModal": "关闭此模式窗口", - "core.euiPagination.jumpToLastPage": "跳转到末页,即页 {pageCount}", - "core.euiPagination.nextPage": "下一页", - "core.euiPagination.pageOfTotal": "第 {page} 页,共 {total} 页", - "core.euiPagination.previousPage": "上一页", "core.euiPopover.screenReaderAnnouncement": "您在对话框中。要关闭此对话框,请按 Esc 键。", "core.euiQuickSelect.applyButton": "应用", "core.euiQuickSelect.fullDescription": "当前设置为 {timeTense} {timeValue} {timeUnit}。", @@ -458,12 +451,6 @@ "core.euiSelectable.noAvailableOptions": "没有任何可用选项", "core.euiSelectable.noMatchingOptions": "{searchValue} 不匹配任何选项", "core.euiStat.loadingText": "统计正在加载", - "core.euiStep.ariaLabel": "{stepStatus}", - "core.euiStepHorizontal.buttonTitle": "第 {step} 步:{title}{titleAppendix}", - "core.euiStepHorizontal.step": "步骤", - "core.euiStepNumber.hasErrors": "有错误", - "core.euiStepNumber.hasWarnings": "有警告", - "core.euiStepNumber.isComplete": "已完成", "core.euiStyleSelector.buttonText": "密度", "core.euiSuperDatePicker.showDatesButtonLabel": "显示日期", "core.euiSuperSelect.screenReaderAnnouncement": "您位于包含 {optionsCount} 个项目的表单选择器中,必须选择单个选项。使用向上和向下键导航,使用 Esc 键关闭。", @@ -532,15 +519,11 @@ "core.ui_settings.params.maxCellHeightText": "表单元格应占用的最大高度。设置为 0 可禁用截断", "core.ui_settings.params.maxCellHeightTitle": "最大表单元格高度", "core.ui_settings.params.notifications.banner.markdownLinkText": "Markdown 受支持", - "core.ui_settings.params.notifications.bannerLifetimeText": "在屏幕上显示横幅通知的时间 (毫秒) 。设置为 {infinityValue} 将禁用倒计时。", "core.ui_settings.params.notifications.bannerLifetimeTitle": "横幅通知生存时间", "core.ui_settings.params.notifications.bannerText": "用于向所有用户发送临时通知的定制横幅。{markdownLink}。", "core.ui_settings.params.notifications.bannerTitle": "定制横幅通知", - "core.ui_settings.params.notifications.errorLifetimeText": "在屏幕上显示错误通知的时间 (毫秒) 。设置为 {infinityValue} 将禁用此项。", "core.ui_settings.params.notifications.errorLifetimeTitle": "错误通知生存时间", - "core.ui_settings.params.notifications.infoLifetimeText": "在屏幕上显示信息通知的时间 (毫秒) 。设置为 {infinityValue} 将禁用此项。", "core.ui_settings.params.notifications.infoLifetimeTitle": "信息通知生存时间", - "core.ui_settings.params.notifications.warningLifetimeText": "在屏幕上显示警告通知的时间 (毫秒) 。设置为 {infinityValue} 将禁用此项。", "core.ui_settings.params.notifications.warningLifetimeTitle": "警告通知生存时间", "core.ui_settings.params.storeUrlText": "有时,URL 可能会变得过长,使某些浏览器无法进行处理。为此,我们将正测试在会话存储中存储 URL 的组成部分是否会有所帮助。请向我们反馈您的体验!", "core.ui_settings.params.storeUrlTitle": "将 URL 存储在会话存储中", @@ -2828,7 +2811,6 @@ "indexPatternManagement.editIndexPattern.scripted.table.nameHeader": "名称", "indexPatternManagement.editIndexPattern.scripted.table.scriptDescription": "字段的脚本", "indexPatternManagement.editIndexPattern.scripted.table.scriptHeader": "脚本", - "indexPatternManagement.editIndexPattern.scriptedHeader": "脚本字段", "indexPatternManagement.editIndexPattern.scriptedLabel": "可以在可视化中使用脚本字段,并在您的文档中显示它们。但是,您不能搜索脚本字段。", "indexPatternManagement.editIndexPattern.setDefaultAria": "设置为默认索引。", "indexPatternManagement.editIndexPattern.setDefaultTooltip": "设置为默认索引。", @@ -2846,7 +2828,6 @@ "indexPatternManagement.editIndexPattern.source.table.matchesHeader": "匹配", "indexPatternManagement.editIndexPattern.source.table.notMatchedLabel": "源筛选不匹配任何已知字段。", "indexPatternManagement.editIndexPattern.source.table.saveAria": "保存", - "indexPatternManagement.editIndexPattern.sourceHeader": "字段筛选", "indexPatternManagement.editIndexPattern.sourceLabel": "字段筛选可用于在提取文档时排除一个或多个字段。在 Discover 应用中查看文档时会使用字段筛选,表在 Dashboard 应用中显示已保存搜索的结果时也会使用字段筛选。如果您的文档含有较大或不重要的字段,则通过在此较低层级筛除这些字段可能会更好。", "indexPatternManagement.editIndexPattern.sourcePlaceholder": "字段筛选,接受通配符 (例如“user*”用于筛选以“user”开头的字段) ", "indexPatternManagement.editIndexPattern.tabs.fieldsHeader": "字段", @@ -2924,8 +2905,6 @@ "indexPatternManagement.testScript.resultsTitle": "预览结果", "indexPatternManagement.testScript.submitButtonLabel": "运行脚本", "indexPatternManagement.typeLabel": "类型", - "indexPatternManagement.warningCallOut.descriptionLabel": "脚本字段可用于显示并聚合计算值。因此,它们会很慢,如果操作不当,会导致 Kibana 不可用。此处没有安全网。如果拼写错误,则在任何地方都会引发异常!", - "indexPatternManagement.warningCallOutHeader": "谨慎操作", "indexPatternManagement.warningCallOutLabel.callOutDetail": "请先熟悉{scripFields}以及{scriptsInAggregation},然后再使用脚本字段。", "indexPatternManagement.warningCallOutLabel.scripFieldsLink": "脚本字段", "indexPatternManagement.warningCallOutLabel.scriptsInAggregationLink": "聚合中的脚本", @@ -8758,7 +8737,6 @@ "xpack.fleet.settings.elasticHostError": "URL 无效", "xpack.fleet.settings.elasticsearchUrlLabel": "Elasticsearch URL", "xpack.fleet.settings.flyoutTitle": "Fleet 设置", - "xpack.fleet.settings.globalOutputTitle": "全局输出", "xpack.fleet.settings.invalidYamlFormatErrorMessage": "YAML 无效:{reason}", "xpack.fleet.settings.saveButtonLabel": "保存设置", "xpack.fleet.settings.success.message": "设置已保存", @@ -11248,7 +11226,6 @@ "xpack.infra.sourceConfiguration.hostNameFieldDescription": "用于标识主机的字段", "xpack.infra.sourceConfiguration.hostNameFieldLabel": "主机名", "xpack.infra.sourceConfiguration.indicesSectionTitle": "索引", - "xpack.infra.sourceConfiguration.logColumnListEmptyErrorMessage": "日志列列表不得为空。", "xpack.infra.sourceConfiguration.logColumnsSectionTitle": "日志列", "xpack.infra.sourceConfiguration.logIndicesDescription": "用于匹配包含日志数据的索引的索引模式", "xpack.infra.sourceConfiguration.logIndicesLabel": "日志索引", @@ -13799,8 +13776,6 @@ "xpack.ml.datavisualizer.dataGrid.showDistributionsAriaLabel": "显示分布", "xpack.ml.datavisualizer.dataGrid.typeColumnName": "类型", "xpack.ml.datavisualizer.dataLoader.internalServerErrorMessage": "加载索引 {index} 中的数据时出错。{message}。请求可能已超时。请尝试使用较小的样例大小或缩小时间范围。", - "xpack.ml.dataVisualizer.fileBased.fieldNameSelect": "字段名称", - "xpack.ml.dataVisualizer.fileBased.fieldTypeSelect": "字段类型", "xpack.ml.dataVisualizer.fileBasedLabel": "文件", "xpack.ml.dataVisualizer.indexBased.fieldNameSelect": "字段名称", "xpack.ml.dataVisualizer.indexBased.fieldTypeSelect": "字段类型", @@ -13983,165 +13958,6 @@ "xpack.ml.fieldTypeIcon.numberTypeAriaLabel": "数字类型", "xpack.ml.fieldTypeIcon.textTypeAriaLabel": "文本类型", "xpack.ml.fieldTypeIcon.unknownTypeAriaLabel": "未知类型", - "xpack.ml.fileDatavisualizer.aboutPanel.analyzingDataTitle": "正在分析数据", - "xpack.ml.fileDatavisualizer.aboutPanel.selectOrDragAndDropFileDescription": "选择或拖放文件", - "xpack.ml.fileDatavisualizer.addCombinedFieldsLabel": "添加组合字段", - "xpack.ml.fileDatavisualizer.advancedImportSettings.createIndexPatternLabel": "创建索引模式", - "xpack.ml.fileDatavisualizer.advancedImportSettings.indexNameAriaLabel": "索引名称,必填字段", - "xpack.ml.fileDatavisualizer.advancedImportSettings.indexNameLabel": "索引名称", - "xpack.ml.fileDatavisualizer.advancedImportSettings.indexNamePlaceholder": "索引名称", - "xpack.ml.fileDatavisualizer.advancedImportSettings.indexPatternNameLabel": "索引模式名称", - "xpack.ml.fileDatavisualizer.advancedImportSettings.indexSettingsLabel": "索引设置", - "xpack.ml.fileDatavisualizer.advancedImportSettings.ingestPipelineLabel": "采集管道", - "xpack.ml.fileDatavisualizer.advancedImportSettings.mappingsLabel": "映射", - "xpack.ml.fileDatavisualizer.analysisSummary.analyzedLinesNumberTitle": "已分析的行数", - "xpack.ml.fileDatavisualizer.analysisSummary.delimiterTitle": "分隔符", - "xpack.ml.fileDatavisualizer.analysisSummary.formatTitle": "格式", - "xpack.ml.fileDatavisualizer.analysisSummary.grokPatternTitle": "Grok 模式", - "xpack.ml.fileDatavisualizer.analysisSummary.hasHeaderRowTitle": "包含标题行", - "xpack.ml.fileDatavisualizer.analysisSummary.summaryTitle": "摘要", - "xpack.ml.fileDatavisualizer.analysisSummary.timeFieldTitle": "时间字段", - "xpack.ml.fileDatavisualizer.analysisSummary.timeFormatTitle": "时间{timestampFormats, plural, other {格式}}", - "xpack.ml.fileDatavisualizer.bottomBar.backButtonLabel": "返回", - "xpack.ml.fileDatavisualizer.bottomBar.cancelButtonLabel": "取消", - "xpack.ml.fileDatavisualizer.bottomBar.missingImportPrivilegesMessage": "您需要具有 ingest_admin 角色才能启用数据导入", - "xpack.ml.fileDatavisualizer.bottomBar.readMode.cancelButtonLabel": "取消", - "xpack.ml.fileDatavisualizer.bottomBar.readMode.importButtonLabel": "导入", - "xpack.ml.fileDatavisualizer.combinedFieldsForm.mappingsParseError": "解析映射时出错:{error}", - "xpack.ml.fileDatavisualizer.combinedFieldsForm.pipelineParseError": "解析管道时出错:{error}", - "xpack.ml.fileDatavisualizer.combinedFieldsLabel": "组合字段", - "xpack.ml.fileDatavisualizer.combinedFieldsReadOnlyHelpTextLabel": "在高级选项卡中编辑组合字段", - "xpack.ml.fileDatavisualizer.combinedFieldsReadOnlyLabel": "组合字段", - "xpack.ml.fileDatavisualizer.editFlyout.applyOverrideSettingsButtonLabel": "应用", - "xpack.ml.fileDatavisualizer.editFlyout.closeOverrideSettingsButtonLabel": "关闭", - "xpack.ml.fileDatavisualizer.editFlyout.overrides.customDelimiterFormRowLabel": "定制分隔符", - "xpack.ml.fileDatavisualizer.editFlyout.overrides.customTimestampFormatErrorMessage": "时间戳格式必须为以下 Java 日期/时间格式的组合:\n yy、yyyy、M、MM、MMM、MMMM、d、dd、EEE、EEEE、H、HH、h、mm、ss、S 至 SSSSSSSSS、a、XX、XXX、zzz", - "xpack.ml.fileDatavisualizer.editFlyout.overrides.customTimestampFormatFormRowLabel": "定制时间戳格式", - "xpack.ml.fileDatavisualizer.editFlyout.overrides.dataFormatFormRowLabel": "数据格式", - "xpack.ml.fileDatavisualizer.editFlyout.overrides.delimiterFormRowLabel": "分隔符", - "xpack.ml.fileDatavisualizer.editFlyout.overrides.editFieldNamesTitle": "编辑字段名称", - "xpack.ml.fileDatavisualizer.editFlyout.overrides.grokPatternFormRowLabel": "Grok 模式", - "xpack.ml.fileDatavisualizer.editFlyout.overrides.hasHeaderRowLabel": "包含标题行", - "xpack.ml.fileDatavisualizer.editFlyout.overrides.linesToSampleErrorMessage": "值必须大于 {min} 并小于或等于 {max}", - "xpack.ml.fileDatavisualizer.editFlyout.overrides.linesToSampleFormRowLabel": "要采样的行数", - "xpack.ml.fileDatavisualizer.editFlyout.overrides.quoteCharacterFormRowLabel": "引用字符", - "xpack.ml.fileDatavisualizer.editFlyout.overrides.timeFieldFormRowLabel": "时间字段", - "xpack.ml.fileDatavisualizer.editFlyout.overrides.timestampEmptyValidationErrorMessage": "时间戳格式 {timestampFormat} 中没有时间格式字母组", - "xpack.ml.fileDatavisualizer.editFlyout.overrides.timestampFormatFormRowLabel": "时间戳格式", - "xpack.ml.fileDatavisualizer.editFlyout.overrides.timestampFormatHelpText": "请参阅有关接受格式的更多内容。", - "xpack.ml.fileDatavisualizer.editFlyout.overrides.timestampLetterSValidationErrorMessage": "{format}的字母 { length, plural, one { {lg} } other { 组 {lg} } } 不受支持,因为其未前置 ss 和 {sep} 中的分隔符", - "xpack.ml.fileDatavisualizer.editFlyout.overrides.timestampLetterValidationErrorMessage": "{format}的字母 { length, plural, one { {lg} } other { 组 {lg} } } 不受支持", - "xpack.ml.fileDatavisualizer.editFlyout.overrides.timestampQuestionMarkValidationErrorMessage": "时间戳格式 {timestampFormat} 不受支持,因为其包含问号字符 ({fieldPlaceholder})", - "xpack.ml.fileDatavisualizer.editFlyout.overrides.trimFieldsLabel": "应剪裁字段", - "xpack.ml.fileDatavisualizer.editFlyout.overrideSettingsTitle": "替代设置", - "xpack.ml.fileDatavisualizer.experimentalBadge.experimentalLabel": "实验性", - "xpack.ml.fileDatavisualizer.explanationFlyout.closeButton": "关闭", - "xpack.ml.fileDatavisualizer.explanationFlyout.content": "产生分析结果的逻辑步骤。", - "xpack.ml.fileDatavisualizer.explanationFlyout.title": "分析说明", - "xpack.ml.fileDatavisualizer.fieldStatsCard.maxTitle": "最大值", - "xpack.ml.fileDatavisualizer.fieldStatsCard.medianTitle": "中值", - "xpack.ml.fileDatavisualizer.fieldStatsCard.minTitle": "最小值", - "xpack.ml.fileDatavisualizer.fileBeatConfig.paths": "在此处将路径添加您的文件中", - "xpack.ml.fileDatavisualizer.fileBeatConfigFlyout.closeButton": "关闭", - "xpack.ml.fileDatavisualizer.fileBeatConfigFlyout.copyButton": "复制到剪贴板", - "xpack.ml.fileDatavisualizer.fileContents.fileContentsTitle": "文件内容", - "xpack.ml.fileDatavisualizer.fileContents.firstLinesDescription": "前 {numberOfLines, plural, other {# 行}}", - "xpack.ml.fileDatavisualizer.fileDatavisualizerView.xmlNotCurrentlySupportedErrorMessage": "当前不支持 XML", - "xpack.ml.fileDatavisualizer.fileErrorCallouts.applyOverridesDescription": "如果您对此数据有所了解,例如文件格式或时间戳格式,则添加初始覆盖可以帮助我们推理结构的其余部分。", - "xpack.ml.fileDatavisualizer.fileErrorCallouts.fileCouldNotBeReadTitle": "无法确定文件结构", - "xpack.ml.fileDatavisualizer.fileErrorCallouts.fileSizeExceedsAllowedSizeByDiffFormatErrorMessage": "您选择用于上传的文件大小超过上限值 {maxFileSizeFormatted} 的 {diffFormatted}", - "xpack.ml.fileDatavisualizer.fileErrorCallouts.fileSizeExceedsAllowedSizeErrorMessage": "您选择用于上传的文件大小为 {fileSizeFormatted},超过上限值 {maxFileSizeFormatted}", - "xpack.ml.fileDatavisualizer.fileErrorCallouts.fileSizeTooLargeTitle": "文件太大", - "xpack.ml.fileDatavisualizer.fileErrorCallouts.overrideButton": "应用覆盖设置", - "xpack.ml.fileDatavisualizer.fileErrorCallouts.revertingToPreviousSettingsDescription": "恢复到以前的设置", - "xpack.ml.fileDatavisualizer.geoPointCombinedFieldLabel": "添加地理点字段", - "xpack.ml.fileDatavisualizer.geoPointForm.geoPointFieldAriaLabel": "地理点字段,必填字段", - "xpack.ml.fileDatavisualizer.geoPointForm.geoPointFieldLabel": "地理点字段", - "xpack.ml.fileDatavisualizer.geoPointForm.latFieldLabel": "纬度字段", - "xpack.ml.fileDatavisualizer.geoPointForm.lonFieldLabel": "经度字段", - "xpack.ml.fileDatavisualizer.geoPointForm.submitButtonLabel": "添加", - "xpack.ml.fileDatavisualizer.importErrors.checkingPermissionErrorMessage": "导入权限错误", - "xpack.ml.fileDatavisualizer.importErrors.creatingIndexErrorMessage": "创建索引时出错", - "xpack.ml.fileDatavisualizer.importErrors.creatingIndexPatternErrorMessage": "创建索引模式时出错", - "xpack.ml.fileDatavisualizer.importErrors.creatingIngestPipelineErrorMessage": "创建采集管道时出错", - "xpack.ml.fileDatavisualizer.importErrors.defaultErrorMessage": "错误", - "xpack.ml.fileDatavisualizer.importErrors.moreButtonLabel": "更多", - "xpack.ml.fileDatavisualizer.importErrors.parsingJSONErrorMessage": "解析 JSON 出错", - "xpack.ml.fileDatavisualizer.importErrors.readingFileErrorMessage": "读取文件时出错", - "xpack.ml.fileDatavisualizer.importErrors.unknownErrorMessage": "未知错误", - "xpack.ml.fileDatavisualizer.importErrors.uploadingDataErrorMessage": "上传数据时出错", - "xpack.ml.fileDatavisualizer.importProgress.createIndexPatternTitle": "创建索引模式", - "xpack.ml.fileDatavisualizer.importProgress.createIndexTitle": "创建索引", - "xpack.ml.fileDatavisualizer.importProgress.createIngestPipelineTitle": "创建采集管道", - "xpack.ml.fileDatavisualizer.importProgress.creatingIndexPatternDescription": "正在创建索引模式", - "xpack.ml.fileDatavisualizer.importProgress.creatingIndexPatternTitle": "正在创建索引模式", - "xpack.ml.fileDatavisualizer.importProgress.creatingIndexTitle": "正在创建索引", - "xpack.ml.fileDatavisualizer.importProgress.creatingIngestPipelineTitle": "正在创建采集管道", - "xpack.ml.fileDatavisualizer.importProgress.dataUploadedTitle": "数据已上传", - "xpack.ml.fileDatavisualizer.importProgress.fileProcessedTitle": "文件已处理", - "xpack.ml.fileDatavisualizer.importProgress.indexCreatedTitle": "索引已创建", - "xpack.ml.fileDatavisualizer.importProgress.indexPatternCreatedTitle": "索引模式已创建", - "xpack.ml.fileDatavisualizer.importProgress.ingestPipelineCreatedTitle": "采集管道已创建", - "xpack.ml.fileDatavisualizer.importProgress.processFileTitle": "处理文件", - "xpack.ml.fileDatavisualizer.importProgress.processingFileTitle": "正在处理文件", - "xpack.ml.fileDatavisualizer.importProgress.processingImportedFileDescription": "正在处理要导入的文件", - "xpack.ml.fileDatavisualizer.importProgress.stepTwoCreatingIndexDescription": "正在创建索引", - "xpack.ml.fileDatavisualizer.importProgress.stepTwoCreatingIndexIngestPipelineDescription": "正在创建索引和采集管道", - "xpack.ml.fileDatavisualizer.importProgress.uploadDataTitle": "上传数据", - "xpack.ml.fileDatavisualizer.importProgress.uploadingDataDescription": "正在上传数据", - "xpack.ml.fileDatavisualizer.importProgress.uploadingDataTitle": "正在上传数据", - "xpack.ml.fileDatavisualizer.importSettings.advancedTabName": "高级", - "xpack.ml.fileDatavisualizer.importSettings.simpleTabName": "简单", - "xpack.ml.fileDatavisualizer.importSummary.documentsCouldNotBeImportedDescription": "无法导入 {importFailuresLength} 个文档,共 {docCount} 个。这可能是由于行与 Grok 模式不匹配。", - "xpack.ml.fileDatavisualizer.importSummary.documentsCouldNotBeImportedTitle": "部分文档无法导入", - "xpack.ml.fileDatavisualizer.importSummary.documentsIngestedTitle": "已采集的文档", - "xpack.ml.fileDatavisualizer.importSummary.failedDocumentsButtonLabel": "失败的文档", - "xpack.ml.fileDatavisualizer.importSummary.failedDocumentsTitle": "失败的文档", - "xpack.ml.fileDatavisualizer.importSummary.importCompleteTitle": "导入完成", - "xpack.ml.fileDatavisualizer.importSummary.indexPatternTitle": "索引模式", - "xpack.ml.fileDatavisualizer.importSummary.indexTitle": "索引", - "xpack.ml.fileDatavisualizer.importSummary.ingestPipelineTitle": "采集管道", - "xpack.ml.fileDatavisualizer.importView.experimentalFeatureTooltip": "实验性功能。我们很乐意听取您的反馈意见。", - "xpack.ml.fileDatavisualizer.importView.importButtonLabel": "导入", - "xpack.ml.fileDatavisualizer.importView.importDataTitle": "导入数据", - "xpack.ml.fileDatavisualizer.importView.importPermissionError": "您无权创建或将数据导入索引 {index}", - "xpack.ml.fileDatavisualizer.importView.indexNameAlreadyExistsErrorMessage": "索引名称已存在", - "xpack.ml.fileDatavisualizer.importView.indexNameContainsIllegalCharactersErrorMessage": "索引名称包含非法字符", - "xpack.ml.fileDatavisualizer.importView.indexPatternDoesNotMatchIndexNameErrorMessage": "索引模式与索引名称不匹配", - "xpack.ml.fileDatavisualizer.importView.indexPatternNameAlreadyExistsErrorMessage": "索引模式名称已存在", - "xpack.ml.fileDatavisualizer.importView.parseMappingsError": "解析映射时出错:", - "xpack.ml.fileDatavisualizer.importView.parsePipelineError": "解析采集管道时出错:", - "xpack.ml.fileDatavisualizer.importView.parseSettingsError": "解析设置时出错:", - "xpack.ml.fileDatavisualizer.importView.resetButtonLabel": "重置", - "xpack.ml.fileDatavisualizer.nameCollisionMsg": "“{name}”已存在,请提供唯一名称", - "xpack.ml.fileDatavisualizer.removeCombinedFieldsLabel": "移除组合字段", - "xpack.ml.fileDatavisualizer.resultsLinks.createNewMLJobTitle": "新建 ML 作业", - "xpack.ml.fileDatavisualizer.resultsLinks.fileBeatConfig": "创建 Filebeat 配置", - "xpack.ml.fileDatavisualizer.resultsLinks.fileBeatConfigBottomText": "其中 {password} 是 {user} 用户的密码,{esUrl} 是 Elasticsearch 的 URL。", - "xpack.ml.fileDatavisualizer.resultsLinks.fileBeatConfigBottomTextNoUsername": "其中 {esUrl} 是 Elasticsearch 的 URL。", - "xpack.ml.fileDatavisualizer.resultsLinks.fileBeatConfigTitle": "Filebeat 配置", - "xpack.ml.fileDatavisualizer.resultsLinks.fileBeatConfigTopText1": "可以使用 Filebeat 将其他数据上传到 {index} 索引。", - "xpack.ml.fileDatavisualizer.resultsLinks.fileBeatConfigTopText2": "修改 {filebeatYml} 以设置连接信息:", - "xpack.ml.fileDatavisualizer.resultsLinks.indexManagementTitle": "索引管理", - "xpack.ml.fileDatavisualizer.resultsLinks.indexPatternManagementTitle": "索引模式管理", - "xpack.ml.fileDatavisualizer.resultsLinks.openInDataVisualizerTitle": "在数据可视化工具中打开", - "xpack.ml.fileDatavisualizer.resultsLinks.viewIndexInDiscoverTitle": "在 Discover 中查看索引", - "xpack.ml.fileDatavisualizer.resultsView.analysisExplanationButtonLabel": "分析说明", - "xpack.ml.fileDatavisualizer.resultsView.fileStatsName": "文件统计", - "xpack.ml.fileDatavisualizer.resultsView.overrideSettingsButtonLabel": "替代设置", - "xpack.ml.fileDatavisualizer.simpleImportSettings.createIndexPatternLabel": "创建索引模式", - "xpack.ml.fileDatavisualizer.simpleImportSettings.indexNameAriaLabel": "索引名称,必填字段", - "xpack.ml.fileDatavisualizer.simpleImportSettings.indexNameFormRowLabel": "索引名称", - "xpack.ml.fileDatavisualizer.simpleImportSettings.indexNamePlaceholder": "索引名称", - "xpack.ml.fileDatavisualizer.welcomeContent.delimitedTextFilesDescription": "分隔的文本文件,例如 CSV 和 TSV", - "xpack.ml.fileDatavisualizer.welcomeContent.experimentalFeatureDescription": "此功能为实验性功能。有反馈?如欲提供反馈,请在 {githubLink} 中创建问题。", - "xpack.ml.fileDatavisualizer.welcomeContent.experimentalFeatureTooltip": "实验性功能。我们很乐意听取您的反馈意见。", - "xpack.ml.fileDatavisualizer.welcomeContent.logFilesWithCommonFormatDescription": "具有时间戳通用格式的日志文件", - "xpack.ml.fileDatavisualizer.welcomeContent.newlineDelimitedJsonDescription": "换行符分隔的 JSON", - "xpack.ml.fileDatavisualizer.welcomeContent.supportedFileFormatDescription": "File Data Visualizer 支持以下文件格式:", - "xpack.ml.fileDatavisualizer.welcomeContent.uploadedFilesAllowedSizeDescription": "您可以上传不超过 {maxFileSize} 的文件。", - "xpack.ml.fileDatavisualizer.welcomeContent.visualizeDataFromLogFileDescription": "File Data Visualizer 可帮助您理解日志文件中的字段和指标。上传文件、分析文件数据,然后选择是否将数据导入 Elasticsearch 索引。", - "xpack.ml.fileDatavisualizer.welcomeContent.visualizeDataFromLogFileTitle": "可视化来自日志文件的数据 {experimentalBadge}", "xpack.ml.fileDataVisualizerDescription": "导入您自己的 CSV、NDJSON 或日志文件。", "xpack.ml.fileDataVisualizerTitle": "上传文件", "xpack.ml.formatters.metricChangeDescription.actualSameAsTypicalDescription": "实际上与典型模式相同", @@ -14201,7 +14017,6 @@ "xpack.ml.jobSelector.filterBar.jobGroupTitle": "({jobsCount, plural, other {# 个作业}})", "xpack.ml.jobSelector.flyoutTitle": "作业选择", "xpack.ml.jobSelector.formControlLabel": "选择作业或组", - "xpack.ml.jobSelector.groupOptionsLabel": "组", "xpack.ml.jobSelector.groupsTab": "组", "xpack.ml.jobSelector.hideBarBadges": "隐藏", "xpack.ml.jobSelector.hideFlyoutBadges": "隐藏", @@ -18605,8 +18420,6 @@ "xpack.securitySolution.containers.detectionEngine.createPrePackagedTimelineSuccesDescription": "安装 Elastic 预先打包的时间线模板", "xpack.securitySolution.containers.detectionEngine.rulesAndTimelines": "无法提取规则和时间线", "xpack.securitySolution.containers.detectionEngine.tagFetchFailDescription": "无法提取标签", - "xpack.securitySolution.containers.errors.dataFetchFailureTitle": "数据提取失败", - "xpack.securitySolution.containers.errors.networkFailureTitle": "网络故障", "xpack.securitySolution.containers.errors.stopJobFailureTitle": "停止作业失败", "xpack.securitySolution.customizeEventRenderers.customizeEventRenderersDescription": "事件呈现器自动在事件中传送最相关的详情,以揭示其故事", "xpack.securitySolution.customizeEventRenderers.customizeEventRenderersTitle": "定制事件呈现器", @@ -18782,7 +18595,6 @@ "xpack.securitySolution.detectionEngine.createRule.stepDefineRule.indicesHelperDescription": "输入要运行此规则的 Elasticsearch 索引的模式。默认情况下,将包括 Security Solution 高级设置中定义的索引模式。", "xpack.securitySolution.detectionEngine.createRule.stepDefineRule.machineLearningJobIdHelpText": "我们提供了一些常见作业来帮助您入门。要添加自己的定制规则,请在 {machineLearning} 应用程序中将一组“security”分配给这些作业,以使其显示在此处。", "xpack.securitySolution.detectionEngine.createRule.stepDefineRule.machineLearningJobIdRequired": "Machine Learning 作业必填。", - "xpack.securitySolution.detectionEngine.createRule.stepDefineRule.mlEnableJobWarningTitle": "此 ML 作业当前未运行。在激活此规则之前请通过“ML 作业设置”设置此作业以使其运行。", "xpack.securitySolution.detectionEngine.createRule.stepDefineRule.mlJobSelectPlaceholderText": "选择作业", "xpack.securitySolution.detectionEngine.createRule.stepDefineRule.outputIndiceNameFieldRequiredError": "至少需要一个索引模式。", "xpack.securitySolution.detectionEngine.createRule.stepDefineRule.referencesUrlInvalidError": "Url 的格式无效", @@ -22106,7 +21918,6 @@ "xpack.transform.groupByLabelForm.editIntervalAriaLabel": "编辑时间间隔", "xpack.transform.home.breadcrumbTitle": "转换", "xpack.transform.indexPreview.copyClipboardTooltip": "将索引预览的开发控制台语句复制到剪贴板。", - "xpack.transform.indexPreview.copyRuntimeMappingsClipboardTooltip": "将运行时映射的开发控制台语句复制到剪贴板。", "xpack.transform.latestPreview.latestPreviewIncompleteConfigCalloutBody": "请选择至少一个唯一键和排序字段。", "xpack.transform.licenseCheckErrorMessage": "许可证检查失败", "xpack.transform.list.emptyPromptButtonText": "创建您的首个转换", @@ -22167,14 +21978,12 @@ "xpack.transform.stepDefineForm.advancedEditorHelpText": "高级编辑器允许您编辑数据帧转换的数据透视表配置。", "xpack.transform.stepDefineForm.advancedEditorHelpTextLink": "详细了解可用选项。", "xpack.transform.stepDefineForm.advancedEditorLabel": "数据透视表配置对象", - "xpack.transform.stepDefineForm.advancedEditorRuntimeMappingsSwitchLabel": "编辑运行时映射", "xpack.transform.stepDefineForm.advancedEditorSourceConfigSwitchLabel": "编辑 JSON 查询", "xpack.transform.stepDefineForm.advancedEditorSwitchLabel": "编辑 JSON 配置", "xpack.transform.stepDefineForm.advancedEditorSwitchModalBodyText": "高级编辑器中的更改尚未应用。禁用高级编辑器将会使您的编辑丢失。", "xpack.transform.stepDefineForm.advancedEditorSwitchModalCancelButtonText": "取消", "xpack.transform.stepDefineForm.advancedEditorSwitchModalConfirmButtonText": "禁用高级编辑器", "xpack.transform.stepDefineForm.advancedEditorSwitchModalTitle": "未应用的更改", - "xpack.transform.stepDefineForm.advancedRuntimeMappingsEditorHelpText": "高级编辑器允许您编辑转换配置的运行时映射。", "xpack.transform.stepDefineForm.advancedSourceEditorApplyButtonText": "应用更改", "xpack.transform.stepDefineForm.advancedSourceEditorAriaLabel": "高级查询编辑器", "xpack.transform.stepDefineForm.advancedSourceEditorHelpText": "高级编辑器允许您编辑转换配置的源查询子句。", @@ -22200,8 +22009,6 @@ "xpack.transform.stepDefineForm.pivotLabel": "数据透视表", "xpack.transform.stepDefineForm.queryPlaceholderKql": "例如,{example}", "xpack.transform.stepDefineForm.queryPlaceholderLucene": "例如,{example}", - "xpack.transform.stepDefineForm.runtimeMappingsLabel": "运行时映射", - "xpack.transform.stepDefineForm.runtimeMappingsListLabel": "{runtimeFields}", "xpack.transform.stepDefineForm.savedSearchLabel": "已保存搜索", "xpack.transform.stepDefineForm.sortFieldOptionsEmptyError": "没有日期字段可用于排序。要使用其他字段类型,请将配置复制到剪贴板,然后继续在控制台中创建转换。", "xpack.transform.stepDefineForm.sortHelpText": "选择要用于标识最新文档的日期字段。", diff --git a/x-pack/plugins/triggers_actions_ui/public/application/home.test.tsx b/x-pack/plugins/triggers_actions_ui/public/application/home.test.tsx index 3d71d5404da2b..0e1c27c1e6768 100644 --- a/x-pack/plugins/triggers_actions_ui/public/application/home.test.tsx +++ b/x-pack/plugins/triggers_actions_ui/public/application/home.test.tsx @@ -37,7 +37,7 @@ describe('home', () => { const documentationLink = wrapper.find('[data-test-subj="documentationLink"]'); expect(documentationLink.exists()).toBeTruthy(); expect(documentationLink.first().prop('href')).toEqual( - 'https://www.elastic.co/guide/en/kibana/mocked-test-branch/managing-alerts-and-actions.html' + 'https://www.elastic.co/guide/en/kibana/mocked-test-branch/alert-management.html' ); }); }); diff --git a/x-pack/plugins/uptime/common/runtime_types/common.ts b/x-pack/plugins/uptime/common/runtime_types/common.ts index de738158cee45..4262a1a244568 100644 --- a/x-pack/plugins/uptime/common/runtime_types/common.ts +++ b/x-pack/plugins/uptime/common/runtime_types/common.ts @@ -30,6 +30,7 @@ export const SummaryType = t.partial({ export const StatesIndexStatusType = t.type({ indexExists: t.boolean, docCount: t.number, + indices: t.string, }); export const DateRangeType = t.type({ diff --git a/x-pack/plugins/uptime/kibana.json b/x-pack/plugins/uptime/kibana.json index 4ba836c1e5d26..0d2346f59b0a1 100644 --- a/x-pack/plugins/uptime/kibana.json +++ b/x-pack/plugins/uptime/kibana.json @@ -9,7 +9,8 @@ "data", "home", "observability", - "ml" + "ml", + "fleet" ], "requiredPlugins": [ "alerting", diff --git a/x-pack/plugins/uptime/public/apps/plugin.ts b/x-pack/plugins/uptime/public/apps/plugin.ts index a578fced134e8..0832274f0785a 100644 --- a/x-pack/plugins/uptime/public/apps/plugin.ts +++ b/x-pack/plugins/uptime/public/apps/plugin.ts @@ -27,9 +27,14 @@ import { DataPublicPluginStart, } from '../../../../../src/plugins/data/public'; import { alertTypeInitializers } from '../lib/alert_types'; +import { FleetStart } from '../../../fleet/public'; import { FetchDataParams, ObservabilityPublicSetup } from '../../../observability/public'; import { PLUGIN } from '../../common/constants/plugin'; import { IStorageWrapper } from '../../../../../src/plugins/kibana_utils/public'; +import { + LazySyntheticsPolicyCreateExtension, + LazySyntheticsPolicyEditExtension, +} from '../components/fleet_package'; export interface ClientPluginsSetup { data: DataPublicPluginSetup; @@ -42,6 +47,7 @@ export interface ClientPluginsStart { embeddable: EmbeddableStart; data: DataPublicPluginStart; triggersActionsUi: TriggersAndActionsUIPublicPluginStart; + fleet?: FleetStart; } export interface UptimePluginServices extends Partial { @@ -79,11 +85,11 @@ export class UptimePlugin if (plugins.observability) { plugins.observability.dashboard.register({ - appName: 'uptime', + appName: 'synthetics', hasData: async () => { const dataHelper = await getUptimeDataHelper(); const status = await dataHelper.indexStatus(); - return status.docCount > 0; + return { hasData: status.docCount > 0, indices: status.indices }; }, fetchData: async (params: FetchDataParams) => { const dataHelper = await getUptimeDataHelper(); @@ -143,6 +149,22 @@ export class UptimePlugin plugins.triggersActionsUi.alertTypeRegistry.register(alertInitializer); } }); + + if (plugins.fleet) { + const { registerExtension } = plugins.fleet; + + registerExtension({ + package: 'synthetics', + view: 'package-policy-create', + component: LazySyntheticsPolicyCreateExtension, + }); + + registerExtension({ + package: 'synthetics', + view: 'package-policy-edit', + component: LazySyntheticsPolicyEditExtension, + }); + } } public stop(): void {} diff --git a/x-pack/plugins/uptime/public/components/common/charts/ping_histogram.tsx b/x-pack/plugins/uptime/public/components/common/charts/ping_histogram.tsx index db4e7b968c2db..09273b1a3f95e 100644 --- a/x-pack/plugins/uptime/public/components/common/charts/ping_histogram.tsx +++ b/x-pack/plugins/uptime/public/components/common/charts/ping_histogram.tsx @@ -16,7 +16,7 @@ import { XYChartElementEvent, ElementClickListener, } from '@elastic/charts'; -import { EuiTitle, EuiSpacer } from '@elastic/eui'; +import { EuiTitle, EuiFlexGroup, EuiFlexItem, EuiButton } from '@elastic/eui'; import { i18n } from '@kbn/i18n'; import React, { useContext } from 'react'; import { FormattedMessage } from '@kbn/i18n/react'; @@ -26,10 +26,12 @@ import { getChartDateLabel } from '../../../lib/helper'; import { ChartWrapper } from './chart_wrapper'; import { UptimeThemeContext } from '../../../contexts'; import { HistogramResult } from '../../../../common/runtime_types'; -import { useUrlParams } from '../../../hooks'; +import { useMonitorId, useUrlParams } from '../../../hooks'; import { ChartEmptyState } from './chart_empty_state'; import { getDateRangeFromChartElement } from './utils'; import { STATUS_DOWN_LABEL, STATUS_UP_LABEL } from '../translations'; +import { createExploratoryViewUrl } from '../../../../../observability/public'; +import { useUptimeSettingsContext } from '../../../contexts/uptime_settings_context'; export interface PingHistogramComponentProps { /** @@ -69,7 +71,13 @@ export const PingHistogramComponent: React.FC = ({ chartTheme, } = useContext(UptimeThemeContext); - const [, updateUrlParams] = useUrlParams(); + const monitorId = useMonitorId(); + + const { basePath } = useUptimeSettingsContext(); + + const [getUrlParams, updateUrlParams] = useUrlParams(); + + const { dateRangeStart, dateRangeEnd } = getUrlParams(); let content: JSX.Element | undefined; if (!data?.histogram?.length) { @@ -179,17 +187,36 @@ export const PingHistogramComponent: React.FC = ({ ); } + const pingHistogramExploratoryViewLink = createExploratoryViewUrl( + { + 'pings-over-time': { + reportType: 'upp', + time: { from: dateRangeStart, to: dateRangeEnd }, + ...(monitorId ? { filters: [{ field: 'monitor.id', values: [monitorId] }] } : {}), + }, + }, + basePath + ); + return ( <> - -

    - -

    -
    - + + + +

    + +

    +
    +
    + + + + + +
    {content} ); diff --git a/x-pack/plugins/uptime/public/components/fleet_package/combo_box.test.tsx b/x-pack/plugins/uptime/public/components/fleet_package/combo_box.test.tsx new file mode 100644 index 0000000000000..932bce9328d4c --- /dev/null +++ b/x-pack/plugins/uptime/public/components/fleet_package/combo_box.test.tsx @@ -0,0 +1,23 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import React from 'react'; +import { render } from '../../lib/helper/rtl_helpers'; +import { ComboBox } from './combo_box'; + +describe('', () => { + const onChange = jest.fn(); + const selectedOptions: string[] = []; + + it('renders ComboBox', () => { + const { getByTestId } = render( + + ); + + expect(getByTestId('syntheticsFleetComboBox')).toBeInTheDocument(); + }); +}); diff --git a/x-pack/plugins/uptime/public/components/fleet_package/combo_box.tsx b/x-pack/plugins/uptime/public/components/fleet_package/combo_box.tsx new file mode 100644 index 0000000000000..12ee154dbcac4 --- /dev/null +++ b/x-pack/plugins/uptime/public/components/fleet_package/combo_box.tsx @@ -0,0 +1,76 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import React, { useState, useCallback } from 'react'; +import { EuiComboBox, EuiComboBoxOptionOption } from '@elastic/eui'; + +export interface Props { + onChange: (value: string[]) => void; + selectedOptions: string[]; +} + +export const ComboBox = ({ onChange, selectedOptions }: Props) => { + const [formattedSelectedOptions, setSelectedOptions] = useState< + Array> + >(selectedOptions.map((option) => ({ label: option, key: option }))); + const [isInvalid, setInvalid] = useState(false); + + const onOptionsChange = useCallback( + (options: Array>) => { + setSelectedOptions(options); + const formattedTags = options.map((option) => option.label); + onChange(formattedTags); + setInvalid(false); + }, + [onChange, setSelectedOptions, setInvalid] + ); + + const onCreateOption = useCallback( + (tag: string) => { + const formattedTag = tag.trim(); + const newOption = { + label: formattedTag, + }; + + onChange([...selectedOptions, formattedTag]); + + // Select the option. + setSelectedOptions([...formattedSelectedOptions, newOption]); + }, + [onChange, formattedSelectedOptions, selectedOptions, setSelectedOptions] + ); + + const onSearchChange = useCallback( + (searchValue: string) => { + if (!searchValue) { + setInvalid(false); + + return; + } + + setInvalid(!isValid(searchValue)); + }, + [setInvalid] + ); + + return ( + + data-test-subj="syntheticsFleetComboBox" + noSuggestions + selectedOptions={formattedSelectedOptions} + onCreateOption={onCreateOption} + onChange={onOptionsChange} + onSearchChange={onSearchChange} + isInvalid={isInvalid} + /> + ); +}; + +const isValid = (value: string) => { + // Ensure that the tag is more than whitespace + return value.match(/\S+/) !== null; +}; diff --git a/x-pack/plugins/uptime/public/components/fleet_package/contexts/advanced_fields_http_context.tsx b/x-pack/plugins/uptime/public/components/fleet_package/contexts/advanced_fields_http_context.tsx new file mode 100644 index 0000000000000..c257a8f71b77a --- /dev/null +++ b/x-pack/plugins/uptime/public/components/fleet_package/contexts/advanced_fields_http_context.tsx @@ -0,0 +1,69 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import React, { createContext, useContext, useMemo, useState } from 'react'; +import { + IHTTPAdvancedFields, + ConfigKeys, + Mode, + ResponseBodyIndexPolicy, + HTTPMethod, +} from '../types'; + +interface IHTTPAdvancedFieldsContext { + setFields: React.Dispatch>; + fields: IHTTPAdvancedFields; + defaultValues: IHTTPAdvancedFields; +} + +interface IHTTPAdvancedFieldsContextProvider { + children: React.ReactNode; + defaultValues?: IHTTPAdvancedFields; +} + +export const initialValues = { + [ConfigKeys.PASSWORD]: '', + [ConfigKeys.PROXY_URL]: '', + [ConfigKeys.RESPONSE_BODY_CHECK_NEGATIVE]: [], + [ConfigKeys.RESPONSE_BODY_CHECK_POSITIVE]: [], + [ConfigKeys.RESPONSE_BODY_INDEX]: ResponseBodyIndexPolicy.ON_ERROR, + [ConfigKeys.RESPONSE_HEADERS_CHECK]: {}, + [ConfigKeys.RESPONSE_HEADERS_INDEX]: true, + [ConfigKeys.RESPONSE_STATUS_CHECK]: [], + [ConfigKeys.REQUEST_BODY_CHECK]: { + value: '', + type: Mode.TEXT, + }, + [ConfigKeys.REQUEST_HEADERS_CHECK]: {}, + [ConfigKeys.REQUEST_METHOD_CHECK]: HTTPMethod.GET, + [ConfigKeys.USERNAME]: '', +}; + +export const defaultContext: IHTTPAdvancedFieldsContext = { + setFields: (_fields: React.SetStateAction) => { + throw new Error('setFields was not initialized, set it when you invoke the context'); + }, + fields: initialValues, + defaultValues: initialValues, +}; + +export const HTTPAdvancedFieldsContext = createContext(defaultContext); + +export const HTTPAdvancedFieldsContextProvider = ({ + children, + defaultValues = initialValues, +}: IHTTPAdvancedFieldsContextProvider) => { + const [fields, setFields] = useState(defaultValues); + + const value = useMemo(() => { + return { fields, setFields, defaultValues }; + }, [fields, defaultValues]); + + return ; +}; + +export const useHTTPAdvancedFieldsContext = () => useContext(HTTPAdvancedFieldsContext); diff --git a/x-pack/plugins/uptime/public/components/fleet_package/contexts/advanced_fields_tcp_context.tsx b/x-pack/plugins/uptime/public/components/fleet_package/contexts/advanced_fields_tcp_context.tsx new file mode 100644 index 0000000000000..6e4f46111c283 --- /dev/null +++ b/x-pack/plugins/uptime/public/components/fleet_package/contexts/advanced_fields_tcp_context.tsx @@ -0,0 +1,52 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import React, { createContext, useContext, useMemo, useState } from 'react'; +import { ITCPAdvancedFields, ConfigKeys } from '../types'; + +interface ITCPAdvancedFieldsContext { + setFields: React.Dispatch>; + fields: ITCPAdvancedFields; + defaultValues: ITCPAdvancedFields; +} + +interface ITCPAdvancedFieldsContextProvider { + children: React.ReactNode; + defaultValues?: ITCPAdvancedFields; +} + +export const initialValues = { + [ConfigKeys.PROXY_URL]: '', + [ConfigKeys.PROXY_USE_LOCAL_RESOLVER]: false, + [ConfigKeys.RESPONSE_RECEIVE_CHECK]: '', + [ConfigKeys.REQUEST_SEND_CHECK]: '', +}; + +const defaultContext: ITCPAdvancedFieldsContext = { + setFields: (_fields: React.SetStateAction) => { + throw new Error('setFields was not initialized, set it when you invoke the context'); + }, + fields: initialValues, // mutable + defaultValues: initialValues, // immutable +}; + +export const TCPAdvancedFieldsContext = createContext(defaultContext); + +export const TCPAdvancedFieldsContextProvider = ({ + children, + defaultValues = initialValues, +}: ITCPAdvancedFieldsContextProvider) => { + const [fields, setFields] = useState(defaultValues); + + const value = useMemo(() => { + return { fields, setFields, defaultValues }; + }, [fields, defaultValues]); + + return ; +}; + +export const useTCPAdvancedFieldsContext = () => useContext(TCPAdvancedFieldsContext); diff --git a/x-pack/plugins/uptime/public/components/fleet_package/contexts/index.ts b/x-pack/plugins/uptime/public/components/fleet_package/contexts/index.ts new file mode 100644 index 0000000000000..bea3e9d5641a5 --- /dev/null +++ b/x-pack/plugins/uptime/public/components/fleet_package/contexts/index.ts @@ -0,0 +1,31 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +export { + SimpleFieldsContext, + SimpleFieldsContextProvider, + initialValues as defaultSimpleFields, + useSimpleFieldsContext, +} from './simple_fields_context'; +export { + TCPAdvancedFieldsContext, + TCPAdvancedFieldsContextProvider, + initialValues as defaultTCPAdvancedFields, + useTCPAdvancedFieldsContext, +} from './advanced_fields_tcp_context'; +export { + HTTPAdvancedFieldsContext, + HTTPAdvancedFieldsContextProvider, + initialValues as defaultHTTPAdvancedFields, + useHTTPAdvancedFieldsContext, +} from './advanced_fields_http_context'; +export { + TLSFieldsContext, + TLSFieldsContextProvider, + initialValues as defaultTLSFields, + useTLSFieldsContext, +} from './tls_fields_context'; diff --git a/x-pack/plugins/uptime/public/components/fleet_package/contexts/simple_fields_context.tsx b/x-pack/plugins/uptime/public/components/fleet_package/contexts/simple_fields_context.tsx new file mode 100644 index 0000000000000..1d981ed4c2c8f --- /dev/null +++ b/x-pack/plugins/uptime/public/components/fleet_package/contexts/simple_fields_context.tsx @@ -0,0 +1,60 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import React, { createContext, useContext, useMemo, useState } from 'react'; +import { ISimpleFields, ConfigKeys, ScheduleUnit, DataStream } from '../types'; + +interface ISimpleFieldsContext { + setFields: React.Dispatch>; + fields: ISimpleFields; + defaultValues: ISimpleFields; +} + +interface ISimpleFieldsContextProvider { + children: React.ReactNode; + defaultValues?: ISimpleFields; +} + +export const initialValues = { + [ConfigKeys.HOSTS]: '', + [ConfigKeys.MAX_REDIRECTS]: '0', + [ConfigKeys.MONITOR_TYPE]: DataStream.HTTP, + [ConfigKeys.SCHEDULE]: { + number: '3', + unit: ScheduleUnit.MINUTES, + }, + [ConfigKeys.APM_SERVICE_NAME]: '', + [ConfigKeys.TAGS]: [], + [ConfigKeys.TIMEOUT]: '16', + [ConfigKeys.URLS]: '', + [ConfigKeys.WAIT]: '1', +}; + +const defaultContext: ISimpleFieldsContext = { + setFields: (_fields: React.SetStateAction) => { + throw new Error('setSimpleFields was not initialized, set it when you invoke the context'); + }, + fields: initialValues, // mutable + defaultValues: initialValues, // immutable +}; + +export const SimpleFieldsContext = createContext(defaultContext); + +export const SimpleFieldsContextProvider = ({ + children, + defaultValues = initialValues, +}: ISimpleFieldsContextProvider) => { + const [fields, setFields] = useState(defaultValues); + + const value = useMemo(() => { + return { fields, setFields, defaultValues }; + }, [fields, defaultValues]); + + return ; +}; + +export const useSimpleFieldsContext = () => useContext(SimpleFieldsContext); diff --git a/x-pack/plugins/uptime/public/components/fleet_package/contexts/tls_fields_context.tsx b/x-pack/plugins/uptime/public/components/fleet_package/contexts/tls_fields_context.tsx new file mode 100644 index 0000000000000..eaeb995654448 --- /dev/null +++ b/x-pack/plugins/uptime/public/components/fleet_package/contexts/tls_fields_context.tsx @@ -0,0 +1,72 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import React, { createContext, useContext, useMemo, useState } from 'react'; +import { ITLSFields, ConfigKeys, TLSVersion, VerificationMode } from '../types'; + +interface ITLSFieldsContext { + setFields: React.Dispatch>; + fields: ITLSFields; + defaultValues: ITLSFields; +} + +interface ITLSFieldsContextProvider { + children: React.ReactNode; + defaultValues?: ITLSFields; +} + +export const initialValues = { + [ConfigKeys.TLS_CERTIFICATE_AUTHORITIES]: { + value: '', + isEnabled: false, + }, + [ConfigKeys.TLS_CERTIFICATE]: { + value: '', + isEnabled: false, + }, + [ConfigKeys.TLS_KEY]: { + value: '', + isEnabled: false, + }, + [ConfigKeys.TLS_KEY_PASSPHRASE]: { + value: '', + isEnabled: false, + }, + [ConfigKeys.TLS_VERIFICATION_MODE]: { + value: VerificationMode.FULL, + isEnabled: false, + }, + [ConfigKeys.TLS_VERSION]: { + value: [TLSVersion.ONE_ONE, TLSVersion.ONE_TWO, TLSVersion.ONE_THREE], + isEnabled: false, + }, +}; + +const defaultContext: ITLSFieldsContext = { + setFields: (_fields: React.SetStateAction) => { + throw new Error('setFields was not initialized, set it when you invoke the context'); + }, + fields: initialValues, // mutable + defaultValues: initialValues, // immutable +}; + +export const TLSFieldsContext = createContext(defaultContext); + +export const TLSFieldsContextProvider = ({ + children, + defaultValues = initialValues, +}: ITLSFieldsContextProvider) => { + const [fields, setFields] = useState(defaultValues); + + const value = useMemo(() => { + return { fields, setFields, defaultValues }; + }, [fields, defaultValues]); + + return ; +}; + +export const useTLSFieldsContext = () => useContext(TLSFieldsContext); diff --git a/x-pack/plugins/uptime/public/components/fleet_package/custom_fields.test.tsx b/x-pack/plugins/uptime/public/components/fleet_package/custom_fields.test.tsx new file mode 100644 index 0000000000000..b5fec58d4da85 --- /dev/null +++ b/x-pack/plugins/uptime/public/components/fleet_package/custom_fields.test.tsx @@ -0,0 +1,247 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import React from 'react'; +import { fireEvent, waitFor } from '@testing-library/react'; +import { render } from '../../lib/helper/rtl_helpers'; +import { + SimpleFieldsContextProvider, + HTTPAdvancedFieldsContextProvider, + TCPAdvancedFieldsContextProvider, + TLSFieldsContextProvider, + defaultSimpleFields, + defaultTLSFields, + defaultHTTPAdvancedFields, + defaultTCPAdvancedFields, +} from './contexts'; +import { CustomFields } from './custom_fields'; +import { ConfigKeys, DataStream, ScheduleUnit } from './types'; +import { validate as centralValidation } from './validation'; + +// ensures that fields appropriately match to their label +jest.mock('@elastic/eui/lib/services/accessibility/html_id_generator', () => ({ + htmlIdGenerator: () => () => `id-${Math.random()}`, +})); + +const defaultValidation = centralValidation[DataStream.HTTP]; + +const defaultConfig = { + ...defaultSimpleFields, + ...defaultTLSFields, + ...defaultHTTPAdvancedFields, + ...defaultTCPAdvancedFields, +}; + +describe('', () => { + const WrappedComponent = ({ validate = defaultValidation, typeEditable = false }) => { + return ( + + + + + + + + + + ); + }; + + it('renders CustomFields', async () => { + const { getByText, getByLabelText, queryByLabelText } = render(); + const monitorType = queryByLabelText('Monitor Type') as HTMLInputElement; + const url = getByLabelText('URL') as HTMLInputElement; + const proxyUrl = getByLabelText('Proxy URL') as HTMLInputElement; + const monitorIntervalNumber = getByLabelText('Number') as HTMLInputElement; + const monitorIntervalUnit = getByLabelText('Unit') as HTMLInputElement; + const apmServiceName = getByLabelText('APM service name') as HTMLInputElement; + const maxRedirects = getByLabelText('Max redirects') as HTMLInputElement; + const timeout = getByLabelText('Timeout in seconds') as HTMLInputElement; + expect(monitorType).not.toBeInTheDocument(); + expect(url).toBeInTheDocument(); + expect(url.value).toEqual(defaultConfig[ConfigKeys.URLS]); + expect(proxyUrl).toBeInTheDocument(); + expect(proxyUrl.value).toEqual(defaultConfig[ConfigKeys.PROXY_URL]); + expect(monitorIntervalNumber).toBeInTheDocument(); + expect(monitorIntervalNumber.value).toEqual(defaultConfig[ConfigKeys.SCHEDULE].number); + expect(monitorIntervalUnit).toBeInTheDocument(); + expect(monitorIntervalUnit.value).toEqual(defaultConfig[ConfigKeys.SCHEDULE].unit); + // expect(tags).toBeInTheDocument(); + expect(apmServiceName).toBeInTheDocument(); + expect(apmServiceName.value).toEqual(defaultConfig[ConfigKeys.APM_SERVICE_NAME]); + expect(maxRedirects).toBeInTheDocument(); + expect(maxRedirects.value).toEqual(`${defaultConfig[ConfigKeys.MAX_REDIRECTS]}`); + expect(timeout).toBeInTheDocument(); + expect(timeout.value).toEqual(`${defaultConfig[ConfigKeys.TIMEOUT]}`); + + // ensure other monitor type options are not in the DOM + expect(queryByLabelText('Host')).not.toBeInTheDocument(); + expect(queryByLabelText('Wait in seconds')).not.toBeInTheDocument(); + + // ensure at least one http advanced option is present + const advancedOptionsButton = getByText('Advanced HTTP options'); + fireEvent.click(advancedOptionsButton); + await waitFor(() => { + expect(getByLabelText('Request method')).toBeInTheDocument(); + }); + }); + + it('shows SSL fields when Enable SSL Fields is checked', async () => { + const { findByLabelText, queryByLabelText } = render(); + const enableSSL = queryByLabelText('Enable TLS configuration') as HTMLInputElement; + expect(queryByLabelText('Certificate authorities')).not.toBeInTheDocument(); + expect(queryByLabelText('Client key')).not.toBeInTheDocument(); + expect(queryByLabelText('Client certificate')).not.toBeInTheDocument(); + expect(queryByLabelText('Client key passphrase')).not.toBeInTheDocument(); + expect(queryByLabelText('Verification mode')).not.toBeInTheDocument(); + + // ensure at least one http advanced option is present + fireEvent.click(enableSSL); + + const ca = (await findByLabelText('Certificate authorities')) as HTMLInputElement; + const clientKey = (await findByLabelText('Client key')) as HTMLInputElement; + const clientKeyPassphrase = (await findByLabelText( + 'Client key passphrase' + )) as HTMLInputElement; + const clientCertificate = (await findByLabelText('Client certificate')) as HTMLInputElement; + const verificationMode = (await findByLabelText('Verification mode')) as HTMLInputElement; + expect(ca).toBeInTheDocument(); + expect(clientKey).toBeInTheDocument(); + expect(clientKeyPassphrase).toBeInTheDocument(); + expect(clientCertificate).toBeInTheDocument(); + expect(verificationMode).toBeInTheDocument(); + + await waitFor(() => { + expect(ca.value).toEqual(defaultConfig[ConfigKeys.TLS_CERTIFICATE_AUTHORITIES].value); + expect(clientKey.value).toEqual(defaultConfig[ConfigKeys.TLS_KEY].value); + expect(clientKeyPassphrase.value).toEqual(defaultConfig[ConfigKeys.TLS_KEY_PASSPHRASE].value); + expect(clientCertificate.value).toEqual(defaultConfig[ConfigKeys.TLS_CERTIFICATE].value); + expect(verificationMode.value).toEqual(defaultConfig[ConfigKeys.TLS_VERIFICATION_MODE].value); + }); + }); + + it('handles updating each field (besides TLS)', async () => { + const { getByLabelText } = render(); + const url = getByLabelText('URL') as HTMLInputElement; + const proxyUrl = getByLabelText('Proxy URL') as HTMLInputElement; + const monitorIntervalNumber = getByLabelText('Number') as HTMLInputElement; + const monitorIntervalUnit = getByLabelText('Unit') as HTMLInputElement; + const apmServiceName = getByLabelText('APM service name') as HTMLInputElement; + const maxRedirects = getByLabelText('Max redirects') as HTMLInputElement; + const timeout = getByLabelText('Timeout in seconds') as HTMLInputElement; + + fireEvent.change(url, { target: { value: 'http://elastic.co' } }); + fireEvent.change(proxyUrl, { target: { value: 'http://proxy.co' } }); + fireEvent.change(monitorIntervalNumber, { target: { value: '1' } }); + fireEvent.change(monitorIntervalUnit, { target: { value: ScheduleUnit.MINUTES } }); + fireEvent.change(apmServiceName, { target: { value: 'APM Service' } }); + fireEvent.change(maxRedirects, { target: { value: '2' } }); + fireEvent.change(timeout, { target: { value: '3' } }); + + expect(url.value).toEqual('http://elastic.co'); + expect(proxyUrl.value).toEqual('http://proxy.co'); + expect(monitorIntervalNumber.value).toEqual('1'); + expect(monitorIntervalUnit.value).toEqual(ScheduleUnit.MINUTES); + expect(apmServiceName.value).toEqual('APM Service'); + expect(maxRedirects.value).toEqual('2'); + expect(timeout.value).toEqual('3'); + }); + + it('handles switching monitor type', () => { + const { getByText, getByLabelText, queryByLabelText } = render( + + ); + const monitorType = getByLabelText('Monitor Type') as HTMLInputElement; + expect(monitorType).toBeInTheDocument(); + expect(monitorType.value).toEqual(defaultConfig[ConfigKeys.MONITOR_TYPE]); + fireEvent.change(monitorType, { target: { value: DataStream.TCP } }); + + // expect tcp fields to be in the DOM + const host = getByLabelText('Host:Port') as HTMLInputElement; + + expect(host).toBeInTheDocument(); + expect(host.value).toEqual(defaultConfig[ConfigKeys.HOSTS]); + + // expect HTTP fields not to be in the DOM + expect(queryByLabelText('URL')).not.toBeInTheDocument(); + expect(queryByLabelText('Max redirects')).not.toBeInTheDocument(); + + // ensure at least one tcp advanced option is present + const advancedOptionsButton = getByText('Advanced TCP options'); + fireEvent.click(advancedOptionsButton); + + expect(queryByLabelText('Request method')).not.toBeInTheDocument(); + expect(getByLabelText('Request payload')).toBeInTheDocument(); + + fireEvent.change(monitorType, { target: { value: DataStream.ICMP } }); + + // expect ICMP fields to be in the DOM + expect(getByLabelText('Wait in seconds')).toBeInTheDocument(); + + // expect TCP fields not to be in the DOM + expect(queryByLabelText('Proxy URL')).not.toBeInTheDocument(); + }); + + it('shows resolve hostnames locally field when proxy url is filled for tcp monitors', () => { + const { getByLabelText, queryByLabelText } = render(); + const monitorType = getByLabelText('Monitor Type') as HTMLInputElement; + fireEvent.change(monitorType, { target: { value: DataStream.TCP } }); + + expect(queryByLabelText('Resolve hostnames locally')).not.toBeInTheDocument(); + + const proxyUrl = getByLabelText('Proxy URL') as HTMLInputElement; + + fireEvent.change(proxyUrl, { target: { value: 'sampleProxyUrl' } }); + + expect(getByLabelText('Resolve hostnames locally')).toBeInTheDocument(); + }); + + it('handles validation', () => { + const { getByText, getByLabelText, queryByText } = render(); + + const url = getByLabelText('URL') as HTMLInputElement; + const monitorIntervalNumber = getByLabelText('Number') as HTMLInputElement; + const maxRedirects = getByLabelText('Max redirects') as HTMLInputElement; + const timeout = getByLabelText('Timeout in seconds') as HTMLInputElement; + + // create errors + fireEvent.change(monitorIntervalNumber, { target: { value: '-1' } }); + fireEvent.change(maxRedirects, { target: { value: '-1' } }); + fireEvent.change(timeout, { target: { value: '-1' } }); + + const urlError = getByText('URL is required'); + const monitorIntervalError = getByText('Monitor interval is required'); + const maxRedirectsError = getByText('Max redirects must be 0 or greater'); + const timeoutError = getByText('Timeout must be 0 or greater and less than schedule interval'); + + expect(urlError).toBeInTheDocument(); + expect(monitorIntervalError).toBeInTheDocument(); + expect(maxRedirectsError).toBeInTheDocument(); + expect(timeoutError).toBeInTheDocument(); + + // resolve errors + fireEvent.change(url, { target: { value: 'http://elastic.co' } }); + fireEvent.change(monitorIntervalNumber, { target: { value: '1' } }); + fireEvent.change(maxRedirects, { target: { value: '1' } }); + fireEvent.change(timeout, { target: { value: '1' } }); + + expect(queryByText('URL is required')).not.toBeInTheDocument(); + expect(queryByText('Monitor interval is required')).not.toBeInTheDocument(); + expect(queryByText('Max redirects must be 0 or greater')).not.toBeInTheDocument(); + expect( + queryByText('Timeout must be 0 or greater and less than schedule interval') + ).not.toBeInTheDocument(); + + // create more errors + fireEvent.change(monitorIntervalNumber, { target: { value: '1' } }); // 1 minute + fireEvent.change(timeout, { target: { value: '61' } }); // timeout cannot be more than monitor interval + + const timeoutError2 = getByText('Timeout must be 0 or greater and less than schedule interval'); + + expect(timeoutError2).toBeInTheDocument(); + }); +}); diff --git a/x-pack/plugins/uptime/public/components/fleet_package/custom_fields.tsx b/x-pack/plugins/uptime/public/components/fleet_package/custom_fields.tsx new file mode 100644 index 0000000000000..1dbd37dc00803 --- /dev/null +++ b/x-pack/plugins/uptime/public/components/fleet_package/custom_fields.tsx @@ -0,0 +1,416 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import React, { useEffect, useState, memo } from 'react'; +import { FormattedMessage } from '@kbn/i18n/react'; +import { + EuiFlexGroup, + EuiFlexItem, + EuiForm, + EuiFormRow, + EuiFieldText, + EuiFieldNumber, + EuiSelect, + EuiSpacer, + EuiDescribedFormGroup, + EuiCheckbox, +} from '@elastic/eui'; +import { ConfigKeys, DataStream, ISimpleFields, Validation } from './types'; +import { useSimpleFieldsContext } from './contexts'; +import { TLSFields, TLSRole } from './tls_fields'; +import { ComboBox } from './combo_box'; +import { OptionalLabel } from './optional_label'; +import { HTTPAdvancedFields } from './http_advanced_fields'; +import { TCPAdvancedFields } from './tcp_advanced_fields'; +import { ScheduleField } from './schedule_field'; + +interface Props { + typeEditable?: boolean; + isTLSEnabled?: boolean; + validate: Validation; +} + +export const CustomFields = memo( + ({ typeEditable = false, isTLSEnabled: defaultIsTLSEnabled = false, validate }) => { + const [isTLSEnabled, setIsTLSEnabled] = useState(defaultIsTLSEnabled); + const { fields, setFields, defaultValues } = useSimpleFieldsContext(); + const { type } = fields; + + const isHTTP = fields[ConfigKeys.MONITOR_TYPE] === DataStream.HTTP; + const isTCP = fields[ConfigKeys.MONITOR_TYPE] === DataStream.TCP; + const isICMP = fields[ConfigKeys.MONITOR_TYPE] === DataStream.ICMP; + + // reset monitor type specific fields any time a monitor type is switched + useEffect(() => { + if (typeEditable) { + setFields((prevFields: ISimpleFields) => ({ + ...prevFields, + [ConfigKeys.HOSTS]: defaultValues[ConfigKeys.HOSTS], + [ConfigKeys.URLS]: defaultValues[ConfigKeys.URLS], + })); + } + }, [defaultValues, type, typeEditable, setFields]); + + const handleInputChange = ({ value, configKey }: { value: unknown; configKey: ConfigKeys }) => { + setFields((prevFields) => ({ ...prevFields, [configKey]: value })); + }; + + return ( + + + + + } + description={ + + } + > + + + {typeEditable && ( + + } + isInvalid={!!validate[ConfigKeys.MONITOR_TYPE]?.(fields[ConfigKeys.MONITOR_TYPE])} + error={ + + } + > + + handleInputChange({ + value: event.target.value, + configKey: ConfigKeys.MONITOR_TYPE, + }) + } + /> + + )} + {isHTTP && ( + + } + isInvalid={!!validate[ConfigKeys.URLS]?.(fields[ConfigKeys.URLS])} + error={ + + } + > + + handleInputChange({ value: event.target.value, configKey: ConfigKeys.URLS }) + } + /> + + )} + {isTCP && ( + + } + isInvalid={!!validate[ConfigKeys.HOSTS]?.(fields[ConfigKeys.HOSTS])} + error={ + + } + > + + handleInputChange({ + value: event.target.value, + configKey: ConfigKeys.HOSTS, + }) + } + /> + + )} + {isICMP && ( + + } + isInvalid={!!validate[ConfigKeys.HOSTS]?.(fields[ConfigKeys.HOSTS])} + error={ + + } + > + + handleInputChange({ + value: event.target.value, + configKey: ConfigKeys.HOSTS, + }) + } + /> + + )} + + } + isInvalid={!!validate[ConfigKeys.SCHEDULE]?.(fields[ConfigKeys.SCHEDULE])} + error={ + + } + > + + handleInputChange({ + value: schedule, + configKey: ConfigKeys.SCHEDULE, + }) + } + number={fields[ConfigKeys.SCHEDULE].number} + unit={fields[ConfigKeys.SCHEDULE].unit} + /> + + {isICMP && ( + + } + isInvalid={!!validate[ConfigKeys.WAIT]?.(fields[ConfigKeys.WAIT])} + error={ + + } + labelAppend={} + helpText={ + + } + > + + handleInputChange({ value: event.target.value, configKey: ConfigKeys.WAIT }) + } + step={'any'} + /> + + )} + + } + labelAppend={} + helpText={ + + } + > + + handleInputChange({ + value: event.target.value, + configKey: ConfigKeys.APM_SERVICE_NAME, + }) + } + /> + + {isHTTP && ( + + } + isInvalid={ + !!validate[ConfigKeys.MAX_REDIRECTS]?.(fields[ConfigKeys.MAX_REDIRECTS]) + } + error={ + + } + labelAppend={} + helpText={ + + } + > + + handleInputChange({ + value: event.target.value, + configKey: ConfigKeys.MAX_REDIRECTS, + }) + } + /> + + )} + + } + isInvalid={ + !!validate[ConfigKeys.TIMEOUT]?.( + fields[ConfigKeys.TIMEOUT], + fields[ConfigKeys.SCHEDULE].number, + fields[ConfigKeys.SCHEDULE].unit + ) + } + error={ + + } + labelAppend={} + helpText={ + + } + > + + handleInputChange({ + value: event.target.value, + configKey: ConfigKeys.TIMEOUT, + }) + } + step={'any'} + /> + + + } + labelAppend={} + helpText={ + + } + > + handleInputChange({ value, configKey: ConfigKeys.TAGS })} + /> + + + + + {(isHTTP || isTCP) && ( + + + + } + description={ + + } + > + + } + onChange={(event) => setIsTLSEnabled(event.target.checked)} + /> + + + )} + + {isHTTP && } + {isTCP && } + + ); + } +); + +const dataStreamOptions = [ + { value: DataStream.HTTP, text: 'HTTP' }, + { value: DataStream.TCP, text: 'TCP' }, + { value: DataStream.ICMP, text: 'ICMP' }, +]; diff --git a/x-pack/plugins/uptime/public/components/fleet_package/header_field.test.tsx b/x-pack/plugins/uptime/public/components/fleet_package/header_field.test.tsx new file mode 100644 index 0000000000000..ee33083b3eae9 --- /dev/null +++ b/x-pack/plugins/uptime/public/components/fleet_package/header_field.test.tsx @@ -0,0 +1,90 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import React from 'react'; +import { fireEvent, waitFor } from '@testing-library/react'; +import { render } from '../../lib/helper/rtl_helpers'; +import { HeaderField, contentTypes } from './header_field'; +import { Mode } from './types'; + +describe('', () => { + const onChange = jest.fn(); + const defaultValue = {}; + + it('renders HeaderField', () => { + const { getByText, getByTestId } = render( + + ); + + expect(getByText('Key')).toBeInTheDocument(); + expect(getByText('Value')).toBeInTheDocument(); + const key = getByTestId('keyValuePairsKey0') as HTMLInputElement; + const value = getByTestId('keyValuePairsValue0') as HTMLInputElement; + expect(key.value).toEqual('sample'); + expect(value.value).toEqual('header'); + }); + + it('formats headers and handles onChange', async () => { + const { getByTestId, getByText } = render( + + ); + const addHeader = getByText('Add header'); + fireEvent.click(addHeader); + const key = getByTestId('keyValuePairsKey0') as HTMLInputElement; + const value = getByTestId('keyValuePairsValue0') as HTMLInputElement; + const newKey = 'sampleKey'; + const newValue = 'sampleValue'; + fireEvent.change(key, { target: { value: newKey } }); + fireEvent.change(value, { target: { value: newValue } }); + + await waitFor(() => { + expect(onChange).toBeCalledWith({ + [newKey]: newValue, + }); + }); + }); + + it('handles deleting headers', async () => { + const { getByTestId, getByText, getByLabelText } = render( + + ); + const addHeader = getByText('Add header'); + + fireEvent.click(addHeader); + + const key = getByTestId('keyValuePairsKey0') as HTMLInputElement; + const value = getByTestId('keyValuePairsValue0') as HTMLInputElement; + const newKey = 'sampleKey'; + const newValue = 'sampleValue'; + fireEvent.change(key, { target: { value: newKey } }); + fireEvent.change(value, { target: { value: newValue } }); + + await waitFor(() => { + expect(onChange).toBeCalledWith({ + [newKey]: newValue, + }); + }); + + const deleteBtn = getByLabelText('Delete item number 2, sampleKey:sampleValue'); + + // uncheck + fireEvent.click(deleteBtn); + }); + + it('handles content mode', async () => { + const contentMode: Mode = Mode.TEXT; + render( + + ); + + await waitFor(() => { + expect(onChange).toBeCalledWith({ + 'Content-Type': contentTypes[Mode.TEXT], + }); + }); + }); +}); diff --git a/x-pack/plugins/uptime/public/components/fleet_package/header_field.tsx b/x-pack/plugins/uptime/public/components/fleet_package/header_field.tsx new file mode 100644 index 0000000000000..9f337d4b00704 --- /dev/null +++ b/x-pack/plugins/uptime/public/components/fleet_package/header_field.tsx @@ -0,0 +1,67 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import React, { useEffect, useState } from 'react'; +import { FormattedMessage } from '@kbn/i18n/react'; +import { ContentType, Mode } from './types'; + +import { KeyValuePairsField, Pair } from './key_value_field'; + +interface Props { + contentMode?: Mode; + defaultValue: Record; + onChange: (value: Record) => void; +} + +export const HeaderField = ({ contentMode, defaultValue, onChange }: Props) => { + const defaultValueKeys = Object.keys(defaultValue).filter((key) => key !== 'Content-Type'); // Content-Type is a secret header we hide from the user + const formattedDefaultValues: Pair[] = [ + ...defaultValueKeys.map((key) => { + return [key || '', defaultValue[key] || '']; // key, value + }), + ]; + const [headers, setHeaders] = useState(formattedDefaultValues); + + useEffect(() => { + const formattedHeaders = headers.reduce((acc: Record, header) => { + const [key, value] = header; + if (key) { + return { + ...acc, + [key]: value, + }; + } + return acc; + }, {}); + + if (contentMode) { + onChange({ 'Content-Type': contentTypes[contentMode], ...formattedHeaders }); + } else { + onChange(formattedHeaders); + } + }, [contentMode, headers, onChange]); + + return ( + + } + defaultPairs={headers} + onChange={setHeaders} + /> + ); +}; + +export const contentTypes: Record = { + [Mode.JSON]: ContentType.JSON, + [Mode.TEXT]: ContentType.TEXT, + [Mode.XML]: ContentType.XML, + [Mode.FORM]: ContentType.FORM, +}; diff --git a/x-pack/plugins/uptime/public/components/fleet_package/http_advanced_fields.test.tsx b/x-pack/plugins/uptime/public/components/fleet_package/http_advanced_fields.test.tsx new file mode 100644 index 0000000000000..b1a37be1bffb6 --- /dev/null +++ b/x-pack/plugins/uptime/public/components/fleet_package/http_advanced_fields.test.tsx @@ -0,0 +1,106 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import React from 'react'; +import { fireEvent } from '@testing-library/react'; +import { render } from '../../lib/helper/rtl_helpers'; +import { HTTPAdvancedFields } from './http_advanced_fields'; +import { ConfigKeys, DataStream, HTTPMethod, IHTTPAdvancedFields, Validation } from './types'; +import { + HTTPAdvancedFieldsContextProvider, + defaultHTTPAdvancedFields as defaultConfig, +} from './contexts'; +import { validate as centralValidation } from './validation'; + +jest.mock('@elastic/eui/lib/services/accessibility/html_id_generator', () => ({ + htmlIdGenerator: () => () => `id-${Math.random()}`, +})); + +const defaultValidation = centralValidation[DataStream.HTTP]; + +describe('', () => { + const WrappedComponent = ({ + defaultValues, + validate = defaultValidation, + }: { + defaultValues?: IHTTPAdvancedFields; + validate?: Validation; + }) => { + return ( + + + + ); + }; + + it('renders HTTPAdvancedFields', () => { + const { getByText, getByLabelText } = render(); + + const requestMethod = getByLabelText('Request method') as HTMLInputElement; + const requestHeaders = getByText('Request headers'); + const requestBody = getByText('Request body'); + const indexResponseBody = getByLabelText('Index response body') as HTMLInputElement; + const indexResponseBodySelect = getByLabelText( + 'Response body index policy' + ) as HTMLInputElement; + const indexResponseHeaders = getByLabelText('Index response headers') as HTMLInputElement; + const proxyUrl = getByLabelText('Proxy URL') as HTMLInputElement; + const responseHeadersContain = getByText('Check response headers contain'); + const responseStatusEquals = getByText('Check response status equals'); + const responseBodyContains = getByText('Check response body contains'); + const responseBodyDoesNotContain = getByText('Check response body does not contain'); + const username = getByLabelText('Username') as HTMLInputElement; + const password = getByLabelText('Password') as HTMLInputElement; + expect(requestMethod).toBeInTheDocument(); + expect(requestMethod.value).toEqual(defaultConfig[ConfigKeys.REQUEST_METHOD_CHECK]); + expect(requestHeaders).toBeInTheDocument(); + expect(requestBody).toBeInTheDocument(); + expect(indexResponseBody).toBeInTheDocument(); + expect(indexResponseBody.checked).toBe(true); + expect(indexResponseBodySelect).toBeInTheDocument(); + expect(indexResponseBodySelect.value).toEqual(defaultConfig[ConfigKeys.RESPONSE_BODY_INDEX]); + expect(indexResponseHeaders).toBeInTheDocument(); + expect(indexResponseHeaders.checked).toBe(true); + expect(proxyUrl).toBeInTheDocument(); + expect(proxyUrl.value).toEqual(defaultConfig[ConfigKeys.PROXY_URL]); + expect(responseStatusEquals).toBeInTheDocument(); + expect(responseBodyContains).toBeInTheDocument(); + expect(responseBodyDoesNotContain).toBeInTheDocument(); + expect(responseHeadersContain).toBeInTheDocument(); + expect(username).toBeInTheDocument(); + expect(username.value).toBe(defaultConfig[ConfigKeys.USERNAME]); + expect(password).toBeInTheDocument(); + expect(password.value).toBe(defaultConfig[ConfigKeys.PASSWORD]); + }); + + it('handles changing fields', () => { + const { getByText, getByLabelText } = render(); + + const username = getByLabelText('Username') as HTMLInputElement; + const password = getByLabelText('Password') as HTMLInputElement; + const proxyUrl = getByLabelText('Proxy URL') as HTMLInputElement; + const requestMethod = getByLabelText('Request method') as HTMLInputElement; + const requestHeaders = getByText('Request headers'); + const indexResponseBody = getByLabelText('Index response body') as HTMLInputElement; + const indexResponseHeaders = getByLabelText('Index response headers') as HTMLInputElement; + + fireEvent.change(username, { target: { value: 'username' } }); + fireEvent.change(password, { target: { value: 'password' } }); + fireEvent.change(proxyUrl, { target: { value: 'proxyUrl' } }); + fireEvent.change(requestMethod, { target: { value: HTTPMethod.POST } }); + fireEvent.click(indexResponseBody); + fireEvent.click(indexResponseHeaders); + + expect(username.value).toEqual('username'); + expect(password.value).toEqual('password'); + expect(proxyUrl.value).toEqual('proxyUrl'); + expect(requestMethod.value).toEqual(HTTPMethod.POST); + expect(requestHeaders).toBeInTheDocument(); + expect(indexResponseBody.checked).toBe(false); + expect(indexResponseHeaders.checked).toBe(false); + }); +}); diff --git a/x-pack/plugins/uptime/public/components/fleet_package/http_advanced_fields.tsx b/x-pack/plugins/uptime/public/components/fleet_package/http_advanced_fields.tsx new file mode 100644 index 0000000000000..5cc1dd12ef961 --- /dev/null +++ b/x-pack/plugins/uptime/public/components/fleet_package/http_advanced_fields.tsx @@ -0,0 +1,476 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import React, { useCallback, memo } from 'react'; +import { i18n } from '@kbn/i18n'; +import { FormattedMessage } from '@kbn/i18n/react'; +import { + EuiAccordion, + EuiCode, + EuiFieldText, + EuiFormRow, + EuiSelect, + EuiDescribedFormGroup, + EuiCheckbox, + EuiSpacer, +} from '@elastic/eui'; + +import { useHTTPAdvancedFieldsContext } from './contexts'; + +import { ConfigKeys, HTTPMethod, Validation } from './types'; + +import { OptionalLabel } from './optional_label'; +import { HeaderField } from './header_field'; +import { RequestBodyField } from './request_body_field'; +import { ResponseBodyIndexField } from './index_response_body_field'; +import { ComboBox } from './combo_box'; + +interface Props { + validate: Validation; +} + +export const HTTPAdvancedFields = memo(({ validate }) => { + const { fields, setFields } = useHTTPAdvancedFieldsContext(); + const handleInputChange = useCallback( + ({ value, configKey }: { value: unknown; configKey: ConfigKeys }) => { + setFields((prevFields) => ({ ...prevFields, [configKey]: value })); + }, + [setFields] + ); + + return ( + + } + > + + + + + } + description={ + + } + > + + + } + labelAppend={} + helpText={ + + } + > + + handleInputChange({ + value: event.target.value, + configKey: ConfigKeys.USERNAME, + }) + } + /> + + + } + labelAppend={} + helpText={ + + } + > + + handleInputChange({ + value: event.target.value, + configKey: ConfigKeys.PASSWORD, + }) + } + /> + + + } + labelAppend={} + helpText={ + + } + > + + handleInputChange({ + value: event.target.value, + configKey: ConfigKeys.PROXY_URL, + }) + } + /> + + + } + helpText={ + + } + > + + handleInputChange({ + value: event.target.value, + configKey: ConfigKeys.REQUEST_METHOD_CHECK, + }) + } + /> + + + } + labelAppend={} + isInvalid={ + !!validate[ConfigKeys.REQUEST_HEADERS_CHECK]?.(fields[ConfigKeys.REQUEST_HEADERS_CHECK]) + } + error={ + !!validate[ConfigKeys.REQUEST_HEADERS_CHECK]?.( + fields[ConfigKeys.REQUEST_HEADERS_CHECK] + ) ? ( + + ) : undefined + } + helpText={ + + } + > + + handleInputChange({ + value, + configKey: ConfigKeys.REQUEST_HEADERS_CHECK, + }), + [handleInputChange] + )} + /> + + + } + labelAppend={} + helpText={ + + } + fullWidth + > + + handleInputChange({ + value, + configKey: ConfigKeys.REQUEST_BODY_CHECK, + }), + [handleInputChange] + )} + /> + + + + + + + } + description={ + + } + > + + + + http.response.body.headers + + } + > + + } + onChange={(event) => + handleInputChange({ + value: event.target.checked, + configKey: ConfigKeys.RESPONSE_HEADERS_INDEX, + }) + } + /> + + + + http.response.body.contents + + } + > + + handleInputChange({ value: policy, configKey: ConfigKeys.RESPONSE_BODY_INDEX }), + [handleInputChange] + )} + /> + + + + + + } + description={ + + } + > + + } + labelAppend={} + isInvalid={ + !!validate[ConfigKeys.RESPONSE_STATUS_CHECK]?.(fields[ConfigKeys.RESPONSE_STATUS_CHECK]) + } + error={ + + } + helpText={i18n.translate( + 'xpack.uptime.createPackagePolicy.stepConfigure.httpAdvancedOptions.responseChecks.responseStatusCheck.helpText', + { + defaultMessage: + 'A list of expected status codes. Press enter to add a new code. 4xx and 5xx codes are considered down by default. Other codes are considered up.', + } + )} + > + + handleInputChange({ + value, + configKey: ConfigKeys.RESPONSE_STATUS_CHECK, + }) + } + /> + + + } + labelAppend={} + isInvalid={ + !!validate[ConfigKeys.RESPONSE_HEADERS_CHECK]?.( + fields[ConfigKeys.RESPONSE_HEADERS_CHECK] + ) + } + error={ + !!validate[ConfigKeys.RESPONSE_HEADERS_CHECK]?.( + fields[ConfigKeys.RESPONSE_HEADERS_CHECK] + ) + ? [ + , + ] + : undefined + } + helpText={ + + } + > + + handleInputChange({ + value, + configKey: ConfigKeys.RESPONSE_HEADERS_CHECK, + }), + [handleInputChange] + )} + /> + + + } + labelAppend={} + helpText={i18n.translate( + 'xpack.uptime.createPackagePolicy.stepConfigure.httpAdvancedOptions.responseBodyCheckPositive.helpText', + { + defaultMessage: + 'A list of regular expressions to match the body output. Press enter to add a new expression. Only a single expression needs to match.', + } + )} + > + + handleInputChange({ + value, + configKey: ConfigKeys.RESPONSE_BODY_CHECK_POSITIVE, + }), + [handleInputChange] + )} + /> + + + } + labelAppend={} + helpText={i18n.translate( + 'xpack.uptime.createPackagePolicy.stepConfigure.httpAdvancedOptions.responseBodyCheckNegative.helpText', + { + defaultMessage: + 'A list of regular expressions to match the the body output negatively. Press enter to add a new expression. Return match failed if single expression matches.', + } + )} + > + + handleInputChange({ + value, + configKey: ConfigKeys.RESPONSE_BODY_CHECK_NEGATIVE, + }), + [handleInputChange] + )} + /> + + + + ); +}); + +const requestMethodOptions = Object.values(HTTPMethod).map((method) => ({ + value: method, + text: method, +})); diff --git a/x-pack/plugins/uptime/public/components/fleet_package/index.tsx b/x-pack/plugins/uptime/public/components/fleet_package/index.tsx new file mode 100644 index 0000000000000..47fd04e3fb71d --- /dev/null +++ b/x-pack/plugins/uptime/public/components/fleet_package/index.tsx @@ -0,0 +1,9 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +export { LazySyntheticsPolicyCreateExtension } from './lazy_synthetics_policy_create_extension'; +export { LazySyntheticsPolicyEditExtension } from './lazy_synthetics_policy_edit_extension'; diff --git a/x-pack/plugins/uptime/public/components/fleet_package/index_response_body_field.test.tsx b/x-pack/plugins/uptime/public/components/fleet_package/index_response_body_field.test.tsx new file mode 100644 index 0000000000000..53a96c5ec1c73 --- /dev/null +++ b/x-pack/plugins/uptime/public/components/fleet_package/index_response_body_field.test.tsx @@ -0,0 +1,97 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import React from 'react'; +import { fireEvent, waitFor } from '@testing-library/react'; +import { render } from '../../lib/helper/rtl_helpers'; +import { ResponseBodyIndexField } from './index_response_body_field'; +import { ResponseBodyIndexPolicy } from './types'; + +describe('', () => { + const defaultDefaultValue = ResponseBodyIndexPolicy.ON_ERROR; + const onChange = jest.fn(); + const WrappedComponent = ({ defaultValue = defaultDefaultValue }) => { + return ; + }; + + it('renders ResponseBodyIndexField', () => { + const { getByText, getByTestId } = render(); + const select = getByTestId('indexResponseBodyFieldSelect') as HTMLInputElement; + expect(select.value).toEqual(defaultDefaultValue); + expect(getByText('On error')).toBeInTheDocument(); + expect(getByText('Index response body')).toBeInTheDocument(); + }); + + it('handles select change', async () => { + const { getByText, getByTestId } = render(); + const select = getByTestId('indexResponseBodyFieldSelect') as HTMLInputElement; + const newPolicy = ResponseBodyIndexPolicy.ALWAYS; + expect(select.value).toEqual(defaultDefaultValue); + + fireEvent.change(select, { target: { value: newPolicy } }); + + await waitFor(() => { + expect(select.value).toBe(newPolicy); + expect(getByText('Always')).toBeInTheDocument(); + expect(onChange).toBeCalledWith(newPolicy); + }); + }); + + it('handles checkbox change', async () => { + const { getByTestId, getByLabelText } = render(); + const checkbox = getByLabelText('Index response body') as HTMLInputElement; + const select = getByTestId('indexResponseBodyFieldSelect') as HTMLInputElement; + const newPolicy = ResponseBodyIndexPolicy.NEVER; + expect(checkbox.checked).toBe(true); + + fireEvent.click(checkbox); + + await waitFor(() => { + expect(checkbox.checked).toBe(false); + expect(select).not.toBeInTheDocument(); + expect(onChange).toBeCalledWith(newPolicy); + }); + + fireEvent.click(checkbox); + + await waitFor(() => { + expect(checkbox.checked).toBe(true); + expect(select).not.toBeInTheDocument(); + expect(onChange).toBeCalledWith(defaultDefaultValue); + }); + }); + + it('handles ResponseBodyIndexPolicy.NEVER as a default value', async () => { + const { queryByTestId, getByTestId, getByLabelText } = render( + + ); + const checkbox = getByLabelText('Index response body') as HTMLInputElement; + expect(checkbox.checked).toBe(false); + expect( + queryByTestId('indexResponseBodyFieldSelect') as HTMLInputElement + ).not.toBeInTheDocument(); + + fireEvent.click(checkbox); + const select = getByTestId('indexResponseBodyFieldSelect') as HTMLInputElement; + + await waitFor(() => { + expect(checkbox.checked).toBe(true); + expect(select).toBeInTheDocument(); + expect(select.value).toEqual(ResponseBodyIndexPolicy.ON_ERROR); + // switches back to on error policy when checkbox is checked + expect(onChange).toBeCalledWith(ResponseBodyIndexPolicy.ON_ERROR); + }); + + const newPolicy = ResponseBodyIndexPolicy.ALWAYS; + fireEvent.change(select, { target: { value: newPolicy } }); + + await waitFor(() => { + expect(select.value).toEqual(newPolicy); + expect(onChange).toBeCalledWith(newPolicy); + }); + }); +}); diff --git a/x-pack/plugins/uptime/public/components/fleet_package/index_response_body_field.tsx b/x-pack/plugins/uptime/public/components/fleet_package/index_response_body_field.tsx new file mode 100644 index 0000000000000..a82e7a0938078 --- /dev/null +++ b/x-pack/plugins/uptime/public/components/fleet_package/index_response_body_field.tsx @@ -0,0 +1,98 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import React, { useEffect, useState } from 'react'; +import { i18n } from '@kbn/i18n'; +import { FormattedMessage } from '@kbn/i18n/react'; + +import { EuiCheckbox, EuiFlexGroup, EuiFlexItem, EuiSelect } from '@elastic/eui'; +import { ResponseBodyIndexPolicy } from './types'; + +interface Props { + defaultValue: ResponseBodyIndexPolicy; + onChange: (responseBodyIndexPolicy: ResponseBodyIndexPolicy) => void; +} + +export const ResponseBodyIndexField = ({ defaultValue, onChange }: Props) => { + const [policy, setPolicy] = useState( + defaultValue !== ResponseBodyIndexPolicy.NEVER ? defaultValue : ResponseBodyIndexPolicy.ON_ERROR + ); + const [checked, setChecked] = useState(defaultValue !== ResponseBodyIndexPolicy.NEVER); + + useEffect(() => { + if (checked) { + setPolicy(policy); + onChange(policy); + } else { + onChange(ResponseBodyIndexPolicy.NEVER); + } + }, [checked, policy, setPolicy, onChange]); + + useEffect(() => { + onChange(policy); + }, [onChange, policy]); + + return ( + + + + } + onChange={(event) => { + const checkedEvent = event.target.checked; + setChecked(checkedEvent); + }} + /> + + {checked && ( + + { + setPolicy(event.target.value as ResponseBodyIndexPolicy); + }} + /> + + )} + + ); +}; + +const responseBodyIndexPolicyOptions = [ + { + value: ResponseBodyIndexPolicy.ALWAYS, + text: i18n.translate( + 'xpack.uptime.createPackagePolicy.stepConfigure.responseBodyIndex.always', + { + defaultMessage: 'Always', + } + ), + }, + { + value: ResponseBodyIndexPolicy.ON_ERROR, + text: i18n.translate( + 'xpack.uptime.createPackagePolicy.stepConfigure.responseBodyIndex.onError', + { + defaultMessage: 'On error', + } + ), + }, +]; diff --git a/x-pack/plugins/uptime/public/components/fleet_package/key_value_field.test.tsx b/x-pack/plugins/uptime/public/components/fleet_package/key_value_field.test.tsx new file mode 100644 index 0000000000000..b0143ab976722 --- /dev/null +++ b/x-pack/plugins/uptime/public/components/fleet_package/key_value_field.test.tsx @@ -0,0 +1,67 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import React from 'react'; +import { fireEvent, waitFor } from '@testing-library/react'; +import { render } from '../../lib/helper/rtl_helpers'; +import { KeyValuePairsField, Pair } from './key_value_field'; + +describe('', () => { + const onChange = jest.fn(); + const defaultDefaultValue = [['', '']] as Pair[]; + const WrappedComponent = ({ + defaultValue = defaultDefaultValue, + addPairControlLabel = 'Add pair', + }) => { + return ( + + ); + }; + + it('renders KeyValuePairsField', () => { + const { getByText } = render(); + expect(getByText('Key')).toBeInTheDocument(); + expect(getByText('Value')).toBeInTheDocument(); + + expect(getByText('Add pair')).toBeInTheDocument(); + }); + + it('handles adding and editing a new row', async () => { + const { getByTestId, queryByTestId, getByText } = render( + + ); + + expect(queryByTestId('keyValuePairsKey0')).not.toBeInTheDocument(); + expect(queryByTestId('keyValuePairsValue0')).not.toBeInTheDocument(); // check that only one row exists + + const addPair = getByText('Add pair'); + + fireEvent.click(addPair); + + const newRowKey = getByTestId('keyValuePairsKey0') as HTMLInputElement; + const newRowValue = getByTestId('keyValuePairsValue0') as HTMLInputElement; + + await waitFor(() => { + expect(newRowKey.value).toEqual(''); + expect(newRowValue.value).toEqual(''); + expect(onChange).toBeCalledWith([[newRowKey.value, newRowValue.value]]); + }); + + fireEvent.change(newRowKey, { target: { value: 'newKey' } }); + fireEvent.change(newRowValue, { target: { value: 'newValue' } }); + + await waitFor(() => { + expect(newRowKey.value).toEqual('newKey'); + expect(newRowValue.value).toEqual('newValue'); + expect(onChange).toBeCalledWith([[newRowKey.value, newRowValue.value]]); + }); + }); +}); diff --git a/x-pack/plugins/uptime/public/components/fleet_package/key_value_field.tsx b/x-pack/plugins/uptime/public/components/fleet_package/key_value_field.tsx new file mode 100644 index 0000000000000..5391233698950 --- /dev/null +++ b/x-pack/plugins/uptime/public/components/fleet_package/key_value_field.tsx @@ -0,0 +1,181 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import React, { Fragment, useCallback, useEffect, useState } from 'react'; +import styled from 'styled-components'; +import { i18n } from '@kbn/i18n'; +import { FormattedMessage } from '@kbn/i18n/react'; +import { + EuiButton, + EuiButtonIcon, + EuiFieldText, + EuiFlexGroup, + EuiFlexItem, + EuiFormControlLayoutDelimited, + EuiFormLabel, + EuiFormFieldset, + EuiSpacer, +} from '@elastic/eui'; + +const StyledFieldset = styled(EuiFormFieldset)` + &&& { + legend { + width: calc(100% - 52px); // right margin + flex item padding + margin-right: 40px; + } + .euiFlexGroup { + margin-left: 0; + } + .euiFlexItem { + margin-left: 0; + padding-left: 12px; + } + } +`; + +const StyledField = styled(EuiFieldText)` + text-align: left; +`; + +export type Pair = [ + string, // key + string // value +]; + +interface Props { + addPairControlLabel: string | React.ReactElement; + defaultPairs: Pair[]; + onChange: (pairs: Pair[]) => void; +} + +export const KeyValuePairsField = ({ addPairControlLabel, defaultPairs, onChange }: Props) => { + const [pairs, setPairs] = useState(defaultPairs); + + const handleOnChange = useCallback( + (event: React.ChangeEvent, index: number, isKey: boolean) => { + const targetValue = event.target.value; + + setPairs((prevPairs) => { + const newPairs = [...prevPairs]; + const [prevKey, prevValue] = prevPairs[index]; + newPairs[index] = isKey ? [targetValue, prevValue] : [prevKey, targetValue]; + return newPairs; + }); + }, + [setPairs] + ); + + const handleAddPair = useCallback(() => { + setPairs((prevPairs) => [['', ''], ...prevPairs]); + }, [setPairs]); + + const handleDeletePair = useCallback( + (index: number) => { + setPairs((prevPairs) => { + const newPairs = [...prevPairs]; + newPairs.splice(index, 1); + return [...newPairs]; + }); + }, + [setPairs] + ); + + useEffect(() => { + onChange(pairs); + }, [onChange, pairs]); + + return ( + <> + + + + + {addPairControlLabel} + + + + + + + { + + } + + + { + + } + +
    + ), + } + : undefined + } + > + {pairs.map((pair, index) => { + const [key, value] = pair; + return ( + + + + handleDeletePair(index)} + /> + + } + startControl={ + handleOnChange(event, index, true)} + /> + } + endControl={ + handleOnChange(event, index, false)} + /> + } + delimiter=":" + /> + + + ); + })} + + + ); +}; diff --git a/x-pack/plugins/osquery/public/fleet_integration/lazy_osquery_managed_empty_create_policy_extension.tsx b/x-pack/plugins/uptime/public/components/fleet_package/lazy_synthetics_policy_create_extension.tsx similarity index 56% rename from x-pack/plugins/osquery/public/fleet_integration/lazy_osquery_managed_empty_create_policy_extension.tsx rename to x-pack/plugins/uptime/public/components/fleet_package/lazy_synthetics_policy_create_extension.tsx index 21f59c505952b..ec7266acca989 100644 --- a/x-pack/plugins/osquery/public/fleet_integration/lazy_osquery_managed_empty_create_policy_extension.tsx +++ b/x-pack/plugins/uptime/public/components/fleet_package/lazy_synthetics_policy_create_extension.tsx @@ -6,15 +6,15 @@ */ import { lazy } from 'react'; -import { PackagePolicyCreateExtensionComponent } from '../../../fleet/public'; +import { PackagePolicyCreateExtensionComponent } from '../../../../fleet/public'; -export const LazyOsqueryManagedEmptyCreatePolicyExtension = lazy( +export const LazySyntheticsPolicyCreateExtension = lazy( async () => { - const { OsqueryManagedEmptyCreatePolicyExtension } = await import( - './osquery_managed_empty_create_policy_extension' + const { SyntheticsPolicyCreateExtensionWrapper } = await import( + './synthetics_policy_create_extension_wrapper' ); return { - default: OsqueryManagedEmptyCreatePolicyExtension, + default: SyntheticsPolicyCreateExtensionWrapper, }; } ); diff --git a/x-pack/plugins/uptime/public/components/fleet_package/lazy_synthetics_policy_edit_extension.tsx b/x-pack/plugins/uptime/public/components/fleet_package/lazy_synthetics_policy_edit_extension.tsx new file mode 100644 index 0000000000000..e7b0564ad4cc3 --- /dev/null +++ b/x-pack/plugins/uptime/public/components/fleet_package/lazy_synthetics_policy_edit_extension.tsx @@ -0,0 +1,20 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import { lazy } from 'react'; +import { PackagePolicyEditExtensionComponent } from '../../../../fleet/public'; + +export const LazySyntheticsPolicyEditExtension = lazy( + async () => { + const { SyntheticsPolicyEditExtensionWrapper } = await import( + './synthetics_policy_edit_extension_wrapper' + ); + return { + default: SyntheticsPolicyEditExtensionWrapper, + }; + } +); diff --git a/x-pack/plugins/uptime/public/components/fleet_package/optional_label.tsx b/x-pack/plugins/uptime/public/components/fleet_package/optional_label.tsx new file mode 100644 index 0000000000000..6f207d3ccd208 --- /dev/null +++ b/x-pack/plugins/uptime/public/components/fleet_package/optional_label.tsx @@ -0,0 +1,20 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ +import React from 'react'; +import { FormattedMessage } from '@kbn/i18n/react'; +import { EuiText } from '@elastic/eui'; + +export const OptionalLabel = () => { + return ( + + + + ); +}; diff --git a/x-pack/plugins/uptime/public/components/fleet_package/request_body_field.test.tsx b/x-pack/plugins/uptime/public/components/fleet_package/request_body_field.test.tsx new file mode 100644 index 0000000000000..849809eae52a4 --- /dev/null +++ b/x-pack/plugins/uptime/public/components/fleet_package/request_body_field.test.tsx @@ -0,0 +1,66 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import React, { useState, useCallback } from 'react'; +import { fireEvent, waitFor } from '@testing-library/react'; +import { render } from '../../lib/helper/rtl_helpers'; +import { RequestBodyField } from './request_body_field'; +import { Mode } from './types'; + +jest.mock('@elastic/eui/lib/services/accessibility/html_id_generator', () => ({ + htmlIdGenerator: () => () => `id-${Math.random()}`, +})); + +describe('', () => { + const defaultMode = Mode.TEXT; + const defaultValue = 'sample value'; + const WrappedComponent = () => { + const [config, setConfig] = useState({ + type: defaultMode, + value: defaultValue, + }); + + return ( + setConfig({ type: code.type as Mode, value: code.value }), [ + setConfig, + ])} + /> + ); + }; + + it('renders RequestBodyField', () => { + const { getByText, getByLabelText } = render(); + + expect(getByText('Form')).toBeInTheDocument(); + expect(getByText('Text')).toBeInTheDocument(); + expect(getByText('XML')).toBeInTheDocument(); + expect(getByText('JSON')).toBeInTheDocument(); + expect(getByLabelText('Text code editor')).toBeInTheDocument(); + }); + + it('handles changing code editor mode', async () => { + const { getByText, getByLabelText, queryByText, queryByLabelText } = render( + + ); + + // currently text code editor is displayed + expect(getByLabelText('Text code editor')).toBeInTheDocument(); + expect(queryByText('Key')).not.toBeInTheDocument(); + + const formButton = getByText('Form').closest('button'); + if (formButton) { + fireEvent.click(formButton); + } + await waitFor(() => { + expect(getByText('Add form field')).toBeInTheDocument(); + expect(queryByLabelText('Text code editor')).not.toBeInTheDocument(); + }); + }); +}); diff --git a/x-pack/plugins/uptime/public/components/fleet_package/request_body_field.tsx b/x-pack/plugins/uptime/public/components/fleet_package/request_body_field.tsx new file mode 100644 index 0000000000000..0b6faefd7aa62 --- /dev/null +++ b/x-pack/plugins/uptime/public/components/fleet_package/request_body_field.tsx @@ -0,0 +1,243 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ +import React, { useCallback, useEffect, useMemo, useState } from 'react'; +import { FormattedMessage } from '@kbn/i18n/react'; +import { i18n } from '@kbn/i18n'; +import { stringify, parse } from 'query-string'; + +import styled from 'styled-components'; + +import { EuiCodeEditor, EuiPanel, EuiTabbedContent } from '@elastic/eui'; + +import { Mode } from './types'; + +import { KeyValuePairsField, Pair } from './key_value_field'; + +import 'brace/theme/github'; +import 'brace/mode/xml'; +import 'brace/mode/json'; +import 'brace/ext/language_tools'; + +const CodeEditorContainer = styled(EuiPanel)` + padding: 0; +`; + +enum ResponseBodyType { + CODE = 'code', + FORM = 'form', +} + +const CodeEditor = ({ + ariaLabel, + id, + mode, + onChange, + value, +}: { + ariaLabel: string; + id: string; + mode: Mode; + onChange: (value: string) => void; + value: string; +}) => { + return ( + +
    + +
    +
    + ); +}; + +interface Props { + onChange: (requestBody: { type: Mode; value: string }) => void; + type: Mode; + value: string; +} + +// TO DO: Look into whether or not code editor reports errors, in order to prevent form submission on an error +export const RequestBodyField = ({ onChange, type, value }: Props) => { + const [values, setValues] = useState>({ + [ResponseBodyType.FORM]: type === Mode.FORM ? value : '', + [ResponseBodyType.CODE]: type !== Mode.FORM ? value : '', + }); + useEffect(() => { + onChange({ + type, + value: type === Mode.FORM ? values[ResponseBodyType.FORM] : values[ResponseBodyType.CODE], + }); + }, [onChange, type, values]); + + const handleSetMode = useCallback( + (currentMode: Mode) => { + onChange({ + type: currentMode, + value: + currentMode === Mode.FORM ? values[ResponseBodyType.FORM] : values[ResponseBodyType.CODE], + }); + }, + [onChange, values] + ); + + const onChangeFormFields = useCallback( + (pairs: Pair[]) => { + const formattedPairs = pairs.reduce((acc: Record, header) => { + const [key, pairValue] = header; + if (key) { + return { + ...acc, + [key]: pairValue, + }; + } + return acc; + }, {}); + return setValues((prevValues) => ({ + ...prevValues, + [Mode.FORM]: stringify(formattedPairs), + })); + }, + [setValues] + ); + + const defaultFormPairs: Pair[] = useMemo(() => { + const pairs = parse(values[Mode.FORM]); + const keys = Object.keys(pairs); + const formattedPairs: Pair[] = keys.map((key: string) => { + // key, value, checked; + return [key, `${pairs[key]}`]; + }); + return formattedPairs; + }, [values]); + + const tabs = [ + { + id: Mode.TEXT, + name: modeLabels[Mode.TEXT], + content: ( + + setValues((prevValues) => ({ ...prevValues, [ResponseBodyType.CODE]: code })) + } + value={values[ResponseBodyType.CODE]} + /> + ), + }, + { + id: Mode.JSON, + name: modeLabels[Mode.JSON], + content: ( + + setValues((prevValues) => ({ ...prevValues, [ResponseBodyType.CODE]: code })) + } + value={values[ResponseBodyType.CODE]} + /> + ), + }, + { + id: Mode.XML, + name: modeLabels[Mode.XML], + content: ( + + setValues((prevValues) => ({ ...prevValues, [ResponseBodyType.CODE]: code })) + } + value={values[ResponseBodyType.CODE]} + /> + ), + }, + { + id: Mode.FORM, + name: modeLabels[Mode.FORM], + content: ( + + } + defaultPairs={defaultFormPairs} + onChange={onChangeFormFields} + /> + ), + }, + ]; + + return ( + tab.id === type)} + autoFocus="selected" + onTabClick={(tab) => { + handleSetMode(tab.id as Mode); + }} + /> + ); +}; + +const modeLabels = { + [Mode.FORM]: i18n.translate( + 'xpack.uptime.createPackagePolicy.stepConfigure.requestBodyType.form', + { + defaultMessage: 'Form', + } + ), + [Mode.TEXT]: i18n.translate( + 'xpack.uptime.createPackagePolicy.stepConfigure.requestBodyType.text', + { + defaultMessage: 'Text', + } + ), + [Mode.JSON]: i18n.translate( + 'xpack.uptime.createPackagePolicy.stepConfigure.requestBodyType.JSON', + { + defaultMessage: 'JSON', + } + ), + [Mode.XML]: i18n.translate('xpack.uptime.createPackagePolicy.stepConfigure.requestBodyType.XML', { + defaultMessage: 'XML', + }), +}; diff --git a/x-pack/plugins/uptime/public/components/fleet_package/schedule_field.test.tsx b/x-pack/plugins/uptime/public/components/fleet_package/schedule_field.test.tsx new file mode 100644 index 0000000000000..3358d1edabcc9 --- /dev/null +++ b/x-pack/plugins/uptime/public/components/fleet_package/schedule_field.test.tsx @@ -0,0 +1,63 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import React, { useState } from 'react'; +import { fireEvent, waitFor } from '@testing-library/react'; +import { render } from '../../lib/helper/rtl_helpers'; +import { ScheduleField } from './schedule_field'; +import { ScheduleUnit } from './types'; + +describe('', () => { + const number = '1'; + const unit = ScheduleUnit.MINUTES; + const WrappedComponent = () => { + const [config, setConfig] = useState({ + number, + unit, + }); + + return ( + setConfig(value)} + /> + ); + }; + + it('hanles schedule', () => { + const { getByText, getByTestId } = render(); + const input = getByTestId('scheduleFieldInput') as HTMLInputElement; + const select = getByTestId('scheduleFieldSelect') as HTMLInputElement; + expect(input.value).toBe(number); + expect(select.value).toBe(unit); + expect(getByText('Minutes')).toBeInTheDocument(); + }); + + it('hanles on change', async () => { + const { getByText, getByTestId } = render(); + const input = getByTestId('scheduleFieldInput') as HTMLInputElement; + const select = getByTestId('scheduleFieldSelect') as HTMLInputElement; + const newNumber = '2'; + const newUnit = ScheduleUnit.SECONDS; + expect(input.value).toBe(number); + expect(select.value).toBe(unit); + + fireEvent.change(input, { target: { value: newNumber } }); + + await waitFor(() => { + expect(input.value).toBe(newNumber); + }); + + fireEvent.change(select, { target: { value: newUnit } }); + + await waitFor(() => { + expect(select.value).toBe(newUnit); + expect(getByText('Seconds')).toBeInTheDocument(); + }); + }); +}); diff --git a/x-pack/plugins/uptime/public/components/fleet_package/schedule_field.tsx b/x-pack/plugins/uptime/public/components/fleet_package/schedule_field.tsx new file mode 100644 index 0000000000000..047d200d0af02 --- /dev/null +++ b/x-pack/plugins/uptime/public/components/fleet_package/schedule_field.tsx @@ -0,0 +1,77 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import React from 'react'; +import { i18n } from '@kbn/i18n'; + +import { EuiFieldNumber, EuiFlexGroup, EuiFlexItem, EuiSelect } from '@elastic/eui'; +import { ConfigKeys, ICustomFields, ScheduleUnit } from './types'; + +interface Props { + number: string; + onChange: (schedule: ICustomFields[ConfigKeys.SCHEDULE]) => void; + unit: ScheduleUnit; +} + +export const ScheduleField = ({ number, onChange, unit }: Props) => { + return ( + + + { + const updatedNumber = event.target.value; + onChange({ number: updatedNumber, unit }); + }} + /> + + + { + const updatedUnit = event.target.value; + onChange({ number, unit: updatedUnit as ScheduleUnit }); + }} + /> + + + ); +}; + +const options = [ + { + text: i18n.translate('xpack.uptime.createPackagePolicy.stepConfigure.scheduleField.seconds', { + defaultMessage: 'Seconds', + }), + value: ScheduleUnit.SECONDS, + }, + { + text: i18n.translate('xpack.uptime.createPackagePolicy.stepConfigure.scheduleField.minutes', { + defaultMessage: 'Minutes', + }), + value: ScheduleUnit.MINUTES, + }, +]; diff --git a/x-pack/plugins/uptime/public/components/fleet_package/synthetics_policy_create_extension.tsx b/x-pack/plugins/uptime/public/components/fleet_package/synthetics_policy_create_extension.tsx new file mode 100644 index 0000000000000..51585e227b56e --- /dev/null +++ b/x-pack/plugins/uptime/public/components/fleet_package/synthetics_policy_create_extension.tsx @@ -0,0 +1,75 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import React, { memo, useContext, useEffect } from 'react'; +import useDebounce from 'react-use/lib/useDebounce'; +import { PackagePolicyCreateExtensionComponentProps } from '../../../../fleet/public'; +import { useTrackPageview } from '../../../../observability/public'; +import { Config, ConfigKeys } from './types'; +import { + SimpleFieldsContext, + HTTPAdvancedFieldsContext, + TCPAdvancedFieldsContext, + TLSFieldsContext, +} from './contexts'; +import { CustomFields } from './custom_fields'; +import { useUpdatePolicy } from './use_update_policy'; +import { validate } from './validation'; + +/** + * Exports Synthetics-specific package policy instructions + * for use in the Ingest app create / edit package policy + */ +export const SyntheticsPolicyCreateExtension = memo( + ({ newPolicy, onChange }) => { + const { fields: simpleFields } = useContext(SimpleFieldsContext); + const { fields: httpAdvancedFields } = useContext(HTTPAdvancedFieldsContext); + const { fields: tcpAdvancedFields } = useContext(TCPAdvancedFieldsContext); + const { fields: tlsFields } = useContext(TLSFieldsContext); + const defaultConfig: Config = { + name: '', + ...simpleFields, + ...httpAdvancedFields, + ...tcpAdvancedFields, + ...tlsFields, + }; + useTrackPageview({ app: 'fleet', path: 'syntheticsCreate' }); + useTrackPageview({ app: 'fleet', path: 'syntheticsCreate', delay: 15000 }); + const { config, setConfig } = useUpdatePolicy({ defaultConfig, newPolicy, onChange, validate }); + + // Fleet will initialize the create form with a default name for the integratin policy, however, + // for synthetics, we want the user to explicitely type in a name to use as the monitor name, + // so we blank it out only during 1st component render (thus why the eslint disabled rule below). + useEffect(() => { + onChange({ + isValid: false, + updatedPolicy: { + ...newPolicy, + name: '', + }, + }); + // eslint-disable-next-line react-hooks/exhaustive-deps + }, []); + + useDebounce( + () => { + setConfig((prevConfig) => ({ + ...prevConfig, + ...simpleFields, + ...httpAdvancedFields, + ...tcpAdvancedFields, + ...tlsFields, + })); + }, + 250, + [setConfig, simpleFields, httpAdvancedFields, tcpAdvancedFields, tlsFields] + ); + + return ; + } +); +SyntheticsPolicyCreateExtension.displayName = 'SyntheticsPolicyCreateExtension'; diff --git a/x-pack/plugins/uptime/public/components/fleet_package/synthetics_policy_create_extension_wrapper.test.tsx b/x-pack/plugins/uptime/public/components/fleet_package/synthetics_policy_create_extension_wrapper.test.tsx new file mode 100644 index 0000000000000..ff05636e7774b --- /dev/null +++ b/x-pack/plugins/uptime/public/components/fleet_package/synthetics_policy_create_extension_wrapper.test.tsx @@ -0,0 +1,739 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import React from 'react'; +import { fireEvent, waitFor } from '@testing-library/react'; +import { render } from '../../lib/helper/rtl_helpers'; +import { NewPackagePolicy } from '../../../../fleet/public'; +import { + defaultSimpleFields, + defaultTLSFields, + defaultHTTPAdvancedFields, + defaultTCPAdvancedFields, +} from './contexts'; +import { SyntheticsPolicyCreateExtensionWrapper } from './synthetics_policy_create_extension_wrapper'; +import { ConfigKeys, DataStream, ScheduleUnit, VerificationMode } from './types'; + +const defaultConfig = { + ...defaultSimpleFields, + ...defaultTLSFields, + ...defaultHTTPAdvancedFields, + ...defaultTCPAdvancedFields, +}; + +// ensures that fields appropriately match to their label +jest.mock('@elastic/eui/lib/services/accessibility/html_id_generator', () => ({ + htmlIdGenerator: () => () => `id-${Math.random()}`, +})); + +const defaultNewPolicy: NewPackagePolicy = { + name: 'samplePolicyName', + description: '', + namespace: 'default', + policy_id: 'ae774160-8e49-11eb-aba5-99269d21ba6e', + enabled: true, + output_id: '', + inputs: [ + { + type: 'synthetics/http', + enabled: true, + streams: [ + { + enabled: true, + data_stream: { + type: 'synthetics', + dataset: 'http', + }, + vars: { + type: { + value: 'http', + type: 'text', + }, + name: { + value: 'Sample name', + type: 'text', + }, + schedule: { + value: '"@every 5s"', + type: 'text', + }, + urls: { + value: '', + type: 'text', + }, + 'service.name': { + value: '', + type: 'text', + }, + timeout: { + value: 1600, + type: 'integer', + }, + max_redirects: { + value: 0, + type: 'integer', + }, + proxy_url: { + value: '', + type: 'text', + }, + tags: { + value: '[]', + type: 'yaml', + }, + 'response.include_headers': { + value: true, + type: 'bool', + }, + 'response.include_body': { + value: 'on_error', + type: 'text', + }, + 'check.request.method': { + value: 'GET', + type: 'text', + }, + 'check.request.headers': { + value: '{}', + type: 'yaml', + }, + 'check.request.body': { + value: '""', + type: 'yaml', + }, + 'check.response.status': { + value: '[]', + type: 'yaml', + }, + 'check.response.headers': { + value: '{}', + type: 'yaml', + }, + 'check.response.body.positive': { + value: '[]', + type: 'yaml', + }, + 'check.response.body.negative': { + value: '[]', + type: 'yaml', + }, + 'ssl.certificate_authorities': { + value: '', + type: 'yaml', + }, + 'ssl.certificate': { + value: '', + type: 'yaml', + }, + 'ssl.key': { + value: '', + type: 'yaml', + }, + 'ssl.key_passphrase': { + type: 'text', + }, + 'ssl.verification_mode': { + value: 'full', + type: 'text', + }, + }, + }, + ], + }, + { + type: 'synthetics/tcp', + enabled: false, + streams: [ + { + enabled: false, + data_stream: { + type: 'synthetics', + dataset: 'tcp', + }, + vars: { + type: { + value: 'tcp', + type: 'text', + }, + name: { + type: 'text', + }, + schedule: { + value: '10s', + type: 'text', + }, + hosts: { + type: 'text', + }, + 'service.name': { + type: 'text', + }, + timeout: { + type: 'integer', + }, + max_redirects: { + type: 'integer', + }, + proxy_url: { + type: 'text', + }, + proxy_use_local_resolver: { + value: false, + type: 'bool', + }, + tags: { + type: 'yaml', + }, + 'check.send': { + type: 'text', + }, + 'check.receive': { + type: 'yaml', + }, + 'ssl.certificate_authorities': { + type: 'yaml', + }, + 'ssl.certificate': { + type: 'yaml', + }, + 'ssl.key': { + type: 'yaml', + }, + 'ssl.key_passphrase': { + type: 'text', + }, + 'ssl.verification_mode': { + type: 'text', + }, + }, + }, + ], + }, + { + type: 'synthetics/icmp', + enabled: false, + streams: [ + { + enabled: false, + data_stream: { + type: 'synthetics', + dataset: 'icmp', + }, + vars: { + type: { + value: 'icmp', + type: 'text', + }, + name: { + type: 'text', + }, + schedule: { + value: '10s', + type: 'text', + }, + wait: { + value: '1s', + type: 'text', + }, + hosts: { + type: 'text', + }, + 'service.name': { + type: 'text', + }, + timeout: { + type: 'integer', + }, + max_redirects: { + type: 'integer', + }, + tags: { + type: 'yaml', + }, + }, + }, + ], + }, + ], + package: { + name: 'synthetics', + title: 'Elastic Synthetics', + version: '0.66.0', + }, +}; + +describe('', () => { + const onChange = jest.fn(); + const WrappedComponent = ({ newPolicy = defaultNewPolicy }) => { + return ; + }; + + it('renders SyntheticsPolicyCreateExtension', async () => { + const { getByText, getByLabelText, queryByLabelText } = render(); + const monitorType = queryByLabelText('Monitor Type') as HTMLInputElement; + const url = getByLabelText('URL') as HTMLInputElement; + const proxyUrl = getByLabelText('Proxy URL') as HTMLInputElement; + const monitorIntervalNumber = getByLabelText('Number') as HTMLInputElement; + const monitorIntervalUnit = getByLabelText('Unit') as HTMLInputElement; + const apmServiceName = getByLabelText('APM service name') as HTMLInputElement; + const maxRedirects = getByLabelText('Max redirects') as HTMLInputElement; + const timeout = getByLabelText('Timeout in seconds') as HTMLInputElement; + expect(monitorType).toBeInTheDocument(); + expect(monitorType.value).toEqual(defaultConfig[ConfigKeys.MONITOR_TYPE]); + expect(url).toBeInTheDocument(); + expect(url.value).toEqual(defaultConfig[ConfigKeys.URLS]); + expect(proxyUrl).toBeInTheDocument(); + expect(proxyUrl.value).toEqual(defaultConfig[ConfigKeys.PROXY_URL]); + expect(monitorIntervalNumber).toBeInTheDocument(); + expect(monitorIntervalNumber.value).toEqual(defaultConfig[ConfigKeys.SCHEDULE].number); + expect(monitorIntervalUnit).toBeInTheDocument(); + expect(monitorIntervalUnit.value).toEqual(defaultConfig[ConfigKeys.SCHEDULE].unit); + expect(apmServiceName).toBeInTheDocument(); + expect(apmServiceName.value).toEqual(defaultConfig[ConfigKeys.APM_SERVICE_NAME]); + expect(maxRedirects).toBeInTheDocument(); + expect(maxRedirects.value).toEqual(`${defaultConfig[ConfigKeys.MAX_REDIRECTS]}`); + expect(timeout).toBeInTheDocument(); + expect(timeout.value).toEqual(`${defaultConfig[ConfigKeys.TIMEOUT]}`); + + // ensure other monitor type options are not in the DOM + expect(queryByLabelText('Host')).not.toBeInTheDocument(); + expect(queryByLabelText('Wait in seconds')).not.toBeInTheDocument(); + + // ensure at least one http advanced option is present + const advancedOptionsButton = getByText('Advanced HTTP options'); + fireEvent.click(advancedOptionsButton); + await waitFor(() => { + expect(getByLabelText('Request method')).toBeInTheDocument(); + }); + }); + + it('handles updating each field', async () => { + const { getByLabelText } = render(); + const url = getByLabelText('URL') as HTMLInputElement; + const proxyUrl = getByLabelText('Proxy URL') as HTMLInputElement; + const monitorIntervalNumber = getByLabelText('Number') as HTMLInputElement; + const monitorIntervalUnit = getByLabelText('Unit') as HTMLInputElement; + const apmServiceName = getByLabelText('APM service name') as HTMLInputElement; + const maxRedirects = getByLabelText('Max redirects') as HTMLInputElement; + const timeout = getByLabelText('Timeout in seconds') as HTMLInputElement; + + fireEvent.change(url, { target: { value: 'http://elastic.co' } }); + fireEvent.change(proxyUrl, { target: { value: 'http://proxy.co' } }); + fireEvent.change(monitorIntervalNumber, { target: { value: '1' } }); + fireEvent.change(monitorIntervalUnit, { target: { value: ScheduleUnit.MINUTES } }); + fireEvent.change(apmServiceName, { target: { value: 'APM Service' } }); + fireEvent.change(maxRedirects, { target: { value: '2' } }); + fireEvent.change(timeout, { target: { value: '3' } }); + + expect(url.value).toEqual('http://elastic.co'); + expect(proxyUrl.value).toEqual('http://proxy.co'); + expect(monitorIntervalNumber.value).toEqual('1'); + expect(monitorIntervalUnit.value).toEqual(ScheduleUnit.MINUTES); + expect(apmServiceName.value).toEqual('APM Service'); + expect(maxRedirects.value).toEqual('2'); + expect(timeout.value).toEqual('3'); + }); + + it('handles calling onChange', async () => { + const { getByLabelText } = render(); + const url = getByLabelText('URL') as HTMLInputElement; + + fireEvent.change(url, { target: { value: 'http://elastic.co' } }); + + await waitFor(() => { + expect(onChange).toBeCalledWith({ + isValid: true, + updatedPolicy: { + ...defaultNewPolicy, + inputs: [ + { + ...defaultNewPolicy.inputs[0], + streams: [ + { + ...defaultNewPolicy.inputs[0].streams[0], + vars: { + ...defaultNewPolicy.inputs[0].streams[0].vars, + urls: { + value: 'http://elastic.co', + type: 'text', + }, + }, + }, + ], + }, + defaultNewPolicy.inputs[1], + defaultNewPolicy.inputs[2], + ], + }, + }); + }); + }); + + it('handles switching monitor type', async () => { + const { getByText, getByLabelText, queryByLabelText } = render(); + const monitorType = getByLabelText('Monitor Type') as HTMLInputElement; + expect(monitorType).toBeInTheDocument(); + expect(monitorType.value).toEqual(defaultConfig[ConfigKeys.MONITOR_TYPE]); + fireEvent.change(monitorType, { target: { value: DataStream.TCP } }); + + await waitFor(() => { + expect(onChange).toBeCalledWith({ + isValid: false, + updatedPolicy: { + ...defaultNewPolicy, + inputs: [ + { + ...defaultNewPolicy.inputs[0], + enabled: false, + }, + { + ...defaultNewPolicy.inputs[1], + enabled: true, + }, + defaultNewPolicy.inputs[2], + ], + }, + }); + }); + + // expect tcp fields to be in the DOM + const host = getByLabelText('Host:Port') as HTMLInputElement; + + expect(host).toBeInTheDocument(); + expect(host.value).toEqual(defaultConfig[ConfigKeys.HOSTS]); + + // expect HTTP fields not to be in the DOM + expect(queryByLabelText('URL')).not.toBeInTheDocument(); + expect(queryByLabelText('Max redirects')).not.toBeInTheDocument(); + + // ensure at least one tcp advanced option is present + const advancedOptionsButton = getByText('Advanced TCP options'); + fireEvent.click(advancedOptionsButton); + + expect(queryByLabelText('Request method')).not.toBeInTheDocument(); + expect(getByLabelText('Request payload')).toBeInTheDocument(); + + fireEvent.change(monitorType, { target: { value: DataStream.ICMP } }); + + await waitFor(() => { + expect(onChange).toBeCalledWith({ + isValid: false, + updatedPolicy: { + ...defaultNewPolicy, + inputs: [ + { + ...defaultNewPolicy.inputs[0], + enabled: false, + }, + { + ...defaultNewPolicy.inputs[1], + enabled: false, + }, + { + ...defaultNewPolicy.inputs[2], + enabled: true, + }, + ], + }, + }); + }); + + // expect ICMP fields to be in the DOM + expect(getByLabelText('Wait in seconds')).toBeInTheDocument(); + + // expect TCP fields not to be in the DOM + expect(queryByLabelText('Proxy URL')).not.toBeInTheDocument(); + }); + + it('handles http validation', async () => { + const { getByText, getByLabelText, queryByText } = render(); + + const url = getByLabelText('URL') as HTMLInputElement; + const monitorIntervalNumber = getByLabelText('Number') as HTMLInputElement; + const maxRedirects = getByLabelText('Max redirects') as HTMLInputElement; + const timeout = getByLabelText('Timeout in seconds') as HTMLInputElement; + + // create errors + fireEvent.change(monitorIntervalNumber, { target: { value: '-1' } }); + fireEvent.change(maxRedirects, { target: { value: '-1' } }); + fireEvent.change(timeout, { target: { value: '-1' } }); + + const urlError = getByText('URL is required'); + const monitorIntervalError = getByText('Monitor interval is required'); + const maxRedirectsError = getByText('Max redirects must be 0 or greater'); + const timeoutError = getByText('Timeout must be 0 or greater and less than schedule interval'); + + expect(urlError).toBeInTheDocument(); + expect(monitorIntervalError).toBeInTheDocument(); + expect(maxRedirectsError).toBeInTheDocument(); + expect(timeoutError).toBeInTheDocument(); + + // expect onChange to be called with isValid false + await waitFor(() => { + expect(onChange).toBeCalledWith( + expect.objectContaining({ + isValid: false, + }) + ); + }); + + // resolve errors + fireEvent.change(url, { target: { value: 'http://elastic.co' } }); + fireEvent.change(monitorIntervalNumber, { target: { value: '1' } }); + fireEvent.change(maxRedirects, { target: { value: '1' } }); + fireEvent.change(timeout, { target: { value: '1' } }); + + // expect onChange to be called with isValid true + await waitFor(() => { + expect(queryByText('URL is required')).not.toBeInTheDocument(); + expect(queryByText('Monitor interval is required')).not.toBeInTheDocument(); + expect(queryByText('Max redirects must be 0 or greater')).not.toBeInTheDocument(); + expect( + queryByText('Timeout must be 0 or greater and less than schedule interval') + ).not.toBeInTheDocument(); + expect(onChange).toBeCalledWith( + expect.objectContaining({ + isValid: true, + }) + ); + }); + }); + + it('handles tcp validation', async () => { + const { getByText, getByLabelText, queryByText } = render(); + + const monitorType = getByLabelText('Monitor Type') as HTMLInputElement; + fireEvent.change(monitorType, { target: { value: DataStream.TCP } }); + + const host = getByLabelText('Host:Port') as HTMLInputElement; + const monitorIntervalNumber = getByLabelText('Number') as HTMLInputElement; + const timeout = getByLabelText('Timeout in seconds') as HTMLInputElement; + + // create errors + fireEvent.change(host, { target: { value: 'localhost' } }); // host without port + fireEvent.change(monitorIntervalNumber, { target: { value: '-1' } }); + fireEvent.change(timeout, { target: { value: '-1' } }); + + await waitFor(() => { + const hostError = getByText('Host and port are required'); + const monitorIntervalError = getByText('Monitor interval is required'); + const timeoutError = getByText( + 'Timeout must be 0 or greater and less than schedule interval' + ); + + expect(hostError).toBeInTheDocument(); + expect(monitorIntervalError).toBeInTheDocument(); + expect(timeoutError).toBeInTheDocument(); + expect(onChange).toBeCalledWith( + expect.objectContaining({ + isValid: false, + }) + ); + }); + + // resolve errors + fireEvent.change(host, { target: { value: 'smtp.gmail.com:587' } }); + fireEvent.change(monitorIntervalNumber, { target: { value: '1' } }); + fireEvent.change(timeout, { target: { value: '1' } }); + + await waitFor(() => { + expect(queryByText('Host and port are required')).not.toBeInTheDocument(); + expect(queryByText('Monitor interval is required')).not.toBeInTheDocument(); + expect(queryByText('Max redirects must be 0 or greater')).not.toBeInTheDocument(); + expect( + queryByText('Timeout must be 0 or greater and less than schedule interval') + ).not.toBeInTheDocument(); + expect(onChange).toBeCalledWith( + expect.objectContaining({ + isValid: true, + }) + ); + }); + }); + + it('handles icmp validation', async () => { + const { getByText, getByLabelText, queryByText } = render(); + + const monitorType = getByLabelText('Monitor Type') as HTMLInputElement; + fireEvent.change(monitorType, { target: { value: DataStream.ICMP } }); + + const host = getByLabelText('Host') as HTMLInputElement; + const monitorIntervalNumber = getByLabelText('Number') as HTMLInputElement; + const timeout = getByLabelText('Timeout in seconds') as HTMLInputElement; + const wait = getByLabelText('Wait in seconds') as HTMLInputElement; + + // create errors + fireEvent.change(host, { target: { value: '' } }); + fireEvent.change(monitorIntervalNumber, { target: { value: '-1' } }); + fireEvent.change(timeout, { target: { value: '-1' } }); + fireEvent.change(wait, { target: { value: '-1' } }); + + await waitFor(() => { + const hostError = getByText('Host is required'); + const monitorIntervalError = getByText('Monitor interval is required'); + const timeoutError = getByText( + 'Timeout must be 0 or greater and less than schedule interval' + ); + const waitError = getByText('Wait must be 0 or greater'); + + expect(hostError).toBeInTheDocument(); + expect(monitorIntervalError).toBeInTheDocument(); + expect(timeoutError).toBeInTheDocument(); + expect(waitError).toBeInTheDocument(); + expect(onChange).toBeCalledWith( + expect.objectContaining({ + isValid: false, + }) + ); + }); + + // resolve errors + fireEvent.change(host, { target: { value: '1.1.1.1' } }); + fireEvent.change(monitorIntervalNumber, { target: { value: '1' } }); + fireEvent.change(timeout, { target: { value: '1' } }); + fireEvent.change(wait, { target: { value: '1' } }); + + await waitFor(() => { + expect(queryByText('Host is required')).not.toBeInTheDocument(); + expect(queryByText('Monitor interval is required')).not.toBeInTheDocument(); + expect( + queryByText('Timeout must be 0 or greater and less than schedule interval') + ).not.toBeInTheDocument(); + expect(queryByText('Wait must be 0 or greater')).not.toBeInTheDocument(); + expect(onChange).toBeCalledWith( + expect.objectContaining({ + isValid: true, + }) + ); + }); + }); + + it('handles changing TLS fields', async () => { + const { findByLabelText, queryByLabelText } = render(); + const enableSSL = queryByLabelText('Enable TLS configuration') as HTMLInputElement; + + await waitFor(() => { + expect(onChange).toBeCalledWith({ + isValid: true, + updatedPolicy: { + ...defaultNewPolicy, + inputs: [ + { + ...defaultNewPolicy.inputs[0], + streams: [ + { + ...defaultNewPolicy.inputs[0].streams[0], + vars: { + ...defaultNewPolicy.inputs[0].streams[0].vars, + [ConfigKeys.TLS_CERTIFICATE_AUTHORITIES]: { + value: null, + type: 'yaml', + }, + [ConfigKeys.TLS_CERTIFICATE]: { + value: null, + type: 'yaml', + }, + [ConfigKeys.TLS_KEY]: { + value: null, + type: 'yaml', + }, + [ConfigKeys.TLS_KEY_PASSPHRASE]: { + value: null, + type: 'text', + }, + [ConfigKeys.TLS_VERIFICATION_MODE]: { + value: null, + type: 'text', + }, + }, + }, + ], + }, + defaultNewPolicy.inputs[1], + defaultNewPolicy.inputs[2], + ], + }, + }); + }); + + // ensure at least one http advanced option is present + fireEvent.click(enableSSL); + + const ca = (await findByLabelText('Certificate authorities')) as HTMLInputElement; + const clientKey = (await findByLabelText('Client key')) as HTMLInputElement; + const clientKeyPassphrase = (await findByLabelText( + 'Client key passphrase' + )) as HTMLInputElement; + const clientCertificate = (await findByLabelText('Client certificate')) as HTMLInputElement; + const verificationMode = (await findByLabelText('Verification mode')) as HTMLInputElement; + + await waitFor(() => { + fireEvent.change(ca, { target: { value: 'certificateAuthorities' } }); + expect(ca.value).toEqual(defaultConfig[ConfigKeys.TLS_CERTIFICATE_AUTHORITIES].value); + }); + await waitFor(() => { + fireEvent.change(clientCertificate, { target: { value: 'clientCertificate' } }); + expect(clientCertificate.value).toEqual(defaultConfig[ConfigKeys.TLS_KEY].value); + }); + await waitFor(() => { + fireEvent.change(clientKey, { target: { value: 'clientKey' } }); + expect(clientKey.value).toEqual(defaultConfig[ConfigKeys.TLS_KEY].value); + }); + await waitFor(() => { + fireEvent.change(clientKeyPassphrase, { target: { value: 'clientKeyPassphrase' } }); + expect(clientKeyPassphrase.value).toEqual(defaultConfig[ConfigKeys.TLS_KEY_PASSPHRASE].value); + }); + await waitFor(() => { + fireEvent.change(verificationMode, { target: { value: VerificationMode.NONE } }); + expect(verificationMode.value).toEqual(defaultConfig[ConfigKeys.TLS_VERIFICATION_MODE].value); + }); + + await waitFor(() => { + expect(onChange).toBeCalledWith({ + isValid: true, + updatedPolicy: { + ...defaultNewPolicy, + inputs: [ + { + ...defaultNewPolicy.inputs[0], + streams: [ + { + ...defaultNewPolicy.inputs[0].streams[0], + vars: { + ...defaultNewPolicy.inputs[0].streams[0].vars, + [ConfigKeys.TLS_CERTIFICATE_AUTHORITIES]: { + value: '"certificateAuthorities"', + type: 'yaml', + }, + [ConfigKeys.TLS_CERTIFICATE]: { + value: '"clientCertificate"', + type: 'yaml', + }, + [ConfigKeys.TLS_KEY]: { + value: '"clientKey"', + type: 'yaml', + }, + [ConfigKeys.TLS_KEY_PASSPHRASE]: { + value: 'clientKeyPassphrase', + type: 'text', + }, + [ConfigKeys.TLS_VERIFICATION_MODE]: { + value: VerificationMode.NONE, + type: 'text', + }, + }, + }, + ], + }, + defaultNewPolicy.inputs[1], + defaultNewPolicy.inputs[2], + ], + }, + }); + }); + }); +}); diff --git a/x-pack/plugins/uptime/public/components/fleet_package/synthetics_policy_create_extension_wrapper.tsx b/x-pack/plugins/uptime/public/components/fleet_package/synthetics_policy_create_extension_wrapper.tsx new file mode 100644 index 0000000000000..688ee24bd2330 --- /dev/null +++ b/x-pack/plugins/uptime/public/components/fleet_package/synthetics_policy_create_extension_wrapper.tsx @@ -0,0 +1,37 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import React, { memo } from 'react'; +import { PackagePolicyCreateExtensionComponentProps } from '../../../../fleet/public'; +import { SyntheticsPolicyCreateExtension } from './synthetics_policy_create_extension'; +import { + SimpleFieldsContextProvider, + HTTPAdvancedFieldsContextProvider, + TCPAdvancedFieldsContextProvider, + TLSFieldsContextProvider, +} from './contexts'; + +/** + * Exports Synthetics-specific package policy instructions + * for use in the Ingest app create / edit package policy + */ +export const SyntheticsPolicyCreateExtensionWrapper = memo( + ({ newPolicy, onChange }) => { + return ( + + + + + + + + + + ); + } +); +SyntheticsPolicyCreateExtensionWrapper.displayName = 'SyntheticsPolicyCreateExtensionWrapper'; diff --git a/x-pack/plugins/uptime/public/components/fleet_package/synthetics_policy_edit_extension.tsx b/x-pack/plugins/uptime/public/components/fleet_package/synthetics_policy_edit_extension.tsx new file mode 100644 index 0000000000000..386d99add87b6 --- /dev/null +++ b/x-pack/plugins/uptime/public/components/fleet_package/synthetics_policy_edit_extension.tsx @@ -0,0 +1,65 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import React, { memo, useContext } from 'react'; +import useDebounce from 'react-use/lib/useDebounce'; +import { PackagePolicyEditExtensionComponentProps } from '../../../../fleet/public'; +import { useTrackPageview } from '../../../../observability/public'; +import { + SimpleFieldsContext, + HTTPAdvancedFieldsContext, + TCPAdvancedFieldsContext, + TLSFieldsContext, +} from './contexts'; +import { Config, ConfigKeys } from './types'; +import { CustomFields } from './custom_fields'; +import { useUpdatePolicy } from './use_update_policy'; +import { validate } from './validation'; + +interface SyntheticsPolicyEditExtensionProps { + newPolicy: PackagePolicyEditExtensionComponentProps['newPolicy']; + onChange: PackagePolicyEditExtensionComponentProps['onChange']; + defaultConfig: Config; + isTLSEnabled: boolean; +} +/** + * Exports Synthetics-specific package policy instructions + * for use in the Fleet app create / edit package policy + */ +export const SyntheticsPolicyEditExtension = memo( + ({ newPolicy, onChange, defaultConfig, isTLSEnabled }) => { + useTrackPageview({ app: 'fleet', path: 'syntheticsEdit' }); + useTrackPageview({ app: 'fleet', path: 'syntheticsEdit', delay: 15000 }); + const { fields: simpleFields } = useContext(SimpleFieldsContext); + const { fields: httpAdvancedFields } = useContext(HTTPAdvancedFieldsContext); + const { fields: tcpAdvancedFields } = useContext(TCPAdvancedFieldsContext); + const { fields: tlsFields } = useContext(TLSFieldsContext); + const { config, setConfig } = useUpdatePolicy({ defaultConfig, newPolicy, onChange, validate }); + + useDebounce( + () => { + setConfig((prevConfig) => ({ + ...prevConfig, + ...simpleFields, + ...httpAdvancedFields, + ...tcpAdvancedFields, + ...tlsFields, + })); + }, + 250, + [setConfig, simpleFields, httpAdvancedFields, tcpAdvancedFields, tlsFields] + ); + + return ( + + ); + } +); +SyntheticsPolicyEditExtension.displayName = 'SyntheticsPolicyEditExtension'; diff --git a/x-pack/plugins/uptime/public/components/fleet_package/synthetics_policy_edit_extension_wrapper.test.tsx b/x-pack/plugins/uptime/public/components/fleet_package/synthetics_policy_edit_extension_wrapper.test.tsx new file mode 100644 index 0000000000000..03e0b338dfd72 --- /dev/null +++ b/x-pack/plugins/uptime/public/components/fleet_package/synthetics_policy_edit_extension_wrapper.test.tsx @@ -0,0 +1,803 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import React from 'react'; +import { fireEvent, waitFor } from '@testing-library/react'; +import { render } from '../../lib/helper/rtl_helpers'; +import { NewPackagePolicy } from '../../../../fleet/public'; +import { SyntheticsPolicyEditExtensionWrapper } from './synthetics_policy_edit_extension_wrapper'; +import { ConfigKeys, DataStream, ScheduleUnit } from './types'; +import { + defaultSimpleFields, + defaultTLSFields, + defaultHTTPAdvancedFields, + defaultTCPAdvancedFields, +} from './contexts'; + +// ensures that fields appropriately match to their label +jest.mock('@elastic/eui/lib/services/accessibility/html_id_generator', () => ({ + htmlIdGenerator: () => () => `id-${Math.random()}`, +})); + +const defaultConfig = { + ...defaultSimpleFields, + ...defaultTLSFields, + ...defaultHTTPAdvancedFields, + ...defaultTCPAdvancedFields, +}; + +const defaultNewPolicy: NewPackagePolicy = { + name: 'samplePolicyName', + description: '', + namespace: 'default', + policy_id: 'ae774160-8e49-11eb-aba5-99269d21ba6e', + enabled: true, + output_id: '', + inputs: [ + { + type: 'synthetics/http', + enabled: true, + streams: [ + { + enabled: true, + data_stream: { + type: 'synthetics', + dataset: 'http', + }, + vars: { + type: { + value: 'http', + type: 'text', + }, + name: { + value: 'Sample name', + type: 'text', + }, + schedule: { + value: '"@every 3m"', + type: 'text', + }, + urls: { + value: '', + type: 'text', + }, + 'service.name': { + value: '', + type: 'text', + }, + timeout: { + value: '16s', + type: 'text', + }, + max_redirects: { + value: 0, + type: 'integer', + }, + proxy_url: { + value: '', + type: 'text', + }, + tags: { + value: '[]', + type: 'yaml', + }, + 'response.include_headers': { + value: true, + type: 'bool', + }, + 'response.include_body': { + value: 'on_error', + type: 'text', + }, + 'check.request.method': { + value: 'GET', + type: 'text', + }, + 'check.request.headers': { + value: '{}', + type: 'yaml', + }, + 'check.request.body': { + value: '""', + type: 'yaml', + }, + 'check.response.status': { + value: '[]', + type: 'yaml', + }, + 'check.response.headers': { + value: '{}', + type: 'yaml', + }, + 'check.response.body.positive': { + value: '[]', + type: 'yaml', + }, + 'check.response.body.negative': { + value: '[]', + type: 'yaml', + }, + 'ssl.certificate_authorities': { + value: '', + type: 'yaml', + }, + 'ssl.certificate': { + value: '', + type: 'yaml', + }, + 'ssl.key': { + value: '', + type: 'yaml', + }, + 'ssl.key_passphrase': { + type: 'text', + }, + 'ssl.verification_mode': { + value: 'full', + type: 'text', + }, + }, + }, + ], + }, + { + type: 'synthetics/tcp', + enabled: false, + streams: [ + { + enabled: false, + data_stream: { + type: 'synthetics', + dataset: 'tcp', + }, + vars: { + type: { + value: 'tcp', + type: 'text', + }, + name: { + type: 'text', + }, + schedule: { + value: '"@every 5s"', + type: 'text', + }, + hosts: { + type: 'text', + }, + 'service.name': { + type: 'text', + }, + timeout: { + type: 'integer', + }, + max_redirects: { + type: 'integer', + }, + proxy_url: { + type: 'text', + }, + proxy_use_local_resolver: { + value: false, + type: 'bool', + }, + tags: { + type: 'yaml', + }, + 'check.send': { + type: 'text', + }, + 'check.receive': { + value: '', + type: 'yaml', + }, + 'ssl.certificate_authorities': { + type: 'yaml', + }, + 'ssl.certificate': { + type: 'yaml', + }, + 'ssl.key': { + type: 'yaml', + }, + 'ssl.key_passphrase': { + type: 'text', + }, + 'ssl.verification_mode': { + type: 'text', + }, + }, + }, + ], + }, + { + type: 'synthetics/icmp', + enabled: false, + streams: [ + { + enabled: false, + data_stream: { + type: 'synthetics', + dataset: 'icmp', + }, + vars: { + type: { + value: 'icmp', + type: 'text', + }, + name: { + type: 'text', + }, + schedule: { + value: '"@every 5s"', + type: 'text', + }, + wait: { + value: '1s', + type: 'text', + }, + hosts: { + type: 'text', + }, + 'service.name': { + type: 'text', + }, + timeout: { + type: 'integer', + }, + max_redirects: { + type: 'integer', + }, + tags: { + type: 'yaml', + }, + }, + }, + ], + }, + ], + package: { + name: 'synthetics', + title: 'Elastic Synthetics', + version: '0.66.0', + }, +}; + +const defaultCurrentPolicy: any = { + ...defaultNewPolicy, + id: '', + revision: '', + updated_at: '', + updated_by: '', + created_at: '', + created_by: '', +}; + +describe('', () => { + const onChange = jest.fn(); + const WrappedComponent = ({ policy = defaultCurrentPolicy, newPolicy = defaultNewPolicy }) => { + return ( + + ); + }; + + it('renders SyntheticsPolicyEditExtension', async () => { + const { getByText, getByLabelText, queryByLabelText } = render(); + const url = getByLabelText('URL') as HTMLInputElement; + const proxyUrl = getByLabelText('Proxy URL') as HTMLInputElement; + const monitorIntervalNumber = getByLabelText('Number') as HTMLInputElement; + const monitorIntervalUnit = getByLabelText('Unit') as HTMLInputElement; + const apmServiceName = getByLabelText('APM service name') as HTMLInputElement; + const maxRedirects = getByLabelText('Max redirects') as HTMLInputElement; + const timeout = getByLabelText('Timeout in seconds') as HTMLInputElement; + const verificationMode = getByLabelText('Verification mode') as HTMLInputElement; + const enableTLSConfig = getByLabelText('Enable TLS configuration') as HTMLInputElement; + expect(url).toBeInTheDocument(); + expect(url.value).toEqual(defaultConfig[ConfigKeys.URLS]); + expect(proxyUrl).toBeInTheDocument(); + expect(proxyUrl.value).toEqual(defaultConfig[ConfigKeys.PROXY_URL]); + expect(monitorIntervalNumber).toBeInTheDocument(); + expect(monitorIntervalNumber.value).toEqual(defaultConfig[ConfigKeys.SCHEDULE].number); + expect(monitorIntervalUnit).toBeInTheDocument(); + expect(monitorIntervalUnit.value).toEqual(defaultConfig[ConfigKeys.SCHEDULE].unit); + expect(apmServiceName).toBeInTheDocument(); + expect(apmServiceName.value).toEqual(defaultConfig[ConfigKeys.APM_SERVICE_NAME]); + expect(maxRedirects).toBeInTheDocument(); + expect(maxRedirects.value).toEqual(`${defaultConfig[ConfigKeys.MAX_REDIRECTS]}`); + expect(timeout).toBeInTheDocument(); + expect(timeout.value).toEqual(`${defaultConfig[ConfigKeys.TIMEOUT]}`); + // expect TLS settings to be in the document when at least one tls key is populated + expect(enableTLSConfig.checked).toBe(true); + expect(verificationMode).toBeInTheDocument(); + expect(verificationMode.value).toEqual( + `${defaultConfig[ConfigKeys.TLS_VERIFICATION_MODE].value}` + ); + + // ensure other monitor type options are not in the DOM + expect(queryByLabelText('Host')).not.toBeInTheDocument(); + expect(queryByLabelText('Wait in seconds')).not.toBeInTheDocument(); + + // ensure at least one http advanced option is present + const advancedOptionsButton = getByText('Advanced HTTP options'); + fireEvent.click(advancedOptionsButton); + await waitFor(() => { + expect(getByLabelText('Request method')).toBeInTheDocument(); + }); + }); + + it('does not allow user to edit monitor type', async () => { + const { queryByLabelText } = render(); + + expect(queryByLabelText('Monitor type')).not.toBeInTheDocument(); + }); + + it('handles updating each field', async () => { + const { getByLabelText } = render(); + const url = getByLabelText('URL') as HTMLInputElement; + const proxyUrl = getByLabelText('Proxy URL') as HTMLInputElement; + const monitorIntervalNumber = getByLabelText('Number') as HTMLInputElement; + const monitorIntervalUnit = getByLabelText('Unit') as HTMLInputElement; + const apmServiceName = getByLabelText('APM service name') as HTMLInputElement; + const maxRedirects = getByLabelText('Max redirects') as HTMLInputElement; + const timeout = getByLabelText('Timeout in seconds') as HTMLInputElement; + + fireEvent.change(url, { target: { value: 'http://elastic.co' } }); + fireEvent.change(proxyUrl, { target: { value: 'http://proxy.co' } }); + fireEvent.change(monitorIntervalNumber, { target: { value: '1' } }); + fireEvent.change(monitorIntervalUnit, { target: { value: ScheduleUnit.MINUTES } }); + fireEvent.change(apmServiceName, { target: { value: 'APM Service' } }); + fireEvent.change(maxRedirects, { target: { value: '2' } }); + fireEvent.change(timeout, { target: { value: '3' } }); + + expect(url.value).toEqual('http://elastic.co'); + expect(proxyUrl.value).toEqual('http://proxy.co'); + expect(monitorIntervalNumber.value).toEqual('1'); + expect(monitorIntervalUnit.value).toEqual(ScheduleUnit.MINUTES); + expect(apmServiceName.value).toEqual('APM Service'); + expect(maxRedirects.value).toEqual('2'); + expect(timeout.value).toEqual('3'); + }); + + it('handles calling onChange', async () => { + const { getByLabelText } = render(); + const url = getByLabelText('URL') as HTMLInputElement; + + fireEvent.change(url, { target: { value: 'http://elastic.co' } }); + + await waitFor(() => { + expect(onChange).toBeCalledWith({ + isValid: true, + updatedPolicy: { + ...defaultNewPolicy, + inputs: [ + { + ...defaultNewPolicy.inputs[0], + streams: [ + { + ...defaultNewPolicy.inputs[0].streams[0], + vars: { + ...defaultNewPolicy.inputs[0].streams[0].vars, + urls: { + value: 'http://elastic.co', + type: 'text', + }, + }, + }, + ], + }, + defaultNewPolicy.inputs[1], + defaultNewPolicy.inputs[2], + ], + }, + }); + }); + }); + + it('handles http validation', async () => { + const { getByText, getByLabelText, queryByText } = render(); + + const url = getByLabelText('URL') as HTMLInputElement; + const monitorIntervalNumber = getByLabelText('Number') as HTMLInputElement; + const maxRedirects = getByLabelText('Max redirects') as HTMLInputElement; + const timeout = getByLabelText('Timeout in seconds') as HTMLInputElement; + + // create errors + fireEvent.change(url, { target: { value: '' } }); + fireEvent.change(monitorIntervalNumber, { target: { value: '-1' } }); + fireEvent.change(maxRedirects, { target: { value: '-1' } }); + fireEvent.change(timeout, { target: { value: '-1' } }); + + const urlError = getByText('URL is required'); + const monitorIntervalError = getByText('Monitor interval is required'); + const maxRedirectsError = getByText('Max redirects must be 0 or greater'); + const timeoutError = getByText('Timeout must be 0 or greater and less than schedule interval'); + + expect(urlError).toBeInTheDocument(); + expect(monitorIntervalError).toBeInTheDocument(); + expect(maxRedirectsError).toBeInTheDocument(); + expect(timeoutError).toBeInTheDocument(); + + // expect onChange to be called with isValid false + await waitFor(() => { + expect(onChange).toBeCalledWith( + expect.objectContaining({ + isValid: false, + }) + ); + }); + + // resolve errors + fireEvent.change(url, { target: { value: 'http://elastic.co' } }); + fireEvent.change(monitorIntervalNumber, { target: { value: '1' } }); + fireEvent.change(maxRedirects, { target: { value: '1' } }); + fireEvent.change(timeout, { target: { value: '1' } }); + + // expect onChange to be called with isValid true + await waitFor(() => { + expect(queryByText('URL is required')).not.toBeInTheDocument(); + expect(queryByText('Monitor interval is required')).not.toBeInTheDocument(); + expect(queryByText('Max redirects must be 0 or greater')).not.toBeInTheDocument(); + expect( + queryByText('Timeout must be 0 or greater and less than schedule interval') + ).not.toBeInTheDocument(); + expect(onChange).toBeCalledWith( + expect.objectContaining({ + isValid: true, + }) + ); + }); + }); + + it('handles tcp validation', async () => { + const currentPolicy = { + ...defaultCurrentPolicy, + inputs: [ + { + ...defaultNewPolicy.inputs[0], + enabled: false, + }, + { + ...defaultNewPolicy.inputs[1], + enabled: true, + }, + defaultNewPolicy.inputs[2], + ], + }; + const { getByText, getByLabelText, queryByText } = render( + + ); + + const host = getByLabelText('Host:Port') as HTMLInputElement; + const monitorIntervalNumber = getByLabelText('Number') as HTMLInputElement; + const timeout = getByLabelText('Timeout in seconds') as HTMLInputElement; + + // create errors + fireEvent.change(host, { target: { value: 'localhost' } }); // host without port + fireEvent.change(monitorIntervalNumber, { target: { value: '-1' } }); + fireEvent.change(timeout, { target: { value: '-1' } }); + + await waitFor(() => { + const hostError = getByText('Host and port are required'); + const monitorIntervalError = getByText('Monitor interval is required'); + const timeoutError = getByText( + 'Timeout must be 0 or greater and less than schedule interval' + ); + + expect(hostError).toBeInTheDocument(); + expect(monitorIntervalError).toBeInTheDocument(); + expect(timeoutError).toBeInTheDocument(); + expect(onChange).toBeCalledWith( + expect.objectContaining({ + isValid: false, + }) + ); + }); + + // resolve errors + fireEvent.change(host, { target: { value: 'smtp.gmail.com:587' } }); + fireEvent.change(monitorIntervalNumber, { target: { value: '1' } }); + fireEvent.change(timeout, { target: { value: '1' } }); + + await waitFor(() => { + expect(queryByText('Host is required')).not.toBeInTheDocument(); + expect(queryByText('Monitor interval is required')).not.toBeInTheDocument(); + expect( + queryByText('Timeout must be 0 or greater and less than schedule interval') + ).not.toBeInTheDocument(); + expect(onChange).toBeCalledWith( + expect.objectContaining({ + isValid: true, + }) + ); + }); + }); + + it('handles icmp validation', async () => { + const currentPolicy = { + ...defaultCurrentPolicy, + inputs: [ + { + ...defaultNewPolicy.inputs[0], + enabled: false, + }, + { + ...defaultNewPolicy.inputs[1], + enabled: false, + }, + { + ...defaultNewPolicy.inputs[2], + enabled: true, + }, + ], + }; + const { getByText, getByLabelText, queryByText } = render( + + ); + + const host = getByLabelText('Host') as HTMLInputElement; + const monitorIntervalNumber = getByLabelText('Number') as HTMLInputElement; + const timeout = getByLabelText('Timeout in seconds') as HTMLInputElement; + const wait = getByLabelText('Wait in seconds') as HTMLInputElement; + + // create errors + fireEvent.change(host, { target: { value: '' } }); + fireEvent.change(monitorIntervalNumber, { target: { value: '-1' } }); + fireEvent.change(timeout, { target: { value: '-1' } }); + fireEvent.change(wait, { target: { value: '-1' } }); + + await waitFor(() => { + const hostError = getByText('Host is required'); + const monitorIntervalError = getByText('Monitor interval is required'); + const timeoutError = getByText( + 'Timeout must be 0 or greater and less than schedule interval' + ); + const waitError = getByText('Wait must be 0 or greater'); + + expect(hostError).toBeInTheDocument(); + expect(monitorIntervalError).toBeInTheDocument(); + expect(timeoutError).toBeInTheDocument(); + expect(waitError).toBeInTheDocument(); + expect(onChange).toBeCalledWith( + expect.objectContaining({ + isValid: false, + }) + ); + }); + + // resolve errors + fireEvent.change(host, { target: { value: '1.1.1.1' } }); + fireEvent.change(monitorIntervalNumber, { target: { value: '1' } }); + fireEvent.change(timeout, { target: { value: '1' } }); + fireEvent.change(wait, { target: { value: '1' } }); + + await waitFor(() => { + expect(queryByText('Host is required')).not.toBeInTheDocument(); + expect(queryByText('Monitor interval is required')).not.toBeInTheDocument(); + expect( + queryByText('Timeout must be 0 or greater and less than schedule interval') + ).not.toBeInTheDocument(); + expect(queryByText('Wait must be 0 or greater')).not.toBeInTheDocument(); + expect(onChange).toBeCalledWith( + expect.objectContaining({ + isValid: true, + }) + ); + }); + }); + + it('handles null values for http', async () => { + const httpVars = defaultNewPolicy.inputs[0].streams[0].vars; + const currentPolicy: NewPackagePolicy = { + ...defaultCurrentPolicy, + inputs: [ + { + ...defaultNewPolicy.inputs[0], + streams: [ + { + ...defaultNewPolicy.inputs[0].streams[0], + vars: Object.keys(httpVars || []).reduce< + Record + >((acc, key) => { + acc[key] = { + value: undefined, + type: `${httpVars?.[key].type}`, + }; + return acc; + }, {}), + }, + ], + }, + defaultCurrentPolicy.inputs[1], + defaultCurrentPolicy.inputs[2], + ], + }; + const { getByText, getByLabelText, queryByLabelText, queryByText } = render( + + ); + const url = getByLabelText('URL') as HTMLInputElement; + const proxyUrl = getByLabelText('Proxy URL') as HTMLInputElement; + const monitorIntervalNumber = getByLabelText('Number') as HTMLInputElement; + const monitorIntervalUnit = getByLabelText('Unit') as HTMLInputElement; + const apmServiceName = getByLabelText('APM service name') as HTMLInputElement; + const maxRedirects = getByLabelText('Max redirects') as HTMLInputElement; + const timeout = getByLabelText('Timeout in seconds') as HTMLInputElement; + const enableTLSConfig = getByLabelText('Enable TLS configuration') as HTMLInputElement; + + expect(url).toBeInTheDocument(); + expect(url.value).toEqual(defaultConfig[ConfigKeys.URLS]); + expect(proxyUrl).toBeInTheDocument(); + expect(proxyUrl.value).toEqual(defaultConfig[ConfigKeys.PROXY_URL]); + expect(monitorIntervalNumber).toBeInTheDocument(); + expect(monitorIntervalNumber.value).toEqual(defaultConfig[ConfigKeys.SCHEDULE].number); + expect(monitorIntervalUnit).toBeInTheDocument(); + expect(monitorIntervalUnit.value).toEqual(defaultConfig[ConfigKeys.SCHEDULE].unit); + expect(apmServiceName).toBeInTheDocument(); + expect(apmServiceName.value).toEqual(defaultConfig[ConfigKeys.APM_SERVICE_NAME]); + expect(maxRedirects).toBeInTheDocument(); + expect(maxRedirects.value).toEqual(`${defaultConfig[ConfigKeys.MAX_REDIRECTS]}`); + expect(timeout).toBeInTheDocument(); + expect(timeout.value).toEqual(`${defaultConfig[ConfigKeys.TIMEOUT]}`); + + /* expect TLS settings not to be in the document when and Enable TLS settings not to be checked + * when all TLS values are falsey */ + expect(enableTLSConfig.checked).toBe(false); + expect(queryByText('Verification mode')).not.toBeInTheDocument(); + + // ensure other monitor type options are not in the DOM + expect(queryByLabelText('Host')).not.toBeInTheDocument(); + expect(queryByLabelText('Wait in seconds')).not.toBeInTheDocument(); + + // ensure at least one http advanced option is present + const advancedOptionsButton = getByText('Advanced HTTP options'); + fireEvent.click(advancedOptionsButton); + await waitFor(() => { + const requestMethod = getByLabelText('Request method') as HTMLInputElement; + expect(requestMethod).toBeInTheDocument(); + expect(requestMethod.value).toEqual(`${defaultConfig[ConfigKeys.REQUEST_METHOD_CHECK]}`); + }); + }); + + it('handles null values for tcp', async () => { + const tcpVars = defaultNewPolicy.inputs[1].streams[0].vars; + const currentPolicy: NewPackagePolicy = { + ...defaultCurrentPolicy, + inputs: [ + { + ...defaultNewPolicy.inputs[0], + enabled: false, + }, + { + ...defaultNewPolicy.inputs[1], + enabled: true, + streams: [ + { + ...defaultNewPolicy.inputs[1].streams[0], + vars: { + ...Object.keys(tcpVars || []).reduce< + Record + >((acc, key) => { + acc[key] = { + value: undefined, + type: `${tcpVars?.[key].type}`, + }; + return acc; + }, {}), + [ConfigKeys.MONITOR_TYPE]: { + value: DataStream.TCP, + type: 'text', + }, + }, + }, + ], + }, + defaultCurrentPolicy.inputs[2], + ], + }; + const { getByText, getByLabelText, queryByLabelText } = render( + + ); + const url = getByLabelText('Host:Port') as HTMLInputElement; + const proxyUrl = getByLabelText('Proxy URL') as HTMLInputElement; + const monitorIntervalNumber = getByLabelText('Number') as HTMLInputElement; + const monitorIntervalUnit = getByLabelText('Unit') as HTMLInputElement; + const apmServiceName = getByLabelText('APM service name') as HTMLInputElement; + const timeout = getByLabelText('Timeout in seconds') as HTMLInputElement; + expect(url).toBeInTheDocument(); + expect(url.value).toEqual(defaultConfig[ConfigKeys.URLS]); + expect(proxyUrl).toBeInTheDocument(); + expect(proxyUrl.value).toEqual(defaultConfig[ConfigKeys.PROXY_URL]); + expect(monitorIntervalNumber).toBeInTheDocument(); + expect(monitorIntervalNumber.value).toEqual(defaultConfig[ConfigKeys.SCHEDULE].number); + expect(monitorIntervalUnit).toBeInTheDocument(); + expect(monitorIntervalUnit.value).toEqual(defaultConfig[ConfigKeys.SCHEDULE].unit); + expect(apmServiceName).toBeInTheDocument(); + expect(apmServiceName.value).toEqual(defaultConfig[ConfigKeys.APM_SERVICE_NAME]); + expect(timeout).toBeInTheDocument(); + expect(timeout.value).toEqual(`${defaultConfig[ConfigKeys.TIMEOUT]}`); + + // ensure other monitor type options are not in the DOM + expect(queryByLabelText('Url')).not.toBeInTheDocument(); + expect(queryByLabelText('Wait in seconds')).not.toBeInTheDocument(); + + // ensure at least one tcp advanced option is present + const advancedOptionsButton = getByText('Advanced TCP options'); + fireEvent.click(advancedOptionsButton); + await waitFor(() => { + expect(getByLabelText('Request payload')).toBeInTheDocument(); + }); + }); + + it('handles null values for icmp', async () => { + const tcpVars = defaultNewPolicy.inputs[1].streams[0].vars; + const currentPolicy: NewPackagePolicy = { + ...defaultCurrentPolicy, + inputs: [ + { + ...defaultNewPolicy.inputs[0], + enabled: false, + }, + { + ...defaultNewPolicy.inputs[1], + enabled: false, + }, + { + ...defaultNewPolicy.inputs[2], + enabled: true, + streams: [ + { + ...defaultNewPolicy.inputs[2].streams[0], + vars: { + ...Object.keys(tcpVars || []).reduce< + Record + >((acc, key) => { + acc[key] = { + value: undefined, + type: `${tcpVars?.[key].type}`, + }; + return acc; + }, {}), + [ConfigKeys.MONITOR_TYPE]: { + value: DataStream.ICMP, + type: 'text', + }, + }, + }, + ], + }, + ], + }; + const { getByLabelText, queryByLabelText } = render( + + ); + const url = getByLabelText('Host') as HTMLInputElement; + const monitorIntervalNumber = getByLabelText('Number') as HTMLInputElement; + const monitorIntervalUnit = getByLabelText('Unit') as HTMLInputElement; + const apmServiceName = getByLabelText('APM service name') as HTMLInputElement; + const timeout = getByLabelText('Timeout in seconds') as HTMLInputElement; + const wait = getByLabelText('Wait in seconds') as HTMLInputElement; + expect(url).toBeInTheDocument(); + expect(url.value).toEqual(defaultConfig[ConfigKeys.URLS]); + expect(monitorIntervalNumber).toBeInTheDocument(); + expect(monitorIntervalNumber.value).toEqual(defaultConfig[ConfigKeys.SCHEDULE].number); + expect(monitorIntervalUnit).toBeInTheDocument(); + expect(monitorIntervalUnit.value).toEqual(defaultConfig[ConfigKeys.SCHEDULE].unit); + expect(apmServiceName).toBeInTheDocument(); + expect(apmServiceName.value).toEqual(defaultConfig[ConfigKeys.APM_SERVICE_NAME]); + expect(timeout).toBeInTheDocument(); + expect(timeout.value).toEqual(`${defaultConfig[ConfigKeys.TIMEOUT]}`); + expect(wait).toBeInTheDocument(); + expect(wait.value).toEqual(`${defaultConfig[ConfigKeys.WAIT]}`); + + // ensure other monitor type options are not in the DOM + expect(queryByLabelText('Url')).not.toBeInTheDocument(); + expect(queryByLabelText('Proxy URL')).not.toBeInTheDocument(); + }); +}); diff --git a/x-pack/plugins/uptime/public/components/fleet_package/synthetics_policy_edit_extension_wrapper.tsx b/x-pack/plugins/uptime/public/components/fleet_package/synthetics_policy_edit_extension_wrapper.tsx new file mode 100644 index 0000000000000..85b38e05fdbc8 --- /dev/null +++ b/x-pack/plugins/uptime/public/components/fleet_package/synthetics_policy_edit_extension_wrapper.tsx @@ -0,0 +1,197 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import React, { memo, useMemo } from 'react'; +import { PackagePolicyEditExtensionComponentProps } from '../../../../fleet/public'; +import { Config, ConfigKeys, ContentType, contentTypesToMode } from './types'; +import { SyntheticsPolicyEditExtension } from './synthetics_policy_edit_extension'; +import { + SimpleFieldsContextProvider, + HTTPAdvancedFieldsContextProvider, + TCPAdvancedFieldsContextProvider, + TLSFieldsContextProvider, + defaultSimpleFields, + defaultHTTPAdvancedFields, + defaultTCPAdvancedFields, + defaultTLSFields, +} from './contexts'; + +/** + * Exports Synthetics-specific package policy instructions + * for use in the Ingest app create / edit package policy + */ +export const SyntheticsPolicyEditExtensionWrapper = memo( + ({ policy: currentPolicy, newPolicy, onChange }) => { + const { enableTLS: isTLSEnabled, config: defaultConfig } = useMemo(() => { + const fallbackConfig: Config = { + name: '', + ...defaultSimpleFields, + ...defaultHTTPAdvancedFields, + ...defaultTCPAdvancedFields, + ...defaultTLSFields, + }; + let enableTLS = false; + const getDefaultConfig = () => { + const currentInput = currentPolicy.inputs.find((input) => input.enabled === true); + const vars = currentInput?.streams[0]?.vars; + + const configKeys: ConfigKeys[] = Object.values(ConfigKeys); + const formattedDefaultConfig = configKeys.reduce( + (acc: Record, key: ConfigKeys) => { + const value = vars?.[key]?.value; + switch (key) { + case ConfigKeys.NAME: + acc[key] = currentPolicy.name; + break; + case ConfigKeys.SCHEDULE: + // split unit and number + if (value) { + const fullString = JSON.parse(value); + const fullSchedule = fullString.replace('@every ', ''); + const unit = fullSchedule.slice(-1); + const number = fullSchedule.slice(0, fullSchedule.length - 1); + acc[key] = { + unit, + number, + }; + } else { + acc[key] = fallbackConfig[key]; + } + break; + case ConfigKeys.TIMEOUT: + case ConfigKeys.WAIT: + acc[key] = value ? value.slice(0, value.length - 1) : fallbackConfig[key]; // remove unit + break; + case ConfigKeys.TAGS: + case ConfigKeys.RESPONSE_BODY_CHECK_NEGATIVE: + case ConfigKeys.RESPONSE_BODY_CHECK_POSITIVE: + case ConfigKeys.RESPONSE_STATUS_CHECK: + case ConfigKeys.RESPONSE_HEADERS_CHECK: + case ConfigKeys.REQUEST_HEADERS_CHECK: + acc[key] = value ? JSON.parse(value) : fallbackConfig[key]; + break; + case ConfigKeys.REQUEST_BODY_CHECK: + const headers = value + ? JSON.parse(vars?.[ConfigKeys.REQUEST_HEADERS_CHECK].value) + : fallbackConfig[ConfigKeys.REQUEST_HEADERS_CHECK]; + const requestBodyValue = + value !== null && value !== undefined + ? JSON.parse(value) + : fallbackConfig[key].value; + let type = fallbackConfig[key].type; + Object.keys(headers || []).some((headerKey) => { + if ( + headerKey === 'Content-Type' && + contentTypesToMode[headers[headerKey] as ContentType] + ) { + type = contentTypesToMode[headers[headerKey] as ContentType]; + return true; + } + }); + acc[key] = { + value: requestBodyValue, + type, + }; + break; + case ConfigKeys.TLS_KEY_PASSPHRASE: + case ConfigKeys.TLS_VERIFICATION_MODE: + acc[key] = { + value: value ?? fallbackConfig[key].value, + isEnabled: !!value, + }; + if (!!value) { + enableTLS = true; + } + break; + case ConfigKeys.TLS_CERTIFICATE: + case ConfigKeys.TLS_CERTIFICATE_AUTHORITIES: + case ConfigKeys.TLS_KEY: + case ConfigKeys.TLS_VERSION: + acc[key] = { + value: value ? JSON.parse(value) : fallbackConfig[key].value, + isEnabled: !!value, + }; + if (!!value) { + enableTLS = true; + } + break; + default: + acc[key] = value ?? fallbackConfig[key]; + } + return acc; + }, + {} + ); + + return { config: (formattedDefaultConfig as unknown) as Config, enableTLS }; + }; + + return getDefaultConfig(); + }, [currentPolicy]); + + const simpleFields = { + [ConfigKeys.APM_SERVICE_NAME]: defaultConfig[ConfigKeys.APM_SERVICE_NAME], + [ConfigKeys.HOSTS]: defaultConfig[ConfigKeys.HOSTS], + [ConfigKeys.MAX_REDIRECTS]: defaultConfig[ConfigKeys.MAX_REDIRECTS], + [ConfigKeys.MONITOR_TYPE]: defaultConfig[ConfigKeys.MONITOR_TYPE], + [ConfigKeys.SCHEDULE]: defaultConfig[ConfigKeys.SCHEDULE], + [ConfigKeys.TAGS]: defaultConfig[ConfigKeys.TAGS], + [ConfigKeys.TIMEOUT]: defaultConfig[ConfigKeys.TIMEOUT], + [ConfigKeys.URLS]: defaultConfig[ConfigKeys.URLS], + [ConfigKeys.WAIT]: defaultConfig[ConfigKeys.WAIT], + }; + const httpAdvancedFields = { + [ConfigKeys.USERNAME]: defaultConfig[ConfigKeys.USERNAME], + [ConfigKeys.PASSWORD]: defaultConfig[ConfigKeys.PASSWORD], + [ConfigKeys.PROXY_URL]: defaultConfig[ConfigKeys.PROXY_URL], + [ConfigKeys.RESPONSE_BODY_CHECK_NEGATIVE]: + defaultConfig[ConfigKeys.RESPONSE_BODY_CHECK_NEGATIVE], + [ConfigKeys.RESPONSE_BODY_CHECK_POSITIVE]: + defaultConfig[ConfigKeys.RESPONSE_BODY_CHECK_POSITIVE], + [ConfigKeys.RESPONSE_BODY_INDEX]: defaultConfig[ConfigKeys.RESPONSE_BODY_INDEX], + [ConfigKeys.RESPONSE_HEADERS_CHECK]: defaultConfig[ConfigKeys.RESPONSE_HEADERS_CHECK], + [ConfigKeys.RESPONSE_HEADERS_INDEX]: defaultConfig[ConfigKeys.RESPONSE_HEADERS_INDEX], + [ConfigKeys.RESPONSE_STATUS_CHECK]: defaultConfig[ConfigKeys.RESPONSE_STATUS_CHECK], + [ConfigKeys.REQUEST_BODY_CHECK]: defaultConfig[ConfigKeys.REQUEST_BODY_CHECK], + [ConfigKeys.REQUEST_HEADERS_CHECK]: defaultConfig[ConfigKeys.REQUEST_HEADERS_CHECK], + [ConfigKeys.REQUEST_METHOD_CHECK]: defaultConfig[ConfigKeys.REQUEST_METHOD_CHECK], + }; + const tcpAdvancedFields = { + [ConfigKeys.PROXY_URL]: defaultConfig[ConfigKeys.PROXY_URL], + [ConfigKeys.PROXY_USE_LOCAL_RESOLVER]: defaultConfig[ConfigKeys.PROXY_USE_LOCAL_RESOLVER], + [ConfigKeys.RESPONSE_RECEIVE_CHECK]: defaultConfig[ConfigKeys.RESPONSE_RECEIVE_CHECK], + [ConfigKeys.REQUEST_SEND_CHECK]: defaultConfig[ConfigKeys.REQUEST_SEND_CHECK], + }; + const tlsFields = { + [ConfigKeys.TLS_CERTIFICATE_AUTHORITIES]: + defaultConfig[ConfigKeys.TLS_CERTIFICATE_AUTHORITIES], + [ConfigKeys.TLS_CERTIFICATE]: defaultConfig[ConfigKeys.TLS_CERTIFICATE], + [ConfigKeys.TLS_KEY]: defaultConfig[ConfigKeys.TLS_KEY], + [ConfigKeys.TLS_KEY_PASSPHRASE]: defaultConfig[ConfigKeys.TLS_KEY_PASSPHRASE], + [ConfigKeys.TLS_VERIFICATION_MODE]: defaultConfig[ConfigKeys.TLS_VERIFICATION_MODE], + [ConfigKeys.TLS_VERSION]: defaultConfig[ConfigKeys.TLS_VERSION], + }; + + return ( + + + + + + + + + + ); + } +); +SyntheticsPolicyEditExtensionWrapper.displayName = 'SyntheticsPolicyEditExtensionWrapper'; diff --git a/x-pack/plugins/uptime/public/components/fleet_package/tcp_advanced_fields.test.tsx b/x-pack/plugins/uptime/public/components/fleet_package/tcp_advanced_fields.test.tsx new file mode 100644 index 0000000000000..77551f9aa8011 --- /dev/null +++ b/x-pack/plugins/uptime/public/components/fleet_package/tcp_advanced_fields.test.tsx @@ -0,0 +1,71 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import React from 'react'; +import { fireEvent } from '@testing-library/react'; +import { render } from '../../lib/helper/rtl_helpers'; +import { TCPAdvancedFields } from './tcp_advanced_fields'; +import { + TCPAdvancedFieldsContextProvider, + defaultTCPAdvancedFields as defaultConfig, +} from './contexts'; +import { ConfigKeys, ITCPAdvancedFields } from './types'; + +// ensures fields and labels map appropriately +jest.mock('@elastic/eui/lib/services/accessibility/html_id_generator', () => ({ + htmlIdGenerator: () => () => `id-${Math.random()}`, +})); + +describe('', () => { + const WrappedComponent = ({ + defaultValues = defaultConfig, + }: { + defaultValues?: ITCPAdvancedFields; + }) => { + return ( + + + + ); + }; + + it('renders TCPAdvancedFields', () => { + const { getByLabelText } = render(); + + const requestPayload = getByLabelText('Request payload') as HTMLInputElement; + const proxyURL = getByLabelText('Proxy URL') as HTMLInputElement; + // ComboBox has an issue with associating labels with the field + const responseContains = getByLabelText('Check response contains') as HTMLInputElement; + expect(requestPayload).toBeInTheDocument(); + expect(requestPayload.value).toEqual(defaultConfig[ConfigKeys.REQUEST_SEND_CHECK]); + expect(proxyURL).toBeInTheDocument(); + expect(proxyURL.value).toEqual(defaultConfig[ConfigKeys.PROXY_URL]); + expect(responseContains).toBeInTheDocument(); + expect(responseContains.value).toEqual(defaultConfig[ConfigKeys.RESPONSE_RECEIVE_CHECK]); + }); + + it('handles changing fields', () => { + const { getByLabelText } = render(); + + const requestPayload = getByLabelText('Request payload') as HTMLInputElement; + + fireEvent.change(requestPayload, { target: { value: 'success' } }); + expect(requestPayload.value).toEqual('success'); + }); + + it('shows resolve hostnames locally field when proxy url is filled for tcp monitors', () => { + const { getByLabelText, queryByLabelText } = render(); + + expect(queryByLabelText('Resolve hostnames locally')).not.toBeInTheDocument(); + + const proxyUrl = getByLabelText('Proxy URL') as HTMLInputElement; + + fireEvent.change(proxyUrl, { target: { value: 'sampleProxyUrl' } }); + + expect(getByLabelText('Resolve hostnames locally')).toBeInTheDocument(); + }); +}); diff --git a/x-pack/plugins/uptime/public/components/fleet_package/tcp_advanced_fields.tsx b/x-pack/plugins/uptime/public/components/fleet_package/tcp_advanced_fields.tsx new file mode 100644 index 0000000000000..d3936b8468664 --- /dev/null +++ b/x-pack/plugins/uptime/public/components/fleet_package/tcp_advanced_fields.tsx @@ -0,0 +1,174 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import React, { useCallback } from 'react'; +import { FormattedMessage } from '@kbn/i18n/react'; +import { + EuiAccordion, + EuiCheckbox, + EuiFormRow, + EuiDescribedFormGroup, + EuiFieldText, + EuiSpacer, +} from '@elastic/eui'; + +import { useTCPAdvancedFieldsContext } from './contexts'; + +import { ConfigKeys } from './types'; + +import { OptionalLabel } from './optional_label'; + +export const TCPAdvancedFields = () => { + const { fields, setFields } = useTCPAdvancedFieldsContext(); + + const handleInputChange = useCallback( + ({ value, configKey }: { value: unknown; configKey: ConfigKeys }) => { + setFields((prevFields) => ({ ...prevFields, [configKey]: value })); + }, + [setFields] + ); + + return ( + + + + + + } + description={ + + } + > + + + } + labelAppend={} + helpText={ + + } + > + + handleInputChange({ + value: event.target.value, + configKey: ConfigKeys.PROXY_URL, + }) + } + /> + + {!!fields[ConfigKeys.PROXY_URL] && ( + + + } + onChange={(event) => + handleInputChange({ + value: event.target.checked, + configKey: ConfigKeys.PROXY_USE_LOCAL_RESOLVER, + }) + } + /> + + )} + + } + labelAppend={} + helpText={ + + } + > + + handleInputChange({ + value: event.target.value, + configKey: ConfigKeys.REQUEST_SEND_CHECK, + }), + [handleInputChange] + )} + /> + + + + + + } + description={ + + } + > + + } + labelAppend={} + helpText={ + + } + > + + handleInputChange({ + value: event.target.value, + configKey: ConfigKeys.RESPONSE_RECEIVE_CHECK, + }), + [handleInputChange] + )} + /> + + + + ); +}; diff --git a/x-pack/plugins/uptime/public/components/fleet_package/tls_fields.test.tsx b/x-pack/plugins/uptime/public/components/fleet_package/tls_fields.test.tsx new file mode 100644 index 0000000000000..0528438650dc3 --- /dev/null +++ b/x-pack/plugins/uptime/public/components/fleet_package/tls_fields.test.tsx @@ -0,0 +1,112 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import React from 'react'; +import { fireEvent } from '@testing-library/react'; +import { render } from '../../lib/helper/rtl_helpers'; +import { TLSFields, TLSRole } from './tls_fields'; +import { ConfigKeys, VerificationMode } from './types'; +import { TLSFieldsContextProvider, defaultTLSFields as defaultValues } from './contexts'; + +// ensures that fields appropriately match to their label +jest.mock('@elastic/eui/lib/services/accessibility/html_id_generator', () => ({ + htmlIdGenerator: () => () => `id-${Math.random()}`, +})); + +describe('', () => { + const WrappedComponent = ({ + tlsRole = TLSRole.CLIENT, + isEnabled = true, + }: { + tlsRole?: TLSRole; + isEnabled?: boolean; + }) => { + return ( + + + + ); + }; + it('renders TLSFields', () => { + const { getByLabelText, getByText } = render(); + + expect(getByText('Certificate settings')).toBeInTheDocument(); + expect(getByText('Supported TLS protocols')).toBeInTheDocument(); + expect(getByLabelText('Client certificate')).toBeInTheDocument(); + expect(getByLabelText('Client key')).toBeInTheDocument(); + expect(getByLabelText('Certificate authorities')).toBeInTheDocument(); + expect(getByLabelText('Verification mode')).toBeInTheDocument(); + }); + + it('handles role', () => { + const { getByLabelText, rerender } = render(); + + expect(getByLabelText('Server certificate')).toBeInTheDocument(); + expect(getByLabelText('Server key')).toBeInTheDocument(); + + rerender(); + }); + + it('updates fields and calls onChange', async () => { + const { getByLabelText } = render(); + + const clientCertificate = getByLabelText('Client certificate') as HTMLInputElement; + const clientKey = getByLabelText('Client key') as HTMLInputElement; + const clientKeyPassphrase = getByLabelText('Client key passphrase') as HTMLInputElement; + const certificateAuthorities = getByLabelText('Certificate authorities') as HTMLInputElement; + const verificationMode = getByLabelText('Verification mode') as HTMLInputElement; + + const newValues = { + [ConfigKeys.TLS_CERTIFICATE]: 'sampleClientCertificate', + [ConfigKeys.TLS_KEY]: 'sampleClientKey', + [ConfigKeys.TLS_KEY_PASSPHRASE]: 'sampleClientKeyPassphrase', + [ConfigKeys.TLS_CERTIFICATE_AUTHORITIES]: 'sampleCertificateAuthorities', + [ConfigKeys.TLS_VERIFICATION_MODE]: VerificationMode.NONE, + }; + + fireEvent.change(clientCertificate, { + target: { value: newValues[ConfigKeys.TLS_CERTIFICATE] }, + }); + fireEvent.change(clientKey, { target: { value: newValues[ConfigKeys.TLS_KEY] } }); + fireEvent.change(clientKeyPassphrase, { + target: { value: newValues[ConfigKeys.TLS_KEY_PASSPHRASE] }, + }); + fireEvent.change(certificateAuthorities, { + target: { value: newValues[ConfigKeys.TLS_CERTIFICATE_AUTHORITIES] }, + }); + fireEvent.change(verificationMode, { + target: { value: newValues[ConfigKeys.TLS_VERIFICATION_MODE] }, + }); + + expect(clientCertificate.value).toEqual(newValues[ConfigKeys.TLS_CERTIFICATE]); + expect(clientKey.value).toEqual(newValues[ConfigKeys.TLS_KEY]); + expect(certificateAuthorities.value).toEqual(newValues[ConfigKeys.TLS_CERTIFICATE_AUTHORITIES]); + expect(verificationMode.value).toEqual(newValues[ConfigKeys.TLS_VERIFICATION_MODE]); + }); + + it('shows warning when verification mode is set to none', () => { + const { getByLabelText, getByText } = render(); + + const verificationMode = getByLabelText('Verification mode') as HTMLInputElement; + + fireEvent.change(verificationMode, { + target: { value: VerificationMode.NONE }, + }); + + expect(getByText('Disabling TLS')).toBeInTheDocument(); + }); + + it('does not show fields when isEnabled is false', async () => { + const { queryByLabelText } = render(); + + expect(queryByLabelText('Client certificate')).not.toBeInTheDocument(); + expect(queryByLabelText('Client key')).not.toBeInTheDocument(); + expect(queryByLabelText('Client key passphrase')).not.toBeInTheDocument(); + expect(queryByLabelText('Certificate authorities')).not.toBeInTheDocument(); + expect(queryByLabelText('verification mode')).not.toBeInTheDocument(); + }); +}); diff --git a/x-pack/plugins/uptime/public/components/fleet_package/tls_fields.tsx b/x-pack/plugins/uptime/public/components/fleet_package/tls_fields.tsx new file mode 100644 index 0000000000000..e01d3d59175a4 --- /dev/null +++ b/x-pack/plugins/uptime/public/components/fleet_package/tls_fields.tsx @@ -0,0 +1,439 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import React, { useEffect, useState, memo } from 'react'; +import { i18n } from '@kbn/i18n'; +import { FormattedMessage } from '@kbn/i18n/react'; +import { + EuiCallOut, + EuiComboBox, + EuiComboBoxOptionOption, + EuiFormRow, + EuiFieldText, + EuiTextArea, + EuiFormFieldset, + EuiSelect, + EuiScreenReaderOnly, + EuiSpacer, +} from '@elastic/eui'; + +import { useTLSFieldsContext } from './contexts'; + +import { VerificationMode, ConfigKeys, TLSVersion } from './types'; + +import { OptionalLabel } from './optional_label'; + +export enum TLSRole { + CLIENT = 'client', + SERVER = 'server', +} + +export const TLSFields: React.FunctionComponent<{ + isEnabled: boolean; + tlsRole: TLSRole; +}> = memo(({ isEnabled, tlsRole }) => { + const { fields, setFields } = useTLSFieldsContext(); + const [ + verificationVersionInputRef, + setVerificationVersionInputRef, + ] = useState(null); + const [hasVerificationVersionError, setHasVerificationVersionError] = useState< + string | undefined + >(undefined); + + useEffect(() => { + setFields((prevFields) => ({ + [ConfigKeys.TLS_CERTIFICATE_AUTHORITIES]: { + value: prevFields[ConfigKeys.TLS_CERTIFICATE_AUTHORITIES].value, + isEnabled, + }, + [ConfigKeys.TLS_CERTIFICATE]: { + value: prevFields[ConfigKeys.TLS_CERTIFICATE].value, + isEnabled, + }, + [ConfigKeys.TLS_KEY]: { + value: prevFields[ConfigKeys.TLS_KEY].value, + isEnabled, + }, + [ConfigKeys.TLS_KEY_PASSPHRASE]: { + value: prevFields[ConfigKeys.TLS_KEY_PASSPHRASE].value, + isEnabled, + }, + [ConfigKeys.TLS_VERIFICATION_MODE]: { + value: prevFields[ConfigKeys.TLS_VERIFICATION_MODE].value, + isEnabled, + }, + [ConfigKeys.TLS_VERSION]: { + value: prevFields[ConfigKeys.TLS_VERSION].value, + isEnabled, + }, + })); + }, [isEnabled, setFields]); + + const onVerificationVersionChange = ( + selectedVersionOptions: Array> + ) => { + setFields((prevFields) => ({ + ...prevFields, + [ConfigKeys.TLS_VERSION]: { + value: selectedVersionOptions.map((option) => option.label as TLSVersion), + isEnabled: true, + }, + })); + setHasVerificationVersionError(undefined); + }; + + const onSearchChange = (value: string, hasMatchingOptions?: boolean) => { + setHasVerificationVersionError( + value.length === 0 || hasMatchingOptions ? undefined : `"${value}" is not a valid option` + ); + }; + + const onBlur = () => { + if (verificationVersionInputRef) { + const { value } = verificationVersionInputRef; + setHasVerificationVersionError( + value.length === 0 ? undefined : `"${value}" is not a valid option` + ); + } + }; + + return isEnabled ? ( + + + + + + ), + }} + > + + } + helpText={verificationModeHelpText[fields[ConfigKeys.TLS_VERIFICATION_MODE].value]} + > + { + const value = event.target.value as VerificationMode; + setFields((prevFields) => ({ + ...prevFields, + [ConfigKeys.TLS_VERIFICATION_MODE]: { + value, + isEnabled: true, + }, + })); + }} + /> + + {fields[ConfigKeys.TLS_VERIFICATION_MODE].value === VerificationMode.NONE && ( + <> + + + } + color="warning" + size="s" + > +

    + +

    +
    + + + )} + + } + error={hasVerificationVersionError} + isInvalid={hasVerificationVersionError !== undefined} + > + ({ + label: version, + }))} + inputRef={setVerificationVersionInputRef} + onChange={onVerificationVersionChange} + onSearchChange={onSearchChange} + onBlur={onBlur} + /> + + + } + helpText={ + + } + labelAppend={} + > + { + const value = event.target.value; + setFields((prevFields) => ({ + ...prevFields, + [ConfigKeys.TLS_CERTIFICATE_AUTHORITIES]: { + value, + isEnabled: true, + }, + })); + }} + onBlur={(event) => { + const value = event.target.value; + setFields((prevFields) => ({ + ...prevFields, + [ConfigKeys.TLS_CERTIFICATE_AUTHORITIES]: { + value: value.trim(), + isEnabled: true, + }, + })); + }} + /> + + + {tlsRoleLabels[tlsRole]}{' '} + + + } + helpText={ + + } + labelAppend={} + > + { + const value = event.target.value; + setFields((prevFields) => ({ + ...prevFields, + [ConfigKeys.TLS_CERTIFICATE]: { + value, + isEnabled: true, + }, + })); + }} + onBlur={(event) => { + const value = event.target.value; + setFields((prevFields) => ({ + ...prevFields, + [ConfigKeys.TLS_CERTIFICATE]: { + value: value.trim(), + isEnabled: true, + }, + })); + }} + /> + + + {tlsRoleLabels[tlsRole]}{' '} + + + } + helpText={ + + } + labelAppend={} + > + { + const value = event.target.value; + setFields((prevFields) => ({ + ...prevFields, + [ConfigKeys.TLS_KEY]: { + value, + isEnabled: true, + }, + })); + }} + onBlur={(event) => { + const value = event.target.value; + setFields((prevFields) => ({ + ...prevFields, + [ConfigKeys.TLS_KEY]: { + value: value.trim(), + isEnabled: true, + }, + })); + }} + /> + + + {tlsRoleLabels[tlsRole]}{' '} + + + } + helpText={ + + } + labelAppend={} + > + { + const value = event.target.value; + setFields((prevFields) => ({ + ...prevFields, + [ConfigKeys.TLS_KEY_PASSPHRASE]: { + value, + isEnabled: true, + }, + })); + }} + /> + +
    + ) : null; +}); + +const tlsRoleLabels = { + [TLSRole.CLIENT]: ( + + ), + [TLSRole.SERVER]: ( + + ), +}; + +const verificationModeHelpText = { + [VerificationMode.CERTIFICATE]: i18n.translate( + 'xpack.uptime.createPackagePolicy.stepConfigure.certsField.verificationMode.certificate.description', + { + defaultMessage: + 'Verifies that the provided certificate is signed by a trusted authority (CA), but does not perform any hostname verification.', + } + ), + [VerificationMode.FULL]: i18n.translate( + 'xpack.uptime.createPackagePolicy.stepConfigure.certsField.verificationMode.full.description', + { + defaultMessage: + 'Verifies that the provided certificate is signed by a trusted authority (CA) and also verifies that the server’s hostname (or IP address) matches the names identified within the certificate.', + } + ), + [VerificationMode.NONE]: i18n.translate( + 'xpack.uptime.createPackagePolicy.stepConfigure.certsField.verificationMode.none.description', + { + defaultMessage: + 'Performs no verification of the server’s certificate. It is primarily intended as a temporary diagnostic mechanism when attempting to resolve TLS errors; its use in production environments is strongly discouraged.', + } + ), + [VerificationMode.STRICT]: i18n.translate( + 'xpack.uptime.createPackagePolicy.stepConfigure.certsField.verificationMode.strict.description', + { + defaultMessage: + 'Verifies that the provided certificate is signed by a trusted authority (CA) and also verifies that the server’s hostname (or IP address) matches the names identified within the certificate. If the Subject Alternative Name is empty, it returns an error.', + } + ), +}; + +const verificationModeLabels = { + [VerificationMode.CERTIFICATE]: i18n.translate( + 'xpack.uptime.createPackagePolicy.stepConfigure.certsField.verificationMode.certificate.label', + { + defaultMessage: 'Certificate', + } + ), + [VerificationMode.FULL]: i18n.translate( + 'xpack.uptime.createPackagePolicy.stepConfigure.certsField.verificationMode.full.label', + { + defaultMessage: 'Full', + } + ), + [VerificationMode.NONE]: i18n.translate( + 'xpack.uptime.createPackagePolicy.stepConfigure.certsField.verificationMode.none.label', + { + defaultMessage: 'None', + } + ), + [VerificationMode.STRICT]: i18n.translate( + 'xpack.uptime.createPackagePolicy.stepConfigure.certsField.verificationMode.strict.label', + { + defaultMessage: 'Strict', + } + ), +}; + +const verificationModeOptions = [ + { + value: VerificationMode.CERTIFICATE, + text: verificationModeLabels[VerificationMode.CERTIFICATE], + }, + { value: VerificationMode.FULL, text: verificationModeLabels[VerificationMode.FULL] }, + { value: VerificationMode.NONE, text: verificationModeLabels[VerificationMode.NONE] }, + { value: VerificationMode.STRICT, text: verificationModeLabels[VerificationMode.STRICT] }, +]; + +const tlsVersionOptions = Object.values(TLSVersion).map((method) => ({ + label: method, +})); diff --git a/x-pack/plugins/uptime/public/components/fleet_package/types.tsx b/x-pack/plugins/uptime/public/components/fleet_package/types.tsx new file mode 100644 index 0000000000000..802d5f08fd646 --- /dev/null +++ b/x-pack/plugins/uptime/public/components/fleet_package/types.tsx @@ -0,0 +1,170 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +export enum DataStream { + HTTP = 'http', + TCP = 'tcp', + ICMP = 'icmp', +} + +export enum HTTPMethod { + GET = 'GET', + POST = 'POST', + PUT = 'PUT', + DELETE = 'DELETE', + HEAD = 'HEAD', +} + +export enum ResponseBodyIndexPolicy { + ALWAYS = 'always', + NEVER = 'never', + ON_ERROR = 'on_error', +} + +export enum Mode { + FORM = 'form', + JSON = 'json', + TEXT = 'text', + XML = 'xml', +} + +export enum ContentType { + JSON = 'application/json', + TEXT = 'text/plain', + XML = 'application/xml', + FORM = 'application/x-www-form-urlencoded', +} + +export enum ScheduleUnit { + MINUTES = 'm', + SECONDS = 's', +} + +export enum VerificationMode { + CERTIFICATE = 'certificate', + FULL = 'full', + NONE = 'none', + STRICT = 'strict', +} + +export enum TLSVersion { + ONE_ZERO = 'TLSv1.0', + ONE_ONE = 'TLSv1.1', + ONE_TWO = 'TLSv1.2', + ONE_THREE = 'TLSv1.3', +} + +// values must match keys in the integration package +export enum ConfigKeys { + APM_SERVICE_NAME = 'service.name', + HOSTS = 'hosts', + MAX_REDIRECTS = 'max_redirects', + MONITOR_TYPE = 'type', + NAME = 'name', + PASSWORD = 'password', + PROXY_URL = 'proxy_url', + PROXY_USE_LOCAL_RESOLVER = 'proxy_use_local_resolver', + RESPONSE_BODY_CHECK_NEGATIVE = 'check.response.body.negative', + RESPONSE_BODY_CHECK_POSITIVE = 'check.response.body.positive', + RESPONSE_BODY_INDEX = 'response.include_body', + RESPONSE_HEADERS_CHECK = 'check.response.headers', + RESPONSE_HEADERS_INDEX = 'response.include_headers', + RESPONSE_RECEIVE_CHECK = 'check.receive', + RESPONSE_STATUS_CHECK = 'check.response.status', + REQUEST_BODY_CHECK = 'check.request.body', + REQUEST_HEADERS_CHECK = 'check.request.headers', + REQUEST_METHOD_CHECK = 'check.request.method', + REQUEST_SEND_CHECK = 'check.send', + SCHEDULE = 'schedule', + TLS_CERTIFICATE_AUTHORITIES = 'ssl.certificate_authorities', + TLS_CERTIFICATE = 'ssl.certificate', + TLS_KEY = 'ssl.key', + TLS_KEY_PASSPHRASE = 'ssl.key_passphrase', + TLS_VERIFICATION_MODE = 'ssl.verification_mode', + TLS_VERSION = 'ssl.supported_protocols', + TAGS = 'tags', + TIMEOUT = 'timeout', + URLS = 'urls', + USERNAME = 'username', + WAIT = 'wait', +} + +export interface ISimpleFields { + [ConfigKeys.HOSTS]: string; + [ConfigKeys.MAX_REDIRECTS]: string; + [ConfigKeys.MONITOR_TYPE]: DataStream; + [ConfigKeys.SCHEDULE]: { number: string; unit: ScheduleUnit }; + [ConfigKeys.APM_SERVICE_NAME]: string; + [ConfigKeys.TIMEOUT]: string; + [ConfigKeys.URLS]: string; + [ConfigKeys.TAGS]: string[]; + [ConfigKeys.WAIT]: string; +} + +export interface ITLSFields { + [ConfigKeys.TLS_CERTIFICATE_AUTHORITIES]: { + value: string; + isEnabled: boolean; + }; + [ConfigKeys.TLS_CERTIFICATE]: { + value: string; + isEnabled: boolean; + }; + [ConfigKeys.TLS_KEY]: { + value: string; + isEnabled: boolean; + }; + [ConfigKeys.TLS_KEY_PASSPHRASE]: { + value: string; + isEnabled: boolean; + }; + [ConfigKeys.TLS_VERIFICATION_MODE]: { + value: VerificationMode; + isEnabled: boolean; + }; + [ConfigKeys.TLS_VERSION]: { + value: TLSVersion[]; + isEnabled: boolean; + }; +} + +export interface IHTTPAdvancedFields { + [ConfigKeys.PASSWORD]: string; + [ConfigKeys.PROXY_URL]: string; + [ConfigKeys.RESPONSE_BODY_CHECK_NEGATIVE]: string[]; + [ConfigKeys.RESPONSE_BODY_CHECK_POSITIVE]: string[]; + [ConfigKeys.RESPONSE_BODY_INDEX]: ResponseBodyIndexPolicy; + [ConfigKeys.RESPONSE_HEADERS_CHECK]: Record; + [ConfigKeys.RESPONSE_HEADERS_INDEX]: boolean; + [ConfigKeys.RESPONSE_STATUS_CHECK]: string[]; + [ConfigKeys.REQUEST_BODY_CHECK]: { value: string; type: Mode }; + [ConfigKeys.REQUEST_HEADERS_CHECK]: Record; + [ConfigKeys.REQUEST_METHOD_CHECK]: string; + [ConfigKeys.USERNAME]: string; +} + +export interface ITCPAdvancedFields { + [ConfigKeys.PROXY_URL]: string; + [ConfigKeys.PROXY_USE_LOCAL_RESOLVER]: boolean; + [ConfigKeys.RESPONSE_RECEIVE_CHECK]: string; + [ConfigKeys.REQUEST_SEND_CHECK]: string; +} + +export type ICustomFields = ISimpleFields & ITLSFields & IHTTPAdvancedFields & ITCPAdvancedFields; + +export type Config = { + [ConfigKeys.NAME]: string; +} & ICustomFields; + +export type Validation = Partial void>>; + +export const contentTypesToMode = { + [ContentType.FORM]: Mode.FORM, + [ContentType.JSON]: Mode.JSON, + [ContentType.TEXT]: Mode.TEXT, + [ContentType.XML]: Mode.XML, +}; diff --git a/x-pack/plugins/uptime/public/components/fleet_package/use_update_policy.test.tsx b/x-pack/plugins/uptime/public/components/fleet_package/use_update_policy.test.tsx new file mode 100644 index 0000000000000..3732791f895dc --- /dev/null +++ b/x-pack/plugins/uptime/public/components/fleet_package/use_update_policy.test.tsx @@ -0,0 +1,530 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import { useUpdatePolicy } from './use_update_policy'; +import { act, renderHook } from '@testing-library/react-hooks'; +import { NewPackagePolicy } from '../../../../fleet/public'; +import { validate } from './validation'; +import { ConfigKeys, DataStream, TLSVersion } from './types'; +import { + defaultSimpleFields, + defaultTLSFields, + defaultHTTPAdvancedFields, + defaultTCPAdvancedFields, +} from './contexts'; + +const defaultConfig = { + name: '', + ...defaultSimpleFields, + ...defaultTLSFields, + ...defaultHTTPAdvancedFields, + ...defaultTCPAdvancedFields, +}; + +describe('useBarChartsHooks', () => { + const newPolicy: NewPackagePolicy = { + name: '', + description: '', + namespace: 'default', + policy_id: 'ae774160-8e49-11eb-aba5-99269d21ba6e', + enabled: true, + output_id: '', + inputs: [ + { + type: 'synthetics/http', + enabled: true, + streams: [ + { + enabled: true, + data_stream: { + type: 'synthetics', + dataset: 'http', + }, + vars: { + type: { + value: 'http', + type: 'text', + }, + name: { + value: '', + type: 'text', + }, + schedule: { + value: '"@every 3m"', + type: 'text', + }, + urls: { + value: '', + type: 'text', + }, + 'service.name': { + value: '', + type: 'text', + }, + timeout: { + value: '16s', + type: 'text', + }, + max_redirects: { + value: 0, + type: 'integer', + }, + proxy_url: { + value: '', + type: 'text', + }, + tags: { + value: '[]', + type: 'yaml', + }, + 'response.include_headers': { + value: true, + type: 'bool', + }, + 'response.include_body': { + value: 'on_error', + type: 'text', + }, + 'check.request.method': { + value: 'GET', + type: 'text', + }, + 'check.request.headers': { + value: '{}', + type: 'yaml', + }, + 'check.request.body': { + value: '""', + type: 'yaml', + }, + 'check.response.status': { + value: '[]', + type: 'yaml', + }, + 'check.response.headers': { + value: '{}', + type: 'yaml', + }, + 'check.response.body.positive': { + value: null, + type: 'yaml', + }, + 'check.response.body.negative': { + value: null, + type: 'yaml', + }, + 'ssl.certificate_authorities': { + value: '', + type: 'yaml', + }, + 'ssl.certificate': { + value: '', + type: 'yaml', + }, + 'ssl.key': { + value: '', + type: 'yaml', + }, + 'ssl.key_passphrase': { + type: 'text', + }, + 'ssl.verification_mode': { + value: 'full', + type: 'text', + }, + 'ssl.supported_protocols': { + value: '', + type: 'yaml', + }, + }, + }, + ], + }, + { + type: 'synthetics/tcp', + enabled: false, + streams: [ + { + enabled: false, + data_stream: { + type: 'synthetics', + dataset: 'tcp', + }, + vars: { + type: { + value: 'tcp', + type: 'text', + }, + name: { + type: 'text', + }, + schedule: { + value: '10s', + type: 'text', + }, + hosts: { + type: 'text', + }, + 'service.name': { + type: 'text', + }, + timeout: { + type: 'integer', + }, + max_redirects: { + type: 'integer', + }, + proxy_url: { + type: 'text', + }, + proxy_use_local_resolver: { + value: false, + type: 'bool', + }, + tags: { + type: 'yaml', + }, + 'check.send': { + type: 'text', + }, + 'check.receive': { + type: 'yaml', + }, + 'ssl.certificate_authorities': { + type: 'yaml', + }, + 'ssl.certificate': { + type: 'yaml', + }, + 'ssl.key': { + type: 'yaml', + }, + 'ssl.key_passphrase': { + type: 'text', + }, + 'ssl.verification_mode': { + type: 'text', + }, + }, + }, + ], + }, + { + type: 'synthetics/icmp', + enabled: false, + streams: [ + { + enabled: false, + data_stream: { + type: 'synthetics', + dataset: 'icmp', + }, + vars: { + type: { + value: 'icmp', + type: 'text', + }, + name: { + type: 'text', + }, + schedule: { + value: '10s', + type: 'text', + }, + wait: { + value: '1s', + type: 'text', + }, + hosts: { + type: 'text', + }, + 'service.name': { + type: 'text', + }, + timeout: { + type: 'integer', + }, + max_redirects: { + type: 'integer', + }, + tags: { + type: 'yaml', + }, + }, + }, + ], + }, + ], + package: { + name: 'synthetics', + title: 'Elastic Synthetics', + version: '0.66.0', + }, + }; + + it('handles http data stream', () => { + const onChange = jest.fn(); + const { result } = renderHook((props) => useUpdatePolicy(props), { + initialProps: { defaultConfig, newPolicy, onChange, validate }, + }); + + expect(result.current.config).toMatchObject({ ...defaultConfig }); + + // expect only http to be enabled + expect(result.current.updatedPolicy.inputs[0].enabled).toBe(true); + expect(result.current.updatedPolicy.inputs[1].enabled).toBe(false); + expect(result.current.updatedPolicy.inputs[2].enabled).toBe(false); + + expect( + result.current.updatedPolicy.inputs[0]?.streams[0]?.vars?.[ConfigKeys.MONITOR_TYPE].value + ).toEqual(defaultConfig[ConfigKeys.MONITOR_TYPE]); + expect( + result.current.updatedPolicy.inputs[0]?.streams[0]?.vars?.[ConfigKeys.URLS].value + ).toEqual(defaultConfig[ConfigKeys.URLS]); + expect( + result.current.updatedPolicy.inputs[0]?.streams[0]?.vars?.[ConfigKeys.SCHEDULE].value + ).toEqual( + JSON.stringify( + `@every ${defaultConfig[ConfigKeys.SCHEDULE].number}${ + defaultConfig[ConfigKeys.SCHEDULE].unit + }` + ) + ); + expect( + result.current.updatedPolicy.inputs[0]?.streams[0]?.vars?.[ConfigKeys.PROXY_URL].value + ).toEqual(defaultConfig[ConfigKeys.PROXY_URL]); + expect( + result.current.updatedPolicy.inputs[0]?.streams[0]?.vars?.[ConfigKeys.APM_SERVICE_NAME].value + ).toEqual(defaultConfig[ConfigKeys.APM_SERVICE_NAME]); + expect( + result.current.updatedPolicy.inputs[0]?.streams[0]?.vars?.[ConfigKeys.TIMEOUT].value + ).toEqual(`${defaultConfig[ConfigKeys.TIMEOUT]}s`); + expect( + result.current.updatedPolicy.inputs[0]?.streams[0]?.vars?.[ + ConfigKeys.RESPONSE_BODY_CHECK_POSITIVE + ].value + ).toEqual(null); + expect( + result.current.updatedPolicy.inputs[0]?.streams[0]?.vars?.[ + ConfigKeys.RESPONSE_BODY_CHECK_NEGATIVE + ].value + ).toEqual(null); + expect( + result.current.updatedPolicy.inputs[0]?.streams[0]?.vars?.[ConfigKeys.RESPONSE_STATUS_CHECK] + .value + ).toEqual(JSON.stringify(defaultConfig[ConfigKeys.RESPONSE_STATUS_CHECK])); + expect( + result.current.updatedPolicy.inputs[0]?.streams[0]?.vars?.[ConfigKeys.REQUEST_HEADERS_CHECK] + .value + ).toEqual(JSON.stringify(defaultConfig[ConfigKeys.REQUEST_HEADERS_CHECK])); + expect( + result.current.updatedPolicy.inputs[0]?.streams[0]?.vars?.[ConfigKeys.RESPONSE_HEADERS_CHECK] + .value + ).toEqual(JSON.stringify(defaultConfig[ConfigKeys.RESPONSE_HEADERS_CHECK])); + expect( + result.current.updatedPolicy.inputs[0]?.streams[0]?.vars?.[ConfigKeys.RESPONSE_BODY_INDEX] + .value + ).toEqual(defaultConfig[ConfigKeys.RESPONSE_BODY_INDEX]); + expect( + result.current.updatedPolicy.inputs[0]?.streams[0]?.vars?.[ConfigKeys.RESPONSE_HEADERS_INDEX] + .value + ).toEqual(defaultConfig[ConfigKeys.RESPONSE_HEADERS_INDEX]); + }); + + it('stringifies array values and returns null for empty array values', () => { + const onChange = jest.fn(); + const { result } = renderHook((props) => useUpdatePolicy(props), { + initialProps: { defaultConfig, newPolicy, onChange, validate }, + }); + + act(() => { + result.current.setConfig({ + ...defaultConfig, + [ConfigKeys.RESPONSE_BODY_CHECK_POSITIVE]: ['test'], + [ConfigKeys.RESPONSE_BODY_CHECK_NEGATIVE]: ['test'], + [ConfigKeys.RESPONSE_STATUS_CHECK]: ['test'], + [ConfigKeys.TAGS]: ['test'], + [ConfigKeys.TLS_VERSION]: { + value: [TLSVersion.ONE_ONE], + isEnabled: true, + }, + }); + }); + + // expect only http to be enabled + expect(result.current.updatedPolicy.inputs[0].enabled).toBe(true); + expect(result.current.updatedPolicy.inputs[1].enabled).toBe(false); + expect(result.current.updatedPolicy.inputs[2].enabled).toBe(false); + + expect( + result.current.updatedPolicy.inputs[0]?.streams[0]?.vars?.[ + ConfigKeys.RESPONSE_BODY_CHECK_POSITIVE + ].value + ).toEqual('["test"]'); + expect( + result.current.updatedPolicy.inputs[0]?.streams[0]?.vars?.[ + ConfigKeys.RESPONSE_BODY_CHECK_NEGATIVE + ].value + ).toEqual('["test"]'); + expect( + result.current.updatedPolicy.inputs[0]?.streams[0]?.vars?.[ConfigKeys.RESPONSE_STATUS_CHECK] + .value + ).toEqual('["test"]'); + expect( + result.current.updatedPolicy.inputs[0]?.streams[0]?.vars?.[ConfigKeys.TAGS].value + ).toEqual('["test"]'); + expect( + result.current.updatedPolicy.inputs[0]?.streams[0]?.vars?.[ConfigKeys.TLS_VERSION].value + ).toEqual('["TLSv1.1"]'); + + act(() => { + result.current.setConfig({ + ...defaultConfig, + [ConfigKeys.RESPONSE_BODY_CHECK_POSITIVE]: [], + [ConfigKeys.RESPONSE_BODY_CHECK_NEGATIVE]: [], + [ConfigKeys.RESPONSE_STATUS_CHECK]: [], + [ConfigKeys.TAGS]: [], + [ConfigKeys.TLS_VERSION]: { + value: [], + isEnabled: true, + }, + }); + }); + + expect( + result.current.updatedPolicy.inputs[0]?.streams[0]?.vars?.[ + ConfigKeys.RESPONSE_BODY_CHECK_POSITIVE + ].value + ).toEqual(null); + expect( + result.current.updatedPolicy.inputs[0]?.streams[0]?.vars?.[ + ConfigKeys.RESPONSE_BODY_CHECK_NEGATIVE + ].value + ).toEqual(null); + expect( + result.current.updatedPolicy.inputs[0]?.streams[0]?.vars?.[ConfigKeys.RESPONSE_STATUS_CHECK] + .value + ).toEqual(null); + expect( + result.current.updatedPolicy.inputs[0]?.streams[0]?.vars?.[ConfigKeys.TAGS].value + ).toEqual(null); + expect( + result.current.updatedPolicy.inputs[0]?.streams[0]?.vars?.[ConfigKeys.TLS_VERSION].value + ).toEqual(null); + }); + + it('handles tcp data stream', () => { + const onChange = jest.fn(); + const tcpConfig = { + ...defaultConfig, + [ConfigKeys.MONITOR_TYPE]: DataStream.TCP, + }; + const { result } = renderHook((props) => useUpdatePolicy(props), { + initialProps: { defaultConfig, newPolicy, onChange, validate }, + }); + + act(() => { + result.current.setConfig(tcpConfig); + }); + + // expect only tcp to be enabled + expect(result.current.updatedPolicy.inputs[0].enabled).toBe(false); + expect(result.current.updatedPolicy.inputs[1].enabled).toBe(true); + expect(result.current.updatedPolicy.inputs[2].enabled).toBe(false); + + expect(onChange).toBeCalledWith({ + isValid: false, + updatedPolicy: result.current.updatedPolicy, + }); + + expect( + result.current.updatedPolicy.inputs[1]?.streams[0]?.vars?.[ConfigKeys.MONITOR_TYPE].value + ).toEqual(tcpConfig[ConfigKeys.MONITOR_TYPE]); + expect( + result.current.updatedPolicy.inputs[1]?.streams[0]?.vars?.[ConfigKeys.HOSTS].value + ).toEqual(defaultConfig[ConfigKeys.HOSTS]); + expect( + result.current.updatedPolicy.inputs[1]?.streams[0]?.vars?.[ConfigKeys.SCHEDULE].value + ).toEqual( + JSON.stringify( + `@every ${defaultConfig[ConfigKeys.SCHEDULE].number}${ + defaultConfig[ConfigKeys.SCHEDULE].unit + }` + ) + ); + expect( + result.current.updatedPolicy.inputs[1]?.streams[0]?.vars?.[ConfigKeys.PROXY_URL].value + ).toEqual(tcpConfig[ConfigKeys.PROXY_URL]); + expect( + result.current.updatedPolicy.inputs[0]?.streams[0]?.vars?.[ConfigKeys.APM_SERVICE_NAME].value + ).toEqual(tcpConfig[ConfigKeys.APM_SERVICE_NAME]); + expect( + result.current.updatedPolicy.inputs[1]?.streams[0]?.vars?.[ConfigKeys.TIMEOUT].value + ).toEqual(`${tcpConfig[ConfigKeys.TIMEOUT]}s`); + expect( + result.current.updatedPolicy.inputs[1]?.streams[0]?.vars?.[ + ConfigKeys.PROXY_USE_LOCAL_RESOLVER + ].value + ).toEqual(tcpConfig[ConfigKeys.PROXY_USE_LOCAL_RESOLVER]); + expect( + result.current.updatedPolicy.inputs[1]?.streams[0]?.vars?.[ConfigKeys.RESPONSE_RECEIVE_CHECK] + .value + ).toEqual(tcpConfig[ConfigKeys.RESPONSE_RECEIVE_CHECK]); + expect( + result.current.updatedPolicy.inputs[1]?.streams[0]?.vars?.[ConfigKeys.REQUEST_SEND_CHECK] + .value + ).toEqual(tcpConfig[ConfigKeys.REQUEST_SEND_CHECK]); + }); + + it('handles icmp data stream', () => { + const onChange = jest.fn(); + const icmpConfig = { + ...defaultConfig, + [ConfigKeys.MONITOR_TYPE]: DataStream.ICMP, + }; + const { result } = renderHook((props) => useUpdatePolicy(props), { + initialProps: { defaultConfig, newPolicy, onChange, validate }, + }); + + act(() => { + result.current.setConfig(icmpConfig); + }); + + // expect only icmp to be enabled + expect(result.current.updatedPolicy.inputs[0].enabled).toBe(false); + expect(result.current.updatedPolicy.inputs[1].enabled).toBe(false); + expect(result.current.updatedPolicy.inputs[2].enabled).toBe(true); + + expect(onChange).toBeCalledWith({ + isValid: false, + updatedPolicy: result.current.updatedPolicy, + }); + + expect( + result.current.updatedPolicy.inputs[2]?.streams[0]?.vars?.[ConfigKeys.MONITOR_TYPE].value + ).toEqual(icmpConfig[ConfigKeys.MONITOR_TYPE]); + expect( + result.current.updatedPolicy.inputs[2]?.streams[0]?.vars?.[ConfigKeys.HOSTS].value + ).toEqual(icmpConfig[ConfigKeys.HOSTS]); + expect( + result.current.updatedPolicy.inputs[2]?.streams[0]?.vars?.[ConfigKeys.SCHEDULE].value + ).toEqual( + JSON.stringify( + `@every ${icmpConfig[ConfigKeys.SCHEDULE].number}${icmpConfig[ConfigKeys.SCHEDULE].unit}` + ) + ); + expect( + result.current.updatedPolicy.inputs[0]?.streams[0]?.vars?.[ConfigKeys.APM_SERVICE_NAME].value + ).toEqual(defaultConfig[ConfigKeys.APM_SERVICE_NAME]); + expect( + result.current.updatedPolicy.inputs[2]?.streams[0]?.vars?.[ConfigKeys.TIMEOUT].value + ).toEqual(`${icmpConfig[ConfigKeys.TIMEOUT]}s`); + expect( + result.current.updatedPolicy.inputs[2]?.streams[0]?.vars?.[ConfigKeys.WAIT].value + ).toEqual(`${icmpConfig[ConfigKeys.WAIT]}s`); + }); +}); diff --git a/x-pack/plugins/uptime/public/components/fleet_package/use_update_policy.ts b/x-pack/plugins/uptime/public/components/fleet_package/use_update_policy.ts new file mode 100644 index 0000000000000..cb11e9f9c4a9b --- /dev/null +++ b/x-pack/plugins/uptime/public/components/fleet_package/use_update_policy.ts @@ -0,0 +1,119 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ +import { useEffect, useRef, useState } from 'react'; +import { NewPackagePolicy } from '../../../../fleet/public'; +import { ConfigKeys, Config, DataStream, Validation } from './types'; + +interface Props { + defaultConfig: Config; + newPolicy: NewPackagePolicy; + onChange: (opts: { + /** is current form state is valid */ + isValid: boolean; + /** The updated Integration Policy to be merged back and included in the API call */ + updatedPolicy: NewPackagePolicy; + }) => void; + validate: Record; +} + +export const useUpdatePolicy = ({ defaultConfig, newPolicy, onChange, validate }: Props) => { + const [updatedPolicy, setUpdatedPolicy] = useState(newPolicy); + // Update the integration policy with our custom fields + const [config, setConfig] = useState(defaultConfig); + const currentConfig = useRef(defaultConfig); + + useEffect(() => { + const { type } = config; + const configKeys = Object.keys(config) as ConfigKeys[]; + const validationKeys = Object.keys(validate[type]) as ConfigKeys[]; + const configDidUpdate = configKeys.some((key) => config[key] !== currentConfig.current[key]); + const isValid = + !!newPolicy.name && !validationKeys.find((key) => validate[type][key]?.(config[key])); + const formattedPolicy = { ...newPolicy }; + const currentInput = formattedPolicy.inputs.find( + (input) => input.type === `synthetics/${type}` + ); + const dataStream = currentInput?.streams[0]; + + // prevent an infinite loop of updating the policy + if (currentInput && dataStream && configDidUpdate) { + // reset all data streams to enabled false + formattedPolicy.inputs.forEach((input) => (input.enabled = false)); + // enable only the input type and data stream that matches the monitor type. + currentInput.enabled = true; + dataStream.enabled = true; + configKeys.forEach((key) => { + const configItem = dataStream.vars?.[key]; + if (configItem) { + switch (key) { + case ConfigKeys.SCHEDULE: + configItem.value = JSON.stringify(`@every ${config[key].number}${config[key].unit}`); // convert to cron + break; + case ConfigKeys.RESPONSE_BODY_CHECK_NEGATIVE: + case ConfigKeys.RESPONSE_BODY_CHECK_POSITIVE: + case ConfigKeys.RESPONSE_STATUS_CHECK: + case ConfigKeys.TAGS: + configItem.value = config[key].length ? JSON.stringify(config[key]) : null; + break; + case ConfigKeys.RESPONSE_HEADERS_CHECK: + case ConfigKeys.REQUEST_HEADERS_CHECK: + configItem.value = Object.keys(config[key]).length + ? JSON.stringify(config[key]) + : null; + break; + case ConfigKeys.TIMEOUT: + case ConfigKeys.WAIT: + configItem.value = config[key] ? `${config[key]}s` : null; // convert to cron + break; + case ConfigKeys.REQUEST_BODY_CHECK: + configItem.value = config[key].value ? JSON.stringify(config[key].value) : null; // only need value of REQUEST_BODY_CHECK for outputted policy + break; + case ConfigKeys.TLS_CERTIFICATE: + case ConfigKeys.TLS_CERTIFICATE_AUTHORITIES: + case ConfigKeys.TLS_KEY: + configItem.value = + config[key].isEnabled && config[key].value + ? JSON.stringify(config[key].value) + : null; // only add tls settings if they are enabled by the user + break; + case ConfigKeys.TLS_VERSION: + configItem.value = + config[key].isEnabled && config[key].value.length + ? JSON.stringify(config[key].value) + : null; // only add tls settings if they are enabled by the user + break; + case ConfigKeys.TLS_KEY_PASSPHRASE: + case ConfigKeys.TLS_VERIFICATION_MODE: + configItem.value = + config[key].isEnabled && config[key].value ? config[key].value : null; // only add tls settings if they are enabled by the user + break; + default: + configItem.value = + config[key] === undefined || config[key] === null ? null : config[key]; + } + } + }); + currentConfig.current = config; + setUpdatedPolicy(formattedPolicy); + onChange({ + isValid, + updatedPolicy: formattedPolicy, + }); + } + }, [config, currentConfig, newPolicy, onChange, validate]); + + // update our local config state ever time name, which is managed by fleet, changes + useEffect(() => { + setConfig((prevConfig) => ({ ...prevConfig, name: newPolicy.name })); + }, [newPolicy.name, setConfig]); + + return { + config, + setConfig, + updatedPolicy, + }; +}; diff --git a/x-pack/plugins/uptime/public/components/fleet_package/validation.tsx b/x-pack/plugins/uptime/public/components/fleet_package/validation.tsx new file mode 100644 index 0000000000000..5197cb9299e45 --- /dev/null +++ b/x-pack/plugins/uptime/public/components/fleet_package/validation.tsx @@ -0,0 +1,113 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ +import { ConfigKeys, DataStream, ICustomFields, Validation, ScheduleUnit } from './types'; + +export const digitsOnly = /^[0-9]*$/g; +export const includesValidPort = /[^\:]+:[0-9]{1,5}$/g; + +// returns true if invalid +function validateHeaders(headers: T): boolean { + return Object.keys(headers).some((key) => { + if (key) { + const whiteSpaceRegEx = /[\s]/g; + return whiteSpaceRegEx.test(key); + } else { + return false; + } + }); +} + +// returns true if invalid +function validateTimeout({ + scheduleNumber, + scheduleUnit, + timeout, +}: { + scheduleNumber: string; + scheduleUnit: ScheduleUnit; + timeout: string; +}): boolean { + let schedule: number; + switch (scheduleUnit) { + case ScheduleUnit.SECONDS: + schedule = parseFloat(scheduleNumber); + break; + case ScheduleUnit.MINUTES: + schedule = parseFloat(scheduleNumber) * 60; + break; + default: + schedule = parseFloat(scheduleNumber); + } + + return parseFloat(timeout) > schedule; +} + +// validation functions return true when invalid +const validateCommon = { + [ConfigKeys.MAX_REDIRECTS]: (value: unknown) => + (!!value && !`${value}`.match(digitsOnly)) || + parseFloat(value as ICustomFields[ConfigKeys.MAX_REDIRECTS]) < 0, + [ConfigKeys.MONITOR_TYPE]: (value: unknown) => !value, + [ConfigKeys.SCHEDULE]: (value: unknown) => { + const { number, unit } = value as ICustomFields[ConfigKeys.SCHEDULE]; + const parsedFloat = parseFloat(number); + return !parsedFloat || !unit || parsedFloat < 1; + }, + [ConfigKeys.TIMEOUT]: ( + timeoutValue: unknown, + scheduleNumber: string, + scheduleUnit: ScheduleUnit + ) => + !timeoutValue || + parseFloat(timeoutValue as ICustomFields[ConfigKeys.TIMEOUT]) < 0 || + validateTimeout({ + timeout: timeoutValue as ICustomFields[ConfigKeys.TIMEOUT], + scheduleNumber, + scheduleUnit, + }), +}; + +const validateHTTP = { + [ConfigKeys.RESPONSE_STATUS_CHECK]: (value: unknown) => { + const statusCodes = value as ICustomFields[ConfigKeys.RESPONSE_STATUS_CHECK]; + return statusCodes.length ? statusCodes.some((code) => !`${code}`.match(digitsOnly)) : false; + }, + [ConfigKeys.RESPONSE_HEADERS_CHECK]: (value: unknown) => { + const headers = value as ICustomFields[ConfigKeys.RESPONSE_HEADERS_CHECK]; + return validateHeaders(headers); + }, + [ConfigKeys.REQUEST_HEADERS_CHECK]: (value: unknown) => { + const headers = value as ICustomFields[ConfigKeys.REQUEST_HEADERS_CHECK]; + return validateHeaders(headers); + }, + [ConfigKeys.URLS]: (value: unknown) => !value, + ...validateCommon, +}; + +const validateTCP = { + [ConfigKeys.HOSTS]: (value: unknown) => { + return !value || !`${value}`.match(includesValidPort); + }, + ...validateCommon, +}; + +const validateICMP = { + [ConfigKeys.HOSTS]: (value: unknown) => !value, + [ConfigKeys.WAIT]: (value: unknown) => + !!value && + !digitsOnly.test(`${value}`) && + parseFloat(value as ICustomFields[ConfigKeys.WAIT]) < 0, + ...validateCommon, +}; + +export type ValidateDictionary = Record; + +export const validate: ValidateDictionary = { + [DataStream.HTTP]: validateHTTP, + [DataStream.TCP]: validateTCP, + [DataStream.ICMP]: validateICMP, +}; diff --git a/x-pack/plugins/uptime/public/components/monitor/monitor_duration/monitor_duration.tsx b/x-pack/plugins/uptime/public/components/monitor/monitor_duration/monitor_duration.tsx index 9c059441b050e..8066458dfde1a 100644 --- a/x-pack/plugins/uptime/public/components/monitor/monitor_duration/monitor_duration.tsx +++ b/x-pack/plugins/uptime/public/components/monitor/monitor_duration/monitor_duration.tsx @@ -7,7 +7,7 @@ import React from 'react'; import { FormattedMessage } from '@kbn/i18n/react'; -import { EuiFlexGroup, EuiFlexItem, EuiPanel, EuiTitle, EuiSpacer } from '@elastic/eui'; +import { EuiFlexGroup, EuiFlexItem, EuiPanel, EuiTitle, EuiSpacer, EuiButton } from '@elastic/eui'; import { LocationDurationLine } from '../../../../common/types'; import { MLIntegrationComponent } from '../ml/ml_integeration'; import { AnomalyRecords } from '../../../state/actions'; @@ -18,6 +18,7 @@ interface DurationChartProps { hasMLJob: boolean; anomalies: AnomalyRecords | null; locationDurationLines: LocationDurationLine[]; + exploratoryViewLink: string; } /** @@ -27,6 +28,7 @@ interface DurationChartProps { * @param props The props required for this component to render properly */ export const MonitorDurationComponent = ({ + exploratoryViewLink, locationDurationLines, anomalies, loading, @@ -34,7 +36,7 @@ export const MonitorDurationComponent = ({ }: DurationChartProps) => { return ( - +

    @@ -56,6 +58,11 @@ export const MonitorDurationComponent = ({ + + + + + = ({ monitorId }) => { const { @@ -49,6 +51,23 @@ export const MonitorDuration: React.FC = ({ monitorId }) => { const { lastRefresh } = useContext(UptimeRefreshContext); + const { basePath } = useUptimeSettingsContext(); + + const exploratoryViewLink = createExploratoryViewUrl( + { + [`monitor-duration`]: { + reportType: 'upd', + time: { from: dateRangeStart, to: dateRangeEnd }, + reportDefinitions: { + 'monitor.id': monitorId as string, + }, + breakdown: 'observer.geo.name', + operationType: 'average', + }, + }, + basePath + ); + useEffect(() => { if (isMLAvailable) { const anomalyParams = { @@ -77,6 +96,7 @@ export const MonitorDuration: React.FC = ({ monitorId }) => { anomalies={anomalies} hasMLJob={hasMLJob} loading={loading || jobsLoading} + exploratoryViewLink={exploratoryViewLink} locationDurationLines={durationLines?.locationDurationLines ?? []} /> ); diff --git a/x-pack/plugins/uptime/public/components/monitor/monitor_title.test.tsx b/x-pack/plugins/uptime/public/components/monitor/monitor_title.test.tsx index dabc0021898eb..4bf4e9193de7e 100644 --- a/x-pack/plugins/uptime/public/components/monitor/monitor_title.test.tsx +++ b/x-pack/plugins/uptime/public/components/monitor/monitor_title.test.tsx @@ -7,11 +7,11 @@ import React from 'react'; import moment from 'moment'; +import { screen } from '@testing-library/react'; +import { render } from '../../lib/helper/rtl_helpers'; import * as reactRouterDom from 'react-router-dom'; import { Ping } from '../../../common/runtime_types'; import { MonitorPageTitle } from './monitor_title'; -import { renderWithRouter } from '../../lib'; -import { mockReduxHooks } from '../../lib/helper/test_helpers'; jest.mock('react-router-dom', () => { const originalModule = jest.requireActual('react-router-dom'); @@ -48,6 +48,54 @@ describe('MonitorTitle component', () => { }, }; + const defaultTCPMonitorStatus: Ping = { + docId: 'few213kl', + timestamp: moment(new Date()).subtract(15, 'm').toString(), + monitor: { + duration: { + us: 1234567, + }, + id: 'tcp', + status: 'up', + type: 'tcp', + }, + url: { + full: 'https://www.elastic.co/', + }, + }; + + const defaultICMPMonitorStatus: Ping = { + docId: 'few213kl', + timestamp: moment(new Date()).subtract(15, 'm').toString(), + monitor: { + duration: { + us: 1234567, + }, + id: 'icmp', + status: 'up', + type: 'icmp', + }, + url: { + full: 'https://www.elastic.co/', + }, + }; + + const defaultBrowserMonitorStatus: Ping = { + docId: 'few213kl', + timestamp: moment(new Date()).subtract(15, 'm').toString(), + monitor: { + duration: { + us: 1234567, + }, + id: 'browser', + status: 'up', + type: 'browser', + }, + url: { + full: 'https://www.elastic.co/', + }, + }; + const monitorStatusWithName: Ping = { ...defaultMonitorStatus, monitor: { @@ -58,25 +106,70 @@ describe('MonitorTitle component', () => { beforeEach(() => { mockReactRouterDomHooks({ useParamsResponse: { monitorId: defaultMonitorIdEncoded } }); - mockReduxHooks(defaultMonitorStatus); }); it('renders the monitor heading and EnableMonitorAlert toggle', () => { - mockReduxHooks(monitorStatusWithName); - const component = renderWithRouter(); - expect(component.find('h1').text()).toBe(monitorName); - expect(component.find('[data-test-subj="uptimeDisplayDefineConnector"]').length).toBe(1); + render(, { + state: { monitorStatus: { status: monitorStatusWithName, loading: false } }, + }); + expect(screen.getByRole('heading', { level: 1, name: monitorName })).toBeInTheDocument(); + expect(screen.getByTestId('uptimeDisplayDefineConnector')).toBeInTheDocument(); }); it('renders the user provided monitorId when the name is not present', () => { mockReactRouterDomHooks({ useParamsResponse: { monitorId: defaultMonitorIdEncoded } }); - const component = renderWithRouter(); - expect(component.find('h1').text()).toBe(defaultMonitorId); + render(, { + state: { monitorStatus: { status: defaultMonitorStatus, loading: false } }, + }); + expect(screen.getByRole('heading', { level: 1, name: defaultMonitorId })).toBeInTheDocument(); }); it('renders the url when the monitorId is auto generated and the monitor name is not present', () => { mockReactRouterDomHooks({ useParamsResponse: { monitorId: autoGeneratedMonitorIdEncoded } }); - const component = renderWithRouter(); - expect(component.find('h1').text()).toBe(defaultMonitorStatus.url?.full); + render(, { + state: { monitorStatus: { status: defaultMonitorStatus, loading: false } }, + }); + expect( + screen.getByRole('heading', { level: 1, name: defaultMonitorStatus.url?.full }) + ).toBeInTheDocument(); + }); + + it('renders beta disclaimer for synthetics monitors', () => { + render(, { + state: { monitorStatus: { status: defaultBrowserMonitorStatus, loading: false } }, + }); + const betaLink = screen.getByRole('link', { + name: 'See more External link', + }) as HTMLAnchorElement; + expect(betaLink).toBeInTheDocument(); + expect(betaLink.href).toBe('https://www.elastic.co/what-is/synthetic-monitoring'); + expect(screen.getByText('Browser (BETA)')).toBeInTheDocument(); + }); + + it('does not render beta disclaimer for http', () => { + render(, { + state: { monitorStatus: { status: defaultMonitorStatus, loading: false } }, + }); + expect(screen.getByText('HTTP ping')).toBeInTheDocument(); + expect(screen.queryByText(/BETA/)).not.toBeInTheDocument(); + expect(screen.queryByRole('link', { name: 'See more External link' })).not.toBeInTheDocument(); + }); + + it('does not render beta disclaimer for tcp', () => { + render(, { + state: { monitorStatus: { status: defaultTCPMonitorStatus, loading: false } }, + }); + expect(screen.getByText('TCP ping')).toBeInTheDocument(); + expect(screen.queryByText(/BETA/)).not.toBeInTheDocument(); + expect(screen.queryByRole('link', { name: 'See more External link' })).not.toBeInTheDocument(); + }); + + it('renders badge and does not render beta disclaimer for icmp', () => { + render(, { + state: { monitorStatus: { status: defaultICMPMonitorStatus, loading: false } }, + }); + expect(screen.getByText('ICMP ping')).toBeInTheDocument(); + expect(screen.queryByText(/BETA/)).not.toBeInTheDocument(); + expect(screen.queryByRole('link', { name: 'See more External link' })).not.toBeInTheDocument(); }); }); diff --git a/x-pack/plugins/uptime/public/components/monitor/monitor_title.tsx b/x-pack/plugins/uptime/public/components/monitor/monitor_title.tsx index a0e4ea507909f..d25d7eca333cf 100644 --- a/x-pack/plugins/uptime/public/components/monitor/monitor_title.tsx +++ b/x-pack/plugins/uptime/public/components/monitor/monitor_title.tsx @@ -5,7 +5,8 @@ * 2.0. */ -import { EuiFlexGroup, EuiFlexItem, EuiSpacer, EuiTitle } from '@elastic/eui'; +import { EuiBadge, EuiFlexGroup, EuiFlexItem, EuiSpacer, EuiTitle, EuiLink } from '@elastic/eui'; +import { FormattedMessage } from '@kbn/i18n/react'; import React from 'react'; import { useSelector } from 'react-redux'; import { useMonitorId } from '../../hooks'; @@ -38,22 +39,88 @@ export const MonitorPageTitle: React.FC = () => { const nameOrId = selectedMonitor?.monitor?.name || getPageTitle(monitorId, selectedMonitor); + const type = selectedMonitor?.monitor?.type; + const isBrowser = type === 'browser'; + useBreadcrumbs([{ text: nameOrId }]); + const renderMonitorType = (monitorType: string) => { + switch (monitorType) { + case 'http': + return ( + + ); + case 'tcp': + return ( + + ); + case 'icmp': + return ( + + ); + case 'browser': + return ( + + ); + default: + return ''; + } + }; + return ( - - - -

    {nameOrId}

    -
    - -
    - - - -
    + <> + + + +

    {nameOrId}

    +
    + +
    + + + +
    + + + + {type && ( + + {renderMonitorType(type)}{' '} + {isBrowser && ( + + )} + + )} + + {isBrowser && ( + + + + + + )} + + ); }; diff --git a/x-pack/plugins/uptime/public/components/monitor/synthetics/step_detail/waterfall/waterfall_sidebar_item.tsx b/x-pack/plugins/uptime/public/components/monitor/synthetics/step_detail/waterfall/waterfall_sidebar_item.tsx index f9d56422ba75c..be624352cd1e4 100644 --- a/x-pack/plugins/uptime/public/components/monitor/synthetics/step_detail/waterfall/waterfall_sidebar_item.tsx +++ b/x-pack/plugins/uptime/public/components/monitor/synthetics/step_detail/waterfall/waterfall_sidebar_item.tsx @@ -55,13 +55,17 @@ export const WaterfallSidebarItem = ({ data-test-subj={isHighlighted ? 'sideBarHighlightedItem' : 'sideBarDimmedItem'} > {!status || !isErrorStatusCode(status) ? ( - + + + + + ) : ( diff --git a/x-pack/plugins/uptime/public/components/monitor/synthetics/waterfall/components/constants.ts b/x-pack/plugins/uptime/public/components/monitor/synthetics/waterfall/components/constants.ts index 5b49e0fd529b7..d36cb025f3c2b 100644 --- a/x-pack/plugins/uptime/public/components/monitor/synthetics/waterfall/components/constants.ts +++ b/x-pack/plugins/uptime/public/components/monitor/synthetics/waterfall/components/constants.ts @@ -6,14 +6,14 @@ */ // Pixel value -export const BAR_HEIGHT = 32; +export const BAR_HEIGHT = 24; // Flex grow value export const MAIN_GROW_SIZE = 8; // Flex grow value export const SIDEBAR_GROW_SIZE = 2; // Axis height // NOTE: This isn't a perfect solution - changes in font size etc within charts could change the ideal height here. -export const FIXED_AXIS_HEIGHT = 32; +export const FIXED_AXIS_HEIGHT = 24; // number of items to display in canvas, since canvas can only have limited size export const CANVAS_MAX_ITEMS = 150; diff --git a/x-pack/plugins/uptime/public/components/monitor/synthetics/waterfall/components/middle_truncated_text.tsx b/x-pack/plugins/uptime/public/components/monitor/synthetics/waterfall/components/middle_truncated_text.tsx index 4881fdb6e6b85..6a9d6660c901c 100644 --- a/x-pack/plugins/uptime/public/components/monitor/synthetics/waterfall/components/middle_truncated_text.tsx +++ b/x-pack/plugins/uptime/public/components/monitor/synthetics/waterfall/components/middle_truncated_text.tsx @@ -50,7 +50,6 @@ const LastChunk = styled.span` const StyledButton = styled(EuiButtonEmpty)` &&& { - height: auto; border: none; .euiButtonContent { diff --git a/x-pack/plugins/uptime/public/components/monitor/synthetics/waterfall/components/styles.ts b/x-pack/plugins/uptime/public/components/monitor/synthetics/waterfall/components/styles.ts index 433f59d0e83af..e8125ebcf30cb 100644 --- a/x-pack/plugins/uptime/public/components/monitor/synthetics/waterfall/components/styles.ts +++ b/x-pack/plugins/uptime/public/components/monitor/synthetics/waterfall/components/styles.ts @@ -115,6 +115,10 @@ export const WaterfallChartSidebarFlexItem = euiStyled(EuiFlexItem)` export const SideBarItemHighlighter = euiStyled(EuiFlexItem)<{ isHighlighted: boolean }>` opacity: ${(props) => (props.isHighlighted ? 1 : 0.4)}; height: 100%; + .euiButtonEmpty { + height: ${FIXED_AXIS_HEIGHT}px; + font-size:${({ theme }) => theme.eui.euiFontSizeM}; + } `; interface WaterfallChartChartContainer { @@ -124,8 +128,8 @@ interface WaterfallChartChartContainer { export const WaterfallChartChartContainer = euiStyled.div` width: 100%; - height: ${(props) => `${props.height + FIXED_AXIS_HEIGHT - 4}px`}; - margin-top: -${FIXED_AXIS_HEIGHT - 4}px; + height: ${(props) => `${props.height + FIXED_AXIS_HEIGHT + 4}px`}; + margin-top: -${FIXED_AXIS_HEIGHT + 4}px; z-index: ${(props) => Math.round(props.theme.eui.euiZLevel3 / (props.chartIndex + 1))}; `; diff --git a/x-pack/plugins/uptime/public/components/overview/empty_state/__snapshots__/empty_state.test.tsx.snap b/x-pack/plugins/uptime/public/components/overview/empty_state/__snapshots__/empty_state.test.tsx.snap deleted file mode 100644 index c106d5d12e54b..0000000000000 --- a/x-pack/plugins/uptime/public/components/overview/empty_state/__snapshots__/empty_state.test.tsx.snap +++ /dev/null @@ -1,2056 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`EmptyState component does not render empty state with appropriate base path and no docs 1`] = ` - - - , - } - } - /> - } - > - -
    - -
    - -
    - - -
    - - - - - - - - - - - - - } - body={ - -

    - -

    -

    - -

    -
    - } - iconType="logoUptime" - title={ - -

    - , - } - } - /> -

    -
    - } - > -
    - - - - -
    - - - - - -

    - , - } - } - > - No uptime data found in index - - -

    -
    -
    - -
    - - -
    -

    - - If you have not setup heartbeat yet, you can setup heartbeat to start monitoring your services. - -

    -

    - - If you have setup heartbeat and confirmed data is being sent to Elasticsearch, update your index pattern settings and insure they are aligned with your Heartbeat config. - -

    -
    -
    - - - - - -
    - -
    - - - - -`; - -exports[`EmptyState component doesn't render child components when count is falsy 1`] = ` - - - , - } - } - /> - } - > - -
    - -
    - -
    - - -
    - - - - - - - - - - - - - } - body={ - -

    - -

    -

    - -

    -
    - } - iconType="logoUptime" - title={ - -

    - , - } - } - /> -

    -
    - } - > -
    - - - - -
    - - - - - -

    - , - } - } - > - No indices found matching pattern - - -

    -
    -
    - -
    - - -
    -

    - - If you have not setup heartbeat yet, you can setup heartbeat to start monitoring your services. - -

    -

    - - If you have setup heartbeat and confirmed data is being sent to Elasticsearch, update your index pattern settings and insure they are aligned with your Heartbeat config. - -

    -
    -
    - - - - - -
    - -
    - - - - -`; - -exports[`EmptyState component notifies when index does not exist 1`] = ` - - - , - } - } - /> - } - > - -
    - -
    - -
    - - -
    - - - - - - - - - - - - - } - body={ - -

    - -

    -

    - -

    -
    - } - iconType="logoUptime" - title={ - -

    - , - } - } - /> -

    -
    - } - > -
    - - - - -
    - - - - - -

    - , - } - } - > - No indices found matching pattern - - -

    -
    -
    - -
    - - -
    -

    - - If you have not setup heartbeat yet, you can setup heartbeat to start monitoring your services. - -

    -

    - - If you have setup heartbeat and confirmed data is being sent to Elasticsearch, update your index pattern settings and insure they are aligned with your Heartbeat config. - -

    -
    -
    - - - - - -
    - -
    - - - - -`; - -exports[`EmptyState component renders child components when count is truthy 1`] = ` - - - -
    - Foo -
    -
    - Bar -
    -
    - Baz -
    -
    -
    -
    -`; - -exports[`EmptyState component renders error message when an error occurs 1`] = ` - - - - -
    - -
    - -
    - -

    - There was an error fetching your data. -

    - - } - iconColor="subdued" - iconType="securityApp" - title={ - -

    - Error -

    -
    - } - > -
    - - - - -
    - - - - - -

    - Error -

    -
    -
    - -
    - - -
    -

    - There was an error fetching your data. -

    -
    -
    - - -
    - -
    - -
    - -
    - - - - -`; - -exports[`EmptyState component renders loading state if no errors or doc count 1`] = ` - - - - - - - -

    - Loading… -

    -
    - - } - > -
    - - - -
    - - - - -
    - - -

    - Loading… -

    -
    -
    - - - -
    - - - - -`; diff --git a/x-pack/plugins/uptime/public/components/overview/empty_state/empty_state.test.tsx b/x-pack/plugins/uptime/public/components/overview/empty_state/empty_state.test.tsx index a617ba0db1eb3..45b107928d79a 100644 --- a/x-pack/plugins/uptime/public/components/overview/empty_state/empty_state.test.tsx +++ b/x-pack/plugins/uptime/public/components/overview/empty_state/empty_state.test.tsx @@ -6,10 +6,11 @@ */ import React from 'react'; +import { screen } from '@testing-library/react'; import { EmptyStateComponent } from './empty_state'; import { StatesIndexStatus } from '../../../../common/runtime_types'; import { HttpFetchError, IHttpFetchError } from 'src/core/public'; -import { mountWithRouter, shallowWithRouter } from '../../../lib'; +import { render } from '../../../lib/helper/rtl_helpers'; describe('EmptyState component', () => { let statesIndexStatus: StatesIndexStatus; @@ -18,27 +19,31 @@ describe('EmptyState component', () => { statesIndexStatus = { indexExists: true, docCount: 1, + indices: 'heartbeat-*,synthetics-*', }; }); it('renders child components when count is truthy', () => { - const component = shallowWithRouter( + render(
    Foo
    Bar
    Baz
    ); - expect(component).toMatchSnapshot(); + + expect(screen.getByText('Foo')).toBeInTheDocument(); + expect(screen.getByText('Bar')).toBeInTheDocument(); + expect(screen.getByText('Baz')).toBeInTheDocument(); }); it(`doesn't render child components when count is falsy`, () => { - const component = mountWithRouter( + render( -
    Shouldn't be rendered
    +
    Should not be rendered
    ); - expect(component).toMatchSnapshot(); + expect(screen.queryByText('Should not be rendered')).toBeNull(); }); it(`renders error message when an error occurs`, () => { @@ -47,43 +52,48 @@ describe('EmptyState component', () => { body: { message: 'There was an error fetching your data.' }, }), ]; - const component = mountWithRouter( + render( -
    Shouldn't appear...
    +
    Should not appear...
    ); - expect(component).toMatchSnapshot(); + expect(screen.queryByText('Should not appear...')).toBeNull(); }); it('renders loading state if no errors or doc count', () => { - const component = mountWithRouter( + render(
    Should appear even while loading...
    ); - expect(component).toMatchSnapshot(); + expect(screen.queryByText('Should appear even while loading...')).toBeInTheDocument(); }); it('does not render empty state with appropriate base path and no docs', () => { statesIndexStatus = { docCount: 0, indexExists: true, + indices: 'heartbeat-*,synthetics-*', }; - const component = mountWithRouter( + const text = 'If this is in the snapshot the test should fail'; + render( -
    If this is in the snapshot the test should fail
    +
    {text}
    ); - expect(component).toMatchSnapshot(); + expect(screen.queryByText(text)).toBeNull(); }); it('notifies when index does not exist', () => { statesIndexStatus.indexExists = false; - const component = mountWithRouter( + + const text = 'This text should not render'; + + render( -
    This text should not render
    +
    {text}
    ); - expect(component).toMatchSnapshot(); + expect(screen.queryByText(text)).toBeNull(); }); }); diff --git a/x-pack/plugins/uptime/public/components/overview/empty_state/empty_state.tsx b/x-pack/plugins/uptime/public/components/overview/empty_state/empty_state.tsx index 415d9cb5adcc6..5a28c7c2592d7 100644 --- a/x-pack/plugins/uptime/public/components/overview/empty_state/empty_state.tsx +++ b/x-pack/plugins/uptime/public/components/overview/empty_state/empty_state.tsx @@ -33,36 +33,28 @@ export const EmptyStateComponent = ({ } const { indexExists, docCount } = statesIndexStatus ?? {}; - if (loading && (!indexExists || docCount === 0 || !statesIndexStatus)) { - return ; - } + const isLoading = loading && (!indexExists || docCount === 0 || !statesIndexStatus); + + const noIndicesMessage = ( + {settings?.heartbeatIndices}
    }} + /> + ); + + const noUptimeDataMessage = ( + {settings?.heartbeatIndices} }} + /> + ); - if (!indexExists) { - return ( - {settings?.heartbeatIndices}
    }} - /> - } - /> - ); - } else if (indexExists && docCount === 0) { - return ( - {settings?.heartbeatIndices} }} - /> - } - /> - ); + if (!indexExists && !isLoading) { + return ; + } else if (indexExists && docCount === 0 && !isLoading) { + return ; } /** * We choose to render the children any time the count > 0, even if @@ -71,6 +63,11 @@ export const EmptyStateComponent = ({ * jittery UX any time the components refresh. This way we'll keep the stale * state displayed during the fetching process. */ - return {children}; + return ( + + {isLoading && } +
    {children}
    +
    + ); // } }; diff --git a/x-pack/plugins/uptime/public/components/overview/empty_state/empty_state_container.tsx b/x-pack/plugins/uptime/public/components/overview/empty_state/empty_state_container.tsx index 83fd2f78278d2..562e45727dda7 100644 --- a/x-pack/plugins/uptime/public/components/overview/empty_state/empty_state_container.tsx +++ b/x-pack/plugins/uptime/public/components/overview/empty_state/empty_state_container.tsx @@ -23,15 +23,18 @@ export const EmptyState: React.FC = ({ children }) => { const dispatch = useDispatch(); + const noDataInfo = !data || data?.docCount === 0 || data?.indexExists === false; + useEffect(() => { - if (!data || data?.docCount === 0 || data?.indexExists === false) { + if (noDataInfo) { + // only call when we haven't fetched it already dispatch(indexStatusAction.get()); } - // Don't add data , it will create endless loop - // eslint-disable-next-line react-hooks/exhaustive-deps - }, [dispatch, lastRefresh]); + }, [dispatch, lastRefresh, noDataInfo]); useEffect(() => { + // using separate side effect, we want to call index status, + // every statue indices setting changes dispatch(indexStatusAction.get()); }, [dispatch, heartbeatIndices]); diff --git a/x-pack/plugins/uptime/public/components/overview/monitor_list/monitor_list_container.tsx b/x-pack/plugins/uptime/public/components/overview/monitor_list/monitor_list_container.tsx index 4fd0a9c0f4b08..835a89e8f7272 100644 --- a/x-pack/plugins/uptime/public/components/overview/monitor_list/monitor_list_container.tsx +++ b/x-pack/plugins/uptime/public/components/overview/monitor_list/monitor_list_container.tsx @@ -12,6 +12,7 @@ import { esKuerySelector, monitorListSelector } from '../../../state/selectors'; import { MonitorListComponent } from './monitor_list'; import { useUrlParams } from '../../../hooks'; import { UptimeRefreshContext } from '../../../contexts'; +import { getConnectorsAction, getMonitorAlertsAction } from '../../../state/alerts/alerts'; export interface MonitorListProps { filters?: string; @@ -65,6 +66,14 @@ export const MonitorList: React.FC = (props) => { query, ]); + useEffect(() => { + dispatch(getMonitorAlertsAction.get()); + }, [dispatch]); + + useEffect(() => { + dispatch(getConnectorsAction.get()); + }, [dispatch]); + return ( { }; export const QueryBar = () => { - const { index_pattern: indexPattern } = useIndexPattern(); - const { search: urlValue } = useGetUrlParams(); const { query, setQuery } = useQueryBar(); + const { index_pattern: indexPattern } = useIndexPattern(query.language ?? SyntaxType.text); + const [inputVal, setInputVal] = useState(query.query); const isInValid = () => { diff --git a/x-pack/plugins/uptime/public/components/overview/query_bar/use_index_pattern.ts b/x-pack/plugins/uptime/public/components/overview/query_bar/use_index_pattern.ts index 49466cf8d00bf..ab10afb5b231e 100644 --- a/x-pack/plugins/uptime/public/components/overview/query_bar/use_index_pattern.ts +++ b/x-pack/plugins/uptime/public/components/overview/query_bar/use_index_pattern.ts @@ -9,16 +9,18 @@ import { useEffect } from 'react'; import { useDispatch, useSelector } from 'react-redux'; import { getIndexPattern } from '../../../state/actions'; import { selectIndexPattern } from '../../../state/selectors'; +import { SyntaxType } from './use_query_bar'; -export const useIndexPattern = () => { +export const useIndexPattern = (queryLanguage?: string) => { const dispatch = useDispatch(); const indexPattern = useSelector(selectIndexPattern); useEffect(() => { - if (!indexPattern.index_pattern) { + // we only use index pattern for kql queries + if (!indexPattern.index_pattern && (!queryLanguage || queryLanguage === SyntaxType.kuery)) { dispatch(getIndexPattern()); } - }, [indexPattern.index_pattern, dispatch]); + }, [indexPattern.index_pattern, dispatch, queryLanguage]); return indexPattern; }; diff --git a/x-pack/plugins/uptime/public/components/overview/query_bar/use_query_bar.ts b/x-pack/plugins/uptime/public/components/overview/query_bar/use_query_bar.ts index caf6b08e8fdea..9e3691497eab6 100644 --- a/x-pack/plugins/uptime/public/components/overview/query_bar/use_query_bar.ts +++ b/x-pack/plugins/uptime/public/components/overview/query_bar/use_query_bar.ts @@ -21,8 +21,6 @@ export enum SyntaxType { const SYNTAX_STORAGE = 'uptime:queryBarSyntax'; export const useQueryBar = () => { - const { index_pattern: indexPattern } = useIndexPattern(); - const dispatch = useDispatch(); const { absoluteDateRangeStart, absoluteDateRangeEnd, ...params } = useGetUrlParams(); @@ -46,6 +44,8 @@ export const useQueryBar = () => { } ); + const { index_pattern: indexPattern } = useIndexPattern(query.language); + const updateUrlParams = useUrlParams()[1]; const [esFilters, error] = useUpdateKueryString( diff --git a/x-pack/plugins/uptime/public/contexts/uptime_settings_context.tsx b/x-pack/plugins/uptime/public/contexts/uptime_settings_context.tsx index 37ee7021eb19f..dacaeb89a5cc5 100644 --- a/x-pack/plugins/uptime/public/contexts/uptime_settings_context.tsx +++ b/x-pack/plugins/uptime/public/contexts/uptime_settings_context.tsx @@ -5,7 +5,7 @@ * 2.0. */ -import React, { createContext, useMemo } from 'react'; +import React, { createContext, useContext, useMemo } from 'react'; import { UptimeAppProps } from '../apps/uptime_app'; import { CLIENT_DEFAULTS, CONTEXT_DEFAULTS } from '../../common/constants'; import { CommonlyUsedRange } from '../components/common/uptime_date_picker'; @@ -66,3 +66,5 @@ export const UptimeSettingsContextProvider: React.FC = ({ childr return ; }; + +export const useUptimeSettingsContext = () => useContext(UptimeSettingsContext); diff --git a/x-pack/plugins/uptime/public/hooks/use_telemetry.ts b/x-pack/plugins/uptime/public/hooks/use_telemetry.ts index b9ec9cc5e5516..4ba0179bb54ba 100644 --- a/x-pack/plugins/uptime/public/hooks/use_telemetry.ts +++ b/x-pack/plugins/uptime/public/hooks/use_telemetry.ts @@ -38,6 +38,8 @@ export const useUptimeTelemetry = (page?: UptimePage) => { dateEnd: dateRangeEnd, autoRefreshEnabled: !autorefreshIsPaused, }; - apiService.post(API_URLS.LOG_PAGE_VIEW, params); + setTimeout(() => { + apiService.post(API_URLS.LOG_PAGE_VIEW, params); + }, 100); }, [autorefreshInterval, autorefreshIsPaused, dateRangeEnd, dateRangeStart, page]); }; diff --git a/x-pack/plugins/uptime/public/pages/overview.tsx b/x-pack/plugins/uptime/public/pages/overview.tsx index d478fe1bc1f37..846698bc390db 100644 --- a/x-pack/plugins/uptime/public/pages/overview.tsx +++ b/x-pack/plugins/uptime/public/pages/overview.tsx @@ -6,17 +6,14 @@ */ import { EuiFlexGroup, EuiFlexItem, EuiSpacer } from '@elastic/eui'; -import React, { useEffect } from 'react'; +import React from 'react'; import styled from 'styled-components'; -import { useDispatch } from 'react-redux'; import { useBreadcrumbs } from '../hooks/use_breadcrumbs'; import { useTrackPageview } from '../../../observability/public'; import { MonitorList } from '../components/overview/monitor_list/monitor_list_container'; import { EmptyState, FilterGroup } from '../components/overview'; import { StatusPanel } from '../components/overview/status_panel'; -import { getConnectorsAction, getMonitorAlertsAction } from '../state/alerts/alerts'; -import { useInitApp } from '../hooks/use_init_app'; import { QueryBar } from '../components/overview/query_bar/query_bar'; const EuiFlexItemStyled = styled(EuiFlexItem)` @@ -35,15 +32,6 @@ export const OverviewPageComponent = () => { useTrackPageview({ app: 'uptime', path: 'overview' }); useTrackPageview({ app: 'uptime', path: 'overview', delay: 15000 }); - useInitApp(); - - const dispatch = useDispatch(); - - useEffect(() => { - dispatch(getConnectorsAction.get()); - dispatch(getMonitorAlertsAction.get()); - }, [dispatch]); - useBreadcrumbs([]); // No extra breadcrumbs on overview return ( diff --git a/x-pack/plugins/uptime/public/state/effects/fetch_effect.test.ts b/x-pack/plugins/uptime/public/state/effects/fetch_effect.test.ts index 620b85b1c3233..d02ba142b907a 100644 --- a/x-pack/plugins/uptime/public/state/effects/fetch_effect.test.ts +++ b/x-pack/plugins/uptime/public/state/effects/fetch_effect.test.ts @@ -18,9 +18,13 @@ describe('fetch saga effect factory', () => { let fetchEffect; it('works with success workflow', () => { - const indexStatusResult = { indexExists: true, docCount: 2712532 }; + const indexStatusResult = { + indexExists: true, + docCount: 2712532, + indices: 'heartbeat-*,synthetics-*', + }; const fetchStatus = async (): Promise => { - return { indexExists: true, docCount: 2712532 }; + return { indexExists: true, docCount: 2712532, indices: 'heartbeat-*,synthetics-*' }; }; fetchEffect = fetchEffectFactory( fetchStatus, diff --git a/x-pack/plugins/uptime/public/state/effects/index_pattern.ts b/x-pack/plugins/uptime/public/state/effects/index_pattern.ts index 5142dcc6df066..687d1fa413ba3 100644 --- a/x-pack/plugins/uptime/public/state/effects/index_pattern.ts +++ b/x-pack/plugins/uptime/public/state/effects/index_pattern.ts @@ -5,13 +5,13 @@ * 2.0. */ -import { takeLatest } from 'redux-saga/effects'; +import { takeLeading } from 'redux-saga/effects'; import { getIndexPattern, getIndexPatternSuccess, getIndexPatternFail } from '../actions'; import { fetchIndexPattern } from '../api'; import { fetchEffectFactory } from './fetch_effect'; export function* fetchIndexPatternEffect() { - yield takeLatest( + yield takeLeading( getIndexPattern, fetchEffectFactory(fetchIndexPattern, getIndexPatternSuccess, getIndexPatternFail) ); diff --git a/x-pack/plugins/uptime/server/lib/lib.ts b/x-pack/plugins/uptime/server/lib/lib.ts index a91ff3d3b0faf..e79d3c28a7d3a 100644 --- a/x-pack/plugins/uptime/server/lib/lib.ts +++ b/x-pack/plugins/uptime/server/lib/lib.ts @@ -29,15 +29,18 @@ export interface UMServerLibs extends UMDomainLibs { } export interface CountResponse { - body: { - count: number; - _shards: { - total: number; - successful: number; - skipped: number; - failed: number; + result: { + body: { + count: number; + _shards: { + total: number; + successful: number; + skipped: number; + failed: number; + }; }; }; + indices: string; } export type UptimeESClient = ReturnType; @@ -107,7 +110,7 @@ export function createUptimeESClient({ throw esError; } - return res; + return { result: res, indices: dynamicSettings.heartbeatIndices }; }, getSavedObjectsClient() { return savedObjectsClient; diff --git a/x-pack/plugins/uptime/server/lib/requests/get_index_status.ts b/x-pack/plugins/uptime/server/lib/requests/get_index_status.ts index 6a00e586ffb17..dcd61d5331aa4 100644 --- a/x-pack/plugins/uptime/server/lib/requests/get_index_status.ts +++ b/x-pack/plugins/uptime/server/lib/requests/get_index_status.ts @@ -12,12 +12,16 @@ export const getIndexStatus: UMElasticsearchQueryFn<{}, StatesIndexStatus> = asy uptimeEsClient, }) => { const { - body: { - _shards: { total }, - count, + indices, + result: { + body: { + _shards: { total }, + count, + }, }, } = await uptimeEsClient.count({ terminateAfter: 1 }); return { + indices, indexExists: total > 0, docCount: count, }; diff --git a/x-pack/plugins/uptime/server/lib/requests/search/query_context.ts b/x-pack/plugins/uptime/server/lib/requests/search/query_context.ts index 3e410a0608094..b54515e84289a 100644 --- a/x-pack/plugins/uptime/server/lib/requests/search/query_context.ts +++ b/x-pack/plugins/uptime/server/lib/requests/search/query_context.ts @@ -48,7 +48,9 @@ export class QueryContext { } async count(params: any): Promise { - const { body } = await this.callES.count(params); + const { + result: { body }, + } = await this.callES.count(params); return body; } diff --git a/x-pack/plugins/uptime/tsconfig.json b/x-pack/plugins/uptime/tsconfig.json index 531ee2ecd8d2b..88099b57f0898 100644 --- a/x-pack/plugins/uptime/tsconfig.json +++ b/x-pack/plugins/uptime/tsconfig.json @@ -16,9 +16,20 @@ "../../../typings/**/*" ], "references": [ - { "path": "../alerting/tsconfig.json" }, - { "path": "../ml/tsconfig.json" }, - { "path": "../triggers_actions_ui/tsconfig.json" }, - { "path": "../observability/tsconfig.json" } + { + "path": "../alerting/tsconfig.json" + }, + { + "path": "../ml/tsconfig.json" + }, + { + "path": "../triggers_actions_ui/tsconfig.json" + }, + { + "path": "../observability/tsconfig.json" + }, + { + "path": "../fleet/tsconfig.json" + } ] -} +} \ No newline at end of file diff --git a/x-pack/scripts/functional_tests.js b/x-pack/scripts/functional_tests.js index 450cbc224eb48..f845f31a39c58 100644 --- a/x-pack/scripts/functional_tests.js +++ b/x-pack/scripts/functional_tests.js @@ -14,6 +14,7 @@ const alwaysImportedTests = [ require.resolve('../test/functional/config_security_basic.ts'), require.resolve('../test/reporting_functional/reporting_and_security.config.ts'), require.resolve('../test/reporting_functional/reporting_without_security.config.ts'), + require.resolve('../test/reporting_functional/reporting_and_deprecated_security.config.ts'), require.resolve('../test/security_functional/login_selector.config.ts'), require.resolve('../test/security_functional/oidc.config.ts'), require.resolve('../test/security_functional/saml.config.ts'), diff --git a/x-pack/test/accessibility/apps/login_page.ts b/x-pack/test/accessibility/apps/login_page.ts index f46a684194810..02d817612671c 100644 --- a/x-pack/test/accessibility/apps/login_page.ts +++ b/x-pack/test/accessibility/apps/login_page.ts @@ -14,8 +14,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { const retry = getService('retry'); const PageObjects = getPageObjects(['common', 'security']); - // FLAKY: https://github.com/elastic/kibana/issues/96372 - describe.skip('Security', () => { + describe('Security', () => { describe('Login Page', () => { before(async () => { await esArchiver.load('empty_kibana'); diff --git a/x-pack/test/accessibility/apps/ml_embeddables_in_dashboard.ts b/x-pack/test/accessibility/apps/ml_embeddables_in_dashboard.ts index 51875c683346e..de44984a50c5b 100644 --- a/x-pack/test/accessibility/apps/ml_embeddables_in_dashboard.ts +++ b/x-pack/test/accessibility/apps/ml_embeddables_in_dashboard.ts @@ -58,7 +58,6 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { const esArchiver = getService('esArchiver'); const ml = getService('ml'); const PageObjects = getPageObjects(['common', 'timePicker', 'dashboard']); - const dashboardAddPanel = getService('dashboardAddPanel'); const a11y = getService('a11y'); /* this is the wrapping service around axe */ describe('machine learning embeddables anomaly charts', function () { @@ -96,10 +95,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { it('can open job selection flyout', async () => { await PageObjects.dashboard.clickCreateDashboardPrompt(); await ml.dashboardEmbeddables.assertDashboardIsEmpty(); - await dashboardAddPanel.clickEditorMenuButton(); - await dashboardAddPanel.clickEmbeddableFactoryGroupButton('ml'); - await dashboardAddPanel.clickAddNewEmbeddableLink('ml_anomaly_charts'); - await ml.dashboardJobSelectionTable.assertJobSelectionTableExists(); + await ml.dashboardEmbeddables.openJobSelectionFlyout(); await a11y.testAppSnapshot(); }); diff --git a/x-pack/test/accessibility/apps/remote_clusters.ts b/x-pack/test/accessibility/apps/remote_clusters.ts new file mode 100644 index 0000000000000..099e3f9f170d9 --- /dev/null +++ b/x-pack/test/accessibility/apps/remote_clusters.ts @@ -0,0 +1,204 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import { FtrProviderContext } from '../ftr_provider_context'; +import { ClusterPayloadEs } from '../../../plugins/remote_clusters/common/lib'; + +const emptyPrompt = 'remoteClusterListEmptyPrompt'; +const createButton = 'remoteClusterEmptyPromptCreateButton'; +const pageTitle = 'remoteClusterPageTitle'; +const nameLink = 'remoteClustersTableListClusterLink'; +const editButton = 'remoteClusterTableRowEditButton'; +const deleteButton = 'remoteClusterTableRowRemoveButton'; +const deleteModalTitle = 'confirmModalTitleText'; +const detailsTitle = 'remoteClusterDetailsFlyoutTitle'; +const requestButton = 'remoteClustersRequestButton'; +const requestTitle = 'remoteClusterRequestFlyoutTitle'; + +interface Payload { + persistent: { + cluster: { + remote: { + [k: string]: ClusterPayloadEs; + }; + }; + }; +} + +const getEmptyPayload = () => + ({ + persistent: { + cluster: { + remote: {}, + }, + }, + } as Payload); + +const getPayloadClusterProxyMode = (name: string): Payload => { + const payload = getEmptyPayload(); + payload.persistent.cluster.remote[name] = { + mode: 'proxy', + proxy_address: '127.0.0.1:9302', + server_name: 'test_server', + }; + return payload; +}; + +const getPayloadClusterSniffMode = (name: string): Payload => { + const payload = getEmptyPayload(); + payload.persistent.cluster.remote[name] = { + mode: 'sniff', + seeds: ['127.0.0.1:9301'], + }; + return payload; +}; + +const getDeleteClusterPayload = (name: string): Payload => { + const payload = getEmptyPayload(); + payload.persistent.cluster.remote[name] = { + skip_unavailable: null, + mode: null, + proxy_address: null, + proxy_socket_connections: null, + server_name: null, + seeds: null, + node_connections: null, + proxy: null, + }; + return payload; +}; + +export default function ({ getService, getPageObjects }: FtrProviderContext) { + const PageObjects = getPageObjects(['common', 'security']); + const testSubjects = getService('testSubjects'); + const esClient = getService('es'); + const a11y = getService('a11y'); + const retry = getService('retry'); + + describe('Remote Clusters', () => { + beforeEach(async () => { + await PageObjects.common.navigateToApp('remoteClusters'); + }); + + describe('Add remote cluster', () => { + it('renders the list view with empty prompt', async () => { + await retry.waitFor('empty prompt to be rendered', async () => { + return testSubjects.isDisplayed(emptyPrompt); + }); + await a11y.testAppSnapshot(); + }); + + it('renders add remote cluster form', async () => { + await retry.waitFor('add remote cluster button to be rendered', async () => { + return testSubjects.isDisplayed(createButton); + }); + + await testSubjects.click(createButton); + await retry.waitFor('add remote cluster form to be rendered', async () => { + return (await testSubjects.getVisibleText(pageTitle)) === 'Add remote cluster'; + }); + + await a11y.testAppSnapshot(); + }); + + it('renders request flyout', async () => { + await retry.waitFor('add remote cluster button to be rendered', async () => { + return testSubjects.isDisplayed(createButton); + }); + + await testSubjects.click(createButton); + await retry.waitFor('add remote cluster form to be rendered', async () => { + return (await testSubjects.getVisibleText(pageTitle)) === 'Add remote cluster'; + }); + + await testSubjects.click(requestButton); + await retry.waitFor('request flyout to be rendered', async () => { + return (await testSubjects.getVisibleText(requestTitle)) === 'Request'; + }); + + await a11y.testAppSnapshot(); + }); + }); + + const modes = ['sniff', 'proxy']; + + modes.forEach((mode: string) => { + describe(`Edit remote cluster (${mode} mode)`, () => { + const clusterName = mode === 'sniff' ? 'clusterSniffMode' : 'clusterProxyMode'; + const body = + mode === 'sniff' + ? getPayloadClusterSniffMode(clusterName) + : getPayloadClusterProxyMode(clusterName); + before(async () => { + await esClient.cluster.putSettings({ body }); + }); + + after(async () => { + await esClient.cluster.putSettings({ body: getDeleteClusterPayload(clusterName) }); + }); + + it('renders the list view with remote clusters', async () => { + await retry.waitFor('remote clusters list to be rendered', async () => { + return testSubjects.isDisplayed(nameLink); + }); + await a11y.testAppSnapshot(); + }); + + it(`renders remote cluster details flyout (${mode} mode)`, async () => { + await retry.waitFor('remote clusters list to be rendered', async () => { + return testSubjects.isDisplayed(nameLink); + }); + + await testSubjects.click(nameLink); + + await retry.waitFor('remote cluster details to be rendered', async () => { + return (await testSubjects.getVisibleText(detailsTitle)) === clusterName; + }); + + await a11y.testAppSnapshot(); + }); + + it(`renders delete cluster modal (${mode} mode)`, async () => { + await retry.waitFor('remote clusters list to be rendered', async () => { + return testSubjects.isDisplayed(nameLink); + }); + + await testSubjects.click(deleteButton); + + await retry.waitFor('delete cluster modal to be rendered', async () => { + return ( + (await testSubjects.getVisibleText(deleteModalTitle)) === + `Remove remote cluster '${clusterName}'?` + ); + }); + + await a11y.testAppSnapshot(); + }); + + it(`renders edit remote cluster form and request flyout (${mode} mode)`, async () => { + await retry.waitFor('edit remote cluster button to be rendered', async () => { + return testSubjects.isDisplayed(editButton); + }); + + await testSubjects.click(editButton); + await retry.waitFor('edit remote cluster form to be rendered', async () => { + return (await testSubjects.getVisibleText(pageTitle)) === 'Edit remote cluster'; + }); + + await testSubjects.click(requestButton); + await retry.waitFor('request flyout to be rendered', async () => { + return ( + (await testSubjects.getVisibleText(requestTitle)) === `Request for '${clusterName}'` + ); + }); + + await a11y.testAppSnapshot(); + }); + }); + }); + }); +} diff --git a/x-pack/test/accessibility/apps/spaces.ts b/x-pack/test/accessibility/apps/spaces.ts index a2f0e835c0b3e..a08ae474497e5 100644 --- a/x-pack/test/accessibility/apps/spaces.ts +++ b/x-pack/test/accessibility/apps/spaces.ts @@ -18,17 +18,14 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { const retry = getService('retry'); const toasts = getService('toasts'); - // flaky - // https://github.com/elastic/kibana/issues/77933 - // https://github.com/elastic/kibana/issues/96625 - describe.skip('Kibana spaces page meets a11y validations', () => { + describe('Kibana spaces page meets a11y validations', () => { before(async () => { await esArchiver.load('empty_kibana'); await PageObjects.common.navigateToApp('home'); }); - it.skip('a11y test for manage spaces menu from top nav on Kibana home', async () => { - await PageObjects.spaceSelector.openSpacesNav(); + it('a11y test for manage spaces menu from top nav on Kibana home', async () => { + await testSubjects.click('space-avatar-default'); await retry.waitFor( 'Manage spaces option visible', async () => await testSubjects.exists('manageSpaces') @@ -36,7 +33,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { await a11y.testAppSnapshot(); }); - it.skip('a11y test for manage spaces page', async () => { + it('a11y test for manage spaces page', async () => { await PageObjects.spaceSelector.clickManageSpaces(); await PageObjects.header.waitUntilLoadingHasFinished(); await toasts.dismissAllToasts(); diff --git a/x-pack/test/accessibility/config.ts b/x-pack/test/accessibility/config.ts index 289247beb4771..5b46e7de1efa4 100644 --- a/x-pack/test/accessibility/config.ts +++ b/x-pack/test/accessibility/config.ts @@ -36,6 +36,7 @@ export default async function ({ readConfigFile }: FtrConfigProviderContext) { require.resolve('./apps/canvas'), require.resolve('./apps/security_solution'), require.resolve('./apps/ml_embeddables_in_dashboard'), + require.resolve('./apps/remote_clusters'), ], pageObjects, diff --git a/x-pack/test/alerting_api_integration/common/fixtures/plugins/alerts/server/plugin.ts b/x-pack/test/alerting_api_integration/common/fixtures/plugins/alerts/server/plugin.ts index bf5d05ee4624a..9a7cd8d333b44 100644 --- a/x-pack/test/alerting_api_integration/common/fixtures/plugins/alerts/server/plugin.ts +++ b/x-pack/test/alerting_api_integration/common/fixtures/plugins/alerts/server/plugin.ts @@ -15,6 +15,7 @@ import { defineActionTypes } from './action_types'; import { defineRoutes } from './routes'; import { SpacesPluginStart } from '../../../../../../../plugins/spaces/server'; import { SecurityPluginStart } from '../../../../../../../plugins/security/server'; +import { PluginStartContract as ActionsPluginStart } from '../../../../../../../plugins/actions/server'; export interface FixtureSetupDeps { features: FeaturesPluginSetup; @@ -26,6 +27,7 @@ export interface FixtureStartDeps { encryptedSavedObjects: EncryptedSavedObjectsPluginStart; security?: SecurityPluginStart; spaces?: SpacesPluginStart; + actions: ActionsPluginStart; } export class FixturePlugin implements Plugin { diff --git a/x-pack/test/alerting_api_integration/common/fixtures/plugins/alerts/server/routes.ts b/x-pack/test/alerting_api_integration/common/fixtures/plugins/alerts/server/routes.ts index 5dc607bdbb69e..091034bd1df72 100644 --- a/x-pack/test/alerting_api_integration/common/fixtures/plugins/alerts/server/routes.ts +++ b/x-pack/test/alerting_api_integration/common/fixtures/plugins/alerts/server/routes.ts @@ -5,6 +5,7 @@ * 2.0. */ +import uuid from 'uuid'; import { CoreSetup, RequestHandlerContext, @@ -174,10 +175,10 @@ export function defineRoutes(core: CoreSetup, { logger }: { lo router.put( { - path: '/api/alerts_fixture/{id}/reschedule_task', + path: '/api/alerts_fixture/{taskId}/reschedule_task', validate: { params: schema.object({ - id: schema.string(), + taskId: schema.string(), }), body: schema.object({ runAt: schema.string(), @@ -189,23 +190,20 @@ export function defineRoutes(core: CoreSetup, { logger }: { lo req: KibanaRequest, res: KibanaResponseFactory ): Promise> => { - const { id } = req.params; + const { taskId } = req.params; const { runAt } = req.body; const [{ savedObjects }] = await core.getStartServices(); const savedObjectsWithTasksAndAlerts = await savedObjects.getScopedClient(req, { includedHiddenTypes: ['task', 'alert'], }); - const alert = await savedObjectsWithTasksAndAlerts.get('alert', id); const result = await retryIfConflicts( logger, - `/api/alerts_fixture/${id}/reschedule_task`, + `/api/alerts_fixture/${taskId}/reschedule_task`, async () => { - return await savedObjectsWithTasksAndAlerts.update( - 'task', - alert.attributes.scheduledTaskId!, - { runAt } - ); + return await savedObjectsWithTasksAndAlerts.update('task', taskId, { + runAt, + }); } ); return res.ok({ body: result }); @@ -278,4 +276,53 @@ export function defineRoutes(core: CoreSetup, { logger }: { lo } } ); + + router.post( + { + path: '/api/alerts_fixture/{id}/enqueue_action', + validate: { + params: schema.object({ + id: schema.string(), + }), + body: schema.object({ + params: schema.recordOf(schema.string(), schema.any()), + }), + }, + }, + async ( + context: RequestHandlerContext, + req: KibanaRequest, + res: KibanaResponseFactory + ): Promise> => { + try { + const [, { actions, security, spaces }] = await core.getStartServices(); + const actionsClient = await actions.getActionsClientWithRequest(req); + + const createAPIKeyResult = + security && + (await security.authc.apiKeys.grantAsInternalUser(req, { + name: `alerts_fixture:enqueue_action:${uuid.v4()}`, + role_descriptors: {}, + })); + + await actionsClient.enqueueExecution({ + id: req.params.id, + spaceId: spaces ? spaces.spacesService.getSpaceId(req) : 'default', + apiKey: createAPIKeyResult + ? Buffer.from(`${createAPIKeyResult.id}:${createAPIKeyResult.api_key}`).toString( + 'base64' + ) + : null, + params: req.body.params, + source: { + type: 'HTTP_REQUEST' as any, + source: req, + }, + }); + return res.noContent(); + } catch (err) { + return res.badRequest({ body: err }); + } + } + ); } diff --git a/x-pack/test/alerting_api_integration/security_and_spaces/tests/alerting/rbac_legacy.ts b/x-pack/test/alerting_api_integration/security_and_spaces/tests/alerting/rbac_legacy.ts index fb32be12500ca..53ea2b845af1f 100644 --- a/x-pack/test/alerting_api_integration/security_and_spaces/tests/alerting/rbac_legacy.ts +++ b/x-pack/test/alerting_api_integration/security_and_spaces/tests/alerting/rbac_legacy.ts @@ -177,12 +177,22 @@ export default function alertTests({ getService }: FtrProviderContext) { 'pre-7.10.0' ); + // Get scheduled task id + const getResponse = await supertestWithoutAuth + .get(`${getUrlPrefix(space.id)}/api/alerting/rule/${alertId}`) + .auth(user.username, user.password) + .expect(200); + // loading the archive likely caused the task to fail so ensure it's rescheduled to run in 2 seconds, // otherwise this test will stall for 5 minutes // no other attributes are touched, only runAt, so unless it would have ran when runAt expired, it // won't run now await supertest - .put(`${getUrlPrefix(space.id)}/api/alerts_fixture/${alertId}/reschedule_task`) + .put( + `${getUrlPrefix(space.id)}/api/alerts_fixture/${ + getResponse.body.scheduled_task_id + }/reschedule_task` + ) .set('kbn-xsrf', 'foo') .send({ runAt: getRunAt(2000), diff --git a/x-pack/test/alerting_api_integration/spaces_only/tests/actions/enqueue.ts b/x-pack/test/alerting_api_integration/spaces_only/tests/actions/enqueue.ts new file mode 100644 index 0000000000000..b6e47df315273 --- /dev/null +++ b/x-pack/test/alerting_api_integration/spaces_only/tests/actions/enqueue.ts @@ -0,0 +1,142 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import expect from '@kbn/expect'; +import { Spaces } from '../../scenarios'; +import { + ESTestIndexTool, + ES_TEST_INDEX_NAME, + getUrlPrefix, + ObjectRemover, +} from '../../../common/lib'; +import { FtrProviderContext } from '../../../common/ftr_provider_context'; + +// eslint-disable-next-line import/no-default-export +export default function ({ getService }: FtrProviderContext) { + const supertest = getService('supertest'); + const es = getService('legacyEs'); + const retry = getService('retry'); + const esTestIndexTool = new ESTestIndexTool(es, retry); + + describe('enqueue', () => { + const objectRemover = new ObjectRemover(supertest); + + before(async () => { + await esTestIndexTool.destroy(); + await esTestIndexTool.setup(); + }); + after(async () => { + await esTestIndexTool.destroy(); + await objectRemover.removeAll(); + }); + + it('should handle enqueue request appropriately', async () => { + const { body: createdAction } = await supertest + .post(`${getUrlPrefix(Spaces.space1.id)}/api/actions/connector`) + .set('kbn-xsrf', 'foo') + .send({ + name: 'My action', + connector_type_id: 'test.index-record', + config: { + unencrypted: `This value shouldn't get encrypted`, + }, + secrets: { + encrypted: 'This value should be encrypted', + }, + }) + .expect(200); + objectRemover.add(Spaces.space1.id, createdAction.id, 'action', 'actions'); + + const reference = `actions-enqueue-1:${Spaces.space1.id}:${createdAction.id}`; + const response = await supertest + .post( + `${getUrlPrefix(Spaces.space1.id)}/api/alerts_fixture/${createdAction.id}/enqueue_action` + ) + .set('kbn-xsrf', 'foo') + .send({ + params: { + reference, + index: ES_TEST_INDEX_NAME, + message: 'Testing 123', + }, + }); + + expect(response.status).to.eql(204); + await esTestIndexTool.waitForDocs('action:test.index-record', reference, 1); + }); + + it('should cleanup task after a failure', async () => { + const testStart = new Date(); + const { body: createdAction } = await supertest + .post(`${getUrlPrefix(Spaces.space1.id)}/api/actions/connector`) + .set('kbn-xsrf', 'foo') + .send({ + name: 'My action', + connector_type_id: 'test.failing', + config: {}, + secrets: {}, + }) + .expect(200); + objectRemover.add(Spaces.space1.id, createdAction.id, 'action', 'actions'); + + const reference = `actions-enqueue-2:${Spaces.space1.id}:${createdAction.id}`; + await supertest + .post( + `${getUrlPrefix(Spaces.space1.id)}/api/alerts_fixture/${createdAction.id}/enqueue_action` + ) + .set('kbn-xsrf', 'foo') + .send({ + params: { + reference, + index: ES_TEST_INDEX_NAME, + }, + }) + .expect(204); + + await esTestIndexTool.waitForDocs('action:test.failing', reference, 1); + + await supertest + .put( + `${getUrlPrefix( + Spaces.space1.id + )}/api/alerts_fixture/Actions-cleanup_failed_action_executions/reschedule_task` + ) + .set('kbn-xsrf', 'foo') + .send({ + runAt: new Date().toISOString(), + }) + .expect(200); + + await retry.try(async () => { + const searchResult = await es.search({ + index: '.kibana_task_manager', + body: { + query: { + bool: { + must: [ + { + term: { + 'task.taskType': 'actions:test.failing', + }, + }, + { + range: { + 'task.scheduledAt': { + gte: testStart, + }, + }, + }, + ], + }, + }, + }, + }); + expect(searchResult.hits.total.value).to.eql(0); + }); + }); + }); +} diff --git a/x-pack/test/alerting_api_integration/spaces_only/tests/actions/index.ts b/x-pack/test/alerting_api_integration/spaces_only/tests/actions/index.ts index 43f442c131626..fc0b23290a865 100644 --- a/x-pack/test/alerting_api_integration/spaces_only/tests/actions/index.ts +++ b/x-pack/test/alerting_api_integration/spaces_only/tests/actions/index.ts @@ -21,6 +21,7 @@ export default function actionsTests({ loadTestFile, getService }: FtrProviderCo loadTestFile(require.resolve('./connector_types')); loadTestFile(require.resolve('./update')); loadTestFile(require.resolve('./execute')); + loadTestFile(require.resolve('./enqueue')); loadTestFile(require.resolve('./builtin_action_types/es_index')); loadTestFile(require.resolve('./builtin_action_types/webhook')); loadTestFile(require.resolve('./builtin_action_types/preconfigured_alert_history_connector')); diff --git a/x-pack/test/alerting_api_integration/spaces_only/tests/alerting/builtin_alert_types/es_query/alert.ts b/x-pack/test/alerting_api_integration/spaces_only/tests/alerting/builtin_alert_types/es_query/alert.ts index 8511bcdf89d3b..ebc03ffb0e952 100644 --- a/x-pack/test/alerting_api_integration/spaces_only/tests/alerting/builtin_alert_types/es_query/alert.ts +++ b/x-pack/test/alerting_api_integration/spaces_only/tests/alerting/builtin_alert_types/es_query/alert.ts @@ -53,9 +53,6 @@ export default function alertTests({ getService }: FtrProviderContext) { // write documents in the future, figure out the end date const endDateMillis = Date.now() + (ALERT_INTERVALS_TO_WRITE - 1) * ALERT_INTERVAL_MILLIS; endDate = new Date(endDateMillis).toISOString(); - - // write documents from now to the future end date in groups - createEsDocumentsInGroups(ES_GROUPS_TO_WRITE); }); afterEach(async () => { @@ -65,6 +62,9 @@ export default function alertTests({ getService }: FtrProviderContext) { }); it('runs correctly: threshold on hit count < >', async () => { + // write documents from now to the future end date in groups + createEsDocumentsInGroups(ES_GROUPS_TO_WRITE); + await createAlert({ name: 'never fire', esQuery: `{\n \"query\":{\n \"match_all\" : {}\n }\n}`, @@ -104,6 +104,9 @@ export default function alertTests({ getService }: FtrProviderContext) { }); it('runs correctly with query: threshold on hit count < >', async () => { + // write documents from now to the future end date in groups + createEsDocumentsInGroups(ES_GROUPS_TO_WRITE); + const rangeQuery = (rangeThreshold: number) => { return { query: { @@ -126,8 +129,8 @@ export default function alertTests({ getService }: FtrProviderContext) { name: 'never fire', esQuery: JSON.stringify(rangeQuery(ES_GROUPS_TO_WRITE * ALERT_INTERVALS_TO_WRITE + 1)), size: 100, - thresholdComparator: '>=', - threshold: [0], + thresholdComparator: '<', + threshold: [-1], }); await createAlert({ @@ -154,6 +157,37 @@ export default function alertTests({ getService }: FtrProviderContext) { } }); + it('runs correctly: no matches', async () => { + await createAlert({ + name: 'always fire', + esQuery: `{\n \"query\":{\n \"match_all\" : {}\n }\n}`, + size: 100, + thresholdComparator: '<', + threshold: [1], + }); + + const docs = await waitForDocs(1); + for (let i = 0; i < docs.length; i++) { + const doc = docs[i]; + const { previousTimestamp, hits } = doc._source; + const { name, title, message } = doc._source.params; + + expect(name).to.be('always fire'); + expect(title).to.be(`alert 'always fire' matched query`); + const messagePattern = /alert 'always fire' is active:\n\n- Value: 0+\n- Conditions Met: Number of matching documents is less than 1 over 15s\n- Timestamp: \d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}.\d{3}Z/; + expect(message).to.match(messagePattern); + expect(hits).to.be.empty(); + + // during the first execution, the latestTimestamp value should be empty + // since this alert always fires, the latestTimestamp value should be updated each execution + if (!i) { + expect(previousTimestamp).to.be.empty(); + } else { + expect(previousTimestamp).not.to.be.empty(); + } + } + }); + async function createEsDocumentsInGroups(groups: number) { await createEsDocuments( es, diff --git a/x-pack/test/api_integration/apis/ml/system/capabilities.ts b/x-pack/test/api_integration/apis/ml/system/capabilities.ts index d8ab2a30ef7fb..aa1ab2016fcb5 100644 --- a/x-pack/test/api_integration/apis/ml/system/capabilities.ts +++ b/x-pack/test/api_integration/apis/ml/system/capabilities.ts @@ -45,7 +45,7 @@ export default ({ getService }: FtrProviderContext) => { it('should have the right number of capabilities', async () => { const { capabilities } = await runRequest(USER.ML_POWERUSER); - expect(Object.keys(capabilities).length).to.eql(29); + expect(Object.keys(capabilities).length).to.eql(30); }); it('should get viewer capabilities', async () => { @@ -72,6 +72,7 @@ export default ({ getService }: FtrProviderContext) => { canDeleteDataFrameAnalytics: false, canStartStopDataFrameAnalytics: false, canCreateMlAlerts: false, + canUseMlAlerts: true, canAccessML: true, canGetJobs: true, canGetDatafeeds: true, @@ -108,6 +109,7 @@ export default ({ getService }: FtrProviderContext) => { canDeleteDataFrameAnalytics: true, canStartStopDataFrameAnalytics: true, canCreateMlAlerts: true, + canUseMlAlerts: true, canAccessML: true, canGetJobs: true, canGetDatafeeds: true, diff --git a/x-pack/test/api_integration/apis/ml/system/space_capabilities.ts b/x-pack/test/api_integration/apis/ml/system/space_capabilities.ts index cd922bf4bae92..b9ca7794b7cd9 100644 --- a/x-pack/test/api_integration/apis/ml/system/space_capabilities.ts +++ b/x-pack/test/api_integration/apis/ml/system/space_capabilities.ts @@ -71,11 +71,11 @@ export default ({ getService }: FtrProviderContext) => { it('should have the right number of capabilities - space with ML', async () => { const { capabilities } = await runRequest(USER.ML_POWERUSER, idSpaceWithMl); - expect(Object.keys(capabilities).length).to.eql(29); + expect(Object.keys(capabilities).length).to.eql(30); }); it('should have the right number of capabilities - space without ML', async () => { const { capabilities } = await runRequest(USER.ML_POWERUSER, idSpaceNoMl); - expect(Object.keys(capabilities).length).to.eql(29); + expect(Object.keys(capabilities).length).to.eql(30); }); it('should get viewer capabilities - space with ML', async () => { @@ -101,6 +101,7 @@ export default ({ getService }: FtrProviderContext) => { canDeleteDataFrameAnalytics: false, canStartStopDataFrameAnalytics: false, canCreateMlAlerts: false, + canUseMlAlerts: true, canAccessML: true, canGetJobs: true, canGetDatafeeds: true, @@ -136,6 +137,7 @@ export default ({ getService }: FtrProviderContext) => { canDeleteDataFrameAnalytics: false, canStartStopDataFrameAnalytics: false, canCreateMlAlerts: false, + canUseMlAlerts: false, canAccessML: false, canGetJobs: false, canGetDatafeeds: false, @@ -171,6 +173,7 @@ export default ({ getService }: FtrProviderContext) => { canDeleteDataFrameAnalytics: true, canStartStopDataFrameAnalytics: true, canCreateMlAlerts: true, + canUseMlAlerts: true, canAccessML: true, canGetJobs: true, canGetDatafeeds: true, @@ -206,6 +209,7 @@ export default ({ getService }: FtrProviderContext) => { canDeleteDataFrameAnalytics: false, canStartStopDataFrameAnalytics: false, canCreateMlAlerts: false, + canUseMlAlerts: false, canAccessML: false, canGetJobs: false, canGetDatafeeds: false, diff --git a/x-pack/test/api_integration/apis/monitoring/apm/fixtures/cluster.json b/x-pack/test/api_integration/apis/monitoring/apm/fixtures/cluster.json index 4b12c5bc12e88..197d8f8fe6c2c 100644 --- a/x-pack/test/api_integration/apis/monitoring/apm/fixtures/cluster.json +++ b/x-pack/test/api_integration/apis/monitoring/apm/fixtures/cluster.json @@ -1052,6 +1052,107 @@ ] ] } + ], + "apm_memory_cgroup": [ + { + "bucket_size": "30 seconds", + "data": [ + [ + 1535723880000, + null + ], + [ + 1535723910000, + null + ], + [ + 1535723940000, + null + ] + ], + "metric": { + "app": "apm", + "description": "Memory usage of the container", + "field": "beats_stats.metrics.beat.cgroup.memory.mem.usage.bytes", + "format": "0,0.0 b", + "hasCalculation": false, + "isDerivative": false, + "label": "Memory Utilization (cgroup)", + "metricAgg": "max", + "title": "Memory", + "units": "B" + }, + "timeRange": { + "max": 1535723989104, + "min": 1535720389104 + } + }, + { + "bucket_size": "30 seconds", + "data": [ + [ + 1535723880000, + null + ], + [ + 1535723910000, + null + ], + [ + 1535723940000, + null + ] + ], + "metric": { + "app": "apm", + "description": "Memory limit of the container", + "field": "beats_stats.metrics.beat.cgroup.memory.mem.limit.bytes", + "format": "0,0.0 b", + "hasCalculation": false, + "isDerivative": false, + "label": "Memory Limit", + "metricAgg": "max", + "title": "Memory", + "units": "B" + }, + "timeRange": { + "max": 1535723989104, + "min": 1535720389104 + } + }, + { + "bucket_size": "30 seconds", + "data": [ + [ + 1535723880000, + 5212816 + ], + [ + 1535723910000, + 4996912 + ], + [ + 1535723940000, + 4886176 + ] + ], + "metric": { + "app": "apm", + "description": "Limit of allocated memory at which garbage collection will occur", + "field": "beats_stats.metrics.beat.memstats.gc_next", + "format": "0,0.0 b", + "hasCalculation": false, + "isDerivative": false, + "label": "GC Next", + "metricAgg": "max", + "title": "Memory", + "units": "B" + }, + "timeRange": { + "max": 1535723989104, + "min": 1535720389104 + } + } ] } } diff --git a/x-pack/test/api_integration/apis/monitoring/apm/fixtures/instance.json b/x-pack/test/api_integration/apis/monitoring/apm/fixtures/instance.json index 8fc5c0fb88e2a..d0b1428868f69 100644 --- a/x-pack/test/api_integration/apis/monitoring/apm/fixtures/instance.json +++ b/x-pack/test/api_integration/apis/monitoring/apm/fixtures/instance.json @@ -147,7 +147,7 @@ "isDerivative": false }, "data": [ - [1535723880000, 4996912], + [1535723880000, 5212816], [1535723910000, 4996912], [1535723940000, 4886176] ] @@ -884,6 +884,107 @@ [1535723940000, 0] ] } + ], + "apm_memory_cgroup": [ + { + "bucket_size": "30 seconds", + "data": [ + [ + 1535723880000, + null + ], + [ + 1535723910000, + null + ], + [ + 1535723940000, + null + ] + ], + "metric": { + "app": "apm", + "description": "Memory usage of the container", + "field": "beats_stats.metrics.beat.cgroup.memory.mem.usage.bytes", + "format": "0,0.0 b", + "hasCalculation": false, + "isDerivative": false, + "label": "Memory Utilization (cgroup)", + "metricAgg": "max", + "title": "Memory", + "units": "B" + }, + "timeRange": { + "max": 1535723989104, + "min": 1535720389104 + } + }, + { + "bucket_size": "30 seconds", + "data": [ + [ + 1535723880000, + null + ], + [ + 1535723910000, + null + ], + [ + 1535723940000, + null + ] + ], + "metric": { + "app": "apm", + "description": "Memory limit of the container", + "field": "beats_stats.metrics.beat.cgroup.memory.mem.limit.bytes", + "format": "0,0.0 b", + "hasCalculation": false, + "isDerivative": false, + "label": "Memory Limit", + "metricAgg": "max", + "title": "Memory", + "units": "B" + }, + "timeRange": { + "max": 1535723989104, + "min": 1535720389104 + } + }, + { + "bucket_size": "30 seconds", + "data": [ + [ + 1535723880000, + 5212816 + ], + [ + 1535723910000, + 4996912 + ], + [ + 1535723940000, + 4886176 + ] + ], + "metric": { + "app": "apm", + "description": "Limit of allocated memory at which garbage collection will occur", + "field": "beats_stats.metrics.beat.memstats.gc_next", + "format": "0,0.0 b", + "hasCalculation": false, + "isDerivative": false, + "label": "GC Next", + "metricAgg": "max", + "title": "Memory", + "units": "B" + }, + "timeRange": { + "max": 1535723989104, + "min": 1535720389104 + } + } ] }, "apmSummary": { diff --git a/x-pack/test/api_integration/apis/monitoring/apm/instance.js b/x-pack/test/api_integration/apis/monitoring/apm/instance.js index 23c11dd530985..5f603d25b7d69 100644 --- a/x-pack/test/api_integration/apis/monitoring/apm/instance.js +++ b/x-pack/test/api_integration/apis/monitoring/apm/instance.js @@ -9,6 +9,8 @@ import expect from '@kbn/expect'; import apmInstanceFixture from './fixtures/instance'; export default function ({ getService }) { + // Skipping for now since failure is unclear + return void 0; const supertest = getService('supertest'); const esArchiver = getService('esArchiver'); diff --git a/x-pack/test/api_integration/apis/search/session.ts b/x-pack/test/api_integration/apis/search/session.ts index 63a6a842fd9f7..d47199a0f1c1e 100644 --- a/x-pack/test/api_integration/apis/search/session.ts +++ b/x-pack/test/api_integration/apis/search/session.ts @@ -7,7 +7,7 @@ import expect from '@kbn/expect'; import { FtrProviderContext } from '../../ftr_provider_context'; -import { SearchSessionStatus } from '../../../../plugins/data_enhanced/common'; +import { SearchSessionStatus } from '../../../../../src/plugins/data/common'; export default function ({ getService }: FtrProviderContext) { const supertest = getService('supertest'); diff --git a/x-pack/test/api_integration/apis/security/license_downgrade.ts b/x-pack/test/api_integration/apis/security/license_downgrade.ts index 3017bd005b776..583df6ea5ed07 100644 --- a/x-pack/test/api_integration/apis/security/license_downgrade.ts +++ b/x-pack/test/api_integration/apis/security/license_downgrade.ts @@ -26,6 +26,7 @@ export default function ({ getService }: FtrProviderContext) { 'minimal_read', 'url_create', 'store_search_session', + 'generate_report', ]; const trialPrivileges = await supertest .get('/api/security/privileges') diff --git a/x-pack/test/api_integration/apis/security/privileges.ts b/x-pack/test/api_integration/apis/security/privileges.ts index 9df7eddfd0025..f08712e015656 100644 --- a/x-pack/test/api_integration/apis/security/privileges.ts +++ b/x-pack/test/api_integration/apis/security/privileges.ts @@ -29,8 +29,16 @@ export default function ({ getService }: FtrProviderContext) { 'minimal_read', 'url_create', 'store_search_session', + 'generate_report', + ], + visualize: [ + 'all', + 'read', + 'minimal_all', + 'minimal_read', + 'url_create', + 'generate_report', ], - visualize: ['all', 'read', 'minimal_all', 'minimal_read', 'url_create'], dashboard: [ 'all', 'read', @@ -38,6 +46,8 @@ export default function ({ getService }: FtrProviderContext) { 'minimal_read', 'url_create', 'store_search_session', + 'generate_report', + 'download_csv_report', ], dev_tools: ['all', 'read'], advancedSettings: ['all', 'read'], @@ -47,7 +57,7 @@ export default function ({ getService }: FtrProviderContext) { timelion: ['all', 'read'], graph: ['all', 'read'], maps: ['all', 'read'], - canvas: ['all', 'read'], + canvas: ['all', 'read', 'minimal_all', 'minimal_read', 'generate_report'], infrastructure: ['all', 'read'], logs: ['all', 'read'], uptime: ['all', 'read'], diff --git a/x-pack/test/api_integration/apis/security_solution/feature_controls.ts b/x-pack/test/api_integration/apis/security_solution/feature_controls.ts deleted file mode 100644 index da28e28dae769..0000000000000 --- a/x-pack/test/api_integration/apis/security_solution/feature_controls.ts +++ /dev/null @@ -1,203 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. - */ - -import expect from '@kbn/expect'; -import gql from 'graphql-tag'; -import { FtrProviderContext } from '../../ftr_provider_context'; - -const introspectionQuery = gql` - query Schema { - __schema { - queryType { - name - } - } - } -`; - -export default function ({ getService }: FtrProviderContext) { - const security = getService('security'); - const spaces = getService('spaces'); - const clientFactory = getService('securitySolutionGraphQLClientFactory'); - - const expectGraphQL403 = (result: any) => { - expect(result.response).to.be(undefined); - expect(result.error).not.to.be(undefined); - expect(result.error).to.have.property('networkError'); - expect(result.error.networkError).to.have.property('statusCode', 403); - }; - - const expectGraphQLResponse = (result: any) => { - expect(result.error).to.be(undefined); - expect(result.response).to.have.property('data'); - expect(result.response.data).to.be.an('object'); - }; - - const executeGraphQLQuery = async (username: string, password: string, spaceId?: string) => { - const queryOptions = { - query: introspectionQuery, - }; - - const basePath = spaceId ? `/s/${spaceId}` : ''; - - const client = clientFactory({ username, password, basePath }); - let error; - let response; - try { - response = await client.query(queryOptions); - } catch (err) { - error = err; - } - return { - error, - response, - }; - }; - - // FLAKY: https://github.com/elastic/kibana/issues/97355 - describe.skip('feature controls', () => { - it(`APIs can't be accessed by user with no privileges`, async () => { - const username = 'logstash_read'; - const roleName = 'logstash_read'; - const password = `${username}-password`; - try { - await security.role.create(roleName, {}); - - await security.user.create(username, { - password, - roles: [roleName], - full_name: 'a kibana user', - }); - - const graphQLResult = await executeGraphQLQuery(username, password); - expectGraphQL403(graphQLResult); - } finally { - await security.role.delete(roleName); - await security.user.delete(username); - } - }); - - it('APIs can be accessed user with global "all" privileges', async () => { - const username = 'global_all'; - const roleName = 'global_all'; - const password = `${username}-password`; - try { - await security.role.create(roleName, { - kibana: [ - { - base: ['all'], - spaces: ['*'], - }, - ], - }); - - await security.user.create(username, { - password, - roles: [roleName], - full_name: 'a kibana user', - }); - - const graphQLResult = await executeGraphQLQuery(username, password); - expectGraphQLResponse(graphQLResult); - } finally { - await security.role.delete(roleName); - await security.user.delete(username); - } - }); - - // this could be any role which doesn't have access to the siem feature - it(`APIs can't be accessed by user with dashboard "all" privileges`, async () => { - const username = 'dashboard_all'; - const roleName = 'dashboard_all'; - const password = `${username}-password`; - try { - await security.role.create(roleName, { - kibana: [ - { - feature: { - dashboard: ['all'], - }, - spaces: ['*'], - }, - ], - }); - - await security.user.create(username, { - password, - roles: [roleName], - full_name: 'a kibana user', - }); - - const graphQLResult = await executeGraphQLQuery(username, password); - expectGraphQL403(graphQLResult); - } finally { - await security.role.delete(roleName); - await security.user.delete(username); - } - }); - - describe('spaces', () => { - // the following tests create a user_1 which has siem read access to space_1 and dashboard all access to space_2 - const space1Id = 'space_1'; - const space2Id = 'space_2'; - - const roleName = 'user_1'; - const username = 'user_1'; - const password = 'user_1-password'; - - before(async () => { - await spaces.create({ - id: space1Id, - name: space1Id, - disabledFeatures: [], - }); - await spaces.create({ - id: space2Id, - name: space2Id, - disabledFeatures: [], - }); - await security.role.create(roleName, { - kibana: [ - { - feature: { - siem: ['read'], - }, - spaces: [space1Id], - }, - { - feature: { - dashboard: ['all'], - }, - spaces: [space2Id], - }, - ], - }); - await security.user.create(username, { - password, - roles: [roleName], - }); - }); - - after(async () => { - await spaces.delete(space1Id); - await spaces.delete(space2Id); - await security.role.delete(roleName); - await security.user.delete(username); - }); - - it('user_1 can access APIs in space_1', async () => { - const graphQLResult = await executeGraphQLQuery(username, password, space1Id); - expectGraphQLResponse(graphQLResult); - }); - - it(`user_1 can't access APIs in space_2`, async () => { - const graphQLResult = await executeGraphQLQuery(username, password, space2Id); - expectGraphQL403(graphQLResult); - }); - }); - }); -} diff --git a/x-pack/test/api_integration/apis/security_solution/index.js b/x-pack/test/api_integration/apis/security_solution/index.js index 57fc712549859..18c315a3b8c3d 100644 --- a/x-pack/test/api_integration/apis/security_solution/index.js +++ b/x-pack/test/api_integration/apis/security_solution/index.js @@ -22,11 +22,10 @@ export default function ({ loadTestFile }) { loadTestFile(require.resolve('./saved_objects/pinned_events')); loadTestFile(require.resolve('./saved_objects/timeline')); loadTestFile(require.resolve('./sources')); - // loadTestFile(require.resolve('./timeline')); + loadTestFile(require.resolve('./timeline')); loadTestFile(require.resolve('./timeline_details')); loadTestFile(require.resolve('./uncommon_processes')); loadTestFile(require.resolve('./users')); loadTestFile(require.resolve('./tls')); - loadTestFile(require.resolve('./feature_controls')); }); } diff --git a/x-pack/test/api_integration/apis/security_solution/kpi_hosts.ts b/x-pack/test/api_integration/apis/security_solution/kpi_hosts.ts index f2e597912c4e1..ff395f056354e 100644 --- a/x-pack/test/api_integration/apis/security_solution/kpi_hosts.ts +++ b/x-pack/test/api_integration/apis/security_solution/kpi_hosts.ts @@ -10,13 +10,14 @@ import { HostsKpiQueries } from '../../../../plugins/security_solution/common/se import { FtrProviderContext } from '../../ftr_provider_context'; export default function ({ getService }: FtrProviderContext) { + const retry = getService('retry'); const esArchiver = getService('esArchiver'); const supertest = getService('supertest'); describe('Kpi Hosts', () => { describe('With filebeat', () => { - before(() => esArchiver.load('filebeat/default')); - after(() => esArchiver.unload('filebeat/default')); + before(() => esArchiver.load('filebeat/kpi_hosts')); + after(() => esArchiver.unload('filebeat/kpi_hosts')); const FROM = '2000-01-01T00:00:00.000Z'; const TO = '3000-01-01T00:00:00.000Z'; @@ -24,19 +25,7 @@ export default function ({ getService }: FtrProviderContext) { hosts: 1, hostsHistogram: [ { - x: new Date('2019-02-09T16:00:00.000Z').valueOf(), - y: 1, - }, - { - x: new Date('2019-02-09T19:00:00.000Z').valueOf(), - y: 0, - }, - { - x: new Date('2019-02-09T22:00:00.000Z').valueOf(), - y: 1, - }, - { - x: new Date('2019-02-10T01:00:00.000Z').valueOf(), + x: new Date('2019-02-09T16:45:06.000Z').valueOf(), y: 1, }, ], @@ -44,246 +33,234 @@ export default function ({ getService }: FtrProviderContext) { authSuccessHistogram: null, authFailure: 0, authFailureHistogram: null, - uniqueSourceIps: 121, + uniqueSourceIps: 1, uniqueSourceIpsHistogram: [ { - x: new Date('2019-02-09T16:00:00.000Z').valueOf(), - y: 52, - }, - { - x: new Date('2019-02-09T19:00:00.000Z').valueOf(), - y: 0, - }, - { - x: new Date('2019-02-09T22:00:00.000Z').valueOf(), - y: 31, - }, - { - x: new Date('2019-02-10T01:00:00.000Z').valueOf(), - y: 88, + x: new Date('2019-02-09T16:45:06.000Z').valueOf(), + y: 1, }, ], - uniqueDestinationIps: 154, + uniqueDestinationIps: 1, uniqueDestinationIpsHistogram: [ { - x: new Date('2019-02-09T16:00:00.000Z').valueOf(), - y: 61, - }, - { - x: new Date('2019-02-09T19:00:00.000Z').valueOf(), - y: 0, - }, - { - x: new Date('2019-02-09T22:00:00.000Z').valueOf(), - y: 45, - }, - { - x: new Date('2019-02-10T01:00:00.000Z').valueOf(), - y: 114, + x: new Date('2019-02-09T16:45:06.000Z').valueOf(), + y: 1, }, ], }; it('Make sure that we get KpiHosts data', async () => { - const { body: kpiHosts } = await supertest - .post('/internal/search/securitySolutionSearchStrategy/') - .set('kbn-xsrf', 'true') - .send({ - factoryQueryType: HostsKpiQueries.kpiHosts, - timerange: { - interval: '12h', - to: TO, - from: FROM, - }, - defaultIndex: ['filebeat-*'], - docValueFields: [], - inspect: false, - wait_for_completion_timeout: '10s', - }) - .expect(200); + await retry.try(async () => { + const { body: kpiHosts } = await supertest + .post('/internal/search/securitySolutionSearchStrategy/') + .set('kbn-xsrf', 'true') + .send({ + factoryQueryType: HostsKpiQueries.kpiHosts, + timerange: { + interval: '12h', + to: TO, + from: FROM, + }, + defaultIndex: ['filebeat-*'], + docValueFields: [], + inspect: false, + wait_for_completion_timeout: '10s', + }) + .expect(200); - expect(kpiHosts.hostsHistogram!).to.eql(expectedResult.hostsHistogram); - expect(kpiHosts.hosts!).to.eql(expectedResult.hosts); + expect(kpiHosts.hostsHistogram!).to.eql(expectedResult.hostsHistogram); + expect(kpiHosts.hosts!).to.eql(expectedResult.hosts); + }); }); it('Make sure that we get KpiAuthentications data', async () => { - const { body } = await supertest - .post('/internal/search/securitySolutionSearchStrategy/') - .set('kbn-xsrf', 'true') - .send({ - factoryQueryType: HostsKpiQueries.kpiAuthentications, - timerange: { - interval: '12h', - to: TO, - from: FROM, - }, - defaultIndex: ['filebeat-*'], - docValueFields: [], - inspect: false, - /* We need a very long timeout to avoid returning just partial data. - ** https://github.com/elastic/kibana/blob/master/x-pack/test/api_integration/apis/search/search.ts#L18 - */ - wait_for_completion_timeout: '10s', - }) - .expect(200); - expect(body.authenticationsSuccess!).to.eql(expectedResult.authSuccess); - expect(body.authenticationsSuccessHistogram!).to.eql(expectedResult.authSuccessHistogram); - expect(body.authenticationsFailure!).to.eql(expectedResult.authFailure); - expect(body.authenticationsFailureHistogram!).to.eql(expectedResult.authFailureHistogram); + await retry.try(async () => { + const { body } = await supertest + .post('/internal/search/securitySolutionSearchStrategy/') + .set('kbn-xsrf', 'true') + .send({ + factoryQueryType: HostsKpiQueries.kpiAuthentications, + timerange: { + interval: '12h', + to: TO, + from: FROM, + }, + defaultIndex: ['filebeat-*'], + docValueFields: [], + inspect: false, + /* We need a very long timeout to avoid returning just partial data. + ** https://github.com/elastic/kibana/blob/master/x-pack/test/api_integration/apis/search/search.ts#L18 + */ + wait_for_completion_timeout: '10s', + }) + .expect(200); + expect(body.authenticationsSuccess!).to.eql(expectedResult.authSuccess); + expect(body.authenticationsSuccessHistogram!).to.eql(expectedResult.authSuccessHistogram); + expect(body.authenticationsFailure!).to.eql(expectedResult.authFailure); + expect(body.authenticationsFailureHistogram!).to.eql(expectedResult.authFailureHistogram); + }); }); it('Make sure that we get KpiUniqueIps data', async () => { - const { body } = await supertest - .post('/internal/search/securitySolutionSearchStrategy/') - .set('kbn-xsrf', 'true') - .send({ - factoryQueryType: HostsKpiQueries.kpiUniqueIps, - timerange: { - interval: '12h', - to: TO, - from: FROM, - }, - defaultIndex: ['filebeat-*'], - docValueFields: [], - inspect: false, - wait_for_completion_timeout: '10s', - }) - .expect(200); - expect(body.uniqueDestinationIps!).to.eql(expectedResult.uniqueDestinationIps); - expect(body.uniqueDestinationIpsHistogram!).to.eql( - expectedResult.uniqueDestinationIpsHistogram - ); - expect(body.uniqueSourceIps!).to.eql(expectedResult.uniqueSourceIps); - expect(body.uniqueSourceIpsHistogram!).to.eql(expectedResult.uniqueSourceIpsHistogram); + await retry.try(async () => { + const { body } = await supertest + .post('/internal/search/securitySolutionSearchStrategy/') + .set('kbn-xsrf', 'true') + .send({ + factoryQueryType: HostsKpiQueries.kpiUniqueIps, + timerange: { + interval: '12h', + to: TO, + from: FROM, + }, + defaultIndex: ['filebeat-*'], + docValueFields: [], + inspect: false, + wait_for_completion_timeout: '10s', + }) + .expect(200); + expect(body.uniqueDestinationIps!).to.eql(expectedResult.uniqueDestinationIps); + expect(body.uniqueDestinationIpsHistogram!).to.eql( + expectedResult.uniqueDestinationIpsHistogram + ); + expect(body.uniqueSourceIps!).to.eql(expectedResult.uniqueSourceIps); + expect(body.uniqueSourceIpsHistogram!).to.eql(expectedResult.uniqueSourceIpsHistogram); + }); }); }); describe('With auditbeat', () => { - before(() => esArchiver.load('auditbeat/default')); - after(() => esArchiver.unload('auditbeat/default')); + before(() => esArchiver.load('auditbeat/kpi_hosts')); + after(() => esArchiver.unload('auditbeat/kpi_hosts')); const FROM = '2000-01-01T00:00:00.000Z'; const TO = '3000-01-01T00:00:00.000Z'; const expectedResult = { - hosts: 6, + hosts: 3, hostsHistogram: [ { x: new Date('2018-11-27T00:00:00.000Z').valueOf(), - y: 6, + y: 1, }, { x: new Date('2018-11-27T00:30:00.000Z').valueOf(), - y: 6, + y: 0, }, { x: new Date('2018-11-27T01:00:00.000Z').valueOf(), - y: 6, + y: 0, }, { x: new Date('2018-11-27T01:30:00.000Z').valueOf(), - y: 6, + y: 0, }, { x: new Date('2018-11-27T02:00:00.000Z').valueOf(), - y: 6, + y: 1, }, { x: new Date('2018-11-27T02:30:00.000Z').valueOf(), - y: 6, + y: 1, }, ], authSuccess: 0, authSuccessHistogram: null, authFailure: 0, authFailureHistogram: null, - uniqueSourceIps: 370, + uniqueSourceIps: 3, uniqueSourceIpsHistogram: [ - { x: 1543276800000, y: 74 }, - { x: 1543278600000, y: 52 }, - { x: 1543280400000, y: 71 }, - { x: 1543282200000, y: 76 }, - { x: 1543284000000, y: 71 }, - { x: 1543285800000, y: 89 }, + { x: 1543276800000, y: 1 }, + { x: 1543278600000, y: 0 }, + { x: 1543280400000, y: 0 }, + { x: 1543282200000, y: 0 }, + { x: 1543284000000, y: 1 }, + { x: 1543285800000, y: 1 }, ], - uniqueDestinationIps: 1, + uniqueDestinationIps: 0, uniqueDestinationIpsHistogram: [ { x: 1543276800000, y: 0 }, { x: 1543278600000, y: 0 }, { x: 1543280400000, y: 0 }, { x: 1543282200000, y: 0 }, { x: 1543284000000, y: 0 }, - { x: 1543285800000, y: 1 }, + { x: 1543285800000, y: 0 }, ], }; it('Make sure that we get KpiHosts data', async () => { - const { body: kpiHosts } = await supertest - .post('/internal/search/securitySolutionSearchStrategy/') - .set('kbn-xsrf', 'true') - .send({ - factoryQueryType: HostsKpiQueries.kpiHosts, - timerange: { - interval: '12h', - to: TO, - from: FROM, - }, - defaultIndex: ['auditbeat-*'], - docValueFields: [], - inspect: false, - wait_for_completion_timeout: '10s', - }) - .expect(200); + await retry.try(async () => { + const { body: kpiHosts } = await supertest + .post('/internal/search/securitySolutionSearchStrategy/') + .set('kbn-xsrf', 'true') + .send({ + factoryQueryType: HostsKpiQueries.kpiHosts, + timerange: { + interval: '12h', + to: TO, + from: FROM, + }, + defaultIndex: ['auditbeat-*'], + docValueFields: [], + inspect: false, + wait_for_completion_timeout: '10s', + }) + .expect(200); - expect(kpiHosts.hostsHistogram!).to.eql(expectedResult.hostsHistogram); - expect(kpiHosts.hosts!).to.eql(expectedResult.hosts); + expect(kpiHosts.hostsHistogram!).to.eql(expectedResult.hostsHistogram); + expect(kpiHosts.hosts!).to.eql(expectedResult.hosts); + }); }); it('Make sure that we get KpiAuthentications data', async () => { - const { body } = await supertest - .post('/internal/search/securitySolutionSearchStrategy/') - .set('kbn-xsrf', 'true') - .send({ - factoryQueryType: HostsKpiQueries.kpiAuthentications, - timerange: { - interval: '12h', - to: TO, - from: FROM, - }, - defaultIndex: ['auditbeat-*'], - docValueFields: [], - inspect: false, - wait_for_completion_timeout: '10s', - }) - .expect(200); - expect(body.authenticationsSuccess!).to.eql(expectedResult.authSuccess); - expect(body.authenticationsSuccessHistogram!).to.eql(expectedResult.authSuccessHistogram); - expect(body.authenticationsFailure!).to.eql(expectedResult.authFailure); - expect(body.authenticationsFailureHistogram!).to.eql(expectedResult.authFailureHistogram); + await retry.try(async () => { + const { body } = await supertest + .post('/internal/search/securitySolutionSearchStrategy/') + .set('kbn-xsrf', 'true') + .send({ + factoryQueryType: HostsKpiQueries.kpiAuthentications, + timerange: { + interval: '12h', + to: TO, + from: FROM, + }, + defaultIndex: ['auditbeat-*'], + docValueFields: [], + inspect: false, + wait_for_completion_timeout: '10s', + }) + .expect(200); + expect(body.authenticationsSuccess!).to.eql(expectedResult.authSuccess); + expect(body.authenticationsSuccessHistogram!).to.eql(expectedResult.authSuccessHistogram); + expect(body.authenticationsFailure!).to.eql(expectedResult.authFailure); + expect(body.authenticationsFailureHistogram!).to.eql(expectedResult.authFailureHistogram); + }); }); it('Make sure that we get KpiUniqueIps data', async () => { - const { body } = await supertest - .post('/internal/search/securitySolutionSearchStrategy/') - .set('kbn-xsrf', 'true') - .send({ - factoryQueryType: HostsKpiQueries.kpiUniqueIps, - timerange: { - interval: '12h', - to: TO, - from: FROM, - }, - defaultIndex: ['auditbeat-*'], - docValueFields: [], - inspect: false, - wait_for_completion_timeout: '10s', - }) - .expect(200); - expect(body.uniqueDestinationIps!).to.eql(expectedResult.uniqueDestinationIps); - expect(body.uniqueDestinationIpsHistogram!).to.eql( - expectedResult.uniqueDestinationIpsHistogram - ); - expect(body.uniqueSourceIps!).to.eql(expectedResult.uniqueSourceIps); - expect(body.uniqueSourceIpsHistogram!).to.eql(expectedResult.uniqueSourceIpsHistogram); + await retry.try(async () => { + const { body } = await supertest + .post('/internal/search/securitySolutionSearchStrategy/') + .set('kbn-xsrf', 'true') + .send({ + factoryQueryType: HostsKpiQueries.kpiUniqueIps, + timerange: { + interval: '12h', + to: TO, + from: FROM, + }, + defaultIndex: ['auditbeat-*'], + docValueFields: [], + inspect: false, + wait_for_completion_timeout: '10s', + }) + .expect(200); + expect(body.uniqueDestinationIps!).to.eql(expectedResult.uniqueDestinationIps); + expect(body.uniqueDestinationIpsHistogram!).to.eql( + expectedResult.uniqueDestinationIpsHistogram + ); + expect(body.uniqueSourceIps!).to.eql(expectedResult.uniqueSourceIps); + expect(body.uniqueSourceIpsHistogram!).to.eql(expectedResult.uniqueSourceIpsHistogram); + }); }); }); }); diff --git a/x-pack/test/api_integration/apis/security_solution/saved_objects/helpers.ts b/x-pack/test/api_integration/apis/security_solution/saved_objects/helpers.ts new file mode 100644 index 0000000000000..7265a2caf7dd8 --- /dev/null +++ b/x-pack/test/api_integration/apis/security_solution/saved_objects/helpers.ts @@ -0,0 +1,44 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import Supertest from 'supertest'; +import supertestAsPromised from 'supertest-as-promised'; +import uuid from 'uuid'; +import { TimelineType } from '../../../../../plugins/security_solution/common/types/timeline'; + +export const createBasicTimeline = async ( + supertest: Supertest.SuperTest, + titleToSaved: string +) => + await supertest + .post('/api/timeline') + .set('kbn-xsrf', 'true') + .send({ + timelineId: null, + version: null, + timeline: { + title: titleToSaved, + }, + }); + +export const createBasicTimelineTemplate = async ( + supertest: Supertest.SuperTest, + titleToSaved: string +) => + await supertest + .post('/api/timeline') + .set('kbn-xsrf', 'true') + .send({ + timelineId: null, + version: null, + timeline: { + title: titleToSaved, + templateTimelineId: uuid.v4(), + templateTimelineVersion: 1, + timelineType: TimelineType.template, + }, + }); diff --git a/x-pack/test/api_integration/apis/security_solution/saved_objects/notes.ts b/x-pack/test/api_integration/apis/security_solution/saved_objects/notes.ts index c2ec448c5b5c9..0d4f3a4fb9ea9 100644 --- a/x-pack/test/api_integration/apis/security_solution/saved_objects/notes.ts +++ b/x-pack/test/api_integration/apis/security_solution/saved_objects/notes.ts @@ -6,14 +6,12 @@ */ import expect from '@kbn/expect'; -import gql from 'graphql-tag'; import { FtrProviderContext } from '../../../ftr_provider_context'; -import { persistTimelineNoteMutation } from '../../../../../plugins/security_solution/public/timelines/containers/notes/persist.gql_query'; export default function ({ getService }: FtrProviderContext) { const esArchiver = getService('esArchiver'); - const client = getService('securitySolutionGraphQLClient'); + const supertest = getService('supertest'); describe('Note - Saved Objects', () => { beforeEach(() => esArchiver.load('empty_kibana')); @@ -22,16 +20,17 @@ export default function ({ getService }: FtrProviderContext) { describe('create a note', () => { it('should return a timelineId, timelineVersion, noteId and version', async () => { const myNote = 'world test'; - const response = await client.mutate({ - mutation: persistTimelineNoteMutation, - variables: { + const response = await supertest + .patch('/api/note') + .set('kbn-xsrf', 'true') + .send({ noteId: null, version: null, note: { note: myNote, timelineId: null }, - }, - }); + }); + const { note, noteId, timelineId, timelineVersion, version } = - response.data && response.data.persistNote.note; + response.body.data && response.body.data.persistNote.note; expect(note).to.be(myNote); expect(noteId).to.not.be.empty(); @@ -42,62 +41,32 @@ export default function ({ getService }: FtrProviderContext) { it('if noteId exist update note and return existing noteId and new version', async () => { const myNote = 'world test'; - const response = await client.mutate({ - mutation: persistTimelineNoteMutation, - variables: { + const response = await supertest + .patch('/api/note') + .set('kbn-xsrf', 'true') + .send({ noteId: null, version: null, note: { note: myNote, timelineId: null }, - }, - }); + }); - const { noteId, timelineId, version } = response.data && response.data.persistNote.note; + const { noteId, timelineId, version } = + response.body.data && response.body.data.persistNote.note; const myNewNote = 'new world test'; - const responseToTest = await client.mutate({ - mutation: persistTimelineNoteMutation, - variables: { + const responseToTest = await supertest + .patch('/api/note') + .set('kbn-xsrf', 'true') + .send({ noteId, version, note: { note: myNewNote, timelineId }, - }, - }); - - expect(responseToTest.data!.persistNote.note.note).to.be(myNewNote); - expect(responseToTest.data!.persistNote.note.noteId).to.be(noteId); - expect(responseToTest.data!.persistNote.note.version).to.not.be.eql(version); - }); - }); - - describe('Delete a note', () => { - it('one note', async () => { - const myNote = 'world test'; - const response = await client.mutate({ - mutation: persistTimelineNoteMutation, - variables: { - noteId: null, - version: null, - note: { note: myNote, timelineId: null }, - }, - }); + }); - const { noteId } = response.data && response.data.persistNote.note; - - const responseToTest = await client.mutate({ - mutation: deleteNoteMutation, - variables: { - id: [noteId], - }, - }); - - expect(responseToTest.data!.deleteNote).to.be(true); + expect(responseToTest.body.data!.persistNote.note.note).to.be(myNewNote); + expect(responseToTest.body.data!.persistNote.note.noteId).to.be(noteId); + expect(responseToTest.body.data!.persistNote.note.version).to.not.be.eql(version); }); }); }); } - -const deleteNoteMutation = gql` - mutation DeleteNoteMutation($id: [ID!]!) { - deleteNote(id: $id) - } -`; diff --git a/x-pack/test/api_integration/apis/security_solution/saved_objects/pinned_events.ts b/x-pack/test/api_integration/apis/security_solution/saved_objects/pinned_events.ts index 3f5bf9df7f06f..b77c654b038c2 100644 --- a/x-pack/test/api_integration/apis/security_solution/saved_objects/pinned_events.ts +++ b/x-pack/test/api_integration/apis/security_solution/saved_objects/pinned_events.ts @@ -8,11 +8,10 @@ import expect from '@kbn/expect'; import { FtrProviderContext } from '../../../ftr_provider_context'; -import { persistTimelinePinnedEventMutation } from '../../../../../plugins/security_solution/public/timelines/containers/pinned_event/persist.gql_query'; export default function ({ getService }: FtrProviderContext) { const esArchiver = getService('esArchiver'); - const client = getService('securitySolutionGraphQLClient'); + const supertest = getService('supertest'); describe('Pinned Events - Saved Objects', () => { beforeEach(() => esArchiver.load('empty_kibana')); @@ -20,15 +19,12 @@ export default function ({ getService }: FtrProviderContext) { describe('Pinned an event', () => { it('return a timelineId, timelineVersion, pinnedEventId and version', async () => { - const response = await client.mutate({ - mutation: persistTimelinePinnedEventMutation, - variables: { - pinnedEventId: null, - eventId: 'bv4QSGsB9v5HJNSH-7fi', - }, + const response = await supertest.patch('/api/pinned_event').set('kbn-xsrf', 'true').send({ + pinnedEventId: null, + eventId: 'bv4QSGsB9v5HJNSH-7fi', }); const { eventId, pinnedEventId, timelineId, timelineVersion, version } = - response.data && response.data.persistPinnedEventOnTimeline; + response.body.data && response.body.data.persistPinnedEventOnTimeline; expect(eventId).to.be('bv4QSGsB9v5HJNSH-7fi'); expect(pinnedEventId).to.not.be.empty(); @@ -40,25 +36,21 @@ export default function ({ getService }: FtrProviderContext) { describe('Unpinned an event', () => { it('return null', async () => { - const response = await client.mutate({ - mutation: persistTimelinePinnedEventMutation, - variables: { - pinnedEventId: null, - eventId: 'bv4QSGsB9v5HJNSH-7fi', - }, + const response = await supertest.patch('/api/pinned_event').set('kbn-xsrf', 'true').send({ + pinnedEventId: null, + eventId: 'bv4QSGsB9v5HJNSH-7fi', }); const { eventId, pinnedEventId } = - response.data && response.data.persistPinnedEventOnTimeline; + response.body.data && response.body.data.persistPinnedEventOnTimeline; - const responseToTest = await client.mutate({ - mutation: persistTimelinePinnedEventMutation, - variables: { + const responseToTest = await supertest + .patch('/api/pinned_event') + .set('kbn-xsrf', 'true') + .send({ pinnedEventId, eventId, - }, - }); - - expect(responseToTest.data!.persistPinnedEventOnTimeline).to.be(null); + }); + expect(responseToTest.body.data!.persistPinnedEventOnTimeline).to.be(null); }); }); }); diff --git a/x-pack/test/api_integration/apis/security_solution/saved_objects/timeline.ts b/x-pack/test/api_integration/apis/security_solution/saved_objects/timeline.ts index c5e9cfbf936ed..ed1d4719b9073 100644 --- a/x-pack/test/api_integration/apis/security_solution/saved_objects/timeline.ts +++ b/x-pack/test/api_integration/apis/security_solution/saved_objects/timeline.ts @@ -6,19 +6,18 @@ */ import expect from '@kbn/expect'; -import ApolloClient from 'apollo-client'; - import { FtrProviderContext } from '../../../ftr_provider_context'; -import { deleteTimelineMutation } from '../../../../../plugins/security_solution/public/timelines/containers/delete/persist.gql_query'; -import { persistTimelineFavoriteMutation } from '../../../../../plugins/security_solution/public/timelines/containers/favorite/persist.gql_query'; -import { persistTimelineMutation } from '../../../../../plugins/security_solution/public/timelines/containers/persist.gql_query'; -import { TimelineResult } from '../../../../../plugins/security_solution/public/graphql/types'; -import { TimelineType } from '../../../../../plugins/security_solution/common/types/timeline'; +import { + TimelineResult, + TimelineType, +} from '../../../../../plugins/security_solution/common/types/timeline'; + +import { createBasicTimeline } from './helpers'; export default function ({ getService }: FtrProviderContext) { const esArchiver = getService('esArchiver'); - const client = getService('securitySolutionGraphQLClient'); + const supertest = getService('supertest'); describe('Timeline - Saved Objects', () => { beforeEach(() => esArchiver.load('empty_kibana')); @@ -27,9 +26,9 @@ export default function ({ getService }: FtrProviderContext) { describe('Persist a timeline', () => { it('Create a timeline just with a title', async () => { const titleToSaved = 'hello title'; - const response = await createBasicTimeline(client, titleToSaved); + const response = await createBasicTimeline(supertest, titleToSaved); const { savedObjectId, title, version } = - response.data && response.data.persistTimeline.timeline; + response.body.data && response.body.data.persistTimeline.timeline; expect(title).to.be(titleToSaved); expect(savedObjectId).to.not.be.empty(); @@ -137,13 +136,11 @@ export default function ({ getService }: FtrProviderContext) { dateRange: { start: '2019-06-10T19:43:20.755Z', end: '2019-06-11T19:43:20.756Z' }, sort: { columnId: '@timestamp', sortDirection: 'desc' }, }; - const response = await client.mutate({ - mutation: persistTimelineMutation, - variables: { - timelineId: null, - version: null, - timeline: timelineObject, - }, + + const response = await supertest.post('/api/timeline').set('kbn-xsrf', 'true').send({ + timelineId: null, + version: null, + timeline: timelineObject, }); const { columns, @@ -156,7 +153,8 @@ export default function ({ getService }: FtrProviderContext) { sort, title, version, - } = response.data && omitTypenameInTimeline(response.data.persistTimeline.timeline); + } = + response.body.data && omitTypenameInTimeline(response.body.data.persistTimeline.timeline); expect(columns.map((col: { id: string }) => col.id)).to.eql( timelineObject.columns.map((col) => col.id) @@ -174,235 +172,245 @@ export default function ({ getService }: FtrProviderContext) { it('Update a timeline with a new title', async () => { const titleToSaved = 'hello title'; - const response = await createBasicTimeline(client, titleToSaved); - const { savedObjectId, version } = response.data && response.data.persistTimeline.timeline; + const response = await createBasicTimeline(supertest, titleToSaved); + const { savedObjectId, version } = + response.body.data && response.body.data.persistTimeline.timeline; const newTitle = 'new title'; - const responseToTest = await client.mutate({ - mutation: persistTimelineMutation, - variables: { + + const responseToTest = await supertest + .patch('/api/timeline') + .set('kbn-xsrf', 'true') + .send({ timelineId: savedObjectId, version, timeline: { title: newTitle, }, - }, - }); - - expect(responseToTest.data!.persistTimeline.timeline.savedObjectId).to.eql(savedObjectId); - expect(responseToTest.data!.persistTimeline.timeline.title).to.be(newTitle); - expect(responseToTest.data!.persistTimeline.timeline.version).to.not.be.eql(version); + }); + expect(responseToTest.body.data!.persistTimeline.timeline.savedObjectId).to.eql( + savedObjectId + ); + expect(responseToTest.body.data!.persistTimeline.timeline.title).to.be(newTitle); + expect(responseToTest.body.data!.persistTimeline.timeline.version).to.not.be.eql(version); }); }); describe('Persist favorite', () => { it('to an existing timeline', async () => { const titleToSaved = 'hello title'; - const response = await createBasicTimeline(client, titleToSaved); - const { savedObjectId, version } = response.data && response.data.persistTimeline.timeline; + const response = await createBasicTimeline(supertest, titleToSaved); - const responseToTest = await client.mutate({ - mutation: persistTimelineFavoriteMutation, - variables: { + const { savedObjectId, version } = + response.body.data && response.body.data.persistTimeline.timeline; + + const responseToTest = await supertest + .patch('/api/timeline/_favorite') + .set('kbn-xsrf', 'true') + .send({ timelineId: savedObjectId, templateTimelineId: null, templateTimelineVersion: null, timelineType: TimelineType.default, - }, - }); - - expect(responseToTest.data!.persistFavorite.savedObjectId).to.be(savedObjectId); - expect(responseToTest.data!.persistFavorite.favorite.length).to.be(1); - expect(responseToTest.data!.persistFavorite.version).to.not.be.eql(version); - expect(responseToTest.data!.persistFavorite.templateTimelineId).to.be.eql(null); - expect(responseToTest.data!.persistFavorite.templateTimelineVersion).to.be.eql(null); - expect(responseToTest.data!.persistFavorite.timelineType).to.be.eql(TimelineType.default); + }); + + expect(responseToTest.body.data!.persistFavorite.savedObjectId).to.be(savedObjectId); + expect(responseToTest.body.data!.persistFavorite.favorite.length).to.be(1); + expect(responseToTest.body.data!.persistFavorite.version).to.not.be.eql(version); + expect(responseToTest.body.data!.persistFavorite.templateTimelineId).to.be.eql(null); + expect(responseToTest.body.data!.persistFavorite.templateTimelineVersion).to.be.eql(null); + expect(responseToTest.body.data!.persistFavorite.timelineType).to.be.eql( + TimelineType.default + ); }); it('to an existing timeline template', async () => { const titleToSaved = 'hello title'; const templateTimelineIdFromStore = 'f4a90a2d-365c-407b-9fef-c1dcb33a6ab3'; const templateTimelineVersionFromStore = 1; - const response = await createBasicTimeline(client, titleToSaved); - const { savedObjectId, version } = response.data && response.data.persistTimeline.timeline; - - const responseToTest = await client.mutate({ - mutation: persistTimelineFavoriteMutation, - variables: { + const response = await createBasicTimeline(supertest, titleToSaved); + const { savedObjectId, version } = + response.body.data && response.body.data.persistTimeline.timeline; + + const responseToTest = await supertest + .patch('/api/timeline/_favorite') + .set('kbn-xsrf', 'true') + .send({ timelineId: savedObjectId, templateTimelineId: templateTimelineIdFromStore, templateTimelineVersion: templateTimelineVersionFromStore, timelineType: TimelineType.template, - }, - }); - - expect(responseToTest.data!.persistFavorite.savedObjectId).to.be(savedObjectId); - expect(responseToTest.data!.persistFavorite.favorite.length).to.be(1); - expect(responseToTest.data!.persistFavorite.version).to.not.be.eql(version); - expect(responseToTest.data!.persistFavorite.templateTimelineId).to.be.eql( + }); + expect(responseToTest.body.data!.persistFavorite.savedObjectId).to.be(savedObjectId); + expect(responseToTest.body.data!.persistFavorite.favorite.length).to.be(1); + expect(responseToTest.body.data!.persistFavorite.version).to.not.be.eql(version); + expect(responseToTest.body.data!.persistFavorite.templateTimelineId).to.be.eql( templateTimelineIdFromStore ); - expect(responseToTest.data!.persistFavorite.templateTimelineVersion).to.be.eql( + expect(responseToTest.body.data!.persistFavorite.templateTimelineVersion).to.be.eql( templateTimelineVersionFromStore ); - expect(responseToTest.data!.persistFavorite.timelineType).to.be.eql(TimelineType.template); + expect(responseToTest.body.data!.persistFavorite.timelineType).to.be.eql( + TimelineType.template + ); }); it('to Unfavorite an existing timeline', async () => { const titleToSaved = 'hello title'; - const response = await createBasicTimeline(client, titleToSaved); - const { savedObjectId, version } = response.data && response.data.persistTimeline.timeline; - - await client.mutate({ - mutation: persistTimelineFavoriteMutation, - variables: { - timelineId: savedObjectId, - templateTimelineId: null, - templateTimelineVersion: null, - timelineType: TimelineType.default, - }, + const response = await createBasicTimeline(supertest, titleToSaved); + const { savedObjectId, version } = + response.body.data && response.body.data.persistTimeline.timeline; + + await supertest.patch('/api/timeline/_favorite').set('kbn-xsrf', 'true').send({ + timelineId: savedObjectId, + templateTimelineId: null, + templateTimelineVersion: null, + timelineType: TimelineType.default, }); - const responseToTest = await client.mutate({ - mutation: persistTimelineFavoriteMutation, - variables: { + const responseToTest = await supertest + .patch('/api/timeline/_favorite') + .set('kbn-xsrf', 'true') + .send({ timelineId: savedObjectId, templateTimelineId: null, templateTimelineVersion: null, timelineType: TimelineType.default, - }, - }); - - expect(responseToTest.data!.persistFavorite.savedObjectId).to.be(savedObjectId); - expect(responseToTest.data!.persistFavorite.favorite).to.be.empty(); - expect(responseToTest.data!.persistFavorite.version).to.not.be.eql(version); - expect(responseToTest.data!.persistFavorite.templateTimelineId).to.be.eql(null); - expect(responseToTest.data!.persistFavorite.templateTimelineVersion).to.be.eql(null); - expect(responseToTest.data!.persistFavorite.timelineType).to.be.eql(TimelineType.default); + }); + + expect(responseToTest.body.data!.persistFavorite.savedObjectId).to.be(savedObjectId); + expect(responseToTest.body.data!.persistFavorite.favorite).to.be.empty(); + expect(responseToTest.body.data!.persistFavorite.version).to.not.be.eql(version); + expect(responseToTest.body.data!.persistFavorite.templateTimelineId).to.be.eql(null); + expect(responseToTest.body.data!.persistFavorite.templateTimelineVersion).to.be.eql(null); + expect(responseToTest.body.data!.persistFavorite.timelineType).to.be.eql( + TimelineType.default + ); }); it('to Unfavorite an existing timeline template', async () => { const titleToSaved = 'hello title'; const templateTimelineIdFromStore = 'f4a90a2d-365c-407b-9fef-c1dcb33a6ab3'; const templateTimelineVersionFromStore = 1; - const response = await createBasicTimeline(client, titleToSaved); - const { savedObjectId, version } = response.data && response.data.persistTimeline.timeline; - - await client.mutate({ - mutation: persistTimelineFavoriteMutation, - variables: { - timelineId: savedObjectId, - templateTimelineId: templateTimelineIdFromStore, - templateTimelineVersion: templateTimelineVersionFromStore, - timelineType: TimelineType.template, - }, + const response = await createBasicTimeline(supertest, titleToSaved); + const { savedObjectId, version } = + response.body.data && response.body.data.persistTimeline.timeline; + + await supertest.patch('/api/timeline/_favorite').set('kbn-xsrf', 'true').send({ + timelineId: savedObjectId, + templateTimelineId: templateTimelineIdFromStore, + templateTimelineVersion: templateTimelineVersionFromStore, + timelineType: TimelineType.template, }); - const responseToTest = await client.mutate({ - mutation: persistTimelineFavoriteMutation, - variables: { + const responseToTest = await supertest + .patch('/api/timeline/_favorite') + .set('kbn-xsrf', 'true') + .send({ timelineId: savedObjectId, templateTimelineId: templateTimelineIdFromStore, templateTimelineVersion: templateTimelineVersionFromStore, timelineType: TimelineType.template, - }, - }); + }); - expect(responseToTest.data!.persistFavorite.savedObjectId).to.be(savedObjectId); - expect(responseToTest.data!.persistFavorite.favorite).to.be.empty(); - expect(responseToTest.data!.persistFavorite.version).to.not.be.eql(version); - expect(responseToTest.data!.persistFavorite.templateTimelineId).to.be.eql( + expect(responseToTest.body.data!.persistFavorite.savedObjectId).to.be(savedObjectId); + expect(responseToTest.body.data!.persistFavorite.favorite).to.be.empty(); + expect(responseToTest.body.data!.persistFavorite.version).to.not.be.eql(version); + expect(responseToTest.body.data!.persistFavorite.templateTimelineId).to.be.eql( templateTimelineIdFromStore ); - expect(responseToTest.data!.persistFavorite.templateTimelineVersion).to.be.eql( + expect(responseToTest.body.data!.persistFavorite.templateTimelineVersion).to.be.eql( templateTimelineVersionFromStore ); - expect(responseToTest.data!.persistFavorite.timelineType).to.be.eql(TimelineType.template); + expect(responseToTest.body.data!.persistFavorite.timelineType).to.be.eql( + TimelineType.template + ); }); it('to a timeline without a timelineId', async () => { - const response = await client.mutate({ - mutation: persistTimelineFavoriteMutation, - variables: { + const response = await supertest + .patch('/api/timeline/_favorite') + .set('kbn-xsrf', 'true') + .send({ timelineId: null, templateTimelineId: null, templateTimelineVersion: null, timelineType: TimelineType.default, - }, - }); - - expect(response.data!.persistFavorite.savedObjectId).to.not.be.empty(); - expect(response.data!.persistFavorite.favorite.length).to.be(1); - expect(response.data!.persistFavorite.version).to.not.be.empty(); - expect(response.data!.persistFavorite.templateTimelineId).to.be.eql(null); - expect(response.data!.persistFavorite.templateTimelineVersion).to.be.eql(null); - expect(response.data!.persistFavorite.timelineType).to.be.eql(TimelineType.default); + }); + + expect(response.body.data!.persistFavorite.savedObjectId).to.not.be.empty(); + expect(response.body.data!.persistFavorite.favorite.length).to.be(1); + expect(response.body.data!.persistFavorite.version).to.not.be.empty(); + expect(response.body.data!.persistFavorite.templateTimelineId).to.be.eql(null); + expect(response.body.data!.persistFavorite.templateTimelineVersion).to.be.eql(null); + expect(response.body.data!.persistFavorite.timelineType).to.be.eql(TimelineType.default); }); it('to a timeline template without a timelineId', async () => { const templateTimelineIdFromStore = 'f4a90a2d-365c-407b-9fef-c1dcb33a6ab3'; const templateTimelineVersionFromStore = 1; - const response = await client.mutate({ - mutation: persistTimelineFavoriteMutation, - variables: { + + const response = await supertest + .patch('/api/timeline/_favorite') + .set('kbn-xsrf', 'true') + .send({ timelineId: null, templateTimelineId: templateTimelineIdFromStore, templateTimelineVersion: templateTimelineVersionFromStore, timelineType: TimelineType.template, - }, - }); + }); - expect(response.data!.persistFavorite.savedObjectId).to.not.be.empty(); - expect(response.data!.persistFavorite.favorite.length).to.be(1); - expect(response.data!.persistFavorite.version).to.not.be.empty(); - expect(response.data!.persistFavorite.templateTimelineId).to.be.eql( + expect(response.body.data!.persistFavorite.savedObjectId).to.not.be.empty(); + expect(response.body.data!.persistFavorite.favorite.length).to.be(1); + expect(response.body.data!.persistFavorite.version).to.not.be.empty(); + expect(response.body.data!.persistFavorite.templateTimelineId).to.be.eql( templateTimelineIdFromStore ); - expect(response.data!.persistFavorite.templateTimelineVersion).to.be.eql( + expect(response.body.data!.persistFavorite.templateTimelineVersion).to.be.eql( templateTimelineVersionFromStore ); - expect(response.data!.persistFavorite.timelineType).to.be.eql(TimelineType.template); + expect(response.body.data!.persistFavorite.timelineType).to.be.eql(TimelineType.template); }); }); describe('Delete', () => { it('one timeline', async () => { const titleToSaved = 'hello title'; - const response = await createBasicTimeline(client, titleToSaved); - const { savedObjectId } = response.data && response.data.persistTimeline.timeline; + const response = await createBasicTimeline(supertest, titleToSaved); + const { savedObjectId } = response.body.data && response.body.data.persistTimeline.timeline; - const responseToTest = await client.mutate({ - mutation: deleteTimelineMutation, - variables: { - id: [savedObjectId], - }, - }); + const responseToTest = await supertest + .delete('/api/timeline') + .set('kbn-xsrf', 'true') + .send({ + savedObjectIds: [savedObjectId], + }); - expect(responseToTest.data!.deleteTimeline).to.be(true); + expect(responseToTest.body.data!.deleteTimeline).to.be(true); }); - it('multiple timeline', async () => { + it('multiple timelines', async () => { const titleToSaved = 'hello title'; - const response1 = await createBasicTimeline(client, titleToSaved); + const response1 = await createBasicTimeline(supertest, titleToSaved); const savedObjectId1 = - response1.data && response1.data.persistTimeline.timeline - ? response1.data.persistTimeline.timeline.savedObjectId + response1.body.data && response1.body.data.persistTimeline.timeline + ? response1.body.data.persistTimeline.timeline.savedObjectId : ''; - const response2 = await createBasicTimeline(client, titleToSaved); + const response2 = await createBasicTimeline(supertest, titleToSaved); const savedObjectId2 = - response2.data && response2.data.persistTimeline.timeline - ? response2.data.persistTimeline.timeline.savedObjectId + response2.body.data && response2.body.data.persistTimeline.timeline + ? response2.body.data.persistTimeline.timeline.savedObjectId : ''; - const responseToTest = await client.mutate({ - mutation: deleteTimelineMutation, - variables: { - id: [savedObjectId1, savedObjectId2], - }, - }); + const responseToTest = await supertest + .delete('/api/timeline') + .set('kbn-xsrf', 'true') + .send({ + savedObjectIds: [savedObjectId1, savedObjectId2], + }); - expect(responseToTest.data!.deleteTimeline).to.be(true); + expect(responseToTest.body.data!.deleteTimeline).to.be(true); }); }); }); @@ -413,15 +421,3 @@ const omitTypename = (key: string, value: keyof TimelineResult) => const omitTypenameInTimeline = (timeline: TimelineResult) => JSON.parse(JSON.stringify(timeline), omitTypename); - -const createBasicTimeline = async (client: ApolloClient, titleToSaved: string) => - await client.mutate({ - mutation: persistTimelineMutation, - variables: { - timelineId: null, - version: null, - timeline: { - title: titleToSaved, - }, - }, - }); diff --git a/x-pack/test/api_integration/apis/security_solution/timeline.ts b/x-pack/test/api_integration/apis/security_solution/timeline.ts index 11de9dbff324c..10e082cf44004 100644 --- a/x-pack/test/api_integration/apis/security_solution/timeline.ts +++ b/x-pack/test/api_integration/apis/security_solution/timeline.ts @@ -6,135 +6,54 @@ */ import expect from '@kbn/expect'; +import { + SavedTimeline, + TimelineType, +} from '../../../../plugins/security_solution/common/types/timeline'; -import { Direction } from '../../../../plugins/security_solution/common/search_strategy'; -// @ts-expect-error -import { timelineQuery } from '../../../../plugins/security_solution/public/timelines/containers/index.gql_query'; -// @ts-expect-error -import { GetTimelineQuery } from '../../../../plugins/security_solution/public/graphql/types'; import { FtrProviderContext } from '../../ftr_provider_context'; +import { createBasicTimeline, createBasicTimelineTemplate } from './saved_objects/helpers'; -const TO = '3000-01-01T00:00:00.000Z'; -const FROM = '2000-01-01T00:00:00.000Z'; +export default function ({ getService }: FtrProviderContext) { + const supertest = getService('supertest'); -// typical values that have to change after an update from "scripts/es_archiver" -const DATA_COUNT = 2; -const HOST_NAME = 'suricata-sensor-amsterdam'; -const TOTAL_COUNT = 96; -const EDGE_LENGTH = 2; -const CURSOR_ID = '1550608949681'; + describe('Timeline', () => { + it('Make sure that we get Timeline data', async () => { + const titleToSaved = 'hello timeline'; + await createBasicTimeline(supertest, titleToSaved); -const FILTER_VALUE = { - bool: { - filter: [ - { - bool: { - should: [{ match_phrase: { 'host.name': HOST_NAME } }], - minimum_should_match: 1, - }, - }, - { - bool: { - filter: [ - { - bool: { - should: [{ range: { '@timestamp': { gte: FROM } } }], - minimum_should_match: 1, - }, - }, - { - bool: { - should: [{ range: { '@timestamp': { lte: TO } } }], - minimum_should_match: 1, - }, - }, - ], - }, - }, - ], - }, -}; + const resp = await supertest.get('/api/timelines').set('kbn-xsrf', 'true'); -export default function ({ getService }: FtrProviderContext) { - const esArchiver = getService('esArchiver'); - const client = getService('securitySolutionGraphQLClient'); + const timelines = resp.body.timeline; - describe('Timeline', () => { - before(() => esArchiver.load('auditbeat/hosts')); - after(() => esArchiver.unload('auditbeat/hosts')); + expect(timelines.length).to.greaterThan(0); + }); + + it('Make sure that pagination is working in Timeline query', async () => { + const titleToSaved = 'hello timeline'; + await createBasicTimeline(supertest, titleToSaved); - it('Make sure that we get Timeline data', () => { - return client - .query({ - query: timelineQuery, - variables: { - sourceId: 'default', - filterQuery: JSON.stringify(FILTER_VALUE), - pagination: { - limit: 2, - cursor: null, - tiebreaker: null, - }, - sortField: { - sortFieldId: 'timestamp', - direction: Direction.desc, - }, - fieldRequested: ['@timestamp', 'host.name'], - defaultIndex: ['auditbeat-*'], - docValueFields: [], - inspect: false, - timerange: { - from: FROM, - to: TO, - interval: '12h', - }, - wait_for_completion_timeout: '10s', - }, - }) - .then((resp) => { - const timeline = resp.data.source.Timeline; - expect(timeline.edges.length).to.be(EDGE_LENGTH); - expect(timeline.edges[0].node.data.length).to.be(DATA_COUNT); - expect(timeline.totalCount).to.be(TOTAL_COUNT); - expect(timeline.pageInfo.endCursor!.value).to.equal(CURSOR_ID); - }); + const resp = await supertest + .get('/api/timelines?page_size=1&page_index=1') + .set('kbn-xsrf', 'true'); + + const timelines = resp.body.timeline; + + expect(timelines.length).to.equal(1); }); - it('Make sure that pagination is working in Timeline query', () => { - return client - .query({ - query: timelineQuery, - variables: { - sourceId: 'default', - filterQuery: JSON.stringify(FILTER_VALUE), - pagination: { - limit: 2, - cursor: CURSOR_ID, - tiebreaker: '191', - }, - sortField: { - sortFieldId: 'timestamp', - direction: Direction.desc, - }, - fieldRequested: ['@timestamp', 'host.name'], - defaultIndex: ['auditbeat-*', 'filebeat-*', 'packetbeat-*', 'winlogbeat-*'], - docValueFields: [], - inspect: false, - timerange: { - from: FROM, - to: TO, - interval: '12h', - }, - wait_for_completion_timeout: '10s', - }, - }) - .then((resp) => { - const timeline = resp.data.source.Timeline; - expect(timeline.edges.length).to.be(EDGE_LENGTH); - expect(timeline.totalCount).to.be(TOTAL_COUNT); - expect(timeline.edges[0].node.data.length).to.be(DATA_COUNT); - expect(timeline.edges[0]!.node.ecs.host!.name).to.eql([HOST_NAME]); - }); + it('Make sure that we get Timeline template data', async () => { + const titleToSaved = 'hello timeline template'; + await createBasicTimelineTemplate(supertest, titleToSaved); + + const resp = await supertest + .get('/api/timelines?timeline_type=template') + .set('kbn-xsrf', 'true'); + + const templates: SavedTimeline[] = resp.body.timeline; + + expect(templates.length).to.greaterThan(0); + expect(templates.filter((t) => t.timelineType === TimelineType.default).length).to.equal(0); }); }); } diff --git a/x-pack/test/api_integration/apis/security_solution/tls.ts b/x-pack/test/api_integration/apis/security_solution/tls.ts index a8e0517e6ccdb..eadf7d2aac7ae 100644 --- a/x-pack/test/api_integration/apis/security_solution/tls.ts +++ b/x-pack/test/api_integration/apis/security_solution/tls.ts @@ -84,8 +84,7 @@ export default function ({ getService }: FtrProviderContext) { const esArchiver = getService('esArchiver'); const supertest = getService('supertest'); - // Failing: See https://github.com/elastic/kibana/issues/91360 - describe.skip('Tls Test with Packetbeat', () => { + describe('Tls Test with Packetbeat', () => { describe('Tls Test', () => { before(() => esArchiver.load('packetbeat/tls')); after(() => esArchiver.unload('packetbeat/tls')); diff --git a/x-pack/test/api_integration/apis/telemetry/telemetry_local.ts b/x-pack/test/api_integration/apis/telemetry/telemetry_local.ts index a85e8ef82fc8c..2412b91e6ee68 100644 --- a/x-pack/test/api_integration/apis/telemetry/telemetry_local.ts +++ b/x-pack/test/api_integration/apis/telemetry/telemetry_local.ts @@ -53,6 +53,7 @@ export default function ({ getService }: FtrProviderContext) { it('should pass the schema validation', () => { const root = deepmerge(ossRootTelemetrySchema, xpackRootTelemetrySchema); const plugins = deepmerge(ossPluginsTelemetrySchema, xpackPluginsTelemetrySchema); + try { assertTelemetryPayload({ root, plugins }, stats); } catch (err) { diff --git a/x-pack/test/api_integration/apis/uptime/rest/fixtures/doc_count.json b/x-pack/test/api_integration/apis/uptime/rest/fixtures/doc_count.json index 6ff7ea58c30f0..5151f0adb0011 100644 --- a/x-pack/test/api_integration/apis/uptime/rest/fixtures/doc_count.json +++ b/x-pack/test/api_integration/apis/uptime/rest/fixtures/doc_count.json @@ -1,4 +1,5 @@ { "indexExists": true, - "docCount": 1 + "docCount": 1, + "indices": "heartbeat-8*,synthetics-*" } diff --git a/x-pack/test/api_integration/apis/uptime/rest/index.ts b/x-pack/test/api_integration/apis/uptime/rest/index.ts index 33fff4fb232d7..a46aa653b6f2b 100644 --- a/x-pack/test/api_integration/apis/uptime/rest/index.ts +++ b/x-pack/test/api_integration/apis/uptime/rest/index.ts @@ -55,7 +55,7 @@ export default function ({ getService, loadTestFile }: FtrProviderContext) { loadTestFile(require.resolve('./ping_histogram')); loadTestFile(require.resolve('./ping_list')); loadTestFile(require.resolve('./monitor_duration')); - loadTestFile(require.resolve('./doc_count')); + loadTestFile(require.resolve('./index_status')); loadTestFile(require.resolve('./monitor_states_real_data')); }); }); diff --git a/x-pack/test/api_integration/apis/uptime/rest/doc_count.ts b/x-pack/test/api_integration/apis/uptime/rest/index_status.ts similarity index 100% rename from x-pack/test/api_integration/apis/uptime/rest/doc_count.ts rename to x-pack/test/api_integration/apis/uptime/rest/index_status.ts diff --git a/x-pack/test/api_integration/services/index.ts b/x-pack/test/api_integration/services/index.ts index 39215d3da673a..bf5eaf9618414 100644 --- a/x-pack/test/api_integration/services/index.ts +++ b/x-pack/test/api_integration/services/index.ts @@ -16,10 +16,7 @@ import { EsSupertestWithoutAuthProvider } from './es_supertest_without_auth'; import { SupertestWithoutAuthProvider } from './supertest_without_auth'; import { UsageAPIProvider } from './usage_api'; -import { - SecuritySolutionGraphQLClientProvider, - SecuritySolutionGraphQLClientFactoryProvider, -} from './security_solution_graphql_client'; + import { InfraOpsSourceConfigurationProvider } from './infraops_source_configuration'; import { InfraLogSourceConfigurationProvider } from './infra_log_source_configuration'; import { MachineLearningProvider } from './ml'; @@ -36,8 +33,6 @@ export const services = { esSupertestWithoutAuth: EsSupertestWithoutAuthProvider, infraOpsSourceConfiguration: InfraOpsSourceConfigurationProvider, infraLogSourceConfiguration: InfraLogSourceConfigurationProvider, - securitySolutionGraphQLClient: SecuritySolutionGraphQLClientProvider, - securitySolutionGraphQLClientFactory: SecuritySolutionGraphQLClientFactoryProvider, supertestWithoutAuth: SupertestWithoutAuthProvider, usageAPI: UsageAPIProvider, ml: MachineLearningProvider, diff --git a/x-pack/test/api_integration/services/security_solution_graphql_client.ts b/x-pack/test/api_integration/services/security_solution_graphql_client.ts deleted file mode 100644 index 35514804f56cf..0000000000000 --- a/x-pack/test/api_integration/services/security_solution_graphql_client.ts +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. - */ - -import { format as formatUrl } from 'url'; -import fetch from 'node-fetch'; -import { InMemoryCache, IntrospectionFragmentMatcher } from 'apollo-cache-inmemory'; -import { ApolloClient } from 'apollo-client'; -import { HttpLink } from 'apollo-link-http'; - -import { FtrProviderContext } from '../ftr_provider_context'; -import introspectionQueryResultData from '../../../plugins/security_solution/public/graphql/introspection.json'; - -interface SecuritySolutionGraphQLClientFactoryOptions { - username?: string; - password?: string; - basePath?: string; -} - -export function SecuritySolutionGraphQLClientProvider(context: FtrProviderContext) { - return SecuritySolutionGraphQLClientFactoryProvider(context)(); -} - -export function SecuritySolutionGraphQLClientFactoryProvider({ getService }: FtrProviderContext) { - const config = getService('config'); - const superAuth: string = config.get('servers.elasticsearch.auth'); - const [superUsername, superPassword] = superAuth.split(':'); - - return function (options?: SecuritySolutionGraphQLClientFactoryOptions) { - const { username = superUsername, password = superPassword, basePath = null } = options || {}; - - const kbnURLWithoutAuth = formatUrl({ ...config.get('servers.kibana'), auth: false }); - - const httpLink = new HttpLink({ - credentials: 'same-origin', - fetch: fetch as any, - headers: { - 'kbn-xsrf': 'xxx', - authorization: `Basic ${Buffer.from(`${username}:${password}`).toString('base64')}`, - }, - uri: `${kbnURLWithoutAuth}${basePath || ''}/api/solutions/security/graphql`, - }); - - return new ApolloClient({ - cache: new InMemoryCache({ - fragmentMatcher: new IntrospectionFragmentMatcher({ - // @ts-expect-error apollo-cache-inmemory types don't match actual introspection data - introspectionQueryResultData, - }), - }), - link: httpLink, - }); - }; -} diff --git a/x-pack/test/apm_api_integration/configs/index.ts b/x-pack/test/apm_api_integration/configs/index.ts index 91437a2d22e27..97d18c2419840 100644 --- a/x-pack/test/apm_api_integration/configs/index.ts +++ b/x-pack/test/apm_api_integration/configs/index.ts @@ -18,7 +18,7 @@ const apmFtrConfigs = { rules: { license: 'trial' as const, kibanaConfig: { - 'xpack.ruleRegistry.writeEnabled': 'true', + 'xpack.ruleRegistry.unsafe.write.enabled': 'true', }, }, }; diff --git a/x-pack/test/apm_api_integration/tests/csm/has_rum_data.ts b/x-pack/test/apm_api_integration/tests/csm/has_rum_data.ts index 4474d0996175b..15ddc04e2414d 100644 --- a/x-pack/test/apm_api_integration/tests/csm/has_rum_data.ts +++ b/x-pack/test/apm_api_integration/tests/csm/has_rum_data.ts @@ -22,6 +22,7 @@ export default function rumHasDataApiTests({ getService }: FtrProviderContext) { expectSnapshot(response.body).toMatchInline(` Object { "hasData": false, + "indices": "traces-apm*,apm-*", } `); }); @@ -41,6 +42,7 @@ export default function rumHasDataApiTests({ getService }: FtrProviderContext) { expectSnapshot(response.body).toMatchInline(` Object { "hasData": true, + "indices": "traces-apm*,apm-*", "serviceName": "client", } `); diff --git a/x-pack/test/apm_api_integration/tests/index.ts b/x-pack/test/apm_api_integration/tests/index.ts index 53ec61b8d9b61..7c38f37093fa4 100644 --- a/x-pack/test/apm_api_integration/tests/index.ts +++ b/x-pack/test/apm_api_integration/tests/index.ts @@ -65,12 +65,16 @@ export default function apmApiIntegrationTests(providerContext: FtrProviderConte loadTestFile(require.resolve('./service_overview/dependencies')); }); - describe('service_overview/instances_primary_statistics', function () { - loadTestFile(require.resolve('./service_overview/instances_primary_statistics')); + describe('service_overview/instances_main_statistics', function () { + loadTestFile(require.resolve('./service_overview/instances_main_statistics')); }); - describe('service_overview/instances_comparison_statistics', function () { - loadTestFile(require.resolve('./service_overview/instances_comparison_statistics')); + describe('service_overview/instances_detailed_statistics', function () { + loadTestFile(require.resolve('./service_overview/instances_detailed_statistics')); + }); + + describe('service_overview/instance_details', function () { + loadTestFile(require.resolve('./service_overview/instance_details')); }); // Services @@ -102,12 +106,12 @@ export default function apmApiIntegrationTests(providerContext: FtrProviderConte loadTestFile(require.resolve('./services/transaction_types')); }); - describe('services/error_groups_primary_statistics', function () { - loadTestFile(require.resolve('./services/error_groups_primary_statistics')); + describe('services/error_groups_main_statistics', function () { + loadTestFile(require.resolve('./services/error_groups_main_statistics')); }); - describe('services/error_groups_comparison_statistics', function () { - loadTestFile(require.resolve('./services/error_groups_comparison_statistics')); + describe('services/error_groups_detailed_statistics', function () { + loadTestFile(require.resolve('./services/error_groups_detailed_statistics')); }); // Settinges @@ -165,12 +169,12 @@ export default function apmApiIntegrationTests(providerContext: FtrProviderConte loadTestFile(require.resolve('./transactions/top_transaction_groups')); }); - describe('transactions/transactions_groups_primary_statistics', function () { - loadTestFile(require.resolve('./transactions/transactions_groups_primary_statistics')); + describe('transactions/transactions_groups_main_statistics', function () { + loadTestFile(require.resolve('./transactions/transactions_groups_main_statistics')); }); - describe('transactions/transactions_groups_comparison_statistics', function () { - loadTestFile(require.resolve('./transactions/transactions_groups_comparison_statistics')); + describe('transactions/transactions_groups_detailed_statistics', function () { + loadTestFile(require.resolve('./transactions/transactions_groups_detailed_statistics')); }); // feature control diff --git a/x-pack/test/apm_api_integration/tests/service_overview/__snapshots__/instance_details.snap b/x-pack/test/apm_api_integration/tests/service_overview/__snapshots__/instance_details.snap new file mode 100644 index 0000000000000..b4197c7dfbf67 --- /dev/null +++ b/x-pack/test/apm_api_integration/tests/service_overview/__snapshots__/instance_details.snap @@ -0,0 +1,47 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`APM API tests basic apm_8.0.0 Instance details when data is loaded fetch instance details return the correct data 1`] = ` +Object { + "@timestamp": "2020-12-08T13:59:01.971Z", + "agent": Object { + "ephemeral_id": "d27b2271-06b4-48c8-a02a-cfd963c0b4d0", + "name": "java", + "version": "1.19.1-SNAPSHOT.null", + }, + "container": Object { + "id": "02950c4c5fbb0fda1cc98c47bf4024b473a8a17629db6530d95dcee68bd54c6c", + }, + "host": Object { + "architecture": "amd64", + "ip": "10.8.4.45", + "os": Object { + "platform": "Linux", + }, + }, + "kubernetes": Object { + "pod": Object { + "name": "opbeans-java-6bdd78cb5c-k2qz6", + "uid": "805e875d-1fda-42c0-bb54-23eb6faf54ab", + }, + }, + "service": Object { + "environment": "production", + "framework": Object { + "name": "Servlet API", + }, + "language": Object { + "name": "Java", + "version": "11.0.9.1", + }, + "name": "opbeans-java", + "node": Object { + "name": "02950c4c5fbb0fda1cc98c47bf4024b473a8a17629db6530d95dcee68bd54c6c", + }, + "runtime": Object { + "name": "Java", + "version": "11.0.9.1", + }, + "version": "2020-12-08 03:35:36", + }, +} +`; diff --git a/x-pack/test/apm_api_integration/tests/service_overview/__snapshots__/instances_comparison_statistics.snap b/x-pack/test/apm_api_integration/tests/service_overview/__snapshots__/instances_detailed_statistics.snap similarity index 99% rename from x-pack/test/apm_api_integration/tests/service_overview/__snapshots__/instances_comparison_statistics.snap rename to x-pack/test/apm_api_integration/tests/service_overview/__snapshots__/instances_detailed_statistics.snap index 7b7f6fd85b71e..99208e6cb466b 100644 --- a/x-pack/test/apm_api_integration/tests/service_overview/__snapshots__/instances_comparison_statistics.snap +++ b/x-pack/test/apm_api_integration/tests/service_overview/__snapshots__/instances_detailed_statistics.snap @@ -1,6 +1,6 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`APM API tests basic apm_8.0.0 Service overview instances comparison statistics when data is loaded fetching data with comparison returns the right data for current and previous periods 5`] = ` +exports[`APM API tests basic apm_8.0.0 Service overview instances detailed statistics when data is loaded fetching data with comparison returns the right data for current and previous periods 5`] = ` Object { "currentPeriod": Object { "02950c4c5fbb0fda1cc98c47bf4024b473a8a17629db6530d95dcee68bd54c6c": Object { @@ -675,7 +675,7 @@ Object { } `; -exports[`APM API tests basic apm_8.0.0 Service overview instances comparison statistics when data is loaded fetching data without comparison returns the right data 3`] = ` +exports[`APM API tests basic apm_8.0.0 Service overview instances detailed statistics when data is loaded fetching data without comparison returns the right data 3`] = ` Object { "currentPeriod": Object { "02950c4c5fbb0fda1cc98c47bf4024b473a8a17629db6530d95dcee68bd54c6c": Object { diff --git a/x-pack/test/apm_api_integration/tests/service_overview/instance_details.ts b/x-pack/test/apm_api_integration/tests/service_overview/instance_details.ts new file mode 100644 index 0000000000000..ee3966aa10a49 --- /dev/null +++ b/x-pack/test/apm_api_integration/tests/service_overview/instance_details.ts @@ -0,0 +1,101 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ +import url from 'url'; +import expect from '@kbn/expect'; +import { FtrProviderContext } from '../../../common/ftr_provider_context'; +import archives from '../../common/fixtures/es_archiver/archives_metadata'; +import { registry } from '../../common/registry'; +import { APIReturnType } from '../../../../plugins/apm/public/services/rest/createCallApmApi'; + +type ServiceOverviewInstanceDetails = APIReturnType<'GET /api/apm/services/{serviceName}/service_overview_instances/details/{serviceNodeName}'>; + +export default function ApiTest({ getService }: FtrProviderContext) { + const supertest = getService('supertest'); + + const archiveName = 'apm_8.0.0'; + const { start, end } = archives[archiveName]; + + registry.when( + 'Instance details when data is not loaded', + { config: 'basic', archives: [] }, + () => { + describe('when data is not loaded', () => { + it('handles empty state', async () => { + const response = await supertest.get( + url.format({ + pathname: '/api/apm/services/opbeans-java/service_overview_instances/details/foo', + query: { + start, + end, + transactionType: 'request', + }, + }) + ); + + expect(response.status).to.be(200); + expect(response.body).to.eql({}); + }); + }); + } + ); + + registry.when( + 'Instance details when data is loaded', + { config: 'basic', archives: [archiveName] }, + () => { + describe('fetch instance details', () => { + let response: { + status: number; + body: ServiceOverviewInstanceDetails; + }; + + before(async () => { + response = await supertest.get( + url.format({ + pathname: + '/api/apm/services/opbeans-java/service_overview_instances/details/02950c4c5fbb0fda1cc98c47bf4024b473a8a17629db6530d95dcee68bd54c6c', + query: { + start, + end, + transactionType: 'request', + }, + }) + ); + }); + + it('returns the instance details', () => { + expect(response.body).to.not.eql({}); + }); + + it('return the correct data', () => { + expectSnapshot(response.body).toMatch(); + }); + }); + } + ); + + registry.when( + 'Instance details when data is loaded but details not found', + { config: 'basic', archives: [archiveName] }, + () => { + it('handles empty state when instance id not found', async () => { + const response = await supertest.get( + url.format({ + pathname: '/api/apm/services/opbeans-java/service_overview_instances/details/foo', + query: { + start, + end, + transactionType: 'request', + }, + }) + ); + expect(response.status).to.be(200); + expect(response.body).to.eql({}); + }); + } + ); +} diff --git a/x-pack/test/apm_api_integration/tests/service_overview/instances_comparison_statistics.ts b/x-pack/test/apm_api_integration/tests/service_overview/instances_detailed_statistics.ts similarity index 95% rename from x-pack/test/apm_api_integration/tests/service_overview/instances_comparison_statistics.ts rename to x-pack/test/apm_api_integration/tests/service_overview/instances_detailed_statistics.ts index 64d7e258c1fad..b5cfd722c41dd 100644 --- a/x-pack/test/apm_api_integration/tests/service_overview/instances_comparison_statistics.ts +++ b/x-pack/test/apm_api_integration/tests/service_overview/instances_detailed_statistics.ts @@ -24,18 +24,18 @@ export default function ApiTest({ getService }: FtrProviderContext) { interface Response { status: number; - body: APIReturnType<'GET /api/apm/services/{serviceName}/service_overview_instances/comparison_statistics'>; + body: APIReturnType<'GET /api/apm/services/{serviceName}/service_overview_instances/detailed_statistics'>; } registry.when( - 'Service overview instances comparison statistics when data is not loaded', + 'Service overview instances detailed statistics when data is not loaded', { config: 'basic', archives: [] }, () => { describe('when data is not loaded', () => { it('handles the empty state', async () => { const response: Response = await supertest.get( url.format({ - pathname: `/api/apm/services/opbeans-java/service_overview_instances/comparison_statistics`, + pathname: `/api/apm/services/opbeans-java/service_overview_instances/detailed_statistics`, query: { latencyAggregationType: 'avg', start, @@ -55,7 +55,7 @@ export default function ApiTest({ getService }: FtrProviderContext) { ); registry.when( - 'Service overview instances comparison statistics when data is loaded', + 'Service overview instances detailed statistics when data is loaded', { config: 'basic', archives: [archiveName] }, () => { describe('fetching data without comparison', () => { @@ -64,7 +64,7 @@ export default function ApiTest({ getService }: FtrProviderContext) { beforeEach(async () => { response = await supertest.get( url.format({ - pathname: `/api/apm/services/opbeans-java/service_overview_instances/comparison_statistics`, + pathname: `/api/apm/services/opbeans-java/service_overview_instances/detailed_statistics`, query: { latencyAggregationType: 'avg', start, @@ -111,7 +111,7 @@ export default function ApiTest({ getService }: FtrProviderContext) { beforeEach(async () => { response = await supertest.get( url.format({ - pathname: `/api/apm/services/opbeans-java/service_overview_instances/comparison_statistics`, + pathname: `/api/apm/services/opbeans-java/service_overview_instances/detailed_statistics`, query: { latencyAggregationType: 'avg', numBuckets: 20, diff --git a/x-pack/test/apm_api_integration/tests/service_overview/instances_primary_statistics.ts b/x-pack/test/apm_api_integration/tests/service_overview/instances_main_statistics.ts similarity index 94% rename from x-pack/test/apm_api_integration/tests/service_overview/instances_primary_statistics.ts rename to x-pack/test/apm_api_integration/tests/service_overview/instances_main_statistics.ts index baa95eb56a126..8e085fab98ebf 100644 --- a/x-pack/test/apm_api_integration/tests/service_overview/instances_primary_statistics.ts +++ b/x-pack/test/apm_api_integration/tests/service_overview/instances_main_statistics.ts @@ -22,13 +22,13 @@ export default function ApiTest({ getService }: FtrProviderContext) { const { start, end } = archives[archiveName]; registry.when( - 'Service overview instances primary statistics when data is not loaded', + 'Service overview instances main statistics when data is not loaded', { config: 'basic', archives: [] }, () => { describe('when data is not loaded', () => { it('handles the empty state', async () => { const response = await apmApiSupertest({ - endpoint: `GET /api/apm/services/{serviceName}/service_overview_instances/primary_statistics`, + endpoint: `GET /api/apm/services/{serviceName}/service_overview_instances/main_statistics`, params: { path: { serviceName: 'opbeans-java' }, query: { @@ -48,17 +48,17 @@ export default function ApiTest({ getService }: FtrProviderContext) { ); registry.when( - 'Service overview instances primary statistics when data is loaded', + 'Service overview instances main statistics when data is loaded', { config: 'basic', archives: [archiveName] }, () => { describe('fetching java data', () => { let response: { - body: APIReturnType<`GET /api/apm/services/{serviceName}/service_overview_instances/primary_statistics`>; + body: APIReturnType<`GET /api/apm/services/{serviceName}/service_overview_instances/main_statistics`>; }; beforeEach(async () => { response = await apmApiSupertest({ - endpoint: `GET /api/apm/services/{serviceName}/service_overview_instances/primary_statistics`, + endpoint: `GET /api/apm/services/{serviceName}/service_overview_instances/main_statistics`, params: { path: { serviceName: 'opbeans-java' }, query: { @@ -122,12 +122,12 @@ export default function ApiTest({ getService }: FtrProviderContext) { describe('fetching non-java data', () => { let response: { - body: APIReturnType<`GET /api/apm/services/{serviceName}/service_overview_instances/primary_statistics`>; + body: APIReturnType<`GET /api/apm/services/{serviceName}/service_overview_instances/main_statistics`>; }; beforeEach(async () => { response = await apmApiSupertest({ - endpoint: `GET /api/apm/services/{serviceName}/service_overview_instances/primary_statistics`, + endpoint: `GET /api/apm/services/{serviceName}/service_overview_instances/main_statistics`, params: { path: { serviceName: 'opbeans-ruby' }, query: { diff --git a/x-pack/test/apm_api_integration/tests/services/__snapshots__/error_groups_comparison_statistics.snap b/x-pack/test/apm_api_integration/tests/services/__snapshots__/error_groups_detailed_statistics.snap similarity index 91% rename from x-pack/test/apm_api_integration/tests/services/__snapshots__/error_groups_comparison_statistics.snap rename to x-pack/test/apm_api_integration/tests/services/__snapshots__/error_groups_detailed_statistics.snap index 31bc29a2476ca..36529a41e080f 100644 --- a/x-pack/test/apm_api_integration/tests/services/__snapshots__/error_groups_comparison_statistics.snap +++ b/x-pack/test/apm_api_integration/tests/services/__snapshots__/error_groups_detailed_statistics.snap @@ -1,6 +1,6 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`APM API tests basic apm_8.0.0 Error groups comparison statistics when data is loaded returns the correct data 1`] = ` +exports[`APM API tests basic apm_8.0.0 Error groups detailed statistics when data is loaded returns the correct data 1`] = ` Object { "groupId": "051f95eabf120ebe2f8b0399fe3e54c5", "timeseries": Array [ @@ -132,7 +132,7 @@ Object { } `; -exports[`APM API tests basic apm_8.0.0 Error groups comparison statistics when data is loaded with previous data returns the correct data returns correct timeseries 1`] = ` +exports[`APM API tests basic apm_8.0.0 Error groups detailed statistics when data is loaded with previous data returns the correct data returns correct timeseries 1`] = ` Object { "groupId": "051f95eabf120ebe2f8b0399fe3e54c5", "timeseries": Array [ diff --git a/x-pack/test/apm_api_integration/tests/services/error_groups_comparison_statistics.ts b/x-pack/test/apm_api_integration/tests/services/error_groups_detailed_statistics.ts similarity index 90% rename from x-pack/test/apm_api_integration/tests/services/error_groups_comparison_statistics.ts rename to x-pack/test/apm_api_integration/tests/services/error_groups_detailed_statistics.ts index 821d0515aa808..fdbc98af03bf2 100644 --- a/x-pack/test/apm_api_integration/tests/services/error_groups_comparison_statistics.ts +++ b/x-pack/test/apm_api_integration/tests/services/error_groups_detailed_statistics.ts @@ -13,7 +13,7 @@ import { FtrProviderContext } from '../../common/ftr_provider_context'; import { registry } from '../../common/registry'; import { APIReturnType } from '../../../../plugins/apm/public/services/rest/createCallApmApi'; -type ErrorGroupsComparisonStatistics = APIReturnType<'GET /api/apm/services/{serviceName}/error_groups/comparison_statistics'>; +type ErrorGroupsDetailedStatistics = APIReturnType<'GET /api/apm/services/{serviceName}/error_groups/detailed_statistics'>; export default function ApiTest({ getService }: FtrProviderContext) { const supertest = getService('supertest'); @@ -30,13 +30,13 @@ export default function ApiTest({ getService }: FtrProviderContext) { ]; registry.when( - 'Error groups comparison statistics when data is not loaded', + 'Error groups detailed statistics when data is not loaded', { config: 'basic', archives: [] }, () => { it('handles empty state', async () => { const response = await supertest.get( url.format({ - pathname: `/api/apm/services/opbeans-java/error_groups/comparison_statistics`, + pathname: `/api/apm/services/opbeans-java/error_groups/detailed_statistics`, query: { start, end, @@ -54,13 +54,13 @@ export default function ApiTest({ getService }: FtrProviderContext) { ); registry.when( - 'Error groups comparison statistics when data is loaded', + 'Error groups detailed statistics when data is loaded', { config: 'basic', archives: [archiveName] }, () => { it('returns the correct data', async () => { const response = await supertest.get( url.format({ - pathname: `/api/apm/services/opbeans-java/error_groups/comparison_statistics`, + pathname: `/api/apm/services/opbeans-java/error_groups/detailed_statistics`, query: { start, end, @@ -73,7 +73,7 @@ export default function ApiTest({ getService }: FtrProviderContext) { expect(response.status).to.be(200); - const errorGroupsComparisonStatistics = response.body as ErrorGroupsComparisonStatistics; + const errorGroupsComparisonStatistics = response.body as ErrorGroupsDetailedStatistics; expect(Object.keys(errorGroupsComparisonStatistics.currentPeriod).sort()).to.eql( groupIds.sort() ); @@ -93,7 +93,7 @@ export default function ApiTest({ getService }: FtrProviderContext) { it('returns an empty state when requested groupIds are not available in the given time range', async () => { const response = await supertest.get( url.format({ - pathname: `/api/apm/services/opbeans-java/error_groups/comparison_statistics`, + pathname: `/api/apm/services/opbeans-java/error_groups/detailed_statistics`, query: { start, end, @@ -111,18 +111,18 @@ export default function ApiTest({ getService }: FtrProviderContext) { ); registry.when( - 'Error groups comparison statistics when data is loaded with previous data', + 'Error groups detailed statistics when data is loaded with previous data', { config: 'basic', archives: [archiveName] }, () => { describe('returns the correct data', async () => { let response: { status: number; - body: ErrorGroupsComparisonStatistics; + body: ErrorGroupsDetailedStatistics; }; before(async () => { response = await supertest.get( url.format({ - pathname: `/api/apm/services/opbeans-java/error_groups/comparison_statistics`, + pathname: `/api/apm/services/opbeans-java/error_groups/detailed_statistics`, query: { numBuckets: 20, transactionType: 'request', @@ -139,7 +139,7 @@ export default function ApiTest({ getService }: FtrProviderContext) { }); it('returns correct timeseries', () => { - const errorGroupsComparisonStatistics = response.body as ErrorGroupsComparisonStatistics; + const errorGroupsComparisonStatistics = response.body as ErrorGroupsDetailedStatistics; const errorgroupsComparisonStatistics = errorGroupsComparisonStatistics.currentPeriod[groupIds[0]]; expect( @@ -149,7 +149,7 @@ export default function ApiTest({ getService }: FtrProviderContext) { }); it('matches x-axis on current period and previous period', () => { - const errorGroupsComparisonStatistics = response.body as ErrorGroupsComparisonStatistics; + const errorGroupsComparisonStatistics = response.body as ErrorGroupsDetailedStatistics; const currentPeriodItems = Object.values(errorGroupsComparisonStatistics.currentPeriod); const previousPeriodItems = Object.values(errorGroupsComparisonStatistics.previousPeriod); @@ -166,7 +166,7 @@ export default function ApiTest({ getService }: FtrProviderContext) { it('returns an empty state when requested groupIds are not available in the given time range', async () => { const response = await supertest.get( url.format({ - pathname: `/api/apm/services/opbeans-java/error_groups/comparison_statistics`, + pathname: `/api/apm/services/opbeans-java/error_groups/detailed_statistics`, query: { numBuckets: 20, transactionType: 'request', diff --git a/x-pack/test/apm_api_integration/tests/services/error_groups_primary_statistics.ts b/x-pack/test/apm_api_integration/tests/services/error_groups_main_statistics.ts similarity index 84% rename from x-pack/test/apm_api_integration/tests/services/error_groups_primary_statistics.ts rename to x-pack/test/apm_api_integration/tests/services/error_groups_main_statistics.ts index 61a44619ea905..c95ba52e6052e 100644 --- a/x-pack/test/apm_api_integration/tests/services/error_groups_primary_statistics.ts +++ b/x-pack/test/apm_api_integration/tests/services/error_groups_main_statistics.ts @@ -12,7 +12,7 @@ import { FtrProviderContext } from '../../common/ftr_provider_context'; import { registry } from '../../common/registry'; import { APIReturnType } from '../../../../plugins/apm/public/services/rest/createCallApmApi'; -type ErrorGroupsPrimaryStatistics = APIReturnType<'GET /api/apm/services/{serviceName}/error_groups/primary_statistics'>; +type ErrorGroupsMainStatistics = APIReturnType<'GET /api/apm/services/{serviceName}/error_groups/main_statistics'>; export default function ApiTest({ getService }: FtrProviderContext) { const supertest = getService('supertest'); @@ -22,13 +22,13 @@ export default function ApiTest({ getService }: FtrProviderContext) { const { start, end } = metadata; registry.when( - 'Error groups primary statistics when data is not loaded', + 'Error groups main statistics when data is not loaded', { config: 'basic', archives: [] }, () => { it('handles empty state', async () => { const response = await supertest.get( url.format({ - pathname: `/api/apm/services/opbeans-java/error_groups/primary_statistics`, + pathname: `/api/apm/services/opbeans-java/error_groups/main_statistics`, query: { start, end, @@ -47,13 +47,13 @@ export default function ApiTest({ getService }: FtrProviderContext) { ); registry.when( - 'Error groups primary statistics when data is loaded', + 'Error groups main statistics when data is loaded', { config: 'basic', archives: [archiveName] }, () => { it('returns the correct data', async () => { const response = await supertest.get( url.format({ - pathname: `/api/apm/services/opbeans-java/error_groups/primary_statistics`, + pathname: `/api/apm/services/opbeans-java/error_groups/main_statistics`, query: { start, end, @@ -65,12 +65,12 @@ export default function ApiTest({ getService }: FtrProviderContext) { expect(response.status).to.be(200); - const errorGroupPrimaryStatistics = response.body as ErrorGroupsPrimaryStatistics; + const errorGroupMainStatistics = response.body as ErrorGroupsMainStatistics; - expect(errorGroupPrimaryStatistics.is_aggregation_accurate).to.eql(true); - expect(errorGroupPrimaryStatistics.error_groups.length).to.be.greaterThan(0); + expect(errorGroupMainStatistics.is_aggregation_accurate).to.eql(true); + expect(errorGroupMainStatistics.error_groups.length).to.be.greaterThan(0); - expectSnapshot(errorGroupPrimaryStatistics.error_groups.map(({ name }) => name)) + expectSnapshot(errorGroupMainStatistics.error_groups.map(({ name }) => name)) .toMatchInline(` Array [ "Could not write JSON: Null return value from advice does not match primitive return type for: public abstract double co.elastic.apm.opbeans.repositories.Numbers.getRevenue(); nested exception is com.fasterxml.jackson.databind.JsonMappingException: Null return value from advice does not match primitive return type for: public abstract double co.elastic.apm.opbeans.repositories.Numbers.getRevenue() (through reference chain: co.elastic.apm.opbeans.repositories.Stats[\\"numbers\\"]->com.sun.proxy.$Proxy132[\\"revenue\\"])", @@ -81,7 +81,7 @@ export default function ApiTest({ getService }: FtrProviderContext) { ] `); - const occurences = errorGroupPrimaryStatistics.error_groups.map( + const occurences = errorGroupMainStatistics.error_groups.map( ({ occurrences }) => occurrences ); @@ -97,7 +97,7 @@ export default function ApiTest({ getService }: FtrProviderContext) { ] `); - const firstItem = errorGroupPrimaryStatistics.error_groups[0]; + const firstItem = errorGroupMainStatistics.error_groups[0]; expectSnapshot(firstItem).toMatchInline(` Object { diff --git a/x-pack/test/apm_api_integration/tests/transactions/__snapshots__/transactions_groups_comparison_statistics.snap b/x-pack/test/apm_api_integration/tests/transactions/__snapshots__/transactions_groups_detailed_statistics.snap similarity index 88% rename from x-pack/test/apm_api_integration/tests/transactions/__snapshots__/transactions_groups_comparison_statistics.snap rename to x-pack/test/apm_api_integration/tests/transactions/__snapshots__/transactions_groups_detailed_statistics.snap index bc641ad1a9890..64336a4c65451 100644 --- a/x-pack/test/apm_api_integration/tests/transactions/__snapshots__/transactions_groups_comparison_statistics.snap +++ b/x-pack/test/apm_api_integration/tests/transactions/__snapshots__/transactions_groups_detailed_statistics.snap @@ -1,6 +1,6 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`APM API tests basic apm_8.0.0 Transaction groups comparison statistics when data is loaded returns data with previous period returns correct error rate data 1`] = ` +exports[`APM API tests basic apm_8.0.0 Transaction groups detailed statistics when data is loaded returns data with previous period returns correct error rate data 1`] = ` Array [ Object { "x": 1607436720000, @@ -69,7 +69,7 @@ Array [ ] `; -exports[`APM API tests basic apm_8.0.0 Transaction groups comparison statistics when data is loaded returns data with previous period returns correct error rate data 2`] = ` +exports[`APM API tests basic apm_8.0.0 Transaction groups detailed statistics when data is loaded returns data with previous period returns correct error rate data 2`] = ` Array [ Object { "x": 1607436720000, @@ -138,7 +138,7 @@ Array [ ] `; -exports[`APM API tests basic apm_8.0.0 Transaction groups comparison statistics when data is loaded returns data with previous period returns correct latency data 1`] = ` +exports[`APM API tests basic apm_8.0.0 Transaction groups detailed statistics when data is loaded returns data with previous period returns correct latency data 1`] = ` Array [ Object { "x": 1607436720000, @@ -207,7 +207,7 @@ Array [ ] `; -exports[`APM API tests basic apm_8.0.0 Transaction groups comparison statistics when data is loaded returns data with previous period returns correct latency data 2`] = ` +exports[`APM API tests basic apm_8.0.0 Transaction groups detailed statistics when data is loaded returns data with previous period returns correct latency data 2`] = ` Array [ Object { "x": 1607436720000, @@ -276,7 +276,7 @@ Array [ ] `; -exports[`APM API tests basic apm_8.0.0 Transaction groups comparison statistics when data is loaded returns data with previous period returns correct throughput data 1`] = ` +exports[`APM API tests basic apm_8.0.0 Transaction groups detailed statistics when data is loaded returns data with previous period returns correct throughput data 1`] = ` Array [ Object { "x": 1607436720000, @@ -345,7 +345,7 @@ Array [ ] `; -exports[`APM API tests basic apm_8.0.0 Transaction groups comparison statistics when data is loaded returns data with previous period returns correct throughput data 2`] = ` +exports[`APM API tests basic apm_8.0.0 Transaction groups detailed statistics when data is loaded returns data with previous period returns correct throughput data 2`] = ` Array [ Object { "x": 1607436720000, @@ -414,7 +414,7 @@ Array [ ] `; -exports[`APM API tests basic apm_8.0.0 Transaction groups comparison statistics when data is loaded returns the correct data 1`] = ` +exports[`APM API tests basic apm_8.0.0 Transaction groups detailed statistics when data is loaded returns the correct data 1`] = ` Array [ Object { "x": 1607435820000, @@ -543,7 +543,7 @@ Array [ ] `; -exports[`APM API tests basic apm_8.0.0 Transaction groups comparison statistics when data is loaded returns the correct data 2`] = ` +exports[`APM API tests basic apm_8.0.0 Transaction groups detailed statistics when data is loaded returns the correct data 2`] = ` Array [ Object { "x": 1607435820000, @@ -672,7 +672,7 @@ Array [ ] `; -exports[`APM API tests basic apm_8.0.0 Transaction groups comparison statistics when data is loaded returns the correct data 3`] = ` +exports[`APM API tests basic apm_8.0.0 Transaction groups detailed statistics when data is loaded returns the correct data 3`] = ` Array [ Object { "x": 1607435820000, @@ -801,7 +801,7 @@ Array [ ] `; -exports[`APM API tests basic apm_8.0.0 Transaction groups comparison statistics when data is loaded returns the correct data for latency aggregation 99th percentile 1`] = ` +exports[`APM API tests basic apm_8.0.0 Transaction groups detailed statistics when data is loaded returns the correct data for latency aggregation 99th percentile 1`] = ` Array [ Object { "x": 1607435820000, diff --git a/x-pack/test/apm_api_integration/tests/transactions/transactions_groups_comparison_statistics.ts b/x-pack/test/apm_api_integration/tests/transactions/transactions_groups_detailed_statistics.ts similarity index 93% rename from x-pack/test/apm_api_integration/tests/transactions/transactions_groups_comparison_statistics.ts rename to x-pack/test/apm_api_integration/tests/transactions/transactions_groups_detailed_statistics.ts index 72fb0e832412d..303b8f715e957 100644 --- a/x-pack/test/apm_api_integration/tests/transactions/transactions_groups_comparison_statistics.ts +++ b/x-pack/test/apm_api_integration/tests/transactions/transactions_groups_detailed_statistics.ts @@ -15,7 +15,7 @@ import { FtrProviderContext } from '../../common/ftr_provider_context'; import { registry } from '../../common/registry'; import { removeEmptyCoordinates, roundNumber } from '../../utils'; -type TransactionsGroupsComparisonStatistics = APIReturnType<'GET /api/apm/services/{serviceName}/transactions/groups/comparison_statistics'>; +type TransactionsGroupsDetailedStatistics = APIReturnType<'GET /api/apm/services/{serviceName}/transactions/groups/detailed_statistics'>; export default function ApiTest({ getService }: FtrProviderContext) { const supertest = getService('supertest'); @@ -25,13 +25,13 @@ export default function ApiTest({ getService }: FtrProviderContext) { const transactionNames = ['DispatcherServlet#doGet', 'APIRestController#customers']; registry.when( - 'Transaction groups comparison statistics when data is not loaded', + 'Transaction groups detailed statistics when data is not loaded', { config: 'basic', archives: [] }, () => { it('handles the empty state', async () => { const response = await supertest.get( url.format({ - pathname: `/api/apm/services/opbeans-java/transactions/groups/comparison_statistics`, + pathname: `/api/apm/services/opbeans-java/transactions/groups/detailed_statistics`, query: { start, end, @@ -50,13 +50,13 @@ export default function ApiTest({ getService }: FtrProviderContext) { ); registry.when( - 'Transaction groups comparison statistics when data is loaded', + 'Transaction groups detailed statistics when data is loaded', { config: 'basic', archives: [archiveName] }, () => { it('returns the correct data', async () => { const response = await supertest.get( url.format({ - pathname: `/api/apm/services/opbeans-java/transactions/groups/comparison_statistics`, + pathname: `/api/apm/services/opbeans-java/transactions/groups/detailed_statistics`, query: { start, end, @@ -73,7 +73,7 @@ export default function ApiTest({ getService }: FtrProviderContext) { const { currentPeriod, previousPeriod, - } = response.body as TransactionsGroupsComparisonStatistics; + } = response.body as TransactionsGroupsDetailedStatistics; expect(Object.keys(currentPeriod).sort()).to.be.eql(transactionNames.sort()); @@ -110,7 +110,7 @@ export default function ApiTest({ getService }: FtrProviderContext) { it('returns the correct data for latency aggregation 99th percentile', async () => { const response = await supertest.get( url.format({ - pathname: `/api/apm/services/opbeans-java/transactions/groups/comparison_statistics`, + pathname: `/api/apm/services/opbeans-java/transactions/groups/detailed_statistics`, query: { start, end, @@ -127,7 +127,7 @@ export default function ApiTest({ getService }: FtrProviderContext) { const { currentPeriod, previousPeriod, - } = response.body as TransactionsGroupsComparisonStatistics; + } = response.body as TransactionsGroupsDetailedStatistics; expect(Object.keys(currentPeriod).sort()).to.be.eql(transactionNames.sort()); @@ -158,7 +158,7 @@ export default function ApiTest({ getService }: FtrProviderContext) { it('returns empty when transaction name is not found', async () => { const response = await supertest.get( url.format({ - pathname: `/api/apm/services/opbeans-java/transactions/groups/comparison_statistics`, + pathname: `/api/apm/services/opbeans-java/transactions/groups/detailed_statistics`, query: { start, end, @@ -175,12 +175,12 @@ export default function ApiTest({ getService }: FtrProviderContext) { }); describe('returns data with previous period', async () => { - let currentPeriod: TransactionsGroupsComparisonStatistics['currentPeriod']; - let previousPeriod: TransactionsGroupsComparisonStatistics['previousPeriod']; + let currentPeriod: TransactionsGroupsDetailedStatistics['currentPeriod']; + let previousPeriod: TransactionsGroupsDetailedStatistics['previousPeriod']; before(async () => { const response = await supertest.get( url.format({ - pathname: `/api/apm/services/opbeans-java/transactions/groups/comparison_statistics`, + pathname: `/api/apm/services/opbeans-java/transactions/groups/detailed_statistics`, query: { numBuckets: 20, transactionType: 'request', diff --git a/x-pack/test/apm_api_integration/tests/transactions/transactions_groups_primary_statistics.ts b/x-pack/test/apm_api_integration/tests/transactions/transactions_groups_main_statistics.ts similarity index 94% rename from x-pack/test/apm_api_integration/tests/transactions/transactions_groups_primary_statistics.ts rename to x-pack/test/apm_api_integration/tests/transactions/transactions_groups_main_statistics.ts index b6fd4054a351c..a2da077864b99 100644 --- a/x-pack/test/apm_api_integration/tests/transactions/transactions_groups_primary_statistics.ts +++ b/x-pack/test/apm_api_integration/tests/transactions/transactions_groups_main_statistics.ts @@ -13,7 +13,7 @@ import { FtrProviderContext } from '../../common/ftr_provider_context'; import archives from '../../common/fixtures/es_archiver/archives_metadata'; import { registry } from '../../common/registry'; -type TransactionsGroupsPrimaryStatistics = APIReturnType<'GET /api/apm/services/{serviceName}/transactions/groups/primary_statistics'>; +type TransactionsGroupsPrimaryStatistics = APIReturnType<'GET /api/apm/services/{serviceName}/transactions/groups/main_statistics'>; export default function ApiTest({ getService }: FtrProviderContext) { const supertest = getService('supertest'); @@ -22,13 +22,13 @@ export default function ApiTest({ getService }: FtrProviderContext) { const { start, end } = archives[archiveName]; registry.when( - 'Transaction groups primary statistics when data is not loaded', + 'Transaction groups main statistics when data is not loaded', { config: 'basic', archives: [] }, () => { it('handles the empty state', async () => { const response = await supertest.get( url.format({ - pathname: `/api/apm/services/opbeans-java/transactions/groups/primary_statistics`, + pathname: `/api/apm/services/opbeans-java/transactions/groups/main_statistics`, query: { start, end, @@ -47,13 +47,13 @@ export default function ApiTest({ getService }: FtrProviderContext) { ); registry.when( - 'Transaction groups primary statistics when data is loaded', + 'Transaction groups main statistics when data is loaded', { config: 'basic', archives: [archiveName] }, () => { it('returns the correct data', async () => { const response = await supertest.get( url.format({ - pathname: `/api/apm/services/opbeans-java/transactions/groups/primary_statistics`, + pathname: `/api/apm/services/opbeans-java/transactions/groups/main_statistics`, query: { start, end, @@ -125,7 +125,7 @@ export default function ApiTest({ getService }: FtrProviderContext) { it('returns the correct data for latency aggregation 99th percentile', async () => { const response = await supertest.get( url.format({ - pathname: `/api/apm/services/opbeans-java/transactions/groups/primary_statistics`, + pathname: `/api/apm/services/opbeans-java/transactions/groups/main_statistics`, query: { start, end, diff --git a/x-pack/test/detection_engine_api_integration/security_and_spaces/tests/create_exceptions.ts b/x-pack/test/detection_engine_api_integration/security_and_spaces/tests/create_exceptions.ts index e8beef3e58a43..18f9858726723 100644 --- a/x-pack/test/detection_engine_api_integration/security_and_spaces/tests/create_exceptions.ts +++ b/x-pack/test/detection_engine_api_integration/security_and_spaces/tests/create_exceptions.ts @@ -8,9 +8,20 @@ /* eslint-disable @typescript-eslint/naming-convention */ import expect from '@kbn/expect'; -import { CreateRulesSchema } from '../../../../plugins/security_solution/common/detection_engine/schemas/request'; +import { + CreateRulesSchema, + EqlCreateSchema, + QueryCreateSchema, + ThreatMatchCreateSchema, + ThresholdCreateSchema, +} from '../../../../plugins/security_solution/common/detection_engine/schemas/request'; import { getCreateExceptionListItemMinimalSchemaMock } from '../../../../plugins/lists/common/schemas/request/create_exception_list_item_schema.mock'; -import { deleteAllExceptions } from '../../../lists_api_integration/utils'; +import { + createListsIndex, + deleteAllExceptions, + deleteListsIndex, + importFile, +} from '../../../lists_api_integration/utils'; import { RulesSchema } from '../../../../plugins/security_solution/common/detection_engine/schemas/response'; import { getCreateExceptionListMinimalSchemaMock } from '../../../../plugins/lists/common/schemas/request/create_exception_list_schema.mock'; import { CreateExceptionListItemSchema } from '../../../../plugins/lists/common'; @@ -39,6 +50,9 @@ import { getSignalsByIds, findImmutableRuleById, getPrePackagedRulesStatus, + getRuleForSignalTesting, + getOpenSignals, + createRuleWithExceptionEntries, } from '../../utils'; import { ROLES } from '../../../../plugins/security_solution/common/test'; import { createUserAndRole, deleteUserAndRole } from '../roles_users_utils'; @@ -576,49 +590,211 @@ export default ({ getService }: FtrProviderContext) => { }); it('should be able to execute against an exception list that does include valid entries and get back 0 signals', async () => { - const { id, list_id, namespace_type, type } = await createExceptionList( - supertest, - getCreateExceptionListMinimalSchemaMock() - ); - - const exceptionListItem: CreateExceptionListItemSchema = { - ...getCreateExceptionListItemMinimalSchemaMock(), - entries: [ + const rule: QueryCreateSchema = { + name: 'Simple Rule Query', + description: 'Simple Rule Query', + enabled: true, + risk_score: 1, + rule_id: 'rule-1', + severity: 'high', + index: ['auditbeat-*'], + type: 'query', + from: '1900-01-01T00:00:00.000Z', + query: 'host.name: "suricata-sensor-amsterdam"', + }; + const createdRule = await createRuleWithExceptionEntries(supertest, rule, [ + [ { - field: 'host.name', // This matches the query below which will exclude everything + field: 'host.name', // This matches the query above which will exclude everything operator: 'included', type: 'match', value: 'suricata-sensor-amsterdam', }, ], + ]); + const signalsOpen = await getOpenSignals(supertest, es, createdRule); + expect(signalsOpen.hits.hits.length).equal(0); + }); + + it('generates no signals when an exception is added for an EQL rule', async () => { + const rule: EqlCreateSchema = { + ...getRuleForSignalTesting(['auditbeat-*']), + rule_id: 'eql-rule', + type: 'eql', + language: 'eql', + query: 'configuration where agent.id=="a1d7b39c-f898-4dbe-a761-efb61939302d"', }; - await createExceptionListItem(supertest, exceptionListItem); + const createdRule = await createRuleWithExceptionEntries(supertest, rule, [ + [ + { + field: 'host.id', + operator: 'included', + type: 'match', + value: '8cc95778cce5407c809480e8e32ad76b', + }, + ], + ]); + const signalsOpen = await getOpenSignals(supertest, es, createdRule); + expect(signalsOpen.hits.hits.length).equal(0); + }); - const ruleWithException: CreateRulesSchema = { - name: 'Simple Rule Query', - description: 'Simple Rule Query', - enabled: true, - risk_score: 1, - rule_id: 'rule-1', + it('generates no signals when an exception is added for a threshold rule', async () => { + const rule: ThresholdCreateSchema = { + ...getRuleForSignalTesting(['auditbeat-*']), + rule_id: 'threshold-rule', + type: 'threshold', + language: 'kuery', + query: '*:*', + threshold: { + field: 'host.id', + value: 700, + }, + }; + const createdRule = await createRuleWithExceptionEntries(supertest, rule, [ + [ + { + field: 'host.id', + operator: 'included', + type: 'match', + value: '8cc95778cce5407c809480e8e32ad76b', + }, + ], + ]); + const signalsOpen = await getOpenSignals(supertest, es, createdRule); + expect(signalsOpen.hits.hits.length).equal(0); + }); + + it('generates no signals when an exception is added for a threat match rule', async () => { + const rule: ThreatMatchCreateSchema = { + description: 'Detecting root and admin users', + name: 'Query with a rule id', severity: 'high', index: ['auditbeat-*'], - type: 'query', + type: 'threat_match', + risk_score: 55, + language: 'kuery', + rule_id: 'rule-1', from: '1900-01-01T00:00:00.000Z', - query: 'host.name: "suricata-sensor-amsterdam"', - exceptions_list: [ + query: '*:*', + threat_query: 'source.ip: "188.166.120.93"', // narrow things down with a query to a specific source ip + threat_index: ['auditbeat-*'], // We use auditbeat as both the matching index and the threat list for simplicity + threat_mapping: [ + // We match host.name against host.name { - id, - list_id, - namespace_type, - type, + entries: [ + { + field: 'host.name', + value: 'host.name', + type: 'mapping', + }, + ], }, ], + threat_filters: [], }; - const rule = await createRule(supertest, ruleWithException); - await waitForRuleSuccessOrStatus(supertest, rule.id); - const signalsOpen = await getSignalsByIds(supertest, [rule.id]); + + const createdRule = await createRuleWithExceptionEntries(supertest, rule, [ + [ + { + field: 'source.ip', + operator: 'included', + type: 'match', + value: '188.166.120.93', + }, + ], + ]); + const signalsOpen = await getOpenSignals(supertest, es, createdRule); expect(signalsOpen.hits.hits.length).equal(0); }); + describe('rules with value list exceptions', () => { + beforeEach(async () => { + await createListsIndex(supertest); + }); + + afterEach(async () => { + await deleteListsIndex(supertest); + }); + + it('generates no signals when a value list exception is added for a query rule', async () => { + const valueListId = 'value-list-id'; + await importFile(supertest, 'keyword', ['suricata-sensor-amsterdam'], valueListId); + const rule: QueryCreateSchema = { + name: 'Simple Rule Query', + description: 'Simple Rule Query', + enabled: true, + risk_score: 1, + rule_id: 'rule-1', + severity: 'high', + index: ['auditbeat-*'], + type: 'query', + from: '1900-01-01T00:00:00.000Z', + query: 'host.name: "suricata-sensor-amsterdam"', + }; + const createdRule = await createRuleWithExceptionEntries(supertest, rule, [ + [ + { + field: 'host.name', + operator: 'included', + type: 'list', + list: { + id: valueListId, + type: 'keyword', + }, + }, + ], + ]); + const signalsOpen = await getOpenSignals(supertest, es, createdRule); + expect(signalsOpen.hits.hits.length).equal(0); + }); + + it('generates no signals when a value list exception is added for a threat match rule', async () => { + const valueListId = 'value-list-id'; + await importFile(supertest, 'keyword', ['zeek-sensor-amsterdam'], valueListId); + const rule: ThreatMatchCreateSchema = { + description: 'Detecting root and admin users', + name: 'Query with a rule id', + severity: 'high', + index: ['auditbeat-*'], + type: 'threat_match', + risk_score: 55, + language: 'kuery', + rule_id: 'rule-1', + from: '1900-01-01T00:00:00.000Z', + query: '*:*', + threat_query: 'source.ip: "188.166.120.93"', // narrow things down with a query to a specific source ip + threat_index: ['auditbeat-*'], // We use auditbeat as both the matching index and the threat list for simplicity + threat_mapping: [ + // We match host.name against host.name + { + entries: [ + { + field: 'host.name', + value: 'host.name', + type: 'mapping', + }, + ], + }, + ], + threat_filters: [], + }; + + const createdRule = await createRuleWithExceptionEntries(supertest, rule, [ + [ + { + field: 'host.name', + operator: 'included', + type: 'list', + list: { + id: valueListId, + type: 'keyword', + }, + }, + ], + ]); + const signalsOpen = await getOpenSignals(supertest, es, createdRule); + expect(signalsOpen.hits.hits.length).equal(0); + }); + }); }); }); }); diff --git a/x-pack/test/detection_engine_api_integration/security_and_spaces/tests/generating_signals.ts b/x-pack/test/detection_engine_api_integration/security_and_spaces/tests/generating_signals.ts index 08fb9222e1789..4ae949d0cba86 100644 --- a/x-pack/test/detection_engine_api_integration/security_and_spaces/tests/generating_signals.ts +++ b/x-pack/test/detection_engine_api_integration/security_and_spaces/tests/generating_signals.ts @@ -6,11 +6,12 @@ */ import expect from '@kbn/expect'; -import { orderBy } from 'lodash'; +import { orderBy, get } from 'lodash'; import { EqlCreateSchema, QueryCreateSchema, + ThresholdCreateSchema, } from '../../../../plugins/security_solution/common/detection_engine/schemas/request'; import { DEFAULT_SIGNALS_INDEX } from '../../../../plugins/security_solution/common/constants'; import { FtrProviderContext } from '../../common/ftr_provider_context'; @@ -19,6 +20,7 @@ import { createSignalsIndex, deleteAllAlerts, deleteSignalsIndex, + getOpenSignals, getRuleForSignalTesting, getSignalsByIds, getSignalsByRuleIds, @@ -38,6 +40,7 @@ export const ID = 'BhbXBmkBR346wHgn4PeZ'; export default ({ getService }: FtrProviderContext) => { const supertest = getService('supertest'); const esArchiver = getService('esArchiver'); + const es = getService('es'); describe('Generating signals from source indexes', () => { beforeEach(async () => { @@ -216,19 +219,286 @@ export default ({ getService }: FtrProviderContext) => { }); describe('EQL Rules', () => { - it('generates signals from EQL sequences in the expected form', async () => { + it('generates a correctly formatted signal from EQL non-sequence queries', async () => { const rule: EqlCreateSchema = { ...getRuleForSignalTesting(['auditbeat-*']), rule_id: 'eql-rule', type: 'eql', language: 'eql', - query: 'sequence by host.name [any where true] [any where true]', + query: 'configuration where agent.id=="a1d7b39c-f898-4dbe-a761-efb61939302d"', }; const { id } = await createRule(supertest, rule); await waitForRuleSuccessOrStatus(supertest, id); await waitForSignalsToBePresent(supertest, 1, [id]); const signals = await getSignalsByRuleIds(supertest, ['eql-rule']); - const signal = signals.hits.hits[0]._source.signal; + expect(signals.hits.hits.length).eql(1); + const fullSignal = signals.hits.hits[0]._source; + + expect(fullSignal).eql({ + '@timestamp': fullSignal['@timestamp'], + agent: { + ephemeral_id: '0010d67a-14f7-41da-be30-489fea735967', + hostname: 'suricata-zeek-sensor-toronto', + id: 'a1d7b39c-f898-4dbe-a761-efb61939302d', + type: 'auditbeat', + version: '8.0.0', + }, + auditd: { + data: { + audit_enabled: '1', + old: '1', + }, + message_type: 'config_change', + result: 'success', + sequence: 1496, + session: 'unset', + summary: { + actor: { + primary: 'unset', + }, + object: { + primary: '1', + type: 'audit-config', + }, + }, + }, + cloud: { + instance: { + id: '133555295', + }, + provider: 'digitalocean', + region: 'tor1', + }, + ecs: { + version: '1.0.0-beta2', + }, + event: { + action: 'changed-audit-configuration', + category: 'configuration', + module: 'auditd', + kind: 'signal', + }, + host: { + architecture: 'x86_64', + containerized: false, + hostname: 'suricata-zeek-sensor-toronto', + id: '8cc95778cce5407c809480e8e32ad76b', + name: 'suricata-zeek-sensor-toronto', + os: { + codename: 'bionic', + family: 'debian', + kernel: '4.15.0-45-generic', + name: 'Ubuntu', + platform: 'ubuntu', + version: '18.04.2 LTS (Bionic Beaver)', + }, + }, + service: { + type: 'auditd', + }, + user: { + audit: { + id: 'unset', + }, + }, + signal: { + rule: fullSignal.signal.rule, + original_time: fullSignal.signal.original_time, + status: 'open', + depth: 1, + ancestors: [ + { + depth: 0, + id: '9xbRBmkBR346wHgngz2D', + index: 'auditbeat-8.0.0-2019.02.19-000001', + type: 'event', + }, + ], + original_event: { + action: 'changed-audit-configuration', + category: 'configuration', + module: 'auditd', + }, + parent: { + depth: 0, + id: '9xbRBmkBR346wHgngz2D', + index: 'auditbeat-8.0.0-2019.02.19-000001', + type: 'event', + }, + parents: [ + { + depth: 0, + id: '9xbRBmkBR346wHgngz2D', + index: 'auditbeat-8.0.0-2019.02.19-000001', + type: 'event', + }, + ], + _meta: { + version: SIGNALS_TEMPLATE_VERSION, + }, + }, + }); + }); + + it('generates up to max_signals for non-sequence EQL queries', async () => { + const rule: EqlCreateSchema = { + ...getRuleForSignalTesting(['auditbeat-*']), + rule_id: 'eql-rule', + type: 'eql', + language: 'eql', + query: 'any where true', + }; + const { id } = await createRule(supertest, rule); + await waitForRuleSuccessOrStatus(supertest, id); + await waitForSignalsToBePresent(supertest, 100, [id]); + const signals = await getSignalsByIds(supertest, [id], 1000); + const filteredSignals = signals.hits.hits.filter( + (signal) => signal._source.signal.depth === 1 + ); + expect(filteredSignals.length).eql(100); + }); + + it('uses the provided event_category_override', async () => { + const rule: EqlCreateSchema = { + ...getRuleForSignalTesting(['auditbeat-*']), + rule_id: 'eql-rule', + type: 'eql', + language: 'eql', + query: 'config_change where agent.id=="a1d7b39c-f898-4dbe-a761-efb61939302d"', + event_category_override: 'auditd.message_type', + }; + const { id } = await createRule(supertest, rule); + await waitForRuleSuccessOrStatus(supertest, id); + await waitForSignalsToBePresent(supertest, 1, [id]); + const signals = await getSignalsByRuleIds(supertest, ['eql-rule']); + expect(signals.hits.hits.length).eql(1); + const fullSignal = signals.hits.hits[0]._source; + + expect(fullSignal).eql({ + '@timestamp': fullSignal['@timestamp'], + agent: { + ephemeral_id: '0010d67a-14f7-41da-be30-489fea735967', + hostname: 'suricata-zeek-sensor-toronto', + id: 'a1d7b39c-f898-4dbe-a761-efb61939302d', + type: 'auditbeat', + version: '8.0.0', + }, + auditd: { + data: { + audit_enabled: '1', + old: '1', + }, + message_type: 'config_change', + result: 'success', + sequence: 1496, + session: 'unset', + summary: { + actor: { + primary: 'unset', + }, + object: { + primary: '1', + type: 'audit-config', + }, + }, + }, + cloud: { + instance: { + id: '133555295', + }, + provider: 'digitalocean', + region: 'tor1', + }, + ecs: { + version: '1.0.0-beta2', + }, + event: { + action: 'changed-audit-configuration', + category: 'configuration', + module: 'auditd', + kind: 'signal', + }, + host: { + architecture: 'x86_64', + containerized: false, + hostname: 'suricata-zeek-sensor-toronto', + id: '8cc95778cce5407c809480e8e32ad76b', + name: 'suricata-zeek-sensor-toronto', + os: { + codename: 'bionic', + family: 'debian', + kernel: '4.15.0-45-generic', + name: 'Ubuntu', + platform: 'ubuntu', + version: '18.04.2 LTS (Bionic Beaver)', + }, + }, + service: { + type: 'auditd', + }, + user: { + audit: { + id: 'unset', + }, + }, + signal: { + rule: fullSignal.signal.rule, + original_time: fullSignal.signal.original_time, + status: 'open', + depth: 1, + ancestors: [ + { + depth: 0, + id: '9xbRBmkBR346wHgngz2D', + index: 'auditbeat-8.0.0-2019.02.19-000001', + type: 'event', + }, + ], + original_event: { + action: 'changed-audit-configuration', + category: 'configuration', + module: 'auditd', + }, + parent: { + depth: 0, + id: '9xbRBmkBR346wHgngz2D', + index: 'auditbeat-8.0.0-2019.02.19-000001', + type: 'event', + }, + parents: [ + { + depth: 0, + id: '9xbRBmkBR346wHgngz2D', + index: 'auditbeat-8.0.0-2019.02.19-000001', + type: 'event', + }, + ], + _meta: { + version: SIGNALS_TEMPLATE_VERSION, + }, + }, + }); + }); + + it('generates building block signals from EQL sequences in the expected form', async () => { + const rule: EqlCreateSchema = { + ...getRuleForSignalTesting(['auditbeat-*']), + rule_id: 'eql-rule', + type: 'eql', + language: 'eql', + query: 'sequence by host.name [anomoly where true] [any where true]', + }; + const { id } = await createRule(supertest, rule); + await waitForRuleSuccessOrStatus(supertest, id); + await waitForSignalsToBePresent(supertest, 3, [id]); + const signals = await getSignalsByRuleIds(supertest, ['eql-rule']); + const buildingBlock = signals.hits.hits.find( + (signal) => + signal._source.signal.depth === 1 && + get(signal._source, 'signal.original_event.category') === 'anomoly' + ); + expect(buildingBlock).not.eql(undefined); + const signal = buildingBlock!._source.signal; expect(signal).eql({ rule: signal.rule, @@ -239,26 +509,26 @@ export default ({ getService }: FtrProviderContext) => { ancestors: [ { depth: 0, - id: 'gCF0B2kBR346wHgnb7m0', + id: 'VhXOBmkBR346wHgnLP8T', index: 'auditbeat-8.0.0-2019.02.19-000001', type: 'event', }, ], original_event: { - action: 'error', - category: 'user-login', + action: 'changed-promiscuous-mode-on-device', + category: 'anomoly', module: 'auditd', }, parent: { depth: 0, - id: 'gCF0B2kBR346wHgnb7m0', + id: 'VhXOBmkBR346wHgnLP8T', index: 'auditbeat-8.0.0-2019.02.19-000001', type: 'event', }, parents: [ { depth: 0, - id: 'gCF0B2kBR346wHgnb7m0', + id: 'VhXOBmkBR346wHgnLP8T', index: 'auditbeat-8.0.0-2019.02.19-000001', type: 'event', }, @@ -269,24 +539,23 @@ export default ({ getService }: FtrProviderContext) => { }); }); - it('generates building block signals from EQL sequences in the expected form', async () => { + it('generates shell signals from EQL sequences in the expected form', async () => { const rule: EqlCreateSchema = { ...getRuleForSignalTesting(['auditbeat-*']), rule_id: 'eql-rule', type: 'eql', language: 'eql', - query: 'sequence by host.name [any where true] [any where true]', + query: 'sequence by host.name [anomoly where true] [any where true]', }; const { id } = await createRule(supertest, rule); await waitForRuleSuccessOrStatus(supertest, id); - await waitForSignalsToBePresent(supertest, 10, [id]); + await waitForSignalsToBePresent(supertest, 3, [id]); const signalsOpen = await getSignalsByRuleIds(supertest, ['eql-rule']); const sequenceSignal = signalsOpen.hits.hits.find( (signal) => signal._source.signal.depth === 2 ); const signal = sequenceSignal!._source.signal; const eventIds = signal.parents.map((event) => event.id); - expect(signal).eql({ status: 'open', depth: 2, @@ -295,7 +564,7 @@ export default ({ getService }: FtrProviderContext) => { ancestors: [ { depth: 0, - id: 'gCF0B2kBR346wHgnb7m0', + id: 'VhXOBmkBR346wHgnLP8T', index: 'auditbeat-8.0.0-2019.02.19-000001', type: 'event', }, @@ -308,7 +577,7 @@ export default ({ getService }: FtrProviderContext) => { }, { depth: 0, - id: 'CCF0B2kBR346wHgngLtX', + id: '4hbXBmkBR346wHgn6fdp', index: 'auditbeat-8.0.0-2019.02.19-000001', type: 'event', }, @@ -341,6 +610,249 @@ export default ({ getService }: FtrProviderContext) => { }, }); }); + + it('generates up to max_signals with an EQL rule', async () => { + const rule: EqlCreateSchema = { + ...getRuleForSignalTesting(['auditbeat-*']), + rule_id: 'eql-rule', + type: 'eql', + language: 'eql', + query: 'sequence by host.name [any where true] [any where true]', + }; + const { id } = await createRule(supertest, rule); + await waitForRuleSuccessOrStatus(supertest, id); + // For EQL rules, max_signals is the maximum number of detected sequences: each sequence has a building block + // alert for each event in the sequence, so max_signals=100 results in 200 building blocks in addition to + // 100 regular alerts + await waitForSignalsToBePresent(supertest, 300, [id]); + const signalsOpen = await getSignalsByIds(supertest, [id], 1000); + expect(signalsOpen.hits.hits.length).eql(300); + const shellSignals = signalsOpen.hits.hits.filter( + (signal) => signal._source.signal.depth === 2 + ); + const buildingBlocks = signalsOpen.hits.hits.filter( + (signal) => signal._source.signal.depth === 1 + ); + expect(shellSignals.length).eql(100); + expect(buildingBlocks.length).eql(200); + }); + }); + + describe('Threshold Rules', () => { + it('generates 1 signal from Threshold rules when threshold is met', async () => { + const ruleId = 'threshold-rule'; + const rule: ThresholdCreateSchema = { + ...getRuleForSignalTesting(['auditbeat-*']), + rule_id: ruleId, + type: 'threshold', + language: 'kuery', + query: '*:*', + threshold: { + field: 'host.id', + value: 700, + }, + }; + const { id } = await createRule(supertest, rule); + await waitForRuleSuccessOrStatus(supertest, id); + await waitForSignalsToBePresent(supertest, 1, [id]); + const signalsOpen = await getSignalsByRuleIds(supertest, [ruleId]); + expect(signalsOpen.hits.hits.length).eql(1); + const signal = signalsOpen.hits.hits[0]; + expect(signal._source.signal.threshold_result).eql({ + terms: [ + { + field: 'host.id', + value: '8cc95778cce5407c809480e8e32ad76b', + }, + ], + count: 788, + from: '1900-01-01T00:00:00.000Z', + }); + }); + + it('generates 2 signals from Threshold rules when threshold is met', async () => { + const ruleId = 'threshold-rule'; + const rule: ThresholdCreateSchema = { + ...getRuleForSignalTesting(['auditbeat-*']), + rule_id: ruleId, + type: 'threshold', + language: 'kuery', + query: '*:*', + threshold: { + field: 'host.id', + value: 100, + }, + }; + const { id } = await createRule(supertest, rule); + await waitForRuleSuccessOrStatus(supertest, id); + await waitForSignalsToBePresent(supertest, 2, [id]); + const signalsOpen = await getSignalsByRuleIds(supertest, [ruleId]); + expect(signalsOpen.hits.hits.length).eql(2); + }); + + it('applies the provided query before bucketing ', async () => { + const ruleId = 'threshold-rule'; + const rule: ThresholdCreateSchema = { + ...getRuleForSignalTesting(['auditbeat-*']), + rule_id: ruleId, + type: 'threshold', + language: 'kuery', + query: 'host.id:"2ab45fc1c41e4c84bbd02202a7e5761f"', + threshold: { + field: 'process.name', + value: 21, + }, + }; + const { id } = await createRule(supertest, rule); + await waitForRuleSuccessOrStatus(supertest, id); + await waitForSignalsToBePresent(supertest, 1, [id]); + const signalsOpen = await getSignalsByRuleIds(supertest, [ruleId]); + expect(signalsOpen.hits.hits.length).eql(1); + }); + + it('generates no signals from Threshold rules when threshold is met and cardinality is not met', async () => { + const ruleId = 'threshold-rule'; + const rule: ThresholdCreateSchema = { + ...getRuleForSignalTesting(['auditbeat-*']), + rule_id: ruleId, + type: 'threshold', + language: 'kuery', + query: '*:*', + threshold: { + field: 'host.id', + value: 100, + cardinality: [ + { + field: 'destination.ip', + value: 100, + }, + ], + }, + }; + const createdRule = await createRule(supertest, rule); + const signalsOpen = await getOpenSignals(supertest, es, createdRule); + expect(signalsOpen.hits.hits.length).eql(0); + }); + + it('generates no signals from Threshold rules when cardinality is met and threshold is not met', async () => { + const ruleId = 'threshold-rule'; + const rule: ThresholdCreateSchema = { + ...getRuleForSignalTesting(['auditbeat-*']), + rule_id: ruleId, + type: 'threshold', + language: 'kuery', + query: '*:*', + threshold: { + field: 'host.id', + value: 1000, + cardinality: [ + { + field: 'destination.ip', + value: 5, + }, + ], + }, + }; + const createdRule = await createRule(supertest, rule); + const signalsOpen = await getOpenSignals(supertest, es, createdRule); + expect(signalsOpen.hits.hits.length).eql(0); + }); + + it('generates signals from Threshold rules when threshold and cardinality are both met', async () => { + const ruleId = 'threshold-rule'; + const rule: ThresholdCreateSchema = { + ...getRuleForSignalTesting(['auditbeat-*']), + rule_id: ruleId, + type: 'threshold', + language: 'kuery', + query: '*:*', + threshold: { + field: 'host.id', + value: 100, + cardinality: [ + { + field: 'destination.ip', + value: 5, + }, + ], + }, + }; + const createdRule = await createRule(supertest, rule); + const signalsOpen = await getOpenSignals(supertest, es, createdRule); + expect(signalsOpen.hits.hits.length).eql(1); + const signal = signalsOpen.hits.hits[0]; + expect(signal._source.signal.threshold_result).eql({ + terms: [ + { + field: 'host.id', + value: '8cc95778cce5407c809480e8e32ad76b', + }, + ], + cardinality: [ + { + field: 'destination.ip', + value: 7, + }, + ], + count: 788, + from: '1900-01-01T00:00:00.000Z', + }); + }); + + it('should not generate signals if only one field meets the threshold requirement', async () => { + const ruleId = 'threshold-rule'; + const rule: ThresholdCreateSchema = { + ...getRuleForSignalTesting(['auditbeat-*']), + rule_id: ruleId, + type: 'threshold', + language: 'kuery', + query: '*:*', + threshold: { + field: ['host.id', 'process.name'], + value: 22, + }, + }; + const createdRule = await createRule(supertest, rule); + const signalsOpen = await getOpenSignals(supertest, es, createdRule); + expect(signalsOpen.hits.hits.length).eql(0); + }); + + it('generates signals from Threshold rules when bucketing by multiple fields', async () => { + const ruleId = 'threshold-rule'; + const rule: ThresholdCreateSchema = { + ...getRuleForSignalTesting(['auditbeat-*']), + rule_id: ruleId, + type: 'threshold', + language: 'kuery', + query: '*:*', + threshold: { + field: ['host.id', 'process.name', 'event.module'], + value: 21, + }, + }; + const createdRule = await createRule(supertest, rule); + const signalsOpen = await getOpenSignals(supertest, es, createdRule); + expect(signalsOpen.hits.hits.length).eql(1); + const signal = signalsOpen.hits.hits[0]; + expect(signal._source.signal.threshold_result).eql({ + terms: [ + { + field: 'event.module', + value: 'system', + }, + { + field: 'host.id', + value: '2ab45fc1c41e4c84bbd02202a7e5761f', + }, + { + field: 'process.name', + value: 'sshd', + }, + ], + count: 21, + from: '1900-01-01T00:00:00.000Z', + }); + }); }); }); @@ -807,5 +1319,118 @@ export default ({ getService }: FtrProviderContext) => { }); }); }); + + describe('Signals generated from events with timestamp override field and ensures search_after continues to work when documents are missing timestamp override field', () => { + beforeEach(async () => { + await createSignalsIndex(supertest); + await esArchiver.load('auditbeat/hosts'); + }); + + afterEach(async () => { + await deleteSignalsIndex(supertest); + await deleteAllAlerts(supertest); + await esArchiver.unload('auditbeat/hosts'); + }); + + /** + * This represents our worst case scenario where this field is not mapped on any index + * We want to check that our logic continues to function within the constraints of search after + * Elasticsearch returns java's long.MAX_VALUE for unmapped date fields + * Javascript does not support numbers this large, but without passing in a number of this size + * The search_after will continue to return the same results and not iterate to the next set + * So to circumvent this limitation of javascript we return the stringified version of Java's + * Long.MAX_VALUE so that search_after does not enter into an infinite loop. + * + * ref: https://github.com/elastic/elasticsearch/issues/28806#issuecomment-369303620 + */ + it('should generate 200 signals when timestamp override does not exist', async () => { + const rule: QueryCreateSchema = { + ...getRuleForSignalTesting(['auditbeat-*']), + timestamp_override: 'event.fakeingested', + max_signals: 200, + }; + + const { id } = await createRule(supertest, rule); + await waitForRuleSuccessOrStatus(supertest, id, 'partial failure'); + await waitForSignalsToBePresent(supertest, 200, [id]); + const signalsResponse = await getSignalsByIds(supertest, [id], 200); + const signals = signalsResponse.hits.hits.map((hit) => hit._source); + + expect(signals.length).equal(200); + }); + }); + + /** + * Here we test the functionality of timestamp overrides. If the rule specifies a timestamp override, + * then the documents will be queried and sorted using the timestamp override field. + * If no timestamp override field exists in the indices but one was provided to the rule, + * the rule's query will additionally search for events using the `@timestamp` field + */ + describe('Signals generated from events with timestamp override field', async () => { + beforeEach(async () => { + await deleteSignalsIndex(supertest); + await createSignalsIndex(supertest); + await esArchiver.load('security_solution/timestamp_override_1'); + await esArchiver.load('security_solution/timestamp_override_2'); + await esArchiver.load('security_solution/timestamp_override_3'); + await esArchiver.load('security_solution/timestamp_override_4'); + }); + + afterEach(async () => { + await deleteSignalsIndex(supertest); + await deleteAllAlerts(supertest); + await esArchiver.unload('security_solution/timestamp_override_1'); + await esArchiver.unload('security_solution/timestamp_override_2'); + await esArchiver.unload('security_solution/timestamp_override_3'); + await esArchiver.unload('security_solution/timestamp_override_4'); + }); + + it('should generate signals with event.ingested, @timestamp and (event.ingested + timestamp)', async () => { + const rule: QueryCreateSchema = { + ...getRuleForSignalTesting(['myfa*']), + timestamp_override: 'event.ingested', + }; + + const { id } = await createRule(supertest, rule); + + await waitForRuleSuccessOrStatus(supertest, id, 'partial failure'); + await waitForSignalsToBePresent(supertest, 3, [id]); + const signalsResponse = await getSignalsByIds(supertest, [id], 3); + const signals = signalsResponse.hits.hits.map((hit) => hit._source); + const signalsOrderedByEventId = orderBy(signals, 'signal.parent.id', 'asc'); + + expect(signalsOrderedByEventId.length).equal(3); + }); + + it('should generate 2 signals with @timestamp', async () => { + const rule: QueryCreateSchema = getRuleForSignalTesting(['myfa*']); + + const { id } = await createRule(supertest, rule); + + await waitForRuleSuccessOrStatus(supertest, id, 'partial failure'); + await waitForSignalsToBePresent(supertest, 2, [id]); + const signalsResponse = await getSignalsByIds(supertest, [id]); + const signals = signalsResponse.hits.hits.map((hit) => hit._source); + const signalsOrderedByEventId = orderBy(signals, 'signal.parent.id', 'asc'); + + expect(signalsOrderedByEventId.length).equal(2); + }); + + it('should generate 2 signals when timestamp override does not exist', async () => { + const rule: QueryCreateSchema = { + ...getRuleForSignalTesting(['myfa*']), + timestamp_override: 'event.fakeingestfield', + }; + const { id } = await createRule(supertest, rule); + + await waitForRuleSuccessOrStatus(supertest, id, 'partial failure'); + await waitForSignalsToBePresent(supertest, 2, [id]); + const signalsResponse = await getSignalsByIds(supertest, [id, id]); + const signals = signalsResponse.hits.hits.map((hit) => hit._source); + const signalsOrderedByEventId = orderBy(signals, 'signal.parent.id', 'asc'); + + expect(signalsOrderedByEventId.length).equal(2); + }); + }); }); }; diff --git a/x-pack/test/detection_engine_api_integration/utils.ts b/x-pack/test/detection_engine_api_integration/utils.ts index d821b57faf225..55011ec055190 100644 --- a/x-pack/test/detection_engine_api_integration/utils.ts +++ b/x-pack/test/detection_engine_api_integration/utils.ts @@ -778,6 +778,17 @@ export const countDownES = async ( ); }; +/** + * Refresh an index, making changes available to search. + * Useful for tests where we want to ensure that a rule does NOT create alerts, e.g. testing exceptions. + * @param es The ElasticSearch handle + */ +export const refreshIndex = async (es: KibanaClient, index?: string) => { + await es.indices.refresh({ + index, + }); +}; + /** * Does a plain countdown and checks against a boolean to determine if to wait and try again. * This is useful for over the wire things that can cause issues such as conflict or timeouts @@ -1107,7 +1118,7 @@ export const installPrePackagedRules = async ( */ export const createRuleWithExceptionEntries = async ( supertest: SuperTest, - rule: QueryCreateSchema, + rule: CreateRulesSchema, entries: NonEmptyEntriesArray[] ): Promise => { // eslint-disable-next-line @typescript-eslint/naming-convention @@ -1141,7 +1152,7 @@ export const createRuleWithExceptionEntries = async ( // the rule to sometimes not filter correctly the first time with an exception list // or other timing issues. Then afterwards wait for the rule to have succeeded before // returning. - const ruleWithException: QueryCreateSchema = { + const ruleWithException: CreateRulesSchema = { ...rule, enabled: false, exceptions_list: [ @@ -1202,3 +1213,16 @@ export const deleteMigrations = async ({ ) ); }; + +export const getOpenSignals = async ( + supertest: SuperTest, + es: KibanaClient, + rule: FullResponseSchema +) => { + await waitForRuleSuccessOrStatus(supertest, rule.id); + // Critically important that we wait for rule success AND refresh the write index in that order before we + // assert that no signals were created. Otherwise, signals could be written but not available to query yet + // when we search, causing tests that check that signals are NOT created to pass when they should fail. + await refreshIndex(es, rule.output_index); + return getSignalsByIds(supertest, [rule.id]); +}; diff --git a/x-pack/test/fleet_api_integration/apis/agents/reassign.ts b/x-pack/test/fleet_api_integration/apis/agents/reassign.ts index ad3c224bb9236..ac5aabc5c5084 100644 --- a/x-pack/test/fleet_api_integration/apis/agents/reassign.ts +++ b/x-pack/test/fleet_api_integration/apis/agents/reassign.ts @@ -157,7 +157,8 @@ export default function (providerContext: FtrProviderContext) { expect(body).to.eql({ agent2: { success: false, - error: 'Cannot reassign an agent from hosted agent policy policy1', + error: + 'Cannot reassign an agent from hosted agent policy policy1 in Fleet because the agent policy is managed by an external orchestration solution, such as Elastic Cloud, Kubernetes, etc. Please make changes using your orchestration solution.', }, INVALID_ID: { success: false, @@ -165,7 +166,8 @@ export default function (providerContext: FtrProviderContext) { }, agent3: { success: false, - error: 'Cannot reassign an agent from hosted agent policy policy1', + error: + 'Cannot reassign an agent from hosted agent policy policy1 in Fleet because the agent policy is managed by an external orchestration solution, such as Elastic Cloud, Kubernetes, etc. Please make changes using your orchestration solution.', }, }); diff --git a/x-pack/test/fleet_api_integration/apis/agents/unenroll.ts b/x-pack/test/fleet_api_integration/apis/agents/unenroll.ts index f0e41d75136c3..df213e82bac7c 100644 --- a/x-pack/test/fleet_api_integration/apis/agents/unenroll.ts +++ b/x-pack/test/fleet_api_integration/apis/agents/unenroll.ts @@ -138,11 +138,13 @@ export default function (providerContext: FtrProviderContext) { expect(unenrolledBody).to.eql({ agent2: { success: false, - error: 'Cannot unenroll agent2 from a hosted agent policy policy1', + error: + 'Cannot unenroll agent2 from a hosted agent policy policy1 in Fleet because the agent policy is managed by an external orchestration solution, such as Elastic Cloud, Kubernetes, etc. Please make changes using your orchestration solution.', }, agent3: { success: false, - error: 'Cannot unenroll agent3 from a hosted agent policy policy1', + error: + 'Cannot unenroll agent3 from a hosted agent policy policy1 in Fleet because the agent policy is managed by an external orchestration solution, such as Elastic Cloud, Kubernetes, etc. Please make changes using your orchestration solution.', }, }); // but agents are still enrolled diff --git a/x-pack/test/fleet_api_integration/apis/agents/upgrade.ts b/x-pack/test/fleet_api_integration/apis/agents/upgrade.ts index 142c360e9232a..b692699182cac 100644 --- a/x-pack/test/fleet_api_integration/apis/agents/upgrade.ts +++ b/x-pack/test/fleet_api_integration/apis/agents/upgrade.ts @@ -593,7 +593,11 @@ export default function (providerContext: FtrProviderContext) { .expect(200); expect(body).to.eql({ - agent1: { success: false, error: 'Cannot upgrade agent in hosted agent policy policy1' }, + agent1: { + success: false, + error: + 'Cannot upgrade agent in hosted agent policy policy1 in Fleet because the agent policy is managed by an external orchestration solution, such as Elastic Cloud, Kubernetes, etc. Please make changes using your orchestration solution.', + }, agent2: { success: true }, }); diff --git a/x-pack/test/fleet_api_integration/apis/fleet_setup.ts b/x-pack/test/fleet_api_integration/apis/fleet_setup.ts index 762a9f5302cef..5d0c40e63545a 100644 --- a/x-pack/test/fleet_api_integration/apis/fleet_setup.ts +++ b/x-pack/test/fleet_api_integration/apis/fleet_setup.ts @@ -75,7 +75,13 @@ export default function (providerContext: FtrProviderContext) { .map((p: any) => p.name) .sort(); - expect(installedPackages).to.eql(['elastic_agent', 'endpoint', 'fleet_server', 'system']); + expect(installedPackages).to.eql([ + 'elastic_agent', + 'endpoint', + 'fleet_server', + 'security_detection_engine', + 'system', + ]); }); }); } diff --git a/x-pack/test/fleet_api_integration/apis/index.js b/x-pack/test/fleet_api_integration/apis/index.js index 722d15751564d..4d2bf1d74a495 100644 --- a/x-pack/test/fleet_api_integration/apis/index.js +++ b/x-pack/test/fleet_api_integration/apis/index.js @@ -43,5 +43,8 @@ export default function ({ loadTestFile }) { // Preconfiguration loadTestFile(require.resolve('./preconfiguration/index')); + + // Service tokens + loadTestFile(require.resolve('./service_tokens')); }); } diff --git a/x-pack/test/fleet_api_integration/apis/service_tokens.ts b/x-pack/test/fleet_api_integration/apis/service_tokens.ts new file mode 100644 index 0000000000000..ddd4aed30f76b --- /dev/null +++ b/x-pack/test/fleet_api_integration/apis/service_tokens.ts @@ -0,0 +1,45 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import expect from '@kbn/expect'; +import { FtrProviderContext } from '../../api_integration/ftr_provider_context'; + +export default function (providerContext: FtrProviderContext) { + const { getService } = providerContext; + const supertest = getService('supertest'); + const esArchiver = getService('esArchiver'); + const esClient = getService('es'); + + describe('fleet_service_tokens', async () => { + before(async () => { + await esArchiver.load('empty_kibana'); + }); + + after(async () => { + await esArchiver.unload('empty_kibana'); + }); + + describe('POST /api/fleet/service-tokens', () => { + it('should create a valid service account token', async () => { + const { body: apiResponse } = await supertest + .post(`/api/fleet/service-tokens`) + .set('kbn-xsrf', 'xxxx') + .expect(200); + + expect(apiResponse).have.property('name'); + expect(apiResponse).have.property('value'); + + const { body: tokensResponse } = await esClient.transport.request({ + method: 'GET', + path: `_security/service/elastic/fleet-server/credential`, + }); + + expect(tokensResponse.tokens).have.property(apiResponse.name); + }); + }); + }); +} diff --git a/x-pack/test/fleet_api_integration/config.ts b/x-pack/test/fleet_api_integration/config.ts index 1257db7016501..2344bdc32904a 100644 --- a/x-pack/test/fleet_api_integration/config.ts +++ b/x-pack/test/fleet_api_integration/config.ts @@ -15,7 +15,7 @@ import { defineDockerServersConfig } from '@kbn/test'; // example: https://beats-ci.elastic.co/blue/organizations/jenkins/Ingest-manager%2Fpackage-storage/detail/snapshot/74/pipeline/257#step-302-log-1. // It should be updated any time there is a new Docker image published for the Snapshot Distribution of the Package Registry. export const dockerImage = - 'docker.elastic.co/package-registry/distribution:c5925eb82898dfc3e879a521871c7383513804c7'; + 'docker.elastic.co/package-registry/distribution:b6a53ac9300333a4a45f3f7d350c9aed72061a66'; export default async function ({ readConfigFile }: FtrConfigProviderContext) { const xPackAPITestsConfig = await readConfigFile(require.resolve('../api_integration/config.ts')); diff --git a/x-pack/test/functional/apps/canvas/feature_controls/canvas_security.ts b/x-pack/test/functional/apps/canvas/feature_controls/canvas_security.ts index b21fba54f1f1a..7f5f5d09f28db 100644 --- a/x-pack/test/functional/apps/canvas/feature_controls/canvas_security.ts +++ b/x-pack/test/functional/apps/canvas/feature_controls/canvas_security.ts @@ -34,7 +34,7 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) { kibana: [ { feature: { - canvas: ['all'], + canvas: ['minimal_all'], }, spaces: ['*'], }, diff --git a/x-pack/test/functional/apps/canvas/reports.ts b/x-pack/test/functional/apps/canvas/reports.ts index 4116a46fe51ae..7edbca783d928 100644 --- a/x-pack/test/functional/apps/canvas/reports.ts +++ b/x-pack/test/functional/apps/canvas/reports.ts @@ -20,7 +20,17 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { describe('Canvas PDF Report Generation', () => { before('initialize tests', async () => { log.debug('ReportingPage:initTests'); - await security.testUser.setRoles(['kibana_admin', 'reporting_user']); + await security.role.create('test_reporting_user', { + elasticsearch: { cluster: [], indices: [], run_as: [] }, + kibana: [ + { + spaces: ['*'], + base: [], + feature: { canvas: ['minimal_read', 'generate_report'] }, + }, + ], + }); + await security.testUser.setRoles(['kibana_admin', 'test_reporting_user']); await esArchiver.load('canvas/reports'); await browser.setWindowSize(1600, 850); }); diff --git a/x-pack/test/functional/apps/dashboard/_async_dashboard.ts b/x-pack/test/functional/apps/dashboard/_async_dashboard.ts index 5b2632ef710e4..88848401a4c9d 100644 --- a/x-pack/test/functional/apps/dashboard/_async_dashboard.ts +++ b/x-pack/test/functional/apps/dashboard/_async_dashboard.ts @@ -179,7 +179,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { log.debug('Checking area, bar and heatmap charts rendered'); await dashboardExpect.seriesElementCount(15); log.debug('Checking saved searches rendered'); - await dashboardExpect.savedSearchRowCount(50); + await dashboardExpect.savedSearchRowCount(11); log.debug('Checking input controls rendered'); await dashboardExpect.inputControlItemCount(3); log.debug('Checking tag cloud rendered'); diff --git a/x-pack/test/functional/apps/dashboard/reporting/screenshots.ts b/x-pack/test/functional/apps/dashboard/reporting/screenshots.ts index b16dc828e1776..a24b18490be74 100644 --- a/x-pack/test/functional/apps/dashboard/reporting/screenshots.ts +++ b/x-pack/test/functional/apps/dashboard/reporting/screenshots.ts @@ -20,6 +20,7 @@ const REPORTS_FOLDER = path.resolve(__dirname, 'reports'); export default function ({ getPageObjects, getService }: FtrProviderContext) { const PageObjects = getPageObjects(['reporting', 'common', 'dashboard']); const esArchiver = getService('esArchiver'); + const security = getService('security'); const browser = getService('browser'); const log = getService('log'); const config = getService('config'); @@ -29,10 +30,32 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) { describe('Dashboard Reporting Screenshots', () => { before('initialize tests', async () => { - log.debug('ReportingPage:initTests'); await esArchiver.loadIfNeeded('reporting/ecommerce'); await esArchiver.loadIfNeeded('reporting/ecommerce_kibana'); await browser.setWindowSize(1600, 850); + + await security.role.create('test_reporting_user', { + elasticsearch: { + cluster: [], + indices: [ + { + names: ['ecommerce'], + privileges: ['read'], + field_security: { grant: ['*'], except: [] }, + }, + ], + run_as: [], + }, + kibana: [ + { + spaces: ['*'], + base: [], + feature: { dashboard: ['minimal_all', 'generate_report'] }, + }, + ], + }); + + await security.testUser.setRoles(['test_reporting_user']); }); after('clean up archives', async () => { await esArchiver.unload('reporting/ecommerce'); @@ -42,6 +65,7 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) { refresh: true, body: { query: { match_all: {} } }, }); + await security.testUser.restoreDefaults(); }); describe('Print PDF button', () => { diff --git a/x-pack/test/functional/apps/dashboard/sync_colors.ts b/x-pack/test/functional/apps/dashboard/sync_colors.ts index 09575c355913e..3a135fb41a58d 100644 --- a/x-pack/test/functional/apps/dashboard/sync_colors.ts +++ b/x-pack/test/functional/apps/dashboard/sync_colors.ts @@ -33,7 +33,8 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { return colorMapping; } - describe('sync colors', function () { + // FLAKY: https://github.com/elastic/kibana/issues/97403 + describe.skip('sync colors', function () { before(async function () { await esArchiver.loadIfNeeded('logstash_functional'); await esArchiver.loadIfNeeded('lens/basic'); diff --git a/x-pack/test/functional/apps/dashboard_mode/dashboard_view_mode.js b/x-pack/test/functional/apps/dashboard_mode/dashboard_view_mode.js index 6bbf1aabe9506..51e41fe760ddd 100644 --- a/x-pack/test/functional/apps/dashboard_mode/dashboard_view_mode.js +++ b/x-pack/test/functional/apps/dashboard_mode/dashboard_view_mode.js @@ -48,10 +48,10 @@ export default function ({ getService, getPageObjects }) { await PageObjects.common.navigateToApp('dashboard'); await PageObjects.dashboard.clickNewDashboard(); + await dashboardAddPanel.addSavedSearch(savedSearchName); await PageObjects.dashboard.addVisualizations( PageObjects.dashboard.getTestVisualizationNames() ); - await dashboardAddPanel.addSavedSearch(savedSearchName); await PageObjects.dashboard.saveDashboard(dashboardName); }); diff --git a/x-pack/test/functional/apps/discover/feature_controls/discover_security.ts b/x-pack/test/functional/apps/discover/feature_controls/discover_security.ts index d595dc98a9a1a..f44d7c42a23c1 100644 --- a/x-pack/test/functional/apps/discover/feature_controls/discover_security.ts +++ b/x-pack/test/functional/apps/discover/feature_controls/discover_security.ts @@ -75,6 +75,7 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) { expectSpaceSelector: false, } ); + await PageObjects.common.navigateToApp('discover'); }); after(async () => { @@ -87,12 +88,11 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) { expect(navLinks.map((link) => link.text)).to.eql([ 'Overview', 'Discover', - 'Stack Management', // because `global_discover_all_role` enables search sessions + 'Stack Management', // because `global_discover_all_role` enables search sessions and reporting ]); }); it('shows save button', async () => { - await PageObjects.common.navigateToApp('discover'); await testSubjects.existOrFail('discoverSaveButton', { timeout: 20000 }); }); @@ -107,6 +107,12 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) { await PageObjects.share.clickShareTopNavButton(); }); + it('shows CSV reports', async () => { + await PageObjects.share.clickShareTopNavButton(); + await testSubjects.existOrFail('sharePanel-CSVReports'); + await PageObjects.share.clickShareTopNavButton(); + }); + it('allows saving via the saved query management component popover with no saved query loaded', async () => { await queryBar.setQuery('response:200'); await savedQueryManagementComponent.saveNewQuery('foo', 'bar', true, false); @@ -213,8 +219,15 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) { }); it(`Permalinks doesn't show create short-url button`, async () => { - await PageObjects.share.openShareMenuItem('Permalinks'); + await PageObjects.share.clickShareTopNavButton(); await PageObjects.share.createShortUrlMissingOrFail(); + await PageObjects.share.clickShareTopNavButton(); + }); + + it(`doesn't show CSV reports`, async () => { + await PageObjects.share.clickShareTopNavButton(); + await testSubjects.missingOrFail('sharePanel-CSVReports'); + await PageObjects.share.clickShareTopNavButton(); }); it('allows loading a saved query via the saved query management component', async () => { @@ -304,7 +317,7 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) { }); it('Permalinks shows create short-url button', async () => { - await PageObjects.share.openShareMenuItem('Permalinks'); + await PageObjects.share.clickShareTopNavButton(); await PageObjects.share.createShortUrlExistOrFail(); // close the menu await PageObjects.share.clickShareTopNavButton(); diff --git a/x-pack/test/functional/apps/lens/lens_reporting.ts b/x-pack/test/functional/apps/lens/lens_reporting.ts index e8f1916a3630c..658a9dbcac822 100644 --- a/x-pack/test/functional/apps/lens/lens_reporting.ts +++ b/x-pack/test/functional/apps/lens/lens_reporting.ts @@ -18,8 +18,18 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { describe('lens reporting', () => { before(async () => { await esArchiver.loadIfNeeded('lens/reporting'); + await security.role.create('test_reporting_user', { + elasticsearch: { cluster: [], indices: [], run_as: [] }, + kibana: [ + { + spaces: ['*'], + base: [], + feature: { dashboard: ['minimal_read', 'generate_report'] }, + }, + ], + }); await security.testUser.setRoles( - ['test_logstash_reader', 'global_dashboard_read', 'reporting_user'], + ['test_logstash_reader', 'global_dashboard_read', 'test_reporting_user'], false ); }); diff --git a/x-pack/test/functional/apps/management/feature_controls/management_security.ts b/x-pack/test/functional/apps/management/feature_controls/management_security.ts index 7d121e9100749..24d3455219fe5 100644 --- a/x-pack/test/functional/apps/management/feature_controls/management_security.ts +++ b/x-pack/test/functional/apps/management/feature_controls/management_security.ts @@ -64,7 +64,7 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) { expect(sections).to.have.length(2); expect(sections[0]).to.eql({ sectionId: 'insightsAndAlerting', - sectionLinks: ['triggersActions'], + sectionLinks: ['triggersActions', 'reporting'], }); expect(sections[1]).to.eql({ sectionId: 'kibana', diff --git a/x-pack/test/functional/apps/ml/data_frame_analytics/classification_creation.ts b/x-pack/test/functional/apps/ml/data_frame_analytics/classification_creation.ts index 5e6a08751c932..80d64ffa15d49 100644 --- a/x-pack/test/functional/apps/ml/data_frame_analytics/classification_creation.ts +++ b/x-pack/test/functional/apps/ml/data_frame_analytics/classification_creation.ts @@ -62,6 +62,7 @@ export default function ({ getService }: FtrProviderContext) { { color: '#D3DAE6', percentage: 8 }, { color: '#F5F7FA', percentage: 15 }, ], + runtimeFieldsEditorContent: ['{', ' "uppercase_y": {', ' "type": "keyword",'], row: { type: 'classification', status: 'stopped', @@ -113,9 +114,9 @@ export default function ({ getService }: FtrProviderContext) { JSON.stringify(testData.runtimeFields) ); await ml.dataFrameAnalyticsCreation.applyRuntimeMappings(); - await ml.dataFrameAnalyticsCreation.assertRuntimeMappingsEditorContent([ - '{"uppercase_y":{"type":"keyword","script":"emit(params._source.y.toUpperCase())"}}', - ]); + await ml.dataFrameAnalyticsCreation.assertRuntimeMappingsEditorContent( + testData.expected.runtimeFieldsEditorContent + ); await ml.testExecution.logTestStep('inputs the dependent variable'); await ml.dataFrameAnalyticsCreation.assertDependentVariableInputExists(); diff --git a/x-pack/test/functional/apps/ml/data_frame_analytics/outlier_detection_creation.ts b/x-pack/test/functional/apps/ml/data_frame_analytics/outlier_detection_creation.ts index e73a477d21b1b..3866642383b22 100644 --- a/x-pack/test/functional/apps/ml/data_frame_analytics/outlier_detection_creation.ts +++ b/x-pack/test/functional/apps/ml/data_frame_analytics/outlier_detection_creation.ts @@ -72,6 +72,11 @@ export default function ({ getService }: FtrProviderContext) { // anti-aliasing { color: '#F5F7FA', percentage: 30 }, ], + runtimeFieldsEditorContent: [ + '{', + ' "lowercase_central_air": {', + ' "type": "keyword",', + ], row: { type: 'outlier_detection', status: 'stopped', @@ -124,9 +129,9 @@ export default function ({ getService }: FtrProviderContext) { JSON.stringify(testData.runtimeFields) ); await ml.dataFrameAnalyticsCreation.applyRuntimeMappings(); - await ml.dataFrameAnalyticsCreation.assertRuntimeMappingsEditorContent([ - '{"lowercase_central_air":{"type":"keyword","script":"emit(params._source.CentralAir.toLowerCase())"}}', - ]); + await ml.dataFrameAnalyticsCreation.assertRuntimeMappingsEditorContent( + testData.expected.runtimeFieldsEditorContent + ); await ml.testExecution.logTestStep('does not display the dependent variable input'); await ml.dataFrameAnalyticsCreation.assertDependentVariableInputMissing(); diff --git a/x-pack/test/functional/apps/ml/data_frame_analytics/regression_creation.ts b/x-pack/test/functional/apps/ml/data_frame_analytics/regression_creation.ts index 540fbc10fa0fc..a65d8986595cc 100644 --- a/x-pack/test/functional/apps/ml/data_frame_analytics/regression_creation.ts +++ b/x-pack/test/functional/apps/ml/data_frame_analytics/regression_creation.ts @@ -55,6 +55,7 @@ export default function ({ getService }: FtrProviderContext) { { color: '#F5F7FA', percentage: 10 }, { color: '#D3DAE6', percentage: 3 }, ], + runtimeFieldsEditorContent: ['{', ' "uppercase_stab": {', ' "type": "keyword",'], row: { type: 'regression', status: 'stopped', @@ -107,9 +108,9 @@ export default function ({ getService }: FtrProviderContext) { JSON.stringify(testData.runtimeFields) ); await ml.dataFrameAnalyticsCreation.applyRuntimeMappings(); - await ml.dataFrameAnalyticsCreation.assertRuntimeMappingsEditorContent([ - '{"uppercase_stab":{"type":"keyword","script":"emit(params._source.stabf.toUpperCase())"}}', - ]); + await ml.dataFrameAnalyticsCreation.assertRuntimeMappingsEditorContent( + testData.expected.runtimeFieldsEditorContent + ); await ml.testExecution.logTestStep('inputs the dependent variable'); await ml.dataFrameAnalyticsCreation.assertDependentVariableInputExists(); diff --git a/x-pack/test/functional/apps/ml/embeddables/anomaly_charts_dashboard_embeddables.ts b/x-pack/test/functional/apps/ml/embeddables/anomaly_charts_dashboard_embeddables.ts index 0aee183c1a4a5..d4eb45619b7f7 100644 --- a/x-pack/test/functional/apps/ml/embeddables/anomaly_charts_dashboard_embeddables.ts +++ b/x-pack/test/functional/apps/ml/embeddables/anomaly_charts_dashboard_embeddables.ts @@ -58,7 +58,6 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { const esArchiver = getService('esArchiver'); const ml = getService('ml'); const PageObjects = getPageObjects(['common', 'timePicker', 'dashboard']); - const dashboardAddPanel = getService('dashboardAddPanel'); describe('anomaly charts', function () { this.tags(['mlqa']); @@ -87,10 +86,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { it('can open job selection flyout', async () => { await PageObjects.dashboard.clickCreateDashboardPrompt(); await ml.dashboardEmbeddables.assertDashboardIsEmpty(); - await dashboardAddPanel.clickEditorMenuButton(); - await dashboardAddPanel.clickEmbeddableFactoryGroupButton('ml'); - await dashboardAddPanel.clickAddNewEmbeddableLink('ml_anomaly_charts'); - await ml.dashboardJobSelectionTable.assertJobSelectionTableExists(); + await ml.dashboardEmbeddables.openJobSelectionFlyout(); }); it('can select jobs', async () => { diff --git a/x-pack/test/functional/apps/reporting_management/report_listing.ts b/x-pack/test/functional/apps/reporting_management/report_listing.ts index 964e6485aff0b..e6503b1550001 100644 --- a/x-pack/test/functional/apps/reporting_management/report_listing.ts +++ b/x-pack/test/functional/apps/reporting_management/report_listing.ts @@ -19,7 +19,17 @@ export default ({ getPageObjects, getService }: FtrProviderContext) => { describe('Listing of Reports', function () { before(async () => { - await security.testUser.setRoles(['kibana_admin', 'reporting_user']); + await security.role.create('test_reporting_user', { + elasticsearch: { cluster: [], indices: [], run_as: [] }, + kibana: [ + { + spaces: ['*'], + base: [], + feature: { canvas: ['minimal_read', 'generate_report'] }, + }, + ], + }); + await security.testUser.setRoles(['kibana_admin', 'test_reporting_user']); await esArchiver.load('empty_kibana'); }); diff --git a/x-pack/test/functional/apps/saved_objects_management/feature_controls/saved_objects_management_security.ts b/x-pack/test/functional/apps/saved_objects_management/feature_controls/saved_objects_management_security.ts index 95ebc7b2ff5d5..d9ba3a78eff13 100644 --- a/x-pack/test/functional/apps/saved_objects_management/feature_controls/saved_objects_management_security.ts +++ b/x-pack/test/functional/apps/saved_objects_management/feature_controls/saved_objects_management_security.ts @@ -262,7 +262,7 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) { kibana: [ { feature: { - visualize: ['all'], + visualize: ['minimal_all'], }, spaces: ['*'], }, diff --git a/x-pack/test/functional/apps/security/doc_level_security_roles.js b/x-pack/test/functional/apps/security/doc_level_security_roles.js index 341a0a97073dc..356216232b0fa 100644 --- a/x-pack/test/functional/apps/security/doc_level_security_roles.js +++ b/x-pack/test/functional/apps/security/doc_level_security_roles.js @@ -76,7 +76,7 @@ export default function ({ getService, getPageObjects }) { }); const rowData = await PageObjects.discover.getDocTableIndex(1); expect(rowData).to.be( - 'name:ABC Company name.keyword:ABC Company region:EAST region.keyword:EAST _id:doc1 _index:dlstest _score:0 _type: -' + 'nameABC Companyname.keywordABC CompanyregionEASTregion.keywordEAST_iddoc1_indexdlstest_score0_type -' ); }); after('logout', async () => { diff --git a/x-pack/test/functional/apps/security/field_level_security.js b/x-pack/test/functional/apps/security/field_level_security.js index 5466e8d58e8e9..220a70b2ae9f0 100644 --- a/x-pack/test/functional/apps/security/field_level_security.js +++ b/x-pack/test/functional/apps/security/field_level_security.js @@ -108,9 +108,7 @@ export default function ({ getService, getPageObjects }) { expect(hitCount).to.be('2'); }); const rowData = await PageObjects.discover.getDocTableIndex(1); - expect(rowData).to.be( - 'customer_name:ABC Company customer_name.keyword:ABC Company customer_region:WEST customer_region.keyword:WEST customer_ssn:444.555.6666 customer_ssn.keyword:444.555.6666 runtime_customer_ssn:444.555.6666 calculated at runtime _id:2 _index:flstest _score:0 _type: -' - ); + expect(rowData).to.contain('ssn'); }); it('user customer2 should not see ssn', async function () { @@ -122,9 +120,7 @@ export default function ({ getService, getPageObjects }) { expect(hitCount).to.be('2'); }); const rowData = await PageObjects.discover.getDocTableIndex(1); - expect(rowData).to.be( - 'customer_name:ABC Company customer_name.keyword:ABC Company customer_region:WEST customer_region.keyword:WEST _id:2 _index:flstest _score:0 _type: -' - ); + expect(rowData).not.to.contain('ssn'); }); after(async function () { diff --git a/x-pack/test/functional/apps/security/secure_roles_perm.js b/x-pack/test/functional/apps/security/secure_roles_perm.js index a1f258714bb0d..33913bcbbf7f0 100644 --- a/x-pack/test/functional/apps/security/secure_roles_perm.js +++ b/x-pack/test/functional/apps/security/secure_roles_perm.js @@ -14,7 +14,7 @@ export default function ({ getService, getPageObjects }) { 'monitoring', 'discover', 'common', - 'reporting', + 'share', 'header', ]); const log = getService('log'); @@ -59,13 +59,13 @@ export default function ({ getService, getPageObjects }) { confirm_password: 'changeme', full_name: 'RashmiFirst RashmiLast', email: 'rashmi@myEmail.com', - roles: ['logstash_reader', 'kibana_admin'], + roles: ['logstash_reader'], }); log.debug('After Add user: , userObj.userName'); const users = keyBy(await PageObjects.security.getElasticsearchUsers(), 'username'); log.debug('actualUsers = %j', users); log.debug('roles: ', users.Rashmi.roles); - expect(users.Rashmi.roles).to.eql(['logstash_reader', 'kibana_admin']); + expect(users.Rashmi.roles).to.eql(['logstash_reader']); expect(users.Rashmi.fullname).to.eql('RashmiFirst RashmiLast'); expect(users.Rashmi.reserved).to.be(false); await PageObjects.security.forceLogout(); @@ -77,14 +77,12 @@ export default function ({ getService, getPageObjects }) { await testSubjects.missingOrFail('users'); }); - it('Kibana User navigating to Discover and trying to generate CSV gets - Authorization Error ', async function () { + it('Kibana User navigating to Discover sees the generate CSV button', async function () { await PageObjects.common.navigateToApp('discover'); await PageObjects.discover.loadSavedSearch('A Saved Search'); - log.debug('click Reporting button'); - await PageObjects.reporting.openCsvReportingPanel(); - await PageObjects.reporting.clickGenerateReportButton(); - const queueReportError = await PageObjects.reporting.getQueueReportError(); - expect(queueReportError).to.be(true); + log.debug('click Top Nav Share button'); + await PageObjects.share.clickShareTopNavButton(); + await testSubjects.existOrFail('sharePanel-CSVReports'); }); after(async function () { diff --git a/x-pack/test/functional/apps/visualize/feature_controls/visualize_security.ts b/x-pack/test/functional/apps/visualize/feature_controls/visualize_security.ts index d6644cee21198..f650ac08de166 100644 --- a/x-pack/test/functional/apps/visualize/feature_controls/visualize_security.ts +++ b/x-pack/test/functional/apps/visualize/feature_controls/visualize_security.ts @@ -81,7 +81,7 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) { it('shows visualize navlink', async () => { const navLinks = (await appsMenu.readLinks()).map((link) => link.text); - expect(navLinks).to.eql(['Overview', 'Visualize Library']); + expect(navLinks).to.eql(['Overview', 'Visualize Library', 'Stack Management']); }); it(`landing page shows "Create new Visualization" button`, async () => { diff --git a/x-pack/test/functional/apps/visualize/precalculated_histogram.ts b/x-pack/test/functional/apps/visualize/precalculated_histogram.ts index 459a497355e0d..20111b8f4f1e0 100644 --- a/x-pack/test/functional/apps/visualize/precalculated_histogram.ts +++ b/x-pack/test/functional/apps/visualize/precalculated_histogram.ts @@ -27,8 +27,10 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { it('appears correctly in discover', async function () { await PageObjects.common.navigateToApp('discover'); + await PageObjects.discover.waitUntilSearchingHasFinished(); + await PageObjects.discover.clickFieldListItemAdd('histogram-content'); const rowData = await PageObjects.discover.getDocTableIndex(1); - expect(rowData.includes('"values":[0.3,1,3,4.2,4.8]')).to.be.ok(); + expect(rowData).to.contain('"values":[0.3,1,3,4.2,4.8]'); }); describe('works in visualizations', () => { diff --git a/x-pack/test/functional/config.js b/x-pack/test/functional/config.js index 177a2cf719dd0..0b22ab920287c 100644 --- a/x-pack/test/functional/config.js +++ b/x-pack/test/functional/config.js @@ -84,6 +84,7 @@ export default async function ({ readConfigFile }) { '--xpack.maps.showMapsInspectorAdapter=true', '--xpack.maps.preserveDrawingBuffer=true', '--xpack.maps.enableDrawingFeature=true', + '--xpack.reporting.roles.enabled=false', // use the non-deprecated access control model for Reporting '--xpack.reporting.queue.pollInterval=3000', // make it explicitly the default '--xpack.reporting.csv.maxSizeBytes=2850', // small-ish limit for cutting off a 1999 byte report '--usageCollection.maximumWaitTimeForAllCollectorsInS=1', @@ -236,8 +237,8 @@ export default async function ({ readConfigFile }) { kibana: [ { feature: { - canvas: ['all'], - visualize: ['all'], + canvas: ['minimal_all'], + visualize: ['minimal_all'], }, spaces: ['*'], }, diff --git a/x-pack/test/functional/es_archives/auditbeat/default/data.json b/x-pack/test/functional/es_archives/auditbeat/default/data.json new file mode 100644 index 0000000000000..b10f3cc73ec6a --- /dev/null +++ b/x-pack/test/functional/es_archives/auditbeat/default/data.json @@ -0,0 +1,110231 @@ +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "Rs93UmcBTFzn_XoLWT6M", + "source": { + "@timestamp": "2018-11-27T00:00:11.544Z", + "process": { + "pid": "31964", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "128.199.87.213" + }, + "network": { + "direction": "incoming" + }, + "beat": { + "name": "demo-stack-nginx-01", + "hostname": "demo-stack-nginx-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-nginx-01" + }, + "auditd": { + "session": "unset", + "data": { + "hostname": "128.199.87.213", + "terminal": "ssh", + "op": "PAM:bad_ident" + }, + "summary": { + "object": { + "primary": "ssh", + "secondary": "128.199.87.213", + "type": "user-session" + }, + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "root" + } + }, + "sequence": 192383, + "result": "fail" + }, + "event": { + "category": "user-login", + "type": "user_err", + "action": "error", + "module": "auditd" + }, + "user": { + "name_map": { + "uid": "root" + }, + "auid": "unset", + "uid": "0" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "R893UmcBTFzn_XoLWT6M", + "source": { + "@timestamp": "2018-11-27T00:00:12.110Z", + "beat": { + "name": "demo-stack-nginx-01", + "hostname": "demo-stack-nginx-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-nginx-01" + }, + "user": { + "name_map": { + "uid": "root" + }, + "auid": "unset", + "uid": "0" + }, + "process": { + "pid": "31966", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "89.40.116.98" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "session": "unset", + "data": { + "op": "login", + "acct": "(unknown user)", + "terminal": "sshd" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + }, + "object": { + "primary": "sshd", + "secondary": "89.40.116.98", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 192384, + "result": "fail" + }, + "event": { + "type": "user_login", + "action": "logged-in", + "module": "auditd", + "category": "user-login" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "SM93UmcBTFzn_XoLWT6M", + "source": { + "@timestamp": "2018-11-27T00:00:12.111Z", + "user": { + "uid": "0", + "auid": "unset", + "name_map": { + "uid": "root" + } + }, + "process": { + "pid": "31966", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "89.40.116.98" + }, + "network": { + "direction": "incoming" + }, + "beat": { + "name": "demo-stack-nginx-01", + "hostname": "demo-stack-nginx-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-nginx-01" + }, + "auditd": { + "data": { + "acct": "(invalid user)", + "op": "login", + "terminal": "sshd" + }, + "summary": { + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + }, + "object": { + "primary": "sshd", + "secondary": "89.40.116.98", + "type": "user-session" + } + }, + "sequence": 192385, + "result": "fail", + "session": "unset" + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "Sc93UmcBTFzn_XoLWT6M", + "source": { + "@timestamp": "2018-11-27T00:00:12.224Z", + "process": { + "exe": "/usr/sbin/sshd", + "pid": "31966" + }, + "source": { + "ip": "89.40.116.98" + }, + "network": { + "direction": "incoming" + }, + "beat": { + "version": "7.0.0-alpha1", + "name": "demo-stack-nginx-01", + "hostname": "demo-stack-nginx-01" + }, + "host": { + "name": "demo-stack-nginx-01" + }, + "auditd": { + "sequence": 192386, + "result": "fail", + "session": "unset", + "data": { + "hostname": "89.40.116.98", + "op": "PAM:bad_ident", + "terminal": "ssh" + }, + "summary": { + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "root" + }, + "object": { + "type": "user-session", + "primary": "ssh", + "secondary": "89.40.116.98" + } + } + }, + "event": { + "type": "user_err", + "action": "error", + "module": "auditd", + "category": "user-login" + }, + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "A89-UmcBTFzn_XoLj91w", + "source": { + "@timestamp": "2018-11-27T00:08:04.229Z", + "auditd": { + "data": { + "acct": "(unknown user)", + "op": "login", + "terminal": "sshd" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + }, + "object": { + "primary": "sshd", + "secondary": "187.188.146.35", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 142249, + "result": "fail", + "session": "unset" + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + }, + "beat": { + "hostname": "demo-stack-haproxy-01", + "version": "7.0.0-alpha1", + "name": "demo-stack-haproxy-01" + }, + "host": { + "name": "demo-stack-haproxy-01" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "pid": "19190", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "187.188.146.35" + }, + "network": { + "direction": "incoming" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "BM9-UmcBTFzn_XoLj91w", + "source": { + "@timestamp": "2018-11-27T00:08:04.231Z", + "host": { + "name": "demo-stack-haproxy-01" + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + }, + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + }, + "process": { + "pid": "19190", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "187.188.146.35" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "sequence": 142250, + "result": "fail", + "session": "unset", + "data": { + "op": "login", + "acct": "(invalid user)", + "terminal": "sshd" + }, + "summary": { + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + }, + "object": { + "type": "user-session", + "primary": "sshd", + "secondary": "187.188.146.35" + } + } + }, + "beat": { + "hostname": "demo-stack-haproxy-01", + "version": "7.0.0-alpha1", + "name": "demo-stack-haproxy-01" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "Bc9-UmcBTFzn_XoLj91w", + "source": { + "@timestamp": "2018-11-27T00:08:04.295Z", + "auditd": { + "summary": { + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "root" + }, + "object": { + "primary": "ssh", + "secondary": "187.188.146.35", + "type": "user-session" + } + }, + "sequence": 142251, + "result": "fail", + "session": "unset", + "data": { + "terminal": "ssh", + "op": "PAM:bad_ident", + "hostname": "187.188.146.35" + } + }, + "event": { + "module": "auditd", + "category": "user-login", + "type": "user_err", + "action": "error" + }, + "user": { + "name_map": { + "uid": "root" + }, + "uid": "0", + "auid": "unset" + }, + "process": { + "pid": "19190", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "187.188.146.35" + }, + "beat": { + "name": "demo-stack-haproxy-01", + "hostname": "demo-stack-haproxy-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-haproxy-01" + }, + "network": { + "direction": "incoming" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "3M99UmcBTFzn_XoL9c8q", + "source": { + "@timestamp": "2018-11-27T00:07:24.736Z", + "process": { + "exe": "/usr/sbin/sshd", + "pid": "31771" + }, + "source": { + "ip": "185.66.213.116" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "result": "fail", + "session": "unset", + "data": { + "acct": "(unknown user)", + "op": "login", + "terminal": "sshd" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + }, + "object": { + "primary": "sshd", + "secondary": "185.66.213.116", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 186194 + }, + "beat": { + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-redis-01" + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + }, + "user": { + "auid": "unset", + "uid": "0", + "name_map": { + "uid": "root" + } + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "3c99UmcBTFzn_XoL9c8q", + "source": { + "@timestamp": "2018-11-27T00:07:24.738Z", + "network": { + "direction": "incoming" + }, + "auditd": { + "sequence": 186195, + "result": "fail", + "session": "unset", + "data": { + "terminal": "sshd", + "op": "login", + "acct": "(invalid user)" + }, + "summary": { + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + }, + "object": { + "secondary": "185.66.213.116", + "type": "user-session", + "primary": "sshd" + } + } + }, + "event": { + "type": "user_login", + "action": "logged-in", + "module": "auditd", + "category": "user-login" + }, + "user": { + "name_map": { + "uid": "root" + }, + "auid": "unset", + "uid": "0" + }, + "process": { + "pid": "31771", + "exe": "/usr/sbin/sshd" + }, + "beat": { + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1", + "name": "demo-stack-redis-01" + }, + "host": { + "name": "demo-stack-redis-01" + }, + "source": { + "ip": "185.66.213.116" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "3s99UmcBTFzn_XoL9c8q", + "source": { + "@timestamp": "2018-11-27T00:07:24.872Z", + "host": { + "name": "demo-stack-redis-01" + }, + "event": { + "action": "error", + "module": "auditd", + "category": "user-login", + "type": "user_err" + }, + "user": { + "name_map": { + "uid": "root" + }, + "uid": "0", + "auid": "unset" + }, + "process": { + "pid": "31771", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "185.66.213.116" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "summary": { + "object": { + "primary": "ssh", + "secondary": "185.66.213.116", + "type": "user-session" + }, + "how": "/usr/sbin/sshd", + "actor": { + "secondary": "root", + "primary": "unset" + } + }, + "sequence": 186196, + "result": "fail", + "session": "unset", + "data": { + "op": "PAM:bad_ident", + "terminal": "ssh", + "hostname": "185.66.213.116" + } + }, + "beat": { + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "cNCAUmcBTFzn_XoLVQS1", + "source": { + "@timestamp": "2018-11-27T00:10:00.521Z", + "source": { + "ip": "202.138.233.92" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "sequence": 142255, + "result": "fail", + "session": "unset", + "data": { + "terminal": "sshd", + "acct": "(unknown user)", + "op": "login" + }, + "summary": { + "object": { + "primary": "sshd", + "secondary": "202.138.233.92", + "type": "user-session" + }, + "how": "/usr/sbin/sshd", + "actor": { + "secondary": "(unknown user)", + "primary": "unset" + } + } + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + }, + "beat": { + "name": "demo-stack-haproxy-01", + "hostname": "demo-stack-haproxy-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-haproxy-01" + }, + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + }, + "process": { + "pid": "19202", + "exe": "/usr/sbin/sshd" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "cdCAUmcBTFzn_XoLVQS1", + "source": { + "@timestamp": "2018-11-27T00:10:00.523Z", + "process": { + "pid": "19202", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "202.138.233.92" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "sequence": 142256, + "result": "fail", + "session": "unset", + "data": { + "op": "login", + "terminal": "sshd", + "acct": "(invalid user)" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + }, + "object": { + "secondary": "202.138.233.92", + "type": "user-session", + "primary": "sshd" + }, + "how": "/usr/sbin/sshd" + } + }, + "beat": { + "name": "demo-stack-haproxy-01", + "hostname": "demo-stack-haproxy-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-haproxy-01" + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "ctCAUmcBTFzn_XoLVQS1", + "source": { + "@timestamp": "2018-11-27T00:10:00.758Z", + "beat": { + "name": "demo-stack-haproxy-01", + "hostname": "demo-stack-haproxy-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-haproxy-01" + }, + "event": { + "category": "user-login", + "type": "user_err", + "action": "error", + "module": "auditd" + }, + "user": { + "uid": "0", + "auid": "unset", + "name_map": { + "uid": "root" + } + }, + "process": { + "pid": "19202", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "202.138.233.92" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "session": "unset", + "data": { + "hostname": "202.138.233.92", + "op": "PAM:bad_ident", + "terminal": "ssh" + }, + "summary": { + "how": "/usr/sbin/sshd", + "actor": { + "secondary": "root", + "primary": "unset" + }, + "object": { + "primary": "ssh", + "secondary": "202.138.233.92", + "type": "user-session" + } + }, + "sequence": 142257, + "result": "fail" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "Lc9_UmcBTFzn_XoL2_og", + "source": { + "@timestamp": "2018-11-27T00:09:29.142Z", + "host": { + "name": "demo-stack-haproxy-01" + }, + "beat": { + "name": "demo-stack-haproxy-01", + "hostname": "demo-stack-haproxy-01", + "version": "7.0.0-alpha1" + }, + "source": { + "ip": "183.6.176.182" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "summary": { + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + }, + "object": { + "type": "user-session", + "primary": "sshd", + "secondary": "183.6.176.182" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 142252, + "result": "fail", + "session": "unset", + "data": { + "terminal": "sshd", + "op": "login", + "acct": "(unknown user)" + } + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + }, + "user": { + "auid": "unset", + "uid": "0", + "name_map": { + "uid": "root" + } + }, + "process": { + "pid": "19199", + "exe": "/usr/sbin/sshd" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "Ls9_UmcBTFzn_XoL2_og", + "source": { + "@timestamp": "2018-11-27T00:09:29.143Z", + "network": { + "direction": "incoming" + }, + "auditd": { + "sequence": 142253, + "result": "fail", + "session": "unset", + "data": { + "terminal": "sshd", + "acct": "(invalid user)", + "op": "login" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + }, + "object": { + "type": "user-session", + "primary": "sshd", + "secondary": "183.6.176.182" + }, + "how": "/usr/sbin/sshd" + } + }, + "beat": { + "name": "demo-stack-haproxy-01", + "hostname": "demo-stack-haproxy-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-haproxy-01" + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + }, + "user": { + "uid": "0", + "auid": "unset", + "name_map": { + "uid": "root" + } + }, + "process": { + "pid": "19199", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "183.6.176.182" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "L89_UmcBTFzn_XoL2_og", + "source": { + "@timestamp": "2018-11-27T00:09:29.337Z", + "network": { + "direction": "incoming" + }, + "host": { + "name": "demo-stack-haproxy-01" + }, + "beat": { + "name": "demo-stack-haproxy-01", + "hostname": "demo-stack-haproxy-01", + "version": "7.0.0-alpha1" + }, + "auditd": { + "result": "fail", + "session": "unset", + "data": { + "hostname": "183.6.176.182", + "op": "PAM:bad_ident", + "terminal": "ssh" + }, + "summary": { + "object": { + "primary": "ssh", + "secondary": "183.6.176.182", + "type": "user-session" + }, + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "root" + } + }, + "sequence": 142254 + }, + "event": { + "action": "error", + "module": "auditd", + "category": "user-login", + "type": "user_err" + }, + "user": { + "uid": "0", + "auid": "unset", + "name_map": { + "uid": "root" + } + }, + "process": { + "pid": "19199", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "183.6.176.182" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "0c9_UmcBTFzn_XoL8Ptt", + "source": { + "@timestamp": "2018-11-27T00:09:34.595Z", + "source": { + "ip": "82.165.64.156" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "session": "unset", + "data": { + "acct": "(unknown user)", + "terminal": "sshd", + "op": "login" + }, + "summary": { + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + }, + "object": { + "primary": "sshd", + "secondary": "82.165.64.156", + "type": "user-session" + } + }, + "sequence": 186200, + "result": "fail" + }, + "beat": { + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-redis-01" + }, + "event": { + "module": "auditd", + "category": "user-login", + "type": "user_login", + "action": "logged-in" + }, + "user": { + "auid": "unset", + "uid": "0", + "name_map": { + "uid": "root" + } + }, + "process": { + "exe": "/usr/sbin/sshd", + "pid": "31787" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "0s9_UmcBTFzn_XoL8Ptt", + "source": { + "@timestamp": "2018-11-27T00:09:34.596Z", + "host": { + "name": "demo-stack-redis-01" + }, + "auditd": { + "result": "fail", + "session": "unset", + "data": { + "op": "login", + "acct": "(invalid user)", + "terminal": "sshd" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + }, + "object": { + "type": "user-session", + "primary": "sshd", + "secondary": "82.165.64.156" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 186201 + }, + "event": { + "type": "user_login", + "action": "logged-in", + "module": "auditd", + "category": "user-login" + }, + "user": { + "auid": "unset", + "uid": "0", + "name_map": { + "uid": "root" + } + }, + "process": { + "pid": "31787", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "82.165.64.156" + }, + "network": { + "direction": "incoming" + }, + "beat": { + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "089_UmcBTFzn_XoL8Ptt", + "source": { + "@timestamp": "2018-11-27T00:09:34.710Z", + "host": { + "name": "demo-stack-redis-01" + }, + "event": { + "category": "user-login", + "type": "user_err", + "action": "error", + "module": "auditd" + }, + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + }, + "process": { + "pid": "31787", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "82.165.64.156" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "summary": { + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "root" + }, + "object": { + "primary": "ssh", + "secondary": "82.165.64.156", + "type": "user-session" + } + }, + "sequence": 186202, + "result": "fail", + "session": "unset", + "data": { + "op": "PAM:bad_ident", + "hostname": "82.165.64.156", + "terminal": "ssh" + } + }, + "beat": { + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "ns9_UmcBTFzn_XoLYe_m", + "source": { + "@timestamp": "2018-11-27T00:08:58.109Z", + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "pid": "31779", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "46.148.18.163" + }, + "beat": { + "version": "7.0.0-alpha1", + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01" + }, + "host": { + "name": "demo-stack-redis-01" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "sequence": 186197, + "result": "fail", + "session": "unset", + "data": { + "op": "login", + "terminal": "sshd", + "acct": "(unknown user)" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + }, + "object": { + "type": "user-session", + "primary": "sshd", + "secondary": "46.148.18.163" + }, + "how": "/usr/sbin/sshd" + } + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "n89_UmcBTFzn_XoLYe_m", + "source": { + "@timestamp": "2018-11-27T00:08:58.110Z", + "auditd": { + "sequence": 186198, + "result": "fail", + "session": "unset", + "data": { + "op": "login", + "acct": "(invalid user)", + "terminal": "sshd" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + }, + "object": { + "primary": "sshd", + "secondary": "46.148.18.163", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + } + }, + "beat": { + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-redis-01" + }, + "event": { + "type": "user_login", + "action": "logged-in", + "module": "auditd", + "category": "user-login" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "pid": "31779", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "46.148.18.163" + }, + "network": { + "direction": "incoming" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "oM9_UmcBTFzn_XoLYe_m", + "source": { + "@timestamp": "2018-11-27T00:08:58.253Z", + "source": { + "ip": "46.148.18.163" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "session": "unset", + "data": { + "terminal": "ssh", + "hostname": "46.148.18.163", + "op": "PAM:bad_ident" + }, + "summary": { + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "root" + }, + "object": { + "type": "user-session", + "primary": "ssh", + "secondary": "46.148.18.163" + } + }, + "sequence": 186199, + "result": "fail" + }, + "beat": { + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-redis-01" + }, + "event": { + "category": "user-login", + "type": "user_err", + "action": "error", + "module": "auditd" + }, + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + }, + "process": { + "pid": "31779", + "exe": "/usr/sbin/sshd" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "hM-AUmcBTFzn_XoLEf64", + "source": { + "@timestamp": "2018-11-27T00:09:43.118Z", + "source": { + "ip": "74.208.43.208" + }, + "network": { + "direction": "incoming" + }, + "beat": { + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-redis-01" + }, + "auditd": { + "sequence": 186203, + "result": "fail", + "session": "unset", + "data": { + "terminal": "sshd", + "op": "login", + "acct": "(unknown user)" + }, + "summary": { + "object": { + "primary": "sshd", + "secondary": "74.208.43.208", + "type": "user-session" + }, + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + } + } + }, + "event": { + "action": "logged-in", + "module": "auditd", + "category": "user-login", + "type": "user_login" + }, + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + }, + "process": { + "pid": "31789", + "exe": "/usr/sbin/sshd" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "hc-AUmcBTFzn_XoLEf64", + "source": { + "@timestamp": "2018-11-27T00:09:43.119Z", + "network": { + "direction": "incoming" + }, + "auditd": { + "session": "unset", + "data": { + "acct": "(invalid user)", + "op": "login", + "terminal": "sshd" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + }, + "object": { + "secondary": "74.208.43.208", + "type": "user-session", + "primary": "sshd" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 186204, + "result": "fail" + }, + "event": { + "action": "logged-in", + "module": "auditd", + "category": "user-login", + "type": "user_login" + }, + "user": { + "name_map": { + "uid": "root" + }, + "uid": "0", + "auid": "unset" + }, + "process": { + "pid": "31789", + "exe": "/usr/sbin/sshd" + }, + "beat": { + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-redis-01" + }, + "source": { + "ip": "74.208.43.208" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "hs-AUmcBTFzn_XoLEf64", + "source": { + "@timestamp": "2018-11-27T00:09:43.146Z", + "network": { + "direction": "incoming" + }, + "auditd": { + "sequence": 186205, + "result": "fail", + "session": "unset", + "data": { + "terminal": "ssh", + "hostname": "74.208.43.208", + "op": "PAM:bad_ident" + }, + "summary": { + "actor": { + "secondary": "root", + "primary": "unset" + }, + "object": { + "primary": "ssh", + "secondary": "74.208.43.208", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + } + }, + "beat": { + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-redis-01" + }, + "event": { + "category": "user-login", + "type": "user_err", + "action": "error", + "module": "auditd" + }, + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + }, + "process": { + "pid": "31789", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "74.208.43.208" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "m89-UmcBTFzn_XoL1OLk", + "source": { + "@timestamp": "2018-11-27T00:08:22.009Z", + "source": { + "ip": "201.75.60.100" + }, + "network": { + "direction": "incoming" + }, + "beat": { + "name": "demo-stack-apache-01", + "hostname": "demo-stack-apache-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-apache-01" + }, + "auditd": { + "session": "unset", + "data": { + "op": "login", + "acct": "(unknown user)", + "terminal": "sshd" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + }, + "object": { + "type": "user-session", + "primary": "sshd", + "secondary": "201.75.60.100" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 184237, + "result": "fail" + }, + "event": { + "type": "user_login", + "action": "logged-in", + "module": "auditd", + "category": "user-login" + }, + "user": { + "uid": "0", + "auid": "unset", + "name_map": { + "uid": "root" + } + }, + "process": { + "pid": "24759", + "exe": "/usr/sbin/sshd" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "nM9-UmcBTFzn_XoL1OLk", + "source": { + "@timestamp": "2018-11-27T00:08:22.011Z", + "beat": { + "name": "demo-stack-apache-01", + "hostname": "demo-stack-apache-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-apache-01" + }, + "process": { + "pid": "24759", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "201.75.60.100" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "sequence": 184238, + "result": "fail", + "session": "unset", + "data": { + "terminal": "sshd", + "acct": "(invalid user)", + "op": "login" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + }, + "object": { + "primary": "sshd", + "secondary": "201.75.60.100", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + } + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + }, + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "nc9-UmcBTFzn_XoL1OLk", + "source": { + "@timestamp": "2018-11-27T00:08:22.241Z", + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + }, + "beat": { + "name": "demo-stack-apache-01", + "hostname": "demo-stack-apache-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-apache-01" + }, + "process": { + "exe": "/usr/sbin/sshd", + "pid": "24759" + }, + "source": { + "ip": "201.75.60.100" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "sequence": 184239, + "result": "fail", + "session": "unset", + "data": { + "op": "PAM:bad_ident", + "terminal": "ssh", + "hostname": "201.75.60.100" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "root" + }, + "object": { + "primary": "ssh", + "secondary": "201.75.60.100", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + } + }, + "event": { + "category": "user-login", + "type": "user_err", + "action": "error", + "module": "auditd" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "Vc9_UmcBTFzn_XoLb_AH", + "source": { + "@timestamp": "2018-11-27T00:09:01.469Z", + "auditd": { + "session": "unset", + "data": { + "op": "PAM:accounting", + "terminal": "cron", + "acct": "root" + }, + "summary": { + "actor": { + "secondary": "root", + "primary": "unset" + }, + "object": { + "type": "user-session", + "primary": "cron" + }, + "how": "/usr/sbin/cron" + }, + "sequence": 184240, + "result": "success" + }, + "event": { + "module": "auditd", + "category": "user-login", + "type": "user_acct", + "action": "was-authorized" + }, + "user": { + "name_map": { + "uid": "root" + }, + "uid": "0", + "auid": "unset" + }, + "beat": { + "name": "demo-stack-apache-01", + "hostname": "demo-stack-apache-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-apache-01" + }, + "process": { + "pid": "24768", + "exe": "/usr/sbin/cron" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "Vs9_UmcBTFzn_XoLb_AH", + "source": { + "@timestamp": "2018-11-27T00:09:01.469Z", + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "beat": { + "name": "demo-stack-apache-01", + "hostname": "demo-stack-apache-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-apache-01" + }, + "process": { + "pid": "24768", + "exe": "/usr/sbin/cron" + }, + "auditd": { + "sequence": 184241, + "result": "success", + "session": "unset", + "data": { + "acct": "root", + "op": "PAM:setcred", + "terminal": "cron" + }, + "summary": { + "actor": { + "secondary": "root", + "primary": "unset" + }, + "object": { + "primary": "cron", + "type": "user-session" + }, + "how": "/usr/sbin/cron" + } + }, + "event": { + "category": "user-login", + "type": "cred_acq", + "action": "acquired-credentials", + "module": "auditd" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "V89_UmcBTFzn_XoLb_AH", + "source": { + "@timestamp": "2018-11-27T00:09:01.471Z", + "user": { + "auid": "0", + "uid": "0", + "name_map": { + "auid": "root", + "uid": "root" + } + }, + "process": { + "pid": "24768", + "exe": "/usr/sbin/cron" + }, + "auditd": { + "result": "success", + "session": "9854", + "data": { + "terminal": "cron", + "op": "PAM:session_open", + "acct": "root" + }, + "summary": { + "actor": { + "secondary": "root", + "primary": "root" + }, + "object": { + "primary": "cron", + "type": "user-session" + }, + "how": "/usr/sbin/cron" + }, + "sequence": 184243 + }, + "event": { + "action": "started-session", + "module": "auditd", + "category": "user-login", + "type": "user_start" + }, + "beat": { + "name": "demo-stack-apache-01", + "hostname": "demo-stack-apache-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-apache-01" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "WM9_UmcBTFzn_XoLb_AH", + "source": { + "@timestamp": "2018-11-27T00:09:01.574Z", + "auditd": { + "result": "success", + "session": "9854", + "data": { + "terminal": "cron", + "acct": "root", + "op": "PAM:setcred" + }, + "summary": { + "actor": { + "primary": "root", + "secondary": "root" + }, + "object": { + "type": "user-session", + "primary": "cron" + }, + "how": "/usr/sbin/cron" + }, + "sequence": 184244 + }, + "event": { + "category": "user-login", + "type": "cred_disp", + "action": "disposed-credentials", + "module": "auditd" + }, + "user": { + "name_map": { + "uid": "root", + "auid": "root" + }, + "auid": "0", + "uid": "0" + }, + "process": { + "exe": "/usr/sbin/cron", + "pid": "24768" + }, + "beat": { + "name": "demo-stack-apache-01", + "hostname": "demo-stack-apache-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-apache-01" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "Wc9_UmcBTFzn_XoLb_AH", + "source": { + "@timestamp": "2018-11-27T00:09:01.575Z", + "auditd": { + "session": "9854", + "data": { + "acct": "root", + "op": "PAM:session_close", + "terminal": "cron" + }, + "summary": { + "how": "/usr/sbin/cron", + "actor": { + "primary": "root", + "secondary": "root" + }, + "object": { + "type": "user-session", + "primary": "cron" + } + }, + "sequence": 184245, + "result": "success" + }, + "beat": { + "name": "demo-stack-apache-01", + "hostname": "demo-stack-apache-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-apache-01" + }, + "event": { + "category": "user-login", + "type": "user_end", + "action": "ended-session", + "module": "auditd" + }, + "user": { + "name_map": { + "auid": "root", + "uid": "root" + }, + "uid": "0", + "auid": "0" + }, + "process": { + "pid": "24768", + "exe": "/usr/sbin/cron" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "W89_UmcBTFzn_XoLb_DG", + "source": { + "@timestamp": "2018-11-27T00:09:01.660Z", + "auditd": { + "sequence": 192396, + "result": "success", + "session": "unset", + "data": { + "terminal": "cron", + "op": "PAM:accounting", + "acct": "root" + }, + "summary": { + "how": "/usr/sbin/cron", + "actor": { + "primary": "unset", + "secondary": "root" + }, + "object": { + "primary": "cron", + "type": "user-session" + } + } + }, + "beat": { + "name": "demo-stack-nginx-01", + "hostname": "demo-stack-nginx-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-nginx-01" + }, + "event": { + "category": "user-login", + "type": "user_acct", + "action": "was-authorized", + "module": "auditd" + }, + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + }, + "process": { + "exe": "/usr/sbin/cron", + "pid": "32020" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "XM9_UmcBTFzn_XoLb_DG", + "source": { + "@timestamp": "2018-11-27T00:09:01.660Z", + "auditd": { + "sequence": 192397, + "result": "success", + "session": "unset", + "data": { + "acct": "root", + "op": "PAM:setcred", + "terminal": "cron" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "root" + }, + "object": { + "type": "user-session", + "primary": "cron" + }, + "how": "/usr/sbin/cron" + } + }, + "event": { + "type": "cred_acq", + "action": "acquired-credentials", + "module": "auditd", + "category": "user-login" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "exe": "/usr/sbin/cron", + "pid": "32020" + }, + "beat": { + "name": "demo-stack-nginx-01", + "hostname": "demo-stack-nginx-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-nginx-01" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "Xc9_UmcBTFzn_XoLb_DG", + "source": { + "@timestamp": "2018-11-27T00:09:01.661Z", + "beat": { + "name": "demo-stack-nginx-01", + "hostname": "demo-stack-nginx-01", + "version": "7.0.0-alpha1" + }, + "event": { + "category": "user-login", + "type": "user_start", + "action": "started-session", + "module": "auditd" + }, + "user": { + "name_map": { + "auid": "root", + "uid": "root" + }, + "uid": "0", + "auid": "0" + }, + "process": { + "pid": "32020", + "exe": "/usr/sbin/cron" + }, + "auditd": { + "result": "success", + "session": "9858", + "data": { + "terminal": "cron", + "op": "PAM:session_open", + "acct": "root" + }, + "summary": { + "object": { + "type": "user-session", + "primary": "cron" + }, + "how": "/usr/sbin/cron", + "actor": { + "secondary": "root", + "primary": "root" + } + }, + "sequence": 192399 + }, + "host": { + "name": "demo-stack-nginx-01" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "Xs9_UmcBTFzn_XoLb_DG", + "source": { + "@timestamp": "2018-11-27T00:09:01.756Z", + "user": { + "uid": "0", + "name_map": { + "auid": "root", + "uid": "root" + }, + "auid": "0" + }, + "process": { + "pid": "32020", + "exe": "/usr/sbin/cron" + }, + "auditd": { + "data": { + "op": "PAM:setcred", + "terminal": "cron", + "acct": "root" + }, + "summary": { + "how": "/usr/sbin/cron", + "actor": { + "primary": "root", + "secondary": "root" + }, + "object": { + "primary": "cron", + "type": "user-session" + } + }, + "sequence": 192400, + "result": "success", + "session": "9858" + }, + "event": { + "category": "user-login", + "type": "cred_disp", + "action": "disposed-credentials", + "module": "auditd" + }, + "beat": { + "version": "7.0.0-alpha1", + "name": "demo-stack-nginx-01", + "hostname": "demo-stack-nginx-01" + }, + "host": { + "name": "demo-stack-nginx-01" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "X89_UmcBTFzn_XoLb_DG", + "source": { + "@timestamp": "2018-11-27T00:09:01.757Z", + "auditd": { + "sequence": 192401, + "result": "success", + "session": "9858", + "data": { + "terminal": "cron", + "op": "PAM:session_close", + "acct": "root" + }, + "summary": { + "actor": { + "secondary": "root", + "primary": "root" + }, + "object": { + "primary": "cron", + "type": "user-session" + }, + "how": "/usr/sbin/cron" + } + }, + "beat": { + "name": "demo-stack-nginx-01", + "hostname": "demo-stack-nginx-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-nginx-01" + }, + "event": { + "module": "auditd", + "category": "user-login", + "type": "user_end", + "action": "ended-session" + }, + "user": { + "uid": "0", + "name_map": { + "auid": "root", + "uid": "root" + }, + "auid": "0" + }, + "process": { + "pid": "32020", + "exe": "/usr/sbin/cron" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "tNCGUmcBTFzn_XoLwJHN", + "source": { + "@timestamp": "2018-11-27T00:17:01.150Z", + "host": { + "name": "demo-stack-es-01" + }, + "process": { + "pid": "28080", + "exe": "/usr/sbin/cron" + }, + "auditd": { + "data": { + "op": "PAM:setcred", + "acct": "root", + "terminal": "cron" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "root" + }, + "object": { + "primary": "cron", + "type": "user-session" + }, + "how": "/usr/sbin/cron" + }, + "sequence": 44083, + "result": "success", + "session": "unset" + }, + "event": { + "category": "user-login", + "type": "cred_acq", + "action": "acquired-credentials", + "module": "auditd" + }, + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + }, + "beat": { + "version": "7.0.0-alpha1", + "name": "demo-stack-es-01", + "hostname": "demo-stack-es-01" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "tdCGUmcBTFzn_XoLwJHN", + "source": { + "@timestamp": "2018-11-27T00:17:01.150Z", + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "pid": "28080", + "exe": "/usr/sbin/cron" + }, + "auditd": { + "result": "success", + "session": "unset", + "data": { + "acct": "root", + "terminal": "cron", + "op": "PAM:accounting" + }, + "summary": { + "how": "/usr/sbin/cron", + "actor": { + "primary": "unset", + "secondary": "root" + }, + "object": { + "primary": "cron", + "type": "user-session" + } + }, + "sequence": 44082 + }, + "beat": { + "name": "demo-stack-es-01", + "hostname": "demo-stack-es-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-es-01" + }, + "event": { + "category": "user-login", + "type": "user_acct", + "action": "was-authorized", + "module": "auditd" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "ttCGUmcBTFzn_XoLwJHN", + "source": { + "@timestamp": "2018-11-27T00:17:01.150Z", + "process": { + "pid": "28080", + "exe": "/usr/sbin/cron" + }, + "auditd": { + "summary": { + "how": "/usr/sbin/cron", + "actor": { + "primary": "root", + "secondary": "root" + }, + "object": { + "primary": "cron", + "type": "user-session" + } + }, + "sequence": 44085, + "result": "success", + "session": "1442", + "data": { + "terminal": "cron", + "op": "PAM:session_open", + "acct": "root" + } + }, + "event": { + "category": "user-login", + "type": "user_start", + "action": "started-session", + "module": "auditd" + }, + "user": { + "name_map": { + "auid": "root", + "uid": "root" + }, + "auid": "0", + "uid": "0" + }, + "host": { + "name": "demo-stack-es-01" + }, + "beat": { + "name": "demo-stack-es-01", + "hostname": "demo-stack-es-01", + "version": "7.0.0-alpha1" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "t9CGUmcBTFzn_XoLwJHN", + "source": { + "@timestamp": "2018-11-27T00:17:01.154Z", + "event": { + "action": "disposed-credentials", + "module": "auditd", + "category": "user-login", + "type": "cred_disp" + }, + "user": { + "name_map": { + "auid": "root", + "uid": "root" + }, + "auid": "0", + "uid": "0" + }, + "process": { + "pid": "28080", + "exe": "/usr/sbin/cron" + }, + "auditd": { + "sequence": 44086, + "result": "success", + "session": "1442", + "data": { + "op": "PAM:setcred", + "terminal": "cron", + "acct": "root" + }, + "summary": { + "actor": { + "primary": "root", + "secondary": "root" + }, + "object": { + "primary": "cron", + "type": "user-session" + }, + "how": "/usr/sbin/cron" + } + }, + "beat": { + "name": "demo-stack-es-01", + "hostname": "demo-stack-es-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-es-01" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "uNCGUmcBTFzn_XoLwJHN", + "source": { + "@timestamp": "2018-11-27T00:17:01.154Z", + "auditd": { + "session": "1442", + "data": { + "op": "PAM:session_close", + "terminal": "cron", + "acct": "root" + }, + "summary": { + "actor": { + "secondary": "root", + "primary": "root" + }, + "object": { + "primary": "cron", + "type": "user-session" + }, + "how": "/usr/sbin/cron" + }, + "sequence": 44087, + "result": "success" + }, + "host": { + "name": "demo-stack-es-01" + }, + "beat": { + "name": "demo-stack-es-01", + "hostname": "demo-stack-es-01", + "version": "7.0.0-alpha1" + }, + "event": { + "action": "ended-session", + "module": "auditd", + "category": "user-login", + "type": "user_end" + }, + "user": { + "auid": "0", + "name_map": { + "auid": "root", + "uid": "root" + }, + "uid": "0" + }, + "process": { + "pid": "28080", + "exe": "/usr/sbin/cron" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "udCGUmcBTFzn_XoLwJHb", + "source": { + "@timestamp": "2018-11-27T00:17:01.168Z", + "auditd": { + "sequence": 142264, + "result": "success", + "session": "unset", + "data": { + "op": "PAM:accounting", + "terminal": "cron", + "acct": "root" + }, + "summary": { + "how": "/usr/sbin/cron", + "actor": { + "primary": "unset", + "secondary": "root" + }, + "object": { + "primary": "cron", + "type": "user-session" + } + } + }, + "beat": { + "hostname": "demo-stack-haproxy-01", + "version": "7.0.0-alpha1", + "name": "demo-stack-haproxy-01" + }, + "host": { + "name": "demo-stack-haproxy-01" + }, + "event": { + "type": "user_acct", + "action": "was-authorized", + "module": "auditd", + "category": "user-login" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "pid": "19244", + "exe": "/usr/sbin/cron" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "utCGUmcBTFzn_XoLwJHb", + "source": { + "@timestamp": "2018-11-27T00:17:01.169Z", + "host": { + "name": "demo-stack-haproxy-01" + }, + "beat": { + "name": "demo-stack-haproxy-01", + "hostname": "demo-stack-haproxy-01", + "version": "7.0.0-alpha1" + }, + "event": { + "module": "auditd", + "category": "user-login", + "type": "cred_acq", + "action": "acquired-credentials" + }, + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + }, + "process": { + "pid": "19244", + "exe": "/usr/sbin/cron" + }, + "auditd": { + "session": "unset", + "data": { + "op": "PAM:setcred", + "terminal": "cron", + "acct": "root" + }, + "summary": { + "object": { + "primary": "cron", + "type": "user-session" + }, + "how": "/usr/sbin/cron", + "actor": { + "primary": "unset", + "secondary": "root" + } + }, + "sequence": 142265, + "result": "success" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "u9CGUmcBTFzn_XoLwJHb", + "source": { + "@timestamp": "2018-11-27T00:17:01.171Z", + "event": { + "type": "user_start", + "action": "started-session", + "module": "auditd", + "category": "user-login" + }, + "user": { + "uid": "0", + "name_map": { + "auid": "root", + "uid": "root" + }, + "auid": "0" + }, + "process": { + "pid": "19244", + "exe": "/usr/sbin/cron" + }, + "auditd": { + "data": { + "terminal": "cron", + "op": "PAM:session_open", + "acct": "root" + }, + "summary": { + "actor": { + "primary": "root", + "secondary": "root" + }, + "object": { + "primary": "cron", + "type": "user-session" + }, + "how": "/usr/sbin/cron" + }, + "sequence": 142267, + "result": "success", + "session": "3502" + }, + "host": { + "name": "demo-stack-haproxy-01" + }, + "beat": { + "name": "demo-stack-haproxy-01", + "hostname": "demo-stack-haproxy-01", + "version": "7.0.0-alpha1" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "vNCGUmcBTFzn_XoLwJHb", + "source": { + "@timestamp": "2018-11-27T00:17:01.174Z", + "host": { + "name": "demo-stack-haproxy-01" + }, + "event": { + "action": "disposed-credentials", + "module": "auditd", + "category": "user-login", + "type": "cred_disp" + }, + "user": { + "name_map": { + "auid": "root", + "uid": "root" + }, + "uid": "0", + "auid": "0" + }, + "process": { + "pid": "19244", + "exe": "/usr/sbin/cron" + }, + "auditd": { + "session": "3502", + "data": { + "op": "PAM:setcred", + "acct": "root", + "terminal": "cron" + }, + "summary": { + "object": { + "primary": "cron", + "type": "user-session" + }, + "how": "/usr/sbin/cron", + "actor": { + "primary": "root", + "secondary": "root" + } + }, + "sequence": 142268, + "result": "success" + }, + "beat": { + "name": "demo-stack-haproxy-01", + "hostname": "demo-stack-haproxy-01", + "version": "7.0.0-alpha1" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "vdCGUmcBTFzn_XoLwJHb", + "source": { + "@timestamp": "2018-11-27T00:17:01.175Z", + "event": { + "module": "auditd", + "category": "user-login", + "type": "user_end", + "action": "ended-session" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root", + "auid": "root" + }, + "auid": "0" + }, + "process": { + "pid": "19244", + "exe": "/usr/sbin/cron" + }, + "auditd": { + "summary": { + "object": { + "primary": "cron", + "type": "user-session" + }, + "how": "/usr/sbin/cron", + "actor": { + "secondary": "root", + "primary": "root" + } + }, + "sequence": 142269, + "result": "success", + "session": "3502", + "data": { + "acct": "root", + "op": "PAM:session_close", + "terminal": "cron" + } + }, + "beat": { + "hostname": "demo-stack-haproxy-01", + "version": "7.0.0-alpha1", + "name": "demo-stack-haproxy-01" + }, + "host": { + "name": "demo-stack-haproxy-01" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "vtCGUmcBTFzn_XoLwJH4", + "source": { + "@timestamp": "2018-11-27T00:17:01.195Z", + "event": { + "type": "user_acct", + "action": "was-authorized", + "module": "auditd", + "category": "user-login" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "pid": "12297", + "exe": "/usr/sbin/cron" + }, + "auditd": { + "session": "unset", + "data": { + "acct": "root", + "terminal": "cron", + "op": "PAM:accounting" + }, + "summary": { + "object": { + "primary": "cron", + "type": "user-session" + }, + "how": "/usr/sbin/cron", + "actor": { + "primary": "unset", + "secondary": "root" + } + }, + "sequence": 43110, + "result": "success" + }, + "beat": { + "name": "demo-stack-mysql-01", + "hostname": "demo-stack-mysql-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-mysql-01" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "v9CGUmcBTFzn_XoLwJH4", + "source": { + "@timestamp": "2018-11-27T00:17:01.195Z", + "beat": { + "name": "demo-stack-mysql-01", + "hostname": "demo-stack-mysql-01", + "version": "7.0.0-alpha1" + }, + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + }, + "process": { + "pid": "12297", + "exe": "/usr/sbin/cron" + }, + "auditd": { + "session": "unset", + "data": { + "terminal": "cron", + "op": "PAM:setcred", + "acct": "root" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "root" + }, + "object": { + "primary": "cron", + "type": "user-session" + }, + "how": "/usr/sbin/cron" + }, + "sequence": 43111, + "result": "success" + }, + "event": { + "category": "user-login", + "type": "cred_acq", + "action": "acquired-credentials", + "module": "auditd" + }, + "host": { + "name": "demo-stack-mysql-01" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "wNCGUmcBTFzn_XoLwJH4", + "source": { + "@timestamp": "2018-11-27T00:17:01.195Z", + "event": { + "action": "started-session", + "module": "auditd", + "category": "user-login", + "type": "user_start" + }, + "user": { + "uid": "0", + "name_map": { + "auid": "root", + "uid": "root" + }, + "auid": "0" + }, + "process": { + "pid": "12297", + "exe": "/usr/sbin/cron" + }, + "auditd": { + "summary": { + "actor": { + "primary": "root", + "secondary": "root" + }, + "object": { + "primary": "cron", + "type": "user-session" + }, + "how": "/usr/sbin/cron" + }, + "sequence": 43113, + "result": "success", + "session": "1251", + "data": { + "terminal": "cron", + "op": "PAM:session_open", + "acct": "root" + } + }, + "beat": { + "name": "demo-stack-mysql-01", + "hostname": "demo-stack-mysql-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-mysql-01" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "wdCGUmcBTFzn_XoLwJH4", + "source": { + "@timestamp": "2018-11-27T00:17:01.195Z", + "auditd": { + "session": "1251", + "data": { + "op": "PAM:setcred", + "terminal": "cron", + "acct": "root" + }, + "summary": { + "object": { + "primary": "cron", + "type": "user-session" + }, + "how": "/usr/sbin/cron", + "actor": { + "primary": "root", + "secondary": "root" + } + }, + "sequence": 43114, + "result": "success" + }, + "beat": { + "name": "demo-stack-mysql-01", + "hostname": "demo-stack-mysql-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-mysql-01" + }, + "event": { + "module": "auditd", + "category": "user-login", + "type": "cred_disp", + "action": "disposed-credentials" + }, + "user": { + "name_map": { + "auid": "root", + "uid": "root" + }, + "auid": "0", + "uid": "0" + }, + "process": { + "pid": "12297", + "exe": "/usr/sbin/cron" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "wtCGUmcBTFzn_XoLwJH4", + "source": { + "@timestamp": "2018-11-27T00:17:01.199Z", + "process": { + "pid": "12297", + "exe": "/usr/sbin/cron" + }, + "auditd": { + "session": "1251", + "data": { + "acct": "root", + "terminal": "cron", + "op": "PAM:session_close" + }, + "summary": { + "actor": { + "primary": "root", + "secondary": "root" + }, + "object": { + "primary": "cron", + "type": "user-session" + }, + "how": "/usr/sbin/cron" + }, + "sequence": 43115, + "result": "success" + }, + "beat": { + "name": "demo-stack-mysql-01", + "hostname": "demo-stack-mysql-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-mysql-01" + }, + "event": { + "module": "auditd", + "category": "user-login", + "type": "user_end", + "action": "ended-session" + }, + "user": { + "uid": "0", + "auid": "0", + "name_map": { + "auid": "root", + "uid": "root" + } + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "2dCGUmcBTFzn_XoLwpF3", + "source": { + "@timestamp": "2018-11-27T00:17:01.580Z", + "beat": { + "name": "demo-stack-apache-01", + "hostname": "demo-stack-apache-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-apache-01" + }, + "event": { + "action": "was-authorized", + "module": "auditd", + "category": "user-login", + "type": "user_acct" + }, + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + }, + "process": { + "pid": "24860", + "exe": "/usr/sbin/cron" + }, + "auditd": { + "result": "success", + "session": "unset", + "data": { + "acct": "root", + "op": "PAM:accounting", + "terminal": "cron" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "root" + }, + "object": { + "primary": "cron", + "type": "user-session" + }, + "how": "/usr/sbin/cron" + }, + "sequence": 184252 + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "2tCGUmcBTFzn_XoLwpF3", + "source": { + "@timestamp": "2018-11-27T00:17:01.581Z", + "process": { + "pid": "24860", + "exe": "/usr/sbin/cron" + }, + "auditd": { + "sequence": 184253, + "result": "success", + "session": "unset", + "data": { + "op": "PAM:setcred", + "terminal": "cron", + "acct": "root" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "root" + }, + "object": { + "primary": "cron", + "type": "user-session" + }, + "how": "/usr/sbin/cron" + } + }, + "event": { + "category": "user-login", + "type": "cred_acq", + "action": "acquired-credentials", + "module": "auditd" + }, + "beat": { + "hostname": "demo-stack-apache-01", + "version": "7.0.0-alpha1", + "name": "demo-stack-apache-01" + }, + "host": { + "name": "demo-stack-apache-01" + }, + "user": { + "uid": "0", + "auid": "unset", + "name_map": { + "uid": "root" + } + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "29CGUmcBTFzn_XoLwpF3", + "source": { + "@timestamp": "2018-11-27T00:17:01.582Z", + "auditd": { + "sequence": 184255, + "result": "success", + "session": "9855", + "data": { + "terminal": "cron", + "op": "PAM:session_open", + "acct": "root" + }, + "summary": { + "how": "/usr/sbin/cron", + "actor": { + "primary": "root", + "secondary": "root" + }, + "object": { + "type": "user-session", + "primary": "cron" + } + } + }, + "beat": { + "name": "demo-stack-apache-01", + "hostname": "demo-stack-apache-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-apache-01" + }, + "event": { + "type": "user_start", + "action": "started-session", + "module": "auditd", + "category": "user-login" + }, + "user": { + "uid": "0", + "name_map": { + "auid": "root", + "uid": "root" + }, + "auid": "0" + }, + "process": { + "exe": "/usr/sbin/cron", + "pid": "24860" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "3NCGUmcBTFzn_XoLwpF3", + "source": { + "@timestamp": "2018-11-27T00:17:01.585Z", + "event": { + "module": "auditd", + "category": "user-login", + "type": "cred_disp", + "action": "disposed-credentials" + }, + "user": { + "auid": "0", + "name_map": { + "uid": "root", + "auid": "root" + }, + "uid": "0" + }, + "process": { + "pid": "24860", + "exe": "/usr/sbin/cron" + }, + "auditd": { + "session": "9855", + "data": { + "terminal": "cron", + "op": "PAM:setcred", + "acct": "root" + }, + "summary": { + "object": { + "primary": "cron", + "type": "user-session" + }, + "how": "/usr/sbin/cron", + "actor": { + "secondary": "root", + "primary": "root" + } + }, + "sequence": 184256, + "result": "success" + }, + "host": { + "name": "demo-stack-apache-01" + }, + "beat": { + "name": "demo-stack-apache-01", + "hostname": "demo-stack-apache-01", + "version": "7.0.0-alpha1" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "3dCGUmcBTFzn_XoLwpF3", + "source": { + "@timestamp": "2018-11-27T00:17:01.586Z", + "host": { + "name": "demo-stack-apache-01" + }, + "event": { + "category": "user-login", + "type": "user_end", + "action": "ended-session", + "module": "auditd" + }, + "user": { + "uid": "0", + "name_map": { + "auid": "root", + "uid": "root" + }, + "auid": "0" + }, + "process": { + "pid": "24860", + "exe": "/usr/sbin/cron" + }, + "auditd": { + "result": "success", + "session": "9855", + "data": { + "terminal": "cron", + "op": "PAM:session_close", + "acct": "root" + }, + "summary": { + "how": "/usr/sbin/cron", + "actor": { + "primary": "root", + "secondary": "root" + }, + "object": { + "primary": "cron", + "type": "user-session" + } + }, + "sequence": 184257 + }, + "beat": { + "name": "demo-stack-apache-01", + "hostname": "demo-stack-apache-01", + "version": "7.0.0-alpha1" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "7dCGUmcBTFzn_XoLw5Er", + "source": { + "@timestamp": "2018-11-27T00:17:01.761Z", + "process": { + "pid": "32105", + "exe": "/usr/sbin/cron" + }, + "auditd": { + "sequence": 192405, + "result": "success", + "session": "unset", + "data": { + "op": "PAM:accounting", + "acct": "root", + "terminal": "cron" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "root" + }, + "object": { + "primary": "cron", + "type": "user-session" + }, + "how": "/usr/sbin/cron" + } + }, + "event": { + "action": "was-authorized", + "module": "auditd", + "category": "user-login", + "type": "user_acct" + }, + "beat": { + "hostname": "demo-stack-nginx-01", + "version": "7.0.0-alpha1", + "name": "demo-stack-nginx-01" + }, + "host": { + "name": "demo-stack-nginx-01" + }, + "user": { + "name_map": { + "uid": "root" + }, + "uid": "0", + "auid": "unset" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "7tCGUmcBTFzn_XoLw5Er", + "source": { + "@timestamp": "2018-11-27T00:17:01.762Z", + "auditd": { + "result": "success", + "session": "unset", + "data": { + "acct": "root", + "op": "PAM:setcred", + "terminal": "cron" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "root" + }, + "object": { + "primary": "cron", + "type": "user-session" + }, + "how": "/usr/sbin/cron" + }, + "sequence": 192406 + }, + "beat": { + "hostname": "demo-stack-nginx-01", + "version": "7.0.0-alpha1", + "name": "demo-stack-nginx-01" + }, + "host": { + "name": "demo-stack-nginx-01" + }, + "event": { + "category": "user-login", + "type": "cred_acq", + "action": "acquired-credentials", + "module": "auditd" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "pid": "32105", + "exe": "/usr/sbin/cron" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "79CGUmcBTFzn_XoLw5Er", + "source": { + "@timestamp": "2018-11-27T00:17:01.763Z", + "event": { + "type": "user_start", + "action": "started-session", + "module": "auditd", + "category": "user-login" + }, + "user": { + "auid": "0", + "name_map": { + "auid": "root", + "uid": "root" + }, + "uid": "0" + }, + "process": { + "pid": "32105", + "exe": "/usr/sbin/cron" + }, + "auditd": { + "summary": { + "actor": { + "primary": "root", + "secondary": "root" + }, + "object": { + "primary": "cron", + "type": "user-session" + }, + "how": "/usr/sbin/cron" + }, + "sequence": 192408, + "result": "success", + "session": "9859", + "data": { + "acct": "root", + "terminal": "cron", + "op": "PAM:session_open" + } + }, + "beat": { + "name": "demo-stack-nginx-01", + "hostname": "demo-stack-nginx-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-nginx-01" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "8NCGUmcBTFzn_XoLw5Er", + "source": { + "@timestamp": "2018-11-27T00:17:01.766Z", + "user": { + "uid": "0", + "name_map": { + "auid": "root", + "uid": "root" + }, + "auid": "0" + }, + "process": { + "exe": "/usr/sbin/cron", + "pid": "32105" + }, + "auditd": { + "sequence": 192409, + "result": "success", + "session": "9859", + "data": { + "op": "PAM:setcred", + "terminal": "cron", + "acct": "root" + }, + "summary": { + "how": "/usr/sbin/cron", + "actor": { + "primary": "root", + "secondary": "root" + }, + "object": { + "type": "user-session", + "primary": "cron" + } + } + }, + "beat": { + "name": "demo-stack-nginx-01", + "hostname": "demo-stack-nginx-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-nginx-01" + }, + "event": { + "module": "auditd", + "category": "user-login", + "type": "cred_disp", + "action": "disposed-credentials" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "8dCGUmcBTFzn_XoLw5Er", + "source": { + "@timestamp": "2018-11-27T00:17:01.767Z", + "event": { + "action": "ended-session", + "module": "auditd", + "category": "user-login", + "type": "user_end" + }, + "user": { + "auid": "0", + "name_map": { + "auid": "root", + "uid": "root" + }, + "uid": "0" + }, + "process": { + "pid": "32105", + "exe": "/usr/sbin/cron" + }, + "auditd": { + "session": "9859", + "data": { + "op": "PAM:session_close", + "terminal": "cron", + "acct": "root" + }, + "summary": { + "actor": { + "primary": "root", + "secondary": "root" + }, + "object": { + "primary": "cron", + "type": "user-session" + }, + "how": "/usr/sbin/cron" + }, + "sequence": 192410, + "result": "success" + }, + "beat": { + "version": "7.0.0-alpha1", + "name": "demo-stack-nginx-01", + "hostname": "demo-stack-nginx-01" + }, + "host": { + "name": "demo-stack-nginx-01" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "-tCGUmcBTFzn_XoLw5GT", + "source": { + "@timestamp": "2018-11-27T00:17:01.863Z", + "event": { + "type": "user_acct", + "action": "was-authorized", + "module": "auditd", + "category": "user-login" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "beat": { + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-redis-01" + }, + "process": { + "pid": "31840", + "exe": "/usr/sbin/cron" + }, + "auditd": { + "data": { + "op": "PAM:accounting", + "terminal": "cron", + "acct": "root" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "root" + }, + "object": { + "primary": "cron", + "type": "user-session" + }, + "how": "/usr/sbin/cron" + }, + "sequence": 186230, + "result": "success", + "session": "unset" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "-9CGUmcBTFzn_XoLw5GT", + "source": { + "@timestamp": "2018-11-27T00:17:01.864Z", + "host": { + "name": "demo-stack-redis-01" + }, + "event": { + "action": "acquired-credentials", + "module": "auditd", + "category": "user-login", + "type": "cred_acq" + }, + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + }, + "process": { + "pid": "31840", + "exe": "/usr/sbin/cron" + }, + "auditd": { + "data": { + "acct": "root", + "op": "PAM:setcred", + "terminal": "cron" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "root" + }, + "object": { + "type": "user-session", + "primary": "cron" + }, + "how": "/usr/sbin/cron" + }, + "sequence": 186231, + "result": "success", + "session": "unset" + }, + "beat": { + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "_NCGUmcBTFzn_XoLw5GT", + "source": { + "@timestamp": "2018-11-27T00:17:01.866Z", + "process": { + "pid": "31840", + "exe": "/usr/sbin/cron" + }, + "auditd": { + "sequence": 186233, + "result": "success", + "session": "3510", + "data": { + "op": "PAM:session_open", + "terminal": "cron", + "acct": "root" + }, + "summary": { + "how": "/usr/sbin/cron", + "actor": { + "primary": "root", + "secondary": "root" + }, + "object": { + "primary": "cron", + "type": "user-session" + } + } + }, + "beat": { + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-redis-01" + }, + "event": { + "action": "started-session", + "module": "auditd", + "category": "user-login", + "type": "user_start" + }, + "user": { + "uid": "0", + "name_map": { + "auid": "root", + "uid": "root" + }, + "auid": "0" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "_dCGUmcBTFzn_XoLw5GT", + "source": { + "@timestamp": "2018-11-27T00:17:01.868Z", + "beat": { + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1", + "name": "demo-stack-redis-01" + }, + "event": { + "module": "auditd", + "category": "user-login", + "type": "cred_disp", + "action": "disposed-credentials" + }, + "user": { + "uid": "0", + "name_map": { + "auid": "root", + "uid": "root" + }, + "auid": "0" + }, + "process": { + "pid": "31840", + "exe": "/usr/sbin/cron" + }, + "auditd": { + "data": { + "acct": "root", + "terminal": "cron", + "op": "PAM:setcred" + }, + "summary": { + "actor": { + "secondary": "root", + "primary": "root" + }, + "object": { + "primary": "cron", + "type": "user-session" + }, + "how": "/usr/sbin/cron" + }, + "sequence": 186234, + "result": "success", + "session": "3510" + }, + "host": { + "name": "demo-stack-redis-01" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "_tCGUmcBTFzn_XoLw5GT", + "source": { + "@timestamp": "2018-11-27T00:17:01.869Z", + "host": { + "name": "demo-stack-redis-01" + }, + "event": { + "category": "user-login", + "type": "user_end", + "action": "ended-session", + "module": "auditd" + }, + "user": { + "auid": "0", + "name_map": { + "auid": "root", + "uid": "root" + }, + "uid": "0" + }, + "process": { + "exe": "/usr/sbin/cron", + "pid": "31840" + }, + "auditd": { + "sequence": 186235, + "result": "success", + "session": "3510", + "data": { + "terminal": "cron", + "op": "PAM:session_close", + "acct": "root" + }, + "summary": { + "how": "/usr/sbin/cron", + "actor": { + "primary": "root", + "secondary": "root" + }, + "object": { + "primary": "cron", + "type": "user-session" + } + } + }, + "beat": { + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "rdCFUmcBTFzn_XoLNW-m", + "source": { + "@timestamp": "2018-11-27T00:15:19.990Z", + "source": { + "ip": "181.58.119.34" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "sequence": 43101, + "result": "fail", + "session": "unset", + "data": { + "terminal": "sshd", + "op": "login", + "acct": "(unknown user)" + }, + "summary": { + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + }, + "object": { + "primary": "sshd", + "secondary": "181.58.119.34", + "type": "user-session" + } + } + }, + "beat": { + "name": "demo-stack-mysql-01", + "hostname": "demo-stack-mysql-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-mysql-01" + }, + "event": { + "module": "auditd", + "category": "user-login", + "type": "user_login", + "action": "logged-in" + }, + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + }, + "process": { + "pid": "12279", + "exe": "/usr/sbin/sshd" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "rtCFUmcBTFzn_XoLNW-m", + "source": { + "@timestamp": "2018-11-27T00:15:19.990Z", + "auditd": { + "result": "fail", + "session": "unset", + "data": { + "terminal": "sshd", + "acct": "(invalid user)", + "op": "login" + }, + "summary": { + "object": { + "primary": "sshd", + "secondary": "181.58.119.34", + "type": "user-session" + }, + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + } + }, + "sequence": 43102 + }, + "host": { + "name": "demo-stack-mysql-01" + }, + "beat": { + "name": "demo-stack-mysql-01", + "hostname": "demo-stack-mysql-01", + "version": "7.0.0-alpha1" + }, + "event": { + "module": "auditd", + "category": "user-login", + "type": "user_login", + "action": "logged-in" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "pid": "12279", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "181.58.119.34" + }, + "network": { + "direction": "incoming" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "r9CFUmcBTFzn_XoLNW-m", + "source": { + "@timestamp": "2018-11-27T00:15:20.098Z", + "source": { + "ip": "181.58.119.34" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "session": "unset", + "data": { + "terminal": "ssh", + "hostname": "181.58.119.34", + "op": "PAM:bad_ident" + }, + "summary": { + "actor": { + "secondary": "root", + "primary": "unset" + }, + "object": { + "primary": "ssh", + "secondary": "181.58.119.34", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 43103, + "result": "fail" + }, + "beat": { + "hostname": "demo-stack-mysql-01", + "version": "7.0.0-alpha1", + "name": "demo-stack-mysql-01" + }, + "host": { + "name": "demo-stack-mysql-01" + }, + "event": { + "action": "error", + "module": "auditd", + "category": "user-login", + "type": "user_err" + }, + "user": { + "auid": "unset", + "uid": "0", + "name_map": { + "uid": "root" + } + }, + "process": { + "exe": "/usr/sbin/sshd", + "pid": "12279" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "9dCFUmcBTFzn_XoLPm_6", + "source": { + "@timestamp": "2018-11-27T00:15:22.384Z", + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "exe": "/usr/sbin/sshd", + "pid": "24844" + }, + "source": { + "ip": "78.217.134.141" + }, + "beat": { + "name": "demo-stack-apache-01", + "hostname": "demo-stack-apache-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-apache-01" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "sequence": 184246, + "result": "fail", + "session": "unset", + "data": { + "acct": "(unknown user)", + "op": "login", + "terminal": "sshd" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + }, + "object": { + "type": "user-session", + "primary": "sshd", + "secondary": "78.217.134.141" + }, + "how": "/usr/sbin/sshd" + } + }, + "event": { + "action": "logged-in", + "module": "auditd", + "category": "user-login", + "type": "user_login" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "9tCFUmcBTFzn_XoLPm_6", + "source": { + "@timestamp": "2018-11-27T00:15:22.385Z", + "beat": { + "name": "demo-stack-apache-01", + "hostname": "demo-stack-apache-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-apache-01" + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "exe": "/usr/sbin/sshd", + "pid": "24844" + }, + "source": { + "ip": "78.217.134.141" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "sequence": 184247, + "result": "fail", + "session": "unset", + "data": { + "terminal": "sshd", + "acct": "(invalid user)", + "op": "login" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + }, + "object": { + "primary": "sshd", + "secondary": "78.217.134.141", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + } + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "99CFUmcBTFzn_XoLPm_6", + "source": { + "@timestamp": "2018-11-27T00:15:22.546Z", + "process": { + "pid": "24844", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "78.217.134.141" + }, + "beat": { + "name": "demo-stack-apache-01", + "hostname": "demo-stack-apache-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-apache-01" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "session": "unset", + "data": { + "op": "PAM:bad_ident", + "hostname": "78.217.134.141", + "terminal": "ssh" + }, + "summary": { + "actor": { + "secondary": "root", + "primary": "unset" + }, + "object": { + "secondary": "78.217.134.141", + "type": "user-session", + "primary": "ssh" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 184248, + "result": "fail" + }, + "event": { + "type": "user_err", + "action": "error", + "module": "auditd", + "category": "user-login" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "ZdCGUmcBTFzn_XoLhYxL", + "source": { + "@timestamp": "2018-11-27T00:16:45.917Z", + "network": { + "direction": "incoming" + }, + "auditd": { + "result": "fail", + "session": "unset", + "data": { + "acct": "(unknown user)", + "op": "login", + "terminal": "sshd" + }, + "summary": { + "object": { + "type": "user-session", + "primary": "sshd", + "secondary": "212.144.234.165" + }, + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + } + }, + "sequence": 43104 + }, + "beat": { + "name": "demo-stack-mysql-01", + "hostname": "demo-stack-mysql-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-mysql-01" + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "pid": "12288", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "212.144.234.165" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "ZtCGUmcBTFzn_XoLhYxL", + "source": { + "@timestamp": "2018-11-27T00:16:45.917Z", + "source": { + "ip": "212.144.234.165" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "session": "unset", + "data": { + "acct": "(invalid user)", + "op": "login", + "terminal": "sshd" + }, + "summary": { + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + }, + "object": { + "primary": "sshd", + "secondary": "212.144.234.165", + "type": "user-session" + } + }, + "sequence": 43105, + "result": "fail" + }, + "event": { + "action": "logged-in", + "module": "auditd", + "category": "user-login", + "type": "user_login" + }, + "user": { + "name_map": { + "uid": "root" + }, + "uid": "0", + "auid": "unset" + }, + "process": { + "pid": "12288", + "exe": "/usr/sbin/sshd" + }, + "beat": { + "hostname": "demo-stack-mysql-01", + "version": "7.0.0-alpha1", + "name": "demo-stack-mysql-01" + }, + "host": { + "name": "demo-stack-mysql-01" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "Z9CGUmcBTFzn_XoLhYxL", + "source": { + "@timestamp": "2018-11-27T00:16:46.029Z", + "user": { + "name_map": { + "uid": "root" + }, + "uid": "0", + "auid": "unset" + }, + "process": { + "pid": "12288", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "212.144.234.165" + }, + "network": { + "direction": "incoming" + }, + "beat": { + "name": "demo-stack-mysql-01", + "hostname": "demo-stack-mysql-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-mysql-01" + }, + "auditd": { + "sequence": 43106, + "result": "fail", + "session": "unset", + "data": { + "hostname": "212.144.234.165", + "terminal": "ssh", + "op": "PAM:bad_ident" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "root" + }, + "object": { + "type": "user-session", + "primary": "ssh", + "secondary": "212.144.234.165" + }, + "how": "/usr/sbin/sshd" + } + }, + "event": { + "category": "user-login", + "type": "user_err", + "action": "error", + "module": "auditd" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "CtCGUmcBTFzn_XoLj44z", + "source": { + "@timestamp": "2018-11-27T00:16:48.454Z", + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "beat": { + "name": "demo-stack-mysql-01", + "hostname": "demo-stack-mysql-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-mysql-01" + }, + "process": { + "pid": "12290", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "82.165.64.156" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "summary": { + "actor": { + "secondary": "(unknown user)", + "primary": "unset" + }, + "object": { + "primary": "sshd", + "secondary": "82.165.64.156", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 43107, + "result": "fail", + "session": "unset", + "data": { + "terminal": "sshd", + "op": "login", + "acct": "(unknown user)" + } + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "C9CGUmcBTFzn_XoLj44z", + "source": { + "@timestamp": "2018-11-27T00:16:48.458Z", + "process": { + "pid": "12290", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "82.165.64.156" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "summary": { + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + }, + "object": { + "type": "user-session", + "primary": "sshd", + "secondary": "82.165.64.156" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 43108, + "result": "fail", + "session": "unset", + "data": { + "op": "login", + "acct": "(invalid user)", + "terminal": "sshd" + } + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + }, + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + }, + "host": { + "name": "demo-stack-mysql-01" + }, + "beat": { + "name": "demo-stack-mysql-01", + "hostname": "demo-stack-mysql-01", + "version": "7.0.0-alpha1" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "DNCGUmcBTFzn_XoLj44z", + "source": { + "@timestamp": "2018-11-27T00:16:48.574Z", + "network": { + "direction": "incoming" + }, + "auditd": { + "summary": { + "actor": { + "primary": "unset", + "secondary": "root" + }, + "object": { + "primary": "ssh", + "secondary": "82.165.64.156", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 43109, + "result": "fail", + "session": "unset", + "data": { + "terminal": "ssh", + "op": "PAM:bad_ident", + "hostname": "82.165.64.156" + } + }, + "event": { + "action": "error", + "module": "auditd", + "category": "user-login", + "type": "user_err" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "exe": "/usr/sbin/sshd", + "pid": "12290" + }, + "host": { + "name": "demo-stack-mysql-01" + }, + "beat": { + "name": "demo-stack-mysql-01", + "hostname": "demo-stack-mysql-01", + "version": "7.0.0-alpha1" + }, + "source": { + "ip": "82.165.64.156" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "XdCGUmcBTFzn_XoLspGv", + "source": { + "@timestamp": "2018-11-27T00:16:57.541Z", + "host": { + "name": "demo-stack-apache-01" + }, + "process": { + "pid": "24857", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "90.63.218.214" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "session": "unset", + "data": { + "acct": "(unknown user)", + "op": "login", + "terminal": "sshd" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + }, + "object": { + "primary": "sshd", + "secondary": "90.63.218.214", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 184249, + "result": "fail" + }, + "event": { + "action": "logged-in", + "module": "auditd", + "category": "user-login", + "type": "user_login" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "beat": { + "name": "demo-stack-apache-01", + "hostname": "demo-stack-apache-01", + "version": "7.0.0-alpha1" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "XtCGUmcBTFzn_XoLspGv", + "source": { + "@timestamp": "2018-11-27T00:16:57.542Z", + "auditd": { + "summary": { + "how": "/usr/sbin/sshd", + "actor": { + "secondary": "(invalid user)", + "primary": "unset" + }, + "object": { + "type": "user-session", + "primary": "sshd", + "secondary": "90.63.218.214" + } + }, + "sequence": 184250, + "result": "fail", + "session": "unset", + "data": { + "op": "login", + "acct": "(invalid user)", + "terminal": "sshd" + } + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + }, + "host": { + "name": "demo-stack-apache-01" + }, + "beat": { + "name": "demo-stack-apache-01", + "hostname": "demo-stack-apache-01", + "version": "7.0.0-alpha1" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "pid": "24857", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "90.63.218.214" + }, + "network": { + "direction": "incoming" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "X9CGUmcBTFzn_XoLspGv", + "source": { + "@timestamp": "2018-11-27T00:16:57.654Z", + "user": { + "name_map": { + "uid": "root" + }, + "auid": "unset", + "uid": "0" + }, + "process": { + "pid": "24857", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "90.63.218.214" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "sequence": 184251, + "result": "fail", + "session": "unset", + "data": { + "op": "PAM:bad_ident", + "hostname": "90.63.218.214", + "terminal": "ssh" + }, + "summary": { + "actor": { + "secondary": "root", + "primary": "unset" + }, + "object": { + "secondary": "90.63.218.214", + "type": "user-session", + "primary": "ssh" + }, + "how": "/usr/sbin/sshd" + } + }, + "beat": { + "name": "demo-stack-apache-01", + "hostname": "demo-stack-apache-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-apache-01" + }, + "event": { + "module": "auditd", + "category": "user-login", + "type": "user_err", + "action": "error" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "gNCDUmcBTFzn_XoLe0qz", + "source": { + "@timestamp": "2018-11-27T00:13:26.761Z", + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "pid": "31815", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "178.128.221.237" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "sequence": 186221, + "result": "fail", + "session": "unset", + "data": { + "terminal": "sshd", + "acct": "(unknown user)", + "op": "login" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + }, + "object": { + "type": "user-session", + "primary": "sshd", + "secondary": "178.128.221.237" + }, + "how": "/usr/sbin/sshd" + } + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + }, + "beat": { + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-redis-01" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "gdCDUmcBTFzn_XoLe0qz", + "source": { + "@timestamp": "2018-11-27T00:13:26.762Z", + "network": { + "direction": "incoming" + }, + "auditd": { + "summary": { + "actor": { + "secondary": "(invalid user)", + "primary": "unset" + }, + "object": { + "primary": "sshd", + "secondary": "178.128.221.237", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 186222, + "result": "fail", + "session": "unset", + "data": { + "acct": "(invalid user)", + "op": "login", + "terminal": "sshd" + } + }, + "event": { + "type": "user_login", + "action": "logged-in", + "module": "auditd", + "category": "user-login" + }, + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + }, + "beat": { + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-redis-01" + }, + "process": { + "pid": "31815", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "178.128.221.237" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "gtCDUmcBTFzn_XoLe0qz", + "source": { + "@timestamp": "2018-11-27T00:13:26.955Z", + "beat": { + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-redis-01" + }, + "event": { + "type": "user_err", + "action": "error", + "module": "auditd", + "category": "user-login" + }, + "user": { + "name_map": { + "uid": "root" + }, + "uid": "0", + "auid": "unset" + }, + "process": { + "pid": "31815", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "178.128.221.237" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "sequence": 186223, + "result": "fail", + "session": "unset", + "data": { + "terminal": "ssh", + "hostname": "178.128.221.237", + "op": "PAM:bad_ident" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "root" + }, + "object": { + "secondary": "178.128.221.237", + "type": "user-session", + "primary": "ssh" + }, + "how": "/usr/sbin/sshd" + } + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "oNCFUmcBTFzn_XoLinbC", + "source": { + "@timestamp": "2018-11-27T00:15:41.783Z", + "beat": { + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "exe": "/usr/sbin/sshd", + "pid": "31832" + }, + "source": { + "ip": "46.148.18.163" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "data": { + "terminal": "sshd", + "acct": "(unknown user)", + "op": "login" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + }, + "object": { + "primary": "sshd", + "secondary": "46.148.18.163", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 186227, + "result": "fail", + "session": "unset" + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + }, + "host": { + "name": "demo-stack-redis-01" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "odCFUmcBTFzn_XoLinbC", + "source": { + "@timestamp": "2018-11-27T00:15:41.784Z", + "source": { + "ip": "46.148.18.163" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "result": "fail", + "session": "unset", + "data": { + "op": "login", + "acct": "(invalid user)", + "terminal": "sshd" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + }, + "object": { + "primary": "sshd", + "secondary": "46.148.18.163", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 186228 + }, + "beat": { + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1", + "name": "demo-stack-redis-01" + }, + "host": { + "name": "demo-stack-redis-01" + }, + "event": { + "action": "logged-in", + "module": "auditd", + "category": "user-login", + "type": "user_login" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "pid": "31832", + "exe": "/usr/sbin/sshd" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "otCFUmcBTFzn_XoLinbC", + "source": { + "@timestamp": "2018-11-27T00:15:41.927Z", + "source": { + "ip": "46.148.18.163" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "session": "unset", + "data": { + "hostname": "46.148.18.163", + "terminal": "ssh", + "op": "PAM:bad_ident" + }, + "summary": { + "actor": { + "secondary": "root", + "primary": "unset" + }, + "object": { + "type": "user-session", + "primary": "ssh", + "secondary": "46.148.18.163" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 186229, + "result": "fail" + }, + "event": { + "category": "user-login", + "type": "user_err", + "action": "error", + "module": "auditd" + }, + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + }, + "beat": { + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-redis-01" + }, + "process": { + "pid": "31832", + "exe": "/usr/sbin/sshd" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "5tCEUmcBTFzn_XoLU1tS", + "source": { + "@timestamp": "2018-11-27T00:14:22.056Z", + "beat": { + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1" + }, + "process": { + "exe": "/usr/sbin/sshd", + "pid": "31823" + }, + "source": { + "ip": "185.241.4.160" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "summary": { + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + }, + "object": { + "secondary": "185.241.4.160", + "type": "user-session", + "primary": "sshd" + } + }, + "sequence": 186224, + "result": "fail", + "session": "unset", + "data": { + "acct": "(unknown user)", + "terminal": "sshd", + "op": "login" + } + }, + "event": { + "action": "logged-in", + "module": "auditd", + "category": "user-login", + "type": "user_login" + }, + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + }, + "host": { + "name": "demo-stack-redis-01" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "59CEUmcBTFzn_XoLU1tS", + "source": { + "@timestamp": "2018-11-27T00:14:22.061Z", + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "pid": "31823", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "185.241.4.160" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "sequence": 186225, + "result": "fail", + "session": "unset", + "data": { + "acct": "(invalid user)", + "terminal": "sshd", + "op": "login" + }, + "summary": { + "object": { + "secondary": "185.241.4.160", + "type": "user-session", + "primary": "sshd" + }, + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + } + } + }, + "beat": { + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-redis-01" + }, + "event": { + "module": "auditd", + "category": "user-login", + "type": "user_login", + "action": "logged-in" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "6NCEUmcBTFzn_XoLU1tS", + "source": { + "@timestamp": "2018-11-27T00:14:22.221Z", + "process": { + "exe": "/usr/sbin/sshd", + "pid": "31823" + }, + "source": { + "ip": "185.241.4.160" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "session": "unset", + "data": { + "hostname": "185.241.4.160", + "terminal": "ssh", + "op": "PAM:bad_ident" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "root" + }, + "object": { + "primary": "ssh", + "secondary": "185.241.4.160", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 186226, + "result": "fail" + }, + "beat": { + "version": "7.0.0-alpha1", + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01" + }, + "host": { + "name": "demo-stack-redis-01" + }, + "event": { + "action": "error", + "module": "auditd", + "category": "user-login", + "type": "user_err" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "D9CFUmcBTFzn_XoL031l", + "source": { + "@timestamp": "2018-11-27T00:16:00.377Z", + "auditd": { + "session": "unset", + "data": { + "terminal": "sshd", + "acct": "(unknown user)", + "op": "login" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + }, + "object": { + "secondary": "117.102.68.188", + "type": "user-session", + "primary": "sshd" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 44076, + "result": "fail" + }, + "host": { + "name": "demo-stack-es-01" + }, + "beat": { + "hostname": "demo-stack-es-01", + "version": "7.0.0-alpha1", + "name": "demo-stack-es-01" + }, + "event": { + "type": "user_login", + "action": "logged-in", + "module": "auditd", + "category": "user-login" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "exe": "/usr/sbin/sshd", + "pid": "28053" + }, + "source": { + "ip": "117.102.68.188" + }, + "network": { + "direction": "incoming" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "ENCFUmcBTFzn_XoL031l", + "source": { + "@timestamp": "2018-11-27T00:16:00.377Z", + "source": { + "ip": "117.102.68.188" + }, + "beat": { + "name": "demo-stack-es-01", + "hostname": "demo-stack-es-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-es-01" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "sequence": 44077, + "result": "fail", + "session": "unset", + "data": { + "acct": "(invalid user)", + "op": "login", + "terminal": "sshd" + }, + "summary": { + "object": { + "type": "user-session", + "primary": "sshd", + "secondary": "117.102.68.188" + }, + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + } + } + }, + "event": { + "module": "auditd", + "category": "user-login", + "type": "user_login", + "action": "logged-in" + }, + "user": { + "name_map": { + "uid": "root" + }, + "uid": "0", + "auid": "unset" + }, + "process": { + "pid": "28053", + "exe": "/usr/sbin/sshd" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "EdCFUmcBTFzn_XoL031l", + "source": { + "@timestamp": "2018-11-27T00:16:00.581Z", + "auditd": { + "sequence": 44078, + "result": "fail", + "session": "unset", + "data": { + "op": "PAM:bad_ident", + "hostname": "117.102.68.188", + "terminal": "ssh" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "root" + }, + "object": { + "secondary": "117.102.68.188", + "type": "user-session", + "primary": "ssh" + }, + "how": "/usr/sbin/sshd" + } + }, + "event": { + "category": "user-login", + "type": "user_err", + "action": "error", + "module": "auditd" + }, + "user": { + "name_map": { + "uid": "root" + }, + "auid": "unset", + "uid": "0" + }, + "beat": { + "name": "demo-stack-es-01", + "hostname": "demo-stack-es-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-es-01" + }, + "process": { + "pid": "28053", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "117.102.68.188" + }, + "network": { + "direction": "incoming" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "19CGUmcBTFzn_XoLC4FO", + "source": { + "@timestamp": "2018-11-27T00:16:14.690Z", + "auditd": { + "session": "unset", + "data": { + "op": "login", + "terminal": "sshd", + "acct": "(unknown user)" + }, + "summary": { + "object": { + "primary": "sshd", + "secondary": "91.183.42.58", + "type": "user-session" + }, + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + } + }, + "sequence": 44079, + "result": "fail" + }, + "beat": { + "name": "demo-stack-es-01", + "hostname": "demo-stack-es-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-es-01" + }, + "event": { + "action": "logged-in", + "module": "auditd", + "category": "user-login", + "type": "user_login" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "pid": "28062", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "91.183.42.58" + }, + "network": { + "direction": "incoming" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "2NCGUmcBTFzn_XoLC4FO", + "source": { + "@timestamp": "2018-11-27T00:16:14.690Z", + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "pid": "28062", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "91.183.42.58" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "sequence": 44080, + "result": "fail", + "session": "unset", + "data": { + "op": "login", + "terminal": "sshd", + "acct": "(invalid user)" + }, + "summary": { + "how": "/usr/sbin/sshd", + "actor": { + "secondary": "(invalid user)", + "primary": "unset" + }, + "object": { + "primary": "sshd", + "secondary": "91.183.42.58", + "type": "user-session" + } + } + }, + "host": { + "name": "demo-stack-es-01" + }, + "beat": { + "hostname": "demo-stack-es-01", + "version": "7.0.0-alpha1", + "name": "demo-stack-es-01" + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "2dCGUmcBTFzn_XoLC4FO", + "source": { + "@timestamp": "2018-11-27T00:16:14.802Z", + "event": { + "type": "user_err", + "action": "error", + "module": "auditd", + "category": "user-login" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "pid": "28062", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "91.183.42.58" + }, + "network": { + "direction": "incoming" + }, + "beat": { + "name": "demo-stack-es-01", + "hostname": "demo-stack-es-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-es-01" + }, + "auditd": { + "sequence": 44081, + "result": "fail", + "session": "unset", + "data": { + "hostname": "91.183.42.58", + "op": "PAM:bad_ident", + "terminal": "ssh" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "root" + }, + "object": { + "type": "user-session", + "primary": "ssh", + "secondary": "91.183.42.58" + }, + "how": "/usr/sbin/sshd" + } + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "dtCJUmcBTFzn_XoL_tm6", + "source": { + "@timestamp": "2018-11-27T00:20:33.614Z", + "auditd": { + "sequence": 44091, + "result": "fail", + "session": "unset", + "data": { + "acct": "(unknown user)", + "op": "login", + "terminal": "sshd" + }, + "summary": { + "actor": { + "secondary": "(unknown user)", + "primary": "unset" + }, + "object": { + "type": "user-session", + "primary": "sshd", + "secondary": "209.59.65.109" + }, + "how": "/usr/sbin/sshd" + } + }, + "beat": { + "name": "demo-stack-es-01", + "hostname": "demo-stack-es-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-es-01" + }, + "event": { + "type": "user_login", + "action": "logged-in", + "module": "auditd", + "category": "user-login" + }, + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + }, + "process": { + "pid": "28150", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "209.59.65.109" + }, + "network": { + "direction": "incoming" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "d9CJUmcBTFzn_XoL_tm6", + "source": { + "@timestamp": "2018-11-27T00:20:33.614Z", + "auditd": { + "sequence": 44092, + "result": "fail", + "session": "unset", + "data": { + "terminal": "sshd", + "op": "login", + "acct": "(invalid user)" + }, + "summary": { + "actor": { + "secondary": "(invalid user)", + "primary": "unset" + }, + "object": { + "primary": "sshd", + "secondary": "209.59.65.109", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + } + }, + "event": { + "action": "logged-in", + "module": "auditd", + "category": "user-login", + "type": "user_login" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "pid": "28150", + "exe": "/usr/sbin/sshd" + }, + "host": { + "name": "demo-stack-es-01" + }, + "beat": { + "name": "demo-stack-es-01", + "hostname": "demo-stack-es-01", + "version": "7.0.0-alpha1" + }, + "source": { + "ip": "209.59.65.109" + }, + "network": { + "direction": "incoming" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "eNCJUmcBTFzn_XoL_tm6", + "source": { + "@timestamp": "2018-11-27T00:20:33.698Z", + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + }, + "process": { + "exe": "/usr/sbin/sshd", + "pid": "28150" + }, + "source": { + "ip": "209.59.65.109" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "sequence": 44093, + "result": "fail", + "session": "unset", + "data": { + "op": "PAM:bad_ident", + "hostname": "209.59.65.109", + "terminal": "ssh" + }, + "summary": { + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "root" + }, + "object": { + "primary": "ssh", + "secondary": "209.59.65.109", + "type": "user-session" + } + } + }, + "beat": { + "version": "7.0.0-alpha1", + "name": "demo-stack-es-01", + "hostname": "demo-stack-es-01" + }, + "host": { + "name": "demo-stack-es-01" + }, + "event": { + "module": "auditd", + "category": "user-login", + "type": "user_err", + "action": "error" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "ptCKUmcBTFzn_XoLDtsd", + "source": { + "@timestamp": "2018-11-27T00:20:37.550Z", + "host": { + "name": "demo-stack-es-01" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "data": { + "op": "login", + "acct": "(unknown user)", + "terminal": "sshd" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + }, + "object": { + "primary": "sshd", + "secondary": "106.51.72.37", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 44094, + "result": "fail", + "session": "unset" + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + }, + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + }, + "process": { + "pid": "28153", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "106.51.72.37" + }, + "beat": { + "name": "demo-stack-es-01", + "hostname": "demo-stack-es-01", + "version": "7.0.0-alpha1" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "p9CKUmcBTFzn_XoLDtsd", + "source": { + "@timestamp": "2018-11-27T00:20:37.550Z", + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + }, + "process": { + "exe": "/usr/sbin/sshd", + "pid": "28153" + }, + "source": { + "ip": "106.51.72.37" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "sequence": 44095, + "result": "fail", + "session": "unset", + "data": { + "op": "login", + "acct": "(invalid user)", + "terminal": "sshd" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + }, + "object": { + "primary": "sshd", + "secondary": "106.51.72.37", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + } + }, + "beat": { + "name": "demo-stack-es-01", + "hostname": "demo-stack-es-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-es-01" + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "qNCKUmcBTFzn_XoLDtsd", + "source": { + "@timestamp": "2018-11-27T00:20:37.782Z", + "event": { + "category": "user-login", + "type": "user_err", + "action": "error", + "module": "auditd" + }, + "beat": { + "version": "7.0.0-alpha1", + "name": "demo-stack-es-01", + "hostname": "demo-stack-es-01" + }, + "host": { + "name": "demo-stack-es-01" + }, + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + }, + "process": { + "pid": "28153", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "106.51.72.37" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "sequence": 44096, + "result": "fail", + "session": "unset", + "data": { + "terminal": "ssh", + "op": "PAM:bad_ident", + "hostname": "106.51.72.37" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "root" + }, + "object": { + "primary": "ssh", + "secondary": "106.51.72.37", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + } + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "5tGMUmcBTFzn_XoLPwqH", + "source": { + "@timestamp": "2018-11-27T00:23:01.275Z", + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "pid": "31880", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "46.105.123.11" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "sequence": 186254, + "result": "fail", + "session": "unset", + "data": { + "terminal": "sshd", + "op": "login", + "acct": "(unknown user)" + }, + "summary": { + "object": { + "primary": "sshd", + "secondary": "46.105.123.11", + "type": "user-session" + }, + "how": "/usr/sbin/sshd", + "actor": { + "secondary": "(unknown user)", + "primary": "unset" + } + } + }, + "beat": { + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-redis-01" + }, + "event": { + "module": "auditd", + "category": "user-login", + "type": "user_login", + "action": "logged-in" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "59GMUmcBTFzn_XoLPwqH", + "source": { + "@timestamp": "2018-11-27T00:23:01.276Z", + "network": { + "direction": "incoming" + }, + "auditd": { + "result": "fail", + "session": "unset", + "data": { + "op": "login", + "terminal": "sshd", + "acct": "(invalid user)" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + }, + "object": { + "type": "user-session", + "primary": "sshd", + "secondary": "46.105.123.11" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 186255 + }, + "beat": { + "version": "7.0.0-alpha1", + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01" + }, + "host": { + "name": "demo-stack-redis-01" + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + }, + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + }, + "process": { + "pid": "31880", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "46.105.123.11" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "6NGMUmcBTFzn_XoLPwqH", + "source": { + "@timestamp": "2018-11-27T00:23:01.383Z", + "event": { + "action": "error", + "module": "auditd", + "category": "user-login", + "type": "user_err" + }, + "user": { + "name_map": { + "uid": "root" + }, + "auid": "unset", + "uid": "0" + }, + "process": { + "pid": "31880", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "46.105.123.11" + }, + "network": { + "direction": "incoming" + }, + "beat": { + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1", + "name": "demo-stack-redis-01" + }, + "host": { + "name": "demo-stack-redis-01" + }, + "auditd": { + "sequence": 186256, + "result": "fail", + "session": "unset", + "data": { + "op": "PAM:bad_ident", + "terminal": "ssh", + "hostname": "46.105.123.11" + }, + "summary": { + "actor": { + "secondary": "root", + "primary": "unset" + }, + "object": { + "type": "user-session", + "primary": "ssh", + "secondary": "46.105.123.11" + }, + "how": "/usr/sbin/sshd" + } + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "FtCKUmcBTFzn_XoL0uxn", + "source": { + "@timestamp": "2018-11-27T00:21:27.805Z", + "host": { + "name": "demo-stack-haproxy-01" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "summary": { + "object": { + "primary": "sshd", + "secondary": "213.143.97.179", + "type": "user-session" + }, + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + } + }, + "sequence": 142270, + "result": "fail", + "session": "unset", + "data": { + "terminal": "sshd", + "acct": "(unknown user)", + "op": "login" + } + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + }, + "user": { + "uid": "0", + "auid": "unset", + "name_map": { + "uid": "root" + } + }, + "process": { + "pid": "19271", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "213.143.97.179" + }, + "beat": { + "name": "demo-stack-haproxy-01", + "hostname": "demo-stack-haproxy-01", + "version": "7.0.0-alpha1" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "F9CKUmcBTFzn_XoL0uxn", + "source": { + "@timestamp": "2018-11-27T00:21:27.807Z", + "beat": { + "name": "demo-stack-haproxy-01", + "hostname": "demo-stack-haproxy-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-haproxy-01" + }, + "auditd": { + "sequence": 142271, + "result": "fail", + "session": "unset", + "data": { + "terminal": "sshd", + "acct": "(invalid user)", + "op": "login" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + }, + "object": { + "type": "user-session", + "primary": "sshd", + "secondary": "213.143.97.179" + }, + "how": "/usr/sbin/sshd" + } + }, + "event": { + "type": "user_login", + "action": "logged-in", + "module": "auditd", + "category": "user-login" + }, + "user": { + "name_map": { + "uid": "root" + }, + "uid": "0", + "auid": "unset" + }, + "process": { + "pid": "19271", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "213.143.97.179" + }, + "network": { + "direction": "incoming" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "GNCKUmcBTFzn_XoL0uxn", + "source": { + "@timestamp": "2018-11-27T00:21:27.937Z", + "beat": { + "name": "demo-stack-haproxy-01", + "hostname": "demo-stack-haproxy-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-haproxy-01" + }, + "auditd": { + "sequence": 142272, + "result": "fail", + "session": "unset", + "data": { + "terminal": "ssh", + "op": "PAM:bad_ident", + "hostname": "213.143.97.179" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "root" + }, + "object": { + "primary": "ssh", + "secondary": "213.143.97.179", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + } + }, + "event": { + "category": "user-login", + "type": "user_err", + "action": "error", + "module": "auditd" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "pid": "19271", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "213.143.97.179" + }, + "network": { + "direction": "incoming" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "ZtCLUmcBTFzn_XoLLPOM", + "source": { + "@timestamp": "2018-11-27T00:21:50.882Z", + "host": { + "name": "demo-stack-apache-01" + }, + "beat": { + "hostname": "demo-stack-apache-01", + "version": "7.0.0-alpha1", + "name": "demo-stack-apache-01" + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + }, + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + }, + "process": { + "pid": "24899", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "192.99.252.97" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "summary": { + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + }, + "object": { + "primary": "sshd", + "secondary": "192.99.252.97", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 184273, + "result": "fail", + "session": "unset", + "data": { + "terminal": "sshd", + "op": "login", + "acct": "(unknown user)" + } + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "Z9CLUmcBTFzn_XoLLPOM", + "source": { + "@timestamp": "2018-11-27T00:21:50.883Z", + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + }, + "process": { + "exe": "/usr/sbin/sshd", + "pid": "24899" + }, + "beat": { + "name": "demo-stack-apache-01", + "hostname": "demo-stack-apache-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-apache-01" + }, + "source": { + "ip": "192.99.252.97" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "sequence": 184274, + "result": "fail", + "session": "unset", + "data": { + "op": "login", + "terminal": "sshd", + "acct": "(invalid user)" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + }, + "object": { + "type": "user-session", + "primary": "sshd", + "secondary": "192.99.252.97" + }, + "how": "/usr/sbin/sshd" + } + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "aNCLUmcBTFzn_XoLLPOM", + "source": { + "@timestamp": "2018-11-27T00:21:50.926Z", + "process": { + "pid": "24899", + "exe": "/usr/sbin/sshd" + }, + "host": { + "name": "demo-stack-apache-01" + }, + "beat": { + "version": "7.0.0-alpha1", + "name": "demo-stack-apache-01", + "hostname": "demo-stack-apache-01" + }, + "source": { + "ip": "192.99.252.97" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "summary": { + "object": { + "primary": "ssh", + "secondary": "192.99.252.97", + "type": "user-session" + }, + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "root" + } + }, + "sequence": 184275, + "result": "fail", + "session": "unset", + "data": { + "op": "PAM:bad_ident", + "terminal": "ssh", + "hostname": "192.99.252.97" + } + }, + "event": { + "type": "user_err", + "action": "error", + "module": "auditd", + "category": "user-login" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "A9CKUmcBTFzn_XoLrulM", + "source": { + "@timestamp": "2018-11-27T00:21:18.562Z", + "network": { + "direction": "incoming" + }, + "auditd": { + "sequence": 186251, + "result": "fail", + "session": "unset", + "data": { + "acct": "(unknown user)", + "op": "login", + "terminal": "sshd" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + }, + "object": { + "type": "user-session", + "primary": "sshd", + "secondary": "163.172.35.93" + }, + "how": "/usr/sbin/sshd" + } + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + }, + "beat": { + "version": "7.0.0-alpha1", + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01" + }, + "host": { + "name": "demo-stack-redis-01" + }, + "user": { + "auid": "unset", + "uid": "0", + "name_map": { + "uid": "root" + } + }, + "process": { + "exe": "/usr/sbin/sshd", + "pid": "31872" + }, + "source": { + "ip": "163.172.35.93" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "BNCKUmcBTFzn_XoLrulM", + "source": { + "@timestamp": "2018-11-27T00:21:18.563Z", + "source": { + "ip": "163.172.35.93" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "result": "fail", + "session": "unset", + "data": { + "op": "login", + "terminal": "sshd", + "acct": "(invalid user)" + }, + "summary": { + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + }, + "object": { + "primary": "sshd", + "secondary": "163.172.35.93", + "type": "user-session" + } + }, + "sequence": 186252 + }, + "event": { + "module": "auditd", + "category": "user-login", + "type": "user_login", + "action": "logged-in" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "beat": { + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-redis-01" + }, + "process": { + "pid": "31872", + "exe": "/usr/sbin/sshd" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "BdCKUmcBTFzn_XoLrulM", + "source": { + "@timestamp": "2018-11-27T00:21:18.669Z", + "event": { + "module": "auditd", + "category": "user-login", + "type": "user_err", + "action": "error" + }, + "beat": { + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-redis-01" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "pid": "31872", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "163.172.35.93" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "sequence": 186253, + "result": "fail", + "session": "unset", + "data": { + "terminal": "ssh", + "op": "PAM:bad_ident", + "hostname": "163.172.35.93" + }, + "summary": { + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "root" + }, + "object": { + "primary": "ssh", + "secondary": "163.172.35.93", + "type": "user-session" + } + } + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "VtCKUmcBTFzn_XoLLt0C", + "source": { + "@timestamp": "2018-11-27T00:20:45.720Z", + "beat": { + "name": "demo-stack-apache-01", + "hostname": "demo-stack-apache-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-apache-01" + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "pid": "24889", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "122.175.55.196" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "data": { + "acct": "(unknown user)", + "op": "login", + "terminal": "sshd" + }, + "summary": { + "actor": { + "secondary": "(unknown user)", + "primary": "unset" + }, + "object": { + "primary": "sshd", + "secondary": "122.175.55.196", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 184270, + "result": "fail", + "session": "unset" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "V9CKUmcBTFzn_XoLLt0C", + "source": { + "@timestamp": "2018-11-27T00:20:45.721Z", + "beat": { + "name": "demo-stack-apache-01", + "hostname": "demo-stack-apache-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-apache-01" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "pid": "24889", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "122.175.55.196" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "sequence": 184271, + "result": "fail", + "session": "unset", + "data": { + "op": "login", + "terminal": "sshd", + "acct": "(invalid user)" + }, + "summary": { + "actor": { + "secondary": "(invalid user)", + "primary": "unset" + }, + "object": { + "primary": "sshd", + "secondary": "122.175.55.196", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + } + }, + "event": { + "action": "logged-in", + "module": "auditd", + "category": "user-login", + "type": "user_login" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "WNCKUmcBTFzn_XoLLt0C", + "source": { + "@timestamp": "2018-11-27T00:20:45.977Z", + "host": { + "name": "demo-stack-apache-01" + }, + "source": { + "ip": "122.175.55.196" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "result": "fail", + "session": "unset", + "data": { + "op": "PAM:bad_ident", + "hostname": "122.175.55.196", + "terminal": "ssh" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "root" + }, + "object": { + "secondary": "122.175.55.196", + "type": "user-session", + "primary": "ssh" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 184272 + }, + "event": { + "category": "user-login", + "type": "user_err", + "action": "error", + "module": "auditd" + }, + "user": { + "uid": "0", + "auid": "unset", + "name_map": { + "uid": "root" + } + }, + "process": { + "pid": "24889", + "exe": "/usr/sbin/sshd" + }, + "beat": { + "name": "demo-stack-apache-01", + "hostname": "demo-stack-apache-01", + "version": "7.0.0-alpha1" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "FNGNUmcBTFzn_XoLiyd2", + "source": { + "@timestamp": "2018-11-27T00:24:26.252Z", + "beat": { + "name": "demo-stack-nginx-01", + "hostname": "demo-stack-nginx-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-nginx-01" + }, + "source": { + "ip": "145.239.137.89" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "session": "unset", + "data": { + "acct": "(unknown user)", + "terminal": "sshd", + "op": "login" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + }, + "object": { + "primary": "sshd", + "secondary": "145.239.137.89", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 192426, + "result": "fail" + }, + "event": { + "action": "logged-in", + "module": "auditd", + "category": "user-login", + "type": "user_login" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "pid": "32155", + "exe": "/usr/sbin/sshd" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "FdGNUmcBTFzn_XoLiyd2", + "source": { + "@timestamp": "2018-11-27T00:24:26.253Z", + "source": { + "ip": "145.239.137.89" + }, + "beat": { + "name": "demo-stack-nginx-01", + "hostname": "demo-stack-nginx-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-nginx-01" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "sequence": 192427, + "result": "fail", + "session": "unset", + "data": { + "acct": "(invalid user)", + "terminal": "sshd", + "op": "login" + }, + "summary": { + "object": { + "primary": "sshd", + "secondary": "145.239.137.89", + "type": "user-session" + }, + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + } + } + }, + "event": { + "type": "user_login", + "action": "logged-in", + "module": "auditd", + "category": "user-login" + }, + "user": { + "uid": "0", + "auid": "unset", + "name_map": { + "uid": "root" + } + }, + "process": { + "exe": "/usr/sbin/sshd", + "pid": "32155" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "FtGNUmcBTFzn_XoLiyd2", + "source": { + "@timestamp": "2018-11-27T00:24:26.370Z", + "process": { + "exe": "/usr/sbin/sshd", + "pid": "32155" + }, + "source": { + "ip": "145.239.137.89" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "summary": { + "object": { + "primary": "ssh", + "secondary": "145.239.137.89", + "type": "user-session" + }, + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "root" + } + }, + "sequence": 192428, + "result": "fail", + "session": "unset", + "data": { + "hostname": "145.239.137.89", + "terminal": "ssh", + "op": "PAM:bad_ident" + } + }, + "beat": { + "name": "demo-stack-nginx-01", + "hostname": "demo-stack-nginx-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-nginx-01" + }, + "event": { + "type": "user_err", + "action": "error", + "module": "auditd", + "category": "user-login" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "QNGLUmcBTFzn_XoL7gTu", + "source": { + "@timestamp": "2018-11-27T00:22:40.643Z", + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "pid": "32146", + "exe": "/usr/sbin/sshd" + }, + "beat": { + "hostname": "demo-stack-nginx-01", + "version": "7.0.0-alpha1", + "name": "demo-stack-nginx-01" + }, + "host": { + "name": "demo-stack-nginx-01" + }, + "source": { + "ip": "52.189.217.7" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "result": "fail", + "session": "unset", + "data": { + "op": "login", + "acct": "(unknown user)", + "terminal": "sshd" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + }, + "object": { + "primary": "sshd", + "secondary": "52.189.217.7", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 192423 + }, + "event": { + "action": "logged-in", + "module": "auditd", + "category": "user-login", + "type": "user_login" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "QdGLUmcBTFzn_XoL7gTu", + "source": { + "@timestamp": "2018-11-27T00:22:40.644Z", + "user": { + "auid": "unset", + "uid": "0", + "name_map": { + "uid": "root" + } + }, + "process": { + "pid": "32146", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "52.189.217.7" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "summary": { + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + }, + "object": { + "secondary": "52.189.217.7", + "type": "user-session", + "primary": "sshd" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 192424, + "result": "fail", + "session": "unset", + "data": { + "terminal": "sshd", + "acct": "(invalid user)", + "op": "login" + } + }, + "beat": { + "name": "demo-stack-nginx-01", + "hostname": "demo-stack-nginx-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-nginx-01" + }, + "event": { + "module": "auditd", + "category": "user-login", + "type": "user_login", + "action": "logged-in" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "QtGLUmcBTFzn_XoL7gTu", + "source": { + "@timestamp": "2018-11-27T00:22:40.849Z", + "process": { + "pid": "32146", + "exe": "/usr/sbin/sshd" + }, + "beat": { + "name": "demo-stack-nginx-01", + "hostname": "demo-stack-nginx-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-nginx-01" + }, + "source": { + "ip": "52.189.217.7" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "session": "unset", + "data": { + "terminal": "ssh", + "op": "PAM:bad_ident", + "hostname": "52.189.217.7" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "root" + }, + "object": { + "primary": "ssh", + "secondary": "52.189.217.7", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 192425, + "result": "fail" + }, + "event": { + "action": "error", + "module": "auditd", + "category": "user-login", + "type": "user_err" + }, + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "_9GMUmcBTFzn_XoL1xdJ", + "source": { + "@timestamp": "2018-11-27T00:23:40.121Z", + "process": { + "pid": "28213", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "139.59.133.18" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "sequence": 44097, + "result": "fail", + "session": "unset", + "data": { + "terminal": "sshd", + "op": "login", + "acct": "(unknown user)" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + }, + "object": { + "primary": "sshd", + "secondary": "139.59.133.18", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + } + }, + "beat": { + "version": "7.0.0-alpha1", + "name": "demo-stack-es-01", + "hostname": "demo-stack-es-01" + }, + "host": { + "name": "demo-stack-es-01" + }, + "event": { + "action": "logged-in", + "module": "auditd", + "category": "user-login", + "type": "user_login" + }, + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "ANGMUmcBTFzn_XoL1xhJ", + "source": { + "@timestamp": "2018-11-27T00:23:40.125Z", + "process": { + "pid": "28213", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "139.59.133.18" + }, + "network": { + "direction": "incoming" + }, + "beat": { + "name": "demo-stack-es-01", + "hostname": "demo-stack-es-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-es-01" + }, + "auditd": { + "sequence": 44098, + "result": "fail", + "session": "unset", + "data": { + "op": "login", + "acct": "(invalid user)", + "terminal": "sshd" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + }, + "object": { + "primary": "sshd", + "secondary": "139.59.133.18", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + } + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "AdGMUmcBTFzn_XoL1xhJ", + "source": { + "@timestamp": "2018-11-27T00:23:40.237Z", + "auditd": { + "summary": { + "how": "/usr/sbin/sshd", + "actor": { + "secondary": "root", + "primary": "unset" + }, + "object": { + "primary": "ssh", + "secondary": "139.59.133.18", + "type": "user-session" + } + }, + "sequence": 44099, + "result": "fail", + "session": "unset", + "data": { + "terminal": "ssh", + "op": "PAM:bad_ident", + "hostname": "139.59.133.18" + } + }, + "event": { + "category": "user-login", + "type": "user_err", + "action": "error", + "module": "auditd" + }, + "user": { + "name_map": { + "uid": "root" + }, + "auid": "unset", + "uid": "0" + }, + "process": { + "pid": "28213", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "139.59.133.18" + }, + "beat": { + "name": "demo-stack-es-01", + "hostname": "demo-stack-es-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-es-01" + }, + "network": { + "direction": "incoming" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "ydGRUmcBTFzn_XoL6IZr", + "source": { + "@timestamp": "2018-11-27T00:29:12.188Z", + "beat": { + "name": "demo-stack-mysql-01", + "hostname": "demo-stack-mysql-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-mysql-01" + }, + "source": { + "ip": "54.37.154.254" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "session": "unset", + "data": { + "op": "login", + "acct": "(unknown user)", + "terminal": "sshd" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + }, + "object": { + "primary": "sshd", + "secondary": "54.37.154.254", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 43119, + "result": "fail" + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "pid": "12362", + "exe": "/usr/sbin/sshd" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "ytGRUmcBTFzn_XoL6IZr", + "source": { + "@timestamp": "2018-11-27T00:29:12.188Z", + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + }, + "user": { + "auid": "unset", + "uid": "0", + "name_map": { + "uid": "root" + } + }, + "process": { + "pid": "12362", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "54.37.154.254" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "summary": { + "actor": { + "secondary": "(invalid user)", + "primary": "unset" + }, + "object": { + "primary": "sshd", + "secondary": "54.37.154.254", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 43120, + "result": "fail", + "session": "unset", + "data": { + "terminal": "sshd", + "op": "login", + "acct": "(invalid user)" + } + }, + "beat": { + "name": "demo-stack-mysql-01", + "hostname": "demo-stack-mysql-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-mysql-01" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "y9GRUmcBTFzn_XoL6IZr", + "source": { + "@timestamp": "2018-11-27T00:29:12.300Z", + "network": { + "direction": "incoming" + }, + "auditd": { + "sequence": 43121, + "result": "fail", + "session": "unset", + "data": { + "op": "PAM:bad_ident", + "terminal": "ssh", + "hostname": "54.37.154.254" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "root" + }, + "object": { + "secondary": "54.37.154.254", + "type": "user-session", + "primary": "ssh" + }, + "how": "/usr/sbin/sshd" + } + }, + "event": { + "module": "auditd", + "category": "user-login", + "type": "user_err", + "action": "error" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "pid": "12362", + "exe": "/usr/sbin/sshd" + }, + "beat": { + "name": "demo-stack-mysql-01", + "hostname": "demo-stack-mysql-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-mysql-01" + }, + "source": { + "ip": "54.37.154.254" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "UtGRUmcBTFzn_XoL7YcV", + "source": { + "@timestamp": "2018-11-27T00:29:13.387Z", + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "pid": "24953", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "86.104.220.26" + }, + "network": { + "direction": "incoming" + }, + "beat": { + "name": "demo-stack-apache-01", + "hostname": "demo-stack-apache-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-apache-01" + }, + "auditd": { + "result": "fail", + "session": "unset", + "data": { + "op": "login", + "acct": "(unknown user)", + "terminal": "sshd" + }, + "summary": { + "actor": { + "secondary": "(unknown user)", + "primary": "unset" + }, + "object": { + "primary": "sshd", + "secondary": "86.104.220.26", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 184288 + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "U9GRUmcBTFzn_XoL7YcV", + "source": { + "@timestamp": "2018-11-27T00:29:13.388Z", + "host": { + "name": "demo-stack-apache-01" + }, + "beat": { + "hostname": "demo-stack-apache-01", + "version": "7.0.0-alpha1", + "name": "demo-stack-apache-01" + }, + "event": { + "action": "logged-in", + "module": "auditd", + "category": "user-login", + "type": "user_login" + }, + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + }, + "process": { + "exe": "/usr/sbin/sshd", + "pid": "24953" + }, + "source": { + "ip": "86.104.220.26" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "data": { + "terminal": "sshd", + "acct": "(invalid user)", + "op": "login" + }, + "summary": { + "how": "/usr/sbin/sshd", + "actor": { + "secondary": "(invalid user)", + "primary": "unset" + }, + "object": { + "secondary": "86.104.220.26", + "type": "user-session", + "primary": "sshd" + } + }, + "sequence": 184289, + "result": "fail", + "session": "unset" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "VNGRUmcBTFzn_XoL7YcV", + "source": { + "@timestamp": "2018-11-27T00:29:13.531Z", + "process": { + "pid": "24953", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "86.104.220.26" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "sequence": 184290, + "result": "fail", + "session": "unset", + "data": { + "hostname": "86.104.220.26", + "terminal": "ssh", + "op": "PAM:bad_ident" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "root" + }, + "object": { + "type": "user-session", + "primary": "ssh", + "secondary": "86.104.220.26" + }, + "how": "/usr/sbin/sshd" + } + }, + "beat": { + "name": "demo-stack-apache-01", + "hostname": "demo-stack-apache-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-apache-01" + }, + "event": { + "category": "user-login", + "type": "user_err", + "action": "error", + "module": "auditd" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "QdGPUmcBTFzn_XoLtVea", + "source": { + "@timestamp": "2018-11-27T00:26:48.111Z", + "event": { + "type": "user_login", + "action": "logged-in", + "module": "auditd", + "category": "user-login" + }, + "user": { + "auid": "unset", + "uid": "0", + "name_map": { + "uid": "root" + } + }, + "host": { + "name": "demo-stack-haproxy-01" + }, + "beat": { + "name": "demo-stack-haproxy-01", + "hostname": "demo-stack-haproxy-01", + "version": "7.0.0-alpha1" + }, + "process": { + "pid": "19304", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "121.162.29.165" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "session": "unset", + "data": { + "op": "login", + "acct": "(unknown user)", + "terminal": "sshd" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + }, + "object": { + "secondary": "121.162.29.165", + "type": "user-session", + "primary": "sshd" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 142276, + "result": "fail" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "QtGPUmcBTFzn_XoLtVea", + "source": { + "@timestamp": "2018-11-27T00:26:48.112Z", + "process": { + "exe": "/usr/sbin/sshd", + "pid": "19304" + }, + "source": { + "ip": "121.162.29.165" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "summary": { + "actor": { + "secondary": "(invalid user)", + "primary": "unset" + }, + "object": { + "primary": "sshd", + "secondary": "121.162.29.165", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 142277, + "result": "fail", + "session": "unset", + "data": { + "terminal": "sshd", + "op": "login", + "acct": "(invalid user)" + } + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + }, + "user": { + "auid": "unset", + "uid": "0", + "name_map": { + "uid": "root" + } + }, + "beat": { + "version": "7.0.0-alpha1", + "name": "demo-stack-haproxy-01", + "hostname": "demo-stack-haproxy-01" + }, + "host": { + "name": "demo-stack-haproxy-01" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "Q9GPUmcBTFzn_XoLtVea", + "source": { + "@timestamp": "2018-11-27T00:26:48.273Z", + "event": { + "category": "user-login", + "type": "user_err", + "action": "error", + "module": "auditd" + }, + "user": { + "name_map": { + "uid": "root" + }, + "auid": "unset", + "uid": "0" + }, + "process": { + "pid": "19304", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "121.162.29.165" + }, + "network": { + "direction": "incoming" + }, + "beat": { + "name": "demo-stack-haproxy-01", + "hostname": "demo-stack-haproxy-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-haproxy-01" + }, + "auditd": { + "session": "unset", + "data": { + "op": "PAM:bad_ident", + "hostname": "121.162.29.165", + "terminal": "ssh" + }, + "summary": { + "object": { + "primary": "ssh", + "secondary": "121.162.29.165", + "type": "user-session" + }, + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "root" + } + }, + "sequence": 142278, + "result": "fail" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "1tGPUmcBTFzn_XoL8FvF", + "source": { + "@timestamp": "2018-11-27T00:27:03.259Z", + "host": { + "name": "demo-stack-haproxy-01" + }, + "auditd": { + "sequence": 142279, + "result": "fail", + "session": "unset", + "data": { + "op": "login", + "acct": "(unknown user)", + "terminal": "sshd" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + }, + "object": { + "primary": "sshd", + "secondary": "103.56.207.96", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + } + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + }, + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + }, + "process": { + "pid": "19306", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "103.56.207.96" + }, + "network": { + "direction": "incoming" + }, + "beat": { + "name": "demo-stack-haproxy-01", + "hostname": "demo-stack-haproxy-01", + "version": "7.0.0-alpha1" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "19GPUmcBTFzn_XoL8FvF", + "source": { + "@timestamp": "2018-11-27T00:27:03.260Z", + "process": { + "pid": "19306", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "103.56.207.96" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "result": "fail", + "session": "unset", + "data": { + "terminal": "sshd", + "acct": "(invalid user)", + "op": "login" + }, + "summary": { + "object": { + "type": "user-session", + "primary": "sshd", + "secondary": "103.56.207.96" + }, + "how": "/usr/sbin/sshd", + "actor": { + "secondary": "(invalid user)", + "primary": "unset" + } + }, + "sequence": 142280 + }, + "host": { + "name": "demo-stack-haproxy-01" + }, + "beat": { + "name": "demo-stack-haproxy-01", + "hostname": "demo-stack-haproxy-01", + "version": "7.0.0-alpha1" + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "2NGPUmcBTFzn_XoL8FvF", + "source": { + "@timestamp": "2018-11-27T00:27:03.463Z", + "user": { + "uid": "0", + "auid": "unset", + "name_map": { + "uid": "root" + } + }, + "process": { + "pid": "19306", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "103.56.207.96" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "session": "unset", + "data": { + "hostname": "103.56.207.96", + "terminal": "ssh", + "op": "PAM:bad_ident" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "root" + }, + "object": { + "type": "user-session", + "primary": "ssh", + "secondary": "103.56.207.96" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 142281, + "result": "fail" + }, + "event": { + "type": "user_err", + "action": "error", + "module": "auditd", + "category": "user-login" + }, + "beat": { + "name": "demo-stack-haproxy-01", + "hostname": "demo-stack-haproxy-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-haproxy-01" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "l9GQUmcBTFzn_XoL0m8i", + "source": { + "@timestamp": "2018-11-27T00:28:00.952Z", + "host": { + "name": "demo-stack-redis-01" + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + }, + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + }, + "process": { + "exe": "/usr/sbin/sshd", + "pid": "31904" + }, + "source": { + "ip": "122.152.225.120" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "sequence": 186260, + "result": "fail", + "session": "unset", + "data": { + "terminal": "sshd", + "op": "login", + "acct": "(unknown user)" + }, + "summary": { + "actor": { + "secondary": "(unknown user)", + "primary": "unset" + }, + "object": { + "secondary": "122.152.225.120", + "type": "user-session", + "primary": "sshd" + }, + "how": "/usr/sbin/sshd" + } + }, + "beat": { + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "mNGQUmcBTFzn_XoL0m8i", + "source": { + "@timestamp": "2018-11-27T00:28:00.954Z", + "process": { + "exe": "/usr/sbin/sshd", + "pid": "31904" + }, + "source": { + "ip": "122.152.225.120" + }, + "beat": { + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-redis-01" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "sequence": 186261, + "result": "fail", + "session": "unset", + "data": { + "op": "login", + "acct": "(invalid user)", + "terminal": "sshd" + }, + "summary": { + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + }, + "object": { + "primary": "sshd", + "secondary": "122.152.225.120", + "type": "user-session" + } + } + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + }, + "user": { + "uid": "0", + "auid": "unset", + "name_map": { + "uid": "root" + } + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "mdGQUmcBTFzn_XoL0m8i", + "source": { + "@timestamp": "2018-11-27T00:28:01.157Z", + "network": { + "direction": "incoming" + }, + "beat": { + "version": "7.0.0-alpha1", + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01" + }, + "host": { + "name": "demo-stack-redis-01" + }, + "auditd": { + "session": "unset", + "data": { + "terminal": "ssh", + "op": "PAM:bad_ident", + "hostname": "122.152.225.120" + }, + "summary": { + "object": { + "type": "user-session", + "primary": "ssh", + "secondary": "122.152.225.120" + }, + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "root" + } + }, + "sequence": 186262, + "result": "fail" + }, + "event": { + "category": "user-login", + "type": "user_err", + "action": "error", + "module": "auditd" + }, + "user": { + "name_map": { + "uid": "root" + }, + "uid": "0", + "auid": "unset" + }, + "process": { + "exe": "/usr/sbin/sshd", + "pid": "31904" + }, + "source": { + "ip": "122.152.225.120" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "nNGTUmcBTFzn_XoLCp-5", + "source": { + "@timestamp": "2018-11-27T00:30:26.511Z", + "event": { + "type": "user_login", + "action": "logged-in", + "module": "auditd", + "category": "user-login" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "exe": "/usr/sbin/sshd", + "pid": "32530" + }, + "source": { + "ip": "173.167.200.227" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "result": "fail", + "session": "unset", + "data": { + "acct": "(unknown user)", + "terminal": "sshd", + "op": "login" + }, + "summary": { + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + }, + "object": { + "type": "user-session", + "primary": "sshd", + "secondary": "173.167.200.227" + } + }, + "sequence": 192434 + }, + "beat": { + "name": "demo-stack-nginx-01", + "hostname": "demo-stack-nginx-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-nginx-01" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "ndGTUmcBTFzn_XoLCp-5", + "source": { + "@timestamp": "2018-11-27T00:30:26.512Z", + "user": { + "uid": "0", + "auid": "unset", + "name_map": { + "uid": "root" + } + }, + "process": { + "pid": "32530", + "exe": "/usr/sbin/sshd" + }, + "beat": { + "name": "demo-stack-nginx-01", + "hostname": "demo-stack-nginx-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-nginx-01" + }, + "source": { + "ip": "173.167.200.227" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "session": "unset", + "data": { + "op": "login", + "acct": "(invalid user)", + "terminal": "sshd" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + }, + "object": { + "primary": "sshd", + "secondary": "173.167.200.227", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 192435, + "result": "fail" + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "ntGTUmcBTFzn_XoLCp-5", + "source": { + "@timestamp": "2018-11-27T00:30:26.557Z", + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "pid": "32530", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "173.167.200.227" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "summary": { + "actor": { + "primary": "unset", + "secondary": "root" + }, + "object": { + "primary": "ssh", + "secondary": "173.167.200.227", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 192436, + "result": "fail", + "session": "unset", + "data": { + "hostname": "173.167.200.227", + "terminal": "ssh", + "op": "PAM:bad_ident" + } + }, + "beat": { + "name": "demo-stack-nginx-01", + "hostname": "demo-stack-nginx-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-nginx-01" + }, + "event": { + "category": "user-login", + "type": "user_err", + "action": "error", + "module": "auditd" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "zdGQUmcBTFzn_XoLtmz7", + "source": { + "@timestamp": "2018-11-27T00:27:54.000Z", + "user": { + "name_map": { + "uid": "root" + }, + "auid": "unset", + "uid": "0" + }, + "process": { + "pid": "31902", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "184.170.7.230" + }, + "beat": { + "version": "7.0.0-alpha1", + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01" + }, + "host": { + "name": "demo-stack-redis-01" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "sequence": 186257, + "result": "fail", + "session": "unset", + "data": { + "terminal": "sshd", + "op": "login", + "acct": "(unknown user)" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + }, + "object": { + "secondary": "184.170.7.230", + "type": "user-session", + "primary": "sshd" + }, + "how": "/usr/sbin/sshd" + } + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "ztGQUmcBTFzn_XoLtmz7", + "source": { + "@timestamp": "2018-11-27T00:27:54.002Z", + "host": { + "name": "demo-stack-redis-01" + }, + "process": { + "pid": "31902", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "184.170.7.230" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "data": { + "op": "login", + "terminal": "sshd", + "acct": "(invalid user)" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + }, + "object": { + "primary": "sshd", + "secondary": "184.170.7.230", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 186258, + "result": "fail", + "session": "unset" + }, + "event": { + "action": "logged-in", + "module": "auditd", + "category": "user-login", + "type": "user_login" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "beat": { + "version": "7.0.0-alpha1", + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "z9GQUmcBTFzn_XoLtmz7", + "source": { + "@timestamp": "2018-11-27T00:27:54.541Z", + "beat": { + "version": "7.0.0-alpha1", + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01" + }, + "host": { + "name": "demo-stack-redis-01" + }, + "event": { + "category": "user-login", + "type": "user_err", + "action": "error", + "module": "auditd" + }, + "user": { + "uid": "0", + "auid": "unset", + "name_map": { + "uid": "root" + } + }, + "process": { + "pid": "31902", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "184.170.7.230" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "session": "unset", + "data": { + "op": "PAM:bad_ident", + "terminal": "ssh", + "hostname": "184.170.7.230" + }, + "summary": { + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "root" + }, + "object": { + "primary": "ssh", + "secondary": "184.170.7.230", + "type": "user-session" + } + }, + "sequence": 186259, + "result": "fail" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "QdGSUmcBTFzn_XoLx5oM", + "source": { + "@timestamp": "2018-11-27T00:30:09.185Z", + "beat": { + "hostname": "demo-stack-mysql-01", + "version": "7.0.0-alpha1", + "name": "demo-stack-mysql-01" + }, + "process": { + "exe": "/usr/sbin/sshd", + "pid": "12372" + }, + "source": { + "ip": "86.229.8.199" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "session": "unset", + "data": { + "terminal": "sshd", + "acct": "(unknown user)", + "op": "login" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + }, + "object": { + "secondary": "86.229.8.199", + "type": "user-session", + "primary": "sshd" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 43125, + "result": "fail" + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + }, + "user": { + "auid": "unset", + "uid": "0", + "name_map": { + "uid": "root" + } + }, + "host": { + "name": "demo-stack-mysql-01" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "QtGSUmcBTFzn_XoLx5oM", + "source": { + "@timestamp": "2018-11-27T00:30:09.185Z", + "auditd": { + "session": "unset", + "data": { + "terminal": "sshd", + "op": "login", + "acct": "(invalid user)" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + }, + "object": { + "type": "user-session", + "primary": "sshd", + "secondary": "86.229.8.199" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 43126, + "result": "fail" + }, + "event": { + "action": "logged-in", + "module": "auditd", + "category": "user-login", + "type": "user_login" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "pid": "12372", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "86.229.8.199" + }, + "beat": { + "hostname": "demo-stack-mysql-01", + "version": "7.0.0-alpha1", + "name": "demo-stack-mysql-01" + }, + "host": { + "name": "demo-stack-mysql-01" + }, + "network": { + "direction": "incoming" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "Q9GSUmcBTFzn_XoLx5oM", + "source": { + "@timestamp": "2018-11-27T00:30:09.329Z", + "host": { + "name": "demo-stack-mysql-01" + }, + "event": { + "type": "user_err", + "action": "error", + "module": "auditd", + "category": "user-login" + }, + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + }, + "process": { + "exe": "/usr/sbin/sshd", + "pid": "12372" + }, + "source": { + "ip": "86.229.8.199" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "summary": { + "actor": { + "primary": "unset", + "secondary": "root" + }, + "object": { + "primary": "ssh", + "secondary": "86.229.8.199", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 43127, + "result": "fail", + "session": "unset", + "data": { + "terminal": "ssh", + "hostname": "86.229.8.199", + "op": "PAM:bad_ident" + } + }, + "beat": { + "name": "demo-stack-mysql-01", + "hostname": "demo-stack-mysql-01", + "version": "7.0.0-alpha1" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "6tGSUmcBTFzn_XoLe5Pk", + "source": { + "@timestamp": "2018-11-27T00:29:49.943Z", + "host": { + "name": "demo-stack-mysql-01" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "pid": "12370", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "138.197.44.25" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "sequence": 43122, + "result": "fail", + "session": "unset", + "data": { + "terminal": "sshd", + "op": "login", + "acct": "(unknown user)" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + }, + "object": { + "primary": "sshd", + "secondary": "138.197.44.25", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + } + }, + "event": { + "type": "user_login", + "action": "logged-in", + "module": "auditd", + "category": "user-login" + }, + "beat": { + "hostname": "demo-stack-mysql-01", + "version": "7.0.0-alpha1", + "name": "demo-stack-mysql-01" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "69GSUmcBTFzn_XoLe5Pk", + "source": { + "@timestamp": "2018-11-27T00:29:49.943Z", + "user": { + "name_map": { + "uid": "root" + }, + "uid": "0", + "auid": "unset" + }, + "process": { + "pid": "12370", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "138.197.44.25" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "summary": { + "object": { + "primary": "sshd", + "secondary": "138.197.44.25", + "type": "user-session" + }, + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + } + }, + "sequence": 43123, + "result": "fail", + "session": "unset", + "data": { + "acct": "(invalid user)", + "op": "login", + "terminal": "sshd" + } + }, + "beat": { + "hostname": "demo-stack-mysql-01", + "version": "7.0.0-alpha1", + "name": "demo-stack-mysql-01" + }, + "host": { + "name": "demo-stack-mysql-01" + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "7NGSUmcBTFzn_XoLe5Pk", + "source": { + "@timestamp": "2018-11-27T00:29:49.975Z", + "auditd": { + "data": { + "op": "PAM:bad_ident", + "hostname": "138.197.44.25", + "terminal": "ssh" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "root" + }, + "object": { + "primary": "ssh", + "secondary": "138.197.44.25", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 43124, + "result": "fail", + "session": "unset" + }, + "event": { + "module": "auditd", + "category": "user-login", + "type": "user_err", + "action": "error" + }, + "beat": { + "name": "demo-stack-mysql-01", + "hostname": "demo-stack-mysql-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-mysql-01" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "pid": "12370", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "138.197.44.25" + }, + "network": { + "direction": "incoming" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "59GRUmcBTFzn_XoLFXXo", + "source": { + "@timestamp": "2018-11-27T00:28:18.298Z", + "event": { + "action": "logged-in", + "module": "auditd", + "category": "user-login", + "type": "user_login" + }, + "beat": { + "hostname": "demo-stack-es-01", + "version": "7.0.0-alpha1", + "name": "demo-stack-es-01" + }, + "host": { + "name": "demo-stack-es-01" + }, + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + }, + "process": { + "exe": "/usr/sbin/sshd", + "pid": "28318" + }, + "source": { + "ip": "200.35.110.58" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "result": "fail", + "session": "unset", + "data": { + "acct": "(unknown user)", + "op": "login", + "terminal": "sshd" + }, + "summary": { + "object": { + "type": "user-session", + "primary": "sshd", + "secondary": "200.35.110.58" + }, + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + } + }, + "sequence": 44112 + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "6NGRUmcBTFzn_XoLFXXo", + "source": { + "@timestamp": "2018-11-27T00:28:18.298Z", + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "exe": "/usr/sbin/sshd", + "pid": "28318" + }, + "source": { + "ip": "200.35.110.58" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "sequence": 44113, + "result": "fail", + "session": "unset", + "data": { + "terminal": "sshd", + "op": "login", + "acct": "(invalid user)" + }, + "summary": { + "actor": { + "secondary": "(invalid user)", + "primary": "unset" + }, + "object": { + "primary": "sshd", + "secondary": "200.35.110.58", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + } + }, + "beat": { + "name": "demo-stack-es-01", + "hostname": "demo-stack-es-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-es-01" + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "6dGRUmcBTFzn_XoLFXXo", + "source": { + "@timestamp": "2018-11-27T00:28:18.414Z", + "network": { + "direction": "incoming" + }, + "auditd": { + "result": "fail", + "session": "unset", + "data": { + "op": "PAM:bad_ident", + "hostname": "200.35.110.58", + "terminal": "ssh" + }, + "summary": { + "actor": { + "secondary": "root", + "primary": "unset" + }, + "object": { + "secondary": "200.35.110.58", + "type": "user-session", + "primary": "ssh" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 44114 + }, + "beat": { + "hostname": "demo-stack-es-01", + "version": "7.0.0-alpha1", + "name": "demo-stack-es-01" + }, + "host": { + "name": "demo-stack-es-01" + }, + "event": { + "type": "user_err", + "action": "error", + "module": "auditd", + "category": "user-login" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "pid": "28318", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "200.35.110.58" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "r9KXUmcBTFzn_XoLtQab", + "source": { + "@timestamp": "2018-11-27T00:35:32.401Z", + "host": { + "name": "demo-stack-redis-01" + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "pid": "31943", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "164.132.43.198" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "session": "unset", + "data": { + "op": "login", + "terminal": "sshd", + "acct": "(unknown user)" + }, + "summary": { + "object": { + "type": "user-session", + "primary": "sshd", + "secondary": "164.132.43.198" + }, + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + } + }, + "sequence": 186269, + "result": "fail" + }, + "beat": { + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "sNKXUmcBTFzn_XoLtQab", + "source": { + "@timestamp": "2018-11-27T00:35:32.402Z", + "beat": { + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-redis-01" + }, + "auditd": { + "sequence": 186270, + "result": "fail", + "session": "unset", + "data": { + "terminal": "sshd", + "op": "login", + "acct": "(invalid user)" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + }, + "object": { + "secondary": "164.132.43.198", + "type": "user-session", + "primary": "sshd" + }, + "how": "/usr/sbin/sshd" + } + }, + "event": { + "module": "auditd", + "category": "user-login", + "type": "user_login", + "action": "logged-in" + }, + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + }, + "process": { + "exe": "/usr/sbin/sshd", + "pid": "31943" + }, + "source": { + "ip": "164.132.43.198" + }, + "network": { + "direction": "incoming" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "sdKXUmcBTFzn_XoLtQab", + "source": { + "@timestamp": "2018-11-27T00:35:32.510Z", + "beat": { + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1", + "name": "demo-stack-redis-01" + }, + "host": { + "name": "demo-stack-redis-01" + }, + "event": { + "module": "auditd", + "category": "user-login", + "type": "user_err", + "action": "error" + }, + "user": { + "uid": "0", + "auid": "unset", + "name_map": { + "uid": "root" + } + }, + "process": { + "pid": "31943", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "164.132.43.198" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "sequence": 186271, + "result": "fail", + "session": "unset", + "data": { + "hostname": "164.132.43.198", + "terminal": "ssh", + "op": "PAM:bad_ident" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "root" + }, + "object": { + "primary": "ssh", + "secondary": "164.132.43.198", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + } + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "CNKXUmcBTFzn_XoLxggy", + "source": { + "@timestamp": "2018-11-27T00:35:36.648Z", + "process": { + "pid": "19353", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "46.55.214.3" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "result": "fail", + "session": "unset", + "data": { + "acct": "(unknown user)", + "op": "login", + "terminal": "sshd" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + }, + "object": { + "primary": "sshd", + "secondary": "46.55.214.3", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 142285 + }, + "event": { + "module": "auditd", + "category": "user-login", + "type": "user_login", + "action": "logged-in" + }, + "beat": { + "name": "demo-stack-haproxy-01", + "hostname": "demo-stack-haproxy-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-haproxy-01" + }, + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "CdKXUmcBTFzn_XoLxggy", + "source": { + "@timestamp": "2018-11-27T00:35:36.650Z", + "network": { + "direction": "incoming" + }, + "beat": { + "name": "demo-stack-haproxy-01", + "hostname": "demo-stack-haproxy-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-haproxy-01" + }, + "auditd": { + "sequence": 142286, + "result": "fail", + "session": "unset", + "data": { + "terminal": "sshd", + "acct": "(invalid user)", + "op": "login" + }, + "summary": { + "how": "/usr/sbin/sshd", + "actor": { + "secondary": "(invalid user)", + "primary": "unset" + }, + "object": { + "type": "user-session", + "primary": "sshd", + "secondary": "46.55.214.3" + } + } + }, + "event": { + "type": "user_login", + "action": "logged-in", + "module": "auditd", + "category": "user-login" + }, + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + }, + "process": { + "pid": "19353", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "46.55.214.3" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "CtKXUmcBTFzn_XoLxggy", + "source": { + "@timestamp": "2018-11-27T00:35:36.800Z", + "beat": { + "name": "demo-stack-haproxy-01", + "hostname": "demo-stack-haproxy-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-haproxy-01" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "summary": { + "object": { + "type": "user-session", + "primary": "ssh", + "secondary": "46.55.214.3" + }, + "how": "/usr/sbin/sshd", + "actor": { + "secondary": "root", + "primary": "unset" + } + }, + "sequence": 142287, + "result": "fail", + "session": "unset", + "data": { + "op": "PAM:bad_ident", + "terminal": "ssh", + "hostname": "46.55.214.3" + } + }, + "event": { + "type": "user_err", + "action": "error", + "module": "auditd", + "category": "user-login" + }, + "user": { + "name_map": { + "uid": "root" + }, + "uid": "0", + "auid": "unset" + }, + "process": { + "pid": "19353", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "46.55.214.3" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "S9KYUmcBTFzn_XoL9yJk", + "source": { + "@timestamp": "2018-11-27T00:36:54.778Z", + "network": { + "direction": "incoming" + }, + "auditd": { + "result": "fail", + "session": "unset", + "data": { + "acct": "(unknown user)", + "terminal": "sshd", + "op": "login" + }, + "summary": { + "actor": { + "secondary": "(unknown user)", + "primary": "unset" + }, + "object": { + "primary": "sshd", + "secondary": "125.63.92.170", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 142288 + }, + "event": { + "type": "user_login", + "action": "logged-in", + "module": "auditd", + "category": "user-login" + }, + "beat": { + "name": "demo-stack-haproxy-01", + "hostname": "demo-stack-haproxy-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-haproxy-01" + }, + "user": { + "name_map": { + "uid": "root" + }, + "auid": "unset", + "uid": "0" + }, + "process": { + "exe": "/usr/sbin/sshd", + "pid": "19361" + }, + "source": { + "ip": "125.63.92.170" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "TNKYUmcBTFzn_XoL9yJk", + "source": { + "@timestamp": "2018-11-27T00:36:54.779Z", + "auditd": { + "session": "unset", + "data": { + "acct": "(invalid user)", + "terminal": "sshd", + "op": "login" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + }, + "object": { + "primary": "sshd", + "secondary": "125.63.92.170", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 142289, + "result": "fail" + }, + "beat": { + "name": "demo-stack-haproxy-01", + "hostname": "demo-stack-haproxy-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-haproxy-01" + }, + "event": { + "action": "logged-in", + "module": "auditd", + "category": "user-login", + "type": "user_login" + }, + "user": { + "name_map": { + "uid": "root" + }, + "auid": "unset", + "uid": "0" + }, + "process": { + "pid": "19361", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "125.63.92.170" + }, + "network": { + "direction": "incoming" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "TdKYUmcBTFzn_XoL9yJk", + "source": { + "@timestamp": "2018-11-27T00:36:55.043Z", + "beat": { + "hostname": "demo-stack-haproxy-01", + "version": "7.0.0-alpha1", + "name": "demo-stack-haproxy-01" + }, + "host": { + "name": "demo-stack-haproxy-01" + }, + "event": { + "type": "user_err", + "action": "error", + "module": "auditd", + "category": "user-login" + }, + "user": { + "auid": "unset", + "uid": "0", + "name_map": { + "uid": "root" + } + }, + "process": { + "pid": "19361", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "125.63.92.170" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "summary": { + "actor": { + "secondary": "root", + "primary": "unset" + }, + "object": { + "primary": "ssh", + "secondary": "125.63.92.170", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 142290, + "result": "fail", + "session": "unset", + "data": { + "op": "PAM:bad_ident", + "terminal": "ssh", + "hostname": "125.63.92.170" + } + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "8tKZUmcBTFzn_XoLZyud", + "source": { + "@timestamp": "2018-11-27T00:37:23.507Z", + "beat": { + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-redis-01" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "result": "fail", + "session": "unset", + "data": { + "acct": "(unknown user)", + "op": "login", + "terminal": "sshd" + }, + "summary": { + "actor": { + "secondary": "(unknown user)", + "primary": "unset" + }, + "object": { + "primary": "sshd", + "secondary": "180.151.228.58", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 186272 + }, + "event": { + "module": "auditd", + "category": "user-login", + "type": "user_login", + "action": "logged-in" + }, + "user": { + "uid": "0", + "auid": "unset", + "name_map": { + "uid": "root" + } + }, + "process": { + "exe": "/usr/sbin/sshd", + "pid": "31951" + }, + "source": { + "ip": "180.151.228.58" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "89KZUmcBTFzn_XoLZyud", + "source": { + "@timestamp": "2018-11-27T00:37:23.508Z", + "auditd": { + "session": "unset", + "data": { + "op": "login", + "acct": "(invalid user)", + "terminal": "sshd" + }, + "summary": { + "actor": { + "secondary": "(invalid user)", + "primary": "unset" + }, + "object": { + "secondary": "180.151.228.58", + "type": "user-session", + "primary": "sshd" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 186273, + "result": "fail" + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "pid": "31951", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "180.151.228.58" + }, + "network": { + "direction": "incoming" + }, + "beat": { + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-redis-01" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "9NKZUmcBTFzn_XoLZyud", + "source": { + "@timestamp": "2018-11-27T00:37:23.776Z", + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + }, + "process": { + "pid": "31951", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "180.151.228.58" + }, + "network": { + "direction": "incoming" + }, + "host": { + "name": "demo-stack-redis-01" + }, + "beat": { + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1" + }, + "auditd": { + "summary": { + "actor": { + "primary": "unset", + "secondary": "root" + }, + "object": { + "primary": "ssh", + "secondary": "180.151.228.58", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 186274, + "result": "fail", + "session": "unset", + "data": { + "terminal": "ssh", + "op": "PAM:bad_ident", + "hostname": "180.151.228.58" + } + }, + "event": { + "action": "error", + "module": "auditd", + "category": "user-login", + "type": "user_err" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "BtGWUmcBTFzn_XoLwfK7", + "source": { + "@timestamp": "2018-11-27T00:34:29.968Z", + "beat": { + "name": "demo-stack-nginx-01", + "hostname": "demo-stack-nginx-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-nginx-01" + }, + "event": { + "action": "logged-in", + "module": "auditd", + "category": "user-login", + "type": "user_login" + }, + "user": { + "name_map": { + "uid": "root" + }, + "auid": "unset", + "uid": "0" + }, + "process": { + "pid": "32558", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "211.24.100.205" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "data": { + "op": "login", + "terminal": "sshd", + "acct": "(unknown user)" + }, + "summary": { + "how": "/usr/sbin/sshd", + "actor": { + "secondary": "(unknown user)", + "primary": "unset" + }, + "object": { + "primary": "sshd", + "secondary": "211.24.100.205", + "type": "user-session" + } + }, + "sequence": 192440, + "result": "fail", + "session": "unset" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "B9GWUmcBTFzn_XoLwfK7", + "source": { + "@timestamp": "2018-11-27T00:34:29.969Z", + "event": { + "action": "logged-in", + "module": "auditd", + "category": "user-login", + "type": "user_login" + }, + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + }, + "beat": { + "name": "demo-stack-nginx-01", + "hostname": "demo-stack-nginx-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-nginx-01" + }, + "process": { + "pid": "32558", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "211.24.100.205" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "data": { + "terminal": "sshd", + "op": "login", + "acct": "(invalid user)" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + }, + "object": { + "secondary": "211.24.100.205", + "type": "user-session", + "primary": "sshd" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 192441, + "result": "fail", + "session": "unset" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "CNGWUmcBTFzn_XoLwfK7", + "source": { + "@timestamp": "2018-11-27T00:34:30.179Z", + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + }, + "process": { + "exe": "/usr/sbin/sshd", + "pid": "32558" + }, + "source": { + "ip": "211.24.100.205" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "result": "fail", + "session": "unset", + "data": { + "op": "PAM:bad_ident", + "terminal": "ssh", + "hostname": "211.24.100.205" + }, + "summary": { + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "root" + }, + "object": { + "primary": "ssh", + "secondary": "211.24.100.205", + "type": "user-session" + } + }, + "sequence": 192442 + }, + "event": { + "category": "user-login", + "type": "user_err", + "action": "error", + "module": "auditd" + }, + "beat": { + "name": "demo-stack-nginx-01", + "hostname": "demo-stack-nginx-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-nginx-01" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "pdKaUmcBTFzn_XoL802l", + "source": { + "@timestamp": "2018-11-27T00:39:04.878Z", + "process": { + "pid": "31959", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "46.251.239.72" + }, + "beat": { + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1", + "name": "demo-stack-redis-01" + }, + "host": { + "name": "demo-stack-redis-01" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "data": { + "terminal": "sshd", + "op": "login", + "acct": "(unknown user)" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + }, + "object": { + "type": "user-session", + "primary": "sshd", + "secondary": "46.251.239.72" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 186275, + "result": "fail", + "session": "unset" + }, + "event": { + "module": "auditd", + "category": "user-login", + "type": "user_login", + "action": "logged-in" + }, + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "ptKaUmcBTFzn_XoL802l", + "source": { + "@timestamp": "2018-11-27T00:39:04.879Z", + "host": { + "name": "demo-stack-redis-01" + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + }, + "user": { + "name_map": { + "uid": "root" + }, + "auid": "unset", + "uid": "0" + }, + "process": { + "pid": "31959", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "46.251.239.72" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "sequence": 186276, + "result": "fail", + "session": "unset", + "data": { + "terminal": "sshd", + "acct": "(invalid user)", + "op": "login" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + }, + "object": { + "primary": "sshd", + "secondary": "46.251.239.72", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + } + }, + "beat": { + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1", + "name": "demo-stack-redis-01" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "p9KaUmcBTFzn_XoL802l", + "source": { + "@timestamp": "2018-11-27T00:39:04.990Z", + "user": { + "uid": "0", + "auid": "unset", + "name_map": { + "uid": "root" + } + }, + "process": { + "pid": "31959", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "46.251.239.72" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "summary": { + "actor": { + "primary": "unset", + "secondary": "root" + }, + "object": { + "primary": "ssh", + "secondary": "46.251.239.72", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 186277, + "result": "fail", + "session": "unset", + "data": { + "terminal": "ssh", + "op": "PAM:bad_ident", + "hostname": "46.251.239.72" + } + }, + "beat": { + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-redis-01" + }, + "event": { + "module": "auditd", + "category": "user-login", + "type": "user_err", + "action": "error" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "r9KXUmcBTFzn_XoLowUZ", + "source": { + "@timestamp": "2018-11-27T00:35:27.663Z", + "source": { + "ip": "185.254.97.113" + }, + "host": { + "name": "demo-stack-redis-01" + }, + "beat": { + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1", + "name": "demo-stack-redis-01" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "data": { + "terminal": "sshd", + "op": "login", + "acct": "(unknown user)" + }, + "summary": { + "actor": { + "secondary": "(unknown user)", + "primary": "unset" + }, + "object": { + "primary": "sshd", + "secondary": "185.254.97.113", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 186266, + "result": "fail", + "session": "unset" + }, + "event": { + "action": "logged-in", + "module": "auditd", + "category": "user-login", + "type": "user_login" + }, + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + }, + "process": { + "pid": "31941", + "exe": "/usr/sbin/sshd" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "sNKXUmcBTFzn_XoLowUZ", + "source": { + "@timestamp": "2018-11-27T00:35:27.664Z", + "beat": { + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-redis-01" + }, + "source": { + "ip": "185.254.97.113" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "data": { + "op": "login", + "acct": "(invalid user)", + "terminal": "sshd" + }, + "summary": { + "actor": { + "secondary": "(invalid user)", + "primary": "unset" + }, + "object": { + "type": "user-session", + "primary": "sshd", + "secondary": "185.254.97.113" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 186267, + "result": "fail", + "session": "unset" + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "pid": "31941", + "exe": "/usr/sbin/sshd" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "sdKXUmcBTFzn_XoLowUZ", + "source": { + "@timestamp": "2018-11-27T00:35:27.773Z", + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + }, + "process": { + "pid": "31941", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "185.254.97.113" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "summary": { + "actor": { + "primary": "unset", + "secondary": "root" + }, + "object": { + "primary": "ssh", + "secondary": "185.254.97.113", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 186268, + "result": "fail", + "session": "unset", + "data": { + "op": "PAM:bad_ident", + "terminal": "ssh", + "hostname": "185.254.97.113" + } + }, + "event": { + "action": "error", + "module": "auditd", + "category": "user-login", + "type": "user_err" + }, + "beat": { + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-redis-01" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "h9GWUmcBTFzn_XoL7_UK", + "source": { + "@timestamp": "2018-11-27T00:34:41.567Z", + "process": { + "pid": "19345", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "202.84.76.146" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "result": "fail", + "session": "unset", + "data": { + "op": "login", + "terminal": "sshd", + "acct": "(unknown user)" + }, + "summary": { + "actor": { + "secondary": "(unknown user)", + "primary": "unset" + }, + "object": { + "secondary": "202.84.76.146", + "type": "user-session", + "primary": "sshd" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 142282 + }, + "beat": { + "name": "demo-stack-haproxy-01", + "hostname": "demo-stack-haproxy-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-haproxy-01" + }, + "event": { + "action": "logged-in", + "module": "auditd", + "category": "user-login", + "type": "user_login" + }, + "user": { + "name_map": { + "uid": "root" + }, + "auid": "unset", + "uid": "0" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "iNGWUmcBTFzn_XoL7_UK", + "source": { + "@timestamp": "2018-11-27T00:34:41.568Z", + "process": { + "pid": "19345", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "202.84.76.146" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "result": "fail", + "session": "unset", + "data": { + "op": "login", + "acct": "(invalid user)", + "terminal": "sshd" + }, + "summary": { + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + }, + "object": { + "secondary": "202.84.76.146", + "type": "user-session", + "primary": "sshd" + } + }, + "sequence": 142283 + }, + "beat": { + "name": "demo-stack-haproxy-01", + "hostname": "demo-stack-haproxy-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-haproxy-01" + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "idGWUmcBTFzn_XoL7_UK", + "source": { + "@timestamp": "2018-11-27T00:34:41.795Z", + "user": { + "name_map": { + "uid": "root" + }, + "auid": "unset", + "uid": "0" + }, + "beat": { + "name": "demo-stack-haproxy-01", + "hostname": "demo-stack-haproxy-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-haproxy-01" + }, + "process": { + "pid": "19345", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "202.84.76.146" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "data": { + "op": "PAM:bad_ident", + "terminal": "ssh", + "hostname": "202.84.76.146" + }, + "summary": { + "actor": { + "secondary": "root", + "primary": "unset" + }, + "object": { + "secondary": "202.84.76.146", + "type": "user-session", + "primary": "ssh" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 142284, + "result": "fail", + "session": "unset" + }, + "event": { + "action": "error", + "module": "auditd", + "category": "user-login", + "type": "user_err" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "StKaUmcBTFzn_XoL5kzE", + "source": { + "@timestamp": "2018-11-27T00:39:01.594Z", + "auditd": { + "result": "success", + "session": "unset", + "data": { + "acct": "root", + "terminal": "cron", + "op": "PAM:accounting" + }, + "summary": { + "object": { + "type": "user-session", + "primary": "cron" + }, + "how": "/usr/sbin/cron", + "actor": { + "secondary": "root", + "primary": "unset" + } + }, + "sequence": 184300 + }, + "event": { + "category": "user-login", + "type": "user_acct", + "action": "was-authorized", + "module": "auditd" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "exe": "/usr/sbin/cron", + "pid": "25011" + }, + "host": { + "name": "demo-stack-apache-01" + }, + "beat": { + "name": "demo-stack-apache-01", + "hostname": "demo-stack-apache-01", + "version": "7.0.0-alpha1" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "S9KaUmcBTFzn_XoL5kzE", + "source": { + "@timestamp": "2018-11-27T00:39:01.594Z", + "process": { + "pid": "25011", + "exe": "/usr/sbin/cron" + }, + "auditd": { + "sequence": 184301, + "result": "success", + "session": "unset", + "data": { + "terminal": "cron", + "op": "PAM:setcred", + "acct": "root" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "root" + }, + "object": { + "primary": "cron", + "type": "user-session" + }, + "how": "/usr/sbin/cron" + } + }, + "event": { + "module": "auditd", + "category": "user-login", + "type": "cred_acq", + "action": "acquired-credentials" + }, + "beat": { + "version": "7.0.0-alpha1", + "name": "demo-stack-apache-01", + "hostname": "demo-stack-apache-01" + }, + "host": { + "name": "demo-stack-apache-01" + }, + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "TNKaUmcBTFzn_XoL5kzE", + "source": { + "@timestamp": "2018-11-27T00:39:01.596Z", + "event": { + "type": "user_start", + "action": "started-session", + "module": "auditd", + "category": "user-login" + }, + "user": { + "auid": "0", + "name_map": { + "auid": "root", + "uid": "root" + }, + "uid": "0" + }, + "beat": { + "name": "demo-stack-apache-01", + "hostname": "demo-stack-apache-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-apache-01" + }, + "process": { + "pid": "25011", + "exe": "/usr/sbin/cron" + }, + "auditd": { + "result": "success", + "session": "9856", + "data": { + "acct": "root", + "op": "PAM:session_open", + "terminal": "cron" + }, + "summary": { + "actor": { + "primary": "root", + "secondary": "root" + }, + "object": { + "primary": "cron", + "type": "user-session" + }, + "how": "/usr/sbin/cron" + }, + "sequence": 184303 + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "TdKaUmcBTFzn_XoL5kzE", + "source": { + "@timestamp": "2018-11-27T00:39:01.697Z", + "auditd": { + "session": "9856", + "data": { + "acct": "root", + "terminal": "cron", + "op": "PAM:setcred" + }, + "summary": { + "how": "/usr/sbin/cron", + "actor": { + "primary": "root", + "secondary": "root" + }, + "object": { + "type": "user-session", + "primary": "cron" + } + }, + "sequence": 184304, + "result": "success" + }, + "event": { + "category": "user-login", + "type": "cred_disp", + "action": "disposed-credentials", + "module": "auditd" + }, + "user": { + "auid": "0", + "name_map": { + "auid": "root", + "uid": "root" + }, + "uid": "0" + }, + "process": { + "pid": "25011", + "exe": "/usr/sbin/cron" + }, + "beat": { + "name": "demo-stack-apache-01", + "hostname": "demo-stack-apache-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-apache-01" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "TtKaUmcBTFzn_XoL5kzE", + "source": { + "@timestamp": "2018-11-27T00:39:01.698Z", + "host": { + "name": "demo-stack-apache-01" + }, + "beat": { + "name": "demo-stack-apache-01", + "hostname": "demo-stack-apache-01", + "version": "7.0.0-alpha1" + }, + "event": { + "category": "user-login", + "type": "user_end", + "action": "ended-session", + "module": "auditd" + }, + "user": { + "auid": "0", + "name_map": { + "auid": "root", + "uid": "root" + }, + "uid": "0" + }, + "process": { + "pid": "25011", + "exe": "/usr/sbin/cron" + }, + "auditd": { + "data": { + "terminal": "cron", + "op": "PAM:session_close", + "acct": "root" + }, + "summary": { + "how": "/usr/sbin/cron", + "actor": { + "primary": "root", + "secondary": "root" + }, + "object": { + "primary": "cron", + "type": "user-session" + } + }, + "sequence": 184305, + "result": "success", + "session": "9856" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "V9KaUmcBTFzn_XoL50x5", + "source": { + "@timestamp": "2018-11-27T00:39:01.774Z", + "auditd": { + "data": { + "acct": "root", + "terminal": "cron", + "op": "PAM:accounting" + }, + "summary": { + "object": { + "primary": "cron", + "type": "user-session" + }, + "how": "/usr/sbin/cron", + "actor": { + "primary": "unset", + "secondary": "root" + } + }, + "sequence": 192443, + "result": "success", + "session": "unset" + }, + "event": { + "type": "user_acct", + "action": "was-authorized", + "module": "auditd", + "category": "user-login" + }, + "user": { + "name_map": { + "uid": "root" + }, + "uid": "0", + "auid": "unset" + }, + "process": { + "pid": "32579", + "exe": "/usr/sbin/cron" + }, + "beat": { + "name": "demo-stack-nginx-01", + "hostname": "demo-stack-nginx-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-nginx-01" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "WNKaUmcBTFzn_XoL50x5", + "source": { + "@timestamp": "2018-11-27T00:39:01.774Z", + "event": { + "module": "auditd", + "category": "user-login", + "type": "cred_acq", + "action": "acquired-credentials" + }, + "user": { + "uid": "0", + "auid": "unset", + "name_map": { + "uid": "root" + } + }, + "process": { + "exe": "/usr/sbin/cron", + "pid": "32579" + }, + "auditd": { + "sequence": 192444, + "result": "success", + "session": "unset", + "data": { + "op": "PAM:setcred", + "acct": "root", + "terminal": "cron" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "root" + }, + "object": { + "primary": "cron", + "type": "user-session" + }, + "how": "/usr/sbin/cron" + } + }, + "beat": { + "name": "demo-stack-nginx-01", + "hostname": "demo-stack-nginx-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-nginx-01" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "WdKaUmcBTFzn_XoL50x5", + "source": { + "@timestamp": "2018-11-27T00:39:01.776Z", + "process": { + "pid": "32579", + "exe": "/usr/sbin/cron" + }, + "auditd": { + "session": "9860", + "data": { + "terminal": "cron", + "acct": "root", + "op": "PAM:session_open" + }, + "summary": { + "actor": { + "primary": "root", + "secondary": "root" + }, + "object": { + "type": "user-session", + "primary": "cron" + }, + "how": "/usr/sbin/cron" + }, + "sequence": 192446, + "result": "success" + }, + "beat": { + "name": "demo-stack-nginx-01", + "hostname": "demo-stack-nginx-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-nginx-01" + }, + "event": { + "category": "user-login", + "type": "user_start", + "action": "started-session", + "module": "auditd" + }, + "user": { + "name_map": { + "auid": "root", + "uid": "root" + }, + "auid": "0", + "uid": "0" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "WtKaUmcBTFzn_XoL50x5", + "source": { + "@timestamp": "2018-11-27T00:39:01.873Z", + "host": { + "name": "demo-stack-nginx-01" + }, + "auditd": { + "summary": { + "how": "/usr/sbin/cron", + "actor": { + "primary": "root", + "secondary": "root" + }, + "object": { + "primary": "cron", + "type": "user-session" + } + }, + "sequence": 192447, + "result": "success", + "session": "9860", + "data": { + "op": "PAM:setcred", + "acct": "root", + "terminal": "cron" + } + }, + "event": { + "action": "disposed-credentials", + "module": "auditd", + "category": "user-login", + "type": "cred_disp" + }, + "user": { + "auid": "0", + "name_map": { + "auid": "root", + "uid": "root" + }, + "uid": "0" + }, + "process": { + "pid": "32579", + "exe": "/usr/sbin/cron" + }, + "beat": { + "name": "demo-stack-nginx-01", + "hostname": "demo-stack-nginx-01", + "version": "7.0.0-alpha1" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "W9KaUmcBTFzn_XoL50x5", + "source": { + "@timestamp": "2018-11-27T00:39:01.874Z", + "user": { + "uid": "0", + "name_map": { + "auid": "root", + "uid": "root" + }, + "auid": "0" + }, + "process": { + "pid": "32579", + "exe": "/usr/sbin/cron" + }, + "auditd": { + "data": { + "terminal": "cron", + "op": "PAM:session_close", + "acct": "root" + }, + "summary": { + "actor": { + "primary": "root", + "secondary": "root" + }, + "object": { + "type": "user-session", + "primary": "cron" + }, + "how": "/usr/sbin/cron" + }, + "sequence": 192448, + "result": "success", + "session": "9860" + }, + "beat": { + "version": "7.0.0-alpha1", + "name": "demo-stack-nginx-01", + "hostname": "demo-stack-nginx-01" + }, + "host": { + "name": "demo-stack-nginx-01" + }, + "event": { + "category": "user-login", + "type": "user_end", + "action": "ended-session", + "module": "auditd" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "W9KbUmcBTFzn_XoLP1QB", + "source": { + "@timestamp": "2018-11-27T00:39:24.137Z", + "beat": { + "name": "demo-stack-es-01", + "hostname": "demo-stack-es-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-es-01" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "session": "unset", + "data": { + "terminal": "sshd", + "op": "login", + "acct": "(unknown user)" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + }, + "object": { + "primary": "sshd", + "secondary": "138.68.111.27", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 44121, + "result": "fail" + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + }, + "user": { + "name_map": { + "uid": "root" + }, + "uid": "0", + "auid": "unset" + }, + "process": { + "pid": "28526", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "138.68.111.27" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "XNKbUmcBTFzn_XoLP1QB", + "source": { + "@timestamp": "2018-11-27T00:39:24.137Z", + "source": { + "ip": "138.68.111.27" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "data": { + "terminal": "sshd", + "op": "login", + "acct": "(invalid user)" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + }, + "object": { + "secondary": "138.68.111.27", + "type": "user-session", + "primary": "sshd" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 44122, + "result": "fail", + "session": "unset" + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "pid": "28526", + "exe": "/usr/sbin/sshd" + }, + "beat": { + "name": "demo-stack-es-01", + "hostname": "demo-stack-es-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-es-01" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "XdKbUmcBTFzn_XoLP1QB", + "source": { + "@timestamp": "2018-11-27T00:39:24.241Z", + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "pid": "28526", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "138.68.111.27" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "result": "fail", + "session": "unset", + "data": { + "op": "PAM:bad_ident", + "terminal": "ssh", + "hostname": "138.68.111.27" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "root" + }, + "object": { + "primary": "ssh", + "secondary": "138.68.111.27", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 44123 + }, + "event": { + "category": "user-login", + "type": "user_err", + "action": "error", + "module": "auditd" + }, + "beat": { + "name": "demo-stack-es-01", + "hostname": "demo-stack-es-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-es-01" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "CNKiUmcBTFzn_XoLvfm3", + "source": { + "@timestamp": "2018-11-27T00:47:35.372Z", + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + }, + "process": { + "pid": "19424", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "137.74.114.109" + }, + "network": { + "direction": "incoming" + }, + "beat": { + "name": "demo-stack-haproxy-01", + "hostname": "demo-stack-haproxy-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-haproxy-01" + }, + "auditd": { + "sequence": 142300, + "result": "fail", + "session": "unset", + "data": { + "op": "login", + "terminal": "sshd", + "acct": "(unknown user)" + }, + "summary": { + "object": { + "primary": "sshd", + "secondary": "137.74.114.109", + "type": "user-session" + }, + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + } + } + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "CdKiUmcBTFzn_XoLvfm3", + "source": { + "@timestamp": "2018-11-27T00:47:35.374Z", + "host": { + "name": "demo-stack-haproxy-01" + }, + "beat": { + "name": "demo-stack-haproxy-01", + "hostname": "demo-stack-haproxy-01", + "version": "7.0.0-alpha1" + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "exe": "/usr/sbin/sshd", + "pid": "19424" + }, + "source": { + "ip": "137.74.114.109" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "summary": { + "object": { + "secondary": "137.74.114.109", + "type": "user-session", + "primary": "sshd" + }, + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + } + }, + "sequence": 142301, + "result": "fail", + "session": "unset", + "data": { + "terminal": "sshd", + "op": "login", + "acct": "(invalid user)" + } + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "CtKiUmcBTFzn_XoLvfm3", + "source": { + "@timestamp": "2018-11-27T00:47:35.480Z", + "event": { + "category": "user-login", + "type": "user_err", + "action": "error", + "module": "auditd" + }, + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + }, + "process": { + "exe": "/usr/sbin/sshd", + "pid": "19424" + }, + "beat": { + "name": "demo-stack-haproxy-01", + "hostname": "demo-stack-haproxy-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-haproxy-01" + }, + "source": { + "ip": "137.74.114.109" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "summary": { + "actor": { + "primary": "unset", + "secondary": "root" + }, + "object": { + "type": "user-session", + "primary": "ssh", + "secondary": "137.74.114.109" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 142302, + "result": "fail", + "session": "unset", + "data": { + "hostname": "137.74.114.109", + "op": "PAM:bad_ident", + "terminal": "ssh" + } + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "qdOkUmcBTFzn_XoLDBVT", + "source": { + "@timestamp": "2018-11-27T00:49:01.033Z", + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "pid": "25113", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "121.67.246.139" + }, + "beat": { + "name": "demo-stack-apache-01", + "hostname": "demo-stack-apache-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-apache-01" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "session": "unset", + "data": { + "op": "login", + "acct": "(unknown user)", + "terminal": "sshd" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + }, + "object": { + "primary": "sshd", + "secondary": "121.67.246.139", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 184309, + "result": "fail" + }, + "event": { + "action": "logged-in", + "module": "auditd", + "category": "user-login", + "type": "user_login" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "qtOkUmcBTFzn_XoLDBVT", + "source": { + "@timestamp": "2018-11-27T00:49:01.034Z", + "network": { + "direction": "incoming" + }, + "auditd": { + "sequence": 184310, + "result": "fail", + "session": "unset", + "data": { + "terminal": "sshd", + "op": "login", + "acct": "(invalid user)" + }, + "summary": { + "how": "/usr/sbin/sshd", + "actor": { + "secondary": "(invalid user)", + "primary": "unset" + }, + "object": { + "primary": "sshd", + "secondary": "121.67.246.139", + "type": "user-session" + } + } + }, + "event": { + "module": "auditd", + "category": "user-login", + "type": "user_login", + "action": "logged-in" + }, + "user": { + "name_map": { + "uid": "root" + }, + "uid": "0", + "auid": "unset" + }, + "process": { + "pid": "25113", + "exe": "/usr/sbin/sshd" + }, + "beat": { + "name": "demo-stack-apache-01", + "hostname": "demo-stack-apache-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-apache-01" + }, + "source": { + "ip": "121.67.246.139" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "q9OkUmcBTFzn_XoLDBVT", + "source": { + "@timestamp": "2018-11-27T00:49:01.224Z", + "auditd": { + "data": { + "hostname": "121.67.246.139", + "terminal": "ssh", + "op": "PAM:bad_ident" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "root" + }, + "object": { + "secondary": "121.67.246.139", + "type": "user-session", + "primary": "ssh" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 184311, + "result": "fail", + "session": "unset" + }, + "beat": { + "hostname": "demo-stack-apache-01", + "version": "7.0.0-alpha1", + "name": "demo-stack-apache-01" + }, + "host": { + "name": "demo-stack-apache-01" + }, + "event": { + "action": "error", + "module": "auditd", + "category": "user-login", + "type": "user_err" + }, + "user": { + "name_map": { + "uid": "root" + }, + "auid": "unset", + "uid": "0" + }, + "process": { + "pid": "25113", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "121.67.246.139" + }, + "network": { + "direction": "incoming" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "qNOkUmcBTFzn_XoLgx_7", + "source": { + "@timestamp": "2018-11-27T00:49:31.664Z", + "user": { + "name_map": { + "uid": "root" + }, + "uid": "0", + "auid": "unset" + }, + "process": { + "pid": "25115", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "179.228.242.120" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "session": "unset", + "data": { + "op": "login", + "terminal": "sshd", + "acct": "(unknown user)" + }, + "summary": { + "actor": { + "secondary": "(unknown user)", + "primary": "unset" + }, + "object": { + "primary": "sshd", + "secondary": "179.228.242.120", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 184312, + "result": "fail" + }, + "beat": { + "name": "demo-stack-apache-01", + "hostname": "demo-stack-apache-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-apache-01" + }, + "event": { + "type": "user_login", + "action": "logged-in", + "module": "auditd", + "category": "user-login" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "qdOkUmcBTFzn_XoLgx_7", + "source": { + "@timestamp": "2018-11-27T00:49:31.665Z", + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + }, + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + }, + "process": { + "pid": "25115", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "179.228.242.120" + }, + "network": { + "direction": "incoming" + }, + "beat": { + "name": "demo-stack-apache-01", + "hostname": "demo-stack-apache-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-apache-01" + }, + "auditd": { + "data": { + "op": "login", + "terminal": "sshd", + "acct": "(invalid user)" + }, + "summary": { + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + }, + "object": { + "primary": "sshd", + "secondary": "179.228.242.120", + "type": "user-session" + } + }, + "sequence": 184313, + "result": "fail", + "session": "unset" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "qtOkUmcBTFzn_XoLgx_7", + "source": { + "@timestamp": "2018-11-27T00:49:31.831Z", + "beat": { + "version": "7.0.0-alpha1", + "name": "demo-stack-apache-01", + "hostname": "demo-stack-apache-01" + }, + "host": { + "name": "demo-stack-apache-01" + }, + "event": { + "category": "user-login", + "type": "user_err", + "action": "error", + "module": "auditd" + }, + "user": { + "uid": "0", + "auid": "unset", + "name_map": { + "uid": "root" + } + }, + "process": { + "pid": "25115", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "179.228.242.120" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "summary": { + "actor": { + "primary": "unset", + "secondary": "root" + }, + "object": { + "primary": "ssh", + "secondary": "179.228.242.120", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 184314, + "result": "fail", + "session": "unset", + "data": { + "terminal": "ssh", + "op": "PAM:bad_ident", + "hostname": "179.228.242.120" + } + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "BtKiUmcBTFzn_XoL-P7X", + "source": { + "@timestamp": "2018-11-27T00:47:50.509Z", + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + }, + "user": { + "uid": "0", + "auid": "unset", + "name_map": { + "uid": "root" + } + }, + "process": { + "pid": "19431", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "39.110.219.91" + }, + "network": { + "direction": "incoming" + }, + "beat": { + "hostname": "demo-stack-haproxy-01", + "version": "7.0.0-alpha1", + "name": "demo-stack-haproxy-01" + }, + "host": { + "name": "demo-stack-haproxy-01" + }, + "auditd": { + "summary": { + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + }, + "object": { + "primary": "sshd", + "secondary": "39.110.219.91", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 142303, + "result": "fail", + "session": "unset", + "data": { + "acct": "(unknown user)", + "terminal": "sshd", + "op": "login" + } + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "B9KiUmcBTFzn_XoL-P7X", + "source": { + "@timestamp": "2018-11-27T00:47:50.511Z", + "source": { + "ip": "39.110.219.91" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "sequence": 142304, + "result": "fail", + "session": "unset", + "data": { + "op": "login", + "terminal": "sshd", + "acct": "(invalid user)" + }, + "summary": { + "how": "/usr/sbin/sshd", + "actor": { + "secondary": "(invalid user)", + "primary": "unset" + }, + "object": { + "primary": "sshd", + "secondary": "39.110.219.91", + "type": "user-session" + } + } + }, + "beat": { + "name": "demo-stack-haproxy-01", + "hostname": "demo-stack-haproxy-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-haproxy-01" + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + }, + "user": { + "auid": "unset", + "uid": "0", + "name_map": { + "uid": "root" + } + }, + "process": { + "pid": "19431", + "exe": "/usr/sbin/sshd" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "CNKiUmcBTFzn_XoL-P7X", + "source": { + "@timestamp": "2018-11-27T00:47:50.642Z", + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + }, + "process": { + "pid": "19431", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "39.110.219.91" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "summary": { + "how": "/usr/sbin/sshd", + "actor": { + "secondary": "root", + "primary": "unset" + }, + "object": { + "primary": "ssh", + "secondary": "39.110.219.91", + "type": "user-session" + } + }, + "sequence": 142305, + "result": "fail", + "session": "unset", + "data": { + "terminal": "ssh", + "op": "PAM:bad_ident", + "hostname": "39.110.219.91" + } + }, + "beat": { + "name": "demo-stack-haproxy-01", + "hostname": "demo-stack-haproxy-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-haproxy-01" + }, + "event": { + "category": "user-login", + "type": "user_err", + "action": "error", + "module": "auditd" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "X9OkUmcBTFzn_XoLABX7", + "source": { + "@timestamp": "2018-11-27T00:48:58.129Z", + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + }, + "process": { + "pid": "19439", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "41.89.47.14" + }, + "beat": { + "name": "demo-stack-haproxy-01", + "hostname": "demo-stack-haproxy-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-haproxy-01" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "sequence": 142306, + "result": "fail", + "session": "unset", + "data": { + "terminal": "sshd", + "acct": "(unknown user)", + "op": "login" + }, + "summary": { + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + }, + "object": { + "primary": "sshd", + "secondary": "41.89.47.14", + "type": "user-session" + } + } + }, + "event": { + "type": "user_login", + "action": "logged-in", + "module": "auditd", + "category": "user-login" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "YNOkUmcBTFzn_XoLABX7", + "source": { + "@timestamp": "2018-11-27T00:48:58.130Z", + "network": { + "direction": "incoming" + }, + "auditd": { + "data": { + "acct": "(invalid user)", + "op": "login", + "terminal": "sshd" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + }, + "object": { + "primary": "sshd", + "secondary": "41.89.47.14", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 142307, + "result": "fail", + "session": "unset" + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + }, + "beat": { + "hostname": "demo-stack-haproxy-01", + "version": "7.0.0-alpha1", + "name": "demo-stack-haproxy-01" + }, + "host": { + "name": "demo-stack-haproxy-01" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "pid": "19439", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "41.89.47.14" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "YdOkUmcBTFzn_XoLABX7", + "source": { + "@timestamp": "2018-11-27T00:48:58.365Z", + "auditd": { + "result": "fail", + "session": "unset", + "data": { + "hostname": "41.89.47.14", + "op": "PAM:bad_ident", + "terminal": "ssh" + }, + "summary": { + "object": { + "secondary": "41.89.47.14", + "type": "user-session", + "primary": "ssh" + }, + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "root" + } + }, + "sequence": 142308 + }, + "beat": { + "name": "demo-stack-haproxy-01", + "hostname": "demo-stack-haproxy-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-haproxy-01" + }, + "event": { + "category": "user-login", + "type": "user_err", + "action": "error", + "module": "auditd" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "pid": "19439", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "41.89.47.14" + }, + "network": { + "direction": "incoming" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "gNOkUmcBTFzn_XoL8ilB", + "source": { + "@timestamp": "2018-11-27T00:49:59.894Z", + "process": { + "pid": "32019", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "105.16.153.210" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "result": "fail", + "session": "unset", + "data": { + "op": "login", + "acct": "(unknown user)", + "terminal": "sshd" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + }, + "object": { + "secondary": "105.16.153.210", + "type": "user-session", + "primary": "sshd" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 186284 + }, + "beat": { + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-redis-01" + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "gdOkUmcBTFzn_XoL8ilB", + "source": { + "@timestamp": "2018-11-27T00:49:59.895Z", + "host": { + "name": "demo-stack-redis-01" + }, + "process": { + "pid": "32019", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "105.16.153.210" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "session": "unset", + "data": { + "op": "login", + "terminal": "sshd", + "acct": "(invalid user)" + }, + "summary": { + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + }, + "object": { + "primary": "sshd", + "secondary": "105.16.153.210", + "type": "user-session" + } + }, + "sequence": 186285, + "result": "fail" + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "beat": { + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "gtOkUmcBTFzn_XoL8ilB", + "source": { + "@timestamp": "2018-11-27T00:50:00.158Z", + "event": { + "module": "auditd", + "category": "user-login", + "type": "user_err", + "action": "error" + }, + "user": { + "uid": "0", + "auid": "unset", + "name_map": { + "uid": "root" + } + }, + "process": { + "pid": "32019", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "105.16.153.210" + }, + "host": { + "name": "demo-stack-redis-01" + }, + "beat": { + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "sequence": 186286, + "result": "fail", + "session": "unset", + "data": { + "op": "PAM:bad_ident", + "hostname": "105.16.153.210", + "terminal": "ssh" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "root" + }, + "object": { + "type": "user-session", + "primary": "ssh", + "secondary": "105.16.153.210" + }, + "how": "/usr/sbin/sshd" + } + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "FdOlUmcBTFzn_XoLkjc2", + "source": { + "@timestamp": "2018-11-27T00:50:40.838Z", + "source": { + "ip": "188.166.243.150" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "sequence": 44130, + "result": "fail", + "session": "unset", + "data": { + "terminal": "sshd", + "acct": "(unknown user)", + "op": "login" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + }, + "object": { + "secondary": "188.166.243.150", + "type": "user-session", + "primary": "sshd" + }, + "how": "/usr/sbin/sshd" + } + }, + "beat": { + "name": "demo-stack-es-01", + "hostname": "demo-stack-es-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-es-01" + }, + "event": { + "action": "logged-in", + "module": "auditd", + "category": "user-login", + "type": "user_login" + }, + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + }, + "process": { + "pid": "28746", + "exe": "/usr/sbin/sshd" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "FtOlUmcBTFzn_XoLkjc2", + "source": { + "@timestamp": "2018-11-27T00:50:40.842Z", + "source": { + "ip": "188.166.243.150" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "result": "fail", + "session": "unset", + "data": { + "op": "login", + "acct": "(invalid user)", + "terminal": "sshd" + }, + "summary": { + "object": { + "primary": "sshd", + "secondary": "188.166.243.150", + "type": "user-session" + }, + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + } + }, + "sequence": 44131 + }, + "event": { + "type": "user_login", + "action": "logged-in", + "module": "auditd", + "category": "user-login" + }, + "user": { + "name_map": { + "uid": "root" + }, + "auid": "unset", + "uid": "0" + }, + "beat": { + "name": "demo-stack-es-01", + "hostname": "demo-stack-es-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-es-01" + }, + "process": { + "exe": "/usr/sbin/sshd", + "pid": "28746" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "F9OlUmcBTFzn_XoLkjc2", + "source": { + "@timestamp": "2018-11-27T00:50:41.034Z", + "network": { + "direction": "incoming" + }, + "beat": { + "hostname": "demo-stack-es-01", + "version": "7.0.0-alpha1", + "name": "demo-stack-es-01" + }, + "host": { + "name": "demo-stack-es-01" + }, + "auditd": { + "session": "unset", + "data": { + "terminal": "ssh", + "hostname": "188.166.243.150", + "op": "PAM:bad_ident" + }, + "summary": { + "object": { + "type": "user-session", + "primary": "ssh", + "secondary": "188.166.243.150" + }, + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "root" + } + }, + "sequence": 44132, + "result": "fail" + }, + "event": { + "type": "user_err", + "action": "error", + "module": "auditd", + "category": "user-login" + }, + "user": { + "name_map": { + "uid": "root" + }, + "auid": "unset", + "uid": "0" + }, + "process": { + "pid": "28746", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "188.166.243.150" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "JdOmUmcBTFzn_XoLCEHk", + "source": { + "@timestamp": "2018-11-27T00:51:11.223Z", + "network": { + "direction": "incoming" + }, + "auditd": { + "sequence": 43140, + "result": "fail", + "session": "unset", + "data": { + "terminal": "sshd", + "op": "login", + "acct": "(unknown user)" + }, + "summary": { + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + }, + "object": { + "type": "user-session", + "primary": "sshd", + "secondary": "194.35.114.10" + } + } + }, + "beat": { + "version": "7.0.0-alpha1", + "name": "demo-stack-mysql-01", + "hostname": "demo-stack-mysql-01" + }, + "host": { + "name": "demo-stack-mysql-01" + }, + "event": { + "action": "logged-in", + "module": "auditd", + "category": "user-login", + "type": "user_login" + }, + "user": { + "auid": "unset", + "uid": "0", + "name_map": { + "uid": "root" + } + }, + "process": { + "pid": "12495", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "194.35.114.10" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "JtOmUmcBTFzn_XoLCEHk", + "source": { + "@timestamp": "2018-11-27T00:51:11.223Z", + "process": { + "exe": "/usr/sbin/sshd", + "pid": "12495" + }, + "source": { + "ip": "194.35.114.10" + }, + "network": { + "direction": "incoming" + }, + "host": { + "name": "demo-stack-mysql-01" + }, + "beat": { + "name": "demo-stack-mysql-01", + "hostname": "demo-stack-mysql-01", + "version": "7.0.0-alpha1" + }, + "auditd": { + "data": { + "op": "login", + "terminal": "sshd", + "acct": "(invalid user)" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + }, + "object": { + "type": "user-session", + "primary": "sshd", + "secondary": "194.35.114.10" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 43141, + "result": "fail", + "session": "unset" + }, + "event": { + "module": "auditd", + "category": "user-login", + "type": "user_login", + "action": "logged-in" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "J9OmUmcBTFzn_XoLCEHk", + "source": { + "@timestamp": "2018-11-27T00:51:11.503Z", + "beat": { + "name": "demo-stack-mysql-01", + "hostname": "demo-stack-mysql-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-mysql-01" + }, + "process": { + "exe": "/usr/sbin/sshd", + "pid": "12495" + }, + "source": { + "ip": "194.35.114.10" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "result": "fail", + "session": "unset", + "data": { + "hostname": "194.35.114.10", + "terminal": "ssh", + "op": "PAM:bad_ident" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "root" + }, + "object": { + "primary": "ssh", + "secondary": "194.35.114.10", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 43142 + }, + "event": { + "action": "error", + "module": "auditd", + "category": "user-login", + "type": "user_err" + }, + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "0dOlUmcBTFzn_XoLvzre", + "source": { + "@timestamp": "2018-11-27T00:50:52.531Z", + "auditd": { + "session": "unset", + "data": { + "terminal": "sshd", + "op": "login", + "acct": "(unknown user)" + }, + "summary": { + "actor": { + "secondary": "(unknown user)", + "primary": "unset" + }, + "object": { + "primary": "sshd", + "secondary": "104.131.178.223", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 44133, + "result": "fail" + }, + "beat": { + "name": "demo-stack-es-01", + "hostname": "demo-stack-es-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-es-01" + }, + "event": { + "module": "auditd", + "category": "user-login", + "type": "user_login", + "action": "logged-in" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "pid": "28750", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "104.131.178.223" + }, + "network": { + "direction": "incoming" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "0tOlUmcBTFzn_XoLvzre", + "source": { + "@timestamp": "2018-11-27T00:50:52.531Z", + "auditd": { + "session": "unset", + "data": { + "terminal": "sshd", + "acct": "(invalid user)", + "op": "login" + }, + "summary": { + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + }, + "object": { + "secondary": "104.131.178.223", + "type": "user-session", + "primary": "sshd" + } + }, + "sequence": 44134, + "result": "fail" + }, + "beat": { + "name": "demo-stack-es-01", + "hostname": "demo-stack-es-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-es-01" + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + }, + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + }, + "process": { + "exe": "/usr/sbin/sshd", + "pid": "28750" + }, + "source": { + "ip": "104.131.178.223" + }, + "network": { + "direction": "incoming" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "09OlUmcBTFzn_XoLvzre", + "source": { + "@timestamp": "2018-11-27T00:50:52.559Z", + "beat": { + "name": "demo-stack-es-01", + "hostname": "demo-stack-es-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-es-01" + }, + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + }, + "process": { + "pid": "28750", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "104.131.178.223" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "result": "fail", + "session": "unset", + "data": { + "terminal": "ssh", + "op": "PAM:bad_ident", + "hostname": "104.131.178.223" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "root" + }, + "object": { + "primary": "ssh", + "secondary": "104.131.178.223", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 44135 + }, + "event": { + "type": "user_err", + "action": "error", + "module": "auditd", + "category": "user-login" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "7NSvUmcBTFzn_XoL9Rog", + "source": { + "@timestamp": "2018-11-27T01:02:01.525Z", + "event": { + "module": "auditd", + "category": "user-login", + "type": "user_login", + "action": "logged-in" + }, + "user": { + "auid": "unset", + "uid": "0", + "name_map": { + "uid": "root" + } + }, + "process": { + "pid": "25194", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "211.219.52.136" + }, + "beat": { + "name": "demo-stack-apache-01", + "hostname": "demo-stack-apache-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-apache-01" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "summary": { + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + }, + "object": { + "type": "user-session", + "primary": "sshd", + "secondary": "211.219.52.136" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 184321, + "result": "fail", + "session": "unset", + "data": { + "acct": "(unknown user)", + "op": "login", + "terminal": "sshd" + } + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "7dSvUmcBTFzn_XoL9Rog", + "source": { + "@timestamp": "2018-11-27T01:02:01.526Z", + "auditd": { + "sequence": 184322, + "result": "fail", + "session": "unset", + "data": { + "acct": "(invalid user)", + "terminal": "sshd", + "op": "login" + }, + "summary": { + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + }, + "object": { + "primary": "sshd", + "secondary": "211.219.52.136", + "type": "user-session" + } + } + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "pid": "25194", + "exe": "/usr/sbin/sshd" + }, + "beat": { + "hostname": "demo-stack-apache-01", + "version": "7.0.0-alpha1", + "name": "demo-stack-apache-01" + }, + "host": { + "name": "demo-stack-apache-01" + }, + "source": { + "ip": "211.219.52.136" + }, + "network": { + "direction": "incoming" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "7tSvUmcBTFzn_XoL9Rog", + "source": { + "@timestamp": "2018-11-27T01:02:01.686Z", + "event": { + "category": "user-login", + "type": "user_err", + "action": "error", + "module": "auditd" + }, + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + }, + "process": { + "pid": "25194", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "211.219.52.136" + }, + "network": { + "direction": "incoming" + }, + "beat": { + "version": "7.0.0-alpha1", + "name": "demo-stack-apache-01", + "hostname": "demo-stack-apache-01" + }, + "host": { + "name": "demo-stack-apache-01" + }, + "auditd": { + "summary": { + "actor": { + "primary": "unset", + "secondary": "root" + }, + "object": { + "primary": "ssh", + "secondary": "211.219.52.136", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 184323, + "result": "fail", + "session": "unset", + "data": { + "terminal": "ssh", + "op": "PAM:bad_ident", + "hostname": "211.219.52.136" + } + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "btOsUmcBTFzn_XoLdc7t", + "source": { + "@timestamp": "2018-11-27T00:58:12.354Z", + "beat": { + "name": "demo-stack-haproxy-01", + "hostname": "demo-stack-haproxy-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-haproxy-01" + }, + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + }, + "process": { + "pid": "19491", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "91.234.241.55" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "data": { + "acct": "(unknown user)", + "op": "login", + "terminal": "sshd" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + }, + "object": { + "secondary": "91.234.241.55", + "type": "user-session", + "primary": "sshd" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 142312, + "result": "fail", + "session": "unset" + }, + "event": { + "type": "user_login", + "action": "logged-in", + "module": "auditd", + "category": "user-login" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "b9OsUmcBTFzn_XoLdc7t", + "source": { + "@timestamp": "2018-11-27T00:58:12.355Z", + "event": { + "action": "logged-in", + "module": "auditd", + "category": "user-login", + "type": "user_login" + }, + "user": { + "uid": "0", + "auid": "unset", + "name_map": { + "uid": "root" + } + }, + "process": { + "exe": "/usr/sbin/sshd", + "pid": "19491" + }, + "source": { + "ip": "91.234.241.55" + }, + "network": { + "direction": "incoming" + }, + "beat": { + "name": "demo-stack-haproxy-01", + "hostname": "demo-stack-haproxy-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-haproxy-01" + }, + "auditd": { + "data": { + "terminal": "sshd", + "acct": "(invalid user)", + "op": "login" + }, + "summary": { + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + }, + "object": { + "secondary": "91.234.241.55", + "type": "user-session", + "primary": "sshd" + } + }, + "sequence": 142313, + "result": "fail", + "session": "unset" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "cNOsUmcBTFzn_XoLdc7t", + "source": { + "@timestamp": "2018-11-27T00:58:12.497Z", + "source": { + "ip": "91.234.241.55" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "summary": { + "object": { + "primary": "ssh", + "secondary": "91.234.241.55", + "type": "user-session" + }, + "how": "/usr/sbin/sshd", + "actor": { + "secondary": "root", + "primary": "unset" + } + }, + "sequence": 142314, + "result": "fail", + "session": "unset", + "data": { + "terminal": "ssh", + "op": "PAM:bad_ident", + "hostname": "91.234.241.55" + } + }, + "beat": { + "name": "demo-stack-haproxy-01", + "hostname": "demo-stack-haproxy-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-haproxy-01" + }, + "event": { + "action": "error", + "module": "auditd", + "category": "user-login", + "type": "user_err" + }, + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + }, + "process": { + "exe": "/usr/sbin/sshd", + "pid": "19491" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "VtOsUmcBTFzn_XoLGcfx", + "source": { + "@timestamp": "2018-11-27T00:57:48.807Z", + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "pid": "19483", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "128.0.121.168" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "sequence": 142309, + "result": "fail", + "session": "unset", + "data": { + "op": "login", + "terminal": "sshd", + "acct": "(unknown user)" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + }, + "object": { + "primary": "sshd", + "secondary": "128.0.121.168", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + } + }, + "beat": { + "version": "7.0.0-alpha1", + "name": "demo-stack-haproxy-01", + "hostname": "demo-stack-haproxy-01" + }, + "host": { + "name": "demo-stack-haproxy-01" + }, + "event": { + "module": "auditd", + "category": "user-login", + "type": "user_login", + "action": "logged-in" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "V9OsUmcBTFzn_XoLGcfx", + "source": { + "@timestamp": "2018-11-27T00:57:48.808Z", + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + }, + "user": { + "auid": "unset", + "uid": "0", + "name_map": { + "uid": "root" + } + }, + "process": { + "pid": "19483", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "128.0.121.168" + }, + "beat": { + "name": "demo-stack-haproxy-01", + "hostname": "demo-stack-haproxy-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-haproxy-01" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "result": "fail", + "session": "unset", + "data": { + "acct": "(invalid user)", + "terminal": "sshd", + "op": "login" + }, + "summary": { + "object": { + "primary": "sshd", + "secondary": "128.0.121.168", + "type": "user-session" + }, + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + } + }, + "sequence": 142310 + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "WNOsUmcBTFzn_XoLGcfx", + "source": { + "@timestamp": "2018-11-27T00:57:48.917Z", + "event": { + "action": "error", + "module": "auditd", + "category": "user-login", + "type": "user_err" + }, + "user": { + "name_map": { + "uid": "root" + }, + "uid": "0", + "auid": "unset" + }, + "process": { + "pid": "19483", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "128.0.121.168" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "sequence": 142311, + "result": "fail", + "session": "unset", + "data": { + "hostname": "128.0.121.168", + "op": "PAM:bad_ident", + "terminal": "ssh" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "root" + }, + "object": { + "primary": "ssh", + "secondary": "128.0.121.168", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + } + }, + "beat": { + "version": "7.0.0-alpha1", + "name": "demo-stack-haproxy-01", + "hostname": "demo-stack-haproxy-01" + }, + "host": { + "name": "demo-stack-haproxy-01" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "p9SvUmcBTFzn_XoLTQyw", + "source": { + "@timestamp": "2018-11-27T01:01:18.662Z", + "network": { + "direction": "incoming" + }, + "auditd": { + "data": { + "op": "login", + "acct": "(unknown user)", + "terminal": "sshd" + }, + "summary": { + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + }, + "object": { + "primary": "sshd", + "secondary": "220.135.55.172", + "type": "user-session" + } + }, + "sequence": 192458, + "result": "fail", + "session": "unset" + }, + "beat": { + "name": "demo-stack-nginx-01", + "hostname": "demo-stack-nginx-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-nginx-01" + }, + "event": { + "module": "auditd", + "category": "user-login", + "type": "user_login", + "action": "logged-in" + }, + "user": { + "name_map": { + "uid": "root" + }, + "auid": "unset", + "uid": "0" + }, + "process": { + "pid": "32763", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "220.135.55.172" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "qNSvUmcBTFzn_XoLTQyw", + "source": { + "@timestamp": "2018-11-27T01:01:18.663Z", + "auditd": { + "session": "unset", + "data": { + "acct": "(invalid user)", + "terminal": "sshd", + "op": "login" + }, + "summary": { + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + }, + "object": { + "primary": "sshd", + "secondary": "220.135.55.172", + "type": "user-session" + } + }, + "sequence": 192459, + "result": "fail" + }, + "event": { + "action": "logged-in", + "module": "auditd", + "category": "user-login", + "type": "user_login" + }, + "user": { + "name_map": { + "uid": "root" + }, + "uid": "0", + "auid": "unset" + }, + "process": { + "pid": "32763", + "exe": "/usr/sbin/sshd" + }, + "beat": { + "name": "demo-stack-nginx-01", + "hostname": "demo-stack-nginx-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-nginx-01" + }, + "source": { + "ip": "220.135.55.172" + }, + "network": { + "direction": "incoming" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "qdSvUmcBTFzn_XoLTQyw", + "source": { + "@timestamp": "2018-11-27T01:01:18.839Z", + "auditd": { + "data": { + "op": "PAM:bad_ident", + "terminal": "ssh", + "hostname": "220.135.55.172" + }, + "summary": { + "actor": { + "secondary": "root", + "primary": "unset" + }, + "object": { + "type": "user-session", + "primary": "ssh", + "secondary": "220.135.55.172" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 192460, + "result": "fail", + "session": "unset" + }, + "event": { + "module": "auditd", + "category": "user-login", + "type": "user_err", + "action": "error" + }, + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + }, + "process": { + "pid": "32763", + "exe": "/usr/sbin/sshd" + }, + "beat": { + "name": "demo-stack-nginx-01", + "hostname": "demo-stack-nginx-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-nginx-01" + }, + "source": { + "ip": "220.135.55.172" + }, + "network": { + "direction": "incoming" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "ztOuUmcBTFzn_XoLCvAK", + "source": { + "@timestamp": "2018-11-27T00:59:55.808Z", + "event": { + "action": "logged-in", + "module": "auditd", + "category": "user-login", + "type": "user_login" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "pid": "19499", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "13.77.75.153" + }, + "beat": { + "name": "demo-stack-haproxy-01", + "hostname": "demo-stack-haproxy-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-haproxy-01" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "result": "fail", + "session": "unset", + "data": { + "acct": "(unknown user)", + "op": "login", + "terminal": "sshd" + }, + "summary": { + "actor": { + "secondary": "(unknown user)", + "primary": "unset" + }, + "object": { + "secondary": "13.77.75.153", + "type": "user-session", + "primary": "sshd" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 142315 + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "z9OuUmcBTFzn_XoLCvAK", + "source": { + "@timestamp": "2018-11-27T00:59:55.809Z", + "event": { + "type": "user_login", + "action": "logged-in", + "module": "auditd", + "category": "user-login" + }, + "user": { + "auid": "unset", + "uid": "0", + "name_map": { + "uid": "root" + } + }, + "process": { + "exe": "/usr/sbin/sshd", + "pid": "19499" + }, + "source": { + "ip": "13.77.75.153" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "summary": { + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + }, + "object": { + "primary": "sshd", + "secondary": "13.77.75.153", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 142316, + "result": "fail", + "session": "unset", + "data": { + "terminal": "sshd", + "op": "login", + "acct": "(invalid user)" + } + }, + "beat": { + "name": "demo-stack-haproxy-01", + "hostname": "demo-stack-haproxy-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-haproxy-01" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "0NOuUmcBTFzn_XoLCvAK", + "source": { + "@timestamp": "2018-11-27T00:59:55.852Z", + "process": { + "pid": "19499", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "13.77.75.153" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "summary": { + "actor": { + "primary": "unset", + "secondary": "root" + }, + "object": { + "primary": "ssh", + "secondary": "13.77.75.153", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 142317, + "result": "fail", + "session": "unset", + "data": { + "hostname": "13.77.75.153", + "op": "PAM:bad_ident", + "terminal": "ssh" + } + }, + "beat": { + "name": "demo-stack-haproxy-01", + "hostname": "demo-stack-haproxy-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-haproxy-01" + }, + "event": { + "category": "user-login", + "type": "user_err", + "action": "error", + "module": "auditd" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "59SwUmcBTFzn_XoLmSiw", + "source": { + "@timestamp": "2018-11-27T01:02:43.654Z", + "host": { + "name": "demo-stack-redis-01" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "data": { + "terminal": "sshd", + "op": "login", + "acct": "(unknown user)" + }, + "summary": { + "object": { + "primary": "sshd", + "secondary": "107.170.65.109", + "type": "user-session" + }, + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + } + }, + "sequence": 186290, + "result": "fail", + "session": "unset" + }, + "event": { + "module": "auditd", + "category": "user-login", + "type": "user_login", + "action": "logged-in" + }, + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + }, + "process": { + "pid": "32075", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "107.170.65.109" + }, + "beat": { + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "6NSwUmcBTFzn_XoLmSiw", + "source": { + "@timestamp": "2018-11-27T01:02:43.655Z", + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + }, + "process": { + "pid": "32075", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "107.170.65.109" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "sequence": 186291, + "result": "fail", + "session": "unset", + "data": { + "acct": "(invalid user)", + "op": "login", + "terminal": "sshd" + }, + "summary": { + "object": { + "primary": "sshd", + "secondary": "107.170.65.109", + "type": "user-session" + }, + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + } + } + }, + "beat": { + "version": "7.0.0-alpha1", + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01" + }, + "host": { + "name": "demo-stack-redis-01" + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "6dSwUmcBTFzn_XoLmSiw", + "source": { + "@timestamp": "2018-11-27T01:02:43.688Z", + "beat": { + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-redis-01" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "pid": "32075", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "107.170.65.109" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "session": "unset", + "data": { + "terminal": "ssh", + "hostname": "107.170.65.109", + "op": "PAM:bad_ident" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "root" + }, + "object": { + "secondary": "107.170.65.109", + "type": "user-session", + "primary": "ssh" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 186292, + "result": "fail" + }, + "event": { + "category": "user-login", + "type": "user_err", + "action": "error", + "module": "auditd" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "ANSwUmcBTFzn_XoL0C7C", + "source": { + "@timestamp": "2018-11-27T01:02:57.752Z", + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "pid": "32082", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "107.170.65.109" + }, + "network": { + "direction": "incoming" + }, + "beat": { + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-redis-01" + }, + "auditd": { + "session": "unset", + "data": { + "terminal": "sshd", + "op": "login", + "acct": "(unknown user)" + }, + "summary": { + "object": { + "type": "user-session", + "primary": "sshd", + "secondary": "107.170.65.109" + }, + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + } + }, + "sequence": 186293, + "result": "fail" + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "AdSwUmcBTFzn_XoL0C7C", + "source": { + "@timestamp": "2018-11-27T01:02:57.754Z", + "process": { + "pid": "32082", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "107.170.65.109" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "summary": { + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + }, + "object": { + "secondary": "107.170.65.109", + "type": "user-session", + "primary": "sshd" + } + }, + "sequence": 186294, + "result": "fail", + "session": "unset", + "data": { + "terminal": "sshd", + "acct": "(invalid user)", + "op": "login" + } + }, + "beat": { + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-redis-01" + }, + "event": { + "type": "user_login", + "action": "logged-in", + "module": "auditd", + "category": "user-login" + }, + "user": { + "name_map": { + "uid": "root" + }, + "auid": "unset", + "uid": "0" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "AtSwUmcBTFzn_XoL0C7C", + "source": { + "@timestamp": "2018-11-27T01:02:57.784Z", + "process": { + "exe": "/usr/sbin/sshd", + "pid": "32082" + }, + "source": { + "ip": "107.170.65.109" + }, + "network": { + "direction": "incoming" + }, + "beat": { + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-redis-01" + }, + "auditd": { + "result": "fail", + "session": "unset", + "data": { + "hostname": "107.170.65.109", + "terminal": "ssh", + "op": "PAM:bad_ident" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "root" + }, + "object": { + "secondary": "107.170.65.109", + "type": "user-session", + "primary": "ssh" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 186295 + }, + "event": { + "type": "user_err", + "action": "error", + "module": "auditd", + "category": "user-login" + }, + "user": { + "name_map": { + "uid": "root" + }, + "uid": "0", + "auid": "unset" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "t9OuUmcBTFzn_XoLHfKW", + "source": { + "@timestamp": "2018-11-27T01:00:00.805Z", + "source": { + "ip": "178.128.127.228" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "data": { + "op": "login", + "acct": "(unknown user)", + "terminal": "sshd" + }, + "summary": { + "object": { + "primary": "sshd", + "secondary": "178.128.127.228", + "type": "user-session" + }, + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + } + }, + "sequence": 44145, + "result": "fail", + "session": "unset" + }, + "event": { + "action": "logged-in", + "module": "auditd", + "category": "user-login", + "type": "user_login" + }, + "beat": { + "name": "demo-stack-es-01", + "hostname": "demo-stack-es-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-es-01" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "pid": "28933", + "exe": "/usr/sbin/sshd" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "uNOuUmcBTFzn_XoLHfKW", + "source": { + "@timestamp": "2018-11-27T01:00:00.809Z", + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + }, + "user": { + "auid": "unset", + "uid": "0", + "name_map": { + "uid": "root" + } + }, + "process": { + "pid": "28933", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "178.128.127.228" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "sequence": 44146, + "result": "fail", + "session": "unset", + "data": { + "op": "login", + "terminal": "sshd", + "acct": "(invalid user)" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + }, + "object": { + "primary": "sshd", + "secondary": "178.128.127.228", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + } + }, + "host": { + "name": "demo-stack-es-01" + }, + "beat": { + "name": "demo-stack-es-01", + "hostname": "demo-stack-es-01", + "version": "7.0.0-alpha1" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "udOuUmcBTFzn_XoLHfKW", + "source": { + "@timestamp": "2018-11-27T01:00:01.001Z", + "auditd": { + "sequence": 44147, + "result": "fail", + "session": "unset", + "data": { + "op": "PAM:bad_ident", + "terminal": "ssh", + "hostname": "178.128.127.228" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "root" + }, + "object": { + "primary": "ssh", + "secondary": "178.128.127.228", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + } + }, + "event": { + "type": "user_err", + "action": "error", + "module": "auditd", + "category": "user-login" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "beat": { + "name": "demo-stack-es-01", + "hostname": "demo-stack-es-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-es-01" + }, + "process": { + "pid": "28933", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "178.128.127.228" + }, + "network": { + "direction": "incoming" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "bNOtUmcBTFzn_XoL8u_M", + "source": { + "@timestamp": "2018-11-27T00:59:49.852Z", + "network": { + "direction": "incoming" + }, + "auditd": { + "session": "unset", + "data": { + "acct": "(unknown user)", + "terminal": "sshd", + "op": "login" + }, + "summary": { + "actor": { + "secondary": "(unknown user)", + "primary": "unset" + }, + "object": { + "primary": "sshd", + "secondary": "164.132.197.108", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 44142, + "result": "fail" + }, + "beat": { + "name": "demo-stack-es-01", + "hostname": "demo-stack-es-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-es-01" + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + }, + "user": { + "auid": "unset", + "uid": "0", + "name_map": { + "uid": "root" + } + }, + "process": { + "exe": "/usr/sbin/sshd", + "pid": "28930" + }, + "source": { + "ip": "164.132.197.108" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "bdOtUmcBTFzn_XoL8u_M", + "source": { + "@timestamp": "2018-11-27T00:59:49.852Z", + "auditd": { + "sequence": 44143, + "result": "fail", + "session": "unset", + "data": { + "acct": "(invalid user)", + "op": "login", + "terminal": "sshd" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + }, + "object": { + "primary": "sshd", + "secondary": "164.132.197.108", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + } + }, + "event": { + "action": "logged-in", + "module": "auditd", + "category": "user-login", + "type": "user_login" + }, + "user": { + "auid": "unset", + "uid": "0", + "name_map": { + "uid": "root" + } + }, + "process": { + "pid": "28930", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "164.132.197.108" + }, + "network": { + "direction": "incoming" + }, + "beat": { + "name": "demo-stack-es-01", + "hostname": "demo-stack-es-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-es-01" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "btOtUmcBTFzn_XoL8u_M", + "source": { + "@timestamp": "2018-11-27T00:59:49.964Z", + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "pid": "28930", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "164.132.197.108" + }, + "beat": { + "name": "demo-stack-es-01", + "hostname": "demo-stack-es-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-es-01" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "sequence": 44144, + "result": "fail", + "session": "unset", + "data": { + "hostname": "164.132.197.108", + "op": "PAM:bad_ident", + "terminal": "ssh" + }, + "summary": { + "actor": { + "secondary": "root", + "primary": "unset" + }, + "object": { + "type": "user-session", + "primary": "ssh", + "secondary": "164.132.197.108" + }, + "how": "/usr/sbin/sshd" + } + }, + "event": { + "module": "auditd", + "category": "user-login", + "type": "user_err", + "action": "error" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "ptS1UmcBTFzn_XoL0JuA", + "source": { + "@timestamp": "2018-11-27T01:08:25.366Z", + "process": { + "exe": "/usr/sbin/sshd", + "pid": "345" + }, + "source": { + "ip": "5.186.77.221" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "result": "fail", + "session": "unset", + "data": { + "acct": "(unknown user)", + "terminal": "sshd", + "op": "login" + }, + "summary": { + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + }, + "object": { + "primary": "sshd", + "secondary": "5.186.77.221", + "type": "user-session" + } + }, + "sequence": 192473 + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + }, + "beat": { + "name": "demo-stack-nginx-01", + "hostname": "demo-stack-nginx-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-nginx-01" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "p9S1UmcBTFzn_XoL0JuA", + "source": { + "@timestamp": "2018-11-27T01:08:25.367Z", + "host": { + "name": "demo-stack-nginx-01" + }, + "beat": { + "hostname": "demo-stack-nginx-01", + "version": "7.0.0-alpha1", + "name": "demo-stack-nginx-01" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "sequence": 192474, + "result": "fail", + "session": "unset", + "data": { + "acct": "(invalid user)", + "terminal": "sshd", + "op": "login" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + }, + "object": { + "type": "user-session", + "primary": "sshd", + "secondary": "5.186.77.221" + }, + "how": "/usr/sbin/sshd" + } + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + }, + "user": { + "name_map": { + "uid": "root" + }, + "uid": "0", + "auid": "unset" + }, + "process": { + "exe": "/usr/sbin/sshd", + "pid": "345" + }, + "source": { + "ip": "5.186.77.221" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "qNS1UmcBTFzn_XoL0JuA", + "source": { + "@timestamp": "2018-11-27T01:08:25.506Z", + "process": { + "exe": "/usr/sbin/sshd", + "pid": "345" + }, + "source": { + "ip": "5.186.77.221" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "sequence": 192475, + "result": "fail", + "session": "unset", + "data": { + "op": "PAM:bad_ident", + "hostname": "5.186.77.221", + "terminal": "ssh" + }, + "summary": { + "object": { + "secondary": "5.186.77.221", + "type": "user-session", + "primary": "ssh" + }, + "how": "/usr/sbin/sshd", + "actor": { + "secondary": "root", + "primary": "unset" + } + } + }, + "beat": { + "name": "demo-stack-nginx-01", + "hostname": "demo-stack-nginx-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-nginx-01" + }, + "event": { + "category": "user-login", + "type": "user_err", + "action": "error", + "module": "auditd" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "-NS1UmcBTFzn_XoL2Jxv", + "source": { + "@timestamp": "2018-11-27T01:08:27.396Z", + "source": { + "ip": "24.37.251.196" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "sequence": 186326, + "result": "fail", + "session": "unset", + "data": { + "acct": "(unknown user)", + "op": "login", + "terminal": "sshd" + }, + "summary": { + "object": { + "primary": "sshd", + "secondary": "24.37.251.196", + "type": "user-session" + }, + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + } + } + }, + "beat": { + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-redis-01" + }, + "event": { + "action": "logged-in", + "module": "auditd", + "category": "user-login", + "type": "user_login" + }, + "user": { + "auid": "unset", + "uid": "0", + "name_map": { + "uid": "root" + } + }, + "process": { + "pid": "32127", + "exe": "/usr/sbin/sshd" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "-dS1UmcBTFzn_XoL2Jxv", + "source": { + "@timestamp": "2018-11-27T01:08:27.397Z", + "user": { + "uid": "0", + "auid": "unset", + "name_map": { + "uid": "root" + } + }, + "process": { + "exe": "/usr/sbin/sshd", + "pid": "32127" + }, + "source": { + "ip": "24.37.251.196" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "result": "fail", + "session": "unset", + "data": { + "terminal": "sshd", + "op": "login", + "acct": "(invalid user)" + }, + "summary": { + "how": "/usr/sbin/sshd", + "actor": { + "secondary": "(invalid user)", + "primary": "unset" + }, + "object": { + "primary": "sshd", + "secondary": "24.37.251.196", + "type": "user-session" + } + }, + "sequence": 186327 + }, + "beat": { + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-redis-01" + }, + "event": { + "action": "logged-in", + "module": "auditd", + "category": "user-login", + "type": "user_login" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "-tS1UmcBTFzn_XoL2Jxv", + "source": { + "@timestamp": "2018-11-27T01:08:27.453Z", + "source": { + "ip": "24.37.251.196" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "result": "fail", + "session": "unset", + "data": { + "op": "PAM:bad_ident", + "terminal": "ssh", + "hostname": "24.37.251.196" + }, + "summary": { + "object": { + "primary": "ssh", + "secondary": "24.37.251.196", + "type": "user-session" + }, + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "root" + } + }, + "sequence": 186328 + }, + "beat": { + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-redis-01" + }, + "event": { + "module": "auditd", + "category": "user-login", + "type": "user_err", + "action": "error" + }, + "user": { + "auid": "unset", + "uid": "0", + "name_map": { + "uid": "root" + } + }, + "process": { + "pid": "32127", + "exe": "/usr/sbin/sshd" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "ydSzUmcBTFzn_XoLp2tF", + "source": { + "@timestamp": "2018-11-27T01:06:03.738Z", + "network": { + "direction": "incoming" + }, + "auditd": { + "session": "unset", + "data": { + "op": "login", + "terminal": "sshd", + "acct": "(unknown user)" + }, + "summary": { + "object": { + "secondary": "178.128.124.241", + "type": "user-session", + "primary": "sshd" + }, + "how": "/usr/sbin/sshd", + "actor": { + "secondary": "(unknown user)", + "primary": "unset" + } + }, + "sequence": 186311, + "result": "fail" + }, + "event": { + "type": "user_login", + "action": "logged-in", + "module": "auditd", + "category": "user-login" + }, + "user": { + "auid": "unset", + "uid": "0", + "name_map": { + "uid": "root" + } + }, + "process": { + "exe": "/usr/sbin/sshd", + "pid": "32108" + }, + "beat": { + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-redis-01" + }, + "source": { + "ip": "178.128.124.241" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "ytSzUmcBTFzn_XoLp2tF", + "source": { + "@timestamp": "2018-11-27T01:06:03.739Z", + "process": { + "pid": "32108", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "178.128.124.241" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "summary": { + "actor": { + "secondary": "(invalid user)", + "primary": "unset" + }, + "object": { + "secondary": "178.128.124.241", + "type": "user-session", + "primary": "sshd" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 186312, + "result": "fail", + "session": "unset", + "data": { + "op": "login", + "acct": "(invalid user)", + "terminal": "sshd" + } + }, + "beat": { + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-redis-01" + }, + "event": { + "action": "logged-in", + "module": "auditd", + "category": "user-login", + "type": "user_login" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "y9SzUmcBTFzn_XoLp2tF", + "source": { + "@timestamp": "2018-11-27T01:06:03.933Z", + "event": { + "module": "auditd", + "category": "user-login", + "type": "user_err", + "action": "error" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "pid": "32108", + "exe": "/usr/sbin/sshd" + }, + "host": { + "name": "demo-stack-redis-01" + }, + "beat": { + "version": "7.0.0-alpha1", + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01" + }, + "source": { + "ip": "178.128.124.241" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "sequence": 186313, + "result": "fail", + "session": "unset", + "data": { + "terminal": "ssh", + "hostname": "178.128.124.241", + "op": "PAM:bad_ident" + }, + "summary": { + "object": { + "secondary": "178.128.124.241", + "type": "user-session", + "primary": "ssh" + }, + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "root" + } + } + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "UtSzUmcBTFzn_XoLrWwF", + "source": { + "@timestamp": "2018-11-27T01:06:05.210Z", + "user": { + "uid": "0", + "auid": "unset", + "name_map": { + "uid": "root" + } + }, + "beat": { + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-redis-01" + }, + "process": { + "exe": "/usr/sbin/sshd", + "pid": "32110" + }, + "source": { + "ip": "191.92.71.194" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "sequence": 186314, + "result": "fail", + "session": "unset", + "data": { + "acct": "(unknown user)", + "terminal": "sshd", + "op": "login" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + }, + "object": { + "primary": "sshd", + "secondary": "191.92.71.194", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + } + }, + "event": { + "action": "logged-in", + "module": "auditd", + "category": "user-login", + "type": "user_login" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "U9SzUmcBTFzn_XoLrWwF", + "source": { + "@timestamp": "2018-11-27T01:06:05.211Z", + "process": { + "exe": "/usr/sbin/sshd", + "pid": "32110" + }, + "source": { + "ip": "191.92.71.194" + }, + "network": { + "direction": "incoming" + }, + "beat": { + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-redis-01" + }, + "auditd": { + "result": "fail", + "session": "unset", + "data": { + "acct": "(invalid user)", + "op": "login", + "terminal": "sshd" + }, + "summary": { + "actor": { + "secondary": "(invalid user)", + "primary": "unset" + }, + "object": { + "primary": "sshd", + "secondary": "191.92.71.194", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 186315 + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + }, + "user": { + "name_map": { + "uid": "root" + }, + "auid": "unset", + "uid": "0" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "VNSzUmcBTFzn_XoLrWwF", + "source": { + "@timestamp": "2018-11-27T01:06:05.347Z", + "host": { + "name": "demo-stack-redis-01" + }, + "source": { + "ip": "191.92.71.194" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "sequence": 186316, + "result": "fail", + "session": "unset", + "data": { + "hostname": "191.92.71.194", + "terminal": "ssh", + "op": "PAM:bad_ident" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "root" + }, + "object": { + "primary": "ssh", + "secondary": "191.92.71.194", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + } + }, + "event": { + "category": "user-login", + "type": "user_err", + "action": "error", + "module": "auditd" + }, + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + }, + "process": { + "pid": "32110", + "exe": "/usr/sbin/sshd" + }, + "beat": { + "version": "7.0.0-alpha1", + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "ztS0UmcBTFzn_XoLK3fA", + "source": { + "@timestamp": "2018-11-27T01:06:37.654Z", + "event": { + "type": "user_login", + "action": "logged-in", + "module": "auditd", + "category": "user-login" + }, + "user": { + "name_map": { + "uid": "root" + }, + "uid": "0", + "auid": "unset" + }, + "process": { + "pid": "327", + "exe": "/usr/sbin/sshd" + }, + "beat": { + "name": "demo-stack-nginx-01", + "hostname": "demo-stack-nginx-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-nginx-01" + }, + "source": { + "ip": "106.241.53.82" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "sequence": 192467, + "result": "fail", + "session": "unset", + "data": { + "op": "login", + "acct": "(unknown user)", + "terminal": "sshd" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + }, + "object": { + "type": "user-session", + "primary": "sshd", + "secondary": "106.241.53.82" + }, + "how": "/usr/sbin/sshd" + } + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "z9S0UmcBTFzn_XoLK3fA", + "source": { + "@timestamp": "2018-11-27T01:06:37.655Z", + "host": { + "name": "demo-stack-nginx-01" + }, + "beat": { + "hostname": "demo-stack-nginx-01", + "version": "7.0.0-alpha1", + "name": "demo-stack-nginx-01" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "data": { + "terminal": "sshd", + "acct": "(invalid user)", + "op": "login" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + }, + "object": { + "primary": "sshd", + "secondary": "106.241.53.82", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 192468, + "result": "fail", + "session": "unset" + }, + "event": { + "action": "logged-in", + "module": "auditd", + "category": "user-login", + "type": "user_login" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "pid": "327", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "106.241.53.82" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "0NS0UmcBTFzn_XoLK3fA", + "source": { + "@timestamp": "2018-11-27T01:06:37.861Z", + "beat": { + "version": "7.0.0-alpha1", + "name": "demo-stack-nginx-01", + "hostname": "demo-stack-nginx-01" + }, + "host": { + "name": "demo-stack-nginx-01" + }, + "event": { + "category": "user-login", + "type": "user_err", + "action": "error", + "module": "auditd" + }, + "user": { + "uid": "0", + "auid": "unset", + "name_map": { + "uid": "root" + } + }, + "process": { + "pid": "327", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "106.241.53.82" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "result": "fail", + "session": "unset", + "data": { + "op": "PAM:bad_ident", + "hostname": "106.241.53.82", + "terminal": "ssh" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "root" + }, + "object": { + "type": "user-session", + "primary": "ssh", + "secondary": "106.241.53.82" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 192469 + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "k9S0UmcBTFzn_XoLPHgu", + "source": { + "@timestamp": "2018-11-27T01:06:41.860Z", + "process": { + "exe": "/usr/sbin/sshd", + "pid": "330" + }, + "source": { + "ip": "170.210.88.50" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "summary": { + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + }, + "object": { + "primary": "sshd", + "secondary": "170.210.88.50", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 192470, + "result": "fail", + "session": "unset", + "data": { + "acct": "(unknown user)", + "op": "login", + "terminal": "sshd" + } + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + }, + "beat": { + "name": "demo-stack-nginx-01", + "hostname": "demo-stack-nginx-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-nginx-01" + }, + "user": { + "auid": "unset", + "uid": "0", + "name_map": { + "uid": "root" + } + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "lNS0UmcBTFzn_XoLPHgu", + "source": { + "@timestamp": "2018-11-27T01:06:41.861Z", + "auditd": { + "sequence": 192471, + "result": "fail", + "session": "unset", + "data": { + "terminal": "sshd", + "op": "login", + "acct": "(invalid user)" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + }, + "object": { + "primary": "sshd", + "secondary": "170.210.88.50", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + } + }, + "beat": { + "name": "demo-stack-nginx-01", + "hostname": "demo-stack-nginx-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-nginx-01" + }, + "event": { + "action": "logged-in", + "module": "auditd", + "category": "user-login", + "type": "user_login" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "pid": "330", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "170.210.88.50" + }, + "network": { + "direction": "incoming" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "ldS0UmcBTFzn_XoLPHgu", + "source": { + "@timestamp": "2018-11-27T01:06:42.073Z", + "beat": { + "hostname": "demo-stack-nginx-01", + "version": "7.0.0-alpha1", + "name": "demo-stack-nginx-01" + }, + "host": { + "name": "demo-stack-nginx-01" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "session": "unset", + "data": { + "terminal": "ssh", + "hostname": "170.210.88.50", + "op": "PAM:bad_ident" + }, + "summary": { + "actor": { + "secondary": "root", + "primary": "unset" + }, + "object": { + "primary": "ssh", + "secondary": "170.210.88.50", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 192472, + "result": "fail" + }, + "event": { + "action": "error", + "module": "auditd", + "category": "user-login", + "type": "user_err" + }, + "user": { + "auid": "unset", + "uid": "0", + "name_map": { + "uid": "root" + } + }, + "process": { + "pid": "330", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "170.210.88.50" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "bdS1UmcBTFzn_XoLo5cq", + "source": { + "@timestamp": "2018-11-27T01:08:13.760Z", + "source": { + "ip": "107.170.65.109" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "summary": { + "actor": { + "secondary": "(unknown user)", + "primary": "unset" + }, + "object": { + "primary": "sshd", + "secondary": "107.170.65.109", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 186323, + "result": "fail", + "session": "unset", + "data": { + "acct": "(unknown user)", + "terminal": "sshd", + "op": "login" + } + }, + "beat": { + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-redis-01" + }, + "event": { + "module": "auditd", + "category": "user-login", + "type": "user_login", + "action": "logged-in" + }, + "user": { + "auid": "unset", + "uid": "0", + "name_map": { + "uid": "root" + } + }, + "process": { + "pid": "32125", + "exe": "/usr/sbin/sshd" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "btS1UmcBTFzn_XoLo5cq", + "source": { + "@timestamp": "2018-11-27T01:08:13.761Z", + "beat": { + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1" + }, + "event": { + "action": "logged-in", + "module": "auditd", + "category": "user-login", + "type": "user_login" + }, + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + }, + "process": { + "exe": "/usr/sbin/sshd", + "pid": "32125" + }, + "source": { + "ip": "107.170.65.109" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "result": "fail", + "session": "unset", + "data": { + "terminal": "sshd", + "op": "login", + "acct": "(invalid user)" + }, + "summary": { + "object": { + "primary": "sshd", + "secondary": "107.170.65.109", + "type": "user-session" + }, + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + } + }, + "sequence": 186324 + }, + "host": { + "name": "demo-stack-redis-01" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "b9S1UmcBTFzn_XoLo5cq", + "source": { + "@timestamp": "2018-11-27T01:08:13.791Z", + "user": { + "uid": "0", + "auid": "unset", + "name_map": { + "uid": "root" + } + }, + "process": { + "exe": "/usr/sbin/sshd", + "pid": "32125" + }, + "source": { + "ip": "107.170.65.109" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "sequence": 186325, + "result": "fail", + "session": "unset", + "data": { + "op": "PAM:bad_ident", + "hostname": "107.170.65.109", + "terminal": "ssh" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "root" + }, + "object": { + "primary": "ssh", + "secondary": "107.170.65.109", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + } + }, + "beat": { + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-redis-01" + }, + "event": { + "category": "user-login", + "type": "user_err", + "action": "error", + "module": "auditd" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "c9S0UmcBTFzn_XoLsoI4", + "source": { + "@timestamp": "2018-11-27T01:07:12.077Z", + "source": { + "ip": "107.170.65.109" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "session": "unset", + "data": { + "acct": "(unknown user)", + "terminal": "sshd", + "op": "login" + }, + "summary": { + "object": { + "primary": "sshd", + "secondary": "107.170.65.109", + "type": "user-session" + }, + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + } + }, + "sequence": 186320, + "result": "fail" + }, + "beat": { + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-redis-01" + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "pid": "32117", + "exe": "/usr/sbin/sshd" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "dNS0UmcBTFzn_XoLsoI4", + "source": { + "@timestamp": "2018-11-27T01:07:12.079Z", + "source": { + "ip": "107.170.65.109" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "data": { + "acct": "(invalid user)", + "terminal": "sshd", + "op": "login" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + }, + "object": { + "secondary": "107.170.65.109", + "type": "user-session", + "primary": "sshd" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 186321, + "result": "fail", + "session": "unset" + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "beat": { + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1", + "name": "demo-stack-redis-01" + }, + "host": { + "name": "demo-stack-redis-01" + }, + "process": { + "pid": "32117", + "exe": "/usr/sbin/sshd" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "ddS0UmcBTFzn_XoLsoI4", + "source": { + "@timestamp": "2018-11-27T01:07:12.110Z", + "auditd": { + "sequence": 186322, + "result": "fail", + "session": "unset", + "data": { + "hostname": "107.170.65.109", + "terminal": "ssh", + "op": "PAM:bad_ident" + }, + "summary": { + "object": { + "primary": "ssh", + "secondary": "107.170.65.109", + "type": "user-session" + }, + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "root" + } + } + }, + "event": { + "type": "user_err", + "action": "error", + "module": "auditd", + "category": "user-login" + }, + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + }, + "process": { + "pid": "32117", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "107.170.65.109" + }, + "host": { + "name": "demo-stack-redis-01" + }, + "beat": { + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1" + }, + "network": { + "direction": "incoming" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "U9SzUmcBTFzn_XoLw27K", + "source": { + "@timestamp": "2018-11-27T01:06:11.040Z", + "network": { + "direction": "incoming" + }, + "beat": { + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-redis-01" + }, + "auditd": { + "sequence": 186317, + "result": "fail", + "session": "unset", + "data": { + "acct": "(unknown user)", + "terminal": "sshd", + "op": "login" + }, + "summary": { + "object": { + "primary": "sshd", + "secondary": "107.170.65.109", + "type": "user-session" + }, + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + } + } + }, + "event": { + "action": "logged-in", + "module": "auditd", + "category": "user-login", + "type": "user_login" + }, + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + }, + "process": { + "pid": "32112", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "107.170.65.109" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "VNSzUmcBTFzn_XoLw27K", + "source": { + "@timestamp": "2018-11-27T01:06:11.041Z", + "network": { + "direction": "incoming" + }, + "auditd": { + "sequence": 186318, + "result": "fail", + "session": "unset", + "data": { + "terminal": "sshd", + "op": "login", + "acct": "(invalid user)" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + }, + "object": { + "primary": "sshd", + "secondary": "107.170.65.109", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + } + }, + "beat": { + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1", + "name": "demo-stack-redis-01" + }, + "host": { + "name": "demo-stack-redis-01" + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + }, + "user": { + "auid": "unset", + "uid": "0", + "name_map": { + "uid": "root" + } + }, + "process": { + "pid": "32112", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "107.170.65.109" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "VdSzUmcBTFzn_XoLw27K", + "source": { + "@timestamp": "2018-11-27T01:06:11.071Z", + "event": { + "category": "user-login", + "type": "user_err", + "action": "error", + "module": "auditd" + }, + "beat": { + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-redis-01" + }, + "user": { + "name_map": { + "uid": "root" + }, + "uid": "0", + "auid": "unset" + }, + "process": { + "pid": "32112", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "107.170.65.109" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "data": { + "op": "PAM:bad_ident", + "hostname": "107.170.65.109", + "terminal": "ssh" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "root" + }, + "object": { + "primary": "ssh", + "secondary": "107.170.65.109", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 186319, + "result": "fail", + "session": "unset" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "o9S0UmcBTFzn_XoL1YXV", + "source": { + "@timestamp": "2018-11-27T01:07:21.191Z", + "network": { + "direction": "incoming" + }, + "auditd": { + "data": { + "op": "login", + "terminal": "sshd", + "acct": "(unknown user)" + }, + "summary": { + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + }, + "object": { + "primary": "sshd", + "secondary": "104.234.223.14", + "type": "user-session" + } + }, + "sequence": 44148, + "result": "fail", + "session": "unset" + }, + "event": { + "module": "auditd", + "category": "user-login", + "type": "user_login", + "action": "logged-in" + }, + "user": { + "auid": "unset", + "uid": "0", + "name_map": { + "uid": "root" + } + }, + "process": { + "pid": "29074", + "exe": "/usr/sbin/sshd" + }, + "beat": { + "name": "demo-stack-es-01", + "hostname": "demo-stack-es-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-es-01" + }, + "source": { + "ip": "104.234.223.14" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "pNS0UmcBTFzn_XoL1YXV", + "source": { + "@timestamp": "2018-11-27T01:07:21.195Z", + "network": { + "direction": "incoming" + }, + "auditd": { + "data": { + "op": "login", + "acct": "(invalid user)", + "terminal": "sshd" + }, + "summary": { + "object": { + "primary": "sshd", + "secondary": "104.234.223.14", + "type": "user-session" + }, + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + } + }, + "sequence": 44149, + "result": "fail", + "session": "unset" + }, + "beat": { + "name": "demo-stack-es-01", + "hostname": "demo-stack-es-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-es-01" + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "pid": "29074", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "104.234.223.14" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "pdS0UmcBTFzn_XoL1YXV", + "source": { + "@timestamp": "2018-11-27T01:07:21.243Z", + "network": { + "direction": "incoming" + }, + "auditd": { + "result": "fail", + "session": "unset", + "data": { + "hostname": "104.234.223.14", + "op": "PAM:bad_ident", + "terminal": "ssh" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "root" + }, + "object": { + "type": "user-session", + "primary": "ssh", + "secondary": "104.234.223.14" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 44150 + }, + "event": { + "category": "user-login", + "type": "user_err", + "action": "error", + "module": "auditd" + }, + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + }, + "process": { + "exe": "/usr/sbin/sshd", + "pid": "29074" + }, + "beat": { + "name": "demo-stack-es-01", + "hostname": "demo-stack-es-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-es-01" + }, + "source": { + "ip": "104.234.223.14" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "dtS2UmcBTFzn_XoLXqd2", + "source": { + "@timestamp": "2018-11-27T01:09:01.707Z", + "auditd": { + "result": "success", + "session": "unset", + "data": { + "op": "PAM:accounting", + "acct": "root", + "terminal": "cron" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "root" + }, + "object": { + "type": "user-session", + "primary": "cron" + }, + "how": "/usr/sbin/cron" + }, + "sequence": 184324 + }, + "beat": { + "name": "demo-stack-apache-01", + "hostname": "demo-stack-apache-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-apache-01" + }, + "event": { + "category": "user-login", + "type": "user_acct", + "action": "was-authorized", + "module": "auditd" + }, + "user": { + "name_map": { + "uid": "root" + }, + "uid": "0", + "auid": "unset" + }, + "process": { + "pid": "25243", + "exe": "/usr/sbin/cron" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "d9S2UmcBTFzn_XoLXqd2", + "source": { + "@timestamp": "2018-11-27T01:09:01.708Z", + "host": { + "name": "demo-stack-apache-01" + }, + "beat": { + "hostname": "demo-stack-apache-01", + "version": "7.0.0-alpha1", + "name": "demo-stack-apache-01" + }, + "event": { + "action": "acquired-credentials", + "module": "auditd", + "category": "user-login", + "type": "cred_acq" + }, + "user": { + "auid": "unset", + "uid": "0", + "name_map": { + "uid": "root" + } + }, + "process": { + "pid": "25243", + "exe": "/usr/sbin/cron" + }, + "auditd": { + "session": "unset", + "data": { + "terminal": "cron", + "acct": "root", + "op": "PAM:setcred" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "root" + }, + "object": { + "primary": "cron", + "type": "user-session" + }, + "how": "/usr/sbin/cron" + }, + "sequence": 184325, + "result": "success" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "eNS2UmcBTFzn_XoLXqd2", + "source": { + "@timestamp": "2018-11-27T01:09:01.710Z", + "process": { + "pid": "25243", + "exe": "/usr/sbin/cron" + }, + "auditd": { + "sequence": 184327, + "result": "success", + "session": "9857", + "data": { + "terminal": "cron", + "op": "PAM:session_open", + "acct": "root" + }, + "summary": { + "actor": { + "primary": "root", + "secondary": "root" + }, + "object": { + "primary": "cron", + "type": "user-session" + }, + "how": "/usr/sbin/cron" + } + }, + "event": { + "action": "started-session", + "module": "auditd", + "category": "user-login", + "type": "user_start" + }, + "user": { + "auid": "0", + "name_map": { + "auid": "root", + "uid": "root" + }, + "uid": "0" + }, + "beat": { + "name": "demo-stack-apache-01", + "hostname": "demo-stack-apache-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-apache-01" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "edS2UmcBTFzn_XoLXqd2", + "source": { + "@timestamp": "2018-11-27T01:09:01.806Z", + "event": { + "module": "auditd", + "category": "user-login", + "type": "cred_disp", + "action": "disposed-credentials" + }, + "user": { + "uid": "0", + "name_map": { + "auid": "root", + "uid": "root" + }, + "auid": "0" + }, + "process": { + "pid": "25243", + "exe": "/usr/sbin/cron" + }, + "auditd": { + "summary": { + "actor": { + "primary": "root", + "secondary": "root" + }, + "object": { + "type": "user-session", + "primary": "cron" + }, + "how": "/usr/sbin/cron" + }, + "sequence": 184328, + "result": "success", + "session": "9857", + "data": { + "terminal": "cron", + "op": "PAM:setcred", + "acct": "root" + } + }, + "host": { + "name": "demo-stack-apache-01" + }, + "beat": { + "name": "demo-stack-apache-01", + "hostname": "demo-stack-apache-01", + "version": "7.0.0-alpha1" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "etS2UmcBTFzn_XoLXqd2", + "source": { + "@timestamp": "2018-11-27T01:09:01.808Z", + "beat": { + "hostname": "demo-stack-apache-01", + "version": "7.0.0-alpha1", + "name": "demo-stack-apache-01" + }, + "host": { + "name": "demo-stack-apache-01" + }, + "event": { + "category": "user-login", + "type": "user_end", + "action": "ended-session", + "module": "auditd" + }, + "user": { + "auid": "0", + "name_map": { + "uid": "root", + "auid": "root" + }, + "uid": "0" + }, + "process": { + "pid": "25243", + "exe": "/usr/sbin/cron" + }, + "auditd": { + "sequence": 184329, + "result": "success", + "session": "9857", + "data": { + "terminal": "cron", + "acct": "root", + "op": "PAM:session_close" + }, + "summary": { + "how": "/usr/sbin/cron", + "actor": { + "secondary": "root", + "primary": "root" + }, + "object": { + "primary": "cron", + "type": "user-session" + } + } + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "t9S2UmcBTFzn_XoLX6cl", + "source": { + "@timestamp": "2018-11-27T01:09:01.883Z", + "beat": { + "name": "demo-stack-nginx-01", + "hostname": "demo-stack-nginx-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-nginx-01" + }, + "event": { + "type": "user_acct", + "action": "was-authorized", + "module": "auditd", + "category": "user-login" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "pid": "348", + "exe": "/usr/sbin/cron" + }, + "auditd": { + "sequence": 192476, + "result": "success", + "session": "unset", + "data": { + "op": "PAM:accounting", + "acct": "root", + "terminal": "cron" + }, + "summary": { + "actor": { + "secondary": "root", + "primary": "unset" + }, + "object": { + "primary": "cron", + "type": "user-session" + }, + "how": "/usr/sbin/cron" + } + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "uNS2UmcBTFzn_XoLX6cl", + "source": { + "@timestamp": "2018-11-27T01:09:01.884Z", + "event": { + "type": "cred_acq", + "action": "acquired-credentials", + "module": "auditd", + "category": "user-login" + }, + "beat": { + "name": "demo-stack-nginx-01", + "hostname": "demo-stack-nginx-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-nginx-01" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "pid": "348", + "exe": "/usr/sbin/cron" + }, + "auditd": { + "sequence": 192477, + "result": "success", + "session": "unset", + "data": { + "op": "PAM:setcred", + "acct": "root", + "terminal": "cron" + }, + "summary": { + "object": { + "type": "user-session", + "primary": "cron" + }, + "how": "/usr/sbin/cron", + "actor": { + "secondary": "root", + "primary": "unset" + } + } + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "udS2UmcBTFzn_XoLX6cl", + "source": { + "@timestamp": "2018-11-27T01:09:01.885Z", + "auditd": { + "summary": { + "how": "/usr/sbin/cron", + "actor": { + "primary": "root", + "secondary": "root" + }, + "object": { + "type": "user-session", + "primary": "cron" + } + }, + "sequence": 192479, + "result": "success", + "session": "9861", + "data": { + "terminal": "cron", + "op": "PAM:session_open", + "acct": "root" + } + }, + "event": { + "category": "user-login", + "type": "user_start", + "action": "started-session", + "module": "auditd" + }, + "user": { + "uid": "0", + "auid": "0", + "name_map": { + "auid": "root", + "uid": "root" + } + }, + "process": { + "pid": "348", + "exe": "/usr/sbin/cron" + }, + "beat": { + "name": "demo-stack-nginx-01", + "hostname": "demo-stack-nginx-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-nginx-01" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "utS2UmcBTFzn_XoLX6cl", + "source": { + "@timestamp": "2018-11-27T01:09:01.981Z", + "beat": { + "name": "demo-stack-nginx-01", + "hostname": "demo-stack-nginx-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-nginx-01" + }, + "auditd": { + "summary": { + "actor": { + "primary": "root", + "secondary": "root" + }, + "object": { + "primary": "cron", + "type": "user-session" + }, + "how": "/usr/sbin/cron" + }, + "sequence": 192480, + "result": "success", + "session": "9861", + "data": { + "op": "PAM:setcred", + "terminal": "cron", + "acct": "root" + } + }, + "event": { + "category": "user-login", + "type": "cred_disp", + "action": "disposed-credentials", + "module": "auditd" + }, + "user": { + "auid": "0", + "name_map": { + "auid": "root", + "uid": "root" + }, + "uid": "0" + }, + "process": { + "pid": "348", + "exe": "/usr/sbin/cron" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "u9S2UmcBTFzn_XoLX6cl", + "source": { + "@timestamp": "2018-11-27T01:09:01.982Z", + "event": { + "type": "user_end", + "action": "ended-session", + "module": "auditd", + "category": "user-login" + }, + "user": { + "auid": "0", + "uid": "0", + "name_map": { + "auid": "root", + "uid": "root" + } + }, + "process": { + "pid": "348", + "exe": "/usr/sbin/cron" + }, + "auditd": { + "session": "9861", + "data": { + "terminal": "cron", + "op": "PAM:session_close", + "acct": "root" + }, + "summary": { + "how": "/usr/sbin/cron", + "actor": { + "secondary": "root", + "primary": "root" + }, + "object": { + "type": "user-session", + "primary": "cron" + } + }, + "sequence": 192481, + "result": "success" + }, + "beat": { + "name": "demo-stack-nginx-01", + "hostname": "demo-stack-nginx-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-nginx-01" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "ItS2UmcBTFzn_XoLBKBn", + "source": { + "@timestamp": "2018-11-27T01:08:38.649Z", + "network": { + "direction": "incoming" + }, + "auditd": { + "summary": { + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + }, + "object": { + "primary": "sshd", + "secondary": "178.33.228.67", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 44151, + "result": "fail", + "session": "unset", + "data": { + "terminal": "sshd", + "op": "login", + "acct": "(unknown user)" + } + }, + "beat": { + "name": "demo-stack-es-01", + "hostname": "demo-stack-es-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-es-01" + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "pid": "29096", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "178.33.228.67" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "I9S2UmcBTFzn_XoLBKBn", + "source": { + "@timestamp": "2018-11-27T01:08:38.649Z", + "source": { + "ip": "178.33.228.67" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "result": "fail", + "session": "unset", + "data": { + "op": "login", + "terminal": "sshd", + "acct": "(invalid user)" + }, + "summary": { + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + }, + "object": { + "primary": "sshd", + "secondary": "178.33.228.67", + "type": "user-session" + } + }, + "sequence": 44152 + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + }, + "beat": { + "name": "demo-stack-es-01", + "hostname": "demo-stack-es-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-es-01" + }, + "user": { + "name_map": { + "uid": "root" + }, + "auid": "unset", + "uid": "0" + }, + "process": { + "pid": "29096", + "exe": "/usr/sbin/sshd" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "JNS2UmcBTFzn_XoLBKBn", + "source": { + "@timestamp": "2018-11-27T01:08:38.757Z", + "event": { + "module": "auditd", + "category": "user-login", + "type": "user_err", + "action": "error" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "pid": "29096", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "178.33.228.67" + }, + "beat": { + "name": "demo-stack-es-01", + "hostname": "demo-stack-es-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-es-01" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "data": { + "terminal": "ssh", + "hostname": "178.33.228.67", + "op": "PAM:bad_ident" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "root" + }, + "object": { + "secondary": "178.33.228.67", + "type": "user-session", + "primary": "ssh" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 44153, + "result": "fail", + "session": "unset" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "LNS4UmcBTFzn_XoLIM6c", + "source": { + "@timestamp": "2018-11-27T01:10:56.938Z", + "beat": { + "name": "demo-stack-apache-01", + "hostname": "demo-stack-apache-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-apache-01" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "sequence": 184333, + "result": "fail", + "session": "unset", + "data": { + "terminal": "ssh", + "op": "PAM:bad_ident", + "hostname": "91.230.8.194" + }, + "summary": { + "actor": { + "secondary": "root", + "primary": "unset" + }, + "object": { + "type": "user-session", + "primary": "ssh", + "secondary": "91.230.8.194" + }, + "how": "/usr/sbin/sshd" + } + }, + "event": { + "category": "user-login", + "type": "user_err", + "action": "error", + "module": "auditd" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "pid": "25299", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "91.230.8.194" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "2NS4UmcBTFzn_XoLMc9n", + "source": { + "@timestamp": "2018-11-27T01:11:01.244Z", + "process": { + "pid": "29148", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "85.234.34.92" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "data": { + "op": "login", + "terminal": "sshd", + "acct": "(unknown user)" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + }, + "object": { + "primary": "sshd", + "secondary": "85.234.34.92", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 44158, + "result": "fail", + "session": "unset" + }, + "beat": { + "name": "demo-stack-es-01", + "hostname": "demo-stack-es-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-es-01" + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + }, + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "2dS4UmcBTFzn_XoLMc9n", + "source": { + "@timestamp": "2018-11-27T01:11:01.244Z", + "event": { + "module": "auditd", + "category": "user-login", + "type": "user_login", + "action": "logged-in" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "pid": "29148", + "exe": "/usr/sbin/sshd" + }, + "beat": { + "version": "7.0.0-alpha1", + "name": "demo-stack-es-01", + "hostname": "demo-stack-es-01" + }, + "host": { + "name": "demo-stack-es-01" + }, + "source": { + "ip": "85.234.34.92" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "summary": { + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + }, + "object": { + "type": "user-session", + "primary": "sshd", + "secondary": "85.234.34.92" + } + }, + "sequence": 44159, + "result": "fail", + "session": "unset", + "data": { + "op": "login", + "terminal": "sshd", + "acct": "(invalid user)" + } + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "2tS4UmcBTFzn_XoLMc9n", + "source": { + "@timestamp": "2018-11-27T01:11:01.400Z", + "process": { + "exe": "/usr/sbin/sshd", + "pid": "29148" + }, + "source": { + "ip": "85.234.34.92" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "sequence": 44160, + "result": "fail", + "session": "unset", + "data": { + "terminal": "ssh", + "hostname": "85.234.34.92", + "op": "PAM:bad_ident" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "root" + }, + "object": { + "type": "user-session", + "primary": "ssh", + "secondary": "85.234.34.92" + }, + "how": "/usr/sbin/sshd" + } + }, + "event": { + "category": "user-login", + "type": "user_err", + "action": "error", + "module": "auditd" + }, + "user": { + "uid": "0", + "auid": "unset", + "name_map": { + "uid": "root" + } + }, + "host": { + "name": "demo-stack-es-01" + }, + "beat": { + "hostname": "demo-stack-es-01", + "version": "7.0.0-alpha1", + "name": "demo-stack-es-01" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "ctS3UmcBTFzn_XoLgcD-", + "source": { + "@timestamp": "2018-11-27T01:10:16.337Z", + "host": { + "name": "demo-stack-redis-01" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "data": { + "op": "login", + "terminal": "sshd", + "acct": "(unknown user)" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + }, + "object": { + "secondary": "79.137.64.132", + "type": "user-session", + "primary": "sshd" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 186333, + "result": "fail", + "session": "unset" + }, + "event": { + "type": "user_login", + "action": "logged-in", + "module": "auditd", + "category": "user-login" + }, + "user": { + "name_map": { + "uid": "root" + }, + "auid": "unset", + "uid": "0" + }, + "process": { + "pid": "32141", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "79.137.64.132" + }, + "beat": { + "version": "7.0.0-alpha1", + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "c9S3UmcBTFzn_XoLgcD-", + "source": { + "@timestamp": "2018-11-27T01:10:16.339Z", + "host": { + "name": "demo-stack-redis-01" + }, + "source": { + "ip": "79.137.64.132" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "sequence": 186334, + "result": "fail", + "session": "unset", + "data": { + "acct": "(invalid user)", + "terminal": "sshd", + "op": "login" + }, + "summary": { + "how": "/usr/sbin/sshd", + "actor": { + "secondary": "(invalid user)", + "primary": "unset" + }, + "object": { + "primary": "sshd", + "secondary": "79.137.64.132", + "type": "user-session" + } + } + }, + "event": { + "type": "user_login", + "action": "logged-in", + "module": "auditd", + "category": "user-login" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "exe": "/usr/sbin/sshd", + "pid": "32141" + }, + "beat": { + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "dNS3UmcBTFzn_XoLgcD-", + "source": { + "@timestamp": "2018-11-27T01:10:16.445Z", + "beat": { + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-redis-01" + }, + "source": { + "ip": "79.137.64.132" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "sequence": 186335, + "result": "fail", + "session": "unset", + "data": { + "hostname": "79.137.64.132", + "terminal": "ssh", + "op": "PAM:bad_ident" + }, + "summary": { + "actor": { + "secondary": "root", + "primary": "unset" + }, + "object": { + "secondary": "79.137.64.132", + "type": "user-session", + "primary": "ssh" + }, + "how": "/usr/sbin/sshd" + } + }, + "event": { + "category": "user-login", + "type": "user_err", + "action": "error", + "module": "auditd" + }, + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + }, + "process": { + "pid": "32141", + "exe": "/usr/sbin/sshd" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "u9S3UmcBTFzn_XoLh8GC", + "source": { + "@timestamp": "2018-11-27T01:10:17.752Z", + "auditd": { + "data": { + "hostname": "107.170.65.109", + "terminal": "ssh", + "op": "PAM:bad_ident" + }, + "summary": { + "actor": { + "secondary": "root", + "primary": "unset" + }, + "object": { + "secondary": "107.170.65.109", + "type": "user-session", + "primary": "ssh" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 186336, + "result": "fail", + "session": "unset" + }, + "beat": { + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-redis-01" + }, + "event": { + "action": "error", + "module": "auditd", + "category": "user-login", + "type": "user_err" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "pid": "32148", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "107.170.65.109" + }, + "network": { + "direction": "incoming" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "Z9S2UmcBTFzn_XoLtK-X", + "source": { + "@timestamp": "2018-11-27T01:09:23.757Z", + "network": { + "direction": "incoming" + }, + "auditd": { + "sequence": 192482, + "result": "fail", + "session": "unset", + "data": { + "acct": "(unknown user)", + "op": "login", + "terminal": "sshd" + }, + "summary": { + "object": { + "primary": "sshd", + "secondary": "109.202.18.235", + "type": "user-session" + }, + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + } + } + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + }, + "user": { + "name_map": { + "uid": "root" + }, + "uid": "0", + "auid": "unset" + }, + "host": { + "name": "demo-stack-nginx-01" + }, + "beat": { + "name": "demo-stack-nginx-01", + "hostname": "demo-stack-nginx-01", + "version": "7.0.0-alpha1" + }, + "process": { + "pid": "397", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "109.202.18.235" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "aNS2UmcBTFzn_XoLtK-X", + "source": { + "@timestamp": "2018-11-27T01:09:23.758Z", + "process": { + "pid": "397", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "109.202.18.235" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "data": { + "terminal": "sshd", + "op": "login", + "acct": "(invalid user)" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + }, + "object": { + "primary": "sshd", + "secondary": "109.202.18.235", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 192483, + "result": "fail", + "session": "unset" + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + }, + "beat": { + "name": "demo-stack-nginx-01", + "hostname": "demo-stack-nginx-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-nginx-01" + }, + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "adS2UmcBTFzn_XoLtK-X", + "source": { + "@timestamp": "2018-11-27T01:09:23.948Z", + "source": { + "ip": "109.202.18.235" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "sequence": 192484, + "result": "fail", + "session": "unset", + "data": { + "hostname": "109.202.18.235", + "terminal": "ssh", + "op": "PAM:bad_ident" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "root" + }, + "object": { + "type": "user-session", + "primary": "ssh", + "secondary": "109.202.18.235" + }, + "how": "/usr/sbin/sshd" + } + }, + "beat": { + "name": "demo-stack-nginx-01", + "hostname": "demo-stack-nginx-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-nginx-01" + }, + "event": { + "action": "error", + "module": "auditd", + "category": "user-login", + "type": "user_err" + }, + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + }, + "process": { + "exe": "/usr/sbin/sshd", + "pid": "397" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "BdS4UmcBTFzn_XoLFs5k", + "source": { + "@timestamp": "2018-11-27T01:10:54.329Z", + "auditd": { + "sequence": 184330, + "result": "fail", + "session": "unset", + "data": { + "terminal": "sshd", + "acct": "(unknown user)", + "op": "login" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + }, + "object": { + "secondary": "188.68.54.39", + "type": "user-session", + "primary": "sshd" + }, + "how": "/usr/sbin/sshd" + } + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + }, + "user": { + "uid": "0", + "auid": "unset", + "name_map": { + "uid": "root" + } + }, + "process": { + "pid": "25297", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "188.68.54.39" + }, + "beat": { + "name": "demo-stack-apache-01", + "hostname": "demo-stack-apache-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-apache-01" + }, + "network": { + "direction": "incoming" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "BtS4UmcBTFzn_XoLFs5k", + "source": { + "@timestamp": "2018-11-27T01:10:54.330Z", + "auditd": { + "sequence": 184331, + "result": "fail", + "session": "unset", + "data": { + "op": "login", + "terminal": "sshd", + "acct": "(invalid user)" + }, + "summary": { + "object": { + "primary": "sshd", + "secondary": "188.68.54.39", + "type": "user-session" + }, + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + } + } + }, + "event": { + "action": "logged-in", + "module": "auditd", + "category": "user-login", + "type": "user_login" + }, + "user": { + "name_map": { + "uid": "root" + }, + "uid": "0", + "auid": "unset" + }, + "process": { + "pid": "25297", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "188.68.54.39" + }, + "beat": { + "version": "7.0.0-alpha1", + "name": "demo-stack-apache-01", + "hostname": "demo-stack-apache-01" + }, + "host": { + "name": "demo-stack-apache-01" + }, + "network": { + "direction": "incoming" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "B9S4UmcBTFzn_XoLFs5k", + "source": { + "@timestamp": "2018-11-27T01:10:54.443Z", + "source": { + "ip": "188.68.54.39" + }, + "beat": { + "name": "demo-stack-apache-01", + "hostname": "demo-stack-apache-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-apache-01" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "sequence": 184332, + "result": "fail", + "session": "unset", + "data": { + "terminal": "ssh", + "hostname": "188.68.54.39", + "op": "PAM:bad_ident" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "root" + }, + "object": { + "primary": "ssh", + "secondary": "188.68.54.39", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + } + }, + "event": { + "module": "auditd", + "category": "user-login", + "type": "user_err", + "action": "error" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "pid": "25297", + "exe": "/usr/sbin/sshd" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "F9S2UmcBTFzn_XoLf6s6", + "source": { + "@timestamp": "2018-11-27T01:09:10.091Z", + "network": { + "direction": "incoming" + }, + "auditd": { + "result": "fail", + "session": "unset", + "data": { + "terminal": "sshd", + "op": "login", + "acct": "(unknown user)" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + }, + "object": { + "primary": "sshd", + "secondary": "46.148.18.163", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 186329 + }, + "host": { + "name": "demo-stack-redis-01" + }, + "beat": { + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1" + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + }, + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + }, + "process": { + "pid": "32135", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "46.148.18.163" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "GNS2UmcBTFzn_XoLf6s6", + "source": { + "@timestamp": "2018-11-27T01:09:10.092Z", + "user": { + "auid": "unset", + "uid": "0", + "name_map": { + "uid": "root" + } + }, + "process": { + "pid": "32135", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "46.148.18.163" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "session": "unset", + "data": { + "acct": "(invalid user)", + "terminal": "sshd", + "op": "login" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + }, + "object": { + "primary": "sshd", + "secondary": "46.148.18.163", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 186330, + "result": "fail" + }, + "beat": { + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-redis-01" + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "GdS2UmcBTFzn_XoLf6s6", + "source": { + "@timestamp": "2018-11-27T01:09:10.235Z", + "event": { + "category": "user-login", + "type": "user_err", + "action": "error", + "module": "auditd" + }, + "beat": { + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-redis-01" + }, + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + }, + "process": { + "exe": "/usr/sbin/sshd", + "pid": "32135" + }, + "source": { + "ip": "46.148.18.163" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "data": { + "op": "PAM:bad_ident", + "terminal": "ssh", + "hostname": "46.148.18.163" + }, + "summary": { + "how": "/usr/sbin/sshd", + "actor": { + "secondary": "root", + "primary": "unset" + }, + "object": { + "primary": "ssh", + "secondary": "46.148.18.163", + "type": "user-session" + } + }, + "sequence": 186331, + "result": "fail", + "session": "unset" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "l9S2UmcBTFzn_XoLxbHN", + "source": { + "@timestamp": "2018-11-27T01:09:28.162Z", + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + }, + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + }, + "process": { + "pid": "399", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "103.68.38.86" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "sequence": 192485, + "result": "fail", + "session": "unset", + "data": { + "acct": "(unknown user)", + "op": "login", + "terminal": "sshd" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + }, + "object": { + "primary": "sshd", + "secondary": "103.68.38.86", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + } + }, + "beat": { + "hostname": "demo-stack-nginx-01", + "version": "7.0.0-alpha1", + "name": "demo-stack-nginx-01" + }, + "host": { + "name": "demo-stack-nginx-01" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "mNS2UmcBTFzn_XoLxbHN", + "source": { + "@timestamp": "2018-11-27T01:09:28.163Z", + "beat": { + "name": "demo-stack-nginx-01", + "hostname": "demo-stack-nginx-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-nginx-01" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "result": "fail", + "session": "unset", + "data": { + "acct": "(invalid user)", + "op": "login", + "terminal": "sshd" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + }, + "object": { + "type": "user-session", + "primary": "sshd", + "secondary": "103.68.38.86" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 192486 + }, + "event": { + "module": "auditd", + "category": "user-login", + "type": "user_login", + "action": "logged-in" + }, + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + }, + "process": { + "exe": "/usr/sbin/sshd", + "pid": "399" + }, + "source": { + "ip": "103.68.38.86" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "mdS2UmcBTFzn_XoLxbHN", + "source": { + "@timestamp": "2018-11-27T01:09:28.435Z", + "auditd": { + "summary": { + "object": { + "primary": "ssh", + "secondary": "103.68.38.86", + "type": "user-session" + }, + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "root" + } + }, + "sequence": 192487, + "result": "fail", + "session": "unset", + "data": { + "hostname": "103.68.38.86", + "op": "PAM:bad_ident", + "terminal": "ssh" + } + }, + "event": { + "module": "auditd", + "category": "user-login", + "type": "user_err", + "action": "error" + }, + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + }, + "process": { + "pid": "399", + "exe": "/usr/sbin/sshd" + }, + "beat": { + "hostname": "demo-stack-nginx-01", + "version": "7.0.0-alpha1", + "name": "demo-stack-nginx-01" + }, + "host": { + "name": "demo-stack-nginx-01" + }, + "source": { + "ip": "103.68.38.86" + }, + "network": { + "direction": "incoming" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "KdS3UmcBTFzn_XoL-8sa", + "source": { + "@timestamp": "2018-11-27T01:10:47.311Z", + "event": { + "module": "auditd", + "category": "user-login", + "type": "user_login", + "action": "logged-in" + }, + "user": { + "uid": "0", + "auid": "unset", + "name_map": { + "uid": "root" + } + }, + "process": { + "pid": "29142", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "51.38.37.69" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "sequence": 44155, + "result": "fail", + "session": "unset", + "data": { + "terminal": "sshd", + "acct": "(unknown user)", + "op": "login" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + }, + "object": { + "primary": "sshd", + "secondary": "51.38.37.69", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + } + }, + "beat": { + "name": "demo-stack-es-01", + "hostname": "demo-stack-es-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-es-01" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "KtS3UmcBTFzn_XoL-8sa", + "source": { + "@timestamp": "2018-11-27T01:10:47.315Z", + "beat": { + "version": "7.0.0-alpha1", + "name": "demo-stack-es-01", + "hostname": "demo-stack-es-01" + }, + "host": { + "name": "demo-stack-es-01" + }, + "user": { + "name_map": { + "uid": "root" + }, + "auid": "unset", + "uid": "0" + }, + "process": { + "pid": "29142", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "51.38.37.69" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "summary": { + "actor": { + "secondary": "(invalid user)", + "primary": "unset" + }, + "object": { + "primary": "sshd", + "secondary": "51.38.37.69", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 44156, + "result": "fail", + "session": "unset", + "data": { + "acct": "(invalid user)", + "op": "login", + "terminal": "sshd" + } + }, + "event": { + "module": "auditd", + "category": "user-login", + "type": "user_login", + "action": "logged-in" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "K9S3UmcBTFzn_XoL-8sa", + "source": { + "@timestamp": "2018-11-27T01:10:47.419Z", + "auditd": { + "data": { + "terminal": "ssh", + "hostname": "51.38.37.69", + "op": "PAM:bad_ident" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "root" + }, + "object": { + "type": "user-session", + "primary": "ssh", + "secondary": "51.38.37.69" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 44157, + "result": "fail", + "session": "unset" + }, + "event": { + "action": "error", + "module": "auditd", + "category": "user-login", + "type": "user_err" + }, + "beat": { + "name": "demo-stack-es-01", + "hostname": "demo-stack-es-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-es-01" + }, + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + }, + "process": { + "exe": "/usr/sbin/sshd", + "pid": "29142" + }, + "source": { + "ip": "51.38.37.69" + }, + "network": { + "direction": "incoming" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "itS2UmcBTFzn_XoLlayd", + "source": { + "@timestamp": "2018-11-27T01:09:15.827Z", + "event": { + "category": "user-login", + "type": "user_err", + "action": "error", + "module": "auditd" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "pid": "32137", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "107.170.65.109" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "result": "fail", + "session": "unset", + "data": { + "terminal": "ssh", + "hostname": "107.170.65.109", + "op": "PAM:bad_ident" + }, + "summary": { + "object": { + "primary": "ssh", + "secondary": "107.170.65.109", + "type": "user-session" + }, + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "root" + } + }, + "sequence": 186332 + }, + "beat": { + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-redis-01" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "I9S3UmcBTFzn_XoLlcLB", + "source": { + "@timestamp": "2018-11-27T01:10:21.397Z", + "event": { + "action": "error", + "module": "auditd", + "category": "user-login", + "type": "user_err" + }, + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + }, + "beat": { + "name": "demo-stack-es-01", + "hostname": "demo-stack-es-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-es-01" + }, + "process": { + "pid": "29135", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "142.93.31.198" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "session": "unset", + "data": { + "terminal": "ssh", + "op": "PAM:bad_ident", + "hostname": "142.93.31.198" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "root" + }, + "object": { + "primary": "ssh", + "secondary": "142.93.31.198", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 44154, + "result": "fail" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "PdW9UmcBTFzn_XoLr0tl", + "source": { + "@timestamp": "2018-11-27T01:17:01.176Z", + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "exe": "/usr/sbin/cron", + "pid": "29271" + }, + "auditd": { + "sequence": 44173, + "result": "success", + "session": "unset", + "data": { + "op": "PAM:accounting", + "acct": "root", + "terminal": "cron" + }, + "summary": { + "object": { + "primary": "cron", + "type": "user-session" + }, + "how": "/usr/sbin/cron", + "actor": { + "secondary": "root", + "primary": "unset" + } + } + }, + "event": { + "type": "user_acct", + "action": "was-authorized", + "module": "auditd", + "category": "user-login" + }, + "beat": { + "hostname": "demo-stack-es-01", + "version": "7.0.0-alpha1", + "name": "demo-stack-es-01" + }, + "host": { + "name": "demo-stack-es-01" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "PtW9UmcBTFzn_XoLr0tl", + "source": { + "@timestamp": "2018-11-27T01:17:01.176Z", + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + }, + "process": { + "pid": "29271", + "exe": "/usr/sbin/cron" + }, + "auditd": { + "summary": { + "object": { + "type": "user-session", + "primary": "cron" + }, + "how": "/usr/sbin/cron", + "actor": { + "primary": "unset", + "secondary": "root" + } + }, + "sequence": 44174, + "result": "success", + "session": "unset", + "data": { + "acct": "root", + "op": "PAM:setcred", + "terminal": "cron" + } + }, + "event": { + "type": "cred_acq", + "action": "acquired-credentials", + "module": "auditd", + "category": "user-login" + }, + "beat": { + "version": "7.0.0-alpha1", + "name": "demo-stack-es-01", + "hostname": "demo-stack-es-01" + }, + "host": { + "name": "demo-stack-es-01" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "P9W9UmcBTFzn_XoLr0tl", + "source": { + "@timestamp": "2018-11-27T01:17:01.180Z", + "process": { + "pid": "29271", + "exe": "/usr/sbin/cron" + }, + "auditd": { + "sequence": 44176, + "result": "success", + "session": "1444", + "data": { + "op": "PAM:session_open", + "terminal": "cron", + "acct": "root" + }, + "summary": { + "actor": { + "primary": "root", + "secondary": "root" + }, + "object": { + "primary": "cron", + "type": "user-session" + }, + "how": "/usr/sbin/cron" + } + }, + "event": { + "type": "user_start", + "action": "started-session", + "module": "auditd", + "category": "user-login" + }, + "user": { + "uid": "0", + "name_map": { + "auid": "root", + "uid": "root" + }, + "auid": "0" + }, + "beat": { + "name": "demo-stack-es-01", + "hostname": "demo-stack-es-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-es-01" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "QNW9UmcBTFzn_XoLr0tl", + "source": { + "@timestamp": "2018-11-27T01:17:01.180Z", + "process": { + "pid": "29271", + "exe": "/usr/sbin/cron" + }, + "auditd": { + "sequence": 44177, + "result": "success", + "session": "1444", + "data": { + "op": "PAM:setcred", + "acct": "root", + "terminal": "cron" + }, + "summary": { + "actor": { + "primary": "root", + "secondary": "root" + }, + "object": { + "primary": "cron", + "type": "user-session" + }, + "how": "/usr/sbin/cron" + } + }, + "beat": { + "name": "demo-stack-es-01", + "hostname": "demo-stack-es-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-es-01" + }, + "event": { + "action": "disposed-credentials", + "module": "auditd", + "category": "user-login", + "type": "cred_disp" + }, + "user": { + "name_map": { + "auid": "root", + "uid": "root" + }, + "uid": "0", + "auid": "0" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "QdW9UmcBTFzn_XoLr0tl", + "source": { + "@timestamp": "2018-11-27T01:17:01.180Z", + "user": { + "auid": "0", + "name_map": { + "auid": "root", + "uid": "root" + }, + "uid": "0" + }, + "process": { + "pid": "29271", + "exe": "/usr/sbin/cron" + }, + "auditd": { + "sequence": 44178, + "result": "success", + "session": "1444", + "data": { + "op": "PAM:session_close", + "acct": "root", + "terminal": "cron" + }, + "summary": { + "object": { + "primary": "cron", + "type": "user-session" + }, + "how": "/usr/sbin/cron", + "actor": { + "secondary": "root", + "primary": "root" + } + } + }, + "beat": { + "name": "demo-stack-es-01", + "hostname": "demo-stack-es-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-es-01" + }, + "event": { + "module": "auditd", + "category": "user-login", + "type": "user_end", + "action": "ended-session" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "QtW9UmcBTFzn_XoLr0ty", + "source": { + "@timestamp": "2018-11-27T01:17:01.191Z", + "event": { + "category": "user-login", + "type": "user_acct", + "action": "was-authorized", + "module": "auditd" + }, + "user": { + "name_map": { + "uid": "root" + }, + "auid": "unset", + "uid": "0" + }, + "process": { + "pid": "19593", + "exe": "/usr/sbin/cron" + }, + "auditd": { + "summary": { + "actor": { + "primary": "unset", + "secondary": "root" + }, + "object": { + "type": "user-session", + "primary": "cron" + }, + "how": "/usr/sbin/cron" + }, + "sequence": 142321, + "result": "success", + "session": "unset", + "data": { + "acct": "root", + "op": "PAM:accounting", + "terminal": "cron" + } + }, + "beat": { + "name": "demo-stack-haproxy-01", + "hostname": "demo-stack-haproxy-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-haproxy-01" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "Q9W9UmcBTFzn_XoLr0ty", + "source": { + "@timestamp": "2018-11-27T01:17:01.191Z", + "process": { + "pid": "19593", + "exe": "/usr/sbin/cron" + }, + "auditd": { + "data": { + "terminal": "cron", + "op": "PAM:setcred", + "acct": "root" + }, + "summary": { + "how": "/usr/sbin/cron", + "actor": { + "secondary": "root", + "primary": "unset" + }, + "object": { + "primary": "cron", + "type": "user-session" + } + }, + "sequence": 142322, + "result": "success", + "session": "unset" + }, + "host": { + "name": "demo-stack-haproxy-01" + }, + "beat": { + "name": "demo-stack-haproxy-01", + "hostname": "demo-stack-haproxy-01", + "version": "7.0.0-alpha1" + }, + "event": { + "action": "acquired-credentials", + "module": "auditd", + "category": "user-login", + "type": "cred_acq" + }, + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "RNW9UmcBTFzn_XoLr0ty", + "source": { + "@timestamp": "2018-11-27T01:17:01.193Z", + "host": { + "name": "demo-stack-haproxy-01" + }, + "event": { + "module": "auditd", + "category": "user-login", + "type": "user_start", + "action": "started-session" + }, + "user": { + "name_map": { + "auid": "root", + "uid": "root" + }, + "uid": "0", + "auid": "0" + }, + "process": { + "pid": "19593", + "exe": "/usr/sbin/cron" + }, + "auditd": { + "sequence": 142324, + "result": "success", + "session": "3503", + "data": { + "acct": "root", + "terminal": "cron", + "op": "PAM:session_open" + }, + "summary": { + "actor": { + "secondary": "root", + "primary": "root" + }, + "object": { + "primary": "cron", + "type": "user-session" + }, + "how": "/usr/sbin/cron" + } + }, + "beat": { + "name": "demo-stack-haproxy-01", + "hostname": "demo-stack-haproxy-01", + "version": "7.0.0-alpha1" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "RdW9UmcBTFzn_XoLr0ty", + "source": { + "@timestamp": "2018-11-27T01:17:01.196Z", + "user": { + "auid": "0", + "name_map": { + "auid": "root", + "uid": "root" + }, + "uid": "0" + }, + "process": { + "pid": "19593", + "exe": "/usr/sbin/cron" + }, + "beat": { + "name": "demo-stack-haproxy-01", + "hostname": "demo-stack-haproxy-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-haproxy-01" + }, + "auditd": { + "summary": { + "actor": { + "primary": "root", + "secondary": "root" + }, + "object": { + "primary": "cron", + "type": "user-session" + }, + "how": "/usr/sbin/cron" + }, + "sequence": 142325, + "result": "success", + "session": "3503", + "data": { + "acct": "root", + "terminal": "cron", + "op": "PAM:setcred" + } + }, + "event": { + "category": "user-login", + "type": "cred_disp", + "action": "disposed-credentials", + "module": "auditd" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "RtW9UmcBTFzn_XoLr0ty", + "source": { + "@timestamp": "2018-11-27T01:17:01.196Z", + "event": { + "category": "user-login", + "type": "user_end", + "action": "ended-session", + "module": "auditd" + }, + "user": { + "auid": "0", + "name_map": { + "auid": "root", + "uid": "root" + }, + "uid": "0" + }, + "process": { + "pid": "19593", + "exe": "/usr/sbin/cron" + }, + "beat": { + "name": "demo-stack-haproxy-01", + "hostname": "demo-stack-haproxy-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-haproxy-01" + }, + "auditd": { + "data": { + "op": "PAM:session_close", + "terminal": "cron", + "acct": "root" + }, + "summary": { + "object": { + "type": "user-session", + "primary": "cron" + }, + "how": "/usr/sbin/cron", + "actor": { + "primary": "root", + "secondary": "root" + } + }, + "sequence": 142326, + "result": "success", + "session": "3503" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "WdW9UmcBTFzn_XoLr0uP", + "source": { + "@timestamp": "2018-11-27T01:17:01.214Z", + "host": { + "name": "demo-stack-mysql-01" + }, + "process": { + "pid": "12641", + "exe": "/usr/sbin/cron" + }, + "auditd": { + "data": { + "terminal": "cron", + "op": "PAM:accounting", + "acct": "root" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "root" + }, + "object": { + "primary": "cron", + "type": "user-session" + }, + "how": "/usr/sbin/cron" + }, + "sequence": 43155, + "result": "success", + "session": "unset" + }, + "event": { + "category": "user-login", + "type": "user_acct", + "action": "was-authorized", + "module": "auditd" + }, + "user": { + "uid": "0", + "auid": "unset", + "name_map": { + "uid": "root" + } + }, + "beat": { + "name": "demo-stack-mysql-01", + "hostname": "demo-stack-mysql-01", + "version": "7.0.0-alpha1" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "WtW9UmcBTFzn_XoLr0uP", + "source": { + "@timestamp": "2018-11-27T01:17:01.214Z", + "user": { + "name_map": { + "uid": "root" + }, + "uid": "0", + "auid": "unset" + }, + "process": { + "pid": "12641", + "exe": "/usr/sbin/cron" + }, + "auditd": { + "result": "success", + "session": "unset", + "data": { + "op": "PAM:setcred", + "terminal": "cron", + "acct": "root" + }, + "summary": { + "how": "/usr/sbin/cron", + "actor": { + "primary": "unset", + "secondary": "root" + }, + "object": { + "primary": "cron", + "type": "user-session" + } + }, + "sequence": 43156 + }, + "beat": { + "name": "demo-stack-mysql-01", + "hostname": "demo-stack-mysql-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-mysql-01" + }, + "event": { + "module": "auditd", + "category": "user-login", + "type": "cred_acq", + "action": "acquired-credentials" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "W9W9UmcBTFzn_XoLr0uP", + "source": { + "@timestamp": "2018-11-27T01:17:01.218Z", + "host": { + "name": "demo-stack-mysql-01" + }, + "event": { + "category": "user-login", + "type": "user_start", + "action": "started-session", + "module": "auditd" + }, + "user": { + "auid": "0", + "uid": "0", + "name_map": { + "uid": "root", + "auid": "root" + } + }, + "process": { + "exe": "/usr/sbin/cron", + "pid": "12641" + }, + "auditd": { + "data": { + "op": "PAM:session_open", + "terminal": "cron", + "acct": "root" + }, + "summary": { + "actor": { + "primary": "root", + "secondary": "root" + }, + "object": { + "primary": "cron", + "type": "user-session" + }, + "how": "/usr/sbin/cron" + }, + "sequence": 43158, + "result": "success", + "session": "1252" + }, + "beat": { + "name": "demo-stack-mysql-01", + "hostname": "demo-stack-mysql-01", + "version": "7.0.0-alpha1" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "XNW9UmcBTFzn_XoLr0uP", + "source": { + "@timestamp": "2018-11-27T01:17:01.218Z", + "auditd": { + "sequence": 43159, + "result": "success", + "session": "1252", + "data": { + "terminal": "cron", + "acct": "root", + "op": "PAM:setcred" + }, + "summary": { + "actor": { + "primary": "root", + "secondary": "root" + }, + "object": { + "primary": "cron", + "type": "user-session" + }, + "how": "/usr/sbin/cron" + } + }, + "beat": { + "hostname": "demo-stack-mysql-01", + "version": "7.0.0-alpha1", + "name": "demo-stack-mysql-01" + }, + "host": { + "name": "demo-stack-mysql-01" + }, + "event": { + "module": "auditd", + "category": "user-login", + "type": "cred_disp", + "action": "disposed-credentials" + }, + "user": { + "uid": "0", + "auid": "0", + "name_map": { + "auid": "root", + "uid": "root" + } + }, + "process": { + "pid": "12641", + "exe": "/usr/sbin/cron" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "XdW9UmcBTFzn_XoLr0uP", + "source": { + "@timestamp": "2018-11-27T01:17:01.222Z", + "process": { + "pid": "12641", + "exe": "/usr/sbin/cron" + }, + "auditd": { + "session": "1252", + "data": { + "terminal": "cron", + "op": "PAM:session_close", + "acct": "root" + }, + "summary": { + "actor": { + "primary": "root", + "secondary": "root" + }, + "object": { + "primary": "cron", + "type": "user-session" + }, + "how": "/usr/sbin/cron" + }, + "sequence": 43160, + "result": "success" + }, + "beat": { + "name": "demo-stack-mysql-01", + "hostname": "demo-stack-mysql-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-mysql-01" + }, + "event": { + "action": "ended-session", + "module": "auditd", + "category": "user-login", + "type": "user_end" + }, + "user": { + "auid": "0", + "name_map": { + "auid": "root", + "uid": "root" + }, + "uid": "0" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "adW9UmcBTFzn_XoLsUvf", + "source": { + "@timestamp": "2018-11-27T01:17:01.812Z", + "event": { + "module": "auditd", + "category": "user-login", + "type": "user_acct", + "action": "was-authorized" + }, + "user": { + "uid": "0", + "auid": "unset", + "name_map": { + "uid": "root" + } + }, + "host": { + "name": "demo-stack-apache-01" + }, + "beat": { + "name": "demo-stack-apache-01", + "hostname": "demo-stack-apache-01", + "version": "7.0.0-alpha1" + }, + "process": { + "pid": "25339", + "exe": "/usr/sbin/cron" + }, + "auditd": { + "sequence": 184337, + "result": "success", + "session": "unset", + "data": { + "op": "PAM:accounting", + "terminal": "cron", + "acct": "root" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "root" + }, + "object": { + "primary": "cron", + "type": "user-session" + }, + "how": "/usr/sbin/cron" + } + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "atW9UmcBTFzn_XoLsUvf", + "source": { + "@timestamp": "2018-11-27T01:17:01.813Z", + "host": { + "name": "demo-stack-apache-01" + }, + "event": { + "action": "acquired-credentials", + "module": "auditd", + "category": "user-login", + "type": "cred_acq" + }, + "user": { + "auid": "unset", + "uid": "0", + "name_map": { + "uid": "root" + } + }, + "process": { + "pid": "25339", + "exe": "/usr/sbin/cron" + }, + "auditd": { + "summary": { + "actor": { + "secondary": "root", + "primary": "unset" + }, + "object": { + "primary": "cron", + "type": "user-session" + }, + "how": "/usr/sbin/cron" + }, + "sequence": 184338, + "result": "success", + "session": "unset", + "data": { + "acct": "root", + "op": "PAM:setcred", + "terminal": "cron" + } + }, + "beat": { + "version": "7.0.0-alpha1", + "name": "demo-stack-apache-01", + "hostname": "demo-stack-apache-01" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "a9W9UmcBTFzn_XoLsUvf", + "source": { + "@timestamp": "2018-11-27T01:17:01.814Z", + "user": { + "auid": "0", + "name_map": { + "auid": "root", + "uid": "root" + }, + "uid": "0" + }, + "process": { + "pid": "25339", + "exe": "/usr/sbin/cron" + }, + "auditd": { + "data": { + "terminal": "cron", + "op": "PAM:session_open", + "acct": "root" + }, + "summary": { + "object": { + "primary": "cron", + "type": "user-session" + }, + "how": "/usr/sbin/cron", + "actor": { + "primary": "root", + "secondary": "root" + } + }, + "sequence": 184340, + "result": "success", + "session": "9858" + }, + "event": { + "module": "auditd", + "category": "user-login", + "type": "user_start", + "action": "started-session" + }, + "beat": { + "hostname": "demo-stack-apache-01", + "version": "7.0.0-alpha1", + "name": "demo-stack-apache-01" + }, + "host": { + "name": "demo-stack-apache-01" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "bNW9UmcBTFzn_XoLsUvf", + "source": { + "@timestamp": "2018-11-27T01:17:01.817Z", + "process": { + "pid": "25339", + "exe": "/usr/sbin/cron" + }, + "beat": { + "name": "demo-stack-apache-01", + "hostname": "demo-stack-apache-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-apache-01" + }, + "auditd": { + "result": "success", + "session": "9858", + "data": { + "acct": "root", + "terminal": "cron", + "op": "PAM:setcred" + }, + "summary": { + "actor": { + "secondary": "root", + "primary": "root" + }, + "object": { + "primary": "cron", + "type": "user-session" + }, + "how": "/usr/sbin/cron" + }, + "sequence": 184341 + }, + "event": { + "type": "cred_disp", + "action": "disposed-credentials", + "module": "auditd", + "category": "user-login" + }, + "user": { + "uid": "0", + "name_map": { + "auid": "root", + "uid": "root" + }, + "auid": "0" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "bdW9UmcBTFzn_XoLsUvf", + "source": { + "@timestamp": "2018-11-27T01:17:01.818Z", + "event": { + "category": "user-login", + "type": "user_end", + "action": "ended-session", + "module": "auditd" + }, + "user": { + "name_map": { + "auid": "root", + "uid": "root" + }, + "auid": "0", + "uid": "0" + }, + "process": { + "exe": "/usr/sbin/cron", + "pid": "25339" + }, + "auditd": { + "summary": { + "actor": { + "primary": "root", + "secondary": "root" + }, + "object": { + "primary": "cron", + "type": "user-session" + }, + "how": "/usr/sbin/cron" + }, + "sequence": 184342, + "result": "success", + "session": "9858", + "data": { + "acct": "root", + "op": "PAM:session_close", + "terminal": "cron" + } + }, + "host": { + "name": "demo-stack-apache-01" + }, + "beat": { + "hostname": "demo-stack-apache-01", + "version": "7.0.0-alpha1", + "name": "demo-stack-apache-01" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "a9W-UmcBTFzn_XoL5GZq", + "source": { + "@timestamp": "2018-11-27T01:18:20.287Z", + "host": { + "name": "demo-stack-haproxy-01" + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + }, + "user": { + "auid": "unset", + "uid": "0", + "name_map": { + "uid": "root" + } + }, + "process": { + "pid": "19602", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "209.59.65.109" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "summary": { + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + }, + "object": { + "type": "user-session", + "primary": "sshd", + "secondary": "209.59.65.109" + } + }, + "sequence": 142327, + "result": "fail", + "session": "unset", + "data": { + "acct": "(unknown user)", + "op": "login", + "terminal": "sshd" + } + }, + "beat": { + "name": "demo-stack-haproxy-01", + "hostname": "demo-stack-haproxy-01", + "version": "7.0.0-alpha1" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "bNW-UmcBTFzn_XoL5GZq", + "source": { + "@timestamp": "2018-11-27T01:18:20.288Z", + "source": { + "ip": "209.59.65.109" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "sequence": 142328, + "result": "fail", + "session": "unset", + "data": { + "op": "login", + "acct": "(invalid user)", + "terminal": "sshd" + }, + "summary": { + "actor": { + "secondary": "(invalid user)", + "primary": "unset" + }, + "object": { + "type": "user-session", + "primary": "sshd", + "secondary": "209.59.65.109" + }, + "how": "/usr/sbin/sshd" + } + }, + "event": { + "action": "logged-in", + "module": "auditd", + "category": "user-login", + "type": "user_login" + }, + "user": { + "name_map": { + "uid": "root" + }, + "uid": "0", + "auid": "unset" + }, + "process": { + "pid": "19602", + "exe": "/usr/sbin/sshd" + }, + "beat": { + "name": "demo-stack-haproxy-01", + "hostname": "demo-stack-haproxy-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-haproxy-01" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "bdW-UmcBTFzn_XoL5GZq", + "source": { + "@timestamp": "2018-11-27T01:18:20.382Z", + "auditd": { + "sequence": 142329, + "result": "fail", + "session": "unset", + "data": { + "terminal": "ssh", + "hostname": "209.59.65.109", + "op": "PAM:bad_ident" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "root" + }, + "object": { + "primary": "ssh", + "secondary": "209.59.65.109", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + } + }, + "beat": { + "version": "7.0.0-alpha1", + "name": "demo-stack-haproxy-01", + "hostname": "demo-stack-haproxy-01" + }, + "host": { + "name": "demo-stack-haproxy-01" + }, + "event": { + "action": "error", + "module": "auditd", + "category": "user-login", + "type": "user_err" + }, + "user": { + "auid": "unset", + "uid": "0", + "name_map": { + "uid": "root" + } + }, + "process": { + "pid": "19602", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "209.59.65.109" + }, + "network": { + "direction": "incoming" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "h9W-UmcBTFzn_XoL6WZS", + "source": { + "@timestamp": "2018-11-27T01:18:21.543Z", + "host": { + "name": "demo-stack-haproxy-01" + }, + "beat": { + "name": "demo-stack-haproxy-01", + "hostname": "demo-stack-haproxy-01", + "version": "7.0.0-alpha1" + }, + "source": { + "ip": "95.156.31.74" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "data": { + "acct": "(unknown user)", + "terminal": "sshd", + "op": "login" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + }, + "object": { + "type": "user-session", + "primary": "sshd", + "secondary": "95.156.31.74" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 142330, + "result": "fail", + "session": "unset" + }, + "event": { + "type": "user_login", + "action": "logged-in", + "module": "auditd", + "category": "user-login" + }, + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + }, + "process": { + "pid": "19604", + "exe": "/usr/sbin/sshd" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "iNW-UmcBTFzn_XoL6WZS", + "source": { + "@timestamp": "2018-11-27T01:18:21.545Z", + "beat": { + "name": "demo-stack-haproxy-01", + "hostname": "demo-stack-haproxy-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-haproxy-01" + }, + "event": { + "type": "user_login", + "action": "logged-in", + "module": "auditd", + "category": "user-login" + }, + "user": { + "name_map": { + "uid": "root" + }, + "auid": "unset", + "uid": "0" + }, + "process": { + "pid": "19604", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "95.156.31.74" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "sequence": 142331, + "result": "fail", + "session": "unset", + "data": { + "terminal": "sshd", + "acct": "(invalid user)", + "op": "login" + }, + "summary": { + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + }, + "object": { + "secondary": "95.156.31.74", + "type": "user-session", + "primary": "sshd" + } + } + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "idW-UmcBTFzn_XoL6WZS", + "source": { + "@timestamp": "2018-11-27T01:18:21.689Z", + "event": { + "module": "auditd", + "category": "user-login", + "type": "user_err", + "action": "error" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "pid": "19604", + "exe": "/usr/sbin/sshd" + }, + "beat": { + "name": "demo-stack-haproxy-01", + "hostname": "demo-stack-haproxy-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-haproxy-01" + }, + "source": { + "ip": "95.156.31.74" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "result": "fail", + "session": "unset", + "data": { + "terminal": "ssh", + "op": "PAM:bad_ident", + "hostname": "95.156.31.74" + }, + "summary": { + "object": { + "secondary": "95.156.31.74", + "type": "user-session", + "primary": "ssh" + }, + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "root" + } + }, + "sequence": 142332 + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "39W_UmcBTFzn_XoLD2nn", + "source": { + "@timestamp": "2018-11-27T01:18:31.420Z", + "beat": { + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-redis-01" + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "pid": "32215", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "107.170.65.109" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "session": "unset", + "data": { + "terminal": "sshd", + "op": "login", + "acct": "(unknown user)" + }, + "summary": { + "object": { + "primary": "sshd", + "secondary": "107.170.65.109", + "type": "user-session" + }, + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + } + }, + "sequence": 186386, + "result": "fail" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "4NW_UmcBTFzn_XoLD2nn", + "source": { + "@timestamp": "2018-11-27T01:18:31.421Z", + "event": { + "action": "logged-in", + "module": "auditd", + "category": "user-login", + "type": "user_login" + }, + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + }, + "process": { + "pid": "32215", + "exe": "/usr/sbin/sshd" + }, + "beat": { + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-redis-01" + }, + "source": { + "ip": "107.170.65.109" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "sequence": 186387, + "result": "fail", + "session": "unset", + "data": { + "acct": "(invalid user)", + "op": "login", + "terminal": "sshd" + }, + "summary": { + "actor": { + "secondary": "(invalid user)", + "primary": "unset" + }, + "object": { + "type": "user-session", + "primary": "sshd", + "secondary": "107.170.65.109" + }, + "how": "/usr/sbin/sshd" + } + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "4dW_UmcBTFzn_XoLD2nn", + "source": { + "@timestamp": "2018-11-27T01:18:31.453Z", + "process": { + "exe": "/usr/sbin/sshd", + "pid": "32215" + }, + "source": { + "ip": "107.170.65.109" + }, + "network": { + "direction": "incoming" + }, + "beat": { + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1", + "name": "demo-stack-redis-01" + }, + "host": { + "name": "demo-stack-redis-01" + }, + "auditd": { + "data": { + "terminal": "ssh", + "op": "PAM:bad_ident", + "hostname": "107.170.65.109" + }, + "summary": { + "actor": { + "secondary": "root", + "primary": "unset" + }, + "object": { + "primary": "ssh", + "secondary": "107.170.65.109", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 186388, + "result": "fail", + "session": "unset" + }, + "event": { + "action": "error", + "module": "auditd", + "category": "user-login", + "type": "user_err" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "adW_UmcBTFzn_XoLeXOw", + "source": { + "@timestamp": "2018-11-27T01:18:58.502Z", + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "pid": "32217", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "46.148.18.163" + }, + "beat": { + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1", + "name": "demo-stack-redis-01" + }, + "host": { + "name": "demo-stack-redis-01" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "sequence": 186389, + "result": "fail", + "session": "unset", + "data": { + "acct": "(unknown user)", + "op": "login", + "terminal": "sshd" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + }, + "object": { + "secondary": "46.148.18.163", + "type": "user-session", + "primary": "sshd" + }, + "how": "/usr/sbin/sshd" + } + }, + "event": { + "module": "auditd", + "category": "user-login", + "type": "user_login", + "action": "logged-in" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "atW_UmcBTFzn_XoLeXOw", + "source": { + "@timestamp": "2018-11-27T01:18:58.503Z", + "host": { + "name": "demo-stack-redis-01" + }, + "auditd": { + "session": "unset", + "data": { + "acct": "(invalid user)", + "terminal": "sshd", + "op": "login" + }, + "summary": { + "object": { + "secondary": "46.148.18.163", + "type": "user-session", + "primary": "sshd" + }, + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + } + }, + "sequence": 186390, + "result": "fail" + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "pid": "32217", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "46.148.18.163" + }, + "network": { + "direction": "incoming" + }, + "beat": { + "version": "7.0.0-alpha1", + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "a9W_UmcBTFzn_XoLeXOw", + "source": { + "@timestamp": "2018-11-27T01:18:58.645Z", + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + }, + "process": { + "pid": "32217", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "46.148.18.163" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "data": { + "terminal": "ssh", + "op": "PAM:bad_ident", + "hostname": "46.148.18.163" + }, + "summary": { + "object": { + "primary": "ssh", + "secondary": "46.148.18.163", + "type": "user-session" + }, + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "root" + } + }, + "sequence": 186391, + "result": "fail", + "session": "unset" + }, + "beat": { + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-redis-01" + }, + "event": { + "action": "error", + "module": "auditd", + "category": "user-login", + "type": "user_err" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "ctW-UmcBTFzn_XoLJVU7", + "source": { + "@timestamp": "2018-11-27T01:17:31.345Z", + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "pid": "32207", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "107.170.65.109" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "sequence": 186383, + "result": "fail", + "session": "unset", + "data": { + "terminal": "sshd", + "op": "login", + "acct": "(unknown user)" + }, + "summary": { + "actor": { + "secondary": "(unknown user)", + "primary": "unset" + }, + "object": { + "primary": "sshd", + "secondary": "107.170.65.109", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + } + }, + "beat": { + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-redis-01" + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "c9W-UmcBTFzn_XoLJVU7", + "source": { + "@timestamp": "2018-11-27T01:17:31.346Z", + "event": { + "action": "logged-in", + "module": "auditd", + "category": "user-login", + "type": "user_login" + }, + "beat": { + "version": "7.0.0-alpha1", + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01" + }, + "host": { + "name": "demo-stack-redis-01" + }, + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + }, + "process": { + "pid": "32207", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "107.170.65.109" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "summary": { + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + }, + "object": { + "type": "user-session", + "primary": "sshd", + "secondary": "107.170.65.109" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 186384, + "result": "fail", + "session": "unset", + "data": { + "terminal": "sshd", + "acct": "(invalid user)", + "op": "login" + } + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "dNW-UmcBTFzn_XoLJVU7", + "source": { + "@timestamp": "2018-11-27T01:17:31.378Z", + "process": { + "pid": "32207", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "107.170.65.109" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "summary": { + "actor": { + "primary": "unset", + "secondary": "root" + }, + "object": { + "primary": "ssh", + "secondary": "107.170.65.109", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 186385, + "result": "fail", + "session": "unset", + "data": { + "terminal": "ssh", + "hostname": "107.170.65.109", + "op": "PAM:bad_ident" + } + }, + "beat": { + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-redis-01" + }, + "event": { + "action": "error", + "module": "auditd", + "category": "user-login", + "type": "user_err" + }, + "user": { + "name_map": { + "uid": "root" + }, + "auid": "unset", + "uid": "0" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "rdW9UmcBTFzn_XoLfkeK", + "source": { + "@timestamp": "2018-11-27T01:16:48.669Z", + "source": { + "ip": "115.146.127.132" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "data": { + "op": "login", + "terminal": "sshd", + "acct": "(unknown user)" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + }, + "object": { + "primary": "sshd", + "secondary": "115.146.127.132", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 43152, + "result": "fail", + "session": "unset" + }, + "beat": { + "hostname": "demo-stack-mysql-01", + "version": "7.0.0-alpha1", + "name": "demo-stack-mysql-01" + }, + "host": { + "name": "demo-stack-mysql-01" + }, + "event": { + "type": "user_login", + "action": "logged-in", + "module": "auditd", + "category": "user-login" + }, + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + }, + "process": { + "pid": "12639", + "exe": "/usr/sbin/sshd" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "rtW9UmcBTFzn_XoLfkeK", + "source": { + "@timestamp": "2018-11-27T01:16:48.669Z", + "auditd": { + "summary": { + "object": { + "primary": "sshd", + "secondary": "115.146.127.132", + "type": "user-session" + }, + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + } + }, + "sequence": 43153, + "result": "fail", + "session": "unset", + "data": { + "acct": "(invalid user)", + "op": "login", + "terminal": "sshd" + } + }, + "beat": { + "name": "demo-stack-mysql-01", + "hostname": "demo-stack-mysql-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-mysql-01" + }, + "event": { + "type": "user_login", + "action": "logged-in", + "module": "auditd", + "category": "user-login" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "pid": "12639", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "115.146.127.132" + }, + "network": { + "direction": "incoming" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "r9W9UmcBTFzn_XoLfkeK", + "source": { + "@timestamp": "2018-11-27T01:16:48.873Z", + "host": { + "name": "demo-stack-mysql-01" + }, + "beat": { + "hostname": "demo-stack-mysql-01", + "version": "7.0.0-alpha1", + "name": "demo-stack-mysql-01" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "sequence": 43154, + "result": "fail", + "session": "unset", + "data": { + "hostname": "115.146.127.132", + "op": "PAM:bad_ident", + "terminal": "ssh" + }, + "summary": { + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "root" + }, + "object": { + "type": "user-session", + "primary": "ssh", + "secondary": "115.146.127.132" + } + } + }, + "event": { + "module": "auditd", + "category": "user-login", + "type": "user_err", + "action": "error" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "pid": "12639", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "115.146.127.132" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "y9W9UmcBTFzn_XoLUUI6", + "source": { + "@timestamp": "2018-11-27T01:16:37.072Z", + "process": { + "exe": "/usr/sbin/sshd", + "pid": "32202" + }, + "source": { + "ip": "107.170.65.109" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "data": { + "op": "login", + "terminal": "sshd", + "acct": "(unknown user)" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + }, + "object": { + "primary": "sshd", + "secondary": "107.170.65.109", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 186374, + "result": "fail", + "session": "unset" + }, + "event": { + "type": "user_login", + "action": "logged-in", + "module": "auditd", + "category": "user-login" + }, + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + }, + "host": { + "name": "demo-stack-redis-01" + }, + "beat": { + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "zNW9UmcBTFzn_XoLUUI6", + "source": { + "@timestamp": "2018-11-27T01:16:37.073Z", + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + }, + "host": { + "name": "demo-stack-redis-01" + }, + "beat": { + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1" + }, + "user": { + "auid": "unset", + "uid": "0", + "name_map": { + "uid": "root" + } + }, + "process": { + "exe": "/usr/sbin/sshd", + "pid": "32202" + }, + "source": { + "ip": "107.170.65.109" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "sequence": 186375, + "result": "fail", + "session": "unset", + "data": { + "op": "login", + "acct": "(invalid user)", + "terminal": "sshd" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + }, + "object": { + "type": "user-session", + "primary": "sshd", + "secondary": "107.170.65.109" + }, + "how": "/usr/sbin/sshd" + } + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "zdW9UmcBTFzn_XoLUUI6", + "source": { + "@timestamp": "2018-11-27T01:16:37.104Z", + "network": { + "direction": "incoming" + }, + "auditd": { + "summary": { + "actor": { + "primary": "unset", + "secondary": "root" + }, + "object": { + "primary": "ssh", + "secondary": "107.170.65.109", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 186376, + "result": "fail", + "session": "unset", + "data": { + "terminal": "ssh", + "hostname": "107.170.65.109", + "op": "PAM:bad_ident" + } + }, + "beat": { + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-redis-01" + }, + "event": { + "category": "user-login", + "type": "user_err", + "action": "error", + "module": "auditd" + }, + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + }, + "process": { + "exe": "/usr/sbin/sshd", + "pid": "32202" + }, + "source": { + "ip": "107.170.65.109" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "btW9UmcBTFzn_XoLskuL", + "source": { + "@timestamp": "2018-11-27T01:17:01.885Z", + "auditd": { + "data": { + "op": "PAM:accounting", + "terminal": "cron", + "acct": "root" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "root" + }, + "object": { + "primary": "cron", + "type": "user-session" + }, + "how": "/usr/sbin/cron" + }, + "sequence": 186377, + "result": "success", + "session": "unset" + }, + "event": { + "type": "user_acct", + "action": "was-authorized", + "module": "auditd", + "category": "user-login" + }, + "user": { + "uid": "0", + "auid": "unset", + "name_map": { + "uid": "root" + } + }, + "beat": { + "version": "7.0.0-alpha1", + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01" + }, + "host": { + "name": "demo-stack-redis-01" + }, + "process": { + "pid": "32204", + "exe": "/usr/sbin/cron" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "b9W9UmcBTFzn_XoLskuL", + "source": { + "@timestamp": "2018-11-27T01:17:01.886Z", + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + }, + "process": { + "exe": "/usr/sbin/cron", + "pid": "32204" + }, + "auditd": { + "result": "success", + "session": "unset", + "data": { + "op": "PAM:setcred", + "acct": "root", + "terminal": "cron" + }, + "summary": { + "actor": { + "secondary": "root", + "primary": "unset" + }, + "object": { + "primary": "cron", + "type": "user-session" + }, + "how": "/usr/sbin/cron" + }, + "sequence": 186378 + }, + "event": { + "category": "user-login", + "type": "cred_acq", + "action": "acquired-credentials", + "module": "auditd" + }, + "beat": { + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-redis-01" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "cNW9UmcBTFzn_XoLskuL", + "source": { + "@timestamp": "2018-11-27T01:17:01.887Z", + "auditd": { + "summary": { + "object": { + "primary": "cron", + "type": "user-session" + }, + "how": "/usr/sbin/cron", + "actor": { + "secondary": "root", + "primary": "root" + } + }, + "sequence": 186380, + "result": "success", + "session": "3511", + "data": { + "acct": "root", + "terminal": "cron", + "op": "PAM:session_open" + } + }, + "event": { + "category": "user-login", + "type": "user_start", + "action": "started-session", + "module": "auditd" + }, + "user": { + "name_map": { + "auid": "root", + "uid": "root" + }, + "uid": "0", + "auid": "0" + }, + "beat": { + "version": "7.0.0-alpha1", + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01" + }, + "host": { + "name": "demo-stack-redis-01" + }, + "process": { + "pid": "32204", + "exe": "/usr/sbin/cron" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "cdW9UmcBTFzn_XoLskuL", + "source": { + "@timestamp": "2018-11-27T01:17:01.890Z", + "beat": { + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-redis-01" + }, + "event": { + "type": "cred_disp", + "action": "disposed-credentials", + "module": "auditd", + "category": "user-login" + }, + "user": { + "auid": "0", + "name_map": { + "auid": "root", + "uid": "root" + }, + "uid": "0" + }, + "process": { + "pid": "32204", + "exe": "/usr/sbin/cron" + }, + "auditd": { + "sequence": 186381, + "result": "success", + "session": "3511", + "data": { + "op": "PAM:setcred", + "terminal": "cron", + "acct": "root" + }, + "summary": { + "actor": { + "primary": "root", + "secondary": "root" + }, + "object": { + "primary": "cron", + "type": "user-session" + }, + "how": "/usr/sbin/cron" + } + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "ctW9UmcBTFzn_XoLskuL", + "source": { + "@timestamp": "2018-11-27T01:17:01.891Z", + "process": { + "pid": "32204", + "exe": "/usr/sbin/cron" + }, + "auditd": { + "data": { + "acct": "root", + "op": "PAM:session_close", + "terminal": "cron" + }, + "summary": { + "actor": { + "secondary": "root", + "primary": "root" + }, + "object": { + "primary": "cron", + "type": "user-session" + }, + "how": "/usr/sbin/cron" + }, + "sequence": 186382, + "result": "success", + "session": "3511" + }, + "event": { + "type": "user_end", + "action": "ended-session", + "module": "auditd", + "category": "user-login" + }, + "user": { + "name_map": { + "auid": "root", + "uid": "root" + }, + "auid": "0", + "uid": "0" + }, + "beat": { + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1", + "name": "demo-stack-redis-01" + }, + "host": { + "name": "demo-stack-redis-01" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "c9W9UmcBTFzn_XoLskuR", + "source": { + "@timestamp": "2018-11-27T01:17:01.987Z", + "user": { + "name_map": { + "uid": "root" + }, + "auid": "unset", + "uid": "0" + }, + "process": { + "exe": "/usr/sbin/cron", + "pid": "458" + }, + "auditd": { + "summary": { + "object": { + "primary": "cron", + "type": "user-session" + }, + "how": "/usr/sbin/cron", + "actor": { + "secondary": "root", + "primary": "unset" + } + }, + "sequence": 192494, + "result": "success", + "session": "unset", + "data": { + "op": "PAM:accounting", + "acct": "root", + "terminal": "cron" + } + }, + "event": { + "module": "auditd", + "category": "user-login", + "type": "user_acct", + "action": "was-authorized" + }, + "beat": { + "name": "demo-stack-nginx-01", + "hostname": "demo-stack-nginx-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-nginx-01" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "dNW9UmcBTFzn_XoLskuR", + "source": { + "@timestamp": "2018-11-27T01:17:01.988Z", + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "pid": "458", + "exe": "/usr/sbin/cron" + }, + "auditd": { + "sequence": 192495, + "result": "success", + "session": "unset", + "data": { + "terminal": "cron", + "acct": "root", + "op": "PAM:setcred" + }, + "summary": { + "how": "/usr/sbin/cron", + "actor": { + "primary": "unset", + "secondary": "root" + }, + "object": { + "type": "user-session", + "primary": "cron" + } + } + }, + "host": { + "name": "demo-stack-nginx-01" + }, + "beat": { + "hostname": "demo-stack-nginx-01", + "version": "7.0.0-alpha1", + "name": "demo-stack-nginx-01" + }, + "event": { + "type": "cred_acq", + "action": "acquired-credentials", + "module": "auditd", + "category": "user-login" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "ddW9UmcBTFzn_XoLskuR", + "source": { + "@timestamp": "2018-11-27T01:17:01.989Z", + "beat": { + "name": "demo-stack-nginx-01", + "hostname": "demo-stack-nginx-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-nginx-01" + }, + "event": { + "category": "user-login", + "type": "user_start", + "action": "started-session", + "module": "auditd" + }, + "user": { + "auid": "0", + "name_map": { + "auid": "root", + "uid": "root" + }, + "uid": "0" + }, + "process": { + "pid": "458", + "exe": "/usr/sbin/cron" + }, + "auditd": { + "session": "9862", + "data": { + "terminal": "cron", + "acct": "root", + "op": "PAM:session_open" + }, + "summary": { + "object": { + "primary": "cron", + "type": "user-session" + }, + "how": "/usr/sbin/cron", + "actor": { + "secondary": "root", + "primary": "root" + } + }, + "sequence": 192497, + "result": "success" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "dtW9UmcBTFzn_XoLskuR", + "source": { + "@timestamp": "2018-11-27T01:17:01.992Z", + "event": { + "category": "user-login", + "type": "cred_disp", + "action": "disposed-credentials", + "module": "auditd" + }, + "user": { + "name_map": { + "auid": "root", + "uid": "root" + }, + "uid": "0", + "auid": "0" + }, + "process": { + "pid": "458", + "exe": "/usr/sbin/cron" + }, + "auditd": { + "session": "9862", + "data": { + "acct": "root", + "op": "PAM:setcred", + "terminal": "cron" + }, + "summary": { + "actor": { + "secondary": "root", + "primary": "root" + }, + "object": { + "primary": "cron", + "type": "user-session" + }, + "how": "/usr/sbin/cron" + }, + "sequence": 192498, + "result": "success" + }, + "host": { + "name": "demo-stack-nginx-01" + }, + "beat": { + "name": "demo-stack-nginx-01", + "hostname": "demo-stack-nginx-01", + "version": "7.0.0-alpha1" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "d9W9UmcBTFzn_XoLskuR", + "source": { + "@timestamp": "2018-11-27T01:17:01.993Z", + "event": { + "category": "user-login", + "type": "user_end", + "action": "ended-session", + "module": "auditd" + }, + "user": { + "name_map": { + "auid": "root", + "uid": "root" + }, + "auid": "0", + "uid": "0" + }, + "process": { + "pid": "458", + "exe": "/usr/sbin/cron" + }, + "auditd": { + "summary": { + "object": { + "primary": "cron", + "type": "user-session" + }, + "how": "/usr/sbin/cron", + "actor": { + "primary": "root", + "secondary": "root" + } + }, + "sequence": 192499, + "result": "success", + "session": "9862", + "data": { + "terminal": "cron", + "acct": "root", + "op": "PAM:session_close" + } + }, + "beat": { + "name": "demo-stack-nginx-01", + "hostname": "demo-stack-nginx-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-nginx-01" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "p9W_UmcBTFzn_XoLs3cF", + "source": { + "@timestamp": "2018-11-27T01:19:13.179Z", + "beat": { + "name": "demo-stack-apache-01", + "hostname": "demo-stack-apache-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-apache-01" + }, + "event": { + "module": "file_integrity", + "action": [ + "created" + ] + }, + "file": { + "uid": 0, + "owner": "root", + "inode": "121", + "mtime": "2018-11-27T01:19:13.174Z", + "size": 20, + "type": "file", + "gid": 0, + "mode": "0000", + "path": "/etc/sed4Tvfpv", + "ctime": "2018-11-27T01:19:13.174Z", + "group": "root" + }, + "hash": { + "sha1": "c7f9a550b77ece79052aa1a630098b911883abde" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "qNW_UmcBTFzn_XoLs3cF", + "source": { + "@timestamp": "2018-11-27T01:19:13.180Z", + "event": { + "module": "file_integrity", + "action": [ + "updated" + ] + }, + "file": { + "group": "root", + "inode": "121", + "gid": 0, + "type": "file", + "mtime": "2018-11-27T01:19:13.178Z", + "ctime": "2018-11-27T01:19:13.178Z", + "uid": 0, + "mode": "0000", + "owner": "root", + "path": "/etc/sed4Tvfpv", + "size": 51 + }, + "hash": { + "sha1": "4dac5cd40b12d209e8a87bf8089fadab9edfca00" + }, + "beat": { + "name": "demo-stack-apache-01", + "hostname": "demo-stack-apache-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-apache-01" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "qdW_UmcBTFzn_XoLs3cF", + "source": { + "@timestamp": "2018-11-27T01:19:13.187Z", + "file": { + "path": "/etc/sed4Tvfpv" + }, + "beat": { + "name": "demo-stack-apache-01", + "hostname": "demo-stack-apache-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-apache-01" + }, + "event": { + "module": "file_integrity", + "action": [ + "attributes_modified" + ] + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "qtW_UmcBTFzn_XoLs3cF", + "source": { + "@timestamp": "2018-11-27T01:19:13.188Z", + "event": { + "action": [ + "moved" + ], + "module": "file_integrity" + }, + "file": { + "path": "/etc/sed4Tvfpv" + }, + "beat": { + "version": "7.0.0-alpha1", + "name": "demo-stack-apache-01", + "hostname": "demo-stack-apache-01" + }, + "host": { + "name": "demo-stack-apache-01" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "q9W_UmcBTFzn_XoLs3cF", + "source": { + "@timestamp": "2018-11-27T01:19:13.195Z", + "event": { + "module": "file_integrity", + "action": [ + "created" + ] + }, + "file": { + "type": "file", + "owner": "root", + "mtime": "2018-11-27T01:19:13.178Z", + "ctime": "2018-11-27T01:19:13.178Z", + "group": "root", + "path": "/etc/hosts", + "gid": 0, + "uid": 0, + "inode": "121", + "mode": "0644", + "size": 209 + }, + "hash": { + "sha1": "ac0139feba2533b2670370c22551547341fde295" + }, + "beat": { + "name": "demo-stack-apache-01", + "hostname": "demo-stack-apache-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-apache-01" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "XNbJUmcBTFzn_XoL6leU", + "source": { + "@timestamp": "2018-11-27T01:30:22.705Z", + "event": { + "module": "auditd", + "category": "user-login", + "type": "user_login", + "action": "logged-in" + }, + "beat": { + "version": "7.0.0-alpha1", + "name": "demo-stack-apache-01", + "hostname": "demo-stack-apache-01" + }, + "host": { + "name": "demo-stack-apache-01" + }, + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + }, + "process": { + "pid": "25784", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "152.245.204.82" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "result": "fail", + "session": "unset", + "data": { + "op": "login", + "terminal": "sshd", + "acct": "(unknown user)" + }, + "summary": { + "object": { + "primary": "sshd", + "secondary": "152.245.204.82", + "type": "user-session" + }, + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + } + }, + "sequence": 184359 + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "XdbJUmcBTFzn_XoL6leU", + "source": { + "@timestamp": "2018-11-27T01:30:22.707Z", + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "pid": "25784", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "152.245.204.82" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "session": "unset", + "data": { + "op": "login", + "acct": "(invalid user)", + "terminal": "sshd" + }, + "summary": { + "actor": { + "secondary": "(invalid user)", + "primary": "unset" + }, + "object": { + "secondary": "152.245.204.82", + "type": "user-session", + "primary": "sshd" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 184360, + "result": "fail" + }, + "beat": { + "hostname": "demo-stack-apache-01", + "version": "7.0.0-alpha1", + "name": "demo-stack-apache-01" + }, + "host": { + "name": "demo-stack-apache-01" + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "XtbJUmcBTFzn_XoL6leU", + "source": { + "@timestamp": "2018-11-27T01:30:22.717Z", + "event": { + "module": "auditd", + "category": "user-login", + "type": "user_login", + "action": "logged-in" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "exe": "/usr/sbin/sshd", + "pid": "25783" + }, + "source": { + "ip": "152.245.204.82" + }, + "beat": { + "name": "demo-stack-apache-01", + "hostname": "demo-stack-apache-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-apache-01" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "sequence": 184361, + "result": "fail", + "session": "unset", + "data": { + "terminal": "sshd", + "acct": "(unknown user)", + "op": "login" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + }, + "object": { + "secondary": "152.245.204.82", + "type": "user-session", + "primary": "sshd" + }, + "how": "/usr/sbin/sshd" + } + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "X9bJUmcBTFzn_XoL6leU", + "source": { + "@timestamp": "2018-11-27T01:30:22.719Z", + "beat": { + "name": "demo-stack-apache-01", + "hostname": "demo-stack-apache-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-apache-01" + }, + "auditd": { + "sequence": 184362, + "result": "fail", + "session": "unset", + "data": { + "op": "login", + "terminal": "sshd", + "acct": "(invalid user)" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + }, + "object": { + "type": "user-session", + "primary": "sshd", + "secondary": "152.245.204.82" + }, + "how": "/usr/sbin/sshd" + } + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + }, + "user": { + "uid": "0", + "auid": "unset", + "name_map": { + "uid": "root" + } + }, + "process": { + "pid": "25783", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "152.245.204.82" + }, + "network": { + "direction": "incoming" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "YNbJUmcBTFzn_XoL6leU", + "source": { + "@timestamp": "2018-11-27T01:30:22.897Z", + "event": { + "category": "user-login", + "type": "user_err", + "action": "error", + "module": "auditd" + }, + "user": { + "auid": "unset", + "uid": "0", + "name_map": { + "uid": "root" + } + }, + "process": { + "pid": "25784", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "152.245.204.82" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "data": { + "hostname": "152.245.204.82", + "terminal": "ssh", + "op": "PAM:bad_ident" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "root" + }, + "object": { + "primary": "ssh", + "secondary": "152.245.204.82", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 184363, + "result": "fail", + "session": "unset" + }, + "beat": { + "name": "demo-stack-apache-01", + "hostname": "demo-stack-apache-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-apache-01" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "YdbJUmcBTFzn_XoL6leU", + "source": { + "@timestamp": "2018-11-27T01:30:22.918Z", + "network": { + "direction": "incoming" + }, + "auditd": { + "result": "fail", + "session": "unset", + "data": { + "op": "PAM:bad_ident", + "terminal": "ssh", + "hostname": "152.245.204.82" + }, + "summary": { + "how": "/usr/sbin/sshd", + "actor": { + "secondary": "root", + "primary": "unset" + }, + "object": { + "type": "user-session", + "primary": "ssh", + "secondary": "152.245.204.82" + } + }, + "sequence": 184364 + }, + "event": { + "category": "user-login", + "type": "user_err", + "action": "error", + "module": "auditd" + }, + "user": { + "name_map": { + "uid": "root" + }, + "auid": "unset", + "uid": "0" + }, + "process": { + "exe": "/usr/sbin/sshd", + "pid": "25783" + }, + "beat": { + "name": "demo-stack-apache-01", + "hostname": "demo-stack-apache-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-apache-01" + }, + "source": { + "ip": "152.245.204.82" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "DNbKUmcBTFzn_XoLGlxF", + "source": { + "@timestamp": "2018-11-27T01:30:34.971Z", + "event": { + "action": "logged-in", + "module": "auditd", + "category": "user-login", + "type": "user_login" + }, + "user": { + "name_map": { + "uid": "root" + }, + "auid": "unset", + "uid": "0" + }, + "process": { + "pid": "32299", + "exe": "/usr/sbin/sshd" + }, + "beat": { + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1", + "name": "demo-stack-redis-01" + }, + "host": { + "name": "demo-stack-redis-01" + }, + "source": { + "ip": "107.170.65.109" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "result": "fail", + "session": "unset", + "data": { + "op": "login", + "acct": "(unknown user)", + "terminal": "sshd" + }, + "summary": { + "actor": { + "secondary": "(unknown user)", + "primary": "unset" + }, + "object": { + "secondary": "107.170.65.109", + "type": "user-session", + "primary": "sshd" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 186434 + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "DdbKUmcBTFzn_XoLGlxF", + "source": { + "@timestamp": "2018-11-27T01:30:34.972Z", + "event": { + "type": "user_login", + "action": "logged-in", + "module": "auditd", + "category": "user-login" + }, + "user": { + "name_map": { + "uid": "root" + }, + "uid": "0", + "auid": "unset" + }, + "process": { + "exe": "/usr/sbin/sshd", + "pid": "32299" + }, + "source": { + "ip": "107.170.65.109" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "data": { + "acct": "(invalid user)", + "terminal": "sshd", + "op": "login" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + }, + "object": { + "primary": "sshd", + "secondary": "107.170.65.109", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 186435, + "result": "fail", + "session": "unset" + }, + "beat": { + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-redis-01" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "DtbKUmcBTFzn_XoLGlxF", + "source": { + "@timestamp": "2018-11-27T01:30:35.002Z", + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + }, + "process": { + "pid": "32299", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "107.170.65.109" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "sequence": 186436, + "result": "fail", + "session": "unset", + "data": { + "hostname": "107.170.65.109", + "terminal": "ssh", + "op": "PAM:bad_ident" + }, + "summary": { + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "root" + }, + "object": { + "type": "user-session", + "primary": "ssh", + "secondary": "107.170.65.109" + } + } + }, + "beat": { + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-redis-01" + }, + "event": { + "module": "auditd", + "category": "user-login", + "type": "user_err", + "action": "error" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "r9bJUmcBTFzn_XoLAkOP", + "source": { + "@timestamp": "2018-11-27T01:29:23.365Z", + "user": { + "uid": "0", + "auid": "unset", + "name_map": { + "uid": "root" + } + }, + "process": { + "pid": "32290", + "exe": "/usr/sbin/sshd" + }, + "beat": { + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-redis-01" + }, + "source": { + "ip": "107.170.65.109" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "sequence": 186431, + "result": "fail", + "session": "unset", + "data": { + "terminal": "sshd", + "acct": "(unknown user)", + "op": "login" + }, + "summary": { + "actor": { + "secondary": "(unknown user)", + "primary": "unset" + }, + "object": { + "secondary": "107.170.65.109", + "type": "user-session", + "primary": "sshd" + }, + "how": "/usr/sbin/sshd" + } + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "sNbJUmcBTFzn_XoLAkOP", + "source": { + "@timestamp": "2018-11-27T01:29:23.366Z", + "host": { + "name": "demo-stack-redis-01" + }, + "event": { + "module": "auditd", + "category": "user-login", + "type": "user_login", + "action": "logged-in" + }, + "user": { + "auid": "unset", + "uid": "0", + "name_map": { + "uid": "root" + } + }, + "process": { + "exe": "/usr/sbin/sshd", + "pid": "32290" + }, + "source": { + "ip": "107.170.65.109" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "result": "fail", + "session": "unset", + "data": { + "acct": "(invalid user)", + "op": "login", + "terminal": "sshd" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + }, + "object": { + "primary": "sshd", + "secondary": "107.170.65.109", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 186432 + }, + "beat": { + "version": "7.0.0-alpha1", + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "sdbJUmcBTFzn_XoLAkOP", + "source": { + "@timestamp": "2018-11-27T01:29:23.397Z", + "source": { + "ip": "107.170.65.109" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "sequence": 186433, + "result": "fail", + "session": "unset", + "data": { + "hostname": "107.170.65.109", + "terminal": "ssh", + "op": "PAM:bad_ident" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "root" + }, + "object": { + "primary": "ssh", + "secondary": "107.170.65.109", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + } + }, + "event": { + "type": "user_err", + "action": "error", + "module": "auditd", + "category": "user-login" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "beat": { + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-redis-01" + }, + "process": { + "exe": "/usr/sbin/sshd", + "pid": "32290" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "KtbLUmcBTFzn_XoLIXLc", + "source": { + "@timestamp": "2018-11-27T01:31:42.449Z", + "auditd": { + "sequence": 186437, + "result": "fail", + "session": "unset", + "data": { + "op": "login", + "terminal": "sshd", + "acct": "(unknown user)" + }, + "summary": { + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + }, + "object": { + "primary": "sshd", + "secondary": "107.170.65.109", + "type": "user-session" + } + } + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + }, + "user": { + "uid": "0", + "auid": "unset", + "name_map": { + "uid": "root" + } + }, + "process": { + "pid": "32307", + "exe": "/usr/sbin/sshd" + }, + "beat": { + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-redis-01" + }, + "source": { + "ip": "107.170.65.109" + }, + "network": { + "direction": "incoming" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "K9bLUmcBTFzn_XoLIXLc", + "source": { + "@timestamp": "2018-11-27T01:31:42.450Z", + "beat": { + "version": "7.0.0-alpha1", + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01" + }, + "host": { + "name": "demo-stack-redis-01" + }, + "event": { + "action": "logged-in", + "module": "auditd", + "category": "user-login", + "type": "user_login" + }, + "user": { + "auid": "unset", + "uid": "0", + "name_map": { + "uid": "root" + } + }, + "process": { + "exe": "/usr/sbin/sshd", + "pid": "32307" + }, + "source": { + "ip": "107.170.65.109" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "data": { + "terminal": "sshd", + "acct": "(invalid user)", + "op": "login" + }, + "summary": { + "object": { + "primary": "sshd", + "secondary": "107.170.65.109", + "type": "user-session" + }, + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + } + }, + "sequence": 186438, + "result": "fail", + "session": "unset" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "LNbLUmcBTFzn_XoLIXLc", + "source": { + "@timestamp": "2018-11-27T01:31:42.481Z", + "process": { + "exe": "/usr/sbin/sshd", + "pid": "32307" + }, + "source": { + "ip": "107.170.65.109" + }, + "host": { + "name": "demo-stack-redis-01" + }, + "beat": { + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "sequence": 186439, + "result": "fail", + "session": "unset", + "data": { + "terminal": "ssh", + "op": "PAM:bad_ident", + "hostname": "107.170.65.109" + }, + "summary": { + "object": { + "type": "user-session", + "primary": "ssh", + "secondary": "107.170.65.109" + }, + "how": "/usr/sbin/sshd", + "actor": { + "secondary": "root", + "primary": "unset" + } + } + }, + "event": { + "action": "error", + "module": "auditd", + "category": "user-login", + "type": "user_err" + }, + "user": { + "name_map": { + "uid": "root" + }, + "auid": "unset", + "uid": "0" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "udbLUmcBTFzn_XoLfHlZ", + "source": { + "@timestamp": "2018-11-27T01:32:05.615Z", + "host": { + "name": "demo-stack-nginx-01" + }, + "beat": { + "name": "demo-stack-nginx-01", + "hostname": "demo-stack-nginx-01", + "version": "7.0.0-alpha1" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "session": "unset", + "data": { + "terminal": "sshd", + "op": "login", + "acct": "(unknown user)" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + }, + "object": { + "secondary": "173.167.200.227", + "type": "user-session", + "primary": "sshd" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 192532, + "result": "fail" + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + }, + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + }, + "process": { + "exe": "/usr/sbin/sshd", + "pid": "562" + }, + "source": { + "ip": "173.167.200.227" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "utbLUmcBTFzn_XoLfHlZ", + "source": { + "@timestamp": "2018-11-27T01:32:05.616Z", + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "exe": "/usr/sbin/sshd", + "pid": "562" + }, + "beat": { + "name": "demo-stack-nginx-01", + "hostname": "demo-stack-nginx-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-nginx-01" + }, + "source": { + "ip": "173.167.200.227" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "sequence": 192533, + "result": "fail", + "session": "unset", + "data": { + "acct": "(invalid user)", + "op": "login", + "terminal": "sshd" + }, + "summary": { + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + }, + "object": { + "type": "user-session", + "primary": "sshd", + "secondary": "173.167.200.227" + } + } + }, + "event": { + "module": "auditd", + "category": "user-login", + "type": "user_login", + "action": "logged-in" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "u9bLUmcBTFzn_XoLfHlZ", + "source": { + "@timestamp": "2018-11-27T01:32:05.661Z", + "event": { + "module": "auditd", + "category": "user-login", + "type": "user_err", + "action": "error" + }, + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + }, + "process": { + "pid": "562", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "173.167.200.227" + }, + "network": { + "direction": "incoming" + }, + "beat": { + "name": "demo-stack-nginx-01", + "hostname": "demo-stack-nginx-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-nginx-01" + }, + "auditd": { + "session": "unset", + "data": { + "hostname": "173.167.200.227", + "op": "PAM:bad_ident", + "terminal": "ssh" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "root" + }, + "object": { + "primary": "ssh", + "secondary": "173.167.200.227", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 192534, + "result": "fail" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "KtbJUmcBTFzn_XoLK0dG", + "source": { + "@timestamp": "2018-11-27T01:29:33.789Z", + "host": { + "name": "demo-stack-nginx-01" + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + }, + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + }, + "process": { + "pid": "548", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "138.68.50.250" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "summary": { + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + }, + "object": { + "primary": "sshd", + "secondary": "138.68.50.250", + "type": "user-session" + } + }, + "sequence": 192529, + "result": "fail", + "session": "unset", + "data": { + "op": "login", + "acct": "(unknown user)", + "terminal": "sshd" + } + }, + "beat": { + "version": "7.0.0-alpha1", + "name": "demo-stack-nginx-01", + "hostname": "demo-stack-nginx-01" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "K9bJUmcBTFzn_XoLK0dG", + "source": { + "@timestamp": "2018-11-27T01:29:33.789Z", + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + }, + "beat": { + "name": "demo-stack-nginx-01", + "hostname": "demo-stack-nginx-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-nginx-01" + }, + "process": { + "exe": "/usr/sbin/sshd", + "pid": "548" + }, + "source": { + "ip": "138.68.50.250" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "sequence": 192530, + "result": "fail", + "session": "unset", + "data": { + "terminal": "sshd", + "op": "login", + "acct": "(invalid user)" + }, + "summary": { + "object": { + "type": "user-session", + "primary": "sshd", + "secondary": "138.68.50.250" + }, + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + } + } + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "LNbJUmcBTFzn_XoLK0dG", + "source": { + "@timestamp": "2018-11-27T01:29:33.830Z", + "auditd": { + "sequence": 192531, + "result": "fail", + "session": "unset", + "data": { + "hostname": "138.68.50.250", + "terminal": "ssh", + "op": "PAM:bad_ident" + }, + "summary": { + "actor": { + "secondary": "root", + "primary": "unset" + }, + "object": { + "primary": "ssh", + "secondary": "138.68.50.250", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + } + }, + "beat": { + "name": "demo-stack-nginx-01", + "hostname": "demo-stack-nginx-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-nginx-01" + }, + "event": { + "category": "user-login", + "type": "user_err", + "action": "error", + "module": "auditd" + }, + "user": { + "name_map": { + "uid": "root" + }, + "auid": "unset", + "uid": "0" + }, + "process": { + "pid": "548", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "138.68.50.250" + }, + "network": { + "direction": "incoming" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "ZtbKUmcBTFzn_XoLRF8K", + "source": { + "@timestamp": "2018-11-27T01:30:45.664Z", + "process": { + "pid": "29595", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "138.68.249.156" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "sequence": 44189, + "result": "fail", + "session": "unset", + "data": { + "acct": "(unknown user)", + "terminal": "sshd", + "op": "login" + }, + "summary": { + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + }, + "object": { + "secondary": "138.68.249.156", + "type": "user-session", + "primary": "sshd" + } + } + }, + "host": { + "name": "demo-stack-es-01" + }, + "beat": { + "name": "demo-stack-es-01", + "hostname": "demo-stack-es-01", + "version": "7.0.0-alpha1" + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "Z9bKUmcBTFzn_XoLRF8K", + "source": { + "@timestamp": "2018-11-27T01:30:45.664Z", + "beat": { + "name": "demo-stack-es-01", + "hostname": "demo-stack-es-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-es-01" + }, + "event": { + "type": "user_login", + "action": "logged-in", + "module": "auditd", + "category": "user-login" + }, + "user": { + "auid": "unset", + "uid": "0", + "name_map": { + "uid": "root" + } + }, + "process": { + "exe": "/usr/sbin/sshd", + "pid": "29595" + }, + "source": { + "ip": "138.68.249.156" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "result": "fail", + "session": "unset", + "data": { + "op": "login", + "terminal": "sshd", + "acct": "(invalid user)" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + }, + "object": { + "primary": "sshd", + "secondary": "138.68.249.156", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 44190 + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "aNbKUmcBTFzn_XoLRF8K", + "source": { + "@timestamp": "2018-11-27T01:30:45.708Z", + "user": { + "name_map": { + "uid": "root" + }, + "uid": "0", + "auid": "unset" + }, + "process": { + "pid": "29595", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "138.68.249.156" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "sequence": 44191, + "result": "fail", + "session": "unset", + "data": { + "op": "PAM:bad_ident", + "terminal": "ssh", + "hostname": "138.68.249.156" + }, + "summary": { + "actor": { + "secondary": "root", + "primary": "unset" + }, + "object": { + "secondary": "138.68.249.156", + "type": "user-session", + "primary": "ssh" + }, + "how": "/usr/sbin/sshd" + } + }, + "beat": { + "name": "demo-stack-es-01", + "hostname": "demo-stack-es-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-es-01" + }, + "event": { + "action": "error", + "module": "auditd", + "category": "user-login", + "type": "user_err" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "gNbKUmcBTFzn_XoL3Gzp", + "source": { + "@timestamp": "2018-11-27T01:31:24.795Z", + "network": { + "direction": "incoming" + }, + "auditd": { + "session": "unset", + "data": { + "op": "login", + "acct": "(unknown user)", + "terminal": "sshd" + }, + "summary": { + "object": { + "primary": "sshd", + "secondary": "200.160.115.234", + "type": "user-session" + }, + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + } + }, + "sequence": 44192, + "result": "fail" + }, + "beat": { + "hostname": "demo-stack-es-01", + "version": "7.0.0-alpha1", + "name": "demo-stack-es-01" + }, + "host": { + "name": "demo-stack-es-01" + }, + "event": { + "action": "logged-in", + "module": "auditd", + "category": "user-login", + "type": "user_login" + }, + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + }, + "process": { + "pid": "29609", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "200.160.115.234" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "gdbKUmcBTFzn_XoL3Gzp", + "source": { + "@timestamp": "2018-11-27T01:31:24.795Z", + "network": { + "direction": "incoming" + }, + "auditd": { + "result": "fail", + "session": "unset", + "data": { + "terminal": "sshd", + "op": "login", + "acct": "(invalid user)" + }, + "summary": { + "object": { + "primary": "sshd", + "secondary": "200.160.115.234", + "type": "user-session" + }, + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + } + }, + "sequence": 44193 + }, + "beat": { + "version": "7.0.0-alpha1", + "name": "demo-stack-es-01", + "hostname": "demo-stack-es-01" + }, + "host": { + "name": "demo-stack-es-01" + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + }, + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + }, + "process": { + "pid": "29609", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "200.160.115.234" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "gtbKUmcBTFzn_XoL3Gzp", + "source": { + "@timestamp": "2018-11-27T01:31:24.971Z", + "host": { + "name": "demo-stack-es-01" + }, + "auditd": { + "sequence": 44194, + "result": "fail", + "session": "unset", + "data": { + "hostname": "200.160.115.234", + "terminal": "ssh", + "op": "PAM:bad_ident" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "root" + }, + "object": { + "primary": "ssh", + "secondary": "200.160.115.234", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + } + }, + "event": { + "action": "error", + "module": "auditd", + "category": "user-login", + "type": "user_err" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "pid": "29609", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "200.160.115.234" + }, + "network": { + "direction": "incoming" + }, + "beat": { + "name": "demo-stack-es-01", + "hostname": "demo-stack-es-01", + "version": "7.0.0-alpha1" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "CNbKUmcBTFzn_XoLLl55", + "source": { + "@timestamp": "2018-11-27T01:30:40.139Z", + "process": { + "pid": "29592", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "164.132.197.108" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "sequence": 44188, + "result": "fail", + "session": "unset", + "data": { + "hostname": "164.132.197.108", + "op": "PAM:bad_ident", + "terminal": "ssh" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "root" + }, + "object": { + "primary": "ssh", + "secondary": "164.132.197.108", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + } + }, + "beat": { + "hostname": "demo-stack-es-01", + "version": "7.0.0-alpha1", + "name": "demo-stack-es-01" + }, + "host": { + "name": "demo-stack-es-01" + }, + "event": { + "category": "user-login", + "type": "user_err", + "action": "error", + "module": "auditd" + }, + "user": { + "uid": "0", + "auid": "unset", + "name_map": { + "uid": "root" + } + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "YdbNUmcBTFzn_XoLn6nH", + "source": { + "@timestamp": "2018-11-27T01:34:25.758Z", + "source": { + "ip": "107.170.65.109" + }, + "network": { + "direction": "incoming" + }, + "beat": { + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1", + "name": "demo-stack-redis-01" + }, + "host": { + "name": "demo-stack-redis-01" + }, + "auditd": { + "session": "unset", + "data": { + "acct": "(unknown user)", + "terminal": "sshd", + "op": "login" + }, + "summary": { + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + }, + "object": { + "secondary": "107.170.65.109", + "type": "user-session", + "primary": "sshd" + } + }, + "sequence": 186449, + "result": "fail" + }, + "event": { + "module": "auditd", + "category": "user-login", + "type": "user_login", + "action": "logged-in" + }, + "user": { + "name_map": { + "uid": "root" + }, + "uid": "0", + "auid": "unset" + }, + "process": { + "pid": "32327", + "exe": "/usr/sbin/sshd" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "YtbNUmcBTFzn_XoLn6nH", + "source": { + "@timestamp": "2018-11-27T01:34:25.759Z", + "user": { + "auid": "unset", + "uid": "0", + "name_map": { + "uid": "root" + } + }, + "process": { + "pid": "32327", + "exe": "/usr/sbin/sshd" + }, + "beat": { + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-redis-01" + }, + "source": { + "ip": "107.170.65.109" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "result": "fail", + "session": "unset", + "data": { + "op": "login", + "acct": "(invalid user)", + "terminal": "sshd" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + }, + "object": { + "type": "user-session", + "primary": "sshd", + "secondary": "107.170.65.109" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 186450 + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "Y9bNUmcBTFzn_XoLn6nH", + "source": { + "@timestamp": "2018-11-27T01:34:25.789Z", + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + }, + "process": { + "pid": "32327", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "107.170.65.109" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "result": "fail", + "session": "unset", + "data": { + "op": "PAM:bad_ident", + "terminal": "ssh", + "hostname": "107.170.65.109" + }, + "summary": { + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "root" + }, + "object": { + "primary": "ssh", + "secondary": "107.170.65.109", + "type": "user-session" + } + }, + "sequence": 186451 + }, + "event": { + "category": "user-login", + "type": "user_err", + "action": "error", + "module": "auditd" + }, + "beat": { + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1", + "name": "demo-stack-redis-01" + }, + "host": { + "name": "demo-stack-redis-01" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "adbNUmcBTFzn_XoLo6mE", + "source": { + "@timestamp": "2018-11-27T01:34:26.614Z", + "process": { + "pid": "12750", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "101.89.114.94" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "sequence": 43176, + "result": "fail", + "session": "unset", + "data": { + "op": "login", + "terminal": "sshd", + "acct": "(unknown user)" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + }, + "object": { + "primary": "sshd", + "secondary": "101.89.114.94", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + } + }, + "beat": { + "version": "7.0.0-alpha1", + "name": "demo-stack-mysql-01", + "hostname": "demo-stack-mysql-01" + }, + "host": { + "name": "demo-stack-mysql-01" + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "atbNUmcBTFzn_XoLo6mE", + "source": { + "@timestamp": "2018-11-27T01:34:26.614Z", + "beat": { + "version": "7.0.0-alpha1", + "name": "demo-stack-mysql-01", + "hostname": "demo-stack-mysql-01" + }, + "host": { + "name": "demo-stack-mysql-01" + }, + "event": { + "type": "user_login", + "action": "logged-in", + "module": "auditd", + "category": "user-login" + }, + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + }, + "process": { + "pid": "12750", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "101.89.114.94" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "sequence": 43177, + "result": "fail", + "session": "unset", + "data": { + "op": "login", + "terminal": "sshd", + "acct": "(invalid user)" + }, + "summary": { + "object": { + "primary": "sshd", + "secondary": "101.89.114.94", + "type": "user-session" + }, + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + } + } + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "a9bNUmcBTFzn_XoLo6mE", + "source": { + "@timestamp": "2018-11-27T01:34:26.814Z", + "host": { + "name": "demo-stack-mysql-01" + }, + "process": { + "pid": "12750", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "101.89.114.94" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "summary": { + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "root" + }, + "object": { + "primary": "ssh", + "secondary": "101.89.114.94", + "type": "user-session" + } + }, + "sequence": 43178, + "result": "fail", + "session": "unset", + "data": { + "hostname": "101.89.114.94", + "op": "PAM:bad_ident", + "terminal": "ssh" + } + }, + "event": { + "category": "user-login", + "type": "user_err", + "action": "error", + "module": "auditd" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "beat": { + "name": "demo-stack-mysql-01", + "hostname": "demo-stack-mysql-01", + "version": "7.0.0-alpha1" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "2tbPUmcBTFzn_XoLbtDN", + "source": { + "@timestamp": "2018-11-27T01:36:24.291Z", + "process": { + "pid": "32340", + "exe": "/usr/sbin/sshd" + }, + "beat": { + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-redis-01" + }, + "source": { + "ip": "107.170.65.109" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "sequence": 186458, + "result": "fail", + "session": "unset", + "data": { + "terminal": "sshd", + "op": "login", + "acct": "(unknown user)" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + }, + "object": { + "secondary": "107.170.65.109", + "type": "user-session", + "primary": "sshd" + }, + "how": "/usr/sbin/sshd" + } + }, + "event": { + "type": "user_login", + "action": "logged-in", + "module": "auditd", + "category": "user-login" + }, + "user": { + "name_map": { + "uid": "root" + }, + "uid": "0", + "auid": "unset" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "29bPUmcBTFzn_XoLbtDN", + "source": { + "@timestamp": "2018-11-27T01:36:24.292Z", + "network": { + "direction": "incoming" + }, + "auditd": { + "summary": { + "actor": { + "secondary": "(invalid user)", + "primary": "unset" + }, + "object": { + "primary": "sshd", + "secondary": "107.170.65.109", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 186459, + "result": "fail", + "session": "unset", + "data": { + "terminal": "sshd", + "acct": "(invalid user)", + "op": "login" + } + }, + "host": { + "name": "demo-stack-redis-01" + }, + "beat": { + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1" + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + }, + "user": { + "auid": "unset", + "uid": "0", + "name_map": { + "uid": "root" + } + }, + "process": { + "pid": "32340", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "107.170.65.109" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "3NbPUmcBTFzn_XoLbtDN", + "source": { + "@timestamp": "2018-11-27T01:36:24.322Z", + "beat": { + "version": "7.0.0-alpha1", + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01" + }, + "process": { + "pid": "32340", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "107.170.65.109" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "sequence": 186460, + "result": "fail", + "session": "unset", + "data": { + "hostname": "107.170.65.109", + "op": "PAM:bad_ident", + "terminal": "ssh" + }, + "summary": { + "actor": { + "secondary": "root", + "primary": "unset" + }, + "object": { + "secondary": "107.170.65.109", + "type": "user-session", + "primary": "ssh" + }, + "how": "/usr/sbin/sshd" + } + }, + "event": { + "action": "error", + "module": "auditd", + "category": "user-login", + "type": "user_err" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "host": { + "name": "demo-stack-redis-01" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "EtbOUmcBTFzn_XoLf7xx", + "source": { + "@timestamp": "2018-11-27T01:35:22.989Z", + "source": { + "ip": "107.170.65.109" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "summary": { + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + }, + "object": { + "primary": "sshd", + "secondary": "107.170.65.109", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 186455, + "result": "fail", + "session": "unset", + "data": { + "op": "login", + "acct": "(unknown user)", + "terminal": "sshd" + } + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + }, + "user": { + "uid": "0", + "auid": "unset", + "name_map": { + "uid": "root" + } + }, + "process": { + "exe": "/usr/sbin/sshd", + "pid": "32333" + }, + "beat": { + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1", + "name": "demo-stack-redis-01" + }, + "host": { + "name": "demo-stack-redis-01" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "E9bOUmcBTFzn_XoLf7xx", + "source": { + "@timestamp": "2018-11-27T01:35:22.990Z", + "process": { + "pid": "32333", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "107.170.65.109" + }, + "beat": { + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-redis-01" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "sequence": 186456, + "result": "fail", + "session": "unset", + "data": { + "acct": "(invalid user)", + "op": "login", + "terminal": "sshd" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + }, + "object": { + "secondary": "107.170.65.109", + "type": "user-session", + "primary": "sshd" + }, + "how": "/usr/sbin/sshd" + } + }, + "event": { + "module": "auditd", + "category": "user-login", + "type": "user_login", + "action": "logged-in" + }, + "user": { + "uid": "0", + "auid": "unset", + "name_map": { + "uid": "root" + } + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "FNbOUmcBTFzn_XoLf7xx", + "source": { + "@timestamp": "2018-11-27T01:35:23.020Z", + "process": { + "pid": "32333", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "107.170.65.109" + }, + "beat": { + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-redis-01" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "sequence": 186457, + "result": "fail", + "session": "unset", + "data": { + "terminal": "ssh", + "hostname": "107.170.65.109", + "op": "PAM:bad_ident" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "root" + }, + "object": { + "primary": "ssh", + "secondary": "107.170.65.109", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + } + }, + "event": { + "category": "user-login", + "type": "user_err", + "action": "error", + "module": "auditd" + }, + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "6tbMUmcBTFzn_XoLzZY6", + "source": { + "@timestamp": "2018-11-27T01:33:31.856Z", + "host": { + "name": "demo-stack-redis-01" + }, + "event": { + "module": "auditd", + "category": "user-login", + "type": "user_login", + "action": "logged-in" + }, + "user": { + "name_map": { + "uid": "root" + }, + "uid": "0", + "auid": "unset" + }, + "process": { + "pid": "32317", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "107.170.65.109" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "data": { + "acct": "(unknown user)", + "op": "login", + "terminal": "sshd" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + }, + "object": { + "primary": "sshd", + "secondary": "107.170.65.109", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 186443, + "result": "fail", + "session": "unset" + }, + "beat": { + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1", + "name": "demo-stack-redis-01" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "69bMUmcBTFzn_XoLzZY6", + "source": { + "@timestamp": "2018-11-27T01:33:31.857Z", + "host": { + "name": "demo-stack-redis-01" + }, + "event": { + "action": "logged-in", + "module": "auditd", + "category": "user-login", + "type": "user_login" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "pid": "32317", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "107.170.65.109" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "data": { + "acct": "(invalid user)", + "terminal": "sshd", + "op": "login" + }, + "summary": { + "object": { + "primary": "sshd", + "secondary": "107.170.65.109", + "type": "user-session" + }, + "how": "/usr/sbin/sshd", + "actor": { + "secondary": "(invalid user)", + "primary": "unset" + } + }, + "sequence": 186444, + "result": "fail", + "session": "unset" + }, + "beat": { + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "7NbMUmcBTFzn_XoLzZY6", + "source": { + "@timestamp": "2018-11-27T01:33:31.887Z", + "user": { + "name_map": { + "uid": "root" + }, + "uid": "0", + "auid": "unset" + }, + "process": { + "pid": "32317", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "107.170.65.109" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "session": "unset", + "data": { + "hostname": "107.170.65.109", + "terminal": "ssh", + "op": "PAM:bad_ident" + }, + "summary": { + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "root" + }, + "object": { + "secondary": "107.170.65.109", + "type": "user-session", + "primary": "ssh" + } + }, + "sequence": 186445, + "result": "fail" + }, + "event": { + "type": "user_err", + "action": "error", + "module": "auditd", + "category": "user-login" + }, + "host": { + "name": "demo-stack-redis-01" + }, + "beat": { + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "EdbMUmcBTFzn_XoLAYZs", + "source": { + "@timestamp": "2018-11-27T01:32:39.681Z", + "auditd": { + "sequence": 186440, + "result": "fail", + "session": "unset", + "data": { + "op": "login", + "acct": "(unknown user)", + "terminal": "sshd" + }, + "summary": { + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + }, + "object": { + "primary": "sshd", + "secondary": "107.170.65.109", + "type": "user-session" + } + } + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "beat": { + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-redis-01" + }, + "process": { + "pid": "32315", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "107.170.65.109" + }, + "network": { + "direction": "incoming" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "EtbMUmcBTFzn_XoLAYZs", + "source": { + "@timestamp": "2018-11-27T01:32:39.682Z", + "beat": { + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-redis-01" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "pid": "32315", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "107.170.65.109" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "sequence": 186441, + "result": "fail", + "session": "unset", + "data": { + "terminal": "sshd", + "op": "login", + "acct": "(invalid user)" + }, + "summary": { + "actor": { + "secondary": "(invalid user)", + "primary": "unset" + }, + "object": { + "secondary": "107.170.65.109", + "type": "user-session", + "primary": "sshd" + }, + "how": "/usr/sbin/sshd" + } + }, + "event": { + "module": "auditd", + "category": "user-login", + "type": "user_login", + "action": "logged-in" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "E9bMUmcBTFzn_XoLAYZs", + "source": { + "@timestamp": "2018-11-27T01:32:39.713Z", + "beat": { + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-redis-01" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "pid": "32315", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "107.170.65.109" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "result": "fail", + "session": "unset", + "data": { + "terminal": "ssh", + "hostname": "107.170.65.109", + "op": "PAM:bad_ident" + }, + "summary": { + "actor": { + "secondary": "root", + "primary": "unset" + }, + "object": { + "primary": "ssh", + "secondary": "107.170.65.109", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 186442 + }, + "event": { + "category": "user-login", + "type": "user_err", + "action": "error", + "module": "auditd" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "6dbOUmcBTFzn_XoLD7I4", + "source": { + "@timestamp": "2018-11-27T01:34:54.285Z", + "user": { + "auid": "unset", + "uid": "0", + "name_map": { + "uid": "root" + } + }, + "process": { + "pid": "32330", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "178.33.228.67" + }, + "network": { + "direction": "incoming" + }, + "beat": { + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-redis-01" + }, + "auditd": { + "sequence": 186452, + "result": "fail", + "session": "unset", + "data": { + "acct": "(unknown user)", + "terminal": "sshd", + "op": "login" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + }, + "object": { + "type": "user-session", + "primary": "sshd", + "secondary": "178.33.228.67" + }, + "how": "/usr/sbin/sshd" + } + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "6tbOUmcBTFzn_XoLD7I4", + "source": { + "@timestamp": "2018-11-27T01:34:54.286Z", + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + }, + "process": { + "pid": "32330", + "exe": "/usr/sbin/sshd" + }, + "beat": { + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-redis-01" + }, + "source": { + "ip": "178.33.228.67" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "session": "unset", + "data": { + "terminal": "sshd", + "op": "login", + "acct": "(invalid user)" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + }, + "object": { + "secondary": "178.33.228.67", + "type": "user-session", + "primary": "sshd" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 186453, + "result": "fail" + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "69bOUmcBTFzn_XoLD7I4", + "source": { + "@timestamp": "2018-11-27T01:34:54.394Z", + "process": { + "pid": "32330", + "exe": "/usr/sbin/sshd" + }, + "beat": { + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-redis-01" + }, + "source": { + "ip": "178.33.228.67" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "sequence": 186454, + "result": "fail", + "session": "unset", + "data": { + "op": "PAM:bad_ident", + "hostname": "178.33.228.67", + "terminal": "ssh" + }, + "summary": { + "object": { + "primary": "ssh", + "secondary": "178.33.228.67", + "type": "user-session" + }, + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "root" + } + } + }, + "event": { + "category": "user-login", + "type": "user_err", + "action": "error", + "module": "auditd" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "-tbOUmcBTFzn_XoL_cbV", + "source": { + "@timestamp": "2018-11-27T01:35:55.371Z", + "source": { + "ip": "85.113.39.134" + }, + "beat": { + "name": "demo-stack-nginx-01", + "hostname": "demo-stack-nginx-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-nginx-01" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "session": "unset", + "data": { + "acct": "(unknown user)", + "terminal": "sshd", + "op": "login" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + }, + "object": { + "secondary": "85.113.39.134", + "type": "user-session", + "primary": "sshd" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 192535, + "result": "fail" + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "exe": "/usr/sbin/sshd", + "pid": "583" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "-9bOUmcBTFzn_XoL_cbV", + "source": { + "@timestamp": "2018-11-27T01:35:55.372Z", + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "exe": "/usr/sbin/sshd", + "pid": "583" + }, + "source": { + "ip": "85.113.39.134" + }, + "network": { + "direction": "incoming" + }, + "beat": { + "name": "demo-stack-nginx-01", + "hostname": "demo-stack-nginx-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-nginx-01" + }, + "auditd": { + "sequence": 192536, + "result": "fail", + "session": "unset", + "data": { + "terminal": "sshd", + "op": "login", + "acct": "(invalid user)" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + }, + "object": { + "type": "user-session", + "primary": "sshd", + "secondary": "85.113.39.134" + }, + "how": "/usr/sbin/sshd" + } + }, + "event": { + "type": "user_login", + "action": "logged-in", + "module": "auditd", + "category": "user-login" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "_NbOUmcBTFzn_XoL_cbV", + "source": { + "@timestamp": "2018-11-27T01:35:55.530Z", + "network": { + "direction": "incoming" + }, + "auditd": { + "sequence": 192537, + "result": "fail", + "session": "unset", + "data": { + "terminal": "ssh", + "hostname": "85.113.39.134", + "op": "PAM:bad_ident" + }, + "summary": { + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "root" + }, + "object": { + "type": "user-session", + "primary": "ssh", + "secondary": "85.113.39.134" + } + } + }, + "event": { + "category": "user-login", + "type": "user_err", + "action": "error", + "module": "auditd" + }, + "beat": { + "name": "demo-stack-nginx-01", + "hostname": "demo-stack-nginx-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-nginx-01" + }, + "user": { + "name_map": { + "uid": "root" + }, + "uid": "0", + "auid": "unset" + }, + "process": { + "pid": "583", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "85.113.39.134" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "xdbMUmcBTFzn_XoLx5bh", + "source": { + "@timestamp": "2018-11-27T01:33:30.481Z", + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + }, + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + }, + "process": { + "pid": "12742", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "131.72.141.34" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "session": "unset", + "data": { + "terminal": "sshd", + "op": "login", + "acct": "(unknown user)" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + }, + "object": { + "type": "user-session", + "primary": "sshd", + "secondary": "131.72.141.34" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 43173, + "result": "fail" + }, + "beat": { + "name": "demo-stack-mysql-01", + "hostname": "demo-stack-mysql-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-mysql-01" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "xtbMUmcBTFzn_XoLx5bh", + "source": { + "@timestamp": "2018-11-27T01:33:30.485Z", + "process": { + "pid": "12742", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "131.72.141.34" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "sequence": 43174, + "result": "fail", + "session": "unset", + "data": { + "terminal": "sshd", + "acct": "(invalid user)", + "op": "login" + }, + "summary": { + "actor": { + "secondary": "(invalid user)", + "primary": "unset" + }, + "object": { + "secondary": "131.72.141.34", + "type": "user-session", + "primary": "sshd" + }, + "how": "/usr/sbin/sshd" + } + }, + "event": { + "action": "logged-in", + "module": "auditd", + "category": "user-login", + "type": "user_login" + }, + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + }, + "beat": { + "name": "demo-stack-mysql-01", + "hostname": "demo-stack-mysql-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-mysql-01" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "x9bMUmcBTFzn_XoLx5bh", + "source": { + "@timestamp": "2018-11-27T01:33:30.637Z", + "network": { + "direction": "incoming" + }, + "auditd": { + "data": { + "op": "PAM:bad_ident", + "hostname": "131.72.141.34", + "terminal": "ssh" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "root" + }, + "object": { + "secondary": "131.72.141.34", + "type": "user-session", + "primary": "ssh" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 43175, + "result": "fail", + "session": "unset" + }, + "beat": { + "name": "demo-stack-mysql-01", + "hostname": "demo-stack-mysql-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-mysql-01" + }, + "event": { + "type": "user_err", + "action": "error", + "module": "auditd", + "category": "user-login" + }, + "user": { + "uid": "0", + "auid": "unset", + "name_map": { + "uid": "root" + } + }, + "process": { + "pid": "12742", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "131.72.141.34" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "WtbNUmcBTFzn_XoLcqUk", + "source": { + "@timestamp": "2018-11-27T01:34:14.073Z", + "event": { + "type": "user_login", + "action": "logged-in", + "module": "auditd", + "category": "user-login" + }, + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + }, + "process": { + "pid": "32325", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "51.38.33.178" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "session": "unset", + "data": { + "terminal": "sshd", + "op": "login", + "acct": "(unknown user)" + }, + "summary": { + "object": { + "primary": "sshd", + "secondary": "51.38.33.178", + "type": "user-session" + }, + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + } + }, + "sequence": 186446, + "result": "fail" + }, + "beat": { + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-redis-01" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "W9bNUmcBTFzn_XoLcqUk", + "source": { + "@timestamp": "2018-11-27T01:34:14.075Z", + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + }, + "host": { + "name": "demo-stack-redis-01" + }, + "beat": { + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1" + }, + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + }, + "process": { + "exe": "/usr/sbin/sshd", + "pid": "32325" + }, + "source": { + "ip": "51.38.33.178" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "result": "fail", + "session": "unset", + "data": { + "terminal": "sshd", + "op": "login", + "acct": "(invalid user)" + }, + "summary": { + "object": { + "primary": "sshd", + "secondary": "51.38.33.178", + "type": "user-session" + }, + "how": "/usr/sbin/sshd", + "actor": { + "secondary": "(invalid user)", + "primary": "unset" + } + }, + "sequence": 186447 + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "XNbNUmcBTFzn_XoLcqUk", + "source": { + "@timestamp": "2018-11-27T01:34:14.182Z", + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "exe": "/usr/sbin/sshd", + "pid": "32325" + }, + "source": { + "ip": "51.38.33.178" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "summary": { + "actor": { + "primary": "unset", + "secondary": "root" + }, + "object": { + "primary": "ssh", + "secondary": "51.38.33.178", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 186448, + "result": "fail", + "session": "unset", + "data": { + "terminal": "ssh", + "op": "PAM:bad_ident", + "hostname": "51.38.33.178" + } + }, + "beat": { + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1", + "name": "demo-stack-redis-01" + }, + "host": { + "name": "demo-stack-redis-01" + }, + "event": { + "category": "user-login", + "type": "user_err", + "action": "error", + "module": "auditd" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "W9bQUmcBTFzn_XoLRuMO", + "source": { + "@timestamp": "2018-11-27T01:37:19.393Z", + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "pid": "12766", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "117.172.59.127" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "result": "fail", + "session": "unset", + "data": { + "acct": "(unknown user)", + "op": "login", + "terminal": "sshd" + }, + "summary": { + "object": { + "type": "user-session", + "primary": "sshd", + "secondary": "117.172.59.127" + }, + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + } + }, + "sequence": 43182 + }, + "beat": { + "name": "demo-stack-mysql-01", + "hostname": "demo-stack-mysql-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-mysql-01" + }, + "event": { + "action": "logged-in", + "module": "auditd", + "category": "user-login", + "type": "user_login" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "XNbQUmcBTFzn_XoLRuMO", + "source": { + "@timestamp": "2018-11-27T01:37:19.393Z", + "beat": { + "name": "demo-stack-mysql-01", + "hostname": "demo-stack-mysql-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-mysql-01" + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + }, + "user": { + "name_map": { + "uid": "root" + }, + "uid": "0", + "auid": "unset" + }, + "process": { + "exe": "/usr/sbin/sshd", + "pid": "12766" + }, + "source": { + "ip": "117.172.59.127" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "session": "unset", + "data": { + "op": "login", + "acct": "(invalid user)", + "terminal": "sshd" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + }, + "object": { + "primary": "sshd", + "secondary": "117.172.59.127", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 43183, + "result": "fail" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "XdbQUmcBTFzn_XoLRuMO", + "source": { + "@timestamp": "2018-11-27T01:37:19.649Z", + "process": { + "pid": "12766", + "exe": "/usr/sbin/sshd" + }, + "beat": { + "version": "7.0.0-alpha1", + "name": "demo-stack-mysql-01", + "hostname": "demo-stack-mysql-01" + }, + "host": { + "name": "demo-stack-mysql-01" + }, + "source": { + "ip": "117.172.59.127" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "session": "unset", + "data": { + "terminal": "ssh", + "op": "PAM:bad_ident", + "hostname": "117.172.59.127" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "root" + }, + "object": { + "type": "user-session", + "primary": "ssh", + "secondary": "117.172.59.127" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 43184, + "result": "fail" + }, + "event": { + "module": "auditd", + "category": "user-login", + "type": "user_err", + "action": "error" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "otbQUmcBTFzn_XoLVOSA", + "source": { + "@timestamp": "2018-11-27T01:37:23.093Z", + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "pid": "12773", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "193.70.85.206" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "sequence": 43185, + "result": "fail", + "session": "unset", + "data": { + "terminal": "ssh", + "op": "PAM:bad_ident", + "hostname": "193.70.85.206" + }, + "summary": { + "object": { + "primary": "ssh", + "secondary": "193.70.85.206", + "type": "user-session" + }, + "how": "/usr/sbin/sshd", + "actor": { + "secondary": "root", + "primary": "unset" + } + } + }, + "beat": { + "name": "demo-stack-mysql-01", + "hostname": "demo-stack-mysql-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-mysql-01" + }, + "event": { + "category": "user-login", + "type": "user_err", + "action": "error", + "module": "auditd" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "BtbQUmcBTFzn_XoLaudn", + "source": { + "@timestamp": "2018-11-27T01:37:28.701Z", + "event": { + "type": "user_login", + "action": "logged-in", + "module": "auditd", + "category": "user-login" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "exe": "/usr/sbin/sshd", + "pid": "32348" + }, + "source": { + "ip": "107.170.65.109" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "sequence": 186461, + "result": "fail", + "session": "unset", + "data": { + "op": "login", + "terminal": "sshd", + "acct": "(unknown user)" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + }, + "object": { + "primary": "sshd", + "secondary": "107.170.65.109", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + } + }, + "host": { + "name": "demo-stack-redis-01" + }, + "beat": { + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "B9bQUmcBTFzn_XoLaudn", + "source": { + "@timestamp": "2018-11-27T01:37:28.702Z", + "network": { + "direction": "incoming" + }, + "auditd": { + "session": "unset", + "data": { + "acct": "(invalid user)", + "terminal": "sshd", + "op": "login" + }, + "summary": { + "object": { + "secondary": "107.170.65.109", + "type": "user-session", + "primary": "sshd" + }, + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + } + }, + "sequence": 186462, + "result": "fail" + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "beat": { + "version": "7.0.0-alpha1", + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01" + }, + "host": { + "name": "demo-stack-redis-01" + }, + "process": { + "exe": "/usr/sbin/sshd", + "pid": "32348" + }, + "source": { + "ip": "107.170.65.109" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "CNbQUmcBTFzn_XoLaudn", + "source": { + "@timestamp": "2018-11-27T01:37:28.734Z", + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + }, + "process": { + "exe": "/usr/sbin/sshd", + "pid": "32348" + }, + "source": { + "ip": "107.170.65.109" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "data": { + "op": "PAM:bad_ident", + "hostname": "107.170.65.109", + "terminal": "ssh" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "root" + }, + "object": { + "type": "user-session", + "primary": "ssh", + "secondary": "107.170.65.109" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 186463, + "result": "fail", + "session": "unset" + }, + "beat": { + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-redis-01" + }, + "event": { + "module": "auditd", + "category": "user-login", + "type": "user_err", + "action": "error" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "E9bRUmcBTFzn_XoLKPdd", + "source": { + "@timestamp": "2018-11-27T01:38:17.330Z", + "process": { + "exe": "/usr/sbin/sshd", + "pid": "19716" + }, + "source": { + "ip": "93.157.241.40" + }, + "network": { + "direction": "incoming" + }, + "beat": { + "hostname": "demo-stack-haproxy-01", + "version": "7.0.0-alpha1", + "name": "demo-stack-haproxy-01" + }, + "host": { + "name": "demo-stack-haproxy-01" + }, + "auditd": { + "session": "unset", + "data": { + "acct": "(unknown user)", + "op": "login", + "terminal": "sshd" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + }, + "object": { + "primary": "sshd", + "secondary": "93.157.241.40", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 142343, + "result": "fail" + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + }, + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "FNbRUmcBTFzn_XoLKPdd", + "source": { + "@timestamp": "2018-11-27T01:38:17.331Z", + "user": { + "name_map": { + "uid": "root" + }, + "uid": "0", + "auid": "unset" + }, + "process": { + "pid": "19716", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "93.157.241.40" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "summary": { + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + }, + "object": { + "primary": "sshd", + "secondary": "93.157.241.40", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 142344, + "result": "fail", + "session": "unset", + "data": { + "op": "login", + "acct": "(invalid user)", + "terminal": "sshd" + } + }, + "beat": { + "name": "demo-stack-haproxy-01", + "hostname": "demo-stack-haproxy-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-haproxy-01" + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "FdbRUmcBTFzn_XoLKPdd", + "source": { + "@timestamp": "2018-11-27T01:38:17.539Z", + "user": { + "name_map": { + "uid": "root" + }, + "uid": "0", + "auid": "unset" + }, + "process": { + "pid": "19716", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "93.157.241.40" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "data": { + "hostname": "93.157.241.40", + "terminal": "ssh", + "op": "PAM:bad_ident" + }, + "summary": { + "actor": { + "secondary": "root", + "primary": "unset" + }, + "object": { + "primary": "ssh", + "secondary": "93.157.241.40", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 142345, + "result": "fail", + "session": "unset" + }, + "host": { + "name": "demo-stack-haproxy-01" + }, + "beat": { + "name": "demo-stack-haproxy-01", + "hostname": "demo-stack-haproxy-01", + "version": "7.0.0-alpha1" + }, + "event": { + "category": "user-login", + "type": "user_err", + "action": "error", + "module": "auditd" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "qNbPUmcBTFzn_XoL8dwD", + "source": { + "@timestamp": "2018-11-27T01:36:57.625Z", + "process": { + "pid": "25824", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "94.23.0.13" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "data": { + "acct": "(unknown user)", + "terminal": "sshd", + "op": "login" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + }, + "object": { + "secondary": "94.23.0.13", + "type": "user-session", + "primary": "sshd" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 184365, + "result": "fail", + "session": "unset" + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + }, + "beat": { + "name": "demo-stack-apache-01", + "hostname": "demo-stack-apache-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-apache-01" + }, + "user": { + "name_map": { + "uid": "root" + }, + "auid": "unset", + "uid": "0" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "qdbPUmcBTFzn_XoL8dwD", + "source": { + "@timestamp": "2018-11-27T01:36:57.626Z", + "source": { + "ip": "94.23.0.13" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "session": "unset", + "data": { + "op": "login", + "acct": "(invalid user)", + "terminal": "sshd" + }, + "summary": { + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + }, + "object": { + "type": "user-session", + "primary": "sshd", + "secondary": "94.23.0.13" + } + }, + "sequence": 184366, + "result": "fail" + }, + "beat": { + "name": "demo-stack-apache-01", + "hostname": "demo-stack-apache-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-apache-01" + }, + "event": { + "action": "logged-in", + "module": "auditd", + "category": "user-login", + "type": "user_login" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "pid": "25824", + "exe": "/usr/sbin/sshd" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "qtbPUmcBTFzn_XoL8dwD", + "source": { + "@timestamp": "2018-11-27T01:36:57.733Z", + "host": { + "name": "demo-stack-apache-01" + }, + "event": { + "category": "user-login", + "type": "user_err", + "action": "error", + "module": "auditd" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "exe": "/usr/sbin/sshd", + "pid": "25824" + }, + "source": { + "ip": "94.23.0.13" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "sequence": 184367, + "result": "fail", + "session": "unset", + "data": { + "hostname": "94.23.0.13", + "op": "PAM:bad_ident", + "terminal": "ssh" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "root" + }, + "object": { + "primary": "ssh", + "secondary": "94.23.0.13", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + } + }, + "beat": { + "name": "demo-stack-apache-01", + "hostname": "demo-stack-apache-01", + "version": "7.0.0-alpha1" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "T9bQUmcBTFzn_XoLQeNm", + "source": { + "@timestamp": "2018-11-27T01:37:18.204Z", + "network": { + "direction": "incoming" + }, + "auditd": { + "result": "fail", + "session": "unset", + "data": { + "op": "login", + "acct": "(unknown user)", + "terminal": "sshd" + }, + "summary": { + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + }, + "object": { + "primary": "sshd", + "secondary": "159.203.185.59", + "type": "user-session" + } + }, + "sequence": 192544 + }, + "beat": { + "name": "demo-stack-nginx-01", + "hostname": "demo-stack-nginx-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-nginx-01" + }, + "event": { + "module": "auditd", + "category": "user-login", + "type": "user_login", + "action": "logged-in" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "pid": "595", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "159.203.185.59" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "UNbQUmcBTFzn_XoLQeNm", + "source": { + "@timestamp": "2018-11-27T01:37:18.205Z", + "process": { + "pid": "595", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "159.203.185.59" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "sequence": 192545, + "result": "fail", + "session": "unset", + "data": { + "terminal": "sshd", + "op": "login", + "acct": "(invalid user)" + }, + "summary": { + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + }, + "object": { + "type": "user-session", + "primary": "sshd", + "secondary": "159.203.185.59" + } + } + }, + "beat": { + "name": "demo-stack-nginx-01", + "hostname": "demo-stack-nginx-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-nginx-01" + }, + "event": { + "module": "auditd", + "category": "user-login", + "type": "user_login", + "action": "logged-in" + }, + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "UdbQUmcBTFzn_XoLQeNm", + "source": { + "@timestamp": "2018-11-27T01:37:18.237Z", + "auditd": { + "summary": { + "actor": { + "secondary": "root", + "primary": "unset" + }, + "object": { + "primary": "ssh", + "secondary": "159.203.185.59", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 192546, + "result": "fail", + "session": "unset", + "data": { + "op": "PAM:bad_ident", + "terminal": "ssh", + "hostname": "159.203.185.59" + } + }, + "event": { + "type": "user_err", + "action": "error", + "module": "auditd", + "category": "user-login" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "pid": "595", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "159.203.185.59" + }, + "network": { + "direction": "incoming" + }, + "beat": { + "hostname": "demo-stack-nginx-01", + "version": "7.0.0-alpha1", + "name": "demo-stack-nginx-01" + }, + "host": { + "name": "demo-stack-nginx-01" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "RdbQUmcBTFzn_XoLGOA5", + "source": { + "@timestamp": "2018-11-27T01:37:07.663Z", + "event": { + "action": "logged-in", + "module": "auditd", + "category": "user-login", + "type": "user_login" + }, + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + }, + "process": { + "pid": "593", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "82.242.169.217" + }, + "network": { + "direction": "incoming" + }, + "beat": { + "name": "demo-stack-nginx-01", + "hostname": "demo-stack-nginx-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-nginx-01" + }, + "auditd": { + "session": "unset", + "data": { + "acct": "(unknown user)", + "op": "login", + "terminal": "sshd" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + }, + "object": { + "primary": "sshd", + "secondary": "82.242.169.217", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 192541, + "result": "fail" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "RtbQUmcBTFzn_XoLGOA5", + "source": { + "@timestamp": "2018-11-27T01:37:07.664Z", + "auditd": { + "summary": { + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + }, + "object": { + "primary": "sshd", + "secondary": "82.242.169.217", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 192542, + "result": "fail", + "session": "unset", + "data": { + "op": "login", + "acct": "(invalid user)", + "terminal": "sshd" + } + }, + "beat": { + "name": "demo-stack-nginx-01", + "hostname": "demo-stack-nginx-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-nginx-01" + }, + "event": { + "type": "user_login", + "action": "logged-in", + "module": "auditd", + "category": "user-login" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "pid": "593", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "82.242.169.217" + }, + "network": { + "direction": "incoming" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "R9bQUmcBTFzn_XoLGOA5", + "source": { + "@timestamp": "2018-11-27T01:37:08.073Z", + "beat": { + "version": "7.0.0-alpha1", + "name": "demo-stack-nginx-01", + "hostname": "demo-stack-nginx-01" + }, + "host": { + "name": "demo-stack-nginx-01" + }, + "event": { + "type": "user_err", + "action": "error", + "module": "auditd", + "category": "user-login" + }, + "user": { + "name_map": { + "uid": "root" + }, + "auid": "unset", + "uid": "0" + }, + "process": { + "pid": "593", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "82.242.169.217" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "sequence": 192543, + "result": "fail", + "session": "unset", + "data": { + "hostname": "82.242.169.217", + "op": "PAM:bad_ident", + "terminal": "ssh" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "root" + }, + "object": { + "primary": "ssh", + "secondary": "82.242.169.217", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + } + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "FtbPUmcBTFzn_XoL29qM", + "source": { + "@timestamp": "2018-11-27T01:36:52.130Z", + "auditd": { + "result": "fail", + "session": "unset", + "data": { + "op": "login", + "acct": "(unknown user)", + "terminal": "sshd" + }, + "summary": { + "object": { + "primary": "sshd", + "secondary": "91.230.8.194", + "type": "user-session" + }, + "how": "/usr/sbin/sshd", + "actor": { + "secondary": "(unknown user)", + "primary": "unset" + } + }, + "sequence": 192538 + }, + "event": { + "type": "user_login", + "action": "logged-in", + "module": "auditd", + "category": "user-login" + }, + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + }, + "process": { + "exe": "/usr/sbin/sshd", + "pid": "591" + }, + "beat": { + "name": "demo-stack-nginx-01", + "hostname": "demo-stack-nginx-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-nginx-01" + }, + "source": { + "ip": "91.230.8.194" + }, + "network": { + "direction": "incoming" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "F9bPUmcBTFzn_XoL29qM", + "source": { + "@timestamp": "2018-11-27T01:36:52.131Z", + "beat": { + "name": "demo-stack-nginx-01", + "hostname": "demo-stack-nginx-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-nginx-01" + }, + "event": { + "action": "logged-in", + "module": "auditd", + "category": "user-login", + "type": "user_login" + }, + "user": { + "auid": "unset", + "uid": "0", + "name_map": { + "uid": "root" + } + }, + "process": { + "pid": "591", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "91.230.8.194" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "result": "fail", + "session": "unset", + "data": { + "acct": "(invalid user)", + "terminal": "sshd", + "op": "login" + }, + "summary": { + "actor": { + "secondary": "(invalid user)", + "primary": "unset" + }, + "object": { + "primary": "sshd", + "secondary": "91.230.8.194", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 192539 + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "GNbPUmcBTFzn_XoL29qM", + "source": { + "@timestamp": "2018-11-27T01:36:52.258Z", + "auditd": { + "result": "fail", + "session": "unset", + "data": { + "op": "PAM:bad_ident", + "hostname": "91.230.8.194", + "terminal": "ssh" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "root" + }, + "object": { + "secondary": "91.230.8.194", + "type": "user-session", + "primary": "ssh" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 192540 + }, + "beat": { + "name": "demo-stack-nginx-01", + "hostname": "demo-stack-nginx-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-nginx-01" + }, + "event": { + "type": "user_err", + "action": "error", + "module": "auditd", + "category": "user-login" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "pid": "591", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "91.230.8.194" + }, + "network": { + "direction": "incoming" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "vtbQUmcBTFzn_XoLKeAA", + "source": { + "@timestamp": "2018-11-27T01:37:11.956Z", + "source": { + "ip": "51.254.201.64" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "summary": { + "object": { + "type": "user-session", + "primary": "sshd", + "secondary": "51.254.201.64" + }, + "how": "/usr/sbin/sshd", + "actor": { + "secondary": "(unknown user)", + "primary": "unset" + } + }, + "sequence": 43179, + "result": "fail", + "session": "unset", + "data": { + "terminal": "sshd", + "op": "login", + "acct": "(unknown user)" + } + }, + "beat": { + "name": "demo-stack-mysql-01", + "hostname": "demo-stack-mysql-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-mysql-01" + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + }, + "user": { + "name_map": { + "uid": "root" + }, + "auid": "unset", + "uid": "0" + }, + "process": { + "pid": "12764", + "exe": "/usr/sbin/sshd" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "v9bQUmcBTFzn_XoLKeAA", + "source": { + "@timestamp": "2018-11-27T01:37:11.956Z", + "user": { + "name_map": { + "uid": "root" + }, + "auid": "unset", + "uid": "0" + }, + "process": { + "pid": "12764", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "51.254.201.64" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "session": "unset", + "data": { + "acct": "(invalid user)", + "op": "login", + "terminal": "sshd" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + }, + "object": { + "primary": "sshd", + "secondary": "51.254.201.64", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 43180, + "result": "fail" + }, + "beat": { + "version": "7.0.0-alpha1", + "name": "demo-stack-mysql-01", + "hostname": "demo-stack-mysql-01" + }, + "host": { + "name": "demo-stack-mysql-01" + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "wNbQUmcBTFzn_XoLKeAA", + "source": { + "@timestamp": "2018-11-27T01:37:12.064Z", + "process": { + "pid": "12764", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "51.254.201.64" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "sequence": 43181, + "result": "fail", + "session": "unset", + "data": { + "op": "PAM:bad_ident", + "hostname": "51.254.201.64", + "terminal": "ssh" + }, + "summary": { + "actor": { + "secondary": "root", + "primary": "unset" + }, + "object": { + "type": "user-session", + "primary": "ssh", + "secondary": "51.254.201.64" + }, + "how": "/usr/sbin/sshd" + } + }, + "beat": { + "name": "demo-stack-mysql-01", + "hostname": "demo-stack-mysql-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-mysql-01" + }, + "event": { + "category": "user-login", + "type": "user_err", + "action": "error", + "module": "auditd" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "ltbQUmcBTFzn_XoL3fAn", + "source": { + "@timestamp": "2018-11-27T01:37:58.076Z", + "auditd": { + "summary": { + "how": "/usr/sbin/sshd", + "actor": { + "secondary": "root", + "primary": "unset" + }, + "object": { + "primary": "ssh", + "secondary": "46.17.40.237", + "type": "user-session" + } + }, + "sequence": 142342, + "result": "fail", + "session": "unset", + "data": { + "terminal": "ssh", + "op": "PAM:bad_ident", + "hostname": "46.17.40.237" + } + }, + "event": { + "category": "user-login", + "type": "user_err", + "action": "error", + "module": "auditd" + }, + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + }, + "beat": { + "name": "demo-stack-haproxy-01", + "hostname": "demo-stack-haproxy-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-haproxy-01" + }, + "process": { + "pid": "19713", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "46.17.40.237" + }, + "network": { + "direction": "incoming" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "VtfUUmcBTFzn_XoLxEaR", + "source": { + "@timestamp": "2018-11-27T01:42:13.909Z", + "source": { + "ip": "147.75.96.90" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "session": "unset", + "data": { + "terminal": "sshd", + "acct": "(unknown user)", + "op": "login" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + }, + "object": { + "primary": "sshd", + "secondary": "147.75.96.90", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 44195, + "result": "fail" + }, + "event": { + "module": "auditd", + "category": "user-login", + "type": "user_login", + "action": "logged-in" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "pid": "29821", + "exe": "/usr/sbin/sshd" + }, + "beat": { + "name": "demo-stack-es-01", + "hostname": "demo-stack-es-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-es-01" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "V9fUUmcBTFzn_XoLxEaR", + "source": { + "@timestamp": "2018-11-27T01:42:13.913Z", + "source": { + "ip": "147.75.96.90" + }, + "beat": { + "name": "demo-stack-es-01", + "hostname": "demo-stack-es-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-es-01" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "sequence": 44196, + "result": "fail", + "session": "unset", + "data": { + "terminal": "sshd", + "op": "login", + "acct": "(invalid user)" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + }, + "object": { + "primary": "sshd", + "secondary": "147.75.96.90", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + } + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "exe": "/usr/sbin/sshd", + "pid": "29821" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "WNfUUmcBTFzn_XoLxEaR", + "source": { + "@timestamp": "2018-11-27T01:42:13.945Z", + "event": { + "type": "user_err", + "action": "error", + "module": "auditd", + "category": "user-login" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "exe": "/usr/sbin/sshd", + "pid": "29821" + }, + "source": { + "ip": "147.75.96.90" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "sequence": 44197, + "result": "fail", + "session": "unset", + "data": { + "terminal": "ssh", + "hostname": "147.75.96.90", + "op": "PAM:bad_ident" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "root" + }, + "object": { + "type": "user-session", + "primary": "ssh", + "secondary": "147.75.96.90" + }, + "how": "/usr/sbin/sshd" + } + }, + "beat": { + "name": "demo-stack-es-01", + "hostname": "demo-stack-es-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-es-01" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "wtfUUmcBTFzn_XoLzEYU", + "source": { + "@timestamp": "2018-11-27T01:42:15.845Z", + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "pid": "29824", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "144.217.4.14" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "sequence": 44198, + "result": "fail", + "session": "unset", + "data": { + "acct": "(unknown user)", + "op": "login", + "terminal": "sshd" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + }, + "object": { + "primary": "sshd", + "secondary": "144.217.4.14", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + } + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + }, + "beat": { + "hostname": "demo-stack-es-01", + "version": "7.0.0-alpha1", + "name": "demo-stack-es-01" + }, + "host": { + "name": "demo-stack-es-01" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "w9fUUmcBTFzn_XoLzEYU", + "source": { + "@timestamp": "2018-11-27T01:42:15.845Z", + "process": { + "pid": "29824", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "144.217.4.14" + }, + "host": { + "name": "demo-stack-es-01" + }, + "beat": { + "name": "demo-stack-es-01", + "hostname": "demo-stack-es-01", + "version": "7.0.0-alpha1" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "sequence": 44199, + "result": "fail", + "session": "unset", + "data": { + "acct": "(invalid user)", + "terminal": "sshd", + "op": "login" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + }, + "object": { + "primary": "sshd", + "secondary": "144.217.4.14", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + } + }, + "event": { + "module": "auditd", + "category": "user-login", + "type": "user_login", + "action": "logged-in" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "xNfUUmcBTFzn_XoLzEYU", + "source": { + "@timestamp": "2018-11-27T01:42:15.889Z", + "beat": { + "name": "demo-stack-es-01", + "hostname": "demo-stack-es-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-es-01" + }, + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + }, + "process": { + "pid": "29824", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "144.217.4.14" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "sequence": 44200, + "result": "fail", + "session": "unset", + "data": { + "terminal": "ssh", + "op": "PAM:bad_ident", + "hostname": "144.217.4.14" + }, + "summary": { + "how": "/usr/sbin/sshd", + "actor": { + "secondary": "root", + "primary": "unset" + }, + "object": { + "primary": "ssh", + "secondary": "144.217.4.14", + "type": "user-session" + } + } + }, + "event": { + "module": "auditd", + "category": "user-login", + "type": "user_err", + "action": "error" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "0NfUUmcBTFzn_XoL0Ubg", + "source": { + "@timestamp": "2018-11-27T01:42:17.334Z", + "process": { + "pid": "19742", + "exe": "/usr/sbin/sshd" + }, + "beat": { + "name": "demo-stack-haproxy-01", + "hostname": "demo-stack-haproxy-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-haproxy-01" + }, + "source": { + "ip": "192.252.209.190" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "result": "fail", + "session": "unset", + "data": { + "terminal": "sshd", + "op": "login", + "acct": "(unknown user)" + }, + "summary": { + "object": { + "secondary": "192.252.209.190", + "type": "user-session", + "primary": "sshd" + }, + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + } + }, + "sequence": 142355 + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "0dfUUmcBTFzn_XoL0Ubg", + "source": { + "@timestamp": "2018-11-27T01:42:17.335Z", + "network": { + "direction": "incoming" + }, + "auditd": { + "session": "unset", + "data": { + "acct": "(invalid user)", + "op": "login", + "terminal": "sshd" + }, + "summary": { + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + }, + "object": { + "primary": "sshd", + "secondary": "192.252.209.190", + "type": "user-session" + } + }, + "sequence": 142356, + "result": "fail" + }, + "beat": { + "name": "demo-stack-haproxy-01", + "hostname": "demo-stack-haproxy-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-haproxy-01" + }, + "event": { + "action": "logged-in", + "module": "auditd", + "category": "user-login", + "type": "user_login" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "pid": "19742", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "192.252.209.190" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "0tfUUmcBTFzn_XoL0Ubg", + "source": { + "@timestamp": "2018-11-27T01:42:17.366Z", + "beat": { + "name": "demo-stack-haproxy-01", + "hostname": "demo-stack-haproxy-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-haproxy-01" + }, + "event": { + "action": "error", + "module": "auditd", + "category": "user-login", + "type": "user_err" + }, + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + }, + "process": { + "pid": "19742", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "192.252.209.190" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "sequence": 142357, + "result": "fail", + "session": "unset", + "data": { + "op": "PAM:bad_ident", + "terminal": "ssh", + "hostname": "192.252.209.190" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "root" + }, + "object": { + "primary": "ssh", + "secondary": "192.252.209.190", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + } + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "tNfUUmcBTFzn_XoLIDfE", + "source": { + "@timestamp": "2018-11-27T01:41:31.994Z", + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "pid": "19739", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "82.196.12.151" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "summary": { + "actor": { + "secondary": "(unknown user)", + "primary": "unset" + }, + "object": { + "secondary": "82.196.12.151", + "type": "user-session", + "primary": "sshd" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 142352, + "result": "fail", + "session": "unset", + "data": { + "acct": "(unknown user)", + "op": "login", + "terminal": "sshd" + } + }, + "event": { + "type": "user_login", + "action": "logged-in", + "module": "auditd", + "category": "user-login" + }, + "beat": { + "name": "demo-stack-haproxy-01", + "hostname": "demo-stack-haproxy-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-haproxy-01" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "tdfUUmcBTFzn_XoLIDfE", + "source": { + "@timestamp": "2018-11-27T01:41:31.995Z", + "auditd": { + "session": "unset", + "data": { + "acct": "(invalid user)", + "terminal": "sshd", + "op": "login" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + }, + "object": { + "secondary": "82.196.12.151", + "type": "user-session", + "primary": "sshd" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 142353, + "result": "fail" + }, + "beat": { + "name": "demo-stack-haproxy-01", + "hostname": "demo-stack-haproxy-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-haproxy-01" + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + }, + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + }, + "process": { + "pid": "19739", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "82.196.12.151" + }, + "network": { + "direction": "incoming" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "ttfUUmcBTFzn_XoLIDfE", + "source": { + "@timestamp": "2018-11-27T01:41:32.100Z", + "event": { + "module": "auditd", + "category": "user-login", + "type": "user_err", + "action": "error" + }, + "user": { + "name_map": { + "uid": "root" + }, + "auid": "unset", + "uid": "0" + }, + "process": { + "pid": "19739", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "82.196.12.151" + }, + "beat": { + "hostname": "demo-stack-haproxy-01", + "version": "7.0.0-alpha1", + "name": "demo-stack-haproxy-01" + }, + "host": { + "name": "demo-stack-haproxy-01" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "sequence": 142354, + "result": "fail", + "session": "unset", + "data": { + "terminal": "ssh", + "op": "PAM:bad_ident", + "hostname": "82.196.12.151" + }, + "summary": { + "actor": { + "secondary": "root", + "primary": "unset" + }, + "object": { + "primary": "ssh", + "secondary": "82.196.12.151", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + } + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "_dfVUmcBTFzn_XoLRFCU", + "source": { + "@timestamp": "2018-11-27T01:42:46.698Z", + "auditd": { + "result": "fail", + "session": "unset", + "data": { + "op": "login", + "acct": "(unknown user)", + "terminal": "sshd" + }, + "summary": { + "object": { + "secondary": "202.28.34.200", + "type": "user-session", + "primary": "sshd" + }, + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + } + }, + "sequence": 184380 + }, + "event": { + "action": "logged-in", + "module": "auditd", + "category": "user-login", + "type": "user_login" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "beat": { + "version": "7.0.0-alpha1", + "name": "demo-stack-apache-01", + "hostname": "demo-stack-apache-01" + }, + "host": { + "name": "demo-stack-apache-01" + }, + "process": { + "pid": "25911", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "202.28.34.200" + }, + "network": { + "direction": "incoming" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "_tfVUmcBTFzn_XoLRFCU", + "source": { + "@timestamp": "2018-11-27T01:42:46.700Z", + "auditd": { + "sequence": 184381, + "result": "fail", + "session": "unset", + "data": { + "acct": "(invalid user)", + "terminal": "sshd", + "op": "login" + }, + "summary": { + "actor": { + "secondary": "(invalid user)", + "primary": "unset" + }, + "object": { + "secondary": "202.28.34.200", + "type": "user-session", + "primary": "sshd" + }, + "how": "/usr/sbin/sshd" + } + }, + "event": { + "module": "auditd", + "category": "user-login", + "type": "user_login", + "action": "logged-in" + }, + "beat": { + "name": "demo-stack-apache-01", + "hostname": "demo-stack-apache-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-apache-01" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "exe": "/usr/sbin/sshd", + "pid": "25911" + }, + "source": { + "ip": "202.28.34.200" + }, + "network": { + "direction": "incoming" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "_9fVUmcBTFzn_XoLRFCU", + "source": { + "@timestamp": "2018-11-27T01:42:46.932Z", + "source": { + "ip": "202.28.34.200" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "session": "unset", + "data": { + "op": "PAM:bad_ident", + "terminal": "ssh", + "hostname": "202.28.34.200" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "root" + }, + "object": { + "secondary": "202.28.34.200", + "type": "user-session", + "primary": "ssh" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 184382, + "result": "fail" + }, + "event": { + "category": "user-login", + "type": "user_err", + "action": "error", + "module": "auditd" + }, + "beat": { + "name": "demo-stack-apache-01", + "hostname": "demo-stack-apache-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-apache-01" + }, + "user": { + "name_map": { + "uid": "root" + }, + "uid": "0", + "auid": "unset" + }, + "process": { + "pid": "25911", + "exe": "/usr/sbin/sshd" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "ANfUUmcBTFzn_XoL5ElJ", + "source": { + "@timestamp": "2018-11-27T01:42:22.047Z", + "user": { + "auid": "unset", + "uid": "0", + "name_map": { + "uid": "root" + } + }, + "process": { + "exe": "/usr/sbin/sshd", + "pid": "25908" + }, + "source": { + "ip": "104.234.223.14" + }, + "beat": { + "name": "demo-stack-apache-01", + "hostname": "demo-stack-apache-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-apache-01" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "data": { + "acct": "(unknown user)", + "op": "login", + "terminal": "sshd" + }, + "summary": { + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + }, + "object": { + "primary": "sshd", + "secondary": "104.234.223.14", + "type": "user-session" + } + }, + "sequence": 184377, + "result": "fail", + "session": "unset" + }, + "event": { + "type": "user_login", + "action": "logged-in", + "module": "auditd", + "category": "user-login" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "AdfUUmcBTFzn_XoL5ElJ", + "source": { + "@timestamp": "2018-11-27T01:42:22.048Z", + "auditd": { + "summary": { + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + }, + "object": { + "primary": "sshd", + "secondary": "104.234.223.14", + "type": "user-session" + } + }, + "sequence": 184378, + "result": "fail", + "session": "unset", + "data": { + "acct": "(invalid user)", + "terminal": "sshd", + "op": "login" + } + }, + "beat": { + "name": "demo-stack-apache-01", + "hostname": "demo-stack-apache-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-apache-01" + }, + "event": { + "module": "auditd", + "category": "user-login", + "type": "user_login", + "action": "logged-in" + }, + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + }, + "process": { + "pid": "25908", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "104.234.223.14" + }, + "network": { + "direction": "incoming" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "AtfUUmcBTFzn_XoL5ElJ", + "source": { + "@timestamp": "2018-11-27T01:42:22.097Z", + "host": { + "name": "demo-stack-apache-01" + }, + "beat": { + "version": "7.0.0-alpha1", + "name": "demo-stack-apache-01", + "hostname": "demo-stack-apache-01" + }, + "event": { + "module": "auditd", + "category": "user-login", + "type": "user_err", + "action": "error" + }, + "user": { + "name_map": { + "uid": "root" + }, + "uid": "0", + "auid": "unset" + }, + "process": { + "pid": "25908", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "104.234.223.14" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "sequence": 184379, + "result": "fail", + "session": "unset", + "data": { + "hostname": "104.234.223.14", + "terminal": "ssh", + "op": "PAM:bad_ident" + }, + "summary": { + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "root" + }, + "object": { + "primary": "ssh", + "secondary": "104.234.223.14", + "type": "user-session" + } + } + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "79fUUmcBTFzn_XoLuUSW", + "source": { + "@timestamp": "2018-11-27T01:42:11.115Z", + "auditd": { + "data": { + "acct": "(unknown user)", + "terminal": "sshd", + "op": "login" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + }, + "object": { + "primary": "sshd", + "secondary": "107.170.65.109", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 186479, + "result": "fail", + "session": "unset" + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + }, + "user": { + "auid": "unset", + "uid": "0", + "name_map": { + "uid": "root" + } + }, + "process": { + "pid": "32381", + "exe": "/usr/sbin/sshd" + }, + "host": { + "name": "demo-stack-redis-01" + }, + "beat": { + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1" + }, + "source": { + "ip": "107.170.65.109" + }, + "network": { + "direction": "incoming" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "8NfUUmcBTFzn_XoLuUSW", + "source": { + "@timestamp": "2018-11-27T01:42:11.116Z", + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + }, + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + }, + "process": { + "pid": "32381", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "107.170.65.109" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "sequence": 186480, + "result": "fail", + "session": "unset", + "data": { + "op": "login", + "terminal": "sshd", + "acct": "(invalid user)" + }, + "summary": { + "object": { + "type": "user-session", + "primary": "sshd", + "secondary": "107.170.65.109" + }, + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + } + } + }, + "beat": { + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-redis-01" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "8dfUUmcBTFzn_XoLuUSW", + "source": { + "@timestamp": "2018-11-27T01:42:11.146Z", + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "pid": "32381", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "107.170.65.109" + }, + "beat": { + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-redis-01" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "session": "unset", + "data": { + "terminal": "ssh", + "op": "PAM:bad_ident", + "hostname": "107.170.65.109" + }, + "summary": { + "actor": { + "secondary": "root", + "primary": "unset" + }, + "object": { + "primary": "ssh", + "secondary": "107.170.65.109", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 186481, + "result": "fail" + }, + "event": { + "type": "user_err", + "action": "error", + "module": "auditd", + "category": "user-login" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "ntfUUmcBTFzn_XoLPzou", + "source": { + "@timestamp": "2018-11-27T01:41:39.780Z", + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + }, + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + }, + "process": { + "pid": "25901", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "185.91.116.197" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "summary": { + "actor": { + "secondary": "(unknown user)", + "primary": "unset" + }, + "object": { + "primary": "sshd", + "secondary": "185.91.116.197", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 184374, + "result": "fail", + "session": "unset", + "data": { + "terminal": "sshd", + "op": "login", + "acct": "(unknown user)" + } + }, + "beat": { + "name": "demo-stack-apache-01", + "hostname": "demo-stack-apache-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-apache-01" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "n9fUUmcBTFzn_XoLPzou", + "source": { + "@timestamp": "2018-11-27T01:41:39.781Z", + "event": { + "module": "auditd", + "category": "user-login", + "type": "user_login", + "action": "logged-in" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "beat": { + "name": "demo-stack-apache-01", + "hostname": "demo-stack-apache-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-apache-01" + }, + "process": { + "pid": "25901", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "185.91.116.197" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "session": "unset", + "data": { + "op": "login", + "acct": "(invalid user)", + "terminal": "sshd" + }, + "summary": { + "actor": { + "secondary": "(invalid user)", + "primary": "unset" + }, + "object": { + "primary": "sshd", + "secondary": "185.91.116.197", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 184375, + "result": "fail" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "oNfUUmcBTFzn_XoLPzou", + "source": { + "@timestamp": "2018-11-27T01:41:39.902Z", + "host": { + "name": "demo-stack-apache-01" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "exe": "/usr/sbin/sshd", + "pid": "25901" + }, + "source": { + "ip": "185.91.116.197" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "session": "unset", + "data": { + "hostname": "185.91.116.197", + "terminal": "ssh", + "op": "PAM:bad_ident" + }, + "summary": { + "how": "/usr/sbin/sshd", + "actor": { + "secondary": "root", + "primary": "unset" + }, + "object": { + "secondary": "185.91.116.197", + "type": "user-session", + "primary": "ssh" + } + }, + "sequence": 184376, + "result": "fail" + }, + "event": { + "category": "user-login", + "type": "user_err", + "action": "error", + "module": "auditd" + }, + "beat": { + "name": "demo-stack-apache-01", + "hostname": "demo-stack-apache-01", + "version": "7.0.0-alpha1" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "TdfUUmcBTFzn_XoLaj6n", + "source": { + "@timestamp": "2018-11-27T01:41:50.908Z", + "host": { + "name": "demo-stack-redis-01" + }, + "user": { + "auid": "unset", + "uid": "0", + "name_map": { + "uid": "root" + } + }, + "process": { + "exe": "/usr/sbin/sshd", + "pid": "32377" + }, + "source": { + "ip": "37.187.113.229" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "sequence": 186476, + "result": "fail", + "session": "unset", + "data": { + "terminal": "sshd", + "op": "login", + "acct": "(unknown user)" + }, + "summary": { + "object": { + "primary": "sshd", + "secondary": "37.187.113.229", + "type": "user-session" + }, + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + } + } + }, + "event": { + "action": "logged-in", + "module": "auditd", + "category": "user-login", + "type": "user_login" + }, + "beat": { + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "TtfUUmcBTFzn_XoLaj6n", + "source": { + "@timestamp": "2018-11-27T01:41:50.909Z", + "host": { + "name": "demo-stack-redis-01" + }, + "auditd": { + "sequence": 186477, + "result": "fail", + "session": "unset", + "data": { + "terminal": "sshd", + "acct": "(invalid user)", + "op": "login" + }, + "summary": { + "object": { + "primary": "sshd", + "secondary": "37.187.113.229", + "type": "user-session" + }, + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + } + } + }, + "event": { + "type": "user_login", + "action": "logged-in", + "module": "auditd", + "category": "user-login" + }, + "user": { + "name_map": { + "uid": "root" + }, + "auid": "unset", + "uid": "0" + }, + "process": { + "exe": "/usr/sbin/sshd", + "pid": "32377" + }, + "source": { + "ip": "37.187.113.229" + }, + "network": { + "direction": "incoming" + }, + "beat": { + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "T9fUUmcBTFzn_XoLaj6n", + "source": { + "@timestamp": "2018-11-27T01:41:51.016Z", + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + }, + "process": { + "pid": "32377", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "37.187.113.229" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "session": "unset", + "data": { + "terminal": "ssh", + "op": "PAM:bad_ident", + "hostname": "37.187.113.229" + }, + "summary": { + "actor": { + "secondary": "root", + "primary": "unset" + }, + "object": { + "type": "user-session", + "primary": "ssh", + "secondary": "37.187.113.229" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 186478, + "result": "fail" + }, + "beat": { + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-redis-01" + }, + "event": { + "category": "user-login", + "type": "user_err", + "action": "error", + "module": "auditd" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "gdfVUmcBTFzn_XoLildy", + "source": { + "@timestamp": "2018-11-27T01:43:04.584Z", + "network": { + "direction": "incoming" + }, + "beat": { + "name": "demo-stack-apache-01", + "hostname": "demo-stack-apache-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-apache-01" + }, + "auditd": { + "data": { + "terminal": "sshd", + "acct": "(unknown user)", + "op": "login" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + }, + "object": { + "primary": "sshd", + "secondary": "92.222.47.243", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 184383, + "result": "fail", + "session": "unset" + }, + "event": { + "type": "user_login", + "action": "logged-in", + "module": "auditd", + "category": "user-login" + }, + "user": { + "name_map": { + "uid": "root" + }, + "auid": "unset", + "uid": "0" + }, + "process": { + "pid": "25918", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "92.222.47.243" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "gtfVUmcBTFzn_XoLildy", + "source": { + "@timestamp": "2018-11-27T01:43:04.585Z", + "source": { + "ip": "92.222.47.243" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "session": "unset", + "data": { + "terminal": "sshd", + "acct": "(invalid user)", + "op": "login" + }, + "summary": { + "object": { + "primary": "sshd", + "secondary": "92.222.47.243", + "type": "user-session" + }, + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + } + }, + "sequence": 184384, + "result": "fail" + }, + "event": { + "type": "user_login", + "action": "logged-in", + "module": "auditd", + "category": "user-login" + }, + "beat": { + "name": "demo-stack-apache-01", + "hostname": "demo-stack-apache-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-apache-01" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "pid": "25918", + "exe": "/usr/sbin/sshd" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "g9fVUmcBTFzn_XoLildy", + "source": { + "@timestamp": "2018-11-27T01:43:04.690Z", + "source": { + "ip": "92.222.47.243" + }, + "network": { + "direction": "incoming" + }, + "host": { + "name": "demo-stack-apache-01" + }, + "beat": { + "name": "demo-stack-apache-01", + "hostname": "demo-stack-apache-01", + "version": "7.0.0-alpha1" + }, + "auditd": { + "session": "unset", + "data": { + "hostname": "92.222.47.243", + "terminal": "ssh", + "op": "PAM:bad_ident" + }, + "summary": { + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "root" + }, + "object": { + "primary": "ssh", + "secondary": "92.222.47.243", + "type": "user-session" + } + }, + "sequence": 184385, + "result": "fail" + }, + "event": { + "category": "user-login", + "type": "user_err", + "action": "error", + "module": "auditd" + }, + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + }, + "process": { + "exe": "/usr/sbin/sshd", + "pid": "25918" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "7tfUUmcBTFzn_XoL-0sw", + "source": { + "@timestamp": "2018-11-27T01:42:27.906Z", + "auditd": { + "data": { + "op": "login", + "terminal": "sshd", + "acct": "(unknown user)" + }, + "summary": { + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + }, + "object": { + "primary": "sshd", + "secondary": "185.21.16.108", + "type": "user-session" + } + }, + "sequence": 44201, + "result": "fail", + "session": "unset" + }, + "event": { + "type": "user_login", + "action": "logged-in", + "module": "auditd", + "category": "user-login" + }, + "beat": { + "name": "demo-stack-es-01", + "hostname": "demo-stack-es-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-es-01" + }, + "user": { + "name_map": { + "uid": "root" + }, + "auid": "unset", + "uid": "0" + }, + "process": { + "pid": "29828", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "185.21.16.108" + }, + "network": { + "direction": "incoming" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "79fUUmcBTFzn_XoL-0sw", + "source": { + "@timestamp": "2018-11-27T01:42:27.906Z", + "beat": { + "name": "demo-stack-es-01", + "hostname": "demo-stack-es-01", + "version": "7.0.0-alpha1" + }, + "process": { + "pid": "29828", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "185.21.16.108" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "summary": { + "actor": { + "secondary": "(invalid user)", + "primary": "unset" + }, + "object": { + "primary": "sshd", + "secondary": "185.21.16.108", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 44202, + "result": "fail", + "session": "unset", + "data": { + "terminal": "sshd", + "acct": "(invalid user)", + "op": "login" + } + }, + "event": { + "module": "auditd", + "category": "user-login", + "type": "user_login", + "action": "logged-in" + }, + "user": { + "uid": "0", + "auid": "unset", + "name_map": { + "uid": "root" + } + }, + "host": { + "name": "demo-stack-es-01" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "8NfUUmcBTFzn_XoL-0sw", + "source": { + "@timestamp": "2018-11-27T01:42:28.038Z", + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + }, + "process": { + "pid": "29828", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "185.21.16.108" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "session": "unset", + "data": { + "hostname": "185.21.16.108", + "terminal": "ssh", + "op": "PAM:bad_ident" + }, + "summary": { + "actor": { + "secondary": "root", + "primary": "unset" + }, + "object": { + "type": "user-session", + "primary": "ssh", + "secondary": "185.21.16.108" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 44203, + "result": "fail" + }, + "beat": { + "name": "demo-stack-es-01", + "hostname": "demo-stack-es-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-es-01" + }, + "event": { + "module": "auditd", + "category": "user-login", + "type": "user_err", + "action": "error" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "NNfcUmcBTFzn_XoLuPTT", + "source": { + "@timestamp": "2018-11-27T01:50:55.209Z", + "beat": { + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-redis-01" + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + }, + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + }, + "process": { + "exe": "/usr/sbin/sshd", + "pid": "32438" + }, + "source": { + "ip": "107.170.65.109" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "session": "unset", + "data": { + "op": "login", + "acct": "(unknown user)", + "terminal": "sshd" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + }, + "object": { + "secondary": "107.170.65.109", + "type": "user-session", + "primary": "sshd" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 186506, + "result": "fail" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "NdfcUmcBTFzn_XoLuPTT", + "source": { + "@timestamp": "2018-11-27T01:50:55.210Z", + "source": { + "ip": "107.170.65.109" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "data": { + "op": "login", + "acct": "(invalid user)", + "terminal": "sshd" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + }, + "object": { + "primary": "sshd", + "secondary": "107.170.65.109", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 186507, + "result": "fail", + "session": "unset" + }, + "beat": { + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-redis-01" + }, + "event": { + "action": "logged-in", + "module": "auditd", + "category": "user-login", + "type": "user_login" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "exe": "/usr/sbin/sshd", + "pid": "32438" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "NtfcUmcBTFzn_XoLuPTT", + "source": { + "@timestamp": "2018-11-27T01:50:55.240Z", + "event": { + "module": "auditd", + "category": "user-login", + "type": "user_err", + "action": "error" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "pid": "32438", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "107.170.65.109" + }, + "beat": { + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-redis-01" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "session": "unset", + "data": { + "hostname": "107.170.65.109", + "terminal": "ssh", + "op": "PAM:bad_ident" + }, + "summary": { + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "root" + }, + "object": { + "primary": "ssh", + "secondary": "107.170.65.109", + "type": "user-session" + } + }, + "sequence": 186508, + "result": "fail" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "OtfcUmcBTFzn_XoLu_Sp", + "source": { + "@timestamp": "2018-11-27T01:50:55.885Z", + "network": { + "direction": "incoming" + }, + "auditd": { + "data": { + "op": "login", + "acct": "(unknown user)", + "terminal": "sshd" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + }, + "object": { + "primary": "sshd", + "secondary": "178.80.6.244", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 142382, + "result": "fail", + "session": "unset" + }, + "event": { + "action": "logged-in", + "module": "auditd", + "category": "user-login", + "type": "user_login" + }, + "beat": { + "name": "demo-stack-haproxy-01", + "hostname": "demo-stack-haproxy-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-haproxy-01" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "pid": "19808", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "178.80.6.244" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "O9fcUmcBTFzn_XoLu_Sp", + "source": { + "@timestamp": "2018-11-27T01:50:55.886Z", + "source": { + "ip": "178.80.6.244" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "data": { + "op": "login", + "acct": "(invalid user)", + "terminal": "sshd" + }, + "summary": { + "object": { + "type": "user-session", + "primary": "sshd", + "secondary": "178.80.6.244" + }, + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + } + }, + "sequence": 142383, + "result": "fail", + "session": "unset" + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "pid": "19808", + "exe": "/usr/sbin/sshd" + }, + "beat": { + "name": "demo-stack-haproxy-01", + "hostname": "demo-stack-haproxy-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-haproxy-01" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "PNfcUmcBTFzn_XoLu_Sp", + "source": { + "@timestamp": "2018-11-27T01:50:56.100Z", + "auditd": { + "data": { + "hostname": "178.80.6.244", + "op": "PAM:bad_ident", + "terminal": "ssh" + }, + "summary": { + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "root" + }, + "object": { + "type": "user-session", + "primary": "ssh", + "secondary": "178.80.6.244" + } + }, + "sequence": 142384, + "result": "fail", + "session": "unset" + }, + "beat": { + "name": "demo-stack-haproxy-01", + "hostname": "demo-stack-haproxy-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-haproxy-01" + }, + "event": { + "type": "user_err", + "action": "error", + "module": "auditd", + "category": "user-login" + }, + "user": { + "auid": "unset", + "uid": "0", + "name_map": { + "uid": "root" + } + }, + "process": { + "pid": "19808", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "178.80.6.244" + }, + "network": { + "direction": "incoming" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "ttfaUmcBTFzn_XoL780P", + "source": { + "@timestamp": "2018-11-27T01:48:58.021Z", + "source": { + "ip": "104.236.181.158" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "summary": { + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + }, + "object": { + "type": "user-session", + "primary": "sshd", + "secondary": "104.236.181.158" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 142376, + "result": "fail", + "session": "unset", + "data": { + "op": "login", + "terminal": "sshd", + "acct": "(unknown user)" + } + }, + "beat": { + "hostname": "demo-stack-haproxy-01", + "version": "7.0.0-alpha1", + "name": "demo-stack-haproxy-01" + }, + "host": { + "name": "demo-stack-haproxy-01" + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + }, + "user": { + "uid": "0", + "auid": "unset", + "name_map": { + "uid": "root" + } + }, + "process": { + "pid": "19793", + "exe": "/usr/sbin/sshd" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "t9faUmcBTFzn_XoL780P", + "source": { + "@timestamp": "2018-11-27T01:48:58.022Z", + "source": { + "ip": "104.236.181.158" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "session": "unset", + "data": { + "acct": "(invalid user)", + "terminal": "sshd", + "op": "login" + }, + "summary": { + "object": { + "primary": "sshd", + "secondary": "104.236.181.158", + "type": "user-session" + }, + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + } + }, + "sequence": 142377, + "result": "fail" + }, + "event": { + "module": "auditd", + "category": "user-login", + "type": "user_login", + "action": "logged-in" + }, + "user": { + "uid": "0", + "auid": "unset", + "name_map": { + "uid": "root" + } + }, + "beat": { + "name": "demo-stack-haproxy-01", + "hostname": "demo-stack-haproxy-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-haproxy-01" + }, + "process": { + "pid": "19793", + "exe": "/usr/sbin/sshd" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "uNfaUmcBTFzn_XoL780P", + "source": { + "@timestamp": "2018-11-27T01:48:58.064Z", + "beat": { + "name": "demo-stack-haproxy-01", + "hostname": "demo-stack-haproxy-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-haproxy-01" + }, + "auditd": { + "session": "unset", + "data": { + "op": "PAM:bad_ident", + "terminal": "ssh", + "hostname": "104.236.181.158" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "root" + }, + "object": { + "type": "user-session", + "primary": "ssh", + "secondary": "104.236.181.158" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 142378, + "result": "fail" + }, + "event": { + "module": "auditd", + "category": "user-login", + "type": "user_err", + "action": "error" + }, + "user": { + "auid": "unset", + "uid": "0", + "name_map": { + "uid": "root" + } + }, + "process": { + "pid": "19793", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "104.236.181.158" + }, + "network": { + "direction": "incoming" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "tNfbUmcBTFzn_XoLTdQu", + "source": { + "@timestamp": "2018-11-27T01:49:22.116Z", + "process": { + "pid": "19795", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "153.142.75.192" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "result": "fail", + "session": "unset", + "data": { + "terminal": "sshd", + "acct": "(unknown user)", + "op": "login" + }, + "summary": { + "object": { + "secondary": "153.142.75.192", + "type": "user-session", + "primary": "sshd" + }, + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + } + }, + "sequence": 142379 + }, + "beat": { + "name": "demo-stack-haproxy-01", + "hostname": "demo-stack-haproxy-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-haproxy-01" + }, + "event": { + "type": "user_login", + "action": "logged-in", + "module": "auditd", + "category": "user-login" + }, + "user": { + "uid": "0", + "auid": "unset", + "name_map": { + "uid": "root" + } + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "tdfbUmcBTFzn_XoLTdQu", + "source": { + "@timestamp": "2018-11-27T01:49:22.117Z", + "host": { + "name": "demo-stack-haproxy-01" + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + }, + "user": { + "uid": "0", + "auid": "unset", + "name_map": { + "uid": "root" + } + }, + "process": { + "pid": "19795", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "153.142.75.192" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "sequence": 142380, + "result": "fail", + "session": "unset", + "data": { + "acct": "(invalid user)", + "terminal": "sshd", + "op": "login" + }, + "summary": { + "object": { + "primary": "sshd", + "secondary": "153.142.75.192", + "type": "user-session" + }, + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + } + } + }, + "beat": { + "name": "demo-stack-haproxy-01", + "hostname": "demo-stack-haproxy-01", + "version": "7.0.0-alpha1" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "ttfbUmcBTFzn_XoLTdQu", + "source": { + "@timestamp": "2018-11-27T01:49:22.274Z", + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + }, + "process": { + "pid": "19795", + "exe": "/usr/sbin/sshd" + }, + "beat": { + "name": "demo-stack-haproxy-01", + "hostname": "demo-stack-haproxy-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-haproxy-01" + }, + "source": { + "ip": "153.142.75.192" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "data": { + "op": "PAM:bad_ident", + "terminal": "ssh", + "hostname": "153.142.75.192" + }, + "summary": { + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "root" + }, + "object": { + "primary": "ssh", + "secondary": "153.142.75.192", + "type": "user-session" + } + }, + "sequence": 142381, + "result": "fail", + "session": "unset" + }, + "event": { + "action": "error", + "module": "auditd", + "category": "user-login", + "type": "user_err" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "GtfaUmcBTFzn_XoLLr2X", + "source": { + "@timestamp": "2018-11-27T01:48:08.749Z", + "beat": { + "name": "demo-stack-haproxy-01", + "hostname": "demo-stack-haproxy-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-haproxy-01" + }, + "event": { + "type": "user_login", + "action": "logged-in", + "module": "auditd", + "category": "user-login" + }, + "user": { + "uid": "0", + "auid": "unset", + "name_map": { + "uid": "root" + } + }, + "process": { + "pid": "19785", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "190.0.10.138" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "summary": { + "object": { + "type": "user-session", + "primary": "sshd", + "secondary": "190.0.10.138" + }, + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + } + }, + "sequence": 142373, + "result": "fail", + "session": "unset", + "data": { + "terminal": "sshd", + "acct": "(unknown user)", + "op": "login" + } + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "G9faUmcBTFzn_XoLLr2X", + "source": { + "@timestamp": "2018-11-27T01:48:08.750Z", + "source": { + "ip": "190.0.10.138" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "result": "fail", + "session": "unset", + "data": { + "acct": "(invalid user)", + "op": "login", + "terminal": "sshd" + }, + "summary": { + "object": { + "primary": "sshd", + "secondary": "190.0.10.138", + "type": "user-session" + }, + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + } + }, + "sequence": 142374 + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "host": { + "name": "demo-stack-haproxy-01" + }, + "beat": { + "version": "7.0.0-alpha1", + "name": "demo-stack-haproxy-01", + "hostname": "demo-stack-haproxy-01" + }, + "process": { + "pid": "19785", + "exe": "/usr/sbin/sshd" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "HNfaUmcBTFzn_XoLLr2X", + "source": { + "@timestamp": "2018-11-27T01:48:08.857Z", + "source": { + "ip": "190.0.10.138" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "sequence": 142375, + "result": "fail", + "session": "unset", + "data": { + "hostname": "190.0.10.138", + "terminal": "ssh", + "op": "PAM:bad_ident" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "root" + }, + "object": { + "type": "user-session", + "primary": "ssh", + "secondary": "190.0.10.138" + }, + "how": "/usr/sbin/sshd" + } + }, + "beat": { + "name": "demo-stack-haproxy-01", + "hostname": "demo-stack-haproxy-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-haproxy-01" + }, + "event": { + "category": "user-login", + "type": "user_err", + "action": "error", + "module": "auditd" + }, + "user": { + "auid": "unset", + "uid": "0", + "name_map": { + "uid": "root" + } + }, + "process": { + "pid": "19785", + "exe": "/usr/sbin/sshd" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "J9faUmcBTFzn_XoLbcKr", + "source": { + "@timestamp": "2018-11-27T01:48:24.897Z", + "beat": { + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-redis-01" + }, + "process": { + "exe": "/usr/sbin/sshd", + "pid": "32420" + }, + "source": { + "ip": "107.170.65.109" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "sequence": 186500, + "result": "fail", + "session": "unset", + "data": { + "terminal": "sshd", + "acct": "(unknown user)", + "op": "login" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + }, + "object": { + "type": "user-session", + "primary": "sshd", + "secondary": "107.170.65.109" + }, + "how": "/usr/sbin/sshd" + } + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "KNfaUmcBTFzn_XoLbcKr", + "source": { + "@timestamp": "2018-11-27T01:48:24.899Z", + "auditd": { + "summary": { + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + }, + "object": { + "primary": "sshd", + "secondary": "107.170.65.109", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 186501, + "result": "fail", + "session": "unset", + "data": { + "op": "login", + "terminal": "sshd", + "acct": "(invalid user)" + } + }, + "beat": { + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-redis-01" + }, + "event": { + "action": "logged-in", + "module": "auditd", + "category": "user-login", + "type": "user_login" + }, + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + }, + "process": { + "exe": "/usr/sbin/sshd", + "pid": "32420" + }, + "source": { + "ip": "107.170.65.109" + }, + "network": { + "direction": "incoming" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "KdfaUmcBTFzn_XoLbcKr", + "source": { + "@timestamp": "2018-11-27T01:48:24.929Z", + "source": { + "ip": "107.170.65.109" + }, + "beat": { + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-redis-01" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "session": "unset", + "data": { + "hostname": "107.170.65.109", + "terminal": "ssh", + "op": "PAM:bad_ident" + }, + "summary": { + "object": { + "type": "user-session", + "primary": "ssh", + "secondary": "107.170.65.109" + }, + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "root" + } + }, + "sequence": 186502, + "result": "fail" + }, + "event": { + "type": "user_err", + "action": "error", + "module": "auditd", + "category": "user-login" + }, + "user": { + "name_map": { + "uid": "root" + }, + "uid": "0", + "auid": "unset" + }, + "process": { + "pid": "32420", + "exe": "/usr/sbin/sshd" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "ItfZUmcBTFzn_XoLRqn8", + "source": { + "@timestamp": "2018-11-27T01:47:09.456Z", + "event": { + "module": "auditd", + "category": "user-login", + "type": "user_login", + "action": "logged-in" + }, + "user": { + "name_map": { + "uid": "root" + }, + "uid": "0", + "auid": "unset" + }, + "beat": { + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-redis-01" + }, + "process": { + "exe": "/usr/sbin/sshd", + "pid": "32412" + }, + "source": { + "ip": "107.170.65.109" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "summary": { + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + }, + "object": { + "primary": "sshd", + "secondary": "107.170.65.109", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 186497, + "result": "fail", + "session": "unset", + "data": { + "op": "login", + "terminal": "sshd", + "acct": "(unknown user)" + } + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "I9fZUmcBTFzn_XoLRqn8", + "source": { + "@timestamp": "2018-11-27T01:47:09.457Z", + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "pid": "32412", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "107.170.65.109" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "data": { + "acct": "(invalid user)", + "terminal": "sshd", + "op": "login" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + }, + "object": { + "type": "user-session", + "primary": "sshd", + "secondary": "107.170.65.109" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 186498, + "result": "fail", + "session": "unset" + }, + "beat": { + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-redis-01" + }, + "event": { + "action": "logged-in", + "module": "auditd", + "category": "user-login", + "type": "user_login" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "JNfZUmcBTFzn_XoLRqn8", + "source": { + "@timestamp": "2018-11-27T01:47:09.491Z", + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "pid": "32412", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "107.170.65.109" + }, + "beat": { + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1", + "name": "demo-stack-redis-01" + }, + "host": { + "name": "demo-stack-redis-01" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "data": { + "op": "PAM:bad_ident", + "terminal": "ssh", + "hostname": "107.170.65.109" + }, + "summary": { + "actor": { + "secondary": "root", + "primary": "unset" + }, + "object": { + "primary": "ssh", + "secondary": "107.170.65.109", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 186499, + "result": "fail", + "session": "unset" + }, + "event": { + "category": "user-login", + "type": "user_err", + "action": "error", + "module": "auditd" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "KtfbUmcBTFzn_XoLltt6", + "source": { + "@timestamp": "2018-11-27T01:49:40.879Z", + "host": { + "name": "demo-stack-redis-01" + }, + "source": { + "ip": "107.170.65.109" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "sequence": 186503, + "result": "fail", + "session": "unset", + "data": { + "op": "login", + "terminal": "sshd", + "acct": "(unknown user)" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + }, + "object": { + "type": "user-session", + "primary": "sshd", + "secondary": "107.170.65.109" + }, + "how": "/usr/sbin/sshd" + } + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + }, + "user": { + "auid": "unset", + "uid": "0", + "name_map": { + "uid": "root" + } + }, + "process": { + "pid": "32428", + "exe": "/usr/sbin/sshd" + }, + "beat": { + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "K9fbUmcBTFzn_XoLltt6", + "source": { + "@timestamp": "2018-11-27T01:49:40.881Z", + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "exe": "/usr/sbin/sshd", + "pid": "32428" + }, + "beat": { + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-redis-01" + }, + "source": { + "ip": "107.170.65.109" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "result": "fail", + "session": "unset", + "data": { + "terminal": "sshd", + "op": "login", + "acct": "(invalid user)" + }, + "summary": { + "actor": { + "secondary": "(invalid user)", + "primary": "unset" + }, + "object": { + "primary": "sshd", + "secondary": "107.170.65.109", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 186504 + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "LNfbUmcBTFzn_XoLltt6", + "source": { + "@timestamp": "2018-11-27T01:49:40.911Z", + "beat": { + "version": "7.0.0-alpha1", + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01" + }, + "host": { + "name": "demo-stack-redis-01" + }, + "source": { + "ip": "107.170.65.109" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "sequence": 186505, + "result": "fail", + "session": "unset", + "data": { + "terminal": "ssh", + "op": "PAM:bad_ident", + "hostname": "107.170.65.109" + }, + "summary": { + "actor": { + "secondary": "root", + "primary": "unset" + }, + "object": { + "primary": "ssh", + "secondary": "107.170.65.109", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + } + }, + "event": { + "module": "auditd", + "category": "user-login", + "type": "user_err", + "action": "error" + }, + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + }, + "process": { + "exe": "/usr/sbin/sshd", + "pid": "32428" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "zNfZUmcBTFzn_XoL6LbT", + "source": { + "@timestamp": "2018-11-27T01:47:50.888Z", + "beat": { + "name": "demo-stack-haproxy-01", + "hostname": "demo-stack-haproxy-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-haproxy-01" + }, + "event": { + "module": "auditd", + "category": "user-login", + "type": "user_login", + "action": "logged-in" + }, + "user": { + "name_map": { + "uid": "root" + }, + "auid": "unset", + "uid": "0" + }, + "process": { + "pid": "19783", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "176.31.75.53" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "sequence": 142370, + "result": "fail", + "session": "unset", + "data": { + "op": "login", + "terminal": "sshd", + "acct": "(unknown user)" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + }, + "object": { + "type": "user-session", + "primary": "sshd", + "secondary": "176.31.75.53" + }, + "how": "/usr/sbin/sshd" + } + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "zdfZUmcBTFzn_XoL6LbT", + "source": { + "@timestamp": "2018-11-27T01:47:50.889Z", + "source": { + "ip": "176.31.75.53" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "sequence": 142371, + "result": "fail", + "session": "unset", + "data": { + "op": "login", + "acct": "(invalid user)", + "terminal": "sshd" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + }, + "object": { + "primary": "sshd", + "secondary": "176.31.75.53", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + } + }, + "event": { + "module": "auditd", + "category": "user-login", + "type": "user_login", + "action": "logged-in" + }, + "host": { + "name": "demo-stack-haproxy-01" + }, + "beat": { + "name": "demo-stack-haproxy-01", + "hostname": "demo-stack-haproxy-01", + "version": "7.0.0-alpha1" + }, + "user": { + "auid": "unset", + "uid": "0", + "name_map": { + "uid": "root" + } + }, + "process": { + "pid": "19783", + "exe": "/usr/sbin/sshd" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "ztfZUmcBTFzn_XoL6LbT", + "source": { + "@timestamp": "2018-11-27T01:47:50.996Z", + "network": { + "direction": "incoming" + }, + "auditd": { + "data": { + "op": "PAM:bad_ident", + "terminal": "ssh", + "hostname": "176.31.75.53" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "root" + }, + "object": { + "secondary": "176.31.75.53", + "type": "user-session", + "primary": "ssh" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 142372, + "result": "fail", + "session": "unset" + }, + "event": { + "category": "user-login", + "type": "user_err", + "action": "error", + "module": "auditd" + }, + "user": { + "name_map": { + "uid": "root" + }, + "auid": "unset", + "uid": "0" + }, + "process": { + "pid": "19783", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "176.31.75.53" + }, + "beat": { + "name": "demo-stack-haproxy-01", + "hostname": "demo-stack-haproxy-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-haproxy-01" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "6dfcUmcBTFzn_XoLVuuz", + "source": { + "@timestamp": "2018-11-27T01:50:30.087Z", + "source": { + "ip": "178.33.45.156" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "sequence": 44204, + "result": "fail", + "session": "unset", + "data": { + "acct": "(unknown user)", + "terminal": "sshd", + "op": "login" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + }, + "object": { + "primary": "sshd", + "secondary": "178.33.45.156", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + } + }, + "beat": { + "name": "demo-stack-es-01", + "hostname": "demo-stack-es-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-es-01" + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + }, + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + }, + "process": { + "exe": "/usr/sbin/sshd", + "pid": "29987" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "6tfcUmcBTFzn_XoLVuuz", + "source": { + "@timestamp": "2018-11-27T01:50:30.087Z", + "event": { + "type": "user_login", + "action": "logged-in", + "module": "auditd", + "category": "user-login" + }, + "user": { + "uid": "0", + "auid": "unset", + "name_map": { + "uid": "root" + } + }, + "process": { + "pid": "29987", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "178.33.45.156" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "summary": { + "actor": { + "secondary": "(invalid user)", + "primary": "unset" + }, + "object": { + "primary": "sshd", + "secondary": "178.33.45.156", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 44205, + "result": "fail", + "session": "unset", + "data": { + "terminal": "sshd", + "acct": "(invalid user)", + "op": "login" + } + }, + "beat": { + "hostname": "demo-stack-es-01", + "version": "7.0.0-alpha1", + "name": "demo-stack-es-01" + }, + "host": { + "name": "demo-stack-es-01" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "69fcUmcBTFzn_XoLVuuz", + "source": { + "@timestamp": "2018-11-27T01:50:30.195Z", + "host": { + "name": "demo-stack-es-01" + }, + "event": { + "category": "user-login", + "type": "user_err", + "action": "error", + "module": "auditd" + }, + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + }, + "process": { + "pid": "29987", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "178.33.45.156" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "sequence": 44206, + "result": "fail", + "session": "unset", + "data": { + "terminal": "ssh", + "op": "PAM:bad_ident", + "hostname": "178.33.45.156" + }, + "summary": { + "how": "/usr/sbin/sshd", + "actor": { + "secondary": "root", + "primary": "unset" + }, + "object": { + "primary": "ssh", + "secondary": "178.33.45.156", + "type": "user-session" + } + } + }, + "beat": { + "name": "demo-stack-es-01", + "hostname": "demo-stack-es-01", + "version": "7.0.0-alpha1" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "i9jhUmcBTFzn_XoLAlEZ", + "source": { + "@timestamp": "2018-11-27T01:55:36.110Z", + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "exe": "/usr/sbin/sshd", + "pid": "26002" + }, + "source": { + "ip": "178.48.181.9" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "result": "fail", + "session": "unset", + "data": { + "op": "login", + "acct": "(unknown user)", + "terminal": "sshd" + }, + "summary": { + "object": { + "secondary": "178.48.181.9", + "type": "user-session", + "primary": "sshd" + }, + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + } + }, + "sequence": 184395 + }, + "beat": { + "hostname": "demo-stack-apache-01", + "version": "7.0.0-alpha1", + "name": "demo-stack-apache-01" + }, + "host": { + "name": "demo-stack-apache-01" + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "jNjhUmcBTFzn_XoLAlEZ", + "source": { + "@timestamp": "2018-11-27T01:55:36.111Z", + "event": { + "action": "logged-in", + "module": "auditd", + "category": "user-login", + "type": "user_login" + }, + "beat": { + "hostname": "demo-stack-apache-01", + "version": "7.0.0-alpha1", + "name": "demo-stack-apache-01" + }, + "host": { + "name": "demo-stack-apache-01" + }, + "user": { + "uid": "0", + "auid": "unset", + "name_map": { + "uid": "root" + } + }, + "process": { + "exe": "/usr/sbin/sshd", + "pid": "26002" + }, + "source": { + "ip": "178.48.181.9" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "sequence": 184396, + "result": "fail", + "session": "unset", + "data": { + "op": "login", + "acct": "(invalid user)", + "terminal": "sshd" + }, + "summary": { + "object": { + "primary": "sshd", + "secondary": "178.48.181.9", + "type": "user-session" + }, + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + } + } + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "jdjhUmcBTFzn_XoLAlEZ", + "source": { + "@timestamp": "2018-11-27T01:55:36.272Z", + "source": { + "ip": "178.48.181.9" + }, + "beat": { + "name": "demo-stack-apache-01", + "hostname": "demo-stack-apache-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-apache-01" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "sequence": 184397, + "result": "fail", + "session": "unset", + "data": { + "hostname": "178.48.181.9", + "op": "PAM:bad_ident", + "terminal": "ssh" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "root" + }, + "object": { + "type": "user-session", + "primary": "ssh", + "secondary": "178.48.181.9" + }, + "how": "/usr/sbin/sshd" + } + }, + "event": { + "module": "auditd", + "category": "user-login", + "type": "user_err", + "action": "error" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "exe": "/usr/sbin/sshd", + "pid": "26002" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "HNjhUmcBTFzn_XoLBFLi", + "source": { + "@timestamp": "2018-11-27T01:55:36.824Z", + "network": { + "direction": "incoming" + }, + "auditd": { + "summary": { + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + }, + "object": { + "primary": "sshd", + "secondary": "107.170.65.109", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 186518, + "result": "fail", + "session": "unset", + "data": { + "op": "login", + "terminal": "sshd", + "acct": "(unknown user)" + } + }, + "beat": { + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-redis-01" + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "pid": "32466", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "107.170.65.109" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "HdjhUmcBTFzn_XoLBFLi", + "source": { + "@timestamp": "2018-11-27T01:55:36.825Z", + "beat": { + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1", + "name": "demo-stack-redis-01" + }, + "process": { + "pid": "32466", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "107.170.65.109" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "sequence": 186519, + "result": "fail", + "session": "unset", + "data": { + "acct": "(invalid user)", + "terminal": "sshd", + "op": "login" + }, + "summary": { + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + }, + "object": { + "primary": "sshd", + "secondary": "107.170.65.109", + "type": "user-session" + } + } + }, + "event": { + "module": "auditd", + "category": "user-login", + "type": "user_login", + "action": "logged-in" + }, + "user": { + "name_map": { + "uid": "root" + }, + "auid": "unset", + "uid": "0" + }, + "host": { + "name": "demo-stack-redis-01" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "HtjhUmcBTFzn_XoLBFLi", + "source": { + "@timestamp": "2018-11-27T01:55:36.858Z", + "source": { + "ip": "107.170.65.109" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "sequence": 186520, + "result": "fail", + "session": "unset", + "data": { + "op": "PAM:bad_ident", + "hostname": "107.170.65.109", + "terminal": "ssh" + }, + "summary": { + "how": "/usr/sbin/sshd", + "actor": { + "secondary": "root", + "primary": "unset" + }, + "object": { + "primary": "ssh", + "secondary": "107.170.65.109", + "type": "user-session" + } + } + }, + "event": { + "category": "user-login", + "type": "user_err", + "action": "error", + "module": "auditd" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "beat": { + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-redis-01" + }, + "process": { + "pid": "32466", + "exe": "/usr/sbin/sshd" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "X9jhUmcBTFzn_XoLml-F", + "source": { + "@timestamp": "2018-11-27T01:56:15.131Z", + "network": { + "direction": "incoming" + }, + "auditd": { + "summary": { + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + }, + "object": { + "primary": "sshd", + "secondary": "83.99.24.14", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 186524, + "result": "fail", + "session": "unset", + "data": { + "op": "login", + "acct": "(unknown user)", + "terminal": "sshd" + } + }, + "beat": { + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-redis-01" + }, + "event": { + "module": "auditd", + "category": "user-login", + "type": "user_login", + "action": "logged-in" + }, + "user": { + "auid": "unset", + "uid": "0", + "name_map": { + "uid": "root" + } + }, + "process": { + "pid": "32470", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "83.99.24.14" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "YNjhUmcBTFzn_XoLml-F", + "source": { + "@timestamp": "2018-11-27T01:56:15.132Z", + "process": { + "exe": "/usr/sbin/sshd", + "pid": "32470" + }, + "source": { + "ip": "83.99.24.14" + }, + "network": { + "direction": "incoming" + }, + "beat": { + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-redis-01" + }, + "auditd": { + "data": { + "acct": "(invalid user)", + "op": "login", + "terminal": "sshd" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + }, + "object": { + "primary": "sshd", + "secondary": "83.99.24.14", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 186525, + "result": "fail", + "session": "unset" + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "YdjhUmcBTFzn_XoLml-F", + "source": { + "@timestamp": "2018-11-27T01:56:15.245Z", + "host": { + "name": "demo-stack-redis-01" + }, + "event": { + "module": "auditd", + "category": "user-login", + "type": "user_err", + "action": "error" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "pid": "32470", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "83.99.24.14" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "summary": { + "actor": { + "primary": "unset", + "secondary": "root" + }, + "object": { + "primary": "ssh", + "secondary": "83.99.24.14", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 186526, + "result": "fail", + "session": "unset", + "data": { + "terminal": "ssh", + "op": "PAM:bad_ident", + "hostname": "83.99.24.14" + } + }, + "beat": { + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "YtjhUmcBTFzn_XoLml-F", + "source": { + "@timestamp": "2018-11-27T01:56:15.822Z", + "network": { + "direction": "incoming" + }, + "auditd": { + "data": { + "acct": "(unknown user)", + "terminal": "sshd", + "op": "login" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + }, + "object": { + "type": "user-session", + "primary": "sshd", + "secondary": "51.38.68.237" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 186527, + "result": "fail", + "session": "unset" + }, + "beat": { + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-redis-01" + }, + "event": { + "type": "user_login", + "action": "logged-in", + "module": "auditd", + "category": "user-login" + }, + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + }, + "process": { + "pid": "32472", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "51.38.68.237" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "Y9jhUmcBTFzn_XoLml-F", + "source": { + "@timestamp": "2018-11-27T01:56:15.823Z", + "user": { + "auid": "unset", + "uid": "0", + "name_map": { + "uid": "root" + } + }, + "process": { + "pid": "32472", + "exe": "/usr/sbin/sshd" + }, + "beat": { + "version": "7.0.0-alpha1", + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01" + }, + "host": { + "name": "demo-stack-redis-01" + }, + "source": { + "ip": "51.38.68.237" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "sequence": 186528, + "result": "fail", + "session": "unset", + "data": { + "acct": "(invalid user)", + "op": "login", + "terminal": "sshd" + }, + "summary": { + "object": { + "type": "user-session", + "primary": "sshd", + "secondary": "51.38.68.237" + }, + "how": "/usr/sbin/sshd", + "actor": { + "secondary": "(invalid user)", + "primary": "unset" + } + } + }, + "event": { + "type": "user_login", + "action": "logged-in", + "module": "auditd", + "category": "user-login" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "ZNjhUmcBTFzn_XoLml-F", + "source": { + "@timestamp": "2018-11-27T01:56:15.930Z", + "auditd": { + "sequence": 186529, + "result": "fail", + "session": "unset", + "data": { + "op": "PAM:bad_ident", + "terminal": "ssh", + "hostname": "51.38.68.237" + }, + "summary": { + "object": { + "type": "user-session", + "primary": "ssh", + "secondary": "51.38.68.237" + }, + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "root" + } + } + }, + "host": { + "name": "demo-stack-redis-01" + }, + "beat": { + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1" + }, + "event": { + "category": "user-login", + "type": "user_err", + "action": "error", + "module": "auditd" + }, + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + }, + "process": { + "exe": "/usr/sbin/sshd", + "pid": "32472" + }, + "source": { + "ip": "51.38.68.237" + }, + "network": { + "direction": "incoming" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "jNjgUmcBTFzn_XoL304M", + "source": { + "@timestamp": "2018-11-27T01:55:27.134Z", + "user": { + "auid": "unset", + "uid": "0", + "name_map": { + "uid": "root" + } + }, + "process": { + "pid": "30088", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "91.121.142.225" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "session": "unset", + "data": { + "terminal": "sshd", + "op": "login", + "acct": "(unknown user)" + }, + "summary": { + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + }, + "object": { + "primary": "sshd", + "secondary": "91.121.142.225", + "type": "user-session" + } + }, + "sequence": 44210, + "result": "fail" + }, + "beat": { + "hostname": "demo-stack-es-01", + "version": "7.0.0-alpha1", + "name": "demo-stack-es-01" + }, + "host": { + "name": "demo-stack-es-01" + }, + "event": { + "action": "logged-in", + "module": "auditd", + "category": "user-login", + "type": "user_login" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "jdjgUmcBTFzn_XoL304M", + "source": { + "@timestamp": "2018-11-27T01:55:27.134Z", + "process": { + "pid": "30088", + "exe": "/usr/sbin/sshd" + }, + "beat": { + "name": "demo-stack-es-01", + "hostname": "demo-stack-es-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-es-01" + }, + "source": { + "ip": "91.121.142.225" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "result": "fail", + "session": "unset", + "data": { + "terminal": "sshd", + "op": "login", + "acct": "(invalid user)" + }, + "summary": { + "how": "/usr/sbin/sshd", + "actor": { + "secondary": "(invalid user)", + "primary": "unset" + }, + "object": { + "type": "user-session", + "primary": "sshd", + "secondary": "91.121.142.225" + } + }, + "sequence": 44211 + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + }, + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "jtjgUmcBTFzn_XoL304M", + "source": { + "@timestamp": "2018-11-27T01:55:27.238Z", + "user": { + "auid": "unset", + "uid": "0", + "name_map": { + "uid": "root" + } + }, + "beat": { + "hostname": "demo-stack-es-01", + "version": "7.0.0-alpha1", + "name": "demo-stack-es-01" + }, + "host": { + "name": "demo-stack-es-01" + }, + "process": { + "pid": "30088", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "91.121.142.225" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "session": "unset", + "data": { + "op": "PAM:bad_ident", + "terminal": "ssh", + "hostname": "91.121.142.225" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "root" + }, + "object": { + "type": "user-session", + "primary": "ssh", + "secondary": "91.121.142.225" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 44212, + "result": "fail" + }, + "event": { + "type": "user_err", + "action": "error", + "module": "auditd", + "category": "user-login" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "j9jgUmcBTFzn_XoL304M", + "source": { + "@timestamp": "2018-11-27T01:55:27.846Z", + "source": { + "ip": "104.234.223.14" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "sequence": 44213, + "result": "fail", + "session": "unset", + "data": { + "terminal": "sshd", + "acct": "(unknown user)", + "op": "login" + }, + "summary": { + "object": { + "primary": "sshd", + "secondary": "104.234.223.14", + "type": "user-session" + }, + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + } + } + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + }, + "user": { + "name_map": { + "uid": "root" + }, + "uid": "0", + "auid": "unset" + }, + "process": { + "pid": "30090", + "exe": "/usr/sbin/sshd" + }, + "beat": { + "version": "7.0.0-alpha1", + "name": "demo-stack-es-01", + "hostname": "demo-stack-es-01" + }, + "host": { + "name": "demo-stack-es-01" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "kNjgUmcBTFzn_XoL304M", + "source": { + "@timestamp": "2018-11-27T01:55:27.850Z", + "auditd": { + "result": "fail", + "session": "unset", + "data": { + "acct": "(invalid user)", + "terminal": "sshd", + "op": "login" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + }, + "object": { + "secondary": "104.234.223.14", + "type": "user-session", + "primary": "sshd" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 44214 + }, + "beat": { + "name": "demo-stack-es-01", + "hostname": "demo-stack-es-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-es-01" + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + }, + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + }, + "process": { + "exe": "/usr/sbin/sshd", + "pid": "30090" + }, + "source": { + "ip": "104.234.223.14" + }, + "network": { + "direction": "incoming" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "kdjgUmcBTFzn_XoL304M", + "source": { + "@timestamp": "2018-11-27T01:55:27.898Z", + "process": { + "pid": "30090", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "104.234.223.14" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "sequence": 44215, + "result": "fail", + "session": "unset", + "data": { + "terminal": "ssh", + "hostname": "104.234.223.14", + "op": "PAM:bad_ident" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "root" + }, + "object": { + "primary": "ssh", + "secondary": "104.234.223.14", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + } + }, + "event": { + "module": "auditd", + "category": "user-login", + "type": "user_err", + "action": "error" + }, + "beat": { + "name": "demo-stack-es-01", + "hostname": "demo-stack-es-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-es-01" + }, + "user": { + "auid": "unset", + "uid": "0", + "name_map": { + "uid": "root" + } + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "vNjfUmcBTFzn_XoL8jpi", + "source": { + "@timestamp": "2018-11-27T01:54:26.552Z", + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + }, + "user": { + "name_map": { + "uid": "root" + }, + "uid": "0", + "auid": "unset" + }, + "process": { + "pid": "32457", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "107.170.65.109" + }, + "network": { + "direction": "incoming" + }, + "beat": { + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1", + "name": "demo-stack-redis-01" + }, + "host": { + "name": "demo-stack-redis-01" + }, + "auditd": { + "summary": { + "object": { + "primary": "sshd", + "secondary": "107.170.65.109", + "type": "user-session" + }, + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + } + }, + "sequence": 186515, + "result": "fail", + "session": "unset", + "data": { + "terminal": "sshd", + "acct": "(unknown user)", + "op": "login" + } + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "vdjfUmcBTFzn_XoL8jpi", + "source": { + "@timestamp": "2018-11-27T01:54:26.553Z", + "process": { + "exe": "/usr/sbin/sshd", + "pid": "32457" + }, + "host": { + "name": "demo-stack-redis-01" + }, + "beat": { + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1", + "name": "demo-stack-redis-01" + }, + "source": { + "ip": "107.170.65.109" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "summary": { + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + }, + "object": { + "primary": "sshd", + "secondary": "107.170.65.109", + "type": "user-session" + } + }, + "sequence": 186516, + "result": "fail", + "session": "unset", + "data": { + "op": "login", + "acct": "(invalid user)", + "terminal": "sshd" + } + }, + "event": { + "action": "logged-in", + "module": "auditd", + "category": "user-login", + "type": "user_login" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "vtjfUmcBTFzn_XoL8jpi", + "source": { + "@timestamp": "2018-11-27T01:54:26.584Z", + "source": { + "ip": "107.170.65.109" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "data": { + "op": "PAM:bad_ident", + "hostname": "107.170.65.109", + "terminal": "ssh" + }, + "summary": { + "actor": { + "secondary": "root", + "primary": "unset" + }, + "object": { + "secondary": "107.170.65.109", + "type": "user-session", + "primary": "ssh" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 186517, + "result": "fail", + "session": "unset" + }, + "beat": { + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-redis-01" + }, + "event": { + "category": "user-login", + "type": "user_err", + "action": "error", + "module": "auditd" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "pid": "32457", + "exe": "/usr/sbin/sshd" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "59jgUmcBTFzn_XoLk0ht", + "source": { + "@timestamp": "2018-11-27T01:55:07.779Z", + "beat": { + "name": "demo-stack-haproxy-01", + "hostname": "demo-stack-haproxy-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-haproxy-01" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "data": { + "acct": "(unknown user)", + "op": "login", + "terminal": "sshd" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + }, + "object": { + "primary": "sshd", + "secondary": "65.127.203.242", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 142395, + "result": "fail", + "session": "unset" + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + }, + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + }, + "process": { + "pid": "19840", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "65.127.203.242" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "6NjgUmcBTFzn_XoLk0ht", + "source": { + "@timestamp": "2018-11-27T01:55:07.780Z", + "host": { + "name": "demo-stack-haproxy-01" + }, + "event": { + "type": "user_login", + "action": "logged-in", + "module": "auditd", + "category": "user-login" + }, + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + }, + "process": { + "pid": "19840", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "65.127.203.242" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "summary": { + "object": { + "primary": "sshd", + "secondary": "65.127.203.242", + "type": "user-session" + }, + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + } + }, + "sequence": 142396, + "result": "fail", + "session": "unset", + "data": { + "op": "login", + "acct": "(invalid user)", + "terminal": "sshd" + } + }, + "beat": { + "name": "demo-stack-haproxy-01", + "hostname": "demo-stack-haproxy-01", + "version": "7.0.0-alpha1" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "6djgUmcBTFzn_XoLk0ht", + "source": { + "@timestamp": "2018-11-27T01:55:07.840Z", + "beat": { + "name": "demo-stack-haproxy-01", + "hostname": "demo-stack-haproxy-01", + "version": "7.0.0-alpha1" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "pid": "19840", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "65.127.203.242" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "summary": { + "object": { + "secondary": "65.127.203.242", + "type": "user-session", + "primary": "ssh" + }, + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "root" + } + }, + "sequence": 142397, + "result": "fail", + "session": "unset", + "data": { + "op": "PAM:bad_ident", + "hostname": "65.127.203.242", + "terminal": "ssh" + } + }, + "event": { + "module": "auditd", + "category": "user-login", + "type": "user_err", + "action": "error" + }, + "host": { + "name": "demo-stack-haproxy-01" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "P9jhUmcBTFzn_XoLbFvp", + "source": { + "@timestamp": "2018-11-27T01:56:03.454Z", + "auditd": { + "result": "fail", + "session": "unset", + "data": { + "terminal": "sshd", + "op": "login", + "acct": "(unknown user)" + }, + "summary": { + "actor": { + "secondary": "(unknown user)", + "primary": "unset" + }, + "object": { + "primary": "sshd", + "secondary": "164.132.197.108", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 186521 + }, + "event": { + "module": "auditd", + "category": "user-login", + "type": "user_login", + "action": "logged-in" + }, + "user": { + "auid": "unset", + "uid": "0", + "name_map": { + "uid": "root" + } + }, + "process": { + "pid": "32468", + "exe": "/usr/sbin/sshd" + }, + "beat": { + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-redis-01" + }, + "source": { + "ip": "164.132.197.108" + }, + "network": { + "direction": "incoming" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "QNjhUmcBTFzn_XoLbFvp", + "source": { + "@timestamp": "2018-11-27T01:56:03.455Z", + "beat": { + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-redis-01" + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + }, + "user": { + "name_map": { + "uid": "root" + }, + "auid": "unset", + "uid": "0" + }, + "process": { + "pid": "32468", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "164.132.197.108" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "summary": { + "actor": { + "secondary": "(invalid user)", + "primary": "unset" + }, + "object": { + "type": "user-session", + "primary": "sshd", + "secondary": "164.132.197.108" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 186522, + "result": "fail", + "session": "unset", + "data": { + "terminal": "sshd", + "op": "login", + "acct": "(invalid user)" + } + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "QdjhUmcBTFzn_XoLbFvp", + "source": { + "@timestamp": "2018-11-27T01:56:03.574Z", + "beat": { + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-redis-01" + }, + "auditd": { + "data": { + "hostname": "164.132.197.108", + "terminal": "ssh", + "op": "PAM:bad_ident" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "root" + }, + "object": { + "secondary": "164.132.197.108", + "type": "user-session", + "primary": "ssh" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 186523, + "result": "fail", + "session": "unset" + }, + "event": { + "category": "user-login", + "type": "user_err", + "action": "error", + "module": "auditd" + }, + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + }, + "process": { + "pid": "32468", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "164.132.197.108" + }, + "network": { + "direction": "incoming" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "kNjgUmcBTFzn_XoLv0zp", + "source": { + "@timestamp": "2018-11-27T01:55:19.167Z", + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + }, + "process": { + "pid": "752", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "36.84.80.31" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "data": { + "op": "login", + "terminal": "sshd", + "acct": "(unknown user)" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + }, + "object": { + "primary": "sshd", + "secondary": "36.84.80.31", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 192556, + "result": "fail", + "session": "unset" + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + }, + "beat": { + "name": "demo-stack-nginx-01", + "hostname": "demo-stack-nginx-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-nginx-01" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "kdjgUmcBTFzn_XoLv0zp", + "source": { + "@timestamp": "2018-11-27T01:55:19.168Z", + "beat": { + "name": "demo-stack-nginx-01", + "hostname": "demo-stack-nginx-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-nginx-01" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "sequence": 192557, + "result": "fail", + "session": "unset", + "data": { + "acct": "(invalid user)", + "op": "login", + "terminal": "sshd" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + }, + "object": { + "secondary": "36.84.80.31", + "type": "user-session", + "primary": "sshd" + }, + "how": "/usr/sbin/sshd" + } + }, + "event": { + "type": "user_login", + "action": "logged-in", + "module": "auditd", + "category": "user-login" + }, + "user": { + "name_map": { + "uid": "root" + }, + "auid": "unset", + "uid": "0" + }, + "process": { + "pid": "752", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "36.84.80.31" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "ktjgUmcBTFzn_XoLv0zp", + "source": { + "@timestamp": "2018-11-27T01:55:19.429Z", + "auditd": { + "result": "fail", + "session": "unset", + "data": { + "op": "PAM:bad_ident", + "terminal": "ssh", + "hostname": "36.84.80.31" + }, + "summary": { + "actor": { + "secondary": "root", + "primary": "unset" + }, + "object": { + "primary": "ssh", + "secondary": "36.84.80.31", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 192558 + }, + "beat": { + "name": "demo-stack-nginx-01", + "hostname": "demo-stack-nginx-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-nginx-01" + }, + "event": { + "category": "user-login", + "type": "user_err", + "action": "error", + "module": "auditd" + }, + "user": { + "name_map": { + "uid": "root" + }, + "uid": "0", + "auid": "unset" + }, + "process": { + "pid": "752", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "36.84.80.31" + }, + "network": { + "direction": "incoming" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "_NjhUmcBTFzn_XoLd1s3", + "source": { + "@timestamp": "2018-11-27T01:56:06.089Z", + "host": { + "name": "demo-stack-es-01" + }, + "auditd": { + "data": { + "terminal": "sshd", + "op": "login", + "acct": "(unknown user)" + }, + "summary": { + "how": "/usr/sbin/sshd", + "actor": { + "secondary": "(unknown user)", + "primary": "unset" + }, + "object": { + "primary": "sshd", + "secondary": "197.149.137.86", + "type": "user-session" + } + }, + "sequence": 44216, + "result": "fail", + "session": "unset" + }, + "event": { + "action": "logged-in", + "module": "auditd", + "category": "user-login", + "type": "user_login" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "pid": "30106", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "197.149.137.86" + }, + "network": { + "direction": "incoming" + }, + "beat": { + "name": "demo-stack-es-01", + "hostname": "demo-stack-es-01", + "version": "7.0.0-alpha1" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "_djhUmcBTFzn_XoLd1s3", + "source": { + "@timestamp": "2018-11-27T01:56:06.089Z", + "event": { + "type": "user_login", + "action": "logged-in", + "module": "auditd", + "category": "user-login" + }, + "host": { + "name": "demo-stack-es-01" + }, + "beat": { + "name": "demo-stack-es-01", + "hostname": "demo-stack-es-01", + "version": "7.0.0-alpha1" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "pid": "30106", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "197.149.137.86" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "data": { + "op": "login", + "terminal": "sshd", + "acct": "(invalid user)" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + }, + "object": { + "primary": "sshd", + "secondary": "197.149.137.86", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 44217, + "result": "fail", + "session": "unset" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "_tjhUmcBTFzn_XoLd1s3", + "source": { + "@timestamp": "2018-11-27T01:56:06.317Z", + "beat": { + "name": "demo-stack-es-01", + "hostname": "demo-stack-es-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-es-01" + }, + "event": { + "module": "auditd", + "category": "user-login", + "type": "user_err", + "action": "error" + }, + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + }, + "process": { + "pid": "30106", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "197.149.137.86" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "summary": { + "actor": { + "primary": "unset", + "secondary": "root" + }, + "object": { + "primary": "ssh", + "secondary": "197.149.137.86", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 44218, + "result": "fail", + "session": "unset", + "data": { + "hostname": "197.149.137.86", + "op": "PAM:bad_ident", + "terminal": "ssh" + } + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "JtjhUmcBTFzn_XoL7GYK", + "source": { + "@timestamp": "2018-11-27T01:56:36.000Z", + "user": { + "name_map": { + "uid": "root" + }, + "auid": "unset", + "uid": "0" + }, + "beat": { + "name": "demo-stack-apache-01", + "hostname": "demo-stack-apache-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-apache-01" + }, + "process": { + "pid": "26010", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "54.37.191.209" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "sequence": 184398, + "result": "fail", + "session": "unset", + "data": { + "terminal": "ssh", + "op": "PAM:bad_ident", + "hostname": "54.37.191.209" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "root" + }, + "object": { + "primary": "ssh", + "secondary": "54.37.191.209", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + } + }, + "event": { + "category": "user-login", + "type": "user_err", + "action": "error", + "module": "auditd" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "NtjlUmcBTFzn_XoLuLrU", + "source": { + "@timestamp": "2018-11-27T02:00:45.031Z", + "user": { + "auid": "unset", + "uid": "0", + "name_map": { + "uid": "root" + } + }, + "process": { + "pid": "26032", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "128.199.145.205" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "data": { + "acct": "(unknown user)", + "terminal": "sshd", + "op": "login" + }, + "summary": { + "actor": { + "secondary": "(unknown user)", + "primary": "unset" + }, + "object": { + "primary": "sshd", + "secondary": "128.199.145.205", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 184399, + "result": "fail", + "session": "unset" + }, + "beat": { + "hostname": "demo-stack-apache-01", + "version": "7.0.0-alpha1", + "name": "demo-stack-apache-01" + }, + "host": { + "name": "demo-stack-apache-01" + }, + "event": { + "action": "logged-in", + "module": "auditd", + "category": "user-login", + "type": "user_login" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "N9jlUmcBTFzn_XoLuLrU", + "source": { + "@timestamp": "2018-11-27T02:00:45.032Z", + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + }, + "user": { + "name_map": { + "uid": "root" + }, + "auid": "unset", + "uid": "0" + }, + "process": { + "pid": "26032", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "128.199.145.205" + }, + "beat": { + "version": "7.0.0-alpha1", + "name": "demo-stack-apache-01", + "hostname": "demo-stack-apache-01" + }, + "host": { + "name": "demo-stack-apache-01" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "result": "fail", + "session": "unset", + "data": { + "acct": "(invalid user)", + "terminal": "sshd", + "op": "login" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + }, + "object": { + "primary": "sshd", + "secondary": "128.199.145.205", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 184400 + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "ONjlUmcBTFzn_XoLuLrU", + "source": { + "@timestamp": "2018-11-27T02:00:45.255Z", + "auditd": { + "result": "fail", + "session": "unset", + "data": { + "hostname": "128.199.145.205", + "op": "PAM:bad_ident", + "terminal": "ssh" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "root" + }, + "object": { + "primary": "ssh", + "secondary": "128.199.145.205", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 184401 + }, + "event": { + "category": "user-login", + "type": "user_err", + "action": "error", + "module": "auditd" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "pid": "26032", + "exe": "/usr/sbin/sshd" + }, + "beat": { + "hostname": "demo-stack-apache-01", + "version": "7.0.0-alpha1", + "name": "demo-stack-apache-01" + }, + "host": { + "name": "demo-stack-apache-01" + }, + "source": { + "ip": "128.199.145.205" + }, + "network": { + "direction": "incoming" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "OdjlUmcBTFzn_XoLubrj", + "source": { + "@timestamp": "2018-11-27T02:00:45.301Z", + "beat": { + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-redis-01" + }, + "process": { + "exe": "/usr/sbin/sshd", + "pid": "32510" + }, + "source": { + "ip": "107.170.65.109" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "session": "unset", + "data": { + "terminal": "sshd", + "op": "login", + "acct": "(unknown user)" + }, + "summary": { + "object": { + "secondary": "107.170.65.109", + "type": "user-session", + "primary": "sshd" + }, + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + } + }, + "sequence": 186545, + "result": "fail" + }, + "event": { + "action": "logged-in", + "module": "auditd", + "category": "user-login", + "type": "user_login" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "OtjlUmcBTFzn_XoLubrj", + "source": { + "@timestamp": "2018-11-27T02:00:45.302Z", + "source": { + "ip": "107.170.65.109" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "result": "fail", + "session": "unset", + "data": { + "terminal": "sshd", + "op": "login", + "acct": "(invalid user)" + }, + "summary": { + "actor": { + "secondary": "(invalid user)", + "primary": "unset" + }, + "object": { + "primary": "sshd", + "secondary": "107.170.65.109", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 186546 + }, + "event": { + "action": "logged-in", + "module": "auditd", + "category": "user-login", + "type": "user_login" + }, + "host": { + "name": "demo-stack-redis-01" + }, + "beat": { + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1" + }, + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + }, + "process": { + "exe": "/usr/sbin/sshd", + "pid": "32510" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "O9jlUmcBTFzn_XoLubrj", + "source": { + "@timestamp": "2018-11-27T02:00:45.333Z", + "network": { + "direction": "incoming" + }, + "auditd": { + "sequence": 186547, + "result": "fail", + "session": "unset", + "data": { + "hostname": "107.170.65.109", + "op": "PAM:bad_ident", + "terminal": "ssh" + }, + "summary": { + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "root" + }, + "object": { + "type": "user-session", + "primary": "ssh", + "secondary": "107.170.65.109" + } + } + }, + "event": { + "type": "user_err", + "action": "error", + "module": "auditd", + "category": "user-login" + }, + "user": { + "name_map": { + "uid": "root" + }, + "uid": "0", + "auid": "unset" + }, + "process": { + "pid": "32510", + "exe": "/usr/sbin/sshd" + }, + "beat": { + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-redis-01" + }, + "source": { + "ip": "107.170.65.109" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "R9jlUmcBTFzn_XoLvrqH", + "source": { + "@timestamp": "2018-11-27T02:00:46.487Z", + "source": { + "ip": "51.254.140.108" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "sequence": 43217, + "result": "fail", + "session": "unset", + "data": { + "op": "login", + "terminal": "sshd", + "acct": "(unknown user)" + }, + "summary": { + "object": { + "type": "user-session", + "primary": "sshd", + "secondary": "51.254.140.108" + }, + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + } + } + }, + "beat": { + "name": "demo-stack-mysql-01", + "hostname": "demo-stack-mysql-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-mysql-01" + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "pid": "12917", + "exe": "/usr/sbin/sshd" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "SNjlUmcBTFzn_XoLvrqH", + "source": { + "@timestamp": "2018-11-27T02:00:46.487Z", + "user": { + "name_map": { + "uid": "root" + }, + "auid": "unset", + "uid": "0" + }, + "process": { + "pid": "12917", + "exe": "/usr/sbin/sshd" + }, + "beat": { + "name": "demo-stack-mysql-01", + "hostname": "demo-stack-mysql-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-mysql-01" + }, + "source": { + "ip": "51.254.140.108" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "sequence": 43218, + "result": "fail", + "session": "unset", + "data": { + "terminal": "sshd", + "acct": "(invalid user)", + "op": "login" + }, + "summary": { + "object": { + "type": "user-session", + "primary": "sshd", + "secondary": "51.254.140.108" + }, + "how": "/usr/sbin/sshd", + "actor": { + "secondary": "(invalid user)", + "primary": "unset" + } + } + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "SdjlUmcBTFzn_XoLvrqH", + "source": { + "@timestamp": "2018-11-27T02:00:46.595Z", + "host": { + "name": "demo-stack-mysql-01" + }, + "process": { + "pid": "12917", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "51.254.140.108" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "sequence": 43219, + "result": "fail", + "session": "unset", + "data": { + "terminal": "ssh", + "hostname": "51.254.140.108", + "op": "PAM:bad_ident" + }, + "summary": { + "object": { + "primary": "ssh", + "secondary": "51.254.140.108", + "type": "user-session" + }, + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "root" + } + } + }, + "event": { + "type": "user_err", + "action": "error", + "module": "auditd", + "category": "user-login" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "beat": { + "name": "demo-stack-mysql-01", + "hostname": "demo-stack-mysql-01", + "version": "7.0.0-alpha1" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "StjlUmcBTFzn_XoLvrqH", + "source": { + "@timestamp": "2018-11-27T02:00:47.131Z", + "beat": { + "name": "demo-stack-mysql-01", + "hostname": "demo-stack-mysql-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-mysql-01" + }, + "process": { + "pid": "12919", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "79.133.56.139" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "session": "unset", + "data": { + "terminal": "sshd", + "acct": "(unknown user)", + "op": "login" + }, + "summary": { + "actor": { + "secondary": "(unknown user)", + "primary": "unset" + }, + "object": { + "primary": "sshd", + "secondary": "79.133.56.139", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 43220, + "result": "fail" + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "S9jlUmcBTFzn_XoLvrqH", + "source": { + "@timestamp": "2018-11-27T02:00:47.135Z", + "process": { + "pid": "12919", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "79.133.56.139" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "result": "fail", + "session": "unset", + "data": { + "terminal": "sshd", + "acct": "(invalid user)", + "op": "login" + }, + "summary": { + "object": { + "primary": "sshd", + "secondary": "79.133.56.139", + "type": "user-session" + }, + "how": "/usr/sbin/sshd", + "actor": { + "secondary": "(invalid user)", + "primary": "unset" + } + }, + "sequence": 43221 + }, + "beat": { + "name": "demo-stack-mysql-01", + "hostname": "demo-stack-mysql-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-mysql-01" + }, + "event": { + "module": "auditd", + "category": "user-login", + "type": "user_login", + "action": "logged-in" + }, + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "TNjlUmcBTFzn_XoLvrqH", + "source": { + "@timestamp": "2018-11-27T02:00:47.243Z", + "source": { + "ip": "79.133.56.139" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "result": "fail", + "session": "unset", + "data": { + "op": "PAM:bad_ident", + "terminal": "ssh", + "hostname": "79.133.56.139" + }, + "summary": { + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "root" + }, + "object": { + "type": "user-session", + "primary": "ssh", + "secondary": "79.133.56.139" + } + }, + "sequence": 43222 + }, + "event": { + "category": "user-login", + "type": "user_err", + "action": "error", + "module": "auditd" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "exe": "/usr/sbin/sshd", + "pid": "12919" + }, + "beat": { + "name": "demo-stack-mysql-01", + "hostname": "demo-stack-mysql-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-mysql-01" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "wdjmUmcBTFzn_XoL8NQE", + "source": { + "@timestamp": "2018-11-27T02:02:04.698Z", + "process": { + "pid": "19884", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "50.71.229.131" + }, + "beat": { + "name": "demo-stack-haproxy-01", + "hostname": "demo-stack-haproxy-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-haproxy-01" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "result": "fail", + "session": "unset", + "data": { + "acct": "(unknown user)", + "terminal": "sshd", + "op": "login" + }, + "summary": { + "actor": { + "secondary": "(unknown user)", + "primary": "unset" + }, + "object": { + "primary": "sshd", + "secondary": "50.71.229.131", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 142407 + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + }, + "user": { + "uid": "0", + "auid": "unset", + "name_map": { + "uid": "root" + } + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "wtjmUmcBTFzn_XoL8NQE", + "source": { + "@timestamp": "2018-11-27T02:02:04.699Z", + "user": { + "uid": "0", + "auid": "unset", + "name_map": { + "uid": "root" + } + }, + "process": { + "pid": "19884", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "50.71.229.131" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "sequence": 142408, + "result": "fail", + "session": "unset", + "data": { + "op": "login", + "acct": "(invalid user)", + "terminal": "sshd" + }, + "summary": { + "how": "/usr/sbin/sshd", + "actor": { + "secondary": "(invalid user)", + "primary": "unset" + }, + "object": { + "secondary": "50.71.229.131", + "type": "user-session", + "primary": "sshd" + } + } + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + }, + "beat": { + "name": "demo-stack-haproxy-01", + "hostname": "demo-stack-haproxy-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-haproxy-01" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "w9jmUmcBTFzn_XoL8NQE", + "source": { + "@timestamp": "2018-11-27T02:02:04.762Z", + "host": { + "name": "demo-stack-haproxy-01" + }, + "source": { + "ip": "50.71.229.131" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "sequence": 142409, + "result": "fail", + "session": "unset", + "data": { + "terminal": "ssh", + "hostname": "50.71.229.131", + "op": "PAM:bad_ident" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "root" + }, + "object": { + "primary": "ssh", + "secondary": "50.71.229.131", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + } + }, + "event": { + "module": "auditd", + "category": "user-login", + "type": "user_err", + "action": "error" + }, + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + }, + "process": { + "pid": "19884", + "exe": "/usr/sbin/sshd" + }, + "beat": { + "name": "demo-stack-haproxy-01", + "hostname": "demo-stack-haproxy-01", + "version": "7.0.0-alpha1" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "xdjmUmcBTFzn_XoL8tSP", + "source": { + "@timestamp": "2018-11-27T02:02:05.349Z", + "host": { + "name": "demo-stack-redis-01" + }, + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + }, + "process": { + "exe": "/usr/sbin/sshd", + "pid": "32513" + }, + "source": { + "ip": "107.170.65.109" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "session": "unset", + "data": { + "terminal": "sshd", + "acct": "(unknown user)", + "op": "login" + }, + "summary": { + "how": "/usr/sbin/sshd", + "actor": { + "secondary": "(unknown user)", + "primary": "unset" + }, + "object": { + "primary": "sshd", + "secondary": "107.170.65.109", + "type": "user-session" + } + }, + "sequence": 186548, + "result": "fail" + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + }, + "beat": { + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "xtjmUmcBTFzn_XoL8tSP", + "source": { + "@timestamp": "2018-11-27T02:02:05.350Z", + "process": { + "exe": "/usr/sbin/sshd", + "pid": "32513" + }, + "source": { + "ip": "107.170.65.109" + }, + "beat": { + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-redis-01" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "data": { + "terminal": "sshd", + "op": "login", + "acct": "(invalid user)" + }, + "summary": { + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + }, + "object": { + "primary": "sshd", + "secondary": "107.170.65.109", + "type": "user-session" + } + }, + "sequence": 186549, + "result": "fail", + "session": "unset" + }, + "event": { + "type": "user_login", + "action": "logged-in", + "module": "auditd", + "category": "user-login" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "x9jmUmcBTFzn_XoL8tSP", + "source": { + "@timestamp": "2018-11-27T02:02:05.381Z", + "event": { + "category": "user-login", + "type": "user_err", + "action": "error", + "module": "auditd" + }, + "user": { + "auid": "unset", + "uid": "0", + "name_map": { + "uid": "root" + } + }, + "process": { + "pid": "32513", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "107.170.65.109" + }, + "beat": { + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-redis-01" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "summary": { + "actor": { + "secondary": "root", + "primary": "unset" + }, + "object": { + "primary": "ssh", + "secondary": "107.170.65.109", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 186550, + "result": "fail", + "session": "unset", + "data": { + "terminal": "ssh", + "op": "PAM:bad_ident", + "hostname": "107.170.65.109" + } + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "V9jlUmcBTFzn_XoLPq9B", + "source": { + "@timestamp": "2018-11-27T02:00:13.654Z", + "network": { + "direction": "incoming" + }, + "auditd": { + "sequence": 142398, + "result": "fail", + "session": "unset", + "data": { + "acct": "(unknown user)", + "terminal": "sshd", + "op": "login" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + }, + "object": { + "primary": "sshd", + "secondary": "217.182.55.191", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + } + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + }, + "beat": { + "hostname": "demo-stack-haproxy-01", + "version": "7.0.0-alpha1", + "name": "demo-stack-haproxy-01" + }, + "host": { + "name": "demo-stack-haproxy-01" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "pid": "19871", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "217.182.55.191" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "WNjlUmcBTFzn_XoLPq9B", + "source": { + "@timestamp": "2018-11-27T02:00:13.656Z", + "network": { + "direction": "incoming" + }, + "auditd": { + "summary": { + "object": { + "primary": "sshd", + "secondary": "217.182.55.191", + "type": "user-session" + }, + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + } + }, + "sequence": 142399, + "result": "fail", + "session": "unset", + "data": { + "op": "login", + "terminal": "sshd", + "acct": "(invalid user)" + } + }, + "beat": { + "name": "demo-stack-haproxy-01", + "hostname": "demo-stack-haproxy-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-haproxy-01" + }, + "event": { + "module": "auditd", + "category": "user-login", + "type": "user_login", + "action": "logged-in" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "pid": "19871", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "217.182.55.191" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "WdjlUmcBTFzn_XoLPq9B", + "source": { + "@timestamp": "2018-11-27T02:00:13.762Z", + "beat": { + "hostname": "demo-stack-haproxy-01", + "version": "7.0.0-alpha1", + "name": "demo-stack-haproxy-01" + }, + "host": { + "name": "demo-stack-haproxy-01" + }, + "event": { + "category": "user-login", + "type": "user_err", + "action": "error", + "module": "auditd" + }, + "user": { + "uid": "0", + "auid": "unset", + "name_map": { + "uid": "root" + } + }, + "process": { + "pid": "19871", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "217.182.55.191" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "sequence": 142400, + "result": "fail", + "session": "unset", + "data": { + "op": "PAM:bad_ident", + "hostname": "217.182.55.191", + "terminal": "ssh" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "root" + }, + "object": { + "secondary": "217.182.55.191", + "type": "user-session", + "primary": "ssh" + }, + "how": "/usr/sbin/sshd" + } + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "4djmUmcBTFzn_XoLT8Yc", + "source": { + "@timestamp": "2018-11-27T02:01:23.506Z", + "auditd": { + "data": { + "terminal": "sshd", + "op": "login", + "acct": "(unknown user)" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + }, + "object": { + "primary": "sshd", + "secondary": "91.121.110.50", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 142401, + "result": "fail", + "session": "unset" + }, + "beat": { + "name": "demo-stack-haproxy-01", + "hostname": "demo-stack-haproxy-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-haproxy-01" + }, + "event": { + "module": "auditd", + "category": "user-login", + "type": "user_login", + "action": "logged-in" + }, + "user": { + "name_map": { + "uid": "root" + }, + "uid": "0", + "auid": "unset" + }, + "process": { + "exe": "/usr/sbin/sshd", + "pid": "19879" + }, + "source": { + "ip": "91.121.110.50" + }, + "network": { + "direction": "incoming" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "4tjmUmcBTFzn_XoLT8Yc", + "source": { + "@timestamp": "2018-11-27T02:01:23.507Z", + "network": { + "direction": "incoming" + }, + "auditd": { + "sequence": 142402, + "result": "fail", + "session": "unset", + "data": { + "terminal": "sshd", + "op": "login", + "acct": "(invalid user)" + }, + "summary": { + "object": { + "primary": "sshd", + "secondary": "91.121.110.50", + "type": "user-session" + }, + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + } + } + }, + "event": { + "module": "auditd", + "category": "user-login", + "type": "user_login", + "action": "logged-in" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "pid": "19879", + "exe": "/usr/sbin/sshd" + }, + "beat": { + "name": "demo-stack-haproxy-01", + "hostname": "demo-stack-haproxy-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-haproxy-01" + }, + "source": { + "ip": "91.121.110.50" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "49jmUmcBTFzn_XoLT8Yc", + "source": { + "@timestamp": "2018-11-27T02:01:23.614Z", + "auditd": { + "session": "unset", + "data": { + "hostname": "91.121.110.50", + "op": "PAM:bad_ident", + "terminal": "ssh" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "root" + }, + "object": { + "primary": "ssh", + "secondary": "91.121.110.50", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 142403, + "result": "fail" + }, + "event": { + "category": "user-login", + "type": "user_err", + "action": "error", + "module": "auditd" + }, + "user": { + "auid": "unset", + "uid": "0", + "name_map": { + "uid": "root" + } + }, + "process": { + "pid": "19879", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "91.121.110.50" + }, + "beat": { + "name": "demo-stack-haproxy-01", + "hostname": "demo-stack-haproxy-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-haproxy-01" + }, + "network": { + "direction": "incoming" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "ktjnUmcBTFzn_XoLvuUr", + "source": { + "@timestamp": "2018-11-27T02:02:57.473Z", + "event": { + "module": "auditd", + "category": "user-login", + "type": "user_login", + "action": "logged-in" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "exe": "/usr/sbin/sshd", + "pid": "32520" + }, + "source": { + "ip": "213.191.147.66" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "summary": { + "object": { + "type": "user-session", + "primary": "sshd", + "secondary": "213.191.147.66" + }, + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + } + }, + "sequence": 186551, + "result": "fail", + "session": "unset", + "data": { + "terminal": "sshd", + "acct": "(unknown user)", + "op": "login" + } + }, + "host": { + "name": "demo-stack-redis-01" + }, + "beat": { + "version": "7.0.0-alpha1", + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "k9jnUmcBTFzn_XoLvuUr", + "source": { + "@timestamp": "2018-11-27T02:02:57.474Z", + "network": { + "direction": "incoming" + }, + "auditd": { + "sequence": 186552, + "result": "fail", + "session": "unset", + "data": { + "terminal": "sshd", + "op": "login", + "acct": "(invalid user)" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + }, + "object": { + "secondary": "213.191.147.66", + "type": "user-session", + "primary": "sshd" + }, + "how": "/usr/sbin/sshd" + } + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + }, + "beat": { + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-redis-01" + }, + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + }, + "process": { + "pid": "32520", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "213.191.147.66" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "lNjnUmcBTFzn_XoLvuUr", + "source": { + "@timestamp": "2018-11-27T02:02:57.617Z", + "host": { + "name": "demo-stack-redis-01" + }, + "event": { + "module": "auditd", + "category": "user-login", + "type": "user_err", + "action": "error" + }, + "user": { + "name_map": { + "uid": "root" + }, + "auid": "unset", + "uid": "0" + }, + "process": { + "pid": "32520", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "213.191.147.66" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "sequence": 186553, + "result": "fail", + "session": "unset", + "data": { + "terminal": "ssh", + "op": "PAM:bad_ident", + "hostname": "213.191.147.66" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "root" + }, + "object": { + "secondary": "213.191.147.66", + "type": "user-session", + "primary": "ssh" + }, + "how": "/usr/sbin/sshd" + } + }, + "beat": { + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "7tjmUmcBTFzn_XoLlMzO", + "source": { + "@timestamp": "2018-11-27T02:01:41.348Z", + "source": { + "ip": "211.219.52.136" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "summary": { + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + }, + "object": { + "primary": "sshd", + "secondary": "211.219.52.136", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 142404, + "result": "fail", + "session": "unset", + "data": { + "op": "login", + "terminal": "sshd", + "acct": "(unknown user)" + } + }, + "beat": { + "name": "demo-stack-haproxy-01", + "hostname": "demo-stack-haproxy-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-haproxy-01" + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + }, + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + }, + "process": { + "pid": "19881", + "exe": "/usr/sbin/sshd" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "79jmUmcBTFzn_XoLlMzO", + "source": { + "@timestamp": "2018-11-27T02:01:41.349Z", + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + }, + "process": { + "pid": "19881", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "211.219.52.136" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "result": "fail", + "session": "unset", + "data": { + "acct": "(invalid user)", + "terminal": "sshd", + "op": "login" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + }, + "object": { + "secondary": "211.219.52.136", + "type": "user-session", + "primary": "sshd" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 142405 + }, + "beat": { + "version": "7.0.0-alpha1", + "name": "demo-stack-haproxy-01", + "hostname": "demo-stack-haproxy-01" + }, + "host": { + "name": "demo-stack-haproxy-01" + }, + "event": { + "type": "user_login", + "action": "logged-in", + "module": "auditd", + "category": "user-login" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "8NjmUmcBTFzn_XoLlMzO", + "source": { + "@timestamp": "2018-11-27T02:01:41.509Z", + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "pid": "19881", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "211.219.52.136" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "summary": { + "actor": { + "primary": "unset", + "secondary": "root" + }, + "object": { + "primary": "ssh", + "secondary": "211.219.52.136", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 142406, + "result": "fail", + "session": "unset", + "data": { + "op": "PAM:bad_ident", + "hostname": "211.219.52.136", + "terminal": "ssh" + } + }, + "beat": { + "name": "demo-stack-haproxy-01", + "hostname": "demo-stack-haproxy-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-haproxy-01" + }, + "event": { + "category": "user-login", + "type": "user_err", + "action": "error", + "module": "auditd" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "h9joUmcBTFzn_XoLK-92", + "source": { + "@timestamp": "2018-11-27T02:03:25.452Z", + "event": { + "module": "auditd", + "category": "user-login", + "type": "user_login", + "action": "logged-in" + }, + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + }, + "process": { + "exe": "/usr/sbin/sshd", + "pid": "32523" + }, + "beat": { + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-redis-01" + }, + "source": { + "ip": "107.170.65.109" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "sequence": 186554, + "result": "fail", + "session": "unset", + "data": { + "acct": "(unknown user)", + "op": "login", + "terminal": "sshd" + }, + "summary": { + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + }, + "object": { + "secondary": "107.170.65.109", + "type": "user-session", + "primary": "sshd" + } + } + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "iNjoUmcBTFzn_XoLK-92", + "source": { + "@timestamp": "2018-11-27T02:03:25.453Z", + "process": { + "exe": "/usr/sbin/sshd", + "pid": "32523" + }, + "source": { + "ip": "107.170.65.109" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "result": "fail", + "session": "unset", + "data": { + "acct": "(invalid user)", + "terminal": "sshd", + "op": "login" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + }, + "object": { + "type": "user-session", + "primary": "sshd", + "secondary": "107.170.65.109" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 186555 + }, + "beat": { + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-redis-01" + }, + "event": { + "module": "auditd", + "category": "user-login", + "type": "user_login", + "action": "logged-in" + }, + "user": { + "uid": "0", + "auid": "unset", + "name_map": { + "uid": "root" + } + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "idjoUmcBTFzn_XoLK-92", + "source": { + "@timestamp": "2018-11-27T02:03:25.484Z", + "user": { + "auid": "unset", + "uid": "0", + "name_map": { + "uid": "root" + } + }, + "process": { + "pid": "32523", + "exe": "/usr/sbin/sshd" + }, + "beat": { + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-redis-01" + }, + "source": { + "ip": "107.170.65.109" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "result": "fail", + "session": "unset", + "data": { + "op": "PAM:bad_ident", + "terminal": "ssh", + "hostname": "107.170.65.109" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "root" + }, + "object": { + "primary": "ssh", + "secondary": "107.170.65.109", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 186556 + }, + "event": { + "action": "error", + "module": "auditd", + "category": "user-login", + "type": "user_err" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "KtjoUmcBTFzn_XoLAuyv", + "source": { + "@timestamp": "2018-11-27T02:03:15.008Z", + "auditd": { + "result": "fail", + "session": "unset", + "data": { + "acct": "(unknown user)", + "terminal": "sshd", + "op": "login" + }, + "summary": { + "how": "/usr/sbin/sshd", + "actor": { + "secondary": "(unknown user)", + "primary": "unset" + }, + "object": { + "primary": "sshd", + "secondary": "191.255.74.211", + "type": "user-session" + } + }, + "sequence": 43223 + }, + "beat": { + "name": "demo-stack-mysql-01", + "hostname": "demo-stack-mysql-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-mysql-01" + }, + "event": { + "action": "logged-in", + "module": "auditd", + "category": "user-login", + "type": "user_login" + }, + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + }, + "process": { + "pid": "12938", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "191.255.74.211" + }, + "network": { + "direction": "incoming" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "K9joUmcBTFzn_XoLAuyv", + "source": { + "@timestamp": "2018-11-27T02:03:15.008Z", + "auditd": { + "result": "fail", + "session": "unset", + "data": { + "terminal": "sshd", + "acct": "(invalid user)", + "op": "login" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + }, + "object": { + "type": "user-session", + "primary": "sshd", + "secondary": "191.255.74.211" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 43224 + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "pid": "12938", + "exe": "/usr/sbin/sshd" + }, + "beat": { + "name": "demo-stack-mysql-01", + "hostname": "demo-stack-mysql-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-mysql-01" + }, + "source": { + "ip": "191.255.74.211" + }, + "network": { + "direction": "incoming" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "LNjoUmcBTFzn_XoLAuyv", + "source": { + "@timestamp": "2018-11-27T02:03:15.172Z", + "network": { + "direction": "incoming" + }, + "beat": { + "version": "7.0.0-alpha1", + "name": "demo-stack-mysql-01", + "hostname": "demo-stack-mysql-01" + }, + "host": { + "name": "demo-stack-mysql-01" + }, + "auditd": { + "data": { + "hostname": "191.255.74.211", + "terminal": "ssh", + "op": "PAM:bad_ident" + }, + "summary": { + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "root" + }, + "object": { + "primary": "ssh", + "secondary": "191.255.74.211", + "type": "user-session" + } + }, + "sequence": 43225, + "result": "fail", + "session": "unset" + }, + "event": { + "category": "user-login", + "type": "user_err", + "action": "error", + "module": "auditd" + }, + "user": { + "auid": "unset", + "uid": "0", + "name_map": { + "uid": "root" + } + }, + "process": { + "pid": "12938", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "191.255.74.211" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "F9jlUmcBTFzn_XoLX7Lz", + "source": { + "@timestamp": "2018-11-27T02:00:22.277Z", + "beat": { + "version": "7.0.0-alpha1", + "name": "demo-stack-es-01", + "hostname": "demo-stack-es-01" + }, + "host": { + "name": "demo-stack-es-01" + }, + "source": { + "ip": "152.115.61.52" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "sequence": 44222, + "result": "fail", + "session": "unset", + "data": { + "terminal": "sshd", + "acct": "(unknown user)", + "op": "login" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + }, + "object": { + "secondary": "152.115.61.52", + "type": "user-session", + "primary": "sshd" + }, + "how": "/usr/sbin/sshd" + } + }, + "event": { + "action": "logged-in", + "module": "auditd", + "category": "user-login", + "type": "user_login" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "pid": "30191", + "exe": "/usr/sbin/sshd" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "GNjlUmcBTFzn_XoLX7Lz", + "source": { + "@timestamp": "2018-11-27T02:00:22.277Z", + "auditd": { + "data": { + "op": "login", + "acct": "(invalid user)", + "terminal": "sshd" + }, + "summary": { + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + }, + "object": { + "type": "user-session", + "primary": "sshd", + "secondary": "152.115.61.52" + } + }, + "sequence": 44223, + "result": "fail", + "session": "unset" + }, + "beat": { + "name": "demo-stack-es-01", + "hostname": "demo-stack-es-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-es-01" + }, + "event": { + "type": "user_login", + "action": "logged-in", + "module": "auditd", + "category": "user-login" + }, + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + }, + "process": { + "pid": "30191", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "152.115.61.52" + }, + "network": { + "direction": "incoming" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "GdjlUmcBTFzn_XoLX7Lz", + "source": { + "@timestamp": "2018-11-27T02:00:22.397Z", + "process": { + "pid": "30191", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "152.115.61.52" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "result": "fail", + "session": "unset", + "data": { + "op": "PAM:bad_ident", + "hostname": "152.115.61.52", + "terminal": "ssh" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "root" + }, + "object": { + "type": "user-session", + "primary": "ssh", + "secondary": "152.115.61.52" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 44224 + }, + "beat": { + "version": "7.0.0-alpha1", + "name": "demo-stack-es-01", + "hostname": "demo-stack-es-01" + }, + "host": { + "name": "demo-stack-es-01" + }, + "event": { + "action": "error", + "module": "auditd", + "category": "user-login", + "type": "user_err" + }, + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "BtnuUmcBTFzn_XoLAnDn", + "source": { + "@timestamp": "2018-11-27T02:09:48.280Z", + "beat": { + "name": "demo-stack-es-01", + "hostname": "demo-stack-es-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-es-01" + }, + "process": { + "exe": "/usr/sbin/sshd", + "pid": "30394" + }, + "source": { + "ip": "185.227.110.251" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "session": "unset", + "data": { + "acct": "(unknown user)", + "op": "login", + "terminal": "sshd" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + }, + "object": { + "type": "user-session", + "primary": "sshd", + "secondary": "185.227.110.251" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 44237, + "result": "fail" + }, + "event": { + "action": "logged-in", + "module": "auditd", + "category": "user-login", + "type": "user_login" + }, + "user": { + "name_map": { + "uid": "root" + }, + "auid": "unset", + "uid": "0" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "B9nuUmcBTFzn_XoLAnDn", + "source": { + "@timestamp": "2018-11-27T02:09:48.280Z", + "source": { + "ip": "185.227.110.251" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "sequence": 44238, + "result": "fail", + "session": "unset", + "data": { + "op": "login", + "acct": "(invalid user)", + "terminal": "sshd" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + }, + "object": { + "primary": "sshd", + "secondary": "185.227.110.251", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + } + }, + "event": { + "module": "auditd", + "category": "user-login", + "type": "user_login", + "action": "logged-in" + }, + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + }, + "beat": { + "name": "demo-stack-es-01", + "hostname": "demo-stack-es-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-es-01" + }, + "process": { + "exe": "/usr/sbin/sshd", + "pid": "30394" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "CNnuUmcBTFzn_XoLAnDn", + "source": { + "@timestamp": "2018-11-27T02:09:48.468Z", + "host": { + "name": "demo-stack-es-01" + }, + "beat": { + "name": "demo-stack-es-01", + "hostname": "demo-stack-es-01", + "version": "7.0.0-alpha1" + }, + "event": { + "type": "user_err", + "action": "error", + "module": "auditd", + "category": "user-login" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "pid": "30394", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "185.227.110.251" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "data": { + "op": "PAM:bad_ident", + "terminal": "ssh", + "hostname": "185.227.110.251" + }, + "summary": { + "object": { + "primary": "ssh", + "secondary": "185.227.110.251", + "type": "user-session" + }, + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "root" + } + }, + "sequence": 44239, + "result": "fail", + "session": "unset" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "X9nuUmcBTFzn_XoLDHBr", + "source": { + "@timestamp": "2018-11-27T02:09:50.721Z", + "beat": { + "name": "demo-stack-apache-01", + "hostname": "demo-stack-apache-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-apache-01" + }, + "source": { + "ip": "218.149.228.158" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "data": { + "op": "login", + "terminal": "sshd", + "acct": "(unknown user)" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + }, + "object": { + "primary": "sshd", + "secondary": "218.149.228.158", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 184418, + "result": "fail", + "session": "unset" + }, + "event": { + "type": "user_login", + "action": "logged-in", + "module": "auditd", + "category": "user-login" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "pid": "26142", + "exe": "/usr/sbin/sshd" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "YNnuUmcBTFzn_XoLDHBr", + "source": { + "@timestamp": "2018-11-27T02:09:50.722Z", + "user": { + "name_map": { + "uid": "root" + }, + "uid": "0", + "auid": "unset" + }, + "beat": { + "version": "7.0.0-alpha1", + "name": "demo-stack-apache-01", + "hostname": "demo-stack-apache-01" + }, + "host": { + "name": "demo-stack-apache-01" + }, + "process": { + "pid": "26142", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "218.149.228.158" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "summary": { + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + }, + "object": { + "primary": "sshd", + "secondary": "218.149.228.158", + "type": "user-session" + } + }, + "sequence": 184419, + "result": "fail", + "session": "unset", + "data": { + "terminal": "sshd", + "acct": "(invalid user)", + "op": "login" + } + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "YdnuUmcBTFzn_XoLDHBr", + "source": { + "@timestamp": "2018-11-27T02:09:51.346Z", + "network": { + "direction": "incoming" + }, + "auditd": { + "sequence": 184420, + "result": "fail", + "session": "unset", + "data": { + "hostname": "218.149.228.158", + "terminal": "ssh", + "op": "PAM:bad_ident" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "root" + }, + "object": { + "type": "user-session", + "primary": "ssh", + "secondary": "218.149.228.158" + }, + "how": "/usr/sbin/sshd" + } + }, + "event": { + "type": "user_err", + "action": "error", + "module": "auditd", + "category": "user-login" + }, + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + }, + "process": { + "pid": "26142", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "218.149.228.158" + }, + "beat": { + "version": "7.0.0-alpha1", + "name": "demo-stack-apache-01", + "hostname": "demo-stack-apache-01" + }, + "host": { + "name": "demo-stack-apache-01" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "79ntUmcBTFzn_XoLGltv", + "source": { + "@timestamp": "2018-11-27T02:08:48.772Z", + "network": { + "direction": "incoming" + }, + "auditd": { + "data": { + "terminal": "sshd", + "op": "login", + "acct": "(unknown user)" + }, + "summary": { + "actor": { + "secondary": "(unknown user)", + "primary": "unset" + }, + "object": { + "primary": "sshd", + "secondary": "107.170.65.109", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 186566, + "result": "fail", + "session": "unset" + }, + "beat": { + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-redis-01" + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + }, + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + }, + "process": { + "pid": "32556", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "107.170.65.109" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "8NntUmcBTFzn_XoLGltv", + "source": { + "@timestamp": "2018-11-27T02:08:48.774Z", + "source": { + "ip": "107.170.65.109" + }, + "beat": { + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-redis-01" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "sequence": 186567, + "result": "fail", + "session": "unset", + "data": { + "terminal": "sshd", + "op": "login", + "acct": "(invalid user)" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + }, + "object": { + "type": "user-session", + "primary": "sshd", + "secondary": "107.170.65.109" + }, + "how": "/usr/sbin/sshd" + } + }, + "event": { + "module": "auditd", + "category": "user-login", + "type": "user_login", + "action": "logged-in" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "pid": "32556", + "exe": "/usr/sbin/sshd" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "8dntUmcBTFzn_XoLGltv", + "source": { + "@timestamp": "2018-11-27T02:08:48.804Z", + "beat": { + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-redis-01" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "summary": { + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "root" + }, + "object": { + "primary": "ssh", + "secondary": "107.170.65.109", + "type": "user-session" + } + }, + "sequence": 186568, + "result": "fail", + "session": "unset", + "data": { + "terminal": "ssh", + "hostname": "107.170.65.109", + "op": "PAM:bad_ident" + } + }, + "event": { + "category": "user-login", + "type": "user_err", + "action": "error", + "module": "auditd" + }, + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + }, + "process": { + "pid": "32556", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "107.170.65.109" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "99ntUmcBTFzn_XoLHFsj", + "source": { + "@timestamp": "2018-11-27T02:08:49.207Z", + "network": { + "direction": "incoming" + }, + "beat": { + "name": "demo-stack-apache-01", + "hostname": "demo-stack-apache-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-apache-01" + }, + "auditd": { + "sequence": 184409, + "result": "fail", + "session": "unset", + "data": { + "acct": "(unknown user)", + "terminal": "sshd", + "op": "login" + }, + "summary": { + "actor": { + "secondary": "(unknown user)", + "primary": "unset" + }, + "object": { + "secondary": "145.239.82.62", + "type": "user-session", + "primary": "sshd" + }, + "how": "/usr/sbin/sshd" + } + }, + "event": { + "type": "user_login", + "action": "logged-in", + "module": "auditd", + "category": "user-login" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "pid": "26086", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "145.239.82.62" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "-NntUmcBTFzn_XoLHFsj", + "source": { + "@timestamp": "2018-11-27T02:08:49.208Z", + "auditd": { + "sequence": 184410, + "result": "fail", + "session": "unset", + "data": { + "op": "login", + "terminal": "sshd", + "acct": "(invalid user)" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + }, + "object": { + "primary": "sshd", + "secondary": "145.239.82.62", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + } + }, + "event": { + "module": "auditd", + "category": "user-login", + "type": "user_login", + "action": "logged-in" + }, + "user": { + "auid": "unset", + "uid": "0", + "name_map": { + "uid": "root" + } + }, + "process": { + "pid": "26086", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "145.239.82.62" + }, + "network": { + "direction": "incoming" + }, + "beat": { + "name": "demo-stack-apache-01", + "hostname": "demo-stack-apache-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-apache-01" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "-dntUmcBTFzn_XoLHFsj", + "source": { + "@timestamp": "2018-11-27T02:08:49.341Z", + "user": { + "uid": "0", + "auid": "unset", + "name_map": { + "uid": "root" + } + }, + "process": { + "exe": "/usr/sbin/sshd", + "pid": "26086" + }, + "source": { + "ip": "145.239.82.62" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "summary": { + "actor": { + "primary": "unset", + "secondary": "root" + }, + "object": { + "primary": "ssh", + "secondary": "145.239.82.62", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 184411, + "result": "fail", + "session": "unset", + "data": { + "op": "PAM:bad_ident", + "terminal": "ssh", + "hostname": "145.239.82.62" + } + }, + "beat": { + "name": "demo-stack-apache-01", + "hostname": "demo-stack-apache-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-apache-01" + }, + "event": { + "category": "user-login", + "type": "user_err", + "action": "error", + "module": "auditd" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "CNntUmcBTFzn_XoLc2Oa", + "source": { + "@timestamp": "2018-11-27T02:09:11.600Z", + "user": { + "auid": "unset", + "uid": "0", + "name_map": { + "uid": "root" + } + }, + "process": { + "pid": "19924", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "109.115.54.245" + }, + "network": { + "direction": "incoming" + }, + "beat": { + "name": "demo-stack-haproxy-01", + "hostname": "demo-stack-haproxy-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-haproxy-01" + }, + "auditd": { + "sequence": 142413, + "result": "fail", + "session": "unset", + "data": { + "acct": "(unknown user)", + "terminal": "sshd", + "op": "login" + }, + "summary": { + "object": { + "primary": "sshd", + "secondary": "109.115.54.245", + "type": "user-session" + }, + "how": "/usr/sbin/sshd", + "actor": { + "secondary": "(unknown user)", + "primary": "unset" + } + } + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "CdntUmcBTFzn_XoLc2Oa", + "source": { + "@timestamp": "2018-11-27T02:09:11.601Z", + "network": { + "direction": "incoming" + }, + "auditd": { + "summary": { + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + }, + "object": { + "primary": "sshd", + "secondary": "109.115.54.245", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 142414, + "result": "fail", + "session": "unset", + "data": { + "acct": "(invalid user)", + "op": "login", + "terminal": "sshd" + } + }, + "beat": { + "version": "7.0.0-alpha1", + "name": "demo-stack-haproxy-01", + "hostname": "demo-stack-haproxy-01" + }, + "host": { + "name": "demo-stack-haproxy-01" + }, + "event": { + "type": "user_login", + "action": "logged-in", + "module": "auditd", + "category": "user-login" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "exe": "/usr/sbin/sshd", + "pid": "19924" + }, + "source": { + "ip": "109.115.54.245" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "CtntUmcBTFzn_XoLc2Oa", + "source": { + "@timestamp": "2018-11-27T02:09:11.721Z", + "host": { + "name": "demo-stack-haproxy-01" + }, + "beat": { + "name": "demo-stack-haproxy-01", + "hostname": "demo-stack-haproxy-01", + "version": "7.0.0-alpha1" + }, + "event": { + "type": "user_err", + "action": "error", + "module": "auditd", + "category": "user-login" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "pid": "19924", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "109.115.54.245" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "result": "fail", + "session": "unset", + "data": { + "hostname": "109.115.54.245", + "terminal": "ssh", + "op": "PAM:bad_ident" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "root" + }, + "object": { + "secondary": "109.115.54.245", + "type": "user-session", + "primary": "ssh" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 142415 + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "RNnuUmcBTFzn_XoLWnfO", + "source": { + "@timestamp": "2018-11-27T02:10:10.787Z", + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + }, + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + }, + "process": { + "exe": "/usr/sbin/sshd", + "pid": "32565" + }, + "source": { + "ip": "107.170.65.109" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "data": { + "op": "login", + "acct": "(unknown user)", + "terminal": "sshd" + }, + "summary": { + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + }, + "object": { + "primary": "sshd", + "secondary": "107.170.65.109", + "type": "user-session" + } + }, + "sequence": 186569, + "result": "fail", + "session": "unset" + }, + "beat": { + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-redis-01" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "RdnuUmcBTFzn_XoLWnfO", + "source": { + "@timestamp": "2018-11-27T02:10:10.788Z", + "network": { + "direction": "incoming" + }, + "auditd": { + "sequence": 186570, + "result": "fail", + "session": "unset", + "data": { + "acct": "(invalid user)", + "terminal": "sshd", + "op": "login" + }, + "summary": { + "actor": { + "secondary": "(invalid user)", + "primary": "unset" + }, + "object": { + "type": "user-session", + "primary": "sshd", + "secondary": "107.170.65.109" + }, + "how": "/usr/sbin/sshd" + } + }, + "beat": { + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-redis-01" + }, + "event": { + "module": "auditd", + "category": "user-login", + "type": "user_login", + "action": "logged-in" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "pid": "32565", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "107.170.65.109" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "RtnuUmcBTFzn_XoLWnfO", + "source": { + "@timestamp": "2018-11-27T02:10:10.819Z", + "event": { + "action": "error", + "module": "auditd", + "category": "user-login", + "type": "user_err" + }, + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + }, + "process": { + "pid": "32565", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "107.170.65.109" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "sequence": 186571, + "result": "fail", + "session": "unset", + "data": { + "hostname": "107.170.65.109", + "op": "PAM:bad_ident", + "terminal": "ssh" + }, + "summary": { + "how": "/usr/sbin/sshd", + "actor": { + "secondary": "root", + "primary": "unset" + }, + "object": { + "primary": "ssh", + "secondary": "107.170.65.109", + "type": "user-session" + } + } + }, + "host": { + "name": "demo-stack-redis-01" + }, + "beat": { + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "AdntUmcBTFzn_XoLiGV_", + "source": { + "@timestamp": "2018-11-27T02:09:16.902Z", + "beat": { + "name": "demo-stack-haproxy-01", + "hostname": "demo-stack-haproxy-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-haproxy-01" + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + }, + "user": { + "auid": "unset", + "uid": "0", + "name_map": { + "uid": "root" + } + }, + "process": { + "pid": "19926", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "71.90.181.64" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "sequence": 142416, + "result": "fail", + "session": "unset", + "data": { + "terminal": "sshd", + "op": "login", + "acct": "(unknown user)" + }, + "summary": { + "how": "/usr/sbin/sshd", + "actor": { + "secondary": "(unknown user)", + "primary": "unset" + }, + "object": { + "primary": "sshd", + "secondary": "71.90.181.64", + "type": "user-session" + } + } + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "AtntUmcBTFzn_XoLiGV_", + "source": { + "@timestamp": "2018-11-27T02:09:16.903Z", + "event": { + "action": "logged-in", + "module": "auditd", + "category": "user-login", + "type": "user_login" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "pid": "19926", + "exe": "/usr/sbin/sshd" + }, + "beat": { + "name": "demo-stack-haproxy-01", + "hostname": "demo-stack-haproxy-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-haproxy-01" + }, + "source": { + "ip": "71.90.181.64" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "result": "fail", + "session": "unset", + "data": { + "op": "login", + "acct": "(invalid user)", + "terminal": "sshd" + }, + "summary": { + "object": { + "primary": "sshd", + "secondary": "71.90.181.64", + "type": "user-session" + }, + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + } + }, + "sequence": 142417 + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "A9ntUmcBTFzn_XoLiGV_", + "source": { + "@timestamp": "2018-11-27T02:09:16.974Z", + "auditd": { + "sequence": 142418, + "result": "fail", + "session": "unset", + "data": { + "terminal": "ssh", + "op": "PAM:bad_ident", + "hostname": "71.90.181.64" + }, + "summary": { + "object": { + "secondary": "71.90.181.64", + "type": "user-session", + "primary": "ssh" + }, + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "root" + } + } + }, + "event": { + "module": "auditd", + "category": "user-login", + "type": "user_err", + "action": "error" + }, + "user": { + "name_map": { + "uid": "root" + }, + "uid": "0", + "auid": "unset" + }, + "process": { + "pid": "19926", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "71.90.181.64" + }, + "network": { + "direction": "incoming" + }, + "beat": { + "name": "demo-stack-haproxy-01", + "hostname": "demo-stack-haproxy-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-haproxy-01" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "2tntUmcBTFzn_XoLSl-h", + "source": { + "@timestamp": "2018-11-27T02:09:01.110Z", + "event": { + "type": "user_acct", + "action": "was-authorized", + "module": "auditd", + "category": "user-login" + }, + "user": { + "auid": "unset", + "uid": "0", + "name_map": { + "uid": "root" + } + }, + "process": { + "pid": "830", + "exe": "/usr/sbin/cron" + }, + "auditd": { + "summary": { + "actor": { + "primary": "unset", + "secondary": "root" + }, + "object": { + "primary": "cron", + "type": "user-session" + }, + "how": "/usr/sbin/cron" + }, + "sequence": 192568, + "result": "success", + "session": "unset", + "data": { + "terminal": "cron", + "op": "PAM:accounting", + "acct": "root" + } + }, + "beat": { + "name": "demo-stack-nginx-01", + "hostname": "demo-stack-nginx-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-nginx-01" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "29ntUmcBTFzn_XoLSl-h", + "source": { + "@timestamp": "2018-11-27T02:09:01.110Z", + "auditd": { + "sequence": 192569, + "result": "success", + "session": "unset", + "data": { + "terminal": "cron", + "acct": "root", + "op": "PAM:setcred" + }, + "summary": { + "actor": { + "secondary": "root", + "primary": "unset" + }, + "object": { + "primary": "cron", + "type": "user-session" + }, + "how": "/usr/sbin/cron" + } + }, + "beat": { + "name": "demo-stack-nginx-01", + "hostname": "demo-stack-nginx-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-nginx-01" + }, + "event": { + "action": "acquired-credentials", + "module": "auditd", + "category": "user-login", + "type": "cred_acq" + }, + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + }, + "process": { + "pid": "830", + "exe": "/usr/sbin/cron" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "3NntUmcBTFzn_XoLSl-h", + "source": { + "@timestamp": "2018-11-27T02:09:01.112Z", + "beat": { + "name": "demo-stack-nginx-01", + "hostname": "demo-stack-nginx-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-nginx-01" + }, + "user": { + "name_map": { + "auid": "root", + "uid": "root" + }, + "auid": "0", + "uid": "0" + }, + "process": { + "pid": "830", + "exe": "/usr/sbin/cron" + }, + "auditd": { + "data": { + "op": "PAM:session_open", + "acct": "root", + "terminal": "cron" + }, + "summary": { + "object": { + "type": "user-session", + "primary": "cron" + }, + "how": "/usr/sbin/cron", + "actor": { + "primary": "root", + "secondary": "root" + } + }, + "sequence": 192571, + "result": "success", + "session": "9864" + }, + "event": { + "module": "auditd", + "category": "user-login", + "type": "user_start", + "action": "started-session" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "3dntUmcBTFzn_XoLSl-h", + "source": { + "@timestamp": "2018-11-27T02:09:01.215Z", + "user": { + "name_map": { + "auid": "root", + "uid": "root" + }, + "auid": "0", + "uid": "0" + }, + "process": { + "pid": "830", + "exe": "/usr/sbin/cron" + }, + "auditd": { + "sequence": 192572, + "result": "success", + "session": "9864", + "data": { + "op": "PAM:setcred", + "acct": "root", + "terminal": "cron" + }, + "summary": { + "how": "/usr/sbin/cron", + "actor": { + "primary": "root", + "secondary": "root" + }, + "object": { + "primary": "cron", + "type": "user-session" + } + } + }, + "beat": { + "name": "demo-stack-nginx-01", + "hostname": "demo-stack-nginx-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-nginx-01" + }, + "event": { + "category": "user-login", + "type": "cred_disp", + "action": "disposed-credentials", + "module": "auditd" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "3tntUmcBTFzn_XoLSl-h", + "source": { + "@timestamp": "2018-11-27T02:09:01.216Z", + "user": { + "auid": "0", + "name_map": { + "auid": "root", + "uid": "root" + }, + "uid": "0" + }, + "process": { + "pid": "830", + "exe": "/usr/sbin/cron" + }, + "auditd": { + "data": { + "op": "PAM:session_close", + "acct": "root", + "terminal": "cron" + }, + "summary": { + "actor": { + "primary": "root", + "secondary": "root" + }, + "object": { + "primary": "cron", + "type": "user-session" + }, + "how": "/usr/sbin/cron" + }, + "sequence": 192573, + "result": "success", + "session": "9864" + }, + "beat": { + "hostname": "demo-stack-nginx-01", + "version": "7.0.0-alpha1", + "name": "demo-stack-nginx-01" + }, + "host": { + "name": "demo-stack-nginx-01" + }, + "event": { + "action": "ended-session", + "module": "auditd", + "category": "user-login", + "type": "user_end" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "_dntUmcBTFzn_XoLTV_Y", + "source": { + "@timestamp": "2018-11-27T02:09:01.933Z", + "event": { + "category": "user-login", + "type": "user_acct", + "action": "was-authorized", + "module": "auditd" + }, + "user": { + "uid": "0", + "auid": "unset", + "name_map": { + "uid": "root" + } + }, + "beat": { + "name": "demo-stack-apache-01", + "hostname": "demo-stack-apache-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-apache-01" + }, + "process": { + "pid": "26094", + "exe": "/usr/sbin/cron" + }, + "auditd": { + "sequence": 184412, + "result": "success", + "session": "unset", + "data": { + "terminal": "cron", + "op": "PAM:accounting", + "acct": "root" + }, + "summary": { + "actor": { + "secondary": "root", + "primary": "unset" + }, + "object": { + "primary": "cron", + "type": "user-session" + }, + "how": "/usr/sbin/cron" + } + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "_tntUmcBTFzn_XoLTV_Y", + "source": { + "@timestamp": "2018-11-27T02:09:01.933Z", + "event": { + "category": "user-login", + "type": "cred_acq", + "action": "acquired-credentials", + "module": "auditd" + }, + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + }, + "process": { + "pid": "26094", + "exe": "/usr/sbin/cron" + }, + "host": { + "name": "demo-stack-apache-01" + }, + "beat": { + "name": "demo-stack-apache-01", + "hostname": "demo-stack-apache-01", + "version": "7.0.0-alpha1" + }, + "auditd": { + "summary": { + "actor": { + "primary": "unset", + "secondary": "root" + }, + "object": { + "primary": "cron", + "type": "user-session" + }, + "how": "/usr/sbin/cron" + }, + "sequence": 184413, + "result": "success", + "session": "unset", + "data": { + "terminal": "cron", + "op": "PAM:setcred", + "acct": "root" + } + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "_9ntUmcBTFzn_XoLTV_Y", + "source": { + "@timestamp": "2018-11-27T02:09:01.935Z", + "auditd": { + "result": "success", + "session": "9860", + "data": { + "terminal": "cron", + "acct": "root", + "op": "PAM:session_open" + }, + "summary": { + "actor": { + "primary": "root", + "secondary": "root" + }, + "object": { + "primary": "cron", + "type": "user-session" + }, + "how": "/usr/sbin/cron" + }, + "sequence": 184415 + }, + "beat": { + "name": "demo-stack-apache-01", + "hostname": "demo-stack-apache-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-apache-01" + }, + "event": { + "action": "started-session", + "module": "auditd", + "category": "user-login", + "type": "user_start" + }, + "user": { + "name_map": { + "auid": "root", + "uid": "root" + }, + "auid": "0", + "uid": "0" + }, + "process": { + "pid": "26094", + "exe": "/usr/sbin/cron" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "ANntUmcBTFzn_XoLTWDY", + "source": { + "@timestamp": "2018-11-27T02:09:02.034Z", + "host": { + "name": "demo-stack-apache-01" + }, + "auditd": { + "session": "9860", + "data": { + "acct": "root", + "terminal": "cron", + "op": "PAM:setcred" + }, + "summary": { + "object": { + "primary": "cron", + "type": "user-session" + }, + "how": "/usr/sbin/cron", + "actor": { + "primary": "root", + "secondary": "root" + } + }, + "sequence": 184416, + "result": "success" + }, + "event": { + "action": "disposed-credentials", + "module": "auditd", + "category": "user-login", + "type": "cred_disp" + }, + "user": { + "uid": "0", + "auid": "0", + "name_map": { + "auid": "root", + "uid": "root" + } + }, + "process": { + "pid": "26094", + "exe": "/usr/sbin/cron" + }, + "beat": { + "name": "demo-stack-apache-01", + "hostname": "demo-stack-apache-01", + "version": "7.0.0-alpha1" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "AdntUmcBTFzn_XoLTWDY", + "source": { + "@timestamp": "2018-11-27T02:09:02.035Z", + "event": { + "module": "auditd", + "category": "user-login", + "type": "user_end", + "action": "ended-session" + }, + "user": { + "name_map": { + "uid": "root", + "auid": "root" + }, + "auid": "0", + "uid": "0" + }, + "process": { + "pid": "26094", + "exe": "/usr/sbin/cron" + }, + "auditd": { + "data": { + "terminal": "cron", + "acct": "root", + "op": "PAM:session_close" + }, + "summary": { + "how": "/usr/sbin/cron", + "actor": { + "secondary": "root", + "primary": "root" + }, + "object": { + "type": "user-session", + "primary": "cron" + } + }, + "sequence": 184417, + "result": "success", + "session": "9860" + }, + "beat": { + "name": "demo-stack-apache-01", + "hostname": "demo-stack-apache-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-apache-01" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "odnuUmcBTFzn_XoLa3iq", + "source": { + "@timestamp": "2018-11-27T02:10:15.075Z", + "auditd": { + "data": { + "terminal": "sshd", + "acct": "(unknown user)", + "op": "login" + }, + "summary": { + "object": { + "type": "user-session", + "primary": "sshd", + "secondary": "185.244.25.108" + }, + "how": "/usr/sbin/sshd", + "actor": { + "secondary": "(unknown user)", + "primary": "unset" + } + }, + "sequence": 44240, + "result": "fail", + "session": "unset" + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + }, + "user": { + "uid": "0", + "auid": "unset", + "name_map": { + "uid": "root" + } + }, + "process": { + "exe": "/usr/sbin/sshd", + "pid": "30401" + }, + "source": { + "ip": "185.244.25.108" + }, + "beat": { + "version": "7.0.0-alpha1", + "name": "demo-stack-es-01", + "hostname": "demo-stack-es-01" + }, + "host": { + "name": "demo-stack-es-01" + }, + "network": { + "direction": "incoming" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "otnuUmcBTFzn_XoLa3iq", + "source": { + "@timestamp": "2018-11-27T02:10:15.075Z", + "process": { + "pid": "30401", + "exe": "/usr/sbin/sshd" + }, + "beat": { + "version": "7.0.0-alpha1", + "name": "demo-stack-es-01", + "hostname": "demo-stack-es-01" + }, + "host": { + "name": "demo-stack-es-01" + }, + "source": { + "ip": "185.244.25.108" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "session": "unset", + "data": { + "terminal": "sshd", + "acct": "(invalid user)", + "op": "login" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + }, + "object": { + "primary": "sshd", + "secondary": "185.244.25.108", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 44241, + "result": "fail" + }, + "event": { + "action": "logged-in", + "module": "auditd", + "category": "user-login", + "type": "user_login" + }, + "user": { + "name_map": { + "uid": "root" + }, + "auid": "unset", + "uid": "0" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "o9nuUmcBTFzn_XoLa3iq", + "source": { + "@timestamp": "2018-11-27T02:10:15.175Z", + "host": { + "name": "demo-stack-es-01" + }, + "auditd": { + "data": { + "hostname": "185.244.25.108", + "terminal": "ssh", + "op": "PAM:bad_ident" + }, + "summary": { + "actor": { + "secondary": "root", + "primary": "unset" + }, + "object": { + "secondary": "185.244.25.108", + "type": "user-session", + "primary": "ssh" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 44242, + "result": "fail", + "session": "unset" + }, + "event": { + "action": "error", + "module": "auditd", + "category": "user-login", + "type": "user_err" + }, + "user": { + "uid": "0", + "auid": "unset", + "name_map": { + "uid": "root" + } + }, + "process": { + "pid": "30401", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "185.244.25.108" + }, + "network": { + "direction": "incoming" + }, + "beat": { + "name": "demo-stack-es-01", + "hostname": "demo-stack-es-01", + "version": "7.0.0-alpha1" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "z9nuUmcBTFzn_XoLh3rt", + "source": { + "@timestamp": "2018-11-27T02:10:22.335Z", + "auditd": { + "summary": { + "object": { + "primary": "sshd", + "secondary": "146.196.59.36", + "type": "user-session" + }, + "how": "/usr/sbin/sshd", + "actor": { + "secondary": "(unknown user)", + "primary": "unset" + } + }, + "sequence": 44243, + "result": "fail", + "session": "unset", + "data": { + "terminal": "sshd", + "op": "login", + "acct": "(unknown user)" + } + }, + "beat": { + "name": "demo-stack-es-01", + "hostname": "demo-stack-es-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-es-01" + }, + "event": { + "action": "logged-in", + "module": "auditd", + "category": "user-login", + "type": "user_login" + }, + "user": { + "name_map": { + "uid": "root" + }, + "uid": "0", + "auid": "unset" + }, + "process": { + "pid": "30405", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "146.196.59.36" + }, + "network": { + "direction": "incoming" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "0NnuUmcBTFzn_XoLh3rt", + "source": { + "@timestamp": "2018-11-27T02:10:22.335Z", + "source": { + "ip": "146.196.59.36" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "result": "fail", + "session": "unset", + "data": { + "acct": "(invalid user)", + "terminal": "sshd", + "op": "login" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + }, + "object": { + "type": "user-session", + "primary": "sshd", + "secondary": "146.196.59.36" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 44244 + }, + "beat": { + "name": "demo-stack-es-01", + "hostname": "demo-stack-es-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-es-01" + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "pid": "30405", + "exe": "/usr/sbin/sshd" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "0dnuUmcBTFzn_XoLh3rt", + "source": { + "@timestamp": "2018-11-27T02:10:22.583Z", + "process": { + "pid": "30405", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "146.196.59.36" + }, + "host": { + "name": "demo-stack-es-01" + }, + "beat": { + "name": "demo-stack-es-01", + "hostname": "demo-stack-es-01", + "version": "7.0.0-alpha1" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "sequence": 44245, + "result": "fail", + "session": "unset", + "data": { + "op": "PAM:bad_ident", + "hostname": "146.196.59.36", + "terminal": "ssh" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "root" + }, + "object": { + "type": "user-session", + "primary": "ssh", + "secondary": "146.196.59.36" + }, + "how": "/usr/sbin/sshd" + } + }, + "event": { + "module": "auditd", + "category": "user-login", + "type": "user_err", + "action": "error" + }, + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "9tnuUmcBTFzn_XoLM3ME", + "source": { + "@timestamp": "2018-11-27T02:10:00.602Z", + "beat": { + "name": "demo-stack-nginx-01", + "hostname": "demo-stack-nginx-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-nginx-01" + }, + "event": { + "module": "file_integrity", + "action": [ + "created" + ] + }, + "file": { + "size": 0, + "type": "file", + "uid": 0, + "owner": "root", + "group": "root", + "mode": "0000", + "mtime": "2018-11-27T02:10:00.596Z", + "gid": 0, + "inode": "185", + "path": "/etc/sed6b0EHM", + "ctime": "2018-11-27T02:10:00.596Z" + }, + "hash": { + "sha1": "da39a3ee5e6b4b0d3255bfef95601890afd80709" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "99nuUmcBTFzn_XoLM3ME", + "source": { + "@timestamp": "2018-11-27T02:10:00.603Z", + "beat": { + "version": "7.0.0-alpha1", + "name": "demo-stack-nginx-01", + "hostname": "demo-stack-nginx-01" + }, + "event": { + "module": "file_integrity", + "action": [ + "updated" + ] + }, + "file": { + "inode": "185", + "size": 50, + "type": "file", + "uid": 0, + "owner": "root", + "mode": "0000", + "path": "/etc/sed6b0EHM", + "group": "root", + "mtime": "2018-11-27T02:10:00.600Z", + "ctime": "2018-11-27T02:10:00.600Z", + "gid": 0 + }, + "hash": { + "sha1": "58a8b2bb04893785eb5a48598a16a3fa8ad2fa36" + }, + "host": { + "name": "demo-stack-nginx-01" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "-NnuUmcBTFzn_XoLM3ME", + "source": { + "@timestamp": "2018-11-27T02:10:00.605Z", + "file": { + "path": "/etc/sed6b0EHM" + }, + "beat": { + "name": "demo-stack-nginx-01", + "hostname": "demo-stack-nginx-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-nginx-01" + }, + "event": { + "module": "file_integrity", + "action": [ + "attributes_modified" + ] + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "-dnuUmcBTFzn_XoLM3ME", + "source": { + "@timestamp": "2018-11-27T02:10:00.606Z", + "beat": { + "name": "demo-stack-nginx-01", + "hostname": "demo-stack-nginx-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-nginx-01" + }, + "event": { + "module": "file_integrity", + "action": [ + "moved" + ] + }, + "file": { + "path": "/etc/sed6b0EHM" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "-tnuUmcBTFzn_XoLM3ME", + "source": { + "@timestamp": "2018-11-27T02:10:00.607Z", + "event": { + "action": [ + "created" + ], + "module": "file_integrity" + }, + "file": { + "owner": "root", + "uid": 0, + "mode": "0644", + "inode": "185", + "mtime": "2018-11-27T02:10:00.600Z", + "gid": 0, + "group": "root", + "path": "/etc/hosts", + "ctime": "2018-11-27T02:10:00.600Z", + "type": "file", + "size": 205 + }, + "hash": { + "sha1": "5a4ccf92aa02bc100c5b20faeed3691286e039e5" + }, + "beat": { + "version": "7.0.0-alpha1", + "name": "demo-stack-nginx-01", + "hostname": "demo-stack-nginx-01" + }, + "host": { + "name": "demo-stack-nginx-01" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "VdnzUmcBTFzn_XoLR-PG", + "source": { + "@timestamp": "2018-11-27T02:15:33.590Z", + "auditd": { + "result": "fail", + "session": "unset", + "data": { + "op": "login", + "acct": "(unknown user)", + "terminal": "sshd" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + }, + "object": { + "secondary": "51.75.23.199", + "type": "user-session", + "primary": "sshd" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 43238 + }, + "event": { + "action": "logged-in", + "module": "auditd", + "category": "user-login", + "type": "user_login" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "pid": "13014", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "51.75.23.199" + }, + "beat": { + "hostname": "demo-stack-mysql-01", + "version": "7.0.0-alpha1", + "name": "demo-stack-mysql-01" + }, + "host": { + "name": "demo-stack-mysql-01" + }, + "network": { + "direction": "incoming" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "VtnzUmcBTFzn_XoLR-PG", + "source": { + "@timestamp": "2018-11-27T02:15:33.590Z", + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + }, + "user": { + "name_map": { + "uid": "root" + }, + "auid": "unset", + "uid": "0" + }, + "process": { + "exe": "/usr/sbin/sshd", + "pid": "13014" + }, + "source": { + "ip": "51.75.23.199" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "sequence": 43239, + "result": "fail", + "session": "unset", + "data": { + "op": "login", + "terminal": "sshd", + "acct": "(invalid user)" + }, + "summary": { + "actor": { + "secondary": "(invalid user)", + "primary": "unset" + }, + "object": { + "primary": "sshd", + "secondary": "51.75.23.199", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + } + }, + "beat": { + "version": "7.0.0-alpha1", + "name": "demo-stack-mysql-01", + "hostname": "demo-stack-mysql-01" + }, + "host": { + "name": "demo-stack-mysql-01" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "V9nzUmcBTFzn_XoLR-PG", + "source": { + "@timestamp": "2018-11-27T02:15:33.702Z", + "event": { + "action": "error", + "module": "auditd", + "category": "user-login", + "type": "user_err" + }, + "user": { + "uid": "0", + "auid": "unset", + "name_map": { + "uid": "root" + } + }, + "process": { + "pid": "13014", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "51.75.23.199" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "summary": { + "actor": { + "primary": "unset", + "secondary": "root" + }, + "object": { + "secondary": "51.75.23.199", + "type": "user-session", + "primary": "ssh" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 43240, + "result": "fail", + "session": "unset", + "data": { + "terminal": "ssh", + "op": "PAM:bad_ident", + "hostname": "51.75.23.199" + } + }, + "host": { + "name": "demo-stack-mysql-01" + }, + "beat": { + "hostname": "demo-stack-mysql-01", + "version": "7.0.0-alpha1", + "name": "demo-stack-mysql-01" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "3tnzUmcBTFzn_XoLUOOL", + "source": { + "@timestamp": "2018-11-27T02:15:35.841Z", + "host": { + "name": "demo-stack-nginx-01" + }, + "process": { + "exe": "/usr/sbin/sshd", + "pid": "939" + }, + "source": { + "ip": "181.28.191.54" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "summary": { + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + }, + "object": { + "primary": "sshd", + "secondary": "181.28.191.54", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 192586, + "result": "fail", + "session": "unset", + "data": { + "op": "login", + "terminal": "sshd", + "acct": "(unknown user)" + } + }, + "event": { + "module": "auditd", + "category": "user-login", + "type": "user_login", + "action": "logged-in" + }, + "user": { + "name_map": { + "uid": "root" + }, + "uid": "0", + "auid": "unset" + }, + "beat": { + "name": "demo-stack-nginx-01", + "hostname": "demo-stack-nginx-01", + "version": "7.0.0-alpha1" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "39nzUmcBTFzn_XoLUOOL", + "source": { + "@timestamp": "2018-11-27T02:15:35.843Z", + "auditd": { + "sequence": 192587, + "result": "fail", + "session": "unset", + "data": { + "terminal": "sshd", + "op": "login", + "acct": "(invalid user)" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + }, + "object": { + "secondary": "181.28.191.54", + "type": "user-session", + "primary": "sshd" + }, + "how": "/usr/sbin/sshd" + } + }, + "beat": { + "name": "demo-stack-nginx-01", + "hostname": "demo-stack-nginx-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-nginx-01" + }, + "event": { + "action": "logged-in", + "module": "auditd", + "category": "user-login", + "type": "user_login" + }, + "user": { + "auid": "unset", + "uid": "0", + "name_map": { + "uid": "root" + } + }, + "process": { + "exe": "/usr/sbin/sshd", + "pid": "939" + }, + "source": { + "ip": "181.28.191.54" + }, + "network": { + "direction": "incoming" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "4NnzUmcBTFzn_XoLUOOL", + "source": { + "@timestamp": "2018-11-27T02:15:36.030Z", + "auditd": { + "sequence": 192588, + "result": "fail", + "session": "unset", + "data": { + "op": "PAM:bad_ident", + "hostname": "181.28.191.54", + "terminal": "ssh" + }, + "summary": { + "object": { + "type": "user-session", + "primary": "ssh", + "secondary": "181.28.191.54" + }, + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "root" + } + } + }, + "beat": { + "name": "demo-stack-nginx-01", + "hostname": "demo-stack-nginx-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-nginx-01" + }, + "event": { + "action": "error", + "module": "auditd", + "category": "user-login", + "type": "user_err" + }, + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + }, + "process": { + "pid": "939", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "181.28.191.54" + }, + "network": { + "direction": "incoming" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "-NnxUmcBTFzn_XoLYbnr", + "source": { + "@timestamp": "2018-11-27T02:13:29.217Z", + "host": { + "name": "demo-stack-apache-01" + }, + "auditd": { + "data": { + "acct": "(unknown user)", + "terminal": "sshd", + "op": "login" + }, + "summary": { + "object": { + "type": "user-session", + "primary": "sshd", + "secondary": "180.76.239.66" + }, + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + } + }, + "sequence": 184427, + "result": "fail", + "session": "unset" + }, + "event": { + "module": "auditd", + "category": "user-login", + "type": "user_login", + "action": "logged-in" + }, + "user": { + "name_map": { + "uid": "root" + }, + "uid": "0", + "auid": "unset" + }, + "process": { + "exe": "/usr/sbin/sshd", + "pid": "26172" + }, + "source": { + "ip": "180.76.239.66" + }, + "network": { + "direction": "incoming" + }, + "beat": { + "hostname": "demo-stack-apache-01", + "version": "7.0.0-alpha1", + "name": "demo-stack-apache-01" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "-dnxUmcBTFzn_XoLYbnr", + "source": { + "@timestamp": "2018-11-27T02:13:29.218Z", + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + }, + "user": { + "name_map": { + "uid": "root" + }, + "uid": "0", + "auid": "unset" + }, + "process": { + "pid": "26172", + "exe": "/usr/sbin/sshd" + }, + "beat": { + "name": "demo-stack-apache-01", + "hostname": "demo-stack-apache-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-apache-01" + }, + "source": { + "ip": "180.76.239.66" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "data": { + "terminal": "sshd", + "op": "login", + "acct": "(invalid user)" + }, + "summary": { + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + }, + "object": { + "type": "user-session", + "primary": "sshd", + "secondary": "180.76.239.66" + } + }, + "sequence": 184428, + "result": "fail", + "session": "unset" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "-tnxUmcBTFzn_XoLYbnr", + "source": { + "@timestamp": "2018-11-27T02:13:29.430Z", + "network": { + "direction": "incoming" + }, + "auditd": { + "sequence": 184429, + "result": "fail", + "session": "unset", + "data": { + "hostname": "180.76.239.66", + "terminal": "ssh", + "op": "PAM:bad_ident" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "root" + }, + "object": { + "primary": "ssh", + "secondary": "180.76.239.66", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + } + }, + "event": { + "module": "auditd", + "category": "user-login", + "type": "user_err", + "action": "error" + }, + "user": { + "auid": "unset", + "uid": "0", + "name_map": { + "uid": "root" + } + }, + "beat": { + "version": "7.0.0-alpha1", + "name": "demo-stack-apache-01", + "hostname": "demo-stack-apache-01" + }, + "host": { + "name": "demo-stack-apache-01" + }, + "process": { + "pid": "26172", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "180.76.239.66" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "H9nxUmcBTFzn_XoLY7rL", + "source": { + "@timestamp": "2018-11-27T02:13:29.694Z", + "process": { + "pid": "30475", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "164.132.43.198" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "sequence": 44252, + "result": "fail", + "session": "unset", + "data": { + "op": "login", + "terminal": "sshd", + "acct": "(unknown user)" + }, + "summary": { + "actor": { + "secondary": "(unknown user)", + "primary": "unset" + }, + "object": { + "primary": "sshd", + "secondary": "164.132.43.198", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + } + }, + "beat": { + "name": "demo-stack-es-01", + "hostname": "demo-stack-es-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-es-01" + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "INnxUmcBTFzn_XoLY7rL", + "source": { + "@timestamp": "2018-11-27T02:13:29.694Z", + "source": { + "ip": "164.132.43.198" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "session": "unset", + "data": { + "op": "login", + "terminal": "sshd", + "acct": "(invalid user)" + }, + "summary": { + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + }, + "object": { + "primary": "sshd", + "secondary": "164.132.43.198", + "type": "user-session" + } + }, + "sequence": 44253, + "result": "fail" + }, + "event": { + "module": "auditd", + "category": "user-login", + "type": "user_login", + "action": "logged-in" + }, + "user": { + "name_map": { + "uid": "root" + }, + "auid": "unset", + "uid": "0" + }, + "beat": { + "name": "demo-stack-es-01", + "hostname": "demo-stack-es-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-es-01" + }, + "process": { + "pid": "30475", + "exe": "/usr/sbin/sshd" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "IdnxUmcBTFzn_XoLY7rL", + "source": { + "@timestamp": "2018-11-27T02:13:29.798Z", + "user": { + "name_map": { + "uid": "root" + }, + "auid": "unset", + "uid": "0" + }, + "process": { + "pid": "30475", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "164.132.43.198" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "result": "fail", + "session": "unset", + "data": { + "terminal": "ssh", + "hostname": "164.132.43.198", + "op": "PAM:bad_ident" + }, + "summary": { + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "root" + }, + "object": { + "primary": "ssh", + "secondary": "164.132.43.198", + "type": "user-session" + } + }, + "sequence": 44254 + }, + "beat": { + "name": "demo-stack-es-01", + "hostname": "demo-stack-es-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-es-01" + }, + "event": { + "module": "auditd", + "category": "user-login", + "type": "user_err", + "action": "error" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "LtnwUmcBTFzn_XoL5q-R", + "source": { + "@timestamp": "2018-11-27T02:12:57.636Z", + "process": { + "exe": "/usr/sbin/sshd", + "pid": "32583" + }, + "source": { + "ip": "107.170.65.109" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "data": { + "terminal": "sshd", + "op": "login", + "acct": "(unknown user)" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + }, + "object": { + "type": "user-session", + "primary": "sshd", + "secondary": "107.170.65.109" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 186578, + "result": "fail", + "session": "unset" + }, + "host": { + "name": "demo-stack-redis-01" + }, + "beat": { + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1" + }, + "event": { + "action": "logged-in", + "module": "auditd", + "category": "user-login", + "type": "user_login" + }, + "user": { + "uid": "0", + "auid": "unset", + "name_map": { + "uid": "root" + } + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "L9nwUmcBTFzn_XoL5q-R", + "source": { + "@timestamp": "2018-11-27T02:12:57.638Z", + "auditd": { + "result": "fail", + "session": "unset", + "data": { + "acct": "(invalid user)", + "op": "login", + "terminal": "sshd" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + }, + "object": { + "primary": "sshd", + "secondary": "107.170.65.109", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 186579 + }, + "beat": { + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-redis-01" + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + }, + "user": { + "name_map": { + "uid": "root" + }, + "uid": "0", + "auid": "unset" + }, + "process": { + "pid": "32583", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "107.170.65.109" + }, + "network": { + "direction": "incoming" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "MNnwUmcBTFzn_XoL5q-R", + "source": { + "@timestamp": "2018-11-27T02:12:57.669Z", + "source": { + "ip": "107.170.65.109" + }, + "network": { + "direction": "incoming" + }, + "beat": { + "version": "7.0.0-alpha1", + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01" + }, + "host": { + "name": "demo-stack-redis-01" + }, + "auditd": { + "result": "fail", + "session": "unset", + "data": { + "op": "PAM:bad_ident", + "hostname": "107.170.65.109", + "terminal": "ssh" + }, + "summary": { + "actor": { + "secondary": "root", + "primary": "unset" + }, + "object": { + "primary": "ssh", + "secondary": "107.170.65.109", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 186580 + }, + "event": { + "type": "user_err", + "action": "error", + "module": "auditd", + "category": "user-login" + }, + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + }, + "process": { + "pid": "32583", + "exe": "/usr/sbin/sshd" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "ctnyUmcBTFzn_XoLDsgI", + "source": { + "@timestamp": "2018-11-27T02:14:13.278Z", + "event": { + "action": "logged-in", + "module": "auditd", + "category": "user-login", + "type": "user_login" + }, + "host": { + "name": "demo-stack-redis-01" + }, + "beat": { + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1", + "name": "demo-stack-redis-01" + }, + "user": { + "uid": "0", + "auid": "unset", + "name_map": { + "uid": "root" + } + }, + "process": { + "exe": "/usr/sbin/sshd", + "pid": "32591" + }, + "source": { + "ip": "182.61.32.147" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "sequence": 186581, + "result": "fail", + "session": "unset", + "data": { + "terminal": "sshd", + "acct": "(unknown user)", + "op": "login" + }, + "summary": { + "object": { + "type": "user-session", + "primary": "sshd", + "secondary": "182.61.32.147" + }, + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + } + } + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "c9nyUmcBTFzn_XoLDsgI", + "source": { + "@timestamp": "2018-11-27T02:14:13.279Z", + "network": { + "direction": "incoming" + }, + "beat": { + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1", + "name": "demo-stack-redis-01" + }, + "host": { + "name": "demo-stack-redis-01" + }, + "auditd": { + "session": "unset", + "data": { + "acct": "(invalid user)", + "terminal": "sshd", + "op": "login" + }, + "summary": { + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + }, + "object": { + "primary": "sshd", + "secondary": "182.61.32.147", + "type": "user-session" + } + }, + "sequence": 186582, + "result": "fail" + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + }, + "user": { + "name_map": { + "uid": "root" + }, + "uid": "0", + "auid": "unset" + }, + "process": { + "exe": "/usr/sbin/sshd", + "pid": "32591" + }, + "source": { + "ip": "182.61.32.147" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "dNnyUmcBTFzn_XoLDsgI", + "source": { + "@timestamp": "2018-11-27T02:14:13.485Z", + "source": { + "ip": "182.61.32.147" + }, + "network": { + "direction": "incoming" + }, + "beat": { + "version": "7.0.0-alpha1", + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01" + }, + "host": { + "name": "demo-stack-redis-01" + }, + "auditd": { + "sequence": 186583, + "result": "fail", + "session": "unset", + "data": { + "terminal": "ssh", + "op": "PAM:bad_ident", + "hostname": "182.61.32.147" + }, + "summary": { + "actor": { + "secondary": "root", + "primary": "unset" + }, + "object": { + "primary": "ssh", + "secondary": "182.61.32.147", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + } + }, + "event": { + "category": "user-login", + "type": "user_err", + "action": "error", + "module": "auditd" + }, + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + }, + "process": { + "exe": "/usr/sbin/sshd", + "pid": "32591" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "M9nyUmcBTFzn_XoLLcvi", + "source": { + "@timestamp": "2018-11-27T02:14:21.431Z", + "source": { + "ip": "107.170.65.109" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "sequence": 186584, + "result": "fail", + "session": "unset", + "data": { + "terminal": "sshd", + "op": "login", + "acct": "(unknown user)" + }, + "summary": { + "object": { + "secondary": "107.170.65.109", + "type": "user-session", + "primary": "sshd" + }, + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + } + } + }, + "host": { + "name": "demo-stack-redis-01" + }, + "beat": { + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1" + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + }, + "user": { + "name_map": { + "uid": "root" + }, + "auid": "unset", + "uid": "0" + }, + "process": { + "exe": "/usr/sbin/sshd", + "pid": "32593" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "NNnyUmcBTFzn_XoLLcvi", + "source": { + "@timestamp": "2018-11-27T02:14:21.432Z", + "network": { + "direction": "incoming" + }, + "auditd": { + "summary": { + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + }, + "object": { + "type": "user-session", + "primary": "sshd", + "secondary": "107.170.65.109" + } + }, + "sequence": 186585, + "result": "fail", + "session": "unset", + "data": { + "acct": "(invalid user)", + "terminal": "sshd", + "op": "login" + } + }, + "event": { + "type": "user_login", + "action": "logged-in", + "module": "auditd", + "category": "user-login" + }, + "beat": { + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-redis-01" + }, + "user": { + "name_map": { + "uid": "root" + }, + "auid": "unset", + "uid": "0" + }, + "process": { + "pid": "32593", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "107.170.65.109" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "NdnyUmcBTFzn_XoLLcvi", + "source": { + "@timestamp": "2018-11-27T02:14:21.462Z", + "network": { + "direction": "incoming" + }, + "auditd": { + "sequence": 186586, + "result": "fail", + "session": "unset", + "data": { + "hostname": "107.170.65.109", + "op": "PAM:bad_ident", + "terminal": "ssh" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "root" + }, + "object": { + "primary": "ssh", + "secondary": "107.170.65.109", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + } + }, + "event": { + "action": "error", + "module": "auditd", + "category": "user-login", + "type": "user_err" + }, + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + }, + "process": { + "pid": "32593", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "107.170.65.109" + }, + "host": { + "name": "demo-stack-redis-01" + }, + "beat": { + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "NdnxUmcBTFzn_XoL1sT3", + "source": { + "@timestamp": "2018-11-27T02:13:59.181Z", + "user": { + "auid": "unset", + "uid": "0", + "name_map": { + "uid": "root" + } + }, + "process": { + "pid": "924", + "exe": "/usr/sbin/sshd" + }, + "beat": { + "name": "demo-stack-nginx-01", + "hostname": "demo-stack-nginx-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-nginx-01" + }, + "source": { + "ip": "201.155.38.30" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "session": "unset", + "data": { + "terminal": "sshd", + "acct": "(unknown user)", + "op": "login" + }, + "summary": { + "object": { + "type": "user-session", + "primary": "sshd", + "secondary": "201.155.38.30" + }, + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + } + }, + "sequence": 192580, + "result": "fail" + }, + "event": { + "type": "user_login", + "action": "logged-in", + "module": "auditd", + "category": "user-login" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "NtnxUmcBTFzn_XoL1sT3", + "source": { + "@timestamp": "2018-11-27T02:13:59.183Z", + "source": { + "ip": "201.155.38.30" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "session": "unset", + "data": { + "op": "login", + "acct": "(invalid user)", + "terminal": "sshd" + }, + "summary": { + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + }, + "object": { + "secondary": "201.155.38.30", + "type": "user-session", + "primary": "sshd" + } + }, + "sequence": 192581, + "result": "fail" + }, + "beat": { + "hostname": "demo-stack-nginx-01", + "version": "7.0.0-alpha1", + "name": "demo-stack-nginx-01" + }, + "host": { + "name": "demo-stack-nginx-01" + }, + "event": { + "action": "logged-in", + "module": "auditd", + "category": "user-login", + "type": "user_login" + }, + "user": { + "uid": "0", + "auid": "unset", + "name_map": { + "uid": "root" + } + }, + "process": { + "pid": "924", + "exe": "/usr/sbin/sshd" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "N9nxUmcBTFzn_XoL1sT3", + "source": { + "@timestamp": "2018-11-27T02:13:59.755Z", + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "pid": "924", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "201.155.38.30" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "data": { + "terminal": "ssh", + "op": "PAM:bad_ident", + "hostname": "201.155.38.30" + }, + "summary": { + "actor": { + "secondary": "root", + "primary": "unset" + }, + "object": { + "type": "user-session", + "primary": "ssh", + "secondary": "201.155.38.30" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 192582, + "result": "fail", + "session": "unset" + }, + "beat": { + "hostname": "demo-stack-nginx-01", + "version": "7.0.0-alpha1", + "name": "demo-stack-nginx-01" + }, + "host": { + "name": "demo-stack-nginx-01" + }, + "event": { + "category": "user-login", + "type": "user_err", + "action": "error", + "module": "auditd" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "I9nxUmcBTFzn_XoL58U9", + "source": { + "@timestamp": "2018-11-27T02:14:03.342Z", + "process": { + "exe": "/usr/sbin/sshd", + "pid": "13001" + }, + "source": { + "ip": "137.74.199.177" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "sequence": 43235, + "result": "fail", + "session": "unset", + "data": { + "op": "login", + "terminal": "sshd", + "acct": "(unknown user)" + }, + "summary": { + "object": { + "type": "user-session", + "primary": "sshd", + "secondary": "137.74.199.177" + }, + "how": "/usr/sbin/sshd", + "actor": { + "secondary": "(unknown user)", + "primary": "unset" + } + } + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + }, + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + }, + "beat": { + "hostname": "demo-stack-mysql-01", + "version": "7.0.0-alpha1", + "name": "demo-stack-mysql-01" + }, + "host": { + "name": "demo-stack-mysql-01" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "JNnxUmcBTFzn_XoL58U9", + "source": { + "@timestamp": "2018-11-27T02:14:03.342Z", + "beat": { + "hostname": "demo-stack-mysql-01", + "version": "7.0.0-alpha1", + "name": "demo-stack-mysql-01" + }, + "host": { + "name": "demo-stack-mysql-01" + }, + "event": { + "action": "logged-in", + "module": "auditd", + "category": "user-login", + "type": "user_login" + }, + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + }, + "process": { + "pid": "13001", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "137.74.199.177" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "sequence": 43236, + "result": "fail", + "session": "unset", + "data": { + "terminal": "sshd", + "op": "login", + "acct": "(invalid user)" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + }, + "object": { + "primary": "sshd", + "secondary": "137.74.199.177", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + } + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "JdnxUmcBTFzn_XoL58U9", + "source": { + "@timestamp": "2018-11-27T02:14:03.458Z", + "host": { + "name": "demo-stack-mysql-01" + }, + "auditd": { + "session": "unset", + "data": { + "terminal": "ssh", + "hostname": "137.74.199.177", + "op": "PAM:bad_ident" + }, + "summary": { + "actor": { + "secondary": "root", + "primary": "unset" + }, + "object": { + "primary": "ssh", + "secondary": "137.74.199.177", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 43237, + "result": "fail" + }, + "event": { + "type": "user_err", + "action": "error", + "module": "auditd", + "category": "user-login" + }, + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + }, + "process": { + "exe": "/usr/sbin/sshd", + "pid": "13001" + }, + "source": { + "ip": "137.74.199.177" + }, + "network": { + "direction": "incoming" + }, + "beat": { + "name": "demo-stack-mysql-01", + "hostname": "demo-stack-mysql-01", + "version": "7.0.0-alpha1" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "jNnzUmcBTFzn_XoLLeBy", + "source": { + "@timestamp": "2018-11-27T02:15:26.857Z", + "host": { + "name": "demo-stack-nginx-01" + }, + "process": { + "pid": "937", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "190.0.10.138" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "summary": { + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + }, + "object": { + "primary": "sshd", + "secondary": "190.0.10.138", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 192583, + "result": "fail", + "session": "unset", + "data": { + "acct": "(unknown user)", + "op": "login", + "terminal": "sshd" + } + }, + "event": { + "action": "logged-in", + "module": "auditd", + "category": "user-login", + "type": "user_login" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "beat": { + "name": "demo-stack-nginx-01", + "hostname": "demo-stack-nginx-01", + "version": "7.0.0-alpha1" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "jdnzUmcBTFzn_XoLLeBy", + "source": { + "@timestamp": "2018-11-27T02:15:26.858Z", + "event": { + "module": "auditd", + "category": "user-login", + "type": "user_login", + "action": "logged-in" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "pid": "937", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "190.0.10.138" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "session": "unset", + "data": { + "op": "login", + "acct": "(invalid user)", + "terminal": "sshd" + }, + "summary": { + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + }, + "object": { + "type": "user-session", + "primary": "sshd", + "secondary": "190.0.10.138" + } + }, + "sequence": 192584, + "result": "fail" + }, + "beat": { + "name": "demo-stack-nginx-01", + "hostname": "demo-stack-nginx-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-nginx-01" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "jtnzUmcBTFzn_XoLLeBy", + "source": { + "@timestamp": "2018-11-27T02:15:26.950Z", + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "beat": { + "version": "7.0.0-alpha1", + "name": "demo-stack-nginx-01", + "hostname": "demo-stack-nginx-01" + }, + "host": { + "name": "demo-stack-nginx-01" + }, + "process": { + "pid": "937", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "190.0.10.138" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "result": "fail", + "session": "unset", + "data": { + "op": "PAM:bad_ident", + "terminal": "ssh", + "hostname": "190.0.10.138" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "root" + }, + "object": { + "primary": "ssh", + "secondary": "190.0.10.138", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 192585 + }, + "event": { + "category": "user-login", + "type": "user_err", + "action": "error", + "module": "auditd" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "n9nzUmcBTFzn_XoLXeXh", + "source": { + "@timestamp": "2018-11-27T02:15:39.252Z", + "beat": { + "name": "demo-stack-es-01", + "hostname": "demo-stack-es-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-es-01" + }, + "auditd": { + "data": { + "acct": "(unknown user)", + "terminal": "sshd", + "op": "login" + }, + "summary": { + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + }, + "object": { + "type": "user-session", + "primary": "sshd", + "secondary": "142.93.18.15" + } + }, + "sequence": 44255, + "result": "fail", + "session": "unset" + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + }, + "user": { + "name_map": { + "uid": "root" + }, + "uid": "0", + "auid": "unset" + }, + "process": { + "pid": "30517", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "142.93.18.15" + }, + "network": { + "direction": "incoming" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "oNnzUmcBTFzn_XoLXeXh", + "source": { + "@timestamp": "2018-11-27T02:15:39.252Z", + "host": { + "name": "demo-stack-es-01" + }, + "event": { + "module": "auditd", + "category": "user-login", + "type": "user_login", + "action": "logged-in" + }, + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + }, + "process": { + "pid": "30517", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "142.93.18.15" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "result": "fail", + "session": "unset", + "data": { + "op": "login", + "acct": "(invalid user)", + "terminal": "sshd" + }, + "summary": { + "object": { + "primary": "sshd", + "secondary": "142.93.18.15", + "type": "user-session" + }, + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + } + }, + "sequence": 44256 + }, + "beat": { + "name": "demo-stack-es-01", + "hostname": "demo-stack-es-01", + "version": "7.0.0-alpha1" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "odnzUmcBTFzn_XoLXeXh", + "source": { + "@timestamp": "2018-11-27T02:15:39.292Z", + "beat": { + "name": "demo-stack-es-01", + "hostname": "demo-stack-es-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-es-01" + }, + "event": { + "category": "user-login", + "type": "user_err", + "action": "error", + "module": "auditd" + }, + "user": { + "uid": "0", + "auid": "unset", + "name_map": { + "uid": "root" + } + }, + "process": { + "pid": "30517", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "142.93.18.15" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "summary": { + "object": { + "primary": "ssh", + "secondary": "142.93.18.15", + "type": "user-session" + }, + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "root" + } + }, + "sequence": 44257, + "result": "fail", + "session": "unset", + "data": { + "hostname": "142.93.18.15", + "op": "PAM:bad_ident", + "terminal": "ssh" + } + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "Utr3UmcBTFzn_XoLVD0D", + "source": { + "@timestamp": "2018-11-27T02:19:58.873Z", + "beat": { + "name": "demo-stack-apache-01", + "hostname": "demo-stack-apache-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-apache-01" + }, + "auditd": { + "data": { + "acct": "(unknown user)", + "terminal": "sshd", + "op": "login" + }, + "summary": { + "object": { + "secondary": "164.132.197.108", + "type": "user-session", + "primary": "sshd" + }, + "how": "/usr/sbin/sshd", + "actor": { + "secondary": "(unknown user)", + "primary": "unset" + } + }, + "sequence": 184439, + "result": "fail", + "session": "unset" + }, + "event": { + "module": "auditd", + "category": "user-login", + "type": "user_login", + "action": "logged-in" + }, + "user": { + "auid": "unset", + "uid": "0", + "name_map": { + "uid": "root" + } + }, + "process": { + "pid": "26214", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "164.132.197.108" + }, + "network": { + "direction": "incoming" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "U9r3UmcBTFzn_XoLVD0D", + "source": { + "@timestamp": "2018-11-27T02:19:58.874Z", + "user": { + "name_map": { + "uid": "root" + }, + "uid": "0", + "auid": "unset" + }, + "process": { + "pid": "26214", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "164.132.197.108" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "result": "fail", + "session": "unset", + "data": { + "op": "login", + "terminal": "sshd", + "acct": "(invalid user)" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + }, + "object": { + "primary": "sshd", + "secondary": "164.132.197.108", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 184440 + }, + "beat": { + "version": "7.0.0-alpha1", + "name": "demo-stack-apache-01", + "hostname": "demo-stack-apache-01" + }, + "host": { + "name": "demo-stack-apache-01" + }, + "event": { + "module": "auditd", + "category": "user-login", + "type": "user_login", + "action": "logged-in" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "VNr3UmcBTFzn_XoLVD0D", + "source": { + "@timestamp": "2018-11-27T02:19:58.986Z", + "auditd": { + "session": "unset", + "data": { + "op": "PAM:bad_ident", + "terminal": "ssh", + "hostname": "164.132.197.108" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "root" + }, + "object": { + "primary": "ssh", + "secondary": "164.132.197.108", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 184441, + "result": "fail" + }, + "event": { + "category": "user-login", + "type": "user_err", + "action": "error", + "module": "auditd" + }, + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + }, + "process": { + "pid": "26214", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "164.132.197.108" + }, + "network": { + "direction": "incoming" + }, + "beat": { + "name": "demo-stack-apache-01", + "hostname": "demo-stack-apache-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-apache-01" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "ltr3UmcBTFzn_XoLWD2x", + "source": { + "@timestamp": "2018-11-27T02:20:00.071Z", + "beat": { + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-redis-01" + }, + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + }, + "process": { + "pid": "32625", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "107.170.65.109" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "sequence": 186602, + "result": "fail", + "session": "unset", + "data": { + "acct": "(unknown user)", + "op": "login", + "terminal": "sshd" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + }, + "object": { + "primary": "sshd", + "secondary": "107.170.65.109", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + } + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "l9r3UmcBTFzn_XoLWD2x", + "source": { + "@timestamp": "2018-11-27T02:20:00.072Z", + "network": { + "direction": "incoming" + }, + "auditd": { + "sequence": 186603, + "result": "fail", + "session": "unset", + "data": { + "terminal": "sshd", + "op": "login", + "acct": "(invalid user)" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + }, + "object": { + "secondary": "107.170.65.109", + "type": "user-session", + "primary": "sshd" + }, + "how": "/usr/sbin/sshd" + } + }, + "beat": { + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-redis-01" + }, + "event": { + "action": "logged-in", + "module": "auditd", + "category": "user-login", + "type": "user_login" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "pid": "32625", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "107.170.65.109" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "mNr3UmcBTFzn_XoLWD2x", + "source": { + "@timestamp": "2018-11-27T02:20:00.103Z", + "process": { + "pid": "32625", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "107.170.65.109" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "summary": { + "object": { + "type": "user-session", + "primary": "ssh", + "secondary": "107.170.65.109" + }, + "how": "/usr/sbin/sshd", + "actor": { + "secondary": "root", + "primary": "unset" + } + }, + "sequence": 186604, + "result": "fail", + "session": "unset", + "data": { + "hostname": "107.170.65.109", + "op": "PAM:bad_ident", + "terminal": "ssh" + } + }, + "event": { + "action": "error", + "module": "auditd", + "category": "user-login", + "type": "user_err" + }, + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + }, + "beat": { + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-redis-01" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "htr4UmcBTFzn_XoLpVlZ", + "source": { + "@timestamp": "2018-11-27T02:21:25.223Z", + "host": { + "name": "demo-stack-mysql-01" + }, + "beat": { + "name": "demo-stack-mysql-01", + "hostname": "demo-stack-mysql-01", + "version": "7.0.0-alpha1" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "summary": { + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + }, + "object": { + "type": "user-session", + "primary": "sshd", + "secondary": "37.195.105.57" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 43262, + "result": "fail", + "session": "unset", + "data": { + "terminal": "sshd", + "acct": "(unknown user)", + "op": "login" + } + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + }, + "user": { + "uid": "0", + "auid": "unset", + "name_map": { + "uid": "root" + } + }, + "process": { + "pid": "13059", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "37.195.105.57" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "h9r4UmcBTFzn_XoLpVlZ", + "source": { + "@timestamp": "2018-11-27T02:21:25.227Z", + "event": { + "type": "user_login", + "action": "logged-in", + "module": "auditd", + "category": "user-login" + }, + "user": { + "uid": "0", + "auid": "unset", + "name_map": { + "uid": "root" + } + }, + "process": { + "pid": "13059", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "37.195.105.57" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "session": "unset", + "data": { + "op": "login", + "acct": "(invalid user)", + "terminal": "sshd" + }, + "summary": { + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + }, + "object": { + "primary": "sshd", + "secondary": "37.195.105.57", + "type": "user-session" + } + }, + "sequence": 43263, + "result": "fail" + }, + "beat": { + "name": "demo-stack-mysql-01", + "hostname": "demo-stack-mysql-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-mysql-01" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "iNr4UmcBTFzn_XoLpVlZ", + "source": { + "@timestamp": "2018-11-27T02:21:25.431Z", + "event": { + "category": "user-login", + "type": "user_err", + "action": "error", + "module": "auditd" + }, + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + }, + "process": { + "pid": "13059", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "37.195.105.57" + }, + "network": { + "direction": "incoming" + }, + "beat": { + "version": "7.0.0-alpha1", + "name": "demo-stack-mysql-01", + "hostname": "demo-stack-mysql-01" + }, + "host": { + "name": "demo-stack-mysql-01" + }, + "auditd": { + "sequence": 43264, + "result": "fail", + "session": "unset", + "data": { + "hostname": "37.195.105.57", + "terminal": "ssh", + "op": "PAM:bad_ident" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "root" + }, + "object": { + "primary": "ssh", + "secondary": "37.195.105.57", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + } + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "idr4UmcBTFzn_XoLpVnm", + "source": { + "@timestamp": "2018-11-27T02:21:25.372Z", + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + }, + "user": { + "name_map": { + "uid": "root" + }, + "auid": "unset", + "uid": "0" + }, + "process": { + "exe": "/usr/sbin/sshd", + "pid": "32633" + }, + "source": { + "ip": "107.170.65.109" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "sequence": 186605, + "result": "fail", + "session": "unset", + "data": { + "terminal": "sshd", + "op": "login", + "acct": "(unknown user)" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + }, + "object": { + "type": "user-session", + "primary": "sshd", + "secondary": "107.170.65.109" + }, + "how": "/usr/sbin/sshd" + } + }, + "beat": { + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-redis-01" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "itr4UmcBTFzn_XoLpVnm", + "source": { + "@timestamp": "2018-11-27T02:21:25.373Z", + "auditd": { + "session": "unset", + "data": { + "op": "login", + "terminal": "sshd", + "acct": "(invalid user)" + }, + "summary": { + "how": "/usr/sbin/sshd", + "actor": { + "secondary": "(invalid user)", + "primary": "unset" + }, + "object": { + "primary": "sshd", + "secondary": "107.170.65.109", + "type": "user-session" + } + }, + "sequence": 186606, + "result": "fail" + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "beat": { + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1", + "name": "demo-stack-redis-01" + }, + "host": { + "name": "demo-stack-redis-01" + }, + "process": { + "pid": "32633", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "107.170.65.109" + }, + "network": { + "direction": "incoming" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "i9r4UmcBTFzn_XoLpVnm", + "source": { + "@timestamp": "2018-11-27T02:21:25.404Z", + "event": { + "category": "user-login", + "type": "user_err", + "action": "error", + "module": "auditd" + }, + "user": { + "name_map": { + "uid": "root" + }, + "auid": "unset", + "uid": "0" + }, + "process": { + "pid": "32633", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "107.170.65.109" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "session": "unset", + "data": { + "hostname": "107.170.65.109", + "op": "PAM:bad_ident", + "terminal": "ssh" + }, + "summary": { + "object": { + "primary": "ssh", + "secondary": "107.170.65.109", + "type": "user-session" + }, + "how": "/usr/sbin/sshd", + "actor": { + "secondary": "root", + "primary": "unset" + } + }, + "sequence": 186607, + "result": "fail" + }, + "beat": { + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-redis-01" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "6Nr4UmcBTFzn_XoL4l6d", + "source": { + "@timestamp": "2018-11-27T02:21:40.914Z", + "host": { + "name": "demo-stack-haproxy-01" + }, + "user": { + "auid": "unset", + "uid": "0", + "name_map": { + "uid": "root" + } + }, + "process": { + "pid": "20001", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "82.62.233.163" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "sequence": 142431, + "result": "fail", + "session": "unset", + "data": { + "acct": "(unknown user)", + "op": "login", + "terminal": "sshd" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + }, + "object": { + "primary": "sshd", + "secondary": "82.62.233.163", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + } + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + }, + "beat": { + "name": "demo-stack-haproxy-01", + "hostname": "demo-stack-haproxy-01", + "version": "7.0.0-alpha1" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "6dr4UmcBTFzn_XoL4l6d", + "source": { + "@timestamp": "2018-11-27T02:21:40.915Z", + "process": { + "pid": "20001", + "exe": "/usr/sbin/sshd" + }, + "beat": { + "version": "7.0.0-alpha1", + "name": "demo-stack-haproxy-01", + "hostname": "demo-stack-haproxy-01" + }, + "host": { + "name": "demo-stack-haproxy-01" + }, + "source": { + "ip": "82.62.233.163" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "data": { + "acct": "(invalid user)", + "terminal": "sshd", + "op": "login" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + }, + "object": { + "secondary": "82.62.233.163", + "type": "user-session", + "primary": "sshd" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 142432, + "result": "fail", + "session": "unset" + }, + "event": { + "type": "user_login", + "action": "logged-in", + "module": "auditd", + "category": "user-login" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "6tr4UmcBTFzn_XoL4l6d", + "source": { + "@timestamp": "2018-11-27T02:21:41.064Z", + "source": { + "ip": "82.62.233.163" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "session": "unset", + "data": { + "terminal": "ssh", + "op": "PAM:bad_ident", + "hostname": "82.62.233.163" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "root" + }, + "object": { + "primary": "ssh", + "secondary": "82.62.233.163", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 142433, + "result": "fail" + }, + "beat": { + "name": "demo-stack-haproxy-01", + "hostname": "demo-stack-haproxy-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-haproxy-01" + }, + "event": { + "category": "user-login", + "type": "user_err", + "action": "error", + "module": "auditd" + }, + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + }, + "process": { + "pid": "20001", + "exe": "/usr/sbin/sshd" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "Xtr5UmcBTFzn_XoL9Ha7", + "source": { + "@timestamp": "2018-11-27T02:22:51.088Z", + "beat": { + "version": "7.0.0-alpha1", + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01" + }, + "host": { + "name": "demo-stack-redis-01" + }, + "process": { + "exe": "/usr/sbin/sshd", + "pid": "32641" + }, + "source": { + "ip": "107.170.65.109" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "sequence": 186608, + "result": "fail", + "session": "unset", + "data": { + "op": "login", + "terminal": "sshd", + "acct": "(unknown user)" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + }, + "object": { + "primary": "sshd", + "secondary": "107.170.65.109", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + } + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "X9r5UmcBTFzn_XoL9Ha7", + "source": { + "@timestamp": "2018-11-27T02:22:51.090Z", + "auditd": { + "sequence": 186609, + "result": "fail", + "session": "unset", + "data": { + "terminal": "sshd", + "op": "login", + "acct": "(invalid user)" + }, + "summary": { + "how": "/usr/sbin/sshd", + "actor": { + "secondary": "(invalid user)", + "primary": "unset" + }, + "object": { + "primary": "sshd", + "secondary": "107.170.65.109", + "type": "user-session" + } + } + }, + "beat": { + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1", + "name": "demo-stack-redis-01" + }, + "host": { + "name": "demo-stack-redis-01" + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + }, + "user": { + "name_map": { + "uid": "root" + }, + "uid": "0", + "auid": "unset" + }, + "process": { + "pid": "32641", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "107.170.65.109" + }, + "network": { + "direction": "incoming" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "YNr5UmcBTFzn_XoL9Ha7", + "source": { + "@timestamp": "2018-11-27T02:22:51.120Z", + "host": { + "name": "demo-stack-redis-01" + }, + "event": { + "module": "auditd", + "category": "user-login", + "type": "user_err", + "action": "error" + }, + "user": { + "auid": "unset", + "uid": "0", + "name_map": { + "uid": "root" + } + }, + "process": { + "pid": "32641", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "107.170.65.109" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "sequence": 186610, + "result": "fail", + "session": "unset", + "data": { + "op": "PAM:bad_ident", + "terminal": "ssh", + "hostname": "107.170.65.109" + }, + "summary": { + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "root" + }, + "object": { + "primary": "ssh", + "secondary": "107.170.65.109", + "type": "user-session" + } + } + }, + "beat": { + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1", + "name": "demo-stack-redis-01" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "ZNr5UmcBTFzn_XoL03NO", + "source": { + "@timestamp": "2018-11-27T02:22:42.532Z", + "network": { + "direction": "incoming" + }, + "beat": { + "name": "demo-stack-nginx-01", + "hostname": "demo-stack-nginx-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-nginx-01" + }, + "auditd": { + "result": "fail", + "session": "unset", + "data": { + "op": "login", + "acct": "(unknown user)", + "terminal": "sshd" + }, + "summary": { + "how": "/usr/sbin/sshd", + "actor": { + "secondary": "(unknown user)", + "primary": "unset" + }, + "object": { + "secondary": "104.248.11.46", + "type": "user-session", + "primary": "sshd" + } + }, + "sequence": 192601 + }, + "event": { + "type": "user_login", + "action": "logged-in", + "module": "auditd", + "category": "user-login" + }, + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + }, + "process": { + "pid": "986", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "104.248.11.46" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "Zdr5UmcBTFzn_XoL03NO", + "source": { + "@timestamp": "2018-11-27T02:22:42.533Z", + "beat": { + "name": "demo-stack-nginx-01", + "hostname": "demo-stack-nginx-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-nginx-01" + }, + "event": { + "type": "user_login", + "action": "logged-in", + "module": "auditd", + "category": "user-login" + }, + "user": { + "auid": "unset", + "uid": "0", + "name_map": { + "uid": "root" + } + }, + "process": { + "exe": "/usr/sbin/sshd", + "pid": "986" + }, + "source": { + "ip": "104.248.11.46" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "result": "fail", + "session": "unset", + "data": { + "terminal": "sshd", + "op": "login", + "acct": "(invalid user)" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + }, + "object": { + "primary": "sshd", + "secondary": "104.248.11.46", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 192602 + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "Ztr5UmcBTFzn_XoL03NO", + "source": { + "@timestamp": "2018-11-27T02:22:42.564Z", + "beat": { + "name": "demo-stack-nginx-01", + "hostname": "demo-stack-nginx-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-nginx-01" + }, + "process": { + "exe": "/usr/sbin/sshd", + "pid": "986" + }, + "source": { + "ip": "104.248.11.46" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "session": "unset", + "data": { + "hostname": "104.248.11.46", + "op": "PAM:bad_ident", + "terminal": "ssh" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "root" + }, + "object": { + "primary": "ssh", + "secondary": "104.248.11.46", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 192603, + "result": "fail" + }, + "event": { + "type": "user_err", + "action": "error", + "module": "auditd", + "category": "user-login" + }, + "user": { + "uid": "0", + "auid": "unset", + "name_map": { + "uid": "root" + } + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "Xdr5UmcBTFzn_XoL23R3", + "source": { + "@timestamp": "2018-11-27T02:22:44.622Z", + "source": { + "ip": "91.67.54.251" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "summary": { + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + }, + "object": { + "type": "user-session", + "primary": "sshd", + "secondary": "91.67.54.251" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 192604, + "result": "fail", + "session": "unset", + "data": { + "terminal": "sshd", + "op": "login", + "acct": "(unknown user)" + } + }, + "beat": { + "hostname": "demo-stack-nginx-01", + "version": "7.0.0-alpha1", + "name": "demo-stack-nginx-01" + }, + "host": { + "name": "demo-stack-nginx-01" + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "pid": "988", + "exe": "/usr/sbin/sshd" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "Xtr5UmcBTFzn_XoL23R3", + "source": { + "@timestamp": "2018-11-27T02:22:44.623Z", + "user": { + "auid": "unset", + "uid": "0", + "name_map": { + "uid": "root" + } + }, + "process": { + "pid": "988", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "91.67.54.251" + }, + "network": { + "direction": "incoming" + }, + "beat": { + "hostname": "demo-stack-nginx-01", + "version": "7.0.0-alpha1", + "name": "demo-stack-nginx-01" + }, + "host": { + "name": "demo-stack-nginx-01" + }, + "auditd": { + "sequence": 192605, + "result": "fail", + "session": "unset", + "data": { + "terminal": "sshd", + "acct": "(invalid user)", + "op": "login" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + }, + "object": { + "primary": "sshd", + "secondary": "91.67.54.251", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + } + }, + "event": { + "module": "auditd", + "category": "user-login", + "type": "user_login", + "action": "logged-in" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "X9r5UmcBTFzn_XoL23R3", + "source": { + "@timestamp": "2018-11-27T02:22:44.754Z", + "beat": { + "version": "7.0.0-alpha1", + "name": "demo-stack-nginx-01", + "hostname": "demo-stack-nginx-01" + }, + "host": { + "name": "demo-stack-nginx-01" + }, + "event": { + "module": "auditd", + "category": "user-login", + "type": "user_err", + "action": "error" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "pid": "988", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "91.67.54.251" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "session": "unset", + "data": { + "terminal": "ssh", + "op": "PAM:bad_ident", + "hostname": "91.67.54.251" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "root" + }, + "object": { + "secondary": "91.67.54.251", + "type": "user-session", + "primary": "ssh" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 192606, + "result": "fail" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "INr4UmcBTFzn_XoLPlHT", + "source": { + "@timestamp": "2018-11-27T02:20:58.980Z", + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + }, + "process": { + "exe": "/usr/sbin/sshd", + "pid": "30623" + }, + "source": { + "ip": "35.189.59.154" + }, + "network": { + "direction": "incoming" + }, + "beat": { + "name": "demo-stack-es-01", + "hostname": "demo-stack-es-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-es-01" + }, + "auditd": { + "summary": { + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + }, + "object": { + "secondary": "35.189.59.154", + "type": "user-session", + "primary": "sshd" + } + }, + "sequence": 44267, + "result": "fail", + "session": "unset", + "data": { + "op": "login", + "acct": "(unknown user)", + "terminal": "sshd" + } + }, + "event": { + "type": "user_login", + "action": "logged-in", + "module": "auditd", + "category": "user-login" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "Idr4UmcBTFzn_XoLPlHT", + "source": { + "@timestamp": "2018-11-27T02:20:58.980Z", + "source": { + "ip": "35.189.59.154" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "session": "unset", + "data": { + "acct": "(invalid user)", + "op": "login", + "terminal": "sshd" + }, + "summary": { + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + }, + "object": { + "type": "user-session", + "primary": "sshd", + "secondary": "35.189.59.154" + } + }, + "sequence": 44268, + "result": "fail" + }, + "event": { + "module": "auditd", + "category": "user-login", + "type": "user_login", + "action": "logged-in" + }, + "user": { + "name_map": { + "uid": "root" + }, + "auid": "unset", + "uid": "0" + }, + "process": { + "pid": "30623", + "exe": "/usr/sbin/sshd" + }, + "beat": { + "hostname": "demo-stack-es-01", + "version": "7.0.0-alpha1", + "name": "demo-stack-es-01" + }, + "host": { + "name": "demo-stack-es-01" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "Itr4UmcBTFzn_XoLPlHT", + "source": { + "@timestamp": "2018-11-27T02:20:59.156Z", + "host": { + "name": "demo-stack-es-01" + }, + "auditd": { + "result": "fail", + "session": "unset", + "data": { + "terminal": "ssh", + "hostname": "35.189.59.154", + "op": "PAM:bad_ident" + }, + "summary": { + "object": { + "primary": "ssh", + "secondary": "35.189.59.154", + "type": "user-session" + }, + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "root" + } + }, + "sequence": 44269 + }, + "event": { + "category": "user-login", + "type": "user_err", + "action": "error", + "module": "auditd" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "pid": "30623", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "35.189.59.154" + }, + "network": { + "direction": "incoming" + }, + "beat": { + "name": "demo-stack-es-01", + "hostname": "demo-stack-es-01", + "version": "7.0.0-alpha1" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "7Nr3UmcBTFzn_XoLyEYO", + "source": { + "@timestamp": "2018-11-27T02:20:28.574Z", + "host": { + "name": "demo-stack-es-01" + }, + "process": { + "exe": "/usr/sbin/sshd", + "pid": "30616" + }, + "source": { + "ip": "91.196.149.76" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "sequence": 44264, + "result": "fail", + "session": "unset", + "data": { + "op": "login", + "terminal": "sshd", + "acct": "(unknown user)" + }, + "summary": { + "object": { + "primary": "sshd", + "secondary": "91.196.149.76", + "type": "user-session" + }, + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + } + } + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + }, + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + }, + "beat": { + "hostname": "demo-stack-es-01", + "version": "7.0.0-alpha1", + "name": "demo-stack-es-01" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "7dr3UmcBTFzn_XoLyEYO", + "source": { + "@timestamp": "2018-11-27T02:20:28.574Z", + "auditd": { + "data": { + "terminal": "sshd", + "acct": "(invalid user)", + "op": "login" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + }, + "object": { + "secondary": "91.196.149.76", + "type": "user-session", + "primary": "sshd" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 44265, + "result": "fail", + "session": "unset" + }, + "event": { + "type": "user_login", + "action": "logged-in", + "module": "auditd", + "category": "user-login" + }, + "beat": { + "name": "demo-stack-es-01", + "hostname": "demo-stack-es-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-es-01" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "exe": "/usr/sbin/sshd", + "pid": "30616" + }, + "source": { + "ip": "91.196.149.76" + }, + "network": { + "direction": "incoming" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "7tr3UmcBTFzn_XoLyEYO", + "source": { + "@timestamp": "2018-11-27T02:20:28.710Z", + "process": { + "pid": "30616", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "91.196.149.76" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "data": { + "terminal": "ssh", + "op": "PAM:bad_ident", + "hostname": "91.196.149.76" + }, + "summary": { + "object": { + "secondary": "91.196.149.76", + "type": "user-session", + "primary": "ssh" + }, + "how": "/usr/sbin/sshd", + "actor": { + "secondary": "root", + "primary": "unset" + } + }, + "sequence": 44266, + "result": "fail", + "session": "unset" + }, + "host": { + "name": "demo-stack-es-01" + }, + "beat": { + "name": "demo-stack-es-01", + "hostname": "demo-stack-es-01", + "version": "7.0.0-alpha1" + }, + "event": { + "action": "error", + "module": "auditd", + "category": "user-login", + "type": "user_err" + }, + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "str3UmcBTFzn_XoLOzru", + "source": { + "@timestamp": "2018-11-27T02:19:52.704Z", + "beat": { + "name": "demo-stack-mysql-01", + "hostname": "demo-stack-mysql-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-mysql-01" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "pid": "13051", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "193.70.38.229" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "sequence": 43259, + "result": "fail", + "session": "unset", + "data": { + "acct": "(unknown user)", + "terminal": "sshd", + "op": "login" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + }, + "object": { + "primary": "sshd", + "secondary": "193.70.38.229", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + } + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "s9r3UmcBTFzn_XoLOzru", + "source": { + "@timestamp": "2018-11-27T02:19:52.704Z", + "event": { + "type": "user_login", + "action": "logged-in", + "module": "auditd", + "category": "user-login" + }, + "user": { + "name_map": { + "uid": "root" + }, + "uid": "0", + "auid": "unset" + }, + "host": { + "name": "demo-stack-mysql-01" + }, + "beat": { + "name": "demo-stack-mysql-01", + "hostname": "demo-stack-mysql-01", + "version": "7.0.0-alpha1" + }, + "process": { + "pid": "13051", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "193.70.38.229" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "data": { + "terminal": "sshd", + "op": "login", + "acct": "(invalid user)" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + }, + "object": { + "primary": "sshd", + "secondary": "193.70.38.229", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 43260, + "result": "fail", + "session": "unset" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "tNr3UmcBTFzn_XoLOzru", + "source": { + "@timestamp": "2018-11-27T02:19:52.820Z", + "process": { + "pid": "13051", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "193.70.38.229" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "session": "unset", + "data": { + "terminal": "ssh", + "op": "PAM:bad_ident", + "hostname": "193.70.38.229" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "root" + }, + "object": { + "primary": "ssh", + "secondary": "193.70.38.229", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 43261, + "result": "fail" + }, + "event": { + "type": "user_err", + "action": "error", + "module": "auditd", + "category": "user-login" + }, + "user": { + "uid": "0", + "auid": "unset", + "name_map": { + "uid": "root" + } + }, + "host": { + "name": "demo-stack-mysql-01" + }, + "beat": { + "name": "demo-stack-mysql-01", + "hostname": "demo-stack-mysql-01", + "version": "7.0.0-alpha1" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "O9r9UmcBTFzn_XoL4syL", + "source": { + "@timestamp": "2018-11-27T02:27:08.552Z", + "source": { + "ip": "150.95.110.147" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "data": { + "acct": "(unknown user)", + "terminal": "sshd", + "op": "login" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + }, + "object": { + "primary": "sshd", + "secondary": "150.95.110.147", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 43265, + "result": "fail", + "session": "unset" + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + }, + "user": { + "uid": "0", + "auid": "unset", + "name_map": { + "uid": "root" + } + }, + "beat": { + "name": "demo-stack-mysql-01", + "hostname": "demo-stack-mysql-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-mysql-01" + }, + "process": { + "pid": "13101", + "exe": "/usr/sbin/sshd" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "PNr9UmcBTFzn_XoL4syL", + "source": { + "@timestamp": "2018-11-27T02:27:08.552Z", + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "pid": "13101", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "150.95.110.147" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "result": "fail", + "session": "unset", + "data": { + "op": "login", + "acct": "(invalid user)", + "terminal": "sshd" + }, + "summary": { + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + }, + "object": { + "primary": "sshd", + "secondary": "150.95.110.147", + "type": "user-session" + } + }, + "sequence": 43266 + }, + "beat": { + "version": "7.0.0-alpha1", + "name": "demo-stack-mysql-01", + "hostname": "demo-stack-mysql-01" + }, + "host": { + "name": "demo-stack-mysql-01" + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "Pdr9UmcBTFzn_XoL4syL", + "source": { + "@timestamp": "2018-11-27T02:27:08.760Z", + "beat": { + "hostname": "demo-stack-mysql-01", + "version": "7.0.0-alpha1", + "name": "demo-stack-mysql-01" + }, + "host": { + "name": "demo-stack-mysql-01" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "data": { + "terminal": "ssh", + "op": "PAM:bad_ident", + "hostname": "150.95.110.147" + }, + "summary": { + "object": { + "secondary": "150.95.110.147", + "type": "user-session", + "primary": "ssh" + }, + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "root" + } + }, + "sequence": 43267, + "result": "fail", + "session": "unset" + }, + "event": { + "action": "error", + "module": "auditd", + "category": "user-login", + "type": "user_err" + }, + "user": { + "auid": "unset", + "uid": "0", + "name_map": { + "uid": "root" + } + }, + "process": { + "exe": "/usr/sbin/sshd", + "pid": "13101" + }, + "source": { + "ip": "150.95.110.147" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "5tr9UmcBTFzn_XoL7Mz5", + "source": { + "@timestamp": "2018-11-27T02:27:11.246Z", + "network": { + "direction": "incoming" + }, + "beat": { + "version": "7.0.0-alpha1", + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01" + }, + "host": { + "name": "demo-stack-redis-01" + }, + "auditd": { + "data": { + "acct": "(unknown user)", + "terminal": "sshd", + "op": "login" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + }, + "object": { + "primary": "sshd", + "secondary": "107.170.65.109", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 186617, + "result": "fail", + "session": "unset" + }, + "event": { + "module": "auditd", + "category": "user-login", + "type": "user_login", + "action": "logged-in" + }, + "user": { + "uid": "0", + "auid": "unset", + "name_map": { + "uid": "root" + } + }, + "process": { + "exe": "/usr/sbin/sshd", + "pid": "32666" + }, + "source": { + "ip": "107.170.65.109" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "59r9UmcBTFzn_XoL7Mz5", + "source": { + "@timestamp": "2018-11-27T02:27:11.247Z", + "host": { + "name": "demo-stack-redis-01" + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + }, + "user": { + "name_map": { + "uid": "root" + }, + "uid": "0", + "auid": "unset" + }, + "process": { + "exe": "/usr/sbin/sshd", + "pid": "32666" + }, + "source": { + "ip": "107.170.65.109" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "summary": { + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + }, + "object": { + "type": "user-session", + "primary": "sshd", + "secondary": "107.170.65.109" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 186618, + "result": "fail", + "session": "unset", + "data": { + "op": "login", + "terminal": "sshd", + "acct": "(invalid user)" + } + }, + "beat": { + "version": "7.0.0-alpha1", + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "6Nr9UmcBTFzn_XoL7Mz5", + "source": { + "@timestamp": "2018-11-27T02:27:11.279Z", + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + }, + "process": { + "pid": "32666", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "107.170.65.109" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "session": "unset", + "data": { + "terminal": "ssh", + "hostname": "107.170.65.109", + "op": "PAM:bad_ident" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "root" + }, + "object": { + "secondary": "107.170.65.109", + "type": "user-session", + "primary": "ssh" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 186619, + "result": "fail" + }, + "event": { + "action": "error", + "module": "auditd", + "category": "user-login", + "type": "user_err" + }, + "beat": { + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1", + "name": "demo-stack-redis-01" + }, + "host": { + "name": "demo-stack-redis-01" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "qtr7UmcBTFzn_XoLqZv2", + "source": { + "@timestamp": "2018-11-27T02:24:43.020Z", + "auditd": { + "result": "fail", + "session": "unset", + "data": { + "op": "login", + "acct": "(unknown user)", + "terminal": "sshd" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + }, + "object": { + "type": "user-session", + "primary": "sshd", + "secondary": "134.175.33.189" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 142434 + }, + "beat": { + "name": "demo-stack-haproxy-01", + "hostname": "demo-stack-haproxy-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-haproxy-01" + }, + "event": { + "action": "logged-in", + "module": "auditd", + "category": "user-login", + "type": "user_login" + }, + "user": { + "name_map": { + "uid": "root" + }, + "uid": "0", + "auid": "unset" + }, + "process": { + "pid": "20021", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "134.175.33.189" + }, + "network": { + "direction": "incoming" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "q9r7UmcBTFzn_XoLqZv2", + "source": { + "@timestamp": "2018-11-27T02:24:43.021Z", + "auditd": { + "session": "unset", + "data": { + "op": "login", + "terminal": "sshd", + "acct": "(invalid user)" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + }, + "object": { + "primary": "sshd", + "secondary": "134.175.33.189", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 142435, + "result": "fail" + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + }, + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + }, + "process": { + "pid": "20021", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "134.175.33.189" + }, + "network": { + "direction": "incoming" + }, + "host": { + "name": "demo-stack-haproxy-01" + }, + "beat": { + "hostname": "demo-stack-haproxy-01", + "version": "7.0.0-alpha1", + "name": "demo-stack-haproxy-01" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "rNr7UmcBTFzn_XoLqZv2", + "source": { + "@timestamp": "2018-11-27T02:24:43.229Z", + "beat": { + "name": "demo-stack-haproxy-01", + "hostname": "demo-stack-haproxy-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-haproxy-01" + }, + "auditd": { + "sequence": 142436, + "result": "fail", + "session": "unset", + "data": { + "hostname": "134.175.33.189", + "terminal": "ssh", + "op": "PAM:bad_ident" + }, + "summary": { + "actor": { + "secondary": "root", + "primary": "unset" + }, + "object": { + "primary": "ssh", + "secondary": "134.175.33.189", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + } + }, + "event": { + "type": "user_err", + "action": "error", + "module": "auditd", + "category": "user-login" + }, + "user": { + "uid": "0", + "auid": "unset", + "name_map": { + "uid": "root" + } + }, + "process": { + "exe": "/usr/sbin/sshd", + "pid": "20021" + }, + "source": { + "ip": "134.175.33.189" + }, + "network": { + "direction": "incoming" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "V9r7UmcBTFzn_XoLRZIS", + "source": { + "@timestamp": "2018-11-27T02:24:17.192Z", + "process": { + "pid": "32649", + "exe": "/usr/sbin/sshd" + }, + "beat": { + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-redis-01" + }, + "source": { + "ip": "107.170.65.109" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "sequence": 186611, + "result": "fail", + "session": "unset", + "data": { + "op": "login", + "acct": "(unknown user)", + "terminal": "sshd" + }, + "summary": { + "actor": { + "secondary": "(unknown user)", + "primary": "unset" + }, + "object": { + "primary": "sshd", + "secondary": "107.170.65.109", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + } + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + }, + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "WNr7UmcBTFzn_XoLRZIS", + "source": { + "@timestamp": "2018-11-27T02:24:17.193Z", + "network": { + "direction": "incoming" + }, + "auditd": { + "session": "unset", + "data": { + "terminal": "sshd", + "op": "login", + "acct": "(invalid user)" + }, + "summary": { + "object": { + "primary": "sshd", + "secondary": "107.170.65.109", + "type": "user-session" + }, + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + } + }, + "sequence": 186612, + "result": "fail" + }, + "beat": { + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-redis-01" + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + }, + "user": { + "name_map": { + "uid": "root" + }, + "auid": "unset", + "uid": "0" + }, + "process": { + "pid": "32649", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "107.170.65.109" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "Wdr7UmcBTFzn_XoLRZIS", + "source": { + "@timestamp": "2018-11-27T02:24:17.223Z", + "beat": { + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1", + "name": "demo-stack-redis-01" + }, + "event": { + "module": "auditd", + "category": "user-login", + "type": "user_err", + "action": "error" + }, + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + }, + "process": { + "pid": "32649", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "107.170.65.109" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "summary": { + "object": { + "primary": "ssh", + "secondary": "107.170.65.109", + "type": "user-session" + }, + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "root" + } + }, + "sequence": 186613, + "result": "fail", + "session": "unset", + "data": { + "hostname": "107.170.65.109", + "op": "PAM:bad_ident", + "terminal": "ssh" + } + }, + "host": { + "name": "demo-stack-redis-01" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "tdr8UmcBTFzn_XoLmK-a", + "source": { + "@timestamp": "2018-11-27T02:25:44.112Z", + "auditd": { + "result": "fail", + "session": "unset", + "data": { + "op": "login", + "terminal": "sshd", + "acct": "(unknown user)" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + }, + "object": { + "type": "user-session", + "primary": "sshd", + "secondary": "107.170.65.109" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 186614 + }, + "beat": { + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-redis-01" + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + }, + "user": { + "uid": "0", + "auid": "unset", + "name_map": { + "uid": "root" + } + }, + "process": { + "pid": "32658", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "107.170.65.109" + }, + "network": { + "direction": "incoming" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "ttr8UmcBTFzn_XoLmK-a", + "source": { + "@timestamp": "2018-11-27T02:25:44.114Z", + "network": { + "direction": "incoming" + }, + "auditd": { + "summary": { + "actor": { + "secondary": "(invalid user)", + "primary": "unset" + }, + "object": { + "primary": "sshd", + "secondary": "107.170.65.109", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 186615, + "result": "fail", + "session": "unset", + "data": { + "op": "login", + "acct": "(invalid user)", + "terminal": "sshd" + } + }, + "beat": { + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-redis-01" + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + }, + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + }, + "process": { + "exe": "/usr/sbin/sshd", + "pid": "32658" + }, + "source": { + "ip": "107.170.65.109" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "t9r8UmcBTFzn_XoLmK-a", + "source": { + "@timestamp": "2018-11-27T02:25:44.144Z", + "beat": { + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-redis-01" + }, + "source": { + "ip": "107.170.65.109" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "result": "fail", + "session": "unset", + "data": { + "hostname": "107.170.65.109", + "op": "PAM:bad_ident", + "terminal": "ssh" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "root" + }, + "object": { + "type": "user-session", + "primary": "ssh", + "secondary": "107.170.65.109" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 186616 + }, + "event": { + "type": "user_err", + "action": "error", + "module": "auditd", + "category": "user-login" + }, + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + }, + "process": { + "pid": "32658", + "exe": "/usr/sbin/sshd" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "Kdr8UmcBTFzn_XoL8rcs", + "source": { + "@timestamp": "2018-11-27T02:26:07.005Z", + "host": { + "name": "demo-stack-nginx-01" + }, + "beat": { + "name": "demo-stack-nginx-01", + "hostname": "demo-stack-nginx-01", + "version": "7.0.0-alpha1" + }, + "event": { + "action": "logged-in", + "module": "auditd", + "category": "user-login", + "type": "user_login" + }, + "user": { + "uid": "0", + "auid": "unset", + "name_map": { + "uid": "root" + } + }, + "process": { + "pid": "1003", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "144.217.12.168" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "summary": { + "object": { + "primary": "sshd", + "secondary": "144.217.12.168", + "type": "user-session" + }, + "how": "/usr/sbin/sshd", + "actor": { + "secondary": "(unknown user)", + "primary": "unset" + } + }, + "sequence": 192607, + "result": "fail", + "session": "unset", + "data": { + "terminal": "sshd", + "acct": "(unknown user)", + "op": "login" + } + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "Ktr8UmcBTFzn_XoL8rcs", + "source": { + "@timestamp": "2018-11-27T02:26:07.006Z", + "user": { + "name_map": { + "uid": "root" + }, + "auid": "unset", + "uid": "0" + }, + "process": { + "pid": "1003", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "144.217.12.168" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "result": "fail", + "session": "unset", + "data": { + "op": "login", + "acct": "(invalid user)", + "terminal": "sshd" + }, + "summary": { + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + }, + "object": { + "primary": "sshd", + "secondary": "144.217.12.168", + "type": "user-session" + } + }, + "sequence": 192608 + }, + "beat": { + "name": "demo-stack-nginx-01", + "hostname": "demo-stack-nginx-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-nginx-01" + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "K9r8UmcBTFzn_XoL8rcs", + "source": { + "@timestamp": "2018-11-27T02:26:07.048Z", + "event": { + "category": "user-login", + "type": "user_err", + "action": "error", + "module": "auditd" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "pid": "1003", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "144.217.12.168" + }, + "network": { + "direction": "incoming" + }, + "beat": { + "name": "demo-stack-nginx-01", + "hostname": "demo-stack-nginx-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-nginx-01" + }, + "auditd": { + "result": "fail", + "session": "unset", + "data": { + "terminal": "ssh", + "hostname": "144.217.12.168", + "op": "PAM:bad_ident" + }, + "summary": { + "object": { + "primary": "ssh", + "secondary": "144.217.12.168", + "type": "user-session" + }, + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "root" + } + }, + "sequence": 192609 + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "6dr7UmcBTFzn_XoLa5XB", + "source": { + "@timestamp": "2018-11-27T02:24:27.095Z", + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + }, + "process": { + "pid": "26248", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "159.138.6.50" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "summary": { + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + }, + "object": { + "primary": "sshd", + "secondary": "159.138.6.50", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 184442, + "result": "fail", + "session": "unset", + "data": { + "acct": "(unknown user)", + "terminal": "sshd", + "op": "login" + } + }, + "beat": { + "hostname": "demo-stack-apache-01", + "version": "7.0.0-alpha1", + "name": "demo-stack-apache-01" + }, + "host": { + "name": "demo-stack-apache-01" + }, + "event": { + "module": "auditd", + "category": "user-login", + "type": "user_login", + "action": "logged-in" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "6tr7UmcBTFzn_XoLa5XB", + "source": { + "@timestamp": "2018-11-27T02:24:27.096Z", + "process": { + "pid": "26248", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "159.138.6.50" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "sequence": 184443, + "result": "fail", + "session": "unset", + "data": { + "op": "login", + "terminal": "sshd", + "acct": "(invalid user)" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + }, + "object": { + "primary": "sshd", + "secondary": "159.138.6.50", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + } + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + }, + "beat": { + "version": "7.0.0-alpha1", + "name": "demo-stack-apache-01", + "hostname": "demo-stack-apache-01" + }, + "host": { + "name": "demo-stack-apache-01" + }, + "user": { + "auid": "unset", + "uid": "0", + "name_map": { + "uid": "root" + } + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "69r7UmcBTFzn_XoLa5XB", + "source": { + "@timestamp": "2018-11-27T02:24:27.306Z", + "user": { + "uid": "0", + "auid": "unset", + "name_map": { + "uid": "root" + } + }, + "process": { + "pid": "26248", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "159.138.6.50" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "data": { + "hostname": "159.138.6.50", + "terminal": "ssh", + "op": "PAM:bad_ident" + }, + "summary": { + "object": { + "primary": "ssh", + "secondary": "159.138.6.50", + "type": "user-session" + }, + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "root" + } + }, + "sequence": 184444, + "result": "fail", + "session": "unset" + }, + "host": { + "name": "demo-stack-apache-01" + }, + "beat": { + "version": "7.0.0-alpha1", + "name": "demo-stack-apache-01", + "hostname": "demo-stack-apache-01" + }, + "event": { + "category": "user-login", + "type": "user_err", + "action": "error", + "module": "auditd" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "mdr9UmcBTFzn_XoLS7_z", + "source": { + "@timestamp": "2018-11-27T02:26:30.024Z", + "beat": { + "version": "7.0.0-alpha1", + "name": "demo-stack-nginx-01", + "hostname": "demo-stack-nginx-01" + }, + "host": { + "name": "demo-stack-nginx-01" + }, + "auditd": { + "data": { + "op": "login", + "acct": "(unknown user)", + "terminal": "sshd" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + }, + "object": { + "primary": "sshd", + "secondary": "178.33.228.67", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 192610, + "result": "fail", + "session": "unset" + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + }, + "user": { + "name_map": { + "uid": "root" + }, + "uid": "0", + "auid": "unset" + }, + "process": { + "pid": "1010", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "178.33.228.67" + }, + "network": { + "direction": "incoming" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "mtr9UmcBTFzn_XoLS7_z", + "source": { + "@timestamp": "2018-11-27T02:26:30.025Z", + "beat": { + "version": "7.0.0-alpha1", + "name": "demo-stack-nginx-01", + "hostname": "demo-stack-nginx-01" + }, + "host": { + "name": "demo-stack-nginx-01" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "pid": "1010", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "178.33.228.67" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "session": "unset", + "data": { + "op": "login", + "terminal": "sshd", + "acct": "(invalid user)" + }, + "summary": { + "actor": { + "secondary": "(invalid user)", + "primary": "unset" + }, + "object": { + "secondary": "178.33.228.67", + "type": "user-session", + "primary": "sshd" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 192611, + "result": "fail" + }, + "event": { + "module": "auditd", + "category": "user-login", + "type": "user_login", + "action": "logged-in" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "m9r9UmcBTFzn_XoLS7_z", + "source": { + "@timestamp": "2018-11-27T02:26:30.133Z", + "host": { + "name": "demo-stack-nginx-01" + }, + "beat": { + "name": "demo-stack-nginx-01", + "hostname": "demo-stack-nginx-01", + "version": "7.0.0-alpha1" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "session": "unset", + "data": { + "op": "PAM:bad_ident", + "hostname": "178.33.228.67", + "terminal": "ssh" + }, + "summary": { + "actor": { + "secondary": "root", + "primary": "unset" + }, + "object": { + "primary": "ssh", + "secondary": "178.33.228.67", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 192612, + "result": "fail" + }, + "event": { + "module": "auditd", + "category": "user-login", + "type": "user_err", + "action": "error" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "exe": "/usr/sbin/sshd", + "pid": "1010" + }, + "source": { + "ip": "178.33.228.67" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "Gdr-UmcBTFzn_XoLHdFd", + "source": { + "@timestamp": "2018-11-27T02:27:23.630Z", + "network": { + "direction": "incoming" + }, + "auditd": { + "result": "fail", + "session": "unset", + "data": { + "terminal": "sshd", + "acct": "(unknown user)", + "op": "login" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + }, + "object": { + "primary": "sshd", + "secondary": "213.34.172.74", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 44273 + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + }, + "user": { + "name_map": { + "uid": "root" + }, + "uid": "0", + "auid": "unset" + }, + "process": { + "exe": "/usr/sbin/sshd", + "pid": "30753" + }, + "beat": { + "name": "demo-stack-es-01", + "hostname": "demo-stack-es-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-es-01" + }, + "source": { + "ip": "213.34.172.74" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "Gtr-UmcBTFzn_XoLHdFd", + "source": { + "@timestamp": "2018-11-27T02:27:23.634Z", + "source": { + "ip": "213.34.172.74" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "result": "fail", + "session": "unset", + "data": { + "op": "login", + "terminal": "sshd", + "acct": "(invalid user)" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + }, + "object": { + "secondary": "213.34.172.74", + "type": "user-session", + "primary": "sshd" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 44274 + }, + "event": { + "type": "user_login", + "action": "logged-in", + "module": "auditd", + "category": "user-login" + }, + "user": { + "name_map": { + "uid": "root" + }, + "auid": "unset", + "uid": "0" + }, + "host": { + "name": "demo-stack-es-01" + }, + "beat": { + "hostname": "demo-stack-es-01", + "version": "7.0.0-alpha1", + "name": "demo-stack-es-01" + }, + "process": { + "exe": "/usr/sbin/sshd", + "pid": "30753" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "G9r-UmcBTFzn_XoLHdFd", + "source": { + "@timestamp": "2018-11-27T02:27:23.758Z", + "event": { + "category": "user-login", + "type": "user_err", + "action": "error", + "module": "auditd" + }, + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + }, + "process": { + "pid": "30753", + "exe": "/usr/sbin/sshd" + }, + "beat": { + "version": "7.0.0-alpha1", + "name": "demo-stack-es-01", + "hostname": "demo-stack-es-01" + }, + "host": { + "name": "demo-stack-es-01" + }, + "source": { + "ip": "213.34.172.74" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "sequence": 44275, + "result": "fail", + "session": "unset", + "data": { + "terminal": "ssh", + "hostname": "213.34.172.74", + "op": "PAM:bad_ident" + }, + "summary": { + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "root" + }, + "object": { + "primary": "ssh", + "secondary": "213.34.172.74", + "type": "user-session" + } + } + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "o9r7UmcBTFzn_XoLJpB1", + "source": { + "@timestamp": "2018-11-27T02:24:09.351Z", + "process": { + "pid": "30690", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "175.205.114.52" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "result": "fail", + "session": "unset", + "data": { + "op": "login", + "acct": "(unknown user)", + "terminal": "sshd" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + }, + "object": { + "primary": "sshd", + "secondary": "175.205.114.52", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 44270 + }, + "event": { + "type": "user_login", + "action": "logged-in", + "module": "auditd", + "category": "user-login" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "beat": { + "name": "demo-stack-es-01", + "hostname": "demo-stack-es-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-es-01" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "pNr7UmcBTFzn_XoLJpB1", + "source": { + "@timestamp": "2018-11-27T02:24:09.351Z", + "network": { + "direction": "incoming" + }, + "beat": { + "name": "demo-stack-es-01", + "hostname": "demo-stack-es-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-es-01" + }, + "auditd": { + "data": { + "op": "login", + "acct": "(invalid user)", + "terminal": "sshd" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + }, + "object": { + "primary": "sshd", + "secondary": "175.205.114.52", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 44271, + "result": "fail", + "session": "unset" + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + }, + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + }, + "process": { + "pid": "30690", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "175.205.114.52" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "pdr7UmcBTFzn_XoLJpB1", + "source": { + "@timestamp": "2018-11-27T02:24:09.523Z", + "auditd": { + "result": "fail", + "session": "unset", + "data": { + "terminal": "ssh", + "op": "PAM:bad_ident", + "hostname": "175.205.114.52" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "root" + }, + "object": { + "primary": "ssh", + "secondary": "175.205.114.52", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 44272 + }, + "event": { + "module": "auditd", + "category": "user-login", + "type": "user_err", + "action": "error" + }, + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + }, + "process": { + "exe": "/usr/sbin/sshd", + "pid": "30690" + }, + "source": { + "ip": "175.205.114.52" + }, + "network": { + "direction": "incoming" + }, + "beat": { + "name": "demo-stack-es-01", + "hostname": "demo-stack-es-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-es-01" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "3NsDU2cBTFzn_XoLlEgC", + "source": { + "@timestamp": "2018-11-27T02:33:21.687Z", + "auditd": { + "sequence": 186632, + "result": "fail", + "session": "unset", + "data": { + "op": "PAM:bad_ident", + "hostname": "92.86.47.26", + "terminal": "ssh" + }, + "summary": { + "actor": { + "secondary": "root", + "primary": "unset" + }, + "object": { + "type": "user-session", + "primary": "ssh", + "secondary": "92.86.47.26" + }, + "how": "/usr/sbin/sshd" + } + }, + "event": { + "category": "user-login", + "type": "user_err", + "action": "error", + "module": "auditd" + }, + "user": { + "uid": "0", + "auid": "unset", + "name_map": { + "uid": "root" + } + }, + "process": { + "pid": "32702", + "exe": "/usr/sbin/sshd" + }, + "beat": { + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1", + "name": "demo-stack-redis-01" + }, + "host": { + "name": "demo-stack-redis-01" + }, + "source": { + "ip": "92.86.47.26" + }, + "network": { + "direction": "incoming" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "a9sDU2cBTFzn_XoLmUlp", + "source": { + "@timestamp": "2018-11-27T02:33:23.071Z", + "auditd": { + "sequence": 192616, + "result": "fail", + "session": "unset", + "data": { + "op": "login", + "terminal": "sshd", + "acct": "(unknown user)" + }, + "summary": { + "object": { + "type": "user-session", + "primary": "sshd", + "secondary": "145.239.137.89" + }, + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + } + } + }, + "event": { + "module": "auditd", + "category": "user-login", + "type": "user_login", + "action": "logged-in" + }, + "user": { + "name_map": { + "uid": "root" + }, + "auid": "unset", + "uid": "0" + }, + "process": { + "exe": "/usr/sbin/sshd", + "pid": "1048" + }, + "beat": { + "version": "7.0.0-alpha1", + "name": "demo-stack-nginx-01", + "hostname": "demo-stack-nginx-01" + }, + "host": { + "name": "demo-stack-nginx-01" + }, + "source": { + "ip": "145.239.137.89" + }, + "network": { + "direction": "incoming" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "bNsDU2cBTFzn_XoLmUlp", + "source": { + "@timestamp": "2018-11-27T02:33:23.072Z", + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + }, + "process": { + "pid": "1048", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "145.239.137.89" + }, + "network": { + "direction": "incoming" + }, + "beat": { + "name": "demo-stack-nginx-01", + "hostname": "demo-stack-nginx-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-nginx-01" + }, + "auditd": { + "result": "fail", + "session": "unset", + "data": { + "acct": "(invalid user)", + "terminal": "sshd", + "op": "login" + }, + "summary": { + "actor": { + "secondary": "(invalid user)", + "primary": "unset" + }, + "object": { + "secondary": "145.239.137.89", + "type": "user-session", + "primary": "sshd" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 192617 + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "bdsDU2cBTFzn_XoLmUlp", + "source": { + "@timestamp": "2018-11-27T02:33:23.187Z", + "network": { + "direction": "incoming" + }, + "auditd": { + "session": "unset", + "data": { + "op": "PAM:bad_ident", + "hostname": "145.239.137.89", + "terminal": "ssh" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "root" + }, + "object": { + "type": "user-session", + "primary": "ssh", + "secondary": "145.239.137.89" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 192618, + "result": "fail" + }, + "host": { + "name": "demo-stack-nginx-01" + }, + "beat": { + "name": "demo-stack-nginx-01", + "hostname": "demo-stack-nginx-01", + "version": "7.0.0-alpha1" + }, + "event": { + "action": "error", + "module": "auditd", + "category": "user-login", + "type": "user_err" + }, + "user": { + "uid": "0", + "auid": "unset", + "name_map": { + "uid": "root" + } + }, + "process": { + "pid": "1048", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "145.239.137.89" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "f9sDU2cBTFzn_XoLp0rb", + "source": { + "@timestamp": "2018-11-27T02:33:26.769Z", + "auditd": { + "sequence": 142437, + "result": "fail", + "session": "unset", + "data": { + "acct": "(unknown user)", + "terminal": "sshd", + "op": "login" + }, + "summary": { + "how": "/usr/sbin/sshd", + "actor": { + "secondary": "(unknown user)", + "primary": "unset" + }, + "object": { + "primary": "sshd", + "secondary": "115.113.54.122", + "type": "user-session" + } + } + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + }, + "beat": { + "name": "demo-stack-haproxy-01", + "hostname": "demo-stack-haproxy-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-haproxy-01" + }, + "user": { + "auid": "unset", + "uid": "0", + "name_map": { + "uid": "root" + } + }, + "process": { + "pid": "20065", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "115.113.54.122" + }, + "network": { + "direction": "incoming" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "gNsDU2cBTFzn_XoLp0rb", + "source": { + "@timestamp": "2018-11-27T02:33:26.771Z", + "auditd": { + "session": "unset", + "data": { + "acct": "(invalid user)", + "op": "login", + "terminal": "sshd" + }, + "summary": { + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + }, + "object": { + "primary": "sshd", + "secondary": "115.113.54.122", + "type": "user-session" + } + }, + "sequence": 142438, + "result": "fail" + }, + "event": { + "type": "user_login", + "action": "logged-in", + "module": "auditd", + "category": "user-login" + }, + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + }, + "beat": { + "name": "demo-stack-haproxy-01", + "hostname": "demo-stack-haproxy-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-haproxy-01" + }, + "process": { + "pid": "20065", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "115.113.54.122" + }, + "network": { + "direction": "incoming" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "gdsDU2cBTFzn_XoLp0rb", + "source": { + "@timestamp": "2018-11-27T02:33:27.053Z", + "beat": { + "name": "demo-stack-haproxy-01", + "hostname": "demo-stack-haproxy-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-haproxy-01" + }, + "event": { + "category": "user-login", + "type": "user_err", + "action": "error", + "module": "auditd" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "pid": "20065", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "115.113.54.122" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "session": "unset", + "data": { + "op": "PAM:bad_ident", + "hostname": "115.113.54.122", + "terminal": "ssh" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "root" + }, + "object": { + "secondary": "115.113.54.122", + "type": "user-session", + "primary": "ssh" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 142439, + "result": "fail" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "J9sGU2cBTFzn_XoLiIku", + "source": { + "@timestamp": "2018-11-27T02:36:35.268Z", + "user": { + "name_map": { + "uid": "root" + }, + "uid": "0", + "auid": "unset" + }, + "host": { + "name": "demo-stack-apache-01" + }, + "beat": { + "hostname": "demo-stack-apache-01", + "version": "7.0.0-alpha1", + "name": "demo-stack-apache-01" + }, + "process": { + "pid": "26335", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "37.59.9.162" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "result": "fail", + "session": "unset", + "data": { + "acct": "(unknown user)", + "terminal": "sshd", + "op": "login" + }, + "summary": { + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + }, + "object": { + "type": "user-session", + "primary": "sshd", + "secondary": "37.59.9.162" + } + }, + "sequence": 184445 + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "KNsGU2cBTFzn_XoLiIku", + "source": { + "@timestamp": "2018-11-27T02:36:35.269Z", + "host": { + "name": "demo-stack-apache-01" + }, + "process": { + "exe": "/usr/sbin/sshd", + "pid": "26335" + }, + "source": { + "ip": "37.59.9.162" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "result": "fail", + "session": "unset", + "data": { + "op": "login", + "terminal": "sshd", + "acct": "(invalid user)" + }, + "summary": { + "how": "/usr/sbin/sshd", + "actor": { + "secondary": "(invalid user)", + "primary": "unset" + }, + "object": { + "type": "user-session", + "primary": "sshd", + "secondary": "37.59.9.162" + } + }, + "sequence": 184446 + }, + "event": { + "type": "user_login", + "action": "logged-in", + "module": "auditd", + "category": "user-login" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "beat": { + "name": "demo-stack-apache-01", + "hostname": "demo-stack-apache-01", + "version": "7.0.0-alpha1" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "KdsGU2cBTFzn_XoLiIku", + "source": { + "@timestamp": "2018-11-27T02:36:35.380Z", + "event": { + "category": "user-login", + "type": "user_err", + "action": "error", + "module": "auditd" + }, + "beat": { + "name": "demo-stack-apache-01", + "hostname": "demo-stack-apache-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-apache-01" + }, + "user": { + "name_map": { + "uid": "root" + }, + "auid": "unset", + "uid": "0" + }, + "process": { + "pid": "26335", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "37.59.9.162" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "summary": { + "actor": { + "primary": "unset", + "secondary": "root" + }, + "object": { + "primary": "ssh", + "secondary": "37.59.9.162", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 184447, + "result": "fail", + "session": "unset", + "data": { + "op": "PAM:bad_ident", + "hostname": "37.59.9.162", + "terminal": "ssh" + } + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "uNsFU2cBTFzn_XoLNGx8", + "source": { + "@timestamp": "2018-11-27T02:35:08.305Z", + "host": { + "name": "demo-stack-nginx-01" + }, + "beat": { + "name": "demo-stack-nginx-01", + "hostname": "demo-stack-nginx-01", + "version": "7.0.0-alpha1" + }, + "source": { + "ip": "81.174.25.52" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "result": "fail", + "session": "unset", + "data": { + "acct": "(unknown user)", + "op": "login", + "terminal": "sshd" + }, + "summary": { + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + }, + "object": { + "type": "user-session", + "primary": "sshd", + "secondary": "81.174.25.52" + } + }, + "sequence": 192619 + }, + "event": { + "module": "auditd", + "category": "user-login", + "type": "user_login", + "action": "logged-in" + }, + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + }, + "process": { + "pid": "1062", + "exe": "/usr/sbin/sshd" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "udsFU2cBTFzn_XoLNGx8", + "source": { + "@timestamp": "2018-11-27T02:35:08.307Z", + "event": { + "module": "auditd", + "category": "user-login", + "type": "user_login", + "action": "logged-in" + }, + "user": { + "name_map": { + "uid": "root" + }, + "auid": "unset", + "uid": "0" + }, + "process": { + "pid": "1062", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "81.174.25.52" + }, + "beat": { + "name": "demo-stack-nginx-01", + "hostname": "demo-stack-nginx-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-nginx-01" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "sequence": 192620, + "result": "fail", + "session": "unset", + "data": { + "op": "login", + "terminal": "sshd", + "acct": "(invalid user)" + }, + "summary": { + "object": { + "type": "user-session", + "primary": "sshd", + "secondary": "81.174.25.52" + }, + "how": "/usr/sbin/sshd", + "actor": { + "secondary": "(invalid user)", + "primary": "unset" + } + } + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "utsFU2cBTFzn_XoLNGx8", + "source": { + "@timestamp": "2018-11-27T02:35:08.440Z", + "network": { + "direction": "incoming" + }, + "beat": { + "name": "demo-stack-nginx-01", + "hostname": "demo-stack-nginx-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-nginx-01" + }, + "auditd": { + "result": "fail", + "session": "unset", + "data": { + "op": "PAM:bad_ident", + "terminal": "ssh", + "hostname": "81.174.25.52" + }, + "summary": { + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "root" + }, + "object": { + "primary": "ssh", + "secondary": "81.174.25.52", + "type": "user-session" + } + }, + "sequence": 192621 + }, + "event": { + "type": "user_err", + "action": "error", + "module": "auditd", + "category": "user-login" + }, + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + }, + "process": { + "pid": "1062", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "81.174.25.52" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "yNsFU2cBTFzn_XoLA2fV", + "source": { + "@timestamp": "2018-11-27T02:34:55.845Z", + "source": { + "ip": "74.208.43.208" + }, + "beat": { + "hostname": "demo-stack-es-01", + "version": "7.0.0-alpha1", + "name": "demo-stack-es-01" + }, + "host": { + "name": "demo-stack-es-01" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "summary": { + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + }, + "object": { + "secondary": "74.208.43.208", + "type": "user-session", + "primary": "sshd" + } + }, + "sequence": 44282, + "result": "fail", + "session": "unset", + "data": { + "terminal": "sshd", + "acct": "(unknown user)", + "op": "login" + } + }, + "event": { + "action": "logged-in", + "module": "auditd", + "category": "user-login", + "type": "user_login" + }, + "user": { + "name_map": { + "uid": "root" + }, + "auid": "unset", + "uid": "0" + }, + "process": { + "exe": "/usr/sbin/sshd", + "pid": "30899" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "ydsFU2cBTFzn_XoLA2fV", + "source": { + "@timestamp": "2018-11-27T02:34:55.849Z", + "source": { + "ip": "74.208.43.208" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "summary": { + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + }, + "object": { + "primary": "sshd", + "secondary": "74.208.43.208", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 44283, + "result": "fail", + "session": "unset", + "data": { + "terminal": "sshd", + "op": "login", + "acct": "(invalid user)" + } + }, + "event": { + "action": "logged-in", + "module": "auditd", + "category": "user-login", + "type": "user_login" + }, + "beat": { + "name": "demo-stack-es-01", + "hostname": "demo-stack-es-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-es-01" + }, + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + }, + "process": { + "pid": "30899", + "exe": "/usr/sbin/sshd" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "ytsFU2cBTFzn_XoLA2fV", + "source": { + "@timestamp": "2018-11-27T02:34:55.873Z", + "user": { + "name_map": { + "uid": "root" + }, + "uid": "0", + "auid": "unset" + }, + "process": { + "exe": "/usr/sbin/sshd", + "pid": "30899" + }, + "source": { + "ip": "74.208.43.208" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "result": "fail", + "session": "unset", + "data": { + "op": "PAM:bad_ident", + "hostname": "74.208.43.208", + "terminal": "ssh" + }, + "summary": { + "object": { + "secondary": "74.208.43.208", + "type": "user-session", + "primary": "ssh" + }, + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "root" + } + }, + "sequence": 44284 + }, + "event": { + "category": "user-login", + "type": "user_err", + "action": "error", + "module": "auditd" + }, + "beat": { + "name": "demo-stack-es-01", + "hostname": "demo-stack-es-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-es-01" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "vNsHU2cBTFzn_XoLOZig", + "source": { + "@timestamp": "2018-11-27T02:37:20.688Z", + "host": { + "name": "demo-stack-es-01" + }, + "beat": { + "name": "demo-stack-es-01", + "hostname": "demo-stack-es-01", + "version": "7.0.0-alpha1" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "pid": "30953", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "87.249.215.83" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "sequence": 44289, + "result": "fail", + "session": "unset", + "data": { + "acct": "(unknown user)", + "terminal": "sshd", + "op": "login" + }, + "summary": { + "how": "/usr/sbin/sshd", + "actor": { + "secondary": "(unknown user)", + "primary": "unset" + }, + "object": { + "type": "user-session", + "primary": "sshd", + "secondary": "87.249.215.83" + } + } + }, + "event": { + "module": "auditd", + "category": "user-login", + "type": "user_login", + "action": "logged-in" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "vdsHU2cBTFzn_XoLOZig", + "source": { + "@timestamp": "2018-11-27T02:37:20.688Z", + "source": { + "ip": "87.249.215.83" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "data": { + "terminal": "sshd", + "op": "login", + "acct": "(invalid user)" + }, + "summary": { + "object": { + "primary": "sshd", + "secondary": "87.249.215.83", + "type": "user-session" + }, + "how": "/usr/sbin/sshd", + "actor": { + "secondary": "(invalid user)", + "primary": "unset" + } + }, + "sequence": 44290, + "result": "fail", + "session": "unset" + }, + "event": { + "action": "logged-in", + "module": "auditd", + "category": "user-login", + "type": "user_login" + }, + "user": { + "auid": "unset", + "uid": "0", + "name_map": { + "uid": "root" + } + }, + "beat": { + "name": "demo-stack-es-01", + "hostname": "demo-stack-es-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-es-01" + }, + "process": { + "exe": "/usr/sbin/sshd", + "pid": "30953" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "vtsHU2cBTFzn_XoLOZig", + "source": { + "@timestamp": "2018-11-27T02:37:20.864Z", + "user": { + "auid": "unset", + "uid": "0", + "name_map": { + "uid": "root" + } + }, + "process": { + "pid": "30953", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "87.249.215.83" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "session": "unset", + "data": { + "terminal": "ssh", + "op": "PAM:bad_ident", + "hostname": "87.249.215.83" + }, + "summary": { + "actor": { + "secondary": "root", + "primary": "unset" + }, + "object": { + "type": "user-session", + "primary": "ssh", + "secondary": "87.249.215.83" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 44291, + "result": "fail" + }, + "beat": { + "version": "7.0.0-alpha1", + "name": "demo-stack-es-01", + "hostname": "demo-stack-es-01" + }, + "host": { + "name": "demo-stack-es-01" + }, + "event": { + "category": "user-login", + "type": "user_err", + "action": "error", + "module": "auditd" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "MtsEU2cBTFzn_XoLzWOC", + "source": { + "@timestamp": "2018-11-27T02:34:41.940Z", + "user": { + "name_map": { + "uid": "root" + }, + "uid": "0", + "auid": "unset" + }, + "process": { + "pid": "30892", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "175.116.217.13" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "summary": { + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + }, + "object": { + "primary": "sshd", + "secondary": "175.116.217.13", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 44279, + "result": "fail", + "session": "unset", + "data": { + "op": "login", + "acct": "(unknown user)", + "terminal": "sshd" + } + }, + "beat": { + "name": "demo-stack-es-01", + "hostname": "demo-stack-es-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-es-01" + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "M9sEU2cBTFzn_XoLzWOC", + "source": { + "@timestamp": "2018-11-27T02:34:41.944Z", + "beat": { + "name": "demo-stack-es-01", + "hostname": "demo-stack-es-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-es-01" + }, + "event": { + "module": "auditd", + "category": "user-login", + "type": "user_login", + "action": "logged-in" + }, + "user": { + "name_map": { + "uid": "root" + }, + "uid": "0", + "auid": "unset" + }, + "process": { + "pid": "30892", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "175.116.217.13" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "summary": { + "object": { + "primary": "sshd", + "secondary": "175.116.217.13", + "type": "user-session" + }, + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + } + }, + "sequence": 44280, + "result": "fail", + "session": "unset", + "data": { + "acct": "(invalid user)", + "terminal": "sshd", + "op": "login" + } + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "NNsEU2cBTFzn_XoLzWOC", + "source": { + "@timestamp": "2018-11-27T02:34:42.116Z", + "auditd": { + "data": { + "op": "PAM:bad_ident", + "terminal": "ssh", + "hostname": "175.116.217.13" + }, + "summary": { + "object": { + "primary": "ssh", + "secondary": "175.116.217.13", + "type": "user-session" + }, + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "root" + } + }, + "sequence": 44281, + "result": "fail", + "session": "unset" + }, + "beat": { + "name": "demo-stack-es-01", + "hostname": "demo-stack-es-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-es-01" + }, + "event": { + "action": "error", + "module": "auditd", + "category": "user-login", + "type": "user_err" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "pid": "30892", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "175.116.217.13" + }, + "network": { + "direction": "incoming" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "59sHU2cBTFzn_XoLBZOc", + "source": { + "@timestamp": "2018-11-27T02:37:07.375Z", + "user": { + "auid": "unset", + "uid": "0", + "name_map": { + "uid": "root" + } + }, + "process": { + "pid": "30947", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "45.55.190.46" + }, + "beat": { + "name": "demo-stack-es-01", + "hostname": "demo-stack-es-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-es-01" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "result": "fail", + "session": "unset", + "data": { + "acct": "(unknown user)", + "terminal": "sshd", + "op": "login" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + }, + "object": { + "type": "user-session", + "primary": "sshd", + "secondary": "45.55.190.46" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 44286 + }, + "event": { + "module": "auditd", + "category": "user-login", + "type": "user_login", + "action": "logged-in" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "6NsHU2cBTFzn_XoLBZOc", + "source": { + "@timestamp": "2018-11-27T02:37:07.375Z", + "auditd": { + "sequence": 44287, + "result": "fail", + "session": "unset", + "data": { + "terminal": "sshd", + "acct": "(invalid user)", + "op": "login" + }, + "summary": { + "actor": { + "secondary": "(invalid user)", + "primary": "unset" + }, + "object": { + "secondary": "45.55.190.46", + "type": "user-session", + "primary": "sshd" + }, + "how": "/usr/sbin/sshd" + } + }, + "beat": { + "name": "demo-stack-es-01", + "hostname": "demo-stack-es-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-es-01" + }, + "event": { + "type": "user_login", + "action": "logged-in", + "module": "auditd", + "category": "user-login" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "pid": "30947", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "45.55.190.46" + }, + "network": { + "direction": "incoming" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "6dsHU2cBTFzn_XoLBZOc", + "source": { + "@timestamp": "2018-11-27T02:37:07.407Z", + "beat": { + "name": "demo-stack-es-01", + "hostname": "demo-stack-es-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-es-01" + }, + "source": { + "ip": "45.55.190.46" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "result": "fail", + "session": "unset", + "data": { + "op": "PAM:bad_ident", + "hostname": "45.55.190.46", + "terminal": "ssh" + }, + "summary": { + "actor": { + "secondary": "root", + "primary": "unset" + }, + "object": { + "primary": "ssh", + "secondary": "45.55.190.46", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 44288 + }, + "event": { + "action": "error", + "module": "auditd", + "category": "user-login", + "type": "user_err" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "pid": "30947", + "exe": "/usr/sbin/sshd" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "Y9sGU2cBTFzn_XoL6ZGy", + "source": { + "@timestamp": "2018-11-27T02:37:00.227Z", + "source": { + "ip": "103.48.12.177" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "sequence": 44285, + "result": "fail", + "session": "unset", + "data": { + "hostname": "103.48.12.177", + "op": "PAM:bad_ident", + "terminal": "ssh" + }, + "summary": { + "object": { + "type": "user-session", + "primary": "ssh", + "secondary": "103.48.12.177" + }, + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "root" + } + } + }, + "event": { + "type": "user_err", + "action": "error", + "module": "auditd", + "category": "user-login" + }, + "user": { + "name_map": { + "uid": "root" + }, + "auid": "unset", + "uid": "0" + }, + "beat": { + "name": "demo-stack-es-01", + "hostname": "demo-stack-es-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-es-01" + }, + "process": { + "pid": "30943", + "exe": "/usr/sbin/sshd" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "JNsJU2cBTFzn_XoLCcBJ", + "source": { + "@timestamp": "2018-11-27T02:39:19.382Z", + "network": { + "direction": "incoming" + }, + "auditd": { + "data": { + "terminal": "sshd", + "acct": "(unknown user)", + "op": "login" + }, + "summary": { + "object": { + "secondary": "167.99.84.229", + "type": "user-session", + "primary": "sshd" + }, + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + } + }, + "sequence": 43278, + "result": "fail", + "session": "unset" + }, + "event": { + "module": "auditd", + "category": "user-login", + "type": "user_login", + "action": "logged-in" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "pid": "13175", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "167.99.84.229" + }, + "beat": { + "name": "demo-stack-mysql-01", + "hostname": "demo-stack-mysql-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-mysql-01" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "JdsJU2cBTFzn_XoLCcBJ", + "source": { + "@timestamp": "2018-11-27T02:39:19.386Z", + "user": { + "auid": "unset", + "uid": "0", + "name_map": { + "uid": "root" + } + }, + "beat": { + "name": "demo-stack-mysql-01", + "hostname": "demo-stack-mysql-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-mysql-01" + }, + "process": { + "exe": "/usr/sbin/sshd", + "pid": "13175" + }, + "source": { + "ip": "167.99.84.229" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "sequence": 43279, + "result": "fail", + "session": "unset", + "data": { + "op": "login", + "terminal": "sshd", + "acct": "(invalid user)" + }, + "summary": { + "object": { + "primary": "sshd", + "secondary": "167.99.84.229", + "type": "user-session" + }, + "how": "/usr/sbin/sshd", + "actor": { + "secondary": "(invalid user)", + "primary": "unset" + } + } + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "JtsJU2cBTFzn_XoLCcBJ", + "source": { + "@timestamp": "2018-11-27T02:39:19.486Z", + "beat": { + "version": "7.0.0-alpha1", + "name": "demo-stack-mysql-01", + "hostname": "demo-stack-mysql-01" + }, + "host": { + "name": "demo-stack-mysql-01" + }, + "process": { + "exe": "/usr/sbin/sshd", + "pid": "13175" + }, + "source": { + "ip": "167.99.84.229" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "data": { + "hostname": "167.99.84.229", + "terminal": "ssh", + "op": "PAM:bad_ident" + }, + "summary": { + "object": { + "primary": "ssh", + "secondary": "167.99.84.229", + "type": "user-session" + }, + "how": "/usr/sbin/sshd", + "actor": { + "secondary": "root", + "primary": "unset" + } + }, + "sequence": 43280, + "result": "fail", + "session": "unset" + }, + "event": { + "module": "auditd", + "category": "user-login", + "type": "user_err", + "action": "error" + }, + "user": { + "name_map": { + "uid": "root" + }, + "uid": "0", + "auid": "unset" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "J9sJU2cBTFzn_XoLCcCX", + "source": { + "@timestamp": "2018-11-27T02:39:19.468Z", + "host": { + "name": "demo-stack-apache-01" + }, + "auditd": { + "summary": { + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + }, + "object": { + "primary": "sshd", + "secondary": "89.223.28.0", + "type": "user-session" + } + }, + "sequence": 184454, + "result": "fail", + "session": "unset", + "data": { + "op": "login", + "terminal": "sshd", + "acct": "(unknown user)" + } + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + }, + "user": { + "name_map": { + "uid": "root" + }, + "auid": "unset", + "uid": "0" + }, + "process": { + "pid": "26405", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "89.223.28.0" + }, + "network": { + "direction": "incoming" + }, + "beat": { + "name": "demo-stack-apache-01", + "hostname": "demo-stack-apache-01", + "version": "7.0.0-alpha1" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "KNsJU2cBTFzn_XoLCcCX", + "source": { + "@timestamp": "2018-11-27T02:39:19.469Z", + "source": { + "ip": "89.223.28.0" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "result": "fail", + "session": "unset", + "data": { + "acct": "(invalid user)", + "terminal": "sshd", + "op": "login" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + }, + "object": { + "primary": "sshd", + "secondary": "89.223.28.0", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 184455 + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + }, + "beat": { + "name": "demo-stack-apache-01", + "hostname": "demo-stack-apache-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-apache-01" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "pid": "26405", + "exe": "/usr/sbin/sshd" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "KdsJU2cBTFzn_XoLCcCX", + "source": { + "@timestamp": "2018-11-27T02:39:19.630Z", + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + }, + "process": { + "exe": "/usr/sbin/sshd", + "pid": "26405" + }, + "source": { + "ip": "89.223.28.0" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "session": "unset", + "data": { + "hostname": "89.223.28.0", + "op": "PAM:bad_ident", + "terminal": "ssh" + }, + "summary": { + "actor": { + "secondary": "root", + "primary": "unset" + }, + "object": { + "primary": "ssh", + "secondary": "89.223.28.0", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 184456, + "result": "fail" + }, + "beat": { + "name": "demo-stack-apache-01", + "hostname": "demo-stack-apache-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-apache-01" + }, + "event": { + "action": "error", + "module": "auditd", + "category": "user-login", + "type": "user_err" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "7dsJU2cBTFzn_XoLVsZ3", + "source": { + "@timestamp": "2018-11-27T02:39:39.149Z", + "network": { + "direction": "incoming" + }, + "auditd": { + "summary": { + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + }, + "object": { + "primary": "sshd", + "secondary": "188.166.58.40", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 192640, + "result": "fail", + "session": "unset", + "data": { + "acct": "(unknown user)", + "terminal": "sshd", + "op": "login" + } + }, + "event": { + "module": "auditd", + "category": "user-login", + "type": "user_login", + "action": "logged-in" + }, + "user": { + "name_map": { + "uid": "root" + }, + "uid": "0", + "auid": "unset" + }, + "beat": { + "name": "demo-stack-nginx-01", + "hostname": "demo-stack-nginx-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-nginx-01" + }, + "process": { + "pid": "1141", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "188.166.58.40" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "7tsJU2cBTFzn_XoLVsZ3", + "source": { + "@timestamp": "2018-11-27T02:39:39.150Z", + "auditd": { + "data": { + "terminal": "sshd", + "acct": "(invalid user)", + "op": "login" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + }, + "object": { + "primary": "sshd", + "secondary": "188.166.58.40", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 192641, + "result": "fail", + "session": "unset" + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "pid": "1141", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "188.166.58.40" + }, + "beat": { + "name": "demo-stack-nginx-01", + "hostname": "demo-stack-nginx-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-nginx-01" + }, + "network": { + "direction": "incoming" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "79sJU2cBTFzn_XoLVsZ3", + "source": { + "@timestamp": "2018-11-27T02:39:39.256Z", + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + }, + "process": { + "exe": "/usr/sbin/sshd", + "pid": "1141" + }, + "source": { + "ip": "188.166.58.40" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "result": "fail", + "session": "unset", + "data": { + "hostname": "188.166.58.40", + "op": "PAM:bad_ident", + "terminal": "ssh" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "root" + }, + "object": { + "primary": "ssh", + "secondary": "188.166.58.40", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 192642 + }, + "event": { + "category": "user-login", + "type": "user_err", + "action": "error", + "module": "auditd" + }, + "beat": { + "name": "demo-stack-nginx-01", + "hostname": "demo-stack-nginx-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-nginx-01" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "KtsJU2cBTFzn_XoLWMfm", + "source": { + "@timestamp": "2018-11-27T02:39:39.771Z", + "auditd": { + "result": "fail", + "session": "unset", + "data": { + "acct": "(unknown user)", + "terminal": "sshd", + "op": "login" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + }, + "object": { + "primary": "sshd", + "secondary": "139.59.171.172", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 44295 + }, + "event": { + "type": "user_login", + "action": "logged-in", + "module": "auditd", + "category": "user-login" + }, + "user": { + "name_map": { + "uid": "root" + }, + "uid": "0", + "auid": "unset" + }, + "process": { + "pid": "31024", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "139.59.171.172" + }, + "network": { + "direction": "incoming" + }, + "beat": { + "hostname": "demo-stack-es-01", + "version": "7.0.0-alpha1", + "name": "demo-stack-es-01" + }, + "host": { + "name": "demo-stack-es-01" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "K9sJU2cBTFzn_XoLWMfm", + "source": { + "@timestamp": "2018-11-27T02:39:39.771Z", + "beat": { + "name": "demo-stack-es-01", + "hostname": "demo-stack-es-01", + "version": "7.0.0-alpha1" + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + }, + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + }, + "process": { + "pid": "31024", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "139.59.171.172" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "data": { + "terminal": "sshd", + "op": "login", + "acct": "(invalid user)" + }, + "summary": { + "object": { + "type": "user-session", + "primary": "sshd", + "secondary": "139.59.171.172" + }, + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + } + }, + "sequence": 44296, + "result": "fail", + "session": "unset" + }, + "host": { + "name": "demo-stack-es-01" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "LNsJU2cBTFzn_XoLWMfm", + "source": { + "@timestamp": "2018-11-27T02:39:39.863Z", + "event": { + "category": "user-login", + "type": "user_err", + "action": "error", + "module": "auditd" + }, + "user": { + "auid": "unset", + "uid": "0", + "name_map": { + "uid": "root" + } + }, + "process": { + "pid": "31024", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "139.59.171.172" + }, + "beat": { + "name": "demo-stack-es-01", + "hostname": "demo-stack-es-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-es-01" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "session": "unset", + "data": { + "hostname": "139.59.171.172", + "terminal": "ssh", + "op": "PAM:bad_ident" + }, + "summary": { + "object": { + "type": "user-session", + "primary": "ssh", + "secondary": "139.59.171.172" + }, + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "root" + } + }, + "sequence": 44297, + "result": "fail" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "HNsIU2cBTFzn_XoLc7MQ", + "source": { + "@timestamp": "2018-11-27T02:38:40.934Z", + "event": { + "action": "logged-in", + "module": "auditd", + "category": "user-login", + "type": "user_login" + }, + "user": { + "name_map": { + "uid": "root" + }, + "uid": "0", + "auid": "unset" + }, + "host": { + "name": "demo-stack-nginx-01" + }, + "beat": { + "name": "demo-stack-nginx-01", + "hostname": "demo-stack-nginx-01", + "version": "7.0.0-alpha1" + }, + "process": { + "exe": "/usr/sbin/sshd", + "pid": "1086" + }, + "source": { + "ip": "139.99.168.192" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "session": "unset", + "data": { + "acct": "(unknown user)", + "terminal": "sshd", + "op": "login" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + }, + "object": { + "primary": "sshd", + "secondary": "139.99.168.192", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 192628, + "result": "fail" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "HdsIU2cBTFzn_XoLc7MQ", + "source": { + "@timestamp": "2018-11-27T02:38:40.935Z", + "event": { + "type": "user_login", + "action": "logged-in", + "module": "auditd", + "category": "user-login" + }, + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + }, + "beat": { + "version": "7.0.0-alpha1", + "name": "demo-stack-nginx-01", + "hostname": "demo-stack-nginx-01" + }, + "host": { + "name": "demo-stack-nginx-01" + }, + "process": { + "pid": "1086", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "139.99.168.192" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "summary": { + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + }, + "object": { + "type": "user-session", + "primary": "sshd", + "secondary": "139.99.168.192" + } + }, + "sequence": 192629, + "result": "fail", + "session": "unset", + "data": { + "acct": "(invalid user)", + "terminal": "sshd", + "op": "login" + } + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "HtsIU2cBTFzn_XoLc7MQ", + "source": { + "@timestamp": "2018-11-27T02:38:41.215Z", + "network": { + "direction": "incoming" + }, + "beat": { + "hostname": "demo-stack-nginx-01", + "version": "7.0.0-alpha1", + "name": "demo-stack-nginx-01" + }, + "host": { + "name": "demo-stack-nginx-01" + }, + "auditd": { + "session": "unset", + "data": { + "hostname": "139.99.168.192", + "op": "PAM:bad_ident", + "terminal": "ssh" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "root" + }, + "object": { + "secondary": "139.99.168.192", + "type": "user-session", + "primary": "ssh" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 192630, + "result": "fail" + }, + "event": { + "category": "user-login", + "type": "user_err", + "action": "error", + "module": "auditd" + }, + "user": { + "name_map": { + "uid": "root" + }, + "uid": "0", + "auid": "unset" + }, + "process": { + "pid": "1086", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "139.99.168.192" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "nNsJU2cBTFzn_XoLTcVS", + "source": { + "@timestamp": "2018-11-27T02:39:36.808Z", + "user": { + "name_map": { + "uid": "root" + }, + "uid": "0", + "auid": "unset" + }, + "process": { + "pid": "1139", + "exe": "/usr/sbin/sshd" + }, + "beat": { + "name": "demo-stack-nginx-01", + "hostname": "demo-stack-nginx-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-nginx-01" + }, + "source": { + "ip": "52.60.179.151" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "summary": { + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + }, + "object": { + "primary": "sshd", + "secondary": "52.60.179.151", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 192637, + "result": "fail", + "session": "unset", + "data": { + "op": "login", + "terminal": "sshd", + "acct": "(unknown user)" + } + }, + "event": { + "action": "logged-in", + "module": "auditd", + "category": "user-login", + "type": "user_login" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "ndsJU2cBTFzn_XoLTcVS", + "source": { + "@timestamp": "2018-11-27T02:39:36.809Z", + "host": { + "name": "demo-stack-nginx-01" + }, + "auditd": { + "session": "unset", + "data": { + "terminal": "sshd", + "op": "login", + "acct": "(invalid user)" + }, + "summary": { + "how": "/usr/sbin/sshd", + "actor": { + "secondary": "(invalid user)", + "primary": "unset" + }, + "object": { + "primary": "sshd", + "secondary": "52.60.179.151", + "type": "user-session" + } + }, + "sequence": 192638, + "result": "fail" + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + }, + "user": { + "auid": "unset", + "uid": "0", + "name_map": { + "uid": "root" + } + }, + "process": { + "pid": "1139", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "52.60.179.151" + }, + "network": { + "direction": "incoming" + }, + "beat": { + "version": "7.0.0-alpha1", + "name": "demo-stack-nginx-01", + "hostname": "demo-stack-nginx-01" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "ntsJU2cBTFzn_XoLTcVS", + "source": { + "@timestamp": "2018-11-27T02:39:36.855Z", + "network": { + "direction": "incoming" + }, + "auditd": { + "data": { + "op": "PAM:bad_ident", + "terminal": "ssh", + "hostname": "52.60.179.151" + }, + "summary": { + "object": { + "secondary": "52.60.179.151", + "type": "user-session", + "primary": "ssh" + }, + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "root" + } + }, + "sequence": 192639, + "result": "fail", + "session": "unset" + }, + "event": { + "action": "error", + "module": "auditd", + "category": "user-login", + "type": "user_err" + }, + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + }, + "process": { + "pid": "1139", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "52.60.179.151" + }, + "beat": { + "name": "demo-stack-nginx-01", + "hostname": "demo-stack-nginx-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-nginx-01" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "sNsHU2cBTFzn_XoLr6LF", + "source": { + "@timestamp": "2018-11-27T02:37:50.939Z", + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "pid": "1076", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "37.187.114.136" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "result": "fail", + "session": "unset", + "data": { + "acct": "(unknown user)", + "terminal": "sshd", + "op": "login" + }, + "summary": { + "object": { + "primary": "sshd", + "secondary": "37.187.114.136", + "type": "user-session" + }, + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + } + }, + "sequence": 192622 + }, + "beat": { + "name": "demo-stack-nginx-01", + "hostname": "demo-stack-nginx-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-nginx-01" + }, + "event": { + "type": "user_login", + "action": "logged-in", + "module": "auditd", + "category": "user-login" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "sdsHU2cBTFzn_XoLr6LF", + "source": { + "@timestamp": "2018-11-27T02:37:50.940Z", + "auditd": { + "result": "fail", + "session": "unset", + "data": { + "op": "login", + "acct": "(invalid user)", + "terminal": "sshd" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + }, + "object": { + "secondary": "37.187.114.136", + "type": "user-session", + "primary": "sshd" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 192623 + }, + "event": { + "module": "auditd", + "category": "user-login", + "type": "user_login", + "action": "logged-in" + }, + "host": { + "name": "demo-stack-nginx-01" + }, + "beat": { + "name": "demo-stack-nginx-01", + "hostname": "demo-stack-nginx-01", + "version": "7.0.0-alpha1" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "pid": "1076", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "37.187.114.136" + }, + "network": { + "direction": "incoming" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "stsHU2cBTFzn_XoLr6LF", + "source": { + "@timestamp": "2018-11-27T02:37:51.046Z", + "auditd": { + "sequence": 192624, + "result": "fail", + "session": "unset", + "data": { + "terminal": "ssh", + "hostname": "37.187.114.136", + "op": "PAM:bad_ident" + }, + "summary": { + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "root" + }, + "object": { + "type": "user-session", + "primary": "ssh", + "secondary": "37.187.114.136" + } + } + }, + "event": { + "module": "auditd", + "category": "user-login", + "type": "user_err", + "action": "error" + }, + "user": { + "uid": "0", + "auid": "unset", + "name_map": { + "uid": "root" + } + }, + "process": { + "pid": "1076", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "37.187.114.136" + }, + "beat": { + "name": "demo-stack-nginx-01", + "hostname": "demo-stack-nginx-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-nginx-01" + }, + "network": { + "direction": "incoming" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "M9sIU2cBTFzn_XoLPq6w", + "source": { + "@timestamp": "2018-11-27T02:38:27.526Z", + "user": { + "auid": "unset", + "uid": "0", + "name_map": { + "uid": "root" + } + }, + "process": { + "pid": "1084", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "85.214.81.104" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "session": "unset", + "data": { + "op": "login", + "terminal": "sshd", + "acct": "(unknown user)" + }, + "summary": { + "actor": { + "secondary": "(unknown user)", + "primary": "unset" + }, + "object": { + "secondary": "85.214.81.104", + "type": "user-session", + "primary": "sshd" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 192625, + "result": "fail" + }, + "beat": { + "name": "demo-stack-nginx-01", + "hostname": "demo-stack-nginx-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-nginx-01" + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "NNsIU2cBTFzn_XoLPq6w", + "source": { + "@timestamp": "2018-11-27T02:38:27.527Z", + "auditd": { + "session": "unset", + "data": { + "op": "login", + "terminal": "sshd", + "acct": "(invalid user)" + }, + "summary": { + "how": "/usr/sbin/sshd", + "actor": { + "secondary": "(invalid user)", + "primary": "unset" + }, + "object": { + "type": "user-session", + "primary": "sshd", + "secondary": "85.214.81.104" + } + }, + "sequence": 192626, + "result": "fail" + }, + "host": { + "name": "demo-stack-nginx-01" + }, + "beat": { + "name": "demo-stack-nginx-01", + "hostname": "demo-stack-nginx-01", + "version": "7.0.0-alpha1" + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "pid": "1084", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "85.214.81.104" + }, + "network": { + "direction": "incoming" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "NdsIU2cBTFzn_XoLPq6w", + "source": { + "@timestamp": "2018-11-27T02:38:27.644Z", + "event": { + "type": "user_err", + "action": "error", + "module": "auditd", + "category": "user-login" + }, + "user": { + "uid": "0", + "auid": "unset", + "name_map": { + "uid": "root" + } + }, + "process": { + "exe": "/usr/sbin/sshd", + "pid": "1084" + }, + "source": { + "ip": "85.214.81.104" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "session": "unset", + "data": { + "hostname": "85.214.81.104", + "terminal": "ssh", + "op": "PAM:bad_ident" + }, + "summary": { + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "root" + }, + "object": { + "secondary": "85.214.81.104", + "type": "user-session", + "primary": "ssh" + } + }, + "sequence": 192627, + "result": "fail" + }, + "beat": { + "name": "demo-stack-nginx-01", + "hostname": "demo-stack-nginx-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-nginx-01" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "N9sJU2cBTFzn_XoLm8zp", + "source": { + "@timestamp": "2018-11-27T02:39:56.927Z", + "auditd": { + "data": { + "terminal": "sshd", + "op": "login", + "acct": "(unknown user)" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + }, + "object": { + "primary": "sshd", + "secondary": "13.66.193.177", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 186633, + "result": "fail", + "session": "unset" + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "host": { + "name": "demo-stack-redis-01" + }, + "beat": { + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1" + }, + "process": { + "pid": "32736", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "13.66.193.177" + }, + "network": { + "direction": "incoming" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "ONsJU2cBTFzn_XoLm8zp", + "source": { + "@timestamp": "2018-11-27T02:39:56.928Z", + "auditd": { + "data": { + "op": "login", + "terminal": "sshd", + "acct": "(invalid user)" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + }, + "object": { + "secondary": "13.66.193.177", + "type": "user-session", + "primary": "sshd" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 186634, + "result": "fail", + "session": "unset" + }, + "beat": { + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-redis-01" + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "pid": "32736", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "13.66.193.177" + }, + "network": { + "direction": "incoming" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "OdsJU2cBTFzn_XoLm8zp", + "source": { + "@timestamp": "2018-11-27T02:39:56.989Z", + "source": { + "ip": "13.66.193.177" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "sequence": 186635, + "result": "fail", + "session": "unset", + "data": { + "op": "PAM:bad_ident", + "terminal": "ssh", + "hostname": "13.66.193.177" + }, + "summary": { + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "root" + }, + "object": { + "type": "user-session", + "primary": "ssh", + "secondary": "13.66.193.177" + } + } + }, + "event": { + "category": "user-login", + "type": "user_err", + "action": "error", + "module": "auditd" + }, + "user": { + "name_map": { + "uid": "root" + }, + "auid": "unset", + "uid": "0" + }, + "host": { + "name": "demo-stack-redis-01" + }, + "beat": { + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1" + }, + "process": { + "pid": "32736", + "exe": "/usr/sbin/sshd" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "btsHU2cBTFzn_XoLaZwR", + "source": { + "@timestamp": "2018-11-27T02:37:32.833Z", + "source": { + "ip": "36.67.135.42" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "result": "fail", + "session": "unset", + "data": { + "terminal": "sshd", + "acct": "(unknown user)", + "op": "login" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + }, + "object": { + "secondary": "36.67.135.42", + "type": "user-session", + "primary": "sshd" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 44292 + }, + "beat": { + "name": "demo-stack-es-01", + "hostname": "demo-stack-es-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-es-01" + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + }, + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + }, + "process": { + "exe": "/usr/sbin/sshd", + "pid": "30958" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "b9sHU2cBTFzn_XoLaZwR", + "source": { + "@timestamp": "2018-11-27T02:37:32.837Z", + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + }, + "process": { + "exe": "/usr/sbin/sshd", + "pid": "30958" + }, + "source": { + "ip": "36.67.135.42" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "result": "fail", + "session": "unset", + "data": { + "acct": "(invalid user)", + "op": "login", + "terminal": "sshd" + }, + "summary": { + "actor": { + "secondary": "(invalid user)", + "primary": "unset" + }, + "object": { + "primary": "sshd", + "secondary": "36.67.135.42", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 44293 + }, + "beat": { + "name": "demo-stack-es-01", + "hostname": "demo-stack-es-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-es-01" + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "cNsHU2cBTFzn_XoLaZwR", + "source": { + "@timestamp": "2018-11-27T02:37:33.045Z", + "network": { + "direction": "incoming" + }, + "auditd": { + "sequence": 44294, + "result": "fail", + "session": "unset", + "data": { + "op": "PAM:bad_ident", + "hostname": "36.67.135.42", + "terminal": "ssh" + }, + "summary": { + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "root" + }, + "object": { + "primary": "ssh", + "secondary": "36.67.135.42", + "type": "user-session" + } + } + }, + "event": { + "module": "auditd", + "category": "user-login", + "type": "user_err", + "action": "error" + }, + "user": { + "name_map": { + "uid": "root" + }, + "uid": "0", + "auid": "unset" + }, + "process": { + "pid": "30958", + "exe": "/usr/sbin/sshd" + }, + "beat": { + "version": "7.0.0-alpha1", + "name": "demo-stack-es-01", + "hostname": "demo-stack-es-01" + }, + "host": { + "name": "demo-stack-es-01" + }, + "source": { + "ip": "36.67.135.42" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "XNsIU2cBTFzn_XoLwbmn", + "source": { + "@timestamp": "2018-11-27T02:39:01.052Z", + "auditd": { + "result": "success", + "session": "unset", + "data": { + "op": "PAM:accounting", + "acct": "root", + "terminal": "cron" + }, + "summary": { + "actor": { + "secondary": "root", + "primary": "unset" + }, + "object": { + "type": "user-session", + "primary": "cron" + }, + "how": "/usr/sbin/cron" + }, + "sequence": 184448 + }, + "beat": { + "name": "demo-stack-apache-01", + "hostname": "demo-stack-apache-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-apache-01" + }, + "event": { + "category": "user-login", + "type": "user_acct", + "action": "was-authorized", + "module": "auditd" + }, + "user": { + "name_map": { + "uid": "root" + }, + "uid": "0", + "auid": "unset" + }, + "process": { + "pid": "26360", + "exe": "/usr/sbin/cron" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "XdsIU2cBTFzn_XoLwbmn", + "source": { + "@timestamp": "2018-11-27T02:39:01.052Z", + "process": { + "pid": "26360", + "exe": "/usr/sbin/cron" + }, + "beat": { + "name": "demo-stack-apache-01", + "hostname": "demo-stack-apache-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-apache-01" + }, + "auditd": { + "session": "unset", + "data": { + "terminal": "cron", + "acct": "root", + "op": "PAM:setcred" + }, + "summary": { + "how": "/usr/sbin/cron", + "actor": { + "primary": "unset", + "secondary": "root" + }, + "object": { + "primary": "cron", + "type": "user-session" + } + }, + "sequence": 184449, + "result": "success" + }, + "event": { + "module": "auditd", + "category": "user-login", + "type": "cred_acq", + "action": "acquired-credentials" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "XtsIU2cBTFzn_XoLwbmn", + "source": { + "@timestamp": "2018-11-27T02:39:01.054Z", + "process": { + "pid": "26360", + "exe": "/usr/sbin/cron" + }, + "beat": { + "name": "demo-stack-apache-01", + "hostname": "demo-stack-apache-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-apache-01" + }, + "auditd": { + "data": { + "op": "PAM:session_open", + "terminal": "cron", + "acct": "root" + }, + "summary": { + "how": "/usr/sbin/cron", + "actor": { + "primary": "root", + "secondary": "root" + }, + "object": { + "primary": "cron", + "type": "user-session" + } + }, + "sequence": 184451, + "result": "success", + "session": "9862" + }, + "event": { + "type": "user_start", + "action": "started-session", + "module": "auditd", + "category": "user-login" + }, + "user": { + "uid": "0", + "name_map": { + "auid": "root", + "uid": "root" + }, + "auid": "0" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "X9sIU2cBTFzn_XoLwbmn", + "source": { + "@timestamp": "2018-11-27T02:39:01.154Z", + "event": { + "module": "auditd", + "category": "user-login", + "type": "cred_disp", + "action": "disposed-credentials" + }, + "user": { + "uid": "0", + "name_map": { + "auid": "root", + "uid": "root" + }, + "auid": "0" + }, + "process": { + "pid": "26360", + "exe": "/usr/sbin/cron" + }, + "auditd": { + "session": "9862", + "data": { + "acct": "root", + "terminal": "cron", + "op": "PAM:setcred" + }, + "summary": { + "actor": { + "primary": "root", + "secondary": "root" + }, + "object": { + "primary": "cron", + "type": "user-session" + }, + "how": "/usr/sbin/cron" + }, + "sequence": 184452, + "result": "success" + }, + "beat": { + "version": "7.0.0-alpha1", + "name": "demo-stack-apache-01", + "hostname": "demo-stack-apache-01" + }, + "host": { + "name": "demo-stack-apache-01" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "YNsIU2cBTFzn_XoLwbmn", + "source": { + "@timestamp": "2018-11-27T02:39:01.156Z", + "beat": { + "name": "demo-stack-apache-01", + "hostname": "demo-stack-apache-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-apache-01" + }, + "event": { + "module": "auditd", + "category": "user-login", + "type": "user_end", + "action": "ended-session" + }, + "user": { + "auid": "0", + "name_map": { + "uid": "root", + "auid": "root" + }, + "uid": "0" + }, + "process": { + "pid": "26360", + "exe": "/usr/sbin/cron" + }, + "auditd": { + "data": { + "acct": "root", + "op": "PAM:session_close", + "terminal": "cron" + }, + "summary": { + "how": "/usr/sbin/cron", + "actor": { + "primary": "root", + "secondary": "root" + }, + "object": { + "type": "user-session", + "primary": "cron" + } + }, + "sequence": 184453, + "result": "success", + "session": "9862" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "c9sIU2cBTFzn_XoLwrlb", + "source": { + "@timestamp": "2018-11-27T02:39:01.233Z", + "event": { + "module": "auditd", + "category": "user-login", + "type": "user_acct", + "action": "was-authorized" + }, + "user": { + "name_map": { + "uid": "root" + }, + "uid": "0", + "auid": "unset" + }, + "process": { + "pid": "1088", + "exe": "/usr/sbin/cron" + }, + "auditd": { + "sequence": 192631, + "result": "success", + "session": "unset", + "data": { + "terminal": "cron", + "op": "PAM:accounting", + "acct": "root" + }, + "summary": { + "how": "/usr/sbin/cron", + "actor": { + "primary": "unset", + "secondary": "root" + }, + "object": { + "primary": "cron", + "type": "user-session" + } + } + }, + "beat": { + "name": "demo-stack-nginx-01", + "hostname": "demo-stack-nginx-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-nginx-01" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "dNsIU2cBTFzn_XoLwrlb", + "source": { + "@timestamp": "2018-11-27T02:39:01.234Z", + "event": { + "type": "cred_acq", + "action": "acquired-credentials", + "module": "auditd", + "category": "user-login" + }, + "user": { + "auid": "unset", + "uid": "0", + "name_map": { + "uid": "root" + } + }, + "host": { + "name": "demo-stack-nginx-01" + }, + "beat": { + "name": "demo-stack-nginx-01", + "hostname": "demo-stack-nginx-01", + "version": "7.0.0-alpha1" + }, + "process": { + "pid": "1088", + "exe": "/usr/sbin/cron" + }, + "auditd": { + "sequence": 192632, + "result": "success", + "session": "unset", + "data": { + "acct": "root", + "terminal": "cron", + "op": "PAM:setcred" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "root" + }, + "object": { + "primary": "cron", + "type": "user-session" + }, + "how": "/usr/sbin/cron" + } + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "ddsIU2cBTFzn_XoLwrlb", + "source": { + "@timestamp": "2018-11-27T02:39:01.235Z", + "user": { + "auid": "0", + "uid": "0", + "name_map": { + "auid": "root", + "uid": "root" + } + }, + "beat": { + "name": "demo-stack-nginx-01", + "hostname": "demo-stack-nginx-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-nginx-01" + }, + "process": { + "pid": "1088", + "exe": "/usr/sbin/cron" + }, + "auditd": { + "session": "9866", + "data": { + "terminal": "cron", + "acct": "root", + "op": "PAM:session_open" + }, + "summary": { + "actor": { + "primary": "root", + "secondary": "root" + }, + "object": { + "primary": "cron", + "type": "user-session" + }, + "how": "/usr/sbin/cron" + }, + "sequence": 192634, + "result": "success" + }, + "event": { + "action": "started-session", + "module": "auditd", + "category": "user-login", + "type": "user_start" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "dtsIU2cBTFzn_XoLwrlb", + "source": { + "@timestamp": "2018-11-27T02:39:01.327Z", + "user": { + "auid": "0", + "uid": "0", + "name_map": { + "auid": "root", + "uid": "root" + } + }, + "process": { + "exe": "/usr/sbin/cron", + "pid": "1088" + }, + "auditd": { + "session": "9866", + "data": { + "op": "PAM:setcred", + "terminal": "cron", + "acct": "root" + }, + "summary": { + "object": { + "primary": "cron", + "type": "user-session" + }, + "how": "/usr/sbin/cron", + "actor": { + "primary": "root", + "secondary": "root" + } + }, + "sequence": 192635, + "result": "success" + }, + "beat": { + "name": "demo-stack-nginx-01", + "hostname": "demo-stack-nginx-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-nginx-01" + }, + "event": { + "category": "user-login", + "type": "cred_disp", + "action": "disposed-credentials", + "module": "auditd" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "d9sIU2cBTFzn_XoLwrlb", + "source": { + "@timestamp": "2018-11-27T02:39:01.327Z", + "host": { + "name": "demo-stack-nginx-01" + }, + "auditd": { + "session": "9866", + "data": { + "acct": "root", + "terminal": "cron", + "op": "PAM:session_close" + }, + "summary": { + "actor": { + "primary": "root", + "secondary": "root" + }, + "object": { + "primary": "cron", + "type": "user-session" + }, + "how": "/usr/sbin/cron" + }, + "sequence": 192636, + "result": "success" + }, + "event": { + "category": "user-login", + "type": "user_end", + "action": "ended-session", + "module": "auditd" + }, + "user": { + "auid": "0", + "name_map": { + "auid": "root", + "uid": "root" + }, + "uid": "0" + }, + "process": { + "pid": "1088", + "exe": "/usr/sbin/cron" + }, + "beat": { + "hostname": "demo-stack-nginx-01", + "version": "7.0.0-alpha1", + "name": "demo-stack-nginx-01" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "ndwMU2cBTFzn_XoLNAWN", + "source": { + "@timestamp": "2018-11-27T02:42:47.067Z", + "source": { + "ip": "107.170.76.170" + }, + "network": { + "direction": "incoming" + }, + "beat": { + "name": "demo-stack-mysql-01", + "hostname": "demo-stack-mysql-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-mysql-01" + }, + "auditd": { + "session": "unset", + "data": { + "acct": "(unknown user)", + "terminal": "sshd", + "op": "login" + }, + "summary": { + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + }, + "object": { + "secondary": "107.170.76.170", + "type": "user-session", + "primary": "sshd" + } + }, + "sequence": 43284, + "result": "fail" + }, + "event": { + "action": "logged-in", + "module": "auditd", + "category": "user-login", + "type": "user_login" + }, + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + }, + "process": { + "pid": "13197", + "exe": "/usr/sbin/sshd" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "ntwMU2cBTFzn_XoLNAWN", + "source": { + "@timestamp": "2018-11-27T02:42:47.071Z", + "event": { + "action": "logged-in", + "module": "auditd", + "category": "user-login", + "type": "user_login" + }, + "user": { + "uid": "0", + "auid": "unset", + "name_map": { + "uid": "root" + } + }, + "process": { + "pid": "13197", + "exe": "/usr/sbin/sshd" + }, + "beat": { + "name": "demo-stack-mysql-01", + "hostname": "demo-stack-mysql-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-mysql-01" + }, + "source": { + "ip": "107.170.76.170" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "session": "unset", + "data": { + "acct": "(invalid user)", + "terminal": "sshd", + "op": "login" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + }, + "object": { + "primary": "sshd", + "secondary": "107.170.76.170", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 43285, + "result": "fail" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "n9wMU2cBTFzn_XoLNAWN", + "source": { + "@timestamp": "2018-11-27T02:42:47.107Z", + "auditd": { + "data": { + "op": "PAM:bad_ident", + "hostname": "107.170.76.170", + "terminal": "ssh" + }, + "summary": { + "actor": { + "secondary": "root", + "primary": "unset" + }, + "object": { + "secondary": "107.170.76.170", + "type": "user-session", + "primary": "ssh" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 43286, + "result": "fail", + "session": "unset" + }, + "event": { + "category": "user-login", + "type": "user_err", + "action": "error", + "module": "auditd" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "exe": "/usr/sbin/sshd", + "pid": "13197" + }, + "source": { + "ip": "107.170.76.170" + }, + "network": { + "direction": "incoming" + }, + "beat": { + "name": "demo-stack-mysql-01", + "hostname": "demo-stack-mysql-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-mysql-01" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "8NwMU2cBTFzn_XoLOwZZ", + "source": { + "@timestamp": "2018-11-27T02:42:48.812Z", + "event": { + "category": "configuration", + "type": "netfilter_cfg", + "action": "loaded-firewall-rule-to", + "module": "auditd" + }, + "beat": { + "name": "demo-stack-mysql-01", + "hostname": "demo-stack-mysql-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-mysql-01" + }, + "user": { + "sgid": "0", + "name_map": { + "egid": "root", + "euid": "root", + "fsgid": "root", + "fsuid": "root", + "gid": "root", + "sgid": "root", + "suid": "root", + "uid": "root" + }, + "gid": "0", + "suid": "0", + "fsuid": "0", + "egid": "0", + "uid": "0", + "auid": "unset", + "euid": "0", + "fsgid": "0" + }, + "process": { + "exe": "/sbin/xtables-multi", + "pid": "13199", + "ppid": "1379", + "title": "/sbin/iptables -w -D sshguard -s 147.135.208.7 -j DROP", + "name": "iptables" + }, + "auditd": { + "data": { + "table": "filter", + "tty": "(none)", + "family": "2", + "a1": "0", + "exit": "0", + "a3": "1666870", + "syscall": "setsockopt", + "a2": "40", + "arch": "x86_64", + "a0": "5", + "entries": "155" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "root" + }, + "object": { + "type": "firewall", + "primary": "filter" + }, + "how": "/sbin/xtables-multi" + }, + "sequence": 43287, + "result": "success", + "session": "unset" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "WdwMU2cBTFzn_XoLRgdH", + "source": { + "@timestamp": "2018-11-27T02:42:51.613Z", + "auditd": { + "result": "fail", + "session": "unset", + "data": { + "terminal": "sshd", + "op": "login", + "acct": "(unknown user)" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + }, + "object": { + "secondary": "84.19.176.196", + "type": "user-session", + "primary": "sshd" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 184460 + }, + "host": { + "name": "demo-stack-apache-01" + }, + "beat": { + "hostname": "demo-stack-apache-01", + "version": "7.0.0-alpha1", + "name": "demo-stack-apache-01" + }, + "event": { + "module": "auditd", + "category": "user-login", + "type": "user_login", + "action": "logged-in" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "pid": "26436", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "84.19.176.196" + }, + "network": { + "direction": "incoming" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "WtwMU2cBTFzn_XoLRgdH", + "source": { + "@timestamp": "2018-11-27T02:42:51.614Z", + "beat": { + "name": "demo-stack-apache-01", + "hostname": "demo-stack-apache-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-apache-01" + }, + "event": { + "action": "logged-in", + "module": "auditd", + "category": "user-login", + "type": "user_login" + }, + "user": { + "name_map": { + "uid": "root" + }, + "auid": "unset", + "uid": "0" + }, + "process": { + "pid": "26436", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "84.19.176.196" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "sequence": 184461, + "result": "fail", + "session": "unset", + "data": { + "acct": "(invalid user)", + "op": "login", + "terminal": "sshd" + }, + "summary": { + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + }, + "object": { + "primary": "sshd", + "secondary": "84.19.176.196", + "type": "user-session" + } + } + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "W9wMU2cBTFzn_XoLRgdH", + "source": { + "@timestamp": "2018-11-27T02:42:51.728Z", + "auditd": { + "summary": { + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "root" + }, + "object": { + "type": "user-session", + "primary": "ssh", + "secondary": "84.19.176.196" + } + }, + "sequence": 184462, + "result": "fail", + "session": "unset", + "data": { + "terminal": "ssh", + "op": "PAM:bad_ident", + "hostname": "84.19.176.196" + } + }, + "event": { + "category": "user-login", + "type": "user_err", + "action": "error", + "module": "auditd" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "beat": { + "name": "demo-stack-apache-01", + "hostname": "demo-stack-apache-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-apache-01" + }, + "process": { + "pid": "26436", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "84.19.176.196" + }, + "network": { + "direction": "incoming" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "rdwMU2cBTFzn_XoLSQex", + "source": { + "@timestamp": "2018-11-27T02:42:52.477Z", + "process": { + "pid": "20119", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "58.97.13.206" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "data": { + "op": "login", + "acct": "(unknown user)", + "terminal": "sshd" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + }, + "object": { + "type": "user-session", + "primary": "sshd", + "secondary": "58.97.13.206" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 142443, + "result": "fail", + "session": "unset" + }, + "event": { + "module": "auditd", + "category": "user-login", + "type": "user_login", + "action": "logged-in" + }, + "beat": { + "name": "demo-stack-haproxy-01", + "hostname": "demo-stack-haproxy-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-haproxy-01" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "rtwMU2cBTFzn_XoLSQex", + "source": { + "@timestamp": "2018-11-27T02:42:52.479Z", + "beat": { + "name": "demo-stack-haproxy-01", + "hostname": "demo-stack-haproxy-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-haproxy-01" + }, + "event": { + "module": "auditd", + "category": "user-login", + "type": "user_login", + "action": "logged-in" + }, + "user": { + "uid": "0", + "auid": "unset", + "name_map": { + "uid": "root" + } + }, + "process": { + "pid": "20119", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "58.97.13.206" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "data": { + "terminal": "sshd", + "op": "login", + "acct": "(invalid user)" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + }, + "object": { + "primary": "sshd", + "secondary": "58.97.13.206", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 142444, + "result": "fail", + "session": "unset" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "r9wMU2cBTFzn_XoLSQex", + "source": { + "@timestamp": "2018-11-27T02:42:52.702Z", + "auditd": { + "data": { + "op": "PAM:bad_ident", + "hostname": "58.97.13.206", + "terminal": "ssh" + }, + "summary": { + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "root" + }, + "object": { + "primary": "ssh", + "secondary": "58.97.13.206", + "type": "user-session" + } + }, + "sequence": 142445, + "result": "fail", + "session": "unset" + }, + "beat": { + "version": "7.0.0-alpha1", + "name": "demo-stack-haproxy-01", + "hostname": "demo-stack-haproxy-01" + }, + "host": { + "name": "demo-stack-haproxy-01" + }, + "event": { + "action": "error", + "module": "auditd", + "category": "user-login", + "type": "user_err" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "pid": "20119", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "58.97.13.206" + }, + "network": { + "direction": "incoming" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "qdwMU2cBTFzn_XoLVwgF", + "source": { + "@timestamp": "2018-11-27T02:42:55.899Z", + "network": { + "direction": "incoming" + }, + "auditd": { + "result": "fail", + "session": "unset", + "data": { + "terminal": "sshd", + "acct": "(unknown user)", + "op": "login" + }, + "summary": { + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + }, + "object": { + "secondary": "45.55.239.241", + "type": "user-session", + "primary": "sshd" + } + }, + "sequence": 142446 + }, + "event": { + "type": "user_login", + "action": "logged-in", + "module": "auditd", + "category": "user-login" + }, + "beat": { + "version": "7.0.0-alpha1", + "name": "demo-stack-haproxy-01", + "hostname": "demo-stack-haproxy-01" + }, + "host": { + "name": "demo-stack-haproxy-01" + }, + "user": { + "name_map": { + "uid": "root" + }, + "auid": "unset", + "uid": "0" + }, + "process": { + "pid": "20121", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "45.55.239.241" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "qtwMU2cBTFzn_XoLVwgF", + "source": { + "@timestamp": "2018-11-27T02:42:55.899Z", + "host": { + "name": "demo-stack-haproxy-01" + }, + "user": { + "name_map": { + "uid": "root" + }, + "auid": "unset", + "uid": "0" + }, + "process": { + "pid": "20121", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "45.55.239.241" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "result": "fail", + "session": "unset", + "data": { + "op": "login", + "acct": "(invalid user)", + "terminal": "sshd" + }, + "summary": { + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + }, + "object": { + "secondary": "45.55.239.241", + "type": "user-session", + "primary": "sshd" + } + }, + "sequence": 142447 + }, + "event": { + "module": "auditd", + "category": "user-login", + "type": "user_login", + "action": "logged-in" + }, + "beat": { + "version": "7.0.0-alpha1", + "name": "demo-stack-haproxy-01", + "hostname": "demo-stack-haproxy-01" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "q9wMU2cBTFzn_XoLVwgF", + "source": { + "@timestamp": "2018-11-27T02:42:55.930Z", + "source": { + "ip": "45.55.239.241" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "session": "unset", + "data": { + "op": "PAM:bad_ident", + "terminal": "ssh", + "hostname": "45.55.239.241" + }, + "summary": { + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "root" + }, + "object": { + "primary": "ssh", + "secondary": "45.55.239.241", + "type": "user-session" + } + }, + "sequence": 142448, + "result": "fail" + }, + "event": { + "category": "user-login", + "type": "user_err", + "action": "error", + "module": "auditd" + }, + "user": { + "name_map": { + "uid": "root" + }, + "auid": "unset", + "uid": "0" + }, + "beat": { + "name": "demo-stack-haproxy-01", + "hostname": "demo-stack-haproxy-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-haproxy-01" + }, + "process": { + "exe": "/usr/sbin/sshd", + "pid": "20121" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "JdsLU2cBTFzn_XoLffYn", + "source": { + "@timestamp": "2018-11-27T02:42:00.124Z", + "host": { + "name": "demo-stack-apache-01" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "summary": { + "actor": { + "secondary": "(unknown user)", + "primary": "unset" + }, + "object": { + "primary": "sshd", + "secondary": "104.131.124.166", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 184457, + "result": "fail", + "session": "unset", + "data": { + "acct": "(unknown user)", + "terminal": "sshd", + "op": "login" + } + }, + "event": { + "module": "auditd", + "category": "user-login", + "type": "user_login", + "action": "logged-in" + }, + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + }, + "process": { + "pid": "26431", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "104.131.124.166" + }, + "beat": { + "name": "demo-stack-apache-01", + "hostname": "demo-stack-apache-01", + "version": "7.0.0-alpha1" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "JtsLU2cBTFzn_XoLffYn", + "source": { + "@timestamp": "2018-11-27T02:42:00.125Z", + "process": { + "pid": "26431", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "104.131.124.166" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "sequence": 184458, + "result": "fail", + "session": "unset", + "data": { + "acct": "(invalid user)", + "terminal": "sshd", + "op": "login" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + }, + "object": { + "primary": "sshd", + "secondary": "104.131.124.166", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + } + }, + "host": { + "name": "demo-stack-apache-01" + }, + "beat": { + "name": "demo-stack-apache-01", + "hostname": "demo-stack-apache-01", + "version": "7.0.0-alpha1" + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "J9sLU2cBTFzn_XoLffYn", + "source": { + "@timestamp": "2018-11-27T02:42:00.158Z", + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + }, + "beat": { + "name": "demo-stack-apache-01", + "hostname": "demo-stack-apache-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-apache-01" + }, + "process": { + "exe": "/usr/sbin/sshd", + "pid": "26431" + }, + "source": { + "ip": "104.131.124.166" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "sequence": 184459, + "result": "fail", + "session": "unset", + "data": { + "op": "PAM:bad_ident", + "hostname": "104.131.124.166", + "terminal": "ssh" + }, + "summary": { + "object": { + "secondary": "104.131.124.166", + "type": "user-session", + "primary": "ssh" + }, + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "root" + } + } + }, + "event": { + "type": "user_err", + "action": "error", + "module": "auditd", + "category": "user-login" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "CNwMU2cBTFzn_XoLDAJ2", + "source": { + "@timestamp": "2018-11-27T02:42:36.811Z", + "beat": { + "name": "demo-stack-haproxy-01", + "hostname": "demo-stack-haproxy-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-haproxy-01" + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + }, + "user": { + "name_map": { + "uid": "root" + }, + "uid": "0", + "auid": "unset" + }, + "process": { + "pid": "20117", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "202.28.34.200" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "data": { + "terminal": "sshd", + "acct": "(unknown user)", + "op": "login" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + }, + "object": { + "type": "user-session", + "primary": "sshd", + "secondary": "202.28.34.200" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 142440, + "result": "fail", + "session": "unset" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "CdwMU2cBTFzn_XoLDAJ2", + "source": { + "@timestamp": "2018-11-27T02:42:36.812Z", + "user": { + "name_map": { + "uid": "root" + }, + "uid": "0", + "auid": "unset" + }, + "process": { + "pid": "20117", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "202.28.34.200" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "result": "fail", + "session": "unset", + "data": { + "terminal": "sshd", + "op": "login", + "acct": "(invalid user)" + }, + "summary": { + "how": "/usr/sbin/sshd", + "actor": { + "secondary": "(invalid user)", + "primary": "unset" + }, + "object": { + "secondary": "202.28.34.200", + "type": "user-session", + "primary": "sshd" + } + }, + "sequence": 142441 + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + }, + "beat": { + "name": "demo-stack-haproxy-01", + "hostname": "demo-stack-haproxy-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-haproxy-01" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "CtwMU2cBTFzn_XoLDAJ2", + "source": { + "@timestamp": "2018-11-27T02:42:37.043Z", + "host": { + "name": "demo-stack-haproxy-01" + }, + "event": { + "module": "auditd", + "category": "user-login", + "type": "user_err", + "action": "error" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "pid": "20117", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "202.28.34.200" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "summary": { + "actor": { + "secondary": "root", + "primary": "unset" + }, + "object": { + "primary": "ssh", + "secondary": "202.28.34.200", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 142442, + "result": "fail", + "session": "unset", + "data": { + "terminal": "ssh", + "hostname": "202.28.34.200", + "op": "PAM:bad_ident" + } + }, + "beat": { + "name": "demo-stack-haproxy-01", + "hostname": "demo-stack-haproxy-01", + "version": "7.0.0-alpha1" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "QtwMU2cBTFzn_XoLKwWd", + "source": { + "@timestamp": "2018-11-27T02:42:44.787Z", + "source": { + "ip": "103.249.205.78" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "sequence": 186639, + "result": "fail", + "session": "unset", + "data": { + "terminal": "sshd", + "op": "login", + "acct": "(unknown user)" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + }, + "object": { + "type": "user-session", + "primary": "sshd", + "secondary": "103.249.205.78" + }, + "how": "/usr/sbin/sshd" + } + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "exe": "/usr/sbin/sshd", + "pid": "32752" + }, + "host": { + "name": "demo-stack-redis-01" + }, + "beat": { + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "Q9wMU2cBTFzn_XoLKwWd", + "source": { + "@timestamp": "2018-11-27T02:42:44.788Z", + "source": { + "ip": "103.249.205.78" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "result": "fail", + "session": "unset", + "data": { + "acct": "(invalid user)", + "op": "login", + "terminal": "sshd" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + }, + "object": { + "secondary": "103.249.205.78", + "type": "user-session", + "primary": "sshd" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 186640 + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + }, + "beat": { + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-redis-01" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "pid": "32752", + "exe": "/usr/sbin/sshd" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "RNwMU2cBTFzn_XoLKwWd", + "source": { + "@timestamp": "2018-11-27T02:42:45.017Z", + "auditd": { + "summary": { + "actor": { + "secondary": "root", + "primary": "unset" + }, + "object": { + "primary": "ssh", + "secondary": "103.249.205.78", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 186641, + "result": "fail", + "session": "unset", + "data": { + "terminal": "ssh", + "op": "PAM:bad_ident", + "hostname": "103.249.205.78" + } + }, + "event": { + "category": "user-login", + "type": "user_err", + "action": "error", + "module": "auditd" + }, + "user": { + "auid": "unset", + "uid": "0", + "name_map": { + "uid": "root" + } + }, + "process": { + "pid": "32752", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "103.249.205.78" + }, + "network": { + "direction": "incoming" + }, + "beat": { + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-redis-01" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "btsKU2cBTFzn_XoL6ul0", + "source": { + "@timestamp": "2018-11-27T02:41:22.569Z", + "process": { + "exe": "/usr/sbin/sshd", + "pid": "1149" + }, + "source": { + "ip": "149.56.15.98" + }, + "beat": { + "name": "demo-stack-nginx-01", + "hostname": "demo-stack-nginx-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-nginx-01" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "summary": { + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + }, + "object": { + "secondary": "149.56.15.98", + "type": "user-session", + "primary": "sshd" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 192643, + "result": "fail", + "session": "unset", + "data": { + "terminal": "sshd", + "op": "login", + "acct": "(unknown user)" + } + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + }, + "user": { + "name_map": { + "uid": "root" + }, + "uid": "0", + "auid": "unset" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "b9sKU2cBTFzn_XoL6ul0", + "source": { + "@timestamp": "2018-11-27T02:41:22.571Z", + "source": { + "ip": "149.56.15.98" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "sequence": 192644, + "result": "fail", + "session": "unset", + "data": { + "acct": "(invalid user)", + "op": "login", + "terminal": "sshd" + }, + "summary": { + "object": { + "secondary": "149.56.15.98", + "type": "user-session", + "primary": "sshd" + }, + "how": "/usr/sbin/sshd", + "actor": { + "secondary": "(invalid user)", + "primary": "unset" + } + } + }, + "event": { + "module": "auditd", + "category": "user-login", + "type": "user_login", + "action": "logged-in" + }, + "user": { + "auid": "unset", + "uid": "0", + "name_map": { + "uid": "root" + } + }, + "beat": { + "name": "demo-stack-nginx-01", + "hostname": "demo-stack-nginx-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-nginx-01" + }, + "process": { + "pid": "1149", + "exe": "/usr/sbin/sshd" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "cNsKU2cBTFzn_XoL6ul0", + "source": { + "@timestamp": "2018-11-27T02:41:22.613Z", + "source": { + "ip": "149.56.15.98" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "sequence": 192645, + "result": "fail", + "session": "unset", + "data": { + "terminal": "ssh", + "op": "PAM:bad_ident", + "hostname": "149.56.15.98" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "root" + }, + "object": { + "primary": "ssh", + "secondary": "149.56.15.98", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + } + }, + "event": { + "module": "auditd", + "category": "user-login", + "type": "user_err", + "action": "error" + }, + "user": { + "uid": "0", + "auid": "unset", + "name_map": { + "uid": "root" + } + }, + "beat": { + "version": "7.0.0-alpha1", + "name": "demo-stack-nginx-01", + "hostname": "demo-stack-nginx-01" + }, + "host": { + "name": "demo-stack-nginx-01" + }, + "process": { + "pid": "1149", + "exe": "/usr/sbin/sshd" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "99sKU2cBTFzn_XoLJtjT", + "source": { + "@timestamp": "2018-11-27T02:40:32.489Z", + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "beat": { + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-redis-01" + }, + "process": { + "exe": "/usr/sbin/sshd", + "pid": "32738" + }, + "source": { + "ip": "37.59.183.21" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "result": "fail", + "session": "unset", + "data": { + "terminal": "sshd", + "acct": "(unknown user)", + "op": "login" + }, + "summary": { + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + }, + "object": { + "primary": "sshd", + "secondary": "37.59.183.21", + "type": "user-session" + } + }, + "sequence": 186636 + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "-NsKU2cBTFzn_XoLJtjT", + "source": { + "@timestamp": "2018-11-27T02:40:32.490Z", + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + }, + "process": { + "pid": "32738", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "37.59.183.21" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "sequence": 186637, + "result": "fail", + "session": "unset", + "data": { + "acct": "(invalid user)", + "terminal": "sshd", + "op": "login" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + }, + "object": { + "type": "user-session", + "primary": "sshd", + "secondary": "37.59.183.21" + }, + "how": "/usr/sbin/sshd" + } + }, + "beat": { + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-redis-01" + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "-dsKU2cBTFzn_XoLJtjT", + "source": { + "@timestamp": "2018-11-27T02:40:32.600Z", + "auditd": { + "summary": { + "actor": { + "primary": "unset", + "secondary": "root" + }, + "object": { + "primary": "ssh", + "secondary": "37.59.183.21", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 186638, + "result": "fail", + "session": "unset", + "data": { + "terminal": "ssh", + "op": "PAM:bad_ident", + "hostname": "37.59.183.21" + } + }, + "beat": { + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-redis-01" + }, + "event": { + "category": "user-login", + "type": "user_err", + "action": "error", + "module": "auditd" + }, + "user": { + "uid": "0", + "auid": "unset", + "name_map": { + "uid": "root" + } + }, + "process": { + "pid": "32738", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "37.59.183.21" + }, + "network": { + "direction": "incoming" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "6dsKU2cBTFzn_XoLCtYx", + "source": { + "@timestamp": "2018-11-27T02:40:25.154Z", + "process": { + "pid": "31052", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "104.248.237.238" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "session": "unset", + "data": { + "acct": "(unknown user)", + "op": "login", + "terminal": "sshd" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + }, + "object": { + "type": "user-session", + "primary": "sshd", + "secondary": "104.248.237.238" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 44298, + "result": "fail" + }, + "event": { + "action": "logged-in", + "module": "auditd", + "category": "user-login", + "type": "user_login" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "beat": { + "name": "demo-stack-es-01", + "hostname": "demo-stack-es-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-es-01" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "6tsKU2cBTFzn_XoLCtYx", + "source": { + "@timestamp": "2018-11-27T02:40:25.158Z", + "host": { + "name": "demo-stack-es-01" + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + }, + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + }, + "process": { + "pid": "31052", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "104.248.237.238" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "data": { + "acct": "(invalid user)", + "op": "login", + "terminal": "sshd" + }, + "summary": { + "actor": { + "secondary": "(invalid user)", + "primary": "unset" + }, + "object": { + "primary": "sshd", + "secondary": "104.248.237.238", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 44299, + "result": "fail", + "session": "unset" + }, + "beat": { + "name": "demo-stack-es-01", + "hostname": "demo-stack-es-01", + "version": "7.0.0-alpha1" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "69sKU2cBTFzn_XoLCtYx", + "source": { + "@timestamp": "2018-11-27T02:40:25.190Z", + "user": { + "uid": "0", + "auid": "unset", + "name_map": { + "uid": "root" + } + }, + "process": { + "exe": "/usr/sbin/sshd", + "pid": "31052" + }, + "source": { + "ip": "104.248.237.238" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "summary": { + "actor": { + "primary": "unset", + "secondary": "root" + }, + "object": { + "type": "user-session", + "primary": "ssh", + "secondary": "104.248.237.238" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 44300, + "result": "fail", + "session": "unset", + "data": { + "op": "PAM:bad_ident", + "hostname": "104.248.237.238", + "terminal": "ssh" + } + }, + "beat": { + "hostname": "demo-stack-es-01", + "version": "7.0.0-alpha1", + "name": "demo-stack-es-01" + }, + "host": { + "name": "demo-stack-es-01" + }, + "event": { + "type": "user_err", + "action": "error", + "module": "auditd", + "category": "user-login" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "TtsKU2cBTFzn_XoLcN9z", + "source": { + "@timestamp": "2018-11-27T02:40:51.334Z", + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + }, + "process": { + "pid": "13183", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "191.255.248.91" + }, + "network": { + "direction": "incoming" + }, + "beat": { + "name": "demo-stack-mysql-01", + "hostname": "demo-stack-mysql-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-mysql-01" + }, + "auditd": { + "result": "fail", + "session": "unset", + "data": { + "op": "login", + "terminal": "sshd", + "acct": "(unknown user)" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + }, + "object": { + "type": "user-session", + "primary": "sshd", + "secondary": "191.255.248.91" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 43281 + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "T9sKU2cBTFzn_XoLcN9z", + "source": { + "@timestamp": "2018-11-27T02:40:51.334Z", + "network": { + "direction": "incoming" + }, + "auditd": { + "result": "fail", + "session": "unset", + "data": { + "acct": "(invalid user)", + "op": "login", + "terminal": "sshd" + }, + "summary": { + "object": { + "secondary": "191.255.248.91", + "type": "user-session", + "primary": "sshd" + }, + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + } + }, + "sequence": 43282 + }, + "beat": { + "hostname": "demo-stack-mysql-01", + "version": "7.0.0-alpha1", + "name": "demo-stack-mysql-01" + }, + "host": { + "name": "demo-stack-mysql-01" + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "exe": "/usr/sbin/sshd", + "pid": "13183" + }, + "source": { + "ip": "191.255.248.91" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "UNsKU2cBTFzn_XoLcN9z", + "source": { + "@timestamp": "2018-11-27T02:40:51.490Z", + "event": { + "module": "auditd", + "category": "user-login", + "type": "user_err", + "action": "error" + }, + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + }, + "process": { + "pid": "13183", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "191.255.248.91" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "sequence": 43283, + "result": "fail", + "session": "unset", + "data": { + "terminal": "ssh", + "op": "PAM:bad_ident", + "hostname": "191.255.248.91" + }, + "summary": { + "object": { + "secondary": "191.255.248.91", + "type": "user-session", + "primary": "ssh" + }, + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "root" + } + } + }, + "host": { + "name": "demo-stack-mysql-01" + }, + "beat": { + "hostname": "demo-stack-mysql-01", + "version": "7.0.0-alpha1", + "name": "demo-stack-mysql-01" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "O90YU2cBTFzn_XoLthfG", + "source": { + "@timestamp": "2018-11-27T02:56:26.843Z", + "auditd": { + "result": "fail", + "session": "unset", + "data": { + "acct": "(unknown user)", + "terminal": "sshd", + "op": "login" + }, + "summary": { + "actor": { + "secondary": "(unknown user)", + "primary": "unset" + }, + "object": { + "primary": "sshd", + "secondary": "212.46.209.158", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 192667 + }, + "beat": { + "name": "demo-stack-nginx-01", + "hostname": "demo-stack-nginx-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-nginx-01" + }, + "event": { + "type": "user_login", + "action": "logged-in", + "module": "auditd", + "category": "user-login" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "exe": "/usr/sbin/sshd", + "pid": "1253" + }, + "source": { + "ip": "212.46.209.158" + }, + "network": { + "direction": "incoming" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "PN0YU2cBTFzn_XoLthfG", + "source": { + "@timestamp": "2018-11-27T02:56:26.844Z", + "host": { + "name": "demo-stack-nginx-01" + }, + "auditd": { + "summary": { + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + }, + "object": { + "primary": "sshd", + "secondary": "212.46.209.158", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 192668, + "result": "fail", + "session": "unset", + "data": { + "terminal": "sshd", + "op": "login", + "acct": "(invalid user)" + } + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + }, + "user": { + "auid": "unset", + "uid": "0", + "name_map": { + "uid": "root" + } + }, + "process": { + "pid": "1253", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "212.46.209.158" + }, + "network": { + "direction": "incoming" + }, + "beat": { + "version": "7.0.0-alpha1", + "name": "demo-stack-nginx-01", + "hostname": "demo-stack-nginx-01" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "Pd0YU2cBTFzn_XoLthfG", + "source": { + "@timestamp": "2018-11-27T02:56:27.038Z", + "source": { + "ip": "212.46.209.158" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "summary": { + "actor": { + "secondary": "root", + "primary": "unset" + }, + "object": { + "primary": "ssh", + "secondary": "212.46.209.158", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 192669, + "result": "fail", + "session": "unset", + "data": { + "terminal": "ssh", + "op": "PAM:bad_ident", + "hostname": "212.46.209.158" + } + }, + "event": { + "category": "user-login", + "type": "user_err", + "action": "error", + "module": "auditd" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "beat": { + "name": "demo-stack-nginx-01", + "hostname": "demo-stack-nginx-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-nginx-01" + }, + "process": { + "exe": "/usr/sbin/sshd", + "pid": "1253" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "Wd0YU2cBTFzn_XoLuRey", + "source": { + "@timestamp": "2018-11-27T02:56:27.592Z", + "user": { + "name_map": { + "uid": "root" + }, + "auid": "unset", + "uid": "0" + }, + "process": { + "pid": "20207", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "212.89.171.146" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "data": { + "terminal": "sshd", + "op": "login", + "acct": "(unknown user)" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + }, + "object": { + "secondary": "212.89.171.146", + "type": "user-session", + "primary": "sshd" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 142463, + "result": "fail", + "session": "unset" + }, + "beat": { + "name": "demo-stack-haproxy-01", + "hostname": "demo-stack-haproxy-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-haproxy-01" + }, + "event": { + "type": "user_login", + "action": "logged-in", + "module": "auditd", + "category": "user-login" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "Wt0YU2cBTFzn_XoLuRey", + "source": { + "@timestamp": "2018-11-27T02:56:27.593Z", + "host": { + "name": "demo-stack-haproxy-01" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "result": "fail", + "session": "unset", + "data": { + "acct": "(invalid user)", + "terminal": "sshd", + "op": "login" + }, + "summary": { + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + }, + "object": { + "primary": "sshd", + "secondary": "212.89.171.146", + "type": "user-session" + } + }, + "sequence": 142464 + }, + "event": { + "type": "user_login", + "action": "logged-in", + "module": "auditd", + "category": "user-login" + }, + "user": { + "name_map": { + "uid": "root" + }, + "auid": "unset", + "uid": "0" + }, + "process": { + "pid": "20207", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "212.89.171.146" + }, + "beat": { + "name": "demo-stack-haproxy-01", + "hostname": "demo-stack-haproxy-01", + "version": "7.0.0-alpha1" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "W90YU2cBTFzn_XoLuRey", + "source": { + "@timestamp": "2018-11-27T02:56:27.731Z", + "beat": { + "name": "demo-stack-haproxy-01", + "hostname": "demo-stack-haproxy-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-haproxy-01" + }, + "event": { + "category": "user-login", + "type": "user_err", + "action": "error", + "module": "auditd" + }, + "user": { + "name_map": { + "uid": "root" + }, + "uid": "0", + "auid": "unset" + }, + "process": { + "exe": "/usr/sbin/sshd", + "pid": "20207" + }, + "source": { + "ip": "212.89.171.146" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "sequence": 142465, + "result": "fail", + "session": "unset", + "data": { + "op": "PAM:bad_ident", + "terminal": "ssh", + "hostname": "212.89.171.146" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "root" + }, + "object": { + "secondary": "212.89.171.146", + "type": "user-session", + "primary": "ssh" + }, + "how": "/usr/sbin/sshd" + } + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "UN0ZU2cBTFzn_XoLKSHH", + "source": { + "@timestamp": "2018-11-27T02:56:56.285Z", + "auditd": { + "sequence": 184490, + "result": "fail", + "session": "unset", + "data": { + "terminal": "sshd", + "op": "login", + "acct": "(unknown user)" + }, + "summary": { + "how": "/usr/sbin/sshd", + "actor": { + "secondary": "(unknown user)", + "primary": "unset" + }, + "object": { + "primary": "sshd", + "secondary": "193.70.85.206", + "type": "user-session" + } + } + }, + "event": { + "type": "user_login", + "action": "logged-in", + "module": "auditd", + "category": "user-login" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "pid": "26545", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "193.70.85.206" + }, + "network": { + "direction": "incoming" + }, + "beat": { + "name": "demo-stack-apache-01", + "hostname": "demo-stack-apache-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-apache-01" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "Ud0ZU2cBTFzn_XoLKSHH", + "source": { + "@timestamp": "2018-11-27T02:56:56.286Z", + "beat": { + "name": "demo-stack-apache-01", + "hostname": "demo-stack-apache-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-apache-01" + }, + "auditd": { + "session": "unset", + "data": { + "terminal": "sshd", + "acct": "(invalid user)", + "op": "login" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + }, + "object": { + "type": "user-session", + "primary": "sshd", + "secondary": "193.70.85.206" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 184491, + "result": "fail" + }, + "event": { + "action": "logged-in", + "module": "auditd", + "category": "user-login", + "type": "user_login" + }, + "user": { + "uid": "0", + "auid": "unset", + "name_map": { + "uid": "root" + } + }, + "process": { + "pid": "26545", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "193.70.85.206" + }, + "network": { + "direction": "incoming" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "Ut0ZU2cBTFzn_XoLKSHH", + "source": { + "@timestamp": "2018-11-27T02:56:56.392Z", + "event": { + "category": "user-login", + "type": "user_err", + "action": "error", + "module": "auditd" + }, + "user": { + "uid": "0", + "auid": "unset", + "name_map": { + "uid": "root" + } + }, + "process": { + "pid": "26545", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "193.70.85.206" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "sequence": 184492, + "result": "fail", + "session": "unset", + "data": { + "terminal": "ssh", + "hostname": "193.70.85.206", + "op": "PAM:bad_ident" + }, + "summary": { + "object": { + "secondary": "193.70.85.206", + "type": "user-session", + "primary": "ssh" + }, + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "root" + } + } + }, + "beat": { + "version": "7.0.0-alpha1", + "name": "demo-stack-apache-01", + "hostname": "demo-stack-apache-01" + }, + "host": { + "name": "demo-stack-apache-01" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "0t0ZU2cBTFzn_XoL6TKj", + "source": { + "@timestamp": "2018-11-27T02:57:45.401Z", + "host": { + "name": "demo-stack-apache-01" + }, + "process": { + "pid": "26553", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "89.36.221.229" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "data": { + "acct": "(unknown user)", + "op": "login", + "terminal": "sshd" + }, + "summary": { + "actor": { + "secondary": "(unknown user)", + "primary": "unset" + }, + "object": { + "primary": "sshd", + "secondary": "89.36.221.229", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 184493, + "result": "fail", + "session": "unset" + }, + "event": { + "type": "user_login", + "action": "logged-in", + "module": "auditd", + "category": "user-login" + }, + "user": { + "name_map": { + "uid": "root" + }, + "auid": "unset", + "uid": "0" + }, + "beat": { + "name": "demo-stack-apache-01", + "hostname": "demo-stack-apache-01", + "version": "7.0.0-alpha1" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "090ZU2cBTFzn_XoL6TKj", + "source": { + "@timestamp": "2018-11-27T02:57:45.402Z", + "auditd": { + "session": "unset", + "data": { + "acct": "(invalid user)", + "op": "login", + "terminal": "sshd" + }, + "summary": { + "object": { + "primary": "sshd", + "secondary": "89.36.221.229", + "type": "user-session" + }, + "how": "/usr/sbin/sshd", + "actor": { + "secondary": "(invalid user)", + "primary": "unset" + } + }, + "sequence": 184494, + "result": "fail" + }, + "beat": { + "name": "demo-stack-apache-01", + "hostname": "demo-stack-apache-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-apache-01" + }, + "event": { + "module": "auditd", + "category": "user-login", + "type": "user_login", + "action": "logged-in" + }, + "user": { + "auid": "unset", + "uid": "0", + "name_map": { + "uid": "root" + } + }, + "process": { + "pid": "26553", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "89.36.221.229" + }, + "network": { + "direction": "incoming" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "1N0ZU2cBTFzn_XoL6TKj", + "source": { + "@timestamp": "2018-11-27T02:57:45.502Z", + "host": { + "name": "demo-stack-apache-01" + }, + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + }, + "process": { + "pid": "26553", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "89.36.221.229" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "sequence": 184495, + "result": "fail", + "session": "unset", + "data": { + "op": "PAM:bad_ident", + "terminal": "ssh", + "hostname": "89.36.221.229" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "root" + }, + "object": { + "primary": "ssh", + "secondary": "89.36.221.229", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + } + }, + "event": { + "category": "user-login", + "type": "user_err", + "action": "error", + "module": "auditd" + }, + "beat": { + "hostname": "demo-stack-apache-01", + "version": "7.0.0-alpha1", + "name": "demo-stack-apache-01" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "f90YU2cBTFzn_XoL-B3u", + "source": { + "@timestamp": "2018-11-27T02:56:43.779Z", + "beat": { + "name": "demo-stack-apache-01", + "hostname": "demo-stack-apache-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-apache-01" + }, + "event": { + "module": "auditd", + "category": "user-login", + "type": "user_login", + "action": "logged-in" + }, + "user": { + "auid": "unset", + "uid": "0", + "name_map": { + "uid": "root" + } + }, + "process": { + "pid": "26542", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "138.68.111.27" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "data": { + "op": "login", + "acct": "(unknown user)", + "terminal": "sshd" + }, + "summary": { + "how": "/usr/sbin/sshd", + "actor": { + "secondary": "(unknown user)", + "primary": "unset" + }, + "object": { + "primary": "sshd", + "secondary": "138.68.111.27", + "type": "user-session" + } + }, + "sequence": 184487, + "result": "fail", + "session": "unset" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "gN0YU2cBTFzn_XoL-B3u", + "source": { + "@timestamp": "2018-11-27T02:56:43.781Z", + "auditd": { + "sequence": 184488, + "result": "fail", + "session": "unset", + "data": { + "terminal": "sshd", + "op": "login", + "acct": "(invalid user)" + }, + "summary": { + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + }, + "object": { + "primary": "sshd", + "secondary": "138.68.111.27", + "type": "user-session" + } + } + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + }, + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + }, + "process": { + "pid": "26542", + "exe": "/usr/sbin/sshd" + }, + "beat": { + "name": "demo-stack-apache-01", + "hostname": "demo-stack-apache-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-apache-01" + }, + "source": { + "ip": "138.68.111.27" + }, + "network": { + "direction": "incoming" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "gd0YU2cBTFzn_XoL-B3u", + "source": { + "@timestamp": "2018-11-27T02:56:43.889Z", + "network": { + "direction": "incoming" + }, + "auditd": { + "sequence": 184489, + "result": "fail", + "session": "unset", + "data": { + "hostname": "138.68.111.27", + "terminal": "ssh", + "op": "PAM:bad_ident" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "root" + }, + "object": { + "primary": "ssh", + "secondary": "138.68.111.27", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + } + }, + "beat": { + "name": "demo-stack-apache-01", + "hostname": "demo-stack-apache-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-apache-01" + }, + "event": { + "type": "user_err", + "action": "error", + "module": "auditd", + "category": "user-login" + }, + "user": { + "auid": "unset", + "uid": "0", + "name_map": { + "uid": "root" + } + }, + "process": { + "pid": "26542", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "138.68.111.27" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "YN0ZU2cBTFzn_XoLMCE9", + "source": { + "@timestamp": "2018-11-27T02:56:57.939Z", + "auditd": { + "data": { + "acct": "(unknown user)", + "terminal": "sshd", + "op": "login" + }, + "summary": { + "actor": { + "secondary": "(unknown user)", + "primary": "unset" + }, + "object": { + "primary": "sshd", + "secondary": "5.39.77.167", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 192670, + "result": "fail", + "session": "unset" + }, + "host": { + "name": "demo-stack-nginx-01" + }, + "beat": { + "name": "demo-stack-nginx-01", + "hostname": "demo-stack-nginx-01", + "version": "7.0.0-alpha1" + }, + "event": { + "type": "user_login", + "action": "logged-in", + "module": "auditd", + "category": "user-login" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "exe": "/usr/sbin/sshd", + "pid": "1261" + }, + "source": { + "ip": "5.39.77.167" + }, + "network": { + "direction": "incoming" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "Yd0ZU2cBTFzn_XoLMCE9", + "source": { + "@timestamp": "2018-11-27T02:56:57.940Z", + "beat": { + "name": "demo-stack-nginx-01", + "hostname": "demo-stack-nginx-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-nginx-01" + }, + "auditd": { + "data": { + "terminal": "sshd", + "op": "login", + "acct": "(invalid user)" + }, + "summary": { + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + }, + "object": { + "secondary": "5.39.77.167", + "type": "user-session", + "primary": "sshd" + } + }, + "sequence": 192671, + "result": "fail", + "session": "unset" + }, + "event": { + "module": "auditd", + "category": "user-login", + "type": "user_login", + "action": "logged-in" + }, + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + }, + "process": { + "exe": "/usr/sbin/sshd", + "pid": "1261" + }, + "source": { + "ip": "5.39.77.167" + }, + "network": { + "direction": "incoming" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "Yt0ZU2cBTFzn_XoLMCE9", + "source": { + "@timestamp": "2018-11-27T02:56:58.047Z", + "network": { + "direction": "incoming" + }, + "auditd": { + "sequence": 192672, + "result": "fail", + "session": "unset", + "data": { + "op": "PAM:bad_ident", + "hostname": "5.39.77.167", + "terminal": "ssh" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "root" + }, + "object": { + "primary": "ssh", + "secondary": "5.39.77.167", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + } + }, + "event": { + "category": "user-login", + "type": "user_err", + "action": "error", + "module": "auditd" + }, + "beat": { + "hostname": "demo-stack-nginx-01", + "version": "7.0.0-alpha1", + "name": "demo-stack-nginx-01" + }, + "host": { + "name": "demo-stack-nginx-01" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "pid": "1261", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "5.39.77.167" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "yN0YU2cBTFzn_XoLnBVF", + "source": { + "@timestamp": "2018-11-27T02:56:20.058Z", + "source": { + "ip": "189.16.195.18" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "result": "fail", + "session": "unset", + "data": { + "op": "login", + "terminal": "sshd", + "acct": "(unknown user)" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + }, + "object": { + "type": "user-session", + "primary": "sshd", + "secondary": "189.16.195.18" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 192664 + }, + "event": { + "module": "auditd", + "category": "user-login", + "type": "user_login", + "action": "logged-in" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "beat": { + "name": "demo-stack-nginx-01", + "hostname": "demo-stack-nginx-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-nginx-01" + }, + "process": { + "pid": "1251", + "exe": "/usr/sbin/sshd" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "yd0YU2cBTFzn_XoLnBVF", + "source": { + "@timestamp": "2018-11-27T02:56:20.060Z", + "process": { + "pid": "1251", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "189.16.195.18" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "summary": { + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + }, + "object": { + "primary": "sshd", + "secondary": "189.16.195.18", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 192665, + "result": "fail", + "session": "unset", + "data": { + "op": "login", + "terminal": "sshd", + "acct": "(invalid user)" + } + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + }, + "beat": { + "name": "demo-stack-nginx-01", + "hostname": "demo-stack-nginx-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-nginx-01" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "yt0YU2cBTFzn_XoLnBVF", + "source": { + "@timestamp": "2018-11-27T02:56:20.223Z", + "event": { + "action": "error", + "module": "auditd", + "category": "user-login", + "type": "user_err" + }, + "user": { + "name_map": { + "uid": "root" + }, + "uid": "0", + "auid": "unset" + }, + "process": { + "exe": "/usr/sbin/sshd", + "pid": "1251" + }, + "source": { + "ip": "189.16.195.18" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "sequence": 192666, + "result": "fail", + "session": "unset", + "data": { + "hostname": "189.16.195.18", + "terminal": "ssh", + "op": "PAM:bad_ident" + }, + "summary": { + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "root" + }, + "object": { + "primary": "ssh", + "secondary": "189.16.195.18", + "type": "user-session" + } + } + }, + "beat": { + "name": "demo-stack-nginx-01", + "hostname": "demo-stack-nginx-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-nginx-01" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "ld0YU2cBTFzn_XoL6hym", + "source": { + "@timestamp": "2018-11-27T02:56:40.122Z", + "network": { + "direction": "incoming" + }, + "auditd": { + "data": { + "terminal": "sshd", + "acct": "(unknown user)", + "op": "login" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + }, + "object": { + "primary": "sshd", + "secondary": "157.100.133.21", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 43303, + "result": "fail", + "session": "unset" + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + }, + "beat": { + "name": "demo-stack-mysql-01", + "hostname": "demo-stack-mysql-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-mysql-01" + }, + "user": { + "auid": "unset", + "uid": "0", + "name_map": { + "uid": "root" + } + }, + "process": { + "pid": "13281", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "157.100.133.21" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "lt0YU2cBTFzn_XoL6hym", + "source": { + "@timestamp": "2018-11-27T02:56:40.122Z", + "event": { + "type": "user_login", + "action": "logged-in", + "module": "auditd", + "category": "user-login" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "pid": "13281", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "157.100.133.21" + }, + "beat": { + "name": "demo-stack-mysql-01", + "hostname": "demo-stack-mysql-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-mysql-01" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "summary": { + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + }, + "object": { + "primary": "sshd", + "secondary": "157.100.133.21", + "type": "user-session" + } + }, + "sequence": 43304, + "result": "fail", + "session": "unset", + "data": { + "acct": "(invalid user)", + "terminal": "sshd", + "op": "login" + } + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "l90YU2cBTFzn_XoL6hym", + "source": { + "@timestamp": "2018-11-27T02:56:40.242Z", + "network": { + "direction": "incoming" + }, + "auditd": { + "summary": { + "actor": { + "primary": "unset", + "secondary": "root" + }, + "object": { + "primary": "ssh", + "secondary": "157.100.133.21", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 43305, + "result": "fail", + "session": "unset", + "data": { + "terminal": "ssh", + "op": "PAM:bad_ident", + "hostname": "157.100.133.21" + } + }, + "event": { + "action": "error", + "module": "auditd", + "category": "user-login", + "type": "user_err" + }, + "user": { + "auid": "unset", + "uid": "0", + "name_map": { + "uid": "root" + } + }, + "process": { + "pid": "13281", + "exe": "/usr/sbin/sshd" + }, + "beat": { + "version": "7.0.0-alpha1", + "name": "demo-stack-mysql-01", + "hostname": "demo-stack-mysql-01" + }, + "host": { + "name": "demo-stack-mysql-01" + }, + "source": { + "ip": "157.100.133.21" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "wt0ZU2cBTFzn_XoLqiw3", + "source": { + "@timestamp": "2018-11-27T02:57:29.161Z", + "source": { + "ip": "37.59.62.23" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "result": "fail", + "session": "unset", + "data": { + "acct": "(unknown user)", + "op": "login", + "terminal": "sshd" + }, + "summary": { + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + }, + "object": { + "secondary": "37.59.62.23", + "type": "user-session", + "primary": "sshd" + } + }, + "sequence": 44318 + }, + "host": { + "name": "demo-stack-es-01" + }, + "beat": { + "hostname": "demo-stack-es-01", + "version": "7.0.0-alpha1", + "name": "demo-stack-es-01" + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + }, + "user": { + "uid": "0", + "auid": "unset", + "name_map": { + "uid": "root" + } + }, + "process": { + "pid": "31535", + "exe": "/usr/sbin/sshd" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "w90ZU2cBTFzn_XoLqiw3", + "source": { + "@timestamp": "2018-11-27T02:57:29.161Z", + "host": { + "name": "demo-stack-es-01" + }, + "event": { + "type": "user_login", + "action": "logged-in", + "module": "auditd", + "category": "user-login" + }, + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + }, + "process": { + "pid": "31535", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "37.59.62.23" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "result": "fail", + "session": "unset", + "data": { + "acct": "(invalid user)", + "terminal": "sshd", + "op": "login" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + }, + "object": { + "primary": "sshd", + "secondary": "37.59.62.23", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 44319 + }, + "beat": { + "name": "demo-stack-es-01", + "hostname": "demo-stack-es-01", + "version": "7.0.0-alpha1" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "xN0ZU2cBTFzn_XoLqiw3", + "source": { + "@timestamp": "2018-11-27T02:57:29.269Z", + "source": { + "ip": "37.59.62.23" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "summary": { + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "root" + }, + "object": { + "secondary": "37.59.62.23", + "type": "user-session", + "primary": "ssh" + } + }, + "sequence": 44320, + "result": "fail", + "session": "unset", + "data": { + "hostname": "37.59.62.23", + "op": "PAM:bad_ident", + "terminal": "ssh" + } + }, + "event": { + "category": "user-login", + "type": "user_err", + "action": "error", + "module": "auditd" + }, + "beat": { + "name": "demo-stack-es-01", + "hostname": "demo-stack-es-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-es-01" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "pid": "31535", + "exe": "/usr/sbin/sshd" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "Ld0ZU2cBTFzn_XoLxC9z", + "source": { + "@timestamp": "2018-11-27T02:57:35.874Z", + "beat": { + "name": "demo-stack-mysql-01", + "hostname": "demo-stack-mysql-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-mysql-01" + }, + "auditd": { + "summary": { + "how": "/lib/systemd/systemd", + "actor": { + "secondary": "root", + "primary": "unset" + }, + "object": { + "primary": "apt-daily", + "type": "service" + } + }, + "sequence": 43306, + "result": "success", + "session": "unset", + "data": { + "unit": "apt-daily" + } + }, + "event": { + "category": "system-services", + "type": "service_start", + "action": "started-service", + "module": "auditd" + }, + "user": { + "name_map": { + "uid": "root" + }, + "auid": "unset", + "uid": "0" + }, + "process": { + "pid": "1", + "name": "systemd", + "exe": "/lib/systemd/systemd" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "Lt0ZU2cBTFzn_XoLxC9z", + "source": { + "@timestamp": "2018-11-27T02:57:35.874Z", + "event": { + "category": "system-services", + "type": "service_stop", + "action": "stopped-service", + "module": "auditd" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "pid": "1", + "name": "systemd", + "exe": "/lib/systemd/systemd" + }, + "auditd": { + "summary": { + "actor": { + "primary": "unset", + "secondary": "root" + }, + "object": { + "primary": "apt-daily", + "type": "service" + }, + "how": "/lib/systemd/systemd" + }, + "sequence": 43307, + "result": "success", + "session": "unset", + "data": { + "unit": "apt-daily" + } + }, + "beat": { + "name": "demo-stack-mysql-01", + "hostname": "demo-stack-mysql-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-mysql-01" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "p893UmcBTFzn_XoLs0bb", + "source": { + "@timestamp": "2018-11-27T00:00:34.801Z", + "process": { + "pid": "19147", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "200.35.110.58" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "data": { + "terminal": "sshd", + "op": "login", + "acct": "(unknown user)" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + }, + "object": { + "secondary": "200.35.110.58", + "type": "user-session", + "primary": "sshd" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 142246, + "result": "fail", + "session": "unset" + }, + "event": { + "action": "logged-in", + "module": "auditd", + "category": "user-login", + "type": "user_login" + }, + "beat": { + "hostname": "demo-stack-haproxy-01", + "version": "7.0.0-alpha1", + "name": "demo-stack-haproxy-01" + }, + "host": { + "name": "demo-stack-haproxy-01" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "qM93UmcBTFzn_XoLs0bb", + "source": { + "@timestamp": "2018-11-27T00:00:34.802Z", + "network": { + "direction": "incoming" + }, + "auditd": { + "data": { + "terminal": "sshd", + "op": "login", + "acct": "(invalid user)" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + }, + "object": { + "primary": "sshd", + "secondary": "200.35.110.58", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 142247, + "result": "fail", + "session": "unset" + }, + "beat": { + "name": "demo-stack-haproxy-01", + "hostname": "demo-stack-haproxy-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-haproxy-01" + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "pid": "19147", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "200.35.110.58" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "qc93UmcBTFzn_XoLs0bb", + "source": { + "@timestamp": "2018-11-27T00:00:34.906Z", + "network": { + "direction": "incoming" + }, + "auditd": { + "summary": { + "actor": { + "primary": "unset", + "secondary": "root" + }, + "object": { + "type": "user-session", + "primary": "ssh", + "secondary": "200.35.110.58" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 142248, + "result": "fail", + "session": "unset", + "data": { + "hostname": "200.35.110.58", + "op": "PAM:bad_ident", + "terminal": "ssh" + } + }, + "event": { + "action": "error", + "module": "auditd", + "category": "user-login", + "type": "user_err" + }, + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + }, + "process": { + "pid": "19147", + "exe": "/usr/sbin/sshd" + }, + "beat": { + "version": "7.0.0-alpha1", + "name": "demo-stack-haproxy-01", + "hostname": "demo-stack-haproxy-01" + }, + "host": { + "name": "demo-stack-haproxy-01" + }, + "source": { + "ip": "200.35.110.58" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "Lc97UmcBTFzn_XoLKpLT", + "source": { + "@timestamp": "2018-11-27T00:04:21.865Z", + "event": { + "type": "user_login", + "action": "logged-in", + "module": "auditd", + "category": "user-login" + }, + "user": { + "name_map": { + "uid": "root" + }, + "auid": "unset", + "uid": "0" + }, + "beat": { + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-redis-01" + }, + "process": { + "exe": "/usr/sbin/sshd", + "pid": "31749" + }, + "source": { + "ip": "164.132.112.233" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "summary": { + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + }, + "object": { + "primary": "sshd", + "secondary": "164.132.112.233", + "type": "user-session" + } + }, + "sequence": 186182, + "result": "fail", + "session": "unset", + "data": { + "terminal": "sshd", + "op": "login", + "acct": "(unknown user)" + } + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "Ls97UmcBTFzn_XoLKpLT", + "source": { + "@timestamp": "2018-11-27T00:04:21.866Z", + "user": { + "uid": "0", + "auid": "unset", + "name_map": { + "uid": "root" + } + }, + "process": { + "pid": "31749", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "164.132.112.233" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "sequence": 186183, + "result": "fail", + "session": "unset", + "data": { + "terminal": "sshd", + "op": "login", + "acct": "(invalid user)" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + }, + "object": { + "primary": "sshd", + "secondary": "164.132.112.233", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + } + }, + "beat": { + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-redis-01" + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "L897UmcBTFzn_XoLKpLT", + "source": { + "@timestamp": "2018-11-27T00:04:21.973Z", + "beat": { + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-redis-01" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "summary": { + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "root" + }, + "object": { + "type": "user-session", + "primary": "ssh", + "secondary": "164.132.112.233" + } + }, + "sequence": 186184, + "result": "fail", + "session": "unset", + "data": { + "op": "PAM:bad_ident", + "hostname": "164.132.112.233", + "terminal": "ssh" + } + }, + "event": { + "category": "user-login", + "type": "user_err", + "action": "error", + "module": "auditd" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "exe": "/usr/sbin/sshd", + "pid": "31749" + }, + "source": { + "ip": "164.132.112.233" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "o894UmcBTFzn_XoLA00h", + "source": { + "@timestamp": "2018-11-27T00:00:55.095Z", + "beat": { + "name": "demo-stack-nginx-01", + "hostname": "demo-stack-nginx-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-nginx-01" + }, + "auditd": { + "summary": { + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + }, + "object": { + "primary": "sshd", + "secondary": "139.198.120.32", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 192390, + "result": "fail", + "session": "unset", + "data": { + "terminal": "sshd", + "acct": "(unknown user)", + "op": "login" + } + }, + "event": { + "module": "auditd", + "category": "user-login", + "type": "user_login", + "action": "logged-in" + }, + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + }, + "process": { + "pid": "31971", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "139.198.120.32" + }, + "network": { + "direction": "incoming" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "pM94UmcBTFzn_XoLA00h", + "source": { + "@timestamp": "2018-11-27T00:00:55.096Z", + "auditd": { + "sequence": 192391, + "result": "fail", + "session": "unset", + "data": { + "op": "login", + "acct": "(invalid user)", + "terminal": "sshd" + }, + "summary": { + "object": { + "primary": "sshd", + "secondary": "139.198.120.32", + "type": "user-session" + }, + "how": "/usr/sbin/sshd", + "actor": { + "secondary": "(invalid user)", + "primary": "unset" + } + } + }, + "event": { + "type": "user_login", + "action": "logged-in", + "module": "auditd", + "category": "user-login" + }, + "beat": { + "name": "demo-stack-nginx-01", + "hostname": "demo-stack-nginx-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-nginx-01" + }, + "user": { + "auid": "unset", + "uid": "0", + "name_map": { + "uid": "root" + } + }, + "process": { + "exe": "/usr/sbin/sshd", + "pid": "31971" + }, + "source": { + "ip": "139.198.120.32" + }, + "network": { + "direction": "incoming" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "pc94UmcBTFzn_XoLA00h", + "source": { + "@timestamp": "2018-11-27T00:00:55.269Z", + "beat": { + "name": "demo-stack-nginx-01", + "hostname": "demo-stack-nginx-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-nginx-01" + }, + "process": { + "pid": "31971", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "139.198.120.32" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "result": "fail", + "session": "unset", + "data": { + "terminal": "ssh", + "op": "PAM:bad_ident", + "hostname": "139.198.120.32" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "root" + }, + "object": { + "primary": "ssh", + "secondary": "139.198.120.32", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 192392 + }, + "event": { + "category": "user-login", + "type": "user_err", + "action": "error", + "module": "auditd" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "eM95UmcBTFzn_XoLP2hD", + "source": { + "@timestamp": "2018-11-27T00:02:15.998Z", + "source": { + "ip": "106.12.29.232" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "sequence": 192393, + "result": "fail", + "session": "unset", + "data": { + "terminal": "sshd", + "acct": "(unknown user)", + "op": "login" + }, + "summary": { + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + }, + "object": { + "primary": "sshd", + "secondary": "106.12.29.232", + "type": "user-session" + } + } + }, + "beat": { + "version": "7.0.0-alpha1", + "name": "demo-stack-nginx-01", + "hostname": "demo-stack-nginx-01" + }, + "host": { + "name": "demo-stack-nginx-01" + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + }, + "user": { + "name_map": { + "uid": "root" + }, + "uid": "0", + "auid": "unset" + }, + "process": { + "pid": "31979", + "exe": "/usr/sbin/sshd" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "ec95UmcBTFzn_XoLP2hD", + "source": { + "@timestamp": "2018-11-27T00:02:15.999Z", + "event": { + "type": "user_login", + "action": "logged-in", + "module": "auditd", + "category": "user-login" + }, + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + }, + "process": { + "exe": "/usr/sbin/sshd", + "pid": "31979" + }, + "beat": { + "name": "demo-stack-nginx-01", + "hostname": "demo-stack-nginx-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-nginx-01" + }, + "source": { + "ip": "106.12.29.232" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "result": "fail", + "session": "unset", + "data": { + "terminal": "sshd", + "acct": "(invalid user)", + "op": "login" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + }, + "object": { + "secondary": "106.12.29.232", + "type": "user-session", + "primary": "sshd" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 192394 + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "es95UmcBTFzn_XoLP2hD", + "source": { + "@timestamp": "2018-11-27T00:02:16.292Z", + "source": { + "ip": "106.12.29.232" + }, + "network": { + "direction": "incoming" + }, + "beat": { + "name": "demo-stack-nginx-01", + "hostname": "demo-stack-nginx-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-nginx-01" + }, + "auditd": { + "result": "fail", + "session": "unset", + "data": { + "terminal": "ssh", + "op": "PAM:bad_ident", + "hostname": "106.12.29.232" + }, + "summary": { + "object": { + "primary": "ssh", + "secondary": "106.12.29.232", + "type": "user-session" + }, + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "root" + } + }, + "sequence": 192395 + }, + "event": { + "category": "user-login", + "type": "user_err", + "action": "error", + "module": "auditd" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "pid": "31979", + "exe": "/usr/sbin/sshd" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "PM99UmcBTFzn_XoLjscA", + "source": { + "@timestamp": "2018-11-27T00:06:58.326Z", + "network": { + "direction": "incoming" + }, + "auditd": { + "data": { + "op": "login", + "terminal": "sshd", + "acct": "(unknown user)" + }, + "summary": { + "actor": { + "secondary": "(unknown user)", + "primary": "unset" + }, + "object": { + "primary": "sshd", + "secondary": "54.37.154.254", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 186188, + "result": "fail", + "session": "unset" + }, + "beat": { + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-redis-01" + }, + "event": { + "action": "logged-in", + "module": "auditd", + "category": "user-login", + "type": "user_login" + }, + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + }, + "process": { + "pid": "31766", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "54.37.154.254" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "Pc99UmcBTFzn_XoLjscA", + "source": { + "@timestamp": "2018-11-27T00:06:58.327Z", + "host": { + "name": "demo-stack-redis-01" + }, + "event": { + "type": "user_login", + "action": "logged-in", + "module": "auditd", + "category": "user-login" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "pid": "31766", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "54.37.154.254" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "result": "fail", + "session": "unset", + "data": { + "op": "login", + "terminal": "sshd", + "acct": "(invalid user)" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + }, + "object": { + "secondary": "54.37.154.254", + "type": "user-session", + "primary": "sshd" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 186189 + }, + "beat": { + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1", + "name": "demo-stack-redis-01" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "Ps99UmcBTFzn_XoLjscA", + "source": { + "@timestamp": "2018-11-27T00:06:58.438Z", + "network": { + "direction": "incoming" + }, + "auditd": { + "result": "fail", + "session": "unset", + "data": { + "op": "PAM:bad_ident", + "terminal": "ssh", + "hostname": "54.37.154.254" + }, + "summary": { + "how": "/usr/sbin/sshd", + "actor": { + "secondary": "root", + "primary": "unset" + }, + "object": { + "type": "user-session", + "primary": "ssh", + "secondary": "54.37.154.254" + } + }, + "sequence": 186190 + }, + "event": { + "category": "user-login", + "type": "user_err", + "action": "error", + "module": "auditd" + }, + "beat": { + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-redis-01" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "pid": "31766", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "54.37.154.254" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "cM95UmcBTFzn_XoLKGaD", + "source": { + "@timestamp": "2018-11-27T00:02:10.186Z", + "event": { + "action": "logged-in", + "module": "auditd", + "category": "user-login", + "type": "user_login" + }, + "host": { + "name": "demo-stack-redis-01" + }, + "beat": { + "version": "7.0.0-alpha1", + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01" + }, + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + }, + "process": { + "pid": "31740", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "211.24.100.205" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "sequence": 186179, + "result": "fail", + "session": "unset", + "data": { + "op": "login", + "acct": "(unknown user)", + "terminal": "sshd" + }, + "summary": { + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + }, + "object": { + "primary": "sshd", + "secondary": "211.24.100.205", + "type": "user-session" + } + } + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "cc95UmcBTFzn_XoLKGaD", + "source": { + "@timestamp": "2018-11-27T00:02:10.188Z", + "host": { + "name": "demo-stack-redis-01" + }, + "event": { + "module": "auditd", + "category": "user-login", + "type": "user_login", + "action": "logged-in" + }, + "user": { + "name_map": { + "uid": "root" + }, + "uid": "0", + "auid": "unset" + }, + "process": { + "pid": "31740", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "211.24.100.205" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "summary": { + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + }, + "object": { + "primary": "sshd", + "secondary": "211.24.100.205", + "type": "user-session" + } + }, + "sequence": 186180, + "result": "fail", + "session": "unset", + "data": { + "op": "login", + "terminal": "sshd", + "acct": "(invalid user)" + } + }, + "beat": { + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1", + "name": "demo-stack-redis-01" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "cs95UmcBTFzn_XoLKGaD", + "source": { + "@timestamp": "2018-11-27T00:02:10.392Z", + "host": { + "name": "demo-stack-redis-01" + }, + "event": { + "category": "user-login", + "type": "user_err", + "action": "error", + "module": "auditd" + }, + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + }, + "process": { + "pid": "31740", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "211.24.100.205" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "summary": { + "actor": { + "primary": "unset", + "secondary": "root" + }, + "object": { + "primary": "ssh", + "secondary": "211.24.100.205", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 186181, + "result": "fail", + "session": "unset", + "data": { + "terminal": "ssh", + "op": "PAM:bad_ident", + "hostname": "211.24.100.205" + } + }, + "beat": { + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1", + "name": "demo-stack-redis-01" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "hs93UmcBTFzn_XoLcEF7", + "source": { + "@timestamp": "2018-11-27T00:00:17.552Z", + "source": { + "ip": "142.93.210.90" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "data": { + "acct": "(unknown user)", + "op": "login", + "terminal": "sshd" + }, + "summary": { + "actor": { + "secondary": "(unknown user)", + "primary": "unset" + }, + "object": { + "type": "user-session", + "primary": "sshd", + "secondary": "142.93.210.90" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 192387, + "result": "fail", + "session": "unset" + }, + "beat": { + "version": "7.0.0-alpha1", + "name": "demo-stack-nginx-01", + "hostname": "demo-stack-nginx-01" + }, + "host": { + "name": "demo-stack-nginx-01" + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "pid": "31968", + "exe": "/usr/sbin/sshd" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "h893UmcBTFzn_XoLcEF7", + "source": { + "@timestamp": "2018-11-27T00:00:17.552Z", + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + }, + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + }, + "process": { + "exe": "/usr/sbin/sshd", + "pid": "31968" + }, + "source": { + "ip": "142.93.210.90" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "sequence": 192388, + "result": "fail", + "session": "unset", + "data": { + "terminal": "sshd", + "acct": "(invalid user)", + "op": "login" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + }, + "object": { + "secondary": "142.93.210.90", + "type": "user-session", + "primary": "sshd" + }, + "how": "/usr/sbin/sshd" + } + }, + "beat": { + "hostname": "demo-stack-nginx-01", + "version": "7.0.0-alpha1", + "name": "demo-stack-nginx-01" + }, + "host": { + "name": "demo-stack-nginx-01" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "iM93UmcBTFzn_XoLcEF7", + "source": { + "@timestamp": "2018-11-27T00:00:17.784Z", + "event": { + "action": "error", + "module": "auditd", + "category": "user-login", + "type": "user_err" + }, + "user": { + "auid": "unset", + "uid": "0", + "name_map": { + "uid": "root" + } + }, + "process": { + "exe": "/usr/sbin/sshd", + "pid": "31968" + }, + "source": { + "ip": "142.93.210.90" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "summary": { + "actor": { + "primary": "unset", + "secondary": "root" + }, + "object": { + "type": "user-session", + "primary": "ssh", + "secondary": "142.93.210.90" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 192389, + "result": "fail", + "session": "unset", + "data": { + "hostname": "142.93.210.90", + "op": "PAM:bad_ident", + "terminal": "ssh" + } + }, + "host": { + "name": "demo-stack-nginx-01" + }, + "beat": { + "name": "demo-stack-nginx-01", + "hostname": "demo-stack-nginx-01", + "version": "7.0.0-alpha1" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "k899UmcBTFzn_XoL6M7W", + "source": { + "@timestamp": "2018-11-27T00:07:21.573Z", + "host": { + "name": "demo-stack-es-01" + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + }, + "user": { + "uid": "0", + "auid": "unset", + "name_map": { + "uid": "root" + } + }, + "process": { + "pid": "27895", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "174.50.26.154" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "session": "unset", + "data": { + "terminal": "sshd", + "acct": "(unknown user)", + "op": "login" + }, + "summary": { + "object": { + "primary": "sshd", + "secondary": "174.50.26.154", + "type": "user-session" + }, + "how": "/usr/sbin/sshd", + "actor": { + "secondary": "(unknown user)", + "primary": "unset" + } + }, + "sequence": 44073, + "result": "fail" + }, + "beat": { + "name": "demo-stack-es-01", + "hostname": "demo-stack-es-01", + "version": "7.0.0-alpha1" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "lM99UmcBTFzn_XoL6M7W", + "source": { + "@timestamp": "2018-11-27T00:07:21.577Z", + "host": { + "name": "demo-stack-es-01" + }, + "auditd": { + "session": "unset", + "data": { + "op": "login", + "acct": "(invalid user)", + "terminal": "sshd" + }, + "summary": { + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + }, + "object": { + "primary": "sshd", + "secondary": "174.50.26.154", + "type": "user-session" + } + }, + "sequence": 44074, + "result": "fail" + }, + "event": { + "module": "auditd", + "category": "user-login", + "type": "user_login", + "action": "logged-in" + }, + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + }, + "process": { + "pid": "27895", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "174.50.26.154" + }, + "network": { + "direction": "incoming" + }, + "beat": { + "name": "demo-stack-es-01", + "hostname": "demo-stack-es-01", + "version": "7.0.0-alpha1" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "lc99UmcBTFzn_XoL6M7W", + "source": { + "@timestamp": "2018-11-27T00:07:21.673Z", + "host": { + "name": "demo-stack-es-01" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "exe": "/usr/sbin/sshd", + "pid": "27895" + }, + "source": { + "ip": "174.50.26.154" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "sequence": 44075, + "result": "fail", + "session": "unset", + "data": { + "hostname": "174.50.26.154", + "terminal": "ssh", + "op": "PAM:bad_ident" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "root" + }, + "object": { + "primary": "ssh", + "secondary": "174.50.26.154", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + } + }, + "event": { + "category": "user-login", + "type": "user_err", + "action": "error", + "module": "auditd" + }, + "beat": { + "name": "demo-stack-es-01", + "hostname": "demo-stack-es-01", + "version": "7.0.0-alpha1" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "aM97UmcBTFzn_XoL4qJ8", + "source": { + "@timestamp": "2018-11-27T00:05:08.881Z", + "process": { + "pid": "31758", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "51.38.82.60" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "result": "fail", + "session": "unset", + "data": { + "acct": "(unknown user)", + "op": "login", + "terminal": "sshd" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + }, + "object": { + "primary": "sshd", + "secondary": "51.38.82.60", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 186185 + }, + "beat": { + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-redis-01" + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "ac97UmcBTFzn_XoL4qJ8", + "source": { + "@timestamp": "2018-11-27T00:05:08.882Z", + "source": { + "ip": "51.38.82.60" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "sequence": 186186, + "result": "fail", + "session": "unset", + "data": { + "terminal": "sshd", + "op": "login", + "acct": "(invalid user)" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + }, + "object": { + "primary": "sshd", + "secondary": "51.38.82.60", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + } + }, + "event": { + "module": "auditd", + "category": "user-login", + "type": "user_login", + "action": "logged-in" + }, + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + }, + "process": { + "pid": "31758", + "exe": "/usr/sbin/sshd" + }, + "beat": { + "version": "7.0.0-alpha1", + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01" + }, + "host": { + "name": "demo-stack-redis-01" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "as97UmcBTFzn_XoL4qJ8", + "source": { + "@timestamp": "2018-11-27T00:05:08.989Z", + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "pid": "31758", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "51.38.82.60" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "sequence": 186187, + "result": "fail", + "session": "unset", + "data": { + "terminal": "ssh", + "op": "PAM:bad_ident", + "hostname": "51.38.82.60" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "root" + }, + "object": { + "type": "user-session", + "primary": "ssh", + "secondary": "51.38.82.60" + }, + "how": "/usr/sbin/sshd" + } + }, + "beat": { + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-redis-01" + }, + "event": { + "category": "user-login", + "type": "user_err", + "action": "error", + "module": "auditd" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "4M99UmcBTFzn_XoLtco1", + "source": { + "@timestamp": "2018-11-27T00:07:08.363Z", + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + }, + "user": { + "auid": "unset", + "uid": "0", + "name_map": { + "uid": "root" + } + }, + "process": { + "pid": "31768", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "46.101.26.63" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "result": "fail", + "session": "unset", + "data": { + "op": "login", + "terminal": "sshd", + "acct": "(unknown user)" + }, + "summary": { + "actor": { + "secondary": "(unknown user)", + "primary": "unset" + }, + "object": { + "secondary": "46.101.26.63", + "type": "user-session", + "primary": "sshd" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 186191 + }, + "beat": { + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-redis-01" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "4c99UmcBTFzn_XoLtco1", + "source": { + "@timestamp": "2018-11-27T00:07:08.364Z", + "host": { + "name": "demo-stack-redis-01" + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + }, + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + }, + "process": { + "pid": "31768", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "46.101.26.63" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "data": { + "terminal": "sshd", + "acct": "(invalid user)", + "op": "login" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + }, + "object": { + "primary": "sshd", + "secondary": "46.101.26.63", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 186192, + "result": "fail", + "session": "unset" + }, + "beat": { + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "4s99UmcBTFzn_XoLtco1", + "source": { + "@timestamp": "2018-11-27T00:07:08.463Z", + "event": { + "category": "user-login", + "type": "user_err", + "action": "error", + "module": "auditd" + }, + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + }, + "process": { + "pid": "31768", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "46.101.26.63" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "sequence": 186193, + "result": "fail", + "session": "unset", + "data": { + "terminal": "ssh", + "op": "PAM:bad_ident", + "hostname": "46.101.26.63" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "root" + }, + "object": { + "type": "user-session", + "primary": "ssh", + "secondary": "46.101.26.63" + }, + "how": "/usr/sbin/sshd" + } + }, + "beat": { + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-redis-01" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "_NCBUmcBTFzn_XoLzSMR", + "source": { + "@timestamp": "2018-11-27T00:11:36.615Z", + "host": { + "name": "demo-stack-redis-01" + }, + "auditd": { + "result": "fail", + "session": "unset", + "data": { + "acct": "(unknown user)", + "terminal": "sshd", + "op": "login" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + }, + "object": { + "primary": "sshd", + "secondary": "86.96.203.107", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 186212 + }, + "event": { + "action": "logged-in", + "module": "auditd", + "category": "user-login", + "type": "user_login" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "pid": "31802", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "86.96.203.107" + }, + "network": { + "direction": "incoming" + }, + "beat": { + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "_dCBUmcBTFzn_XoLzSMR", + "source": { + "@timestamp": "2018-11-27T00:11:36.616Z", + "host": { + "name": "demo-stack-redis-01" + }, + "event": { + "module": "auditd", + "category": "user-login", + "type": "user_login", + "action": "logged-in" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "pid": "31802", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "86.96.203.107" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "data": { + "terminal": "sshd", + "acct": "(invalid user)", + "op": "login" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + }, + "object": { + "primary": "sshd", + "secondary": "86.96.203.107", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 186213, + "result": "fail", + "session": "unset" + }, + "beat": { + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1", + "name": "demo-stack-redis-01" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "_tCBUmcBTFzn_XoLzSMR", + "source": { + "@timestamp": "2018-11-27T00:11:36.828Z", + "source": { + "ip": "86.96.203.107" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "data": { + "terminal": "ssh", + "op": "PAM:bad_ident", + "hostname": "86.96.203.107" + }, + "summary": { + "actor": { + "secondary": "root", + "primary": "unset" + }, + "object": { + "primary": "ssh", + "secondary": "86.96.203.107", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 186214, + "result": "fail", + "session": "unset" + }, + "beat": { + "version": "7.0.0-alpha1", + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01" + }, + "host": { + "name": "demo-stack-redis-01" + }, + "event": { + "module": "auditd", + "category": "user-login", + "type": "user_err", + "action": "error" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "exe": "/usr/sbin/sshd", + "pid": "31802" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "WdCBUmcBTFzn_XoLzyVY", + "source": { + "@timestamp": "2018-11-27T00:11:37.195Z", + "auditd": { + "sequence": 43095, + "result": "fail", + "session": "unset", + "data": { + "terminal": "sshd", + "acct": "(unknown user)", + "op": "login" + }, + "summary": { + "object": { + "type": "user-session", + "primary": "sshd", + "secondary": "104.248.236.32" + }, + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + } + } + }, + "event": { + "action": "logged-in", + "module": "auditd", + "category": "user-login", + "type": "user_login" + }, + "user": { + "auid": "unset", + "uid": "0", + "name_map": { + "uid": "root" + } + }, + "process": { + "pid": "12257", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "104.248.236.32" + }, + "network": { + "direction": "incoming" + }, + "host": { + "name": "demo-stack-mysql-01" + }, + "beat": { + "name": "demo-stack-mysql-01", + "hostname": "demo-stack-mysql-01", + "version": "7.0.0-alpha1" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "WtCBUmcBTFzn_XoLzyVY", + "source": { + "@timestamp": "2018-11-27T00:11:37.195Z", + "host": { + "name": "demo-stack-mysql-01" + }, + "beat": { + "name": "demo-stack-mysql-01", + "hostname": "demo-stack-mysql-01", + "version": "7.0.0-alpha1" + }, + "process": { + "pid": "12257", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "104.248.236.32" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "sequence": 43096, + "result": "fail", + "session": "unset", + "data": { + "terminal": "sshd", + "acct": "(invalid user)", + "op": "login" + }, + "summary": { + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + }, + "object": { + "secondary": "104.248.236.32", + "type": "user-session", + "primary": "sshd" + } + } + }, + "event": { + "type": "user_login", + "action": "logged-in", + "module": "auditd", + "category": "user-login" + }, + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "W9CBUmcBTFzn_XoLzyVY", + "source": { + "@timestamp": "2018-11-27T00:11:37.223Z", + "host": { + "name": "demo-stack-mysql-01" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "sequence": 43097, + "result": "fail", + "session": "unset", + "data": { + "op": "PAM:bad_ident", + "hostname": "104.248.236.32", + "terminal": "ssh" + }, + "summary": { + "object": { + "primary": "ssh", + "secondary": "104.248.236.32", + "type": "user-session" + }, + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "root" + } + } + }, + "event": { + "module": "auditd", + "category": "user-login", + "type": "user_err", + "action": "error" + }, + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + }, + "process": { + "pid": "12257", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "104.248.236.32" + }, + "beat": { + "name": "demo-stack-mysql-01", + "hostname": "demo-stack-mysql-01", + "version": "7.0.0-alpha1" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "ZNCBUmcBTFzn_XoL0yWS", + "source": { + "@timestamp": "2018-11-27T00:11:38.280Z", + "user": { + "name_map": { + "uid": "root" + }, + "auid": "unset", + "uid": "0" + }, + "beat": { + "name": "demo-stack-nginx-01", + "hostname": "demo-stack-nginx-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-nginx-01" + }, + "process": { + "pid": "32078", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "91.121.26.184" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "result": "fail", + "session": "unset", + "data": { + "op": "login", + "acct": "(unknown user)", + "terminal": "sshd" + }, + "summary": { + "actor": { + "secondary": "(unknown user)", + "primary": "unset" + }, + "object": { + "secondary": "91.121.26.184", + "type": "user-session", + "primary": "sshd" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 192402 + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "ZdCBUmcBTFzn_XoL0yWS", + "source": { + "@timestamp": "2018-11-27T00:11:38.280Z", + "network": { + "direction": "incoming" + }, + "auditd": { + "data": { + "terminal": "sshd", + "acct": "(invalid user)", + "op": "login" + }, + "summary": { + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + }, + "object": { + "primary": "sshd", + "secondary": "91.121.26.184", + "type": "user-session" + } + }, + "sequence": 192403, + "result": "fail", + "session": "unset" + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + }, + "beat": { + "name": "demo-stack-nginx-01", + "hostname": "demo-stack-nginx-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-nginx-01" + }, + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + }, + "process": { + "pid": "32078", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "91.121.26.184" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "ZtCBUmcBTFzn_XoL0yWS", + "source": { + "@timestamp": "2018-11-27T00:11:38.388Z", + "user": { + "name_map": { + "uid": "root" + }, + "auid": "unset", + "uid": "0" + }, + "process": { + "pid": "32078", + "exe": "/usr/sbin/sshd" + }, + "beat": { + "name": "demo-stack-nginx-01", + "hostname": "demo-stack-nginx-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-nginx-01" + }, + "source": { + "ip": "91.121.26.184" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "sequence": 192404, + "result": "fail", + "session": "unset", + "data": { + "hostname": "91.121.26.184", + "terminal": "ssh", + "op": "PAM:bad_ident" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "root" + }, + "object": { + "secondary": "91.121.26.184", + "type": "user-session", + "primary": "ssh" + }, + "how": "/usr/sbin/sshd" + } + }, + "event": { + "action": "error", + "module": "auditd", + "category": "user-login", + "type": "user_err" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "HtCBUmcBTFzn_XoLJBa0", + "source": { + "@timestamp": "2018-11-27T00:10:53.514Z", + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "beat": { + "name": "demo-stack-haproxy-01", + "hostname": "demo-stack-haproxy-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-haproxy-01" + }, + "process": { + "pid": "19210", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "206.189.183.75" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "summary": { + "how": "/usr/sbin/sshd", + "actor": { + "secondary": "(unknown user)", + "primary": "unset" + }, + "object": { + "type": "user-session", + "primary": "sshd", + "secondary": "206.189.183.75" + } + }, + "sequence": 142258, + "result": "fail", + "session": "unset", + "data": { + "terminal": "sshd", + "acct": "(unknown user)", + "op": "login" + } + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "H9CBUmcBTFzn_XoLJBa0", + "source": { + "@timestamp": "2018-11-27T00:10:53.515Z", + "network": { + "direction": "incoming" + }, + "beat": { + "hostname": "demo-stack-haproxy-01", + "version": "7.0.0-alpha1", + "name": "demo-stack-haproxy-01" + }, + "host": { + "name": "demo-stack-haproxy-01" + }, + "auditd": { + "summary": { + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + }, + "object": { + "type": "user-session", + "primary": "sshd", + "secondary": "206.189.183.75" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 142259, + "result": "fail", + "session": "unset", + "data": { + "terminal": "sshd", + "acct": "(invalid user)", + "op": "login" + } + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + }, + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + }, + "process": { + "exe": "/usr/sbin/sshd", + "pid": "19210" + }, + "source": { + "ip": "206.189.183.75" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "INCBUmcBTFzn_XoLJBa0", + "source": { + "@timestamp": "2018-11-27T00:10:53.546Z", + "network": { + "direction": "incoming" + }, + "auditd": { + "sequence": 142260, + "result": "fail", + "session": "unset", + "data": { + "terminal": "ssh", + "op": "PAM:bad_ident", + "hostname": "206.189.183.75" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "root" + }, + "object": { + "type": "user-session", + "primary": "ssh", + "secondary": "206.189.183.75" + }, + "how": "/usr/sbin/sshd" + } + }, + "host": { + "name": "demo-stack-haproxy-01" + }, + "beat": { + "hostname": "demo-stack-haproxy-01", + "version": "7.0.0-alpha1", + "name": "demo-stack-haproxy-01" + }, + "event": { + "action": "error", + "module": "auditd", + "category": "user-login", + "type": "user_err" + }, + "user": { + "auid": "unset", + "uid": "0", + "name_map": { + "uid": "root" + } + }, + "process": { + "pid": "19210", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "206.189.183.75" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "Z9CCUmcBTFzn_XoL5z0B", + "source": { + "@timestamp": "2018-11-27T00:12:48.790Z", + "beat": { + "name": "demo-stack-haproxy-01", + "hostname": "demo-stack-haproxy-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-haproxy-01" + }, + "user": { + "uid": "0", + "auid": "unset", + "name_map": { + "uid": "root" + } + }, + "process": { + "exe": "/usr/sbin/sshd", + "pid": "19223" + }, + "source": { + "ip": "188.166.213.254" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "summary": { + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + }, + "object": { + "primary": "sshd", + "secondary": "188.166.213.254", + "type": "user-session" + } + }, + "sequence": 142261, + "result": "fail", + "session": "unset", + "data": { + "op": "login", + "acct": "(unknown user)", + "terminal": "sshd" + } + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "aNCCUmcBTFzn_XoL5z0B", + "source": { + "@timestamp": "2018-11-27T00:12:48.791Z", + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "pid": "19223", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "188.166.213.254" + }, + "beat": { + "hostname": "demo-stack-haproxy-01", + "version": "7.0.0-alpha1", + "name": "demo-stack-haproxy-01" + }, + "host": { + "name": "demo-stack-haproxy-01" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "sequence": 142262, + "result": "fail", + "session": "unset", + "data": { + "terminal": "sshd", + "op": "login", + "acct": "(invalid user)" + }, + "summary": { + "actor": { + "secondary": "(invalid user)", + "primary": "unset" + }, + "object": { + "primary": "sshd", + "secondary": "188.166.213.254", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + } + }, + "event": { + "module": "auditd", + "category": "user-login", + "type": "user_login", + "action": "logged-in" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "adCCUmcBTFzn_XoL5z0B", + "source": { + "@timestamp": "2018-11-27T00:12:48.985Z", + "host": { + "name": "demo-stack-haproxy-01" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "pid": "19223", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "188.166.213.254" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "sequence": 142263, + "result": "fail", + "session": "unset", + "data": { + "op": "PAM:bad_ident", + "terminal": "ssh", + "hostname": "188.166.213.254" + }, + "summary": { + "actor": { + "secondary": "root", + "primary": "unset" + }, + "object": { + "primary": "ssh", + "secondary": "188.166.213.254", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + } + }, + "event": { + "category": "user-login", + "type": "user_err", + "action": "error", + "module": "auditd" + }, + "beat": { + "hostname": "demo-stack-haproxy-01", + "version": "7.0.0-alpha1", + "name": "demo-stack-haproxy-01" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "ytCAUmcBTFzn_XoLfAfq", + "source": { + "@timestamp": "2018-11-27T00:10:10.560Z", + "host": { + "name": "demo-stack-redis-01" + }, + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + }, + "process": { + "pid": "31792", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "123.136.161.146" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "session": "unset", + "data": { + "acct": "(unknown user)", + "terminal": "sshd", + "op": "login" + }, + "summary": { + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + }, + "object": { + "type": "user-session", + "primary": "sshd", + "secondary": "123.136.161.146" + } + }, + "sequence": 186206, + "result": "fail" + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + }, + "beat": { + "version": "7.0.0-alpha1", + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "y9CAUmcBTFzn_XoLfAfq", + "source": { + "@timestamp": "2018-11-27T00:10:10.561Z", + "auditd": { + "data": { + "op": "login", + "acct": "(invalid user)", + "terminal": "sshd" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + }, + "object": { + "primary": "sshd", + "secondary": "123.136.161.146", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 186207, + "result": "fail", + "session": "unset" + }, + "event": { + "action": "logged-in", + "module": "auditd", + "category": "user-login", + "type": "user_login" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "pid": "31792", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "123.136.161.146" + }, + "network": { + "direction": "incoming" + }, + "host": { + "name": "demo-stack-redis-01" + }, + "beat": { + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "zNCAUmcBTFzn_XoLfAfq", + "source": { + "@timestamp": "2018-11-27T00:10:10.789Z", + "event": { + "category": "user-login", + "type": "user_err", + "action": "error", + "module": "auditd" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "pid": "31792", + "exe": "/usr/sbin/sshd" + }, + "beat": { + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-redis-01" + }, + "source": { + "ip": "123.136.161.146" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "data": { + "terminal": "ssh", + "op": "PAM:bad_ident", + "hostname": "123.136.161.146" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "root" + }, + "object": { + "type": "user-session", + "primary": "ssh", + "secondary": "123.136.161.146" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 186208, + "result": "fail", + "session": "unset" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "-NCBUmcBTFzn_XoLRxhI", + "source": { + "@timestamp": "2018-11-27T00:11:02.367Z", + "user": { + "name_map": { + "uid": "root" + }, + "auid": "unset", + "uid": "0" + }, + "process": { + "pid": "31799", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "103.241.146.65" + }, + "beat": { + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-redis-01" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "sequence": 186209, + "result": "fail", + "session": "unset", + "data": { + "terminal": "sshd", + "acct": "(unknown user)", + "op": "login" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + }, + "object": { + "primary": "sshd", + "secondary": "103.241.146.65", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + } + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "-dCBUmcBTFzn_XoLRxhI", + "source": { + "@timestamp": "2018-11-27T00:11:02.368Z", + "source": { + "ip": "103.241.146.65" + }, + "network": { + "direction": "incoming" + }, + "host": { + "name": "demo-stack-redis-01" + }, + "beat": { + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1" + }, + "auditd": { + "result": "fail", + "session": "unset", + "data": { + "op": "login", + "terminal": "sshd", + "acct": "(invalid user)" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + }, + "object": { + "primary": "sshd", + "secondary": "103.241.146.65", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 186210 + }, + "event": { + "type": "user_login", + "action": "logged-in", + "module": "auditd", + "category": "user-login" + }, + "user": { + "auid": "unset", + "uid": "0", + "name_map": { + "uid": "root" + } + }, + "process": { + "pid": "31799", + "exe": "/usr/sbin/sshd" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "-tCBUmcBTFzn_XoLRxhI", + "source": { + "@timestamp": "2018-11-27T00:11:02.619Z", + "host": { + "name": "demo-stack-redis-01" + }, + "event": { + "category": "user-login", + "type": "user_err", + "action": "error", + "module": "auditd" + }, + "user": { + "uid": "0", + "auid": "unset", + "name_map": { + "uid": "root" + } + }, + "process": { + "pid": "31799", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "103.241.146.65" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "sequence": 186211, + "result": "fail", + "session": "unset", + "data": { + "terminal": "ssh", + "hostname": "103.241.146.65", + "op": "PAM:bad_ident" + }, + "summary": { + "actor": { + "secondary": "root", + "primary": "unset" + }, + "object": { + "type": "user-session", + "primary": "ssh", + "secondary": "103.241.146.65" + }, + "how": "/usr/sbin/sshd" + } + }, + "beat": { + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "kdCDUmcBTFzn_XoLZUd0", + "source": { + "@timestamp": "2018-11-27T00:13:21.161Z", + "auditd": { + "summary": { + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + }, + "object": { + "secondary": "104.248.159.44", + "type": "user-session", + "primary": "sshd" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 186218, + "result": "fail", + "session": "unset", + "data": { + "terminal": "sshd", + "acct": "(unknown user)", + "op": "login" + } + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + }, + "user": { + "name_map": { + "uid": "root" + }, + "auid": "unset", + "uid": "0" + }, + "process": { + "pid": "31813", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "104.248.159.44" + }, + "network": { + "direction": "incoming" + }, + "beat": { + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-redis-01" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "ktCDUmcBTFzn_XoLZUd0", + "source": { + "@timestamp": "2018-11-27T00:13:21.162Z", + "auditd": { + "summary": { + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + }, + "object": { + "primary": "sshd", + "secondary": "104.248.159.44", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 186219, + "result": "fail", + "session": "unset", + "data": { + "acct": "(invalid user)", + "terminal": "sshd", + "op": "login" + } + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + }, + "beat": { + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-redis-01" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "exe": "/usr/sbin/sshd", + "pid": "31813" + }, + "source": { + "ip": "104.248.159.44" + }, + "network": { + "direction": "incoming" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "k9CDUmcBTFzn_XoLZUd0", + "source": { + "@timestamp": "2018-11-27T00:13:21.355Z", + "host": { + "name": "demo-stack-redis-01" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "session": "unset", + "data": { + "hostname": "104.248.159.44", + "terminal": "ssh", + "op": "PAM:bad_ident" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "root" + }, + "object": { + "primary": "ssh", + "secondary": "104.248.159.44", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 186220, + "result": "fail" + }, + "event": { + "category": "user-login", + "type": "user_err", + "action": "error", + "module": "auditd" + }, + "user": { + "name_map": { + "uid": "root" + }, + "uid": "0", + "auid": "unset" + }, + "process": { + "pid": "31813", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "104.248.159.44" + }, + "beat": { + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "zdCCUmcBTFzn_XoLfDPd", + "source": { + "@timestamp": "2018-11-27T00:12:21.596Z", + "source": { + "ip": "46.148.18.163" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "data": { + "terminal": "sshd", + "acct": "(unknown user)", + "op": "login" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + }, + "object": { + "primary": "sshd", + "secondary": "46.148.18.163", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 186215, + "result": "fail", + "session": "unset" + }, + "event": { + "module": "auditd", + "category": "user-login", + "type": "user_login", + "action": "logged-in" + }, + "user": { + "name_map": { + "uid": "root" + }, + "uid": "0", + "auid": "unset" + }, + "process": { + "pid": "31805", + "exe": "/usr/sbin/sshd" + }, + "beat": { + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-redis-01" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "ztCCUmcBTFzn_XoLfDPd", + "source": { + "@timestamp": "2018-11-27T00:12:21.598Z", + "source": { + "ip": "46.148.18.163" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "summary": { + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + }, + "object": { + "primary": "sshd", + "secondary": "46.148.18.163", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 186216, + "result": "fail", + "session": "unset", + "data": { + "terminal": "sshd", + "acct": "(invalid user)", + "op": "login" + } + }, + "event": { + "action": "logged-in", + "module": "auditd", + "category": "user-login", + "type": "user_login" + }, + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + }, + "process": { + "exe": "/usr/sbin/sshd", + "pid": "31805" + }, + "beat": { + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-redis-01" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "z9CCUmcBTFzn_XoLfDPd", + "source": { + "@timestamp": "2018-11-27T00:12:21.740Z", + "network": { + "direction": "incoming" + }, + "auditd": { + "sequence": 186217, + "result": "fail", + "session": "unset", + "data": { + "op": "PAM:bad_ident", + "hostname": "46.148.18.163", + "terminal": "ssh" + }, + "summary": { + "actor": { + "secondary": "root", + "primary": "unset" + }, + "object": { + "primary": "ssh", + "secondary": "46.148.18.163", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + } + }, + "event": { + "module": "auditd", + "category": "user-login", + "type": "user_err", + "action": "error" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "pid": "31805", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "46.148.18.163" + }, + "beat": { + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-redis-01" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "J9CAUmcBTFzn_XoL2xDJ", + "source": { + "@timestamp": "2018-11-27T00:10:34.814Z", + "network": { + "direction": "incoming" + }, + "auditd": { + "session": "unset", + "data": { + "acct": "(unknown user)", + "terminal": "sshd", + "op": "login" + }, + "summary": { + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + }, + "object": { + "primary": "sshd", + "secondary": "177.206.128.131", + "type": "user-session" + } + }, + "sequence": 43092, + "result": "fail" + }, + "beat": { + "name": "demo-stack-mysql-01", + "hostname": "demo-stack-mysql-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-mysql-01" + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + }, + "user": { + "name_map": { + "uid": "root" + }, + "auid": "unset", + "uid": "0" + }, + "process": { + "pid": "12250", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "177.206.128.131" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "KNCAUmcBTFzn_XoL2xDJ", + "source": { + "@timestamp": "2018-11-27T00:10:34.814Z", + "beat": { + "name": "demo-stack-mysql-01", + "hostname": "demo-stack-mysql-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-mysql-01" + }, + "user": { + "name_map": { + "uid": "root" + }, + "auid": "unset", + "uid": "0" + }, + "process": { + "pid": "12250", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "177.206.128.131" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "data": { + "terminal": "sshd", + "acct": "(invalid user)", + "op": "login" + }, + "summary": { + "object": { + "primary": "sshd", + "secondary": "177.206.128.131", + "type": "user-session" + }, + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + } + }, + "sequence": 43093, + "result": "fail", + "session": "unset" + }, + "event": { + "module": "auditd", + "category": "user-login", + "type": "user_login", + "action": "logged-in" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "KdCAUmcBTFzn_XoL2xDJ", + "source": { + "@timestamp": "2018-11-27T00:10:35.006Z", + "event": { + "type": "user_err", + "action": "error", + "module": "auditd", + "category": "user-login" + }, + "user": { + "uid": "0", + "auid": "unset", + "name_map": { + "uid": "root" + } + }, + "beat": { + "name": "demo-stack-mysql-01", + "hostname": "demo-stack-mysql-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-mysql-01" + }, + "process": { + "pid": "12250", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "177.206.128.131" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "sequence": 43094, + "result": "fail", + "session": "unset", + "data": { + "terminal": "ssh", + "op": "PAM:bad_ident", + "hostname": "177.206.128.131" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "root" + }, + "object": { + "primary": "ssh", + "secondary": "177.206.128.131", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + } + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "cdCCUmcBTFzn_XoLBilE", + "source": { + "@timestamp": "2018-11-27T00:11:51.257Z", + "beat": { + "name": "demo-stack-mysql-01", + "hostname": "demo-stack-mysql-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-mysql-01" + }, + "source": { + "ip": "142.93.109.33" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "summary": { + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + }, + "object": { + "primary": "sshd", + "secondary": "142.93.109.33", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 43098, + "result": "fail", + "session": "unset", + "data": { + "op": "login", + "terminal": "sshd", + "acct": "(unknown user)" + } + }, + "event": { + "action": "logged-in", + "module": "auditd", + "category": "user-login", + "type": "user_login" + }, + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + }, + "process": { + "pid": "12259", + "exe": "/usr/sbin/sshd" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "ctCCUmcBTFzn_XoLBilE", + "source": { + "@timestamp": "2018-11-27T00:11:51.257Z", + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "pid": "12259", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "142.93.109.33" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "session": "unset", + "data": { + "terminal": "sshd", + "op": "login", + "acct": "(invalid user)" + }, + "summary": { + "actor": { + "secondary": "(invalid user)", + "primary": "unset" + }, + "object": { + "secondary": "142.93.109.33", + "type": "user-session", + "primary": "sshd" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 43099, + "result": "fail" + }, + "host": { + "name": "demo-stack-mysql-01" + }, + "beat": { + "name": "demo-stack-mysql-01", + "hostname": "demo-stack-mysql-01", + "version": "7.0.0-alpha1" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "c9CCUmcBTFzn_XoLBilE", + "source": { + "@timestamp": "2018-11-27T00:11:51.365Z", + "host": { + "name": "demo-stack-mysql-01" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "pid": "12259", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "142.93.109.33" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "summary": { + "actor": { + "primary": "unset", + "secondary": "root" + }, + "object": { + "type": "user-session", + "primary": "ssh", + "secondary": "142.93.109.33" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 43100, + "result": "fail", + "session": "unset", + "data": { + "op": "PAM:bad_ident", + "hostname": "142.93.109.33", + "terminal": "ssh" + } + }, + "event": { + "category": "user-login", + "type": "user_err", + "action": "error", + "module": "auditd" + }, + "beat": { + "name": "demo-stack-mysql-01", + "hostname": "demo-stack-mysql-01", + "version": "7.0.0-alpha1" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "5NCHUmcBTFzn_XoLiqIH", + "source": { + "@timestamp": "2018-11-27T00:17:52.669Z", + "beat": { + "name": "demo-stack-nginx-01", + "hostname": "demo-stack-nginx-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-nginx-01" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "sequence": 192414, + "result": "fail", + "session": "unset", + "data": { + "op": "login", + "acct": "(unknown user)", + "terminal": "sshd" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + }, + "object": { + "primary": "sshd", + "secondary": "161.132.195.76", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + } + }, + "event": { + "module": "auditd", + "category": "user-login", + "type": "user_login", + "action": "logged-in" + }, + "user": { + "name_map": { + "uid": "root" + }, + "auid": "unset", + "uid": "0" + }, + "process": { + "pid": "32116", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "161.132.195.76" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "5dCHUmcBTFzn_XoLiqIH", + "source": { + "@timestamp": "2018-11-27T00:17:52.670Z", + "beat": { + "name": "demo-stack-nginx-01", + "hostname": "demo-stack-nginx-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-nginx-01" + }, + "event": { + "action": "logged-in", + "module": "auditd", + "category": "user-login", + "type": "user_login" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "pid": "32116", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "161.132.195.76" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "summary": { + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + }, + "object": { + "type": "user-session", + "primary": "sshd", + "secondary": "161.132.195.76" + } + }, + "sequence": 192415, + "result": "fail", + "session": "unset", + "data": { + "acct": "(invalid user)", + "terminal": "sshd", + "op": "login" + } + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "5tCHUmcBTFzn_XoLiqIH", + "source": { + "@timestamp": "2018-11-27T00:17:52.776Z", + "user": { + "auid": "unset", + "uid": "0", + "name_map": { + "uid": "root" + } + }, + "process": { + "exe": "/usr/sbin/sshd", + "pid": "32116" + }, + "source": { + "ip": "161.132.195.76" + }, + "network": { + "direction": "incoming" + }, + "beat": { + "name": "demo-stack-nginx-01", + "hostname": "demo-stack-nginx-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-nginx-01" + }, + "auditd": { + "summary": { + "object": { + "primary": "ssh", + "secondary": "161.132.195.76", + "type": "user-session" + }, + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "root" + } + }, + "sequence": 192416, + "result": "fail", + "session": "unset", + "data": { + "op": "PAM:bad_ident", + "hostname": "161.132.195.76", + "terminal": "ssh" + } + }, + "event": { + "module": "auditd", + "category": "user-login", + "type": "user_err", + "action": "error" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "q9CHUmcBTFzn_XoLj6PQ", + "source": { + "@timestamp": "2018-11-27T00:17:54.150Z", + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "exe": "/usr/sbin/sshd", + "pid": "31844" + }, + "source": { + "ip": "202.175.83.165" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "session": "unset", + "data": { + "terminal": "sshd", + "op": "login", + "acct": "(unknown user)" + }, + "summary": { + "actor": { + "secondary": "(unknown user)", + "primary": "unset" + }, + "object": { + "type": "user-session", + "primary": "sshd", + "secondary": "202.175.83.165" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 186236, + "result": "fail" + }, + "event": { + "type": "user_login", + "action": "logged-in", + "module": "auditd", + "category": "user-login" + }, + "beat": { + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-redis-01" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "rNCHUmcBTFzn_XoLj6PQ", + "source": { + "@timestamp": "2018-11-27T00:17:54.151Z", + "host": { + "name": "demo-stack-redis-01" + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "exe": "/usr/sbin/sshd", + "pid": "31844" + }, + "source": { + "ip": "202.175.83.165" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "sequence": 186237, + "result": "fail", + "session": "unset", + "data": { + "acct": "(invalid user)", + "terminal": "sshd", + "op": "login" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + }, + "object": { + "primary": "sshd", + "secondary": "202.175.83.165", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + } + }, + "beat": { + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1", + "name": "demo-stack-redis-01" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "rdCHUmcBTFzn_XoLj6PQ", + "source": { + "@timestamp": "2018-11-27T00:17:54.333Z", + "event": { + "module": "auditd", + "category": "user-login", + "type": "user_err", + "action": "error" + }, + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + }, + "process": { + "exe": "/usr/sbin/sshd", + "pid": "31844" + }, + "source": { + "ip": "202.175.83.165" + }, + "beat": { + "version": "7.0.0-alpha1", + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01" + }, + "host": { + "name": "demo-stack-redis-01" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "sequence": 186238, + "result": "fail", + "session": "unset", + "data": { + "hostname": "202.175.83.165", + "op": "PAM:bad_ident", + "terminal": "ssh" + }, + "summary": { + "actor": { + "secondary": "root", + "primary": "unset" + }, + "object": { + "primary": "ssh", + "secondary": "202.175.83.165", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + } + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "NNCHUmcBTFzn_XoLkqTG", + "source": { + "@timestamp": "2018-11-27T00:17:54.909Z", + "user": { + "auid": "unset", + "uid": "0", + "name_map": { + "uid": "root" + } + }, + "process": { + "pid": "32118", + "exe": "/usr/sbin/sshd" + }, + "beat": { + "name": "demo-stack-nginx-01", + "hostname": "demo-stack-nginx-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-nginx-01" + }, + "source": { + "ip": "128.199.107.237" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "data": { + "op": "login", + "terminal": "sshd", + "acct": "(unknown user)" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + }, + "object": { + "primary": "sshd", + "secondary": "128.199.107.237", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 192417, + "result": "fail", + "session": "unset" + }, + "event": { + "module": "auditd", + "category": "user-login", + "type": "user_login", + "action": "logged-in" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "NdCHUmcBTFzn_XoLkqTG", + "source": { + "@timestamp": "2018-11-27T00:17:54.910Z", + "source": { + "ip": "128.199.107.237" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "data": { + "op": "login", + "acct": "(invalid user)", + "terminal": "sshd" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + }, + "object": { + "primary": "sshd", + "secondary": "128.199.107.237", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 192418, + "result": "fail", + "session": "unset" + }, + "event": { + "module": "auditd", + "category": "user-login", + "type": "user_login", + "action": "logged-in" + }, + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + }, + "process": { + "pid": "32118", + "exe": "/usr/sbin/sshd" + }, + "beat": { + "name": "demo-stack-nginx-01", + "hostname": "demo-stack-nginx-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-nginx-01" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "NtCHUmcBTFzn_XoLkqTG", + "source": { + "@timestamp": "2018-11-27T00:17:55.100Z", + "beat": { + "name": "demo-stack-nginx-01", + "hostname": "demo-stack-nginx-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-nginx-01" + }, + "source": { + "ip": "128.199.107.237" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "result": "fail", + "session": "unset", + "data": { + "hostname": "128.199.107.237", + "terminal": "ssh", + "op": "PAM:bad_ident" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "root" + }, + "object": { + "primary": "ssh", + "secondary": "128.199.107.237", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 192419 + }, + "event": { + "category": "user-login", + "type": "user_err", + "action": "error", + "module": "auditd" + }, + "user": { + "auid": "unset", + "uid": "0", + "name_map": { + "uid": "root" + } + }, + "process": { + "pid": "32118", + "exe": "/usr/sbin/sshd" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "P9CHUmcBTFzn_XoLmKRB", + "source": { + "@timestamp": "2018-11-27T00:17:56.311Z", + "host": { + "name": "demo-stack-nginx-01" + }, + "auditd": { + "data": { + "terminal": "sshd", + "acct": "(unknown user)", + "op": "login" + }, + "summary": { + "actor": { + "secondary": "(unknown user)", + "primary": "unset" + }, + "object": { + "secondary": "197.149.137.86", + "type": "user-session", + "primary": "sshd" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 192420, + "result": "fail", + "session": "unset" + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + }, + "user": { + "auid": "unset", + "uid": "0", + "name_map": { + "uid": "root" + } + }, + "process": { + "pid": "32120", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "197.149.137.86" + }, + "network": { + "direction": "incoming" + }, + "beat": { + "hostname": "demo-stack-nginx-01", + "version": "7.0.0-alpha1", + "name": "demo-stack-nginx-01" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "QNCHUmcBTFzn_XoLmKRB", + "source": { + "@timestamp": "2018-11-27T00:17:56.312Z", + "auditd": { + "session": "unset", + "data": { + "op": "login", + "acct": "(invalid user)", + "terminal": "sshd" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + }, + "object": { + "primary": "sshd", + "secondary": "197.149.137.86", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 192421, + "result": "fail" + }, + "beat": { + "name": "demo-stack-nginx-01", + "hostname": "demo-stack-nginx-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-nginx-01" + }, + "event": { + "action": "logged-in", + "module": "auditd", + "category": "user-login", + "type": "user_login" + }, + "user": { + "uid": "0", + "auid": "unset", + "name_map": { + "uid": "root" + } + }, + "process": { + "pid": "32120", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "197.149.137.86" + }, + "network": { + "direction": "incoming" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "QdCHUmcBTFzn_XoLmKRB", + "source": { + "@timestamp": "2018-11-27T00:17:56.547Z", + "network": { + "direction": "incoming" + }, + "auditd": { + "result": "fail", + "session": "unset", + "data": { + "op": "PAM:bad_ident", + "hostname": "197.149.137.86", + "terminal": "ssh" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "root" + }, + "object": { + "type": "user-session", + "primary": "ssh", + "secondary": "197.149.137.86" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 192422 + }, + "event": { + "category": "user-login", + "type": "user_err", + "action": "error", + "module": "auditd" + }, + "host": { + "name": "demo-stack-nginx-01" + }, + "beat": { + "name": "demo-stack-nginx-01", + "hostname": "demo-stack-nginx-01", + "version": "7.0.0-alpha1" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "exe": "/usr/sbin/sshd", + "pid": "32120" + }, + "source": { + "ip": "197.149.137.86" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "kNCIUmcBTFzn_XoL68Ge", + "source": { + "@timestamp": "2018-11-27T00:19:23.188Z", + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + }, + "process": { + "exe": "/usr/sbin/sshd", + "pid": "31854" + }, + "source": { + "ip": "165.227.63.250" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "data": { + "op": "login", + "acct": "(unknown user)", + "terminal": "sshd" + }, + "summary": { + "actor": { + "secondary": "(unknown user)", + "primary": "unset" + }, + "object": { + "primary": "sshd", + "secondary": "165.227.63.250", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 186242, + "result": "fail", + "session": "unset" + }, + "host": { + "name": "demo-stack-redis-01" + }, + "beat": { + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1" + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "kdCIUmcBTFzn_XoL68Ge", + "source": { + "@timestamp": "2018-11-27T00:19:23.189Z", + "process": { + "pid": "31854", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "165.227.63.250" + }, + "network": { + "direction": "incoming" + }, + "beat": { + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-redis-01" + }, + "auditd": { + "result": "fail", + "session": "unset", + "data": { + "op": "login", + "terminal": "sshd", + "acct": "(invalid user)" + }, + "summary": { + "actor": { + "secondary": "(invalid user)", + "primary": "unset" + }, + "object": { + "secondary": "165.227.63.250", + "type": "user-session", + "primary": "sshd" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 186243 + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "ktCIUmcBTFzn_XoL68Ge", + "source": { + "@timestamp": "2018-11-27T00:19:23.230Z", + "event": { + "type": "user_err", + "action": "error", + "module": "auditd", + "category": "user-login" + }, + "beat": { + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-redis-01" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "pid": "31854", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "165.227.63.250" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "session": "unset", + "data": { + "terminal": "ssh", + "hostname": "165.227.63.250", + "op": "PAM:bad_ident" + }, + "summary": { + "actor": { + "secondary": "root", + "primary": "unset" + }, + "object": { + "secondary": "165.227.63.250", + "type": "user-session", + "primary": "ssh" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 186244, + "result": "fail" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "7tCIUmcBTFzn_XoL_MPx", + "source": { + "@timestamp": "2018-11-27T00:19:27.623Z", + "beat": { + "name": "demo-stack-apache-01", + "hostname": "demo-stack-apache-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-apache-01" + }, + "process": { + "exe": "/usr/sbin/sshd", + "pid": "24879" + }, + "source": { + "ip": "185.137.92.168" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "result": "fail", + "session": "unset", + "data": { + "acct": "(unknown user)", + "terminal": "sshd", + "op": "login" + }, + "summary": { + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + }, + "object": { + "type": "user-session", + "primary": "sshd", + "secondary": "185.137.92.168" + } + }, + "sequence": 184264 + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + }, + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "79CIUmcBTFzn_XoL_MPx", + "source": { + "@timestamp": "2018-11-27T00:19:27.624Z", + "host": { + "name": "demo-stack-apache-01" + }, + "beat": { + "version": "7.0.0-alpha1", + "name": "demo-stack-apache-01", + "hostname": "demo-stack-apache-01" + }, + "user": { + "name_map": { + "uid": "root" + }, + "uid": "0", + "auid": "unset" + }, + "process": { + "pid": "24879", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "185.137.92.168" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "result": "fail", + "session": "unset", + "data": { + "op": "login", + "acct": "(invalid user)", + "terminal": "sshd" + }, + "summary": { + "actor": { + "secondary": "(invalid user)", + "primary": "unset" + }, + "object": { + "primary": "sshd", + "secondary": "185.137.92.168", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 184265 + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "8NCIUmcBTFzn_XoL_MPx", + "source": { + "@timestamp": "2018-11-27T00:19:27.733Z", + "host": { + "name": "demo-stack-apache-01" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "pid": "24879", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "185.137.92.168" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "data": { + "op": "PAM:bad_ident", + "terminal": "ssh", + "hostname": "185.137.92.168" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "root" + }, + "object": { + "type": "user-session", + "primary": "ssh", + "secondary": "185.137.92.168" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 184266, + "result": "fail", + "session": "unset" + }, + "event": { + "category": "user-login", + "type": "user_err", + "action": "error", + "module": "auditd" + }, + "beat": { + "name": "demo-stack-apache-01", + "hostname": "demo-stack-apache-01", + "version": "7.0.0-alpha1" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "sdCJUmcBTFzn_XoLMcci", + "source": { + "@timestamp": "2018-11-27T00:19:40.983Z", + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + }, + "process": { + "pid": "31857", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "185.58.119.156" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "sequence": 186245, + "result": "fail", + "session": "unset", + "data": { + "op": "login", + "acct": "(unknown user)", + "terminal": "sshd" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + }, + "object": { + "type": "user-session", + "primary": "sshd", + "secondary": "185.58.119.156" + }, + "how": "/usr/sbin/sshd" + } + }, + "event": { + "type": "user_login", + "action": "logged-in", + "module": "auditd", + "category": "user-login" + }, + "host": { + "name": "demo-stack-redis-01" + }, + "beat": { + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1", + "name": "demo-stack-redis-01" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "stCJUmcBTFzn_XoLMcci", + "source": { + "@timestamp": "2018-11-27T00:19:40.984Z", + "source": { + "ip": "185.58.119.156" + }, + "network": { + "direction": "incoming" + }, + "beat": { + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-redis-01" + }, + "auditd": { + "summary": { + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + }, + "object": { + "type": "user-session", + "primary": "sshd", + "secondary": "185.58.119.156" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 186246, + "result": "fail", + "session": "unset", + "data": { + "terminal": "sshd", + "acct": "(invalid user)", + "op": "login" + } + }, + "event": { + "action": "logged-in", + "module": "auditd", + "category": "user-login", + "type": "user_login" + }, + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + }, + "process": { + "pid": "31857", + "exe": "/usr/sbin/sshd" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "s9CJUmcBTFzn_XoLMcci", + "source": { + "@timestamp": "2018-11-27T00:19:41.111Z", + "user": { + "name_map": { + "uid": "root" + }, + "uid": "0", + "auid": "unset" + }, + "process": { + "pid": "31857", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "185.58.119.156" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "sequence": 186247, + "result": "fail", + "session": "unset", + "data": { + "op": "PAM:bad_ident", + "hostname": "185.58.119.156", + "terminal": "ssh" + }, + "summary": { + "actor": { + "secondary": "root", + "primary": "unset" + }, + "object": { + "secondary": "185.58.119.156", + "type": "user-session", + "primary": "ssh" + }, + "how": "/usr/sbin/sshd" + } + }, + "host": { + "name": "demo-stack-redis-01" + }, + "beat": { + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1" + }, + "event": { + "type": "user_err", + "action": "error", + "module": "auditd", + "category": "user-login" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "RdCJUmcBTFzn_XoLOcgJ", + "source": { + "@timestamp": "2018-11-27T00:19:43.008Z", + "auditd": { + "summary": { + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + }, + "object": { + "type": "user-session", + "primary": "sshd", + "secondary": "201.134.231.33" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 186248, + "result": "fail", + "session": "unset", + "data": { + "acct": "(unknown user)", + "terminal": "sshd", + "op": "login" + } + }, + "beat": { + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-redis-01" + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + }, + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + }, + "process": { + "pid": "31859", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "201.134.231.33" + }, + "network": { + "direction": "incoming" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "RtCJUmcBTFzn_XoLOcgJ", + "source": { + "@timestamp": "2018-11-27T00:19:43.009Z", + "process": { + "pid": "31859", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "201.134.231.33" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "session": "unset", + "data": { + "op": "login", + "acct": "(invalid user)", + "terminal": "sshd" + }, + "summary": { + "object": { + "secondary": "201.134.231.33", + "type": "user-session", + "primary": "sshd" + }, + "how": "/usr/sbin/sshd", + "actor": { + "secondary": "(invalid user)", + "primary": "unset" + } + }, + "sequence": 186249, + "result": "fail" + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "beat": { + "version": "7.0.0-alpha1", + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01" + }, + "host": { + "name": "demo-stack-redis-01" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "R9CJUmcBTFzn_XoLOcgJ", + "source": { + "@timestamp": "2018-11-27T00:19:43.074Z", + "network": { + "direction": "incoming" + }, + "beat": { + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-redis-01" + }, + "auditd": { + "summary": { + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "root" + }, + "object": { + "secondary": "201.134.231.33", + "type": "user-session", + "primary": "ssh" + } + }, + "sequence": 186250, + "result": "fail", + "session": "unset", + "data": { + "op": "PAM:bad_ident", + "hostname": "201.134.231.33", + "terminal": "ssh" + } + }, + "event": { + "action": "error", + "module": "auditd", + "category": "user-login", + "type": "user_err" + }, + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + }, + "process": { + "pid": "31859", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "201.134.231.33" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "rtCGUmcBTFzn_XoL3pS1", + "source": { + "@timestamp": "2018-11-27T00:17:08.809Z", + "host": { + "name": "demo-stack-nginx-01" + }, + "process": { + "exe": "/usr/sbin/sshd", + "pid": "32108" + }, + "source": { + "ip": "220.116.47.116" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "data": { + "op": "login", + "acct": "(unknown user)", + "terminal": "sshd" + }, + "summary": { + "actor": { + "secondary": "(unknown user)", + "primary": "unset" + }, + "object": { + "primary": "sshd", + "secondary": "220.116.47.116", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 192411, + "result": "fail", + "session": "unset" + }, + "event": { + "module": "auditd", + "category": "user-login", + "type": "user_login", + "action": "logged-in" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "beat": { + "hostname": "demo-stack-nginx-01", + "version": "7.0.0-alpha1", + "name": "demo-stack-nginx-01" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "r9CGUmcBTFzn_XoL3pS1", + "source": { + "@timestamp": "2018-11-27T00:17:08.810Z", + "network": { + "direction": "incoming" + }, + "auditd": { + "data": { + "op": "login", + "terminal": "sshd", + "acct": "(invalid user)" + }, + "summary": { + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + }, + "object": { + "primary": "sshd", + "secondary": "220.116.47.116", + "type": "user-session" + } + }, + "sequence": 192412, + "result": "fail", + "session": "unset" + }, + "beat": { + "version": "7.0.0-alpha1", + "name": "demo-stack-nginx-01", + "hostname": "demo-stack-nginx-01" + }, + "host": { + "name": "demo-stack-nginx-01" + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + }, + "user": { + "auid": "unset", + "uid": "0", + "name_map": { + "uid": "root" + } + }, + "process": { + "exe": "/usr/sbin/sshd", + "pid": "32108" + }, + "source": { + "ip": "220.116.47.116" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "sNCGUmcBTFzn_XoL3pS1", + "source": { + "@timestamp": "2018-11-27T00:17:08.983Z", + "source": { + "ip": "220.116.47.116" + }, + "beat": { + "name": "demo-stack-nginx-01", + "hostname": "demo-stack-nginx-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-nginx-01" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "session": "unset", + "data": { + "terminal": "ssh", + "hostname": "220.116.47.116", + "op": "PAM:bad_ident" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "root" + }, + "object": { + "primary": "ssh", + "secondary": "220.116.47.116", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 192413, + "result": "fail" + }, + "event": { + "category": "user-login", + "type": "user_err", + "action": "error", + "module": "auditd" + }, + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + }, + "process": { + "pid": "32108", + "exe": "/usr/sbin/sshd" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "rNCIUmcBTFzn_XoLa7Yh", + "source": { + "@timestamp": "2018-11-27T00:18:50.295Z", + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + }, + "user": { + "uid": "0", + "auid": "unset", + "name_map": { + "uid": "root" + } + }, + "process": { + "exe": "/usr/sbin/sshd", + "pid": "24869" + }, + "source": { + "ip": "222.117.50.66" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "data": { + "acct": "(unknown user)", + "terminal": "sshd", + "op": "login" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + }, + "object": { + "type": "user-session", + "primary": "sshd", + "secondary": "222.117.50.66" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 184258, + "result": "fail", + "session": "unset" + }, + "beat": { + "name": "demo-stack-apache-01", + "hostname": "demo-stack-apache-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-apache-01" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "rdCIUmcBTFzn_XoLa7Yh", + "source": { + "@timestamp": "2018-11-27T00:18:50.297Z", + "process": { + "pid": "24869", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "222.117.50.66" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "result": "fail", + "session": "unset", + "data": { + "op": "login", + "terminal": "sshd", + "acct": "(invalid user)" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + }, + "object": { + "primary": "sshd", + "secondary": "222.117.50.66", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 184259 + }, + "event": { + "action": "logged-in", + "module": "auditd", + "category": "user-login", + "type": "user_login" + }, + "beat": { + "name": "demo-stack-apache-01", + "hostname": "demo-stack-apache-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-apache-01" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "rtCIUmcBTFzn_XoLa7Yh", + "source": { + "@timestamp": "2018-11-27T00:18:50.462Z", + "beat": { + "version": "7.0.0-alpha1", + "name": "demo-stack-apache-01", + "hostname": "demo-stack-apache-01" + }, + "host": { + "name": "demo-stack-apache-01" + }, + "auditd": { + "session": "unset", + "data": { + "terminal": "ssh", + "hostname": "222.117.50.66", + "op": "PAM:bad_ident" + }, + "summary": { + "object": { + "primary": "ssh", + "secondary": "222.117.50.66", + "type": "user-session" + }, + "how": "/usr/sbin/sshd", + "actor": { + "secondary": "root", + "primary": "unset" + } + }, + "sequence": 184260, + "result": "fail" + }, + "event": { + "action": "error", + "module": "auditd", + "category": "user-login", + "type": "user_err" + }, + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + }, + "process": { + "pid": "24869", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "222.117.50.66" + }, + "network": { + "direction": "incoming" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "SNCIUmcBTFzn_XoLeri8", + "source": { + "@timestamp": "2018-11-27T00:18:54.288Z", + "source": { + "ip": "46.148.18.163" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "sequence": 186239, + "result": "fail", + "session": "unset", + "data": { + "op": "login", + "acct": "(unknown user)", + "terminal": "sshd" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + }, + "object": { + "primary": "sshd", + "secondary": "46.148.18.163", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + } + }, + "beat": { + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1", + "name": "demo-stack-redis-01" + }, + "host": { + "name": "demo-stack-redis-01" + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + }, + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + }, + "process": { + "pid": "31851", + "exe": "/usr/sbin/sshd" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "SdCIUmcBTFzn_XoLeri8", + "source": { + "@timestamp": "2018-11-27T00:18:54.289Z", + "host": { + "name": "demo-stack-redis-01" + }, + "beat": { + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1", + "name": "demo-stack-redis-01" + }, + "auditd": { + "sequence": 186240, + "result": "fail", + "session": "unset", + "data": { + "terminal": "sshd", + "acct": "(invalid user)", + "op": "login" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + }, + "object": { + "primary": "sshd", + "secondary": "46.148.18.163", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + } + }, + "event": { + "module": "auditd", + "category": "user-login", + "type": "user_login", + "action": "logged-in" + }, + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + }, + "process": { + "pid": "31851", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "46.148.18.163" + }, + "network": { + "direction": "incoming" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "StCIUmcBTFzn_XoLeri8", + "source": { + "@timestamp": "2018-11-27T00:18:54.436Z", + "process": { + "exe": "/usr/sbin/sshd", + "pid": "31851" + }, + "source": { + "ip": "46.148.18.163" + }, + "network": { + "direction": "incoming" + }, + "beat": { + "version": "7.0.0-alpha1", + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01" + }, + "host": { + "name": "demo-stack-redis-01" + }, + "auditd": { + "result": "fail", + "session": "unset", + "data": { + "hostname": "46.148.18.163", + "op": "PAM:bad_ident", + "terminal": "ssh" + }, + "summary": { + "object": { + "primary": "ssh", + "secondary": "46.148.18.163", + "type": "user-session" + }, + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "root" + } + }, + "sequence": 186241 + }, + "event": { + "category": "user-login", + "type": "user_err", + "action": "error", + "module": "auditd" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "Z9CJUmcBTFzn_XoLDcR_", + "source": { + "@timestamp": "2018-11-27T00:19:31.861Z", + "source": { + "ip": "85.234.34.90" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "summary": { + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + }, + "object": { + "secondary": "85.234.34.90", + "type": "user-session", + "primary": "sshd" + } + }, + "sequence": 184267, + "result": "fail", + "session": "unset", + "data": { + "op": "login", + "acct": "(unknown user)", + "terminal": "sshd" + } + }, + "beat": { + "name": "demo-stack-apache-01", + "hostname": "demo-stack-apache-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-apache-01" + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + }, + "user": { + "name_map": { + "uid": "root" + }, + "auid": "unset", + "uid": "0" + }, + "process": { + "pid": "24881", + "exe": "/usr/sbin/sshd" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "aNCJUmcBTFzn_XoLDcR_", + "source": { + "@timestamp": "2018-11-27T00:19:31.862Z", + "auditd": { + "summary": { + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + }, + "object": { + "primary": "sshd", + "secondary": "85.234.34.90", + "type": "user-session" + } + }, + "sequence": 184268, + "result": "fail", + "session": "unset", + "data": { + "terminal": "sshd", + "op": "login", + "acct": "(invalid user)" + } + }, + "event": { + "type": "user_login", + "action": "logged-in", + "module": "auditd", + "category": "user-login" + }, + "beat": { + "version": "7.0.0-alpha1", + "name": "demo-stack-apache-01", + "hostname": "demo-stack-apache-01" + }, + "host": { + "name": "demo-stack-apache-01" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "exe": "/usr/sbin/sshd", + "pid": "24881" + }, + "source": { + "ip": "85.234.34.90" + }, + "network": { + "direction": "incoming" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "adCJUmcBTFzn_XoLDcR_", + "source": { + "@timestamp": "2018-11-27T00:19:32.020Z", + "source": { + "ip": "85.234.34.90" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "data": { + "terminal": "ssh", + "hostname": "85.234.34.90", + "op": "PAM:bad_ident" + }, + "summary": { + "object": { + "primary": "ssh", + "secondary": "85.234.34.90", + "type": "user-session" + }, + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "root" + } + }, + "sequence": 184269, + "result": "fail", + "session": "unset" + }, + "beat": { + "name": "demo-stack-apache-01", + "hostname": "demo-stack-apache-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-apache-01" + }, + "event": { + "action": "error", + "module": "auditd", + "category": "user-login", + "type": "user_err" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "exe": "/usr/sbin/sshd", + "pid": "24881" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "OtCIUmcBTFzn_XoL08CH", + "source": { + "@timestamp": "2018-11-27T00:19:17.019Z", + "beat": { + "name": "demo-stack-apache-01", + "hostname": "demo-stack-apache-01", + "version": "7.0.0-alpha1" + }, + "event": { + "action": "logged-in", + "module": "auditd", + "category": "user-login", + "type": "user_login" + }, + "user": { + "auid": "unset", + "uid": "0", + "name_map": { + "uid": "root" + } + }, + "process": { + "pid": "24877", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "27.254.90.106" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "result": "fail", + "session": "unset", + "data": { + "acct": "(unknown user)", + "op": "login", + "terminal": "sshd" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + }, + "object": { + "secondary": "27.254.90.106", + "type": "user-session", + "primary": "sshd" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 184261 + }, + "host": { + "name": "demo-stack-apache-01" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "O9CIUmcBTFzn_XoL08CH", + "source": { + "@timestamp": "2018-11-27T00:19:17.020Z", + "source": { + "ip": "27.254.90.106" + }, + "beat": { + "name": "demo-stack-apache-01", + "hostname": "demo-stack-apache-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-apache-01" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "sequence": 184262, + "result": "fail", + "session": "unset", + "data": { + "acct": "(invalid user)", + "terminal": "sshd", + "op": "login" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + }, + "object": { + "primary": "sshd", + "secondary": "27.254.90.106", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + } + }, + "event": { + "action": "logged-in", + "module": "auditd", + "category": "user-login", + "type": "user_login" + }, + "user": { + "auid": "unset", + "uid": "0", + "name_map": { + "uid": "root" + } + }, + "process": { + "pid": "24877", + "exe": "/usr/sbin/sshd" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "PNCIUmcBTFzn_XoL08CH", + "source": { + "@timestamp": "2018-11-27T00:19:17.244Z", + "auditd": { + "result": "fail", + "session": "unset", + "data": { + "op": "PAM:bad_ident", + "hostname": "27.254.90.106", + "terminal": "ssh" + }, + "summary": { + "object": { + "primary": "ssh", + "secondary": "27.254.90.106", + "type": "user-session" + }, + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "root" + } + }, + "sequence": 184263 + }, + "beat": { + "name": "demo-stack-apache-01", + "hostname": "demo-stack-apache-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-apache-01" + }, + "event": { + "module": "auditd", + "category": "user-login", + "type": "user_err", + "action": "error" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "pid": "24877", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "27.254.90.106" + }, + "network": { + "direction": "incoming" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "_dCJUmcBTFzn_XoLv9T4", + "source": { + "@timestamp": "2018-11-27T00:20:17.545Z", + "auditd": { + "sequence": 44088, + "result": "fail", + "session": "unset", + "data": { + "acct": "(unknown user)", + "terminal": "sshd", + "op": "login" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + }, + "object": { + "primary": "sshd", + "secondary": "87.191.133.16", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + } + }, + "event": { + "type": "user_login", + "action": "logged-in", + "module": "auditd", + "category": "user-login" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "beat": { + "name": "demo-stack-es-01", + "hostname": "demo-stack-es-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-es-01" + }, + "process": { + "pid": "28146", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "87.191.133.16" + }, + "network": { + "direction": "incoming" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "_tCJUmcBTFzn_XoLv9T4", + "source": { + "@timestamp": "2018-11-27T00:20:17.545Z", + "process": { + "exe": "/usr/sbin/sshd", + "pid": "28146" + }, + "source": { + "ip": "87.191.133.16" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "data": { + "op": "login", + "acct": "(invalid user)", + "terminal": "sshd" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + }, + "object": { + "primary": "sshd", + "secondary": "87.191.133.16", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 44089, + "result": "fail", + "session": "unset" + }, + "event": { + "type": "user_login", + "action": "logged-in", + "module": "auditd", + "category": "user-login" + }, + "beat": { + "hostname": "demo-stack-es-01", + "version": "7.0.0-alpha1", + "name": "demo-stack-es-01" + }, + "host": { + "name": "demo-stack-es-01" + }, + "user": { + "auid": "unset", + "uid": "0", + "name_map": { + "uid": "root" + } + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "_9CJUmcBTFzn_XoLv9T4", + "source": { + "@timestamp": "2018-11-27T00:20:17.665Z", + "network": { + "direction": "incoming" + }, + "auditd": { + "session": "unset", + "data": { + "hostname": "87.191.133.16", + "op": "PAM:bad_ident", + "terminal": "ssh" + }, + "summary": { + "object": { + "secondary": "87.191.133.16", + "type": "user-session", + "primary": "ssh" + }, + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "root" + } + }, + "sequence": 44090, + "result": "fail" + }, + "event": { + "category": "user-login", + "type": "user_err", + "action": "error", + "module": "auditd" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "pid": "28146", + "exe": "/usr/sbin/sshd" + }, + "host": { + "name": "demo-stack-es-01" + }, + "beat": { + "hostname": "demo-stack-es-01", + "version": "7.0.0-alpha1", + "name": "demo-stack-es-01" + }, + "source": { + "ip": "87.191.133.16" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "xtGOUmcBTFzn_XoLCjLw", + "source": { + "@timestamp": "2018-11-27T00:24:58.886Z", + "host": { + "name": "demo-stack-apache-01" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "pid": "24919", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "178.128.55.52" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "sequence": 184276, + "result": "fail", + "session": "unset", + "data": { + "op": "login", + "acct": "(unknown user)", + "terminal": "sshd" + }, + "summary": { + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + }, + "object": { + "primary": "sshd", + "secondary": "178.128.55.52", + "type": "user-session" + } + } + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + }, + "beat": { + "hostname": "demo-stack-apache-01", + "version": "7.0.0-alpha1", + "name": "demo-stack-apache-01" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "x9GOUmcBTFzn_XoLCjLw", + "source": { + "@timestamp": "2018-11-27T00:24:58.888Z", + "beat": { + "name": "demo-stack-apache-01", + "hostname": "demo-stack-apache-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-apache-01" + }, + "source": { + "ip": "178.128.55.52" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "sequence": 184277, + "result": "fail", + "session": "unset", + "data": { + "acct": "(invalid user)", + "terminal": "sshd", + "op": "login" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + }, + "object": { + "secondary": "178.128.55.52", + "type": "user-session", + "primary": "sshd" + }, + "how": "/usr/sbin/sshd" + } + }, + "event": { + "module": "auditd", + "category": "user-login", + "type": "user_login", + "action": "logged-in" + }, + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + }, + "process": { + "pid": "24919", + "exe": "/usr/sbin/sshd" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "yNGOUmcBTFzn_XoLCjLw", + "source": { + "@timestamp": "2018-11-27T00:24:59.080Z", + "beat": { + "name": "demo-stack-apache-01", + "hostname": "demo-stack-apache-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-apache-01" + }, + "event": { + "category": "user-login", + "type": "user_err", + "action": "error", + "module": "auditd" + }, + "user": { + "auid": "unset", + "uid": "0", + "name_map": { + "uid": "root" + } + }, + "process": { + "pid": "24919", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "178.128.55.52" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "result": "fail", + "session": "unset", + "data": { + "hostname": "178.128.55.52", + "terminal": "ssh", + "op": "PAM:bad_ident" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "root" + }, + "object": { + "primary": "ssh", + "secondary": "178.128.55.52", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 184278 + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "FtGOUmcBTFzn_XoLEzP0", + "source": { + "@timestamp": "2018-11-27T00:25:01.159Z", + "auditd": { + "session": "unset", + "data": { + "acct": "root", + "op": "PAM:accounting", + "terminal": "cron" + }, + "summary": { + "object": { + "type": "user-session", + "primary": "cron" + }, + "how": "/usr/sbin/cron", + "actor": { + "primary": "unset", + "secondary": "root" + } + }, + "sequence": 44103, + "result": "success" + }, + "beat": { + "name": "demo-stack-es-01", + "hostname": "demo-stack-es-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-es-01" + }, + "event": { + "action": "was-authorized", + "module": "auditd", + "category": "user-login", + "type": "user_acct" + }, + "user": { + "name_map": { + "uid": "root" + }, + "auid": "unset", + "uid": "0" + }, + "process": { + "pid": "28242", + "exe": "/usr/sbin/cron" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "F9GOUmcBTFzn_XoLEzP0", + "source": { + "@timestamp": "2018-11-27T00:25:01.159Z", + "beat": { + "name": "demo-stack-es-01", + "hostname": "demo-stack-es-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-es-01" + }, + "process": { + "pid": "28242", + "exe": "/usr/sbin/cron" + }, + "auditd": { + "sequence": 44104, + "result": "success", + "session": "unset", + "data": { + "terminal": "cron", + "acct": "root", + "op": "PAM:setcred" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "root" + }, + "object": { + "type": "user-session", + "primary": "cron" + }, + "how": "/usr/sbin/cron" + } + }, + "event": { + "category": "user-login", + "type": "cred_acq", + "action": "acquired-credentials", + "module": "auditd" + }, + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "GNGOUmcBTFzn_XoLEzP0", + "source": { + "@timestamp": "2018-11-27T00:25:01.159Z", + "process": { + "pid": "28242", + "exe": "/usr/sbin/cron" + }, + "auditd": { + "summary": { + "actor": { + "primary": "root", + "secondary": "root" + }, + "object": { + "type": "user-session", + "primary": "cron" + }, + "how": "/usr/sbin/cron" + }, + "sequence": 44106, + "result": "success", + "session": "1443", + "data": { + "op": "PAM:session_open", + "terminal": "cron", + "acct": "root" + } + }, + "event": { + "module": "auditd", + "category": "user-login", + "type": "user_start", + "action": "started-session" + }, + "beat": { + "hostname": "demo-stack-es-01", + "version": "7.0.0-alpha1", + "name": "demo-stack-es-01" + }, + "host": { + "name": "demo-stack-es-01" + }, + "user": { + "auid": "0", + "name_map": { + "auid": "root", + "uid": "root" + }, + "uid": "0" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "GdGOUmcBTFzn_XoLEzP0", + "source": { + "@timestamp": "2018-11-27T00:25:01.163Z", + "event": { + "type": "cred_disp", + "action": "disposed-credentials", + "module": "auditd", + "category": "user-login" + }, + "user": { + "auid": "0", + "uid": "0", + "name_map": { + "auid": "root", + "uid": "root" + } + }, + "process": { + "exe": "/usr/sbin/cron", + "pid": "28242" + }, + "auditd": { + "sequence": 44107, + "result": "success", + "session": "1443", + "data": { + "acct": "root", + "op": "PAM:setcred", + "terminal": "cron" + }, + "summary": { + "actor": { + "primary": "root", + "secondary": "root" + }, + "object": { + "type": "user-session", + "primary": "cron" + }, + "how": "/usr/sbin/cron" + } + }, + "beat": { + "hostname": "demo-stack-es-01", + "version": "7.0.0-alpha1", + "name": "demo-stack-es-01" + }, + "host": { + "name": "demo-stack-es-01" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "GtGOUmcBTFzn_XoLEzP0", + "source": { + "@timestamp": "2018-11-27T00:25:01.163Z", + "user": { + "uid": "0", + "name_map": { + "auid": "root", + "uid": "root" + }, + "auid": "0" + }, + "process": { + "pid": "28242", + "exe": "/usr/sbin/cron" + }, + "auditd": { + "sequence": 44108, + "result": "success", + "session": "1443", + "data": { + "terminal": "cron", + "acct": "root", + "op": "PAM:session_close" + }, + "summary": { + "object": { + "type": "user-session", + "primary": "cron" + }, + "how": "/usr/sbin/cron", + "actor": { + "primary": "root", + "secondary": "root" + } + } + }, + "beat": { + "name": "demo-stack-es-01", + "hostname": "demo-stack-es-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-es-01" + }, + "event": { + "type": "user_end", + "action": "ended-session", + "module": "auditd", + "category": "user-login" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "y9GOUmcBTFzn_XoLLTXy", + "source": { + "@timestamp": "2018-11-27T00:25:07.848Z", + "beat": { + "version": "7.0.0-alpha1", + "name": "demo-stack-apache-01", + "hostname": "demo-stack-apache-01" + }, + "host": { + "name": "demo-stack-apache-01" + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + }, + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + }, + "process": { + "exe": "/usr/sbin/sshd", + "pid": "24921" + }, + "source": { + "ip": "78.217.134.141" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "result": "fail", + "session": "unset", + "data": { + "terminal": "sshd", + "acct": "(unknown user)", + "op": "login" + }, + "summary": { + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + }, + "object": { + "primary": "sshd", + "secondary": "78.217.134.141", + "type": "user-session" + } + }, + "sequence": 184279 + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "zNGOUmcBTFzn_XoLLTXy", + "source": { + "@timestamp": "2018-11-27T00:25:07.849Z", + "event": { + "type": "user_login", + "action": "logged-in", + "module": "auditd", + "category": "user-login" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "exe": "/usr/sbin/sshd", + "pid": "24921" + }, + "source": { + "ip": "78.217.134.141" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "result": "fail", + "session": "unset", + "data": { + "op": "login", + "terminal": "sshd", + "acct": "(invalid user)" + }, + "summary": { + "how": "/usr/sbin/sshd", + "actor": { + "secondary": "(invalid user)", + "primary": "unset" + }, + "object": { + "type": "user-session", + "primary": "sshd", + "secondary": "78.217.134.141" + } + }, + "sequence": 184280 + }, + "beat": { + "version": "7.0.0-alpha1", + "name": "demo-stack-apache-01", + "hostname": "demo-stack-apache-01" + }, + "host": { + "name": "demo-stack-apache-01" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "zdGOUmcBTFzn_XoLLTXy", + "source": { + "@timestamp": "2018-11-27T00:25:07.962Z", + "host": { + "name": "demo-stack-apache-01" + }, + "event": { + "module": "auditd", + "category": "user-login", + "type": "user_err", + "action": "error" + }, + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + }, + "process": { + "pid": "24921", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "78.217.134.141" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "session": "unset", + "data": { + "hostname": "78.217.134.141", + "terminal": "ssh", + "op": "PAM:bad_ident" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "root" + }, + "object": { + "secondary": "78.217.134.141", + "type": "user-session", + "primary": "ssh" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 184281, + "result": "fail" + }, + "beat": { + "name": "demo-stack-apache-01", + "hostname": "demo-stack-apache-01", + "version": "7.0.0-alpha1" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "0NGOUmcBTFzn_XoLLjX5", + "source": { + "@timestamp": "2018-11-27T00:25:08.111Z", + "auditd": { + "result": "fail", + "session": "unset", + "data": { + "op": "login", + "terminal": "sshd", + "acct": "(unknown user)" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + }, + "object": { + "primary": "sshd", + "secondary": "151.80.144.39", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 142273 + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + }, + "user": { + "name_map": { + "uid": "root" + }, + "auid": "unset", + "uid": "0" + }, + "process": { + "pid": "19291", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "151.80.144.39" + }, + "beat": { + "name": "demo-stack-haproxy-01", + "hostname": "demo-stack-haproxy-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-haproxy-01" + }, + "network": { + "direction": "incoming" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "0dGOUmcBTFzn_XoLLjX5", + "source": { + "@timestamp": "2018-11-27T00:25:08.112Z", + "process": { + "pid": "19291", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "151.80.144.39" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "sequence": 142274, + "result": "fail", + "session": "unset", + "data": { + "terminal": "sshd", + "op": "login", + "acct": "(invalid user)" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + }, + "object": { + "primary": "sshd", + "secondary": "151.80.144.39", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + } + }, + "beat": { + "name": "demo-stack-haproxy-01", + "hostname": "demo-stack-haproxy-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-haproxy-01" + }, + "event": { + "type": "user_login", + "action": "logged-in", + "module": "auditd", + "category": "user-login" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "0tGOUmcBTFzn_XoLLjX5", + "source": { + "@timestamp": "2018-11-27T00:25:08.218Z", + "auditd": { + "sequence": 142275, + "result": "fail", + "session": "unset", + "data": { + "hostname": "151.80.144.39", + "terminal": "ssh", + "op": "PAM:bad_ident" + }, + "summary": { + "actor": { + "secondary": "root", + "primary": "unset" + }, + "object": { + "primary": "ssh", + "secondary": "151.80.144.39", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + } + }, + "event": { + "action": "error", + "module": "auditd", + "category": "user-login", + "type": "user_err" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "exe": "/usr/sbin/sshd", + "pid": "19291" + }, + "source": { + "ip": "151.80.144.39" + }, + "network": { + "direction": "incoming" + }, + "host": { + "name": "demo-stack-haproxy-01" + }, + "beat": { + "name": "demo-stack-haproxy-01", + "hostname": "demo-stack-haproxy-01", + "version": "7.0.0-alpha1" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "xNGOUmcBTFzn_XoLYDl2", + "source": { + "@timestamp": "2018-11-27T00:25:20.780Z", + "process": { + "pid": "24924", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "104.208.143.92" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "sequence": 184282, + "result": "fail", + "session": "unset", + "data": { + "acct": "(unknown user)", + "terminal": "sshd", + "op": "login" + }, + "summary": { + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + }, + "object": { + "secondary": "104.208.143.92", + "type": "user-session", + "primary": "sshd" + } + } + }, + "beat": { + "version": "7.0.0-alpha1", + "name": "demo-stack-apache-01", + "hostname": "demo-stack-apache-01" + }, + "host": { + "name": "demo-stack-apache-01" + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "xdGOUmcBTFzn_XoLYDl2", + "source": { + "@timestamp": "2018-11-27T00:25:20.781Z", + "process": { + "pid": "24924", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "104.208.143.92" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "sequence": 184283, + "result": "fail", + "session": "unset", + "data": { + "op": "login", + "acct": "(invalid user)", + "terminal": "sshd" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + }, + "object": { + "type": "user-session", + "primary": "sshd", + "secondary": "104.208.143.92" + }, + "how": "/usr/sbin/sshd" + } + }, + "event": { + "action": "logged-in", + "module": "auditd", + "category": "user-login", + "type": "user_login" + }, + "beat": { + "name": "demo-stack-apache-01", + "hostname": "demo-stack-apache-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-apache-01" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "xtGOUmcBTFzn_XoLYDl2", + "source": { + "@timestamp": "2018-11-27T00:25:20.819Z", + "process": { + "pid": "24924", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "104.208.143.92" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "data": { + "hostname": "104.208.143.92", + "terminal": "ssh", + "op": "PAM:bad_ident" + }, + "summary": { + "object": { + "primary": "ssh", + "secondary": "104.208.143.92", + "type": "user-session" + }, + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "root" + } + }, + "sequence": 184284, + "result": "fail", + "session": "unset" + }, + "host": { + "name": "demo-stack-apache-01" + }, + "beat": { + "name": "demo-stack-apache-01", + "hostname": "demo-stack-apache-01", + "version": "7.0.0-alpha1" + }, + "event": { + "type": "user_err", + "action": "error", + "module": "auditd", + "category": "user-login" + }, + "user": { + "auid": "unset", + "uid": "0", + "name_map": { + "uid": "root" + } + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "nNGPUmcBTFzn_XoLF0mX", + "source": { + "@timestamp": "2018-11-27T00:26:07.661Z", + "source": { + "ip": "197.13.4.211" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "result": "fail", + "session": "unset", + "data": { + "acct": "(unknown user)", + "op": "login", + "terminal": "sshd" + }, + "summary": { + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + }, + "object": { + "secondary": "197.13.4.211", + "type": "user-session", + "primary": "sshd" + } + }, + "sequence": 184285 + }, + "event": { + "module": "auditd", + "category": "user-login", + "type": "user_login", + "action": "logged-in" + }, + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + }, + "beat": { + "name": "demo-stack-apache-01", + "hostname": "demo-stack-apache-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-apache-01" + }, + "process": { + "pid": "24931", + "exe": "/usr/sbin/sshd" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "ndGPUmcBTFzn_XoLF0mX", + "source": { + "@timestamp": "2018-11-27T00:26:07.662Z", + "auditd": { + "data": { + "terminal": "sshd", + "acct": "(invalid user)", + "op": "login" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + }, + "object": { + "type": "user-session", + "primary": "sshd", + "secondary": "197.13.4.211" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 184286, + "result": "fail", + "session": "unset" + }, + "event": { + "action": "logged-in", + "module": "auditd", + "category": "user-login", + "type": "user_login" + }, + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + }, + "process": { + "pid": "24931", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "197.13.4.211" + }, + "network": { + "direction": "incoming" + }, + "beat": { + "name": "demo-stack-apache-01", + "hostname": "demo-stack-apache-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-apache-01" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "ntGPUmcBTFzn_XoLF0mX", + "source": { + "@timestamp": "2018-11-27T00:26:07.796Z", + "user": { + "uid": "0", + "auid": "unset", + "name_map": { + "uid": "root" + } + }, + "process": { + "pid": "24931", + "exe": "/usr/sbin/sshd" + }, + "beat": { + "version": "7.0.0-alpha1", + "name": "demo-stack-apache-01", + "hostname": "demo-stack-apache-01" + }, + "host": { + "name": "demo-stack-apache-01" + }, + "source": { + "ip": "197.13.4.211" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "result": "fail", + "session": "unset", + "data": { + "terminal": "ssh", + "op": "PAM:bad_ident", + "hostname": "197.13.4.211" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "root" + }, + "object": { + "secondary": "197.13.4.211", + "type": "user-session", + "primary": "ssh" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 184287 + }, + "event": { + "category": "user-login", + "type": "user_err", + "action": "error", + "module": "auditd" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "N9GPUmcBTFzn_XoLi1R8", + "source": { + "@timestamp": "2018-11-27T00:26:37.330Z", + "source": { + "ip": "128.199.216.13" + }, + "network": { + "direction": "incoming" + }, + "beat": { + "name": "demo-stack-nginx-01", + "hostname": "demo-stack-nginx-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-nginx-01" + }, + "auditd": { + "data": { + "terminal": "sshd", + "acct": "(unknown user)", + "op": "login" + }, + "summary": { + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + }, + "object": { + "primary": "sshd", + "secondary": "128.199.216.13", + "type": "user-session" + } + }, + "sequence": 192431, + "result": "fail", + "session": "unset" + }, + "event": { + "action": "logged-in", + "module": "auditd", + "category": "user-login", + "type": "user_login" + }, + "user": { + "uid": "0", + "auid": "unset", + "name_map": { + "uid": "root" + } + }, + "process": { + "pid": "32510", + "exe": "/usr/sbin/sshd" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "ONGPUmcBTFzn_XoLi1R8", + "source": { + "@timestamp": "2018-11-27T00:26:37.331Z", + "event": { + "action": "logged-in", + "module": "auditd", + "category": "user-login", + "type": "user_login" + }, + "user": { + "name_map": { + "uid": "root" + }, + "auid": "unset", + "uid": "0" + }, + "process": { + "pid": "32510", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "128.199.216.13" + }, + "network": { + "direction": "incoming" + }, + "beat": { + "name": "demo-stack-nginx-01", + "hostname": "demo-stack-nginx-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-nginx-01" + }, + "auditd": { + "result": "fail", + "session": "unset", + "data": { + "terminal": "sshd", + "op": "login", + "acct": "(invalid user)" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + }, + "object": { + "primary": "sshd", + "secondary": "128.199.216.13", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 192432 + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "OdGPUmcBTFzn_XoLi1R8", + "source": { + "@timestamp": "2018-11-27T00:26:37.524Z", + "beat": { + "name": "demo-stack-nginx-01", + "hostname": "demo-stack-nginx-01", + "version": "7.0.0-alpha1" + }, + "process": { + "pid": "32510", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "128.199.216.13" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "sequence": 192433, + "result": "fail", + "session": "unset", + "data": { + "op": "PAM:bad_ident", + "hostname": "128.199.216.13", + "terminal": "ssh" + }, + "summary": { + "object": { + "primary": "ssh", + "secondary": "128.199.216.13", + "type": "user-session" + }, + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "root" + } + } + }, + "event": { + "category": "user-login", + "type": "user_err", + "action": "error", + "module": "auditd" + }, + "user": { + "name_map": { + "uid": "root" + }, + "auid": "unset", + "uid": "0" + }, + "host": { + "name": "demo-stack-nginx-01" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "iNGNUmcBTFzn_XoLxiyC", + "source": { + "@timestamp": "2018-11-27T00:24:41.365Z", + "host": { + "name": "demo-stack-mysql-01" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "summary": { + "object": { + "secondary": "147.135.208.7", + "type": "user-session", + "primary": "sshd" + }, + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + } + }, + "sequence": 43116, + "result": "fail", + "session": "unset", + "data": { + "terminal": "sshd", + "op": "login", + "acct": "(unknown user)" + } + }, + "event": { + "action": "logged-in", + "module": "auditd", + "category": "user-login", + "type": "user_login" + }, + "user": { + "name_map": { + "uid": "root" + }, + "auid": "unset", + "uid": "0" + }, + "process": { + "exe": "/usr/sbin/sshd", + "pid": "12336" + }, + "source": { + "ip": "147.135.208.7" + }, + "beat": { + "name": "demo-stack-mysql-01", + "hostname": "demo-stack-mysql-01", + "version": "7.0.0-alpha1" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "idGNUmcBTFzn_XoLxiyC", + "source": { + "@timestamp": "2018-11-27T00:24:41.365Z", + "source": { + "ip": "147.135.208.7" + }, + "host": { + "name": "demo-stack-mysql-01" + }, + "beat": { + "name": "demo-stack-mysql-01", + "hostname": "demo-stack-mysql-01", + "version": "7.0.0-alpha1" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "sequence": 43117, + "result": "fail", + "session": "unset", + "data": { + "acct": "(invalid user)", + "terminal": "sshd", + "op": "login" + }, + "summary": { + "actor": { + "secondary": "(invalid user)", + "primary": "unset" + }, + "object": { + "secondary": "147.135.208.7", + "type": "user-session", + "primary": "sshd" + }, + "how": "/usr/sbin/sshd" + } + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + }, + "user": { + "auid": "unset", + "uid": "0", + "name_map": { + "uid": "root" + } + }, + "process": { + "pid": "12336", + "exe": "/usr/sbin/sshd" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "itGNUmcBTFzn_XoLxiyC", + "source": { + "@timestamp": "2018-11-27T00:24:41.497Z", + "auditd": { + "sequence": 43118, + "result": "fail", + "session": "unset", + "data": { + "terminal": "ssh", + "op": "PAM:bad_ident", + "hostname": "147.135.208.7" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "root" + }, + "object": { + "primary": "ssh", + "secondary": "147.135.208.7", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + } + }, + "event": { + "type": "user_err", + "action": "error", + "module": "auditd", + "category": "user-login" + }, + "user": { + "name_map": { + "uid": "root" + }, + "uid": "0", + "auid": "unset" + }, + "process": { + "exe": "/usr/sbin/sshd", + "pid": "12336" + }, + "beat": { + "version": "7.0.0-alpha1", + "name": "demo-stack-mysql-01", + "hostname": "demo-stack-mysql-01" + }, + "host": { + "name": "demo-stack-mysql-01" + }, + "source": { + "ip": "147.135.208.7" + }, + "network": { + "direction": "incoming" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "3NGPUmcBTFzn_XoLV05i", + "source": { + "@timestamp": "2018-11-27T00:26:23.985Z", + "auditd": { + "data": { + "terminal": "sshd", + "acct": "(unknown user)", + "op": "login" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + }, + "object": { + "primary": "sshd", + "secondary": "51.38.38.221", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 44109, + "result": "fail", + "session": "unset" + }, + "host": { + "name": "demo-stack-es-01" + }, + "beat": { + "name": "demo-stack-es-01", + "hostname": "demo-stack-es-01", + "version": "7.0.0-alpha1" + }, + "event": { + "type": "user_login", + "action": "logged-in", + "module": "auditd", + "category": "user-login" + }, + "user": { + "uid": "0", + "auid": "unset", + "name_map": { + "uid": "root" + } + }, + "process": { + "pid": "28278", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "51.38.38.221" + }, + "network": { + "direction": "incoming" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "3dGPUmcBTFzn_XoLV05i", + "source": { + "@timestamp": "2018-11-27T00:26:23.989Z", + "process": { + "pid": "28278", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "51.38.38.221" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "session": "unset", + "data": { + "op": "login", + "acct": "(invalid user)", + "terminal": "sshd" + }, + "summary": { + "actor": { + "secondary": "(invalid user)", + "primary": "unset" + }, + "object": { + "secondary": "51.38.38.221", + "type": "user-session", + "primary": "sshd" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 44110, + "result": "fail" + }, + "event": { + "type": "user_login", + "action": "logged-in", + "module": "auditd", + "category": "user-login" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "beat": { + "name": "demo-stack-es-01", + "hostname": "demo-stack-es-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-es-01" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "3tGPUmcBTFzn_XoLV05i", + "source": { + "@timestamp": "2018-11-27T00:26:24.093Z", + "beat": { + "name": "demo-stack-es-01", + "hostname": "demo-stack-es-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-es-01" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "session": "unset", + "data": { + "op": "PAM:bad_ident", + "hostname": "51.38.38.221", + "terminal": "ssh" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "root" + }, + "object": { + "primary": "ssh", + "secondary": "51.38.38.221", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 44111, + "result": "fail" + }, + "event": { + "action": "error", + "module": "auditd", + "category": "user-login", + "type": "user_err" + }, + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + }, + "process": { + "pid": "28278", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "51.38.38.221" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "NdGNUmcBTFzn_XoLoilI", + "source": { + "@timestamp": "2018-11-27T00:24:32.089Z", + "beat": { + "name": "demo-stack-es-01", + "hostname": "demo-stack-es-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-es-01" + }, + "process": { + "pid": "28228", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "202.138.233.92" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "result": "fail", + "session": "unset", + "data": { + "terminal": "sshd", + "op": "login", + "acct": "(unknown user)" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + }, + "object": { + "primary": "sshd", + "secondary": "202.138.233.92", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 44100 + }, + "event": { + "action": "logged-in", + "module": "auditd", + "category": "user-login", + "type": "user_login" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "NtGNUmcBTFzn_XoLoilI", + "source": { + "@timestamp": "2018-11-27T00:24:32.089Z", + "event": { + "type": "user_login", + "action": "logged-in", + "module": "auditd", + "category": "user-login" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "pid": "28228", + "exe": "/usr/sbin/sshd" + }, + "host": { + "name": "demo-stack-es-01" + }, + "beat": { + "name": "demo-stack-es-01", + "hostname": "demo-stack-es-01", + "version": "7.0.0-alpha1" + }, + "source": { + "ip": "202.138.233.92" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "result": "fail", + "session": "unset", + "data": { + "op": "login", + "terminal": "sshd", + "acct": "(invalid user)" + }, + "summary": { + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + }, + "object": { + "type": "user-session", + "primary": "sshd", + "secondary": "202.138.233.92" + } + }, + "sequence": 44101 + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "N9GNUmcBTFzn_XoLoilI", + "source": { + "@timestamp": "2018-11-27T00:24:32.345Z", + "process": { + "pid": "28228", + "exe": "/usr/sbin/sshd" + }, + "beat": { + "name": "demo-stack-es-01", + "hostname": "demo-stack-es-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-es-01" + }, + "source": { + "ip": "202.138.233.92" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "sequence": 44102, + "result": "fail", + "session": "unset", + "data": { + "op": "PAM:bad_ident", + "hostname": "202.138.233.92", + "terminal": "ssh" + }, + "summary": { + "actor": { + "secondary": "root", + "primary": "unset" + }, + "object": { + "secondary": "202.138.233.92", + "type": "user-session", + "primary": "ssh" + }, + "how": "/usr/sbin/sshd" + } + }, + "event": { + "type": "user_err", + "action": "error", + "module": "auditd", + "category": "user-login" + }, + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "69GPUmcBTFzn_XoLM0ud", + "source": { + "@timestamp": "2018-11-27T00:26:14.833Z", + "user": { + "name_map": { + "uid": "root" + }, + "auid": "unset", + "uid": "0" + }, + "process": { + "pid": "1", + "name": "systemd", + "exe": "/lib/systemd/systemd" + }, + "auditd": { + "result": "success", + "session": "unset", + "data": { + "unit": "apt-daily" + }, + "summary": { + "object": { + "primary": "apt-daily", + "type": "service" + }, + "how": "/lib/systemd/systemd", + "actor": { + "primary": "unset", + "secondary": "root" + } + }, + "sequence": 192429 + }, + "beat": { + "hostname": "demo-stack-nginx-01", + "version": "7.0.0-alpha1", + "name": "demo-stack-nginx-01" + }, + "host": { + "name": "demo-stack-nginx-01" + }, + "event": { + "category": "system-services", + "type": "service_start", + "action": "started-service", + "module": "auditd" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "7NGPUmcBTFzn_XoLM0ud", + "source": { + "@timestamp": "2018-11-27T00:26:14.834Z", + "beat": { + "hostname": "demo-stack-nginx-01", + "version": "7.0.0-alpha1", + "name": "demo-stack-nginx-01" + }, + "host": { + "name": "demo-stack-nginx-01" + }, + "process": { + "pid": "1", + "name": "systemd", + "exe": "/lib/systemd/systemd" + }, + "auditd": { + "summary": { + "actor": { + "primary": "unset", + "secondary": "root" + }, + "object": { + "primary": "apt-daily", + "type": "service" + }, + "how": "/lib/systemd/systemd" + }, + "sequence": 192430, + "result": "success", + "session": "unset", + "data": { + "unit": "apt-daily" + } + }, + "event": { + "action": "stopped-service", + "module": "auditd", + "category": "system-services", + "type": "service_stop" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "-dGTUmcBTFzn_XoLE6A1", + "source": { + "@timestamp": "2018-11-27T00:30:28.676Z", + "process": { + "pid": "28355", + "exe": "/usr/sbin/sshd" + }, + "beat": { + "name": "demo-stack-es-01", + "hostname": "demo-stack-es-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-es-01" + }, + "source": { + "ip": "212.227.192.118" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "sequence": 44115, + "result": "fail", + "session": "unset", + "data": { + "terminal": "sshd", + "acct": "(unknown user)", + "op": "login" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + }, + "object": { + "primary": "sshd", + "secondary": "212.227.192.118", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + } + }, + "event": { + "module": "auditd", + "category": "user-login", + "type": "user_login", + "action": "logged-in" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "-tGTUmcBTFzn_XoLE6A1", + "source": { + "@timestamp": "2018-11-27T00:30:28.680Z", + "process": { + "pid": "28355", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "212.227.192.118" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "summary": { + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + }, + "object": { + "secondary": "212.227.192.118", + "type": "user-session", + "primary": "sshd" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 44116, + "result": "fail", + "session": "unset", + "data": { + "op": "login", + "acct": "(invalid user)", + "terminal": "sshd" + } + }, + "event": { + "type": "user_login", + "action": "logged-in", + "module": "auditd", + "category": "user-login" + }, + "user": { + "auid": "unset", + "uid": "0", + "name_map": { + "uid": "root" + } + }, + "beat": { + "name": "demo-stack-es-01", + "hostname": "demo-stack-es-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-es-01" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "-9GTUmcBTFzn_XoLE6A1", + "source": { + "@timestamp": "2018-11-27T00:30:28.788Z", + "network": { + "direction": "incoming" + }, + "auditd": { + "session": "unset", + "data": { + "op": "PAM:bad_ident", + "terminal": "ssh", + "hostname": "212.227.192.118" + }, + "summary": { + "actor": { + "secondary": "root", + "primary": "unset" + }, + "object": { + "primary": "ssh", + "secondary": "212.227.192.118", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 44117, + "result": "fail" + }, + "beat": { + "name": "demo-stack-es-01", + "hostname": "demo-stack-es-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-es-01" + }, + "event": { + "module": "auditd", + "category": "user-login", + "type": "user_err", + "action": "error" + }, + "user": { + "name_map": { + "uid": "root" + }, + "auid": "unset", + "uid": "0" + }, + "process": { + "exe": "/usr/sbin/sshd", + "pid": "28355" + }, + "source": { + "ip": "212.227.192.118" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "_NGTUmcBTFzn_XoLIaG8", + "source": { + "@timestamp": "2018-11-27T00:30:32.403Z", + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + }, + "user": { + "name_map": { + "uid": "root" + }, + "uid": "0", + "auid": "unset" + }, + "process": { + "pid": "32532", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "164.132.56.243" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "result": "fail", + "session": "unset", + "data": { + "acct": "(unknown user)", + "op": "login", + "terminal": "sshd" + }, + "summary": { + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + }, + "object": { + "primary": "sshd", + "secondary": "164.132.56.243", + "type": "user-session" + } + }, + "sequence": 192437 + }, + "host": { + "name": "demo-stack-nginx-01" + }, + "beat": { + "name": "demo-stack-nginx-01", + "hostname": "demo-stack-nginx-01", + "version": "7.0.0-alpha1" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "_dGTUmcBTFzn_XoLIaG8", + "source": { + "@timestamp": "2018-11-27T00:30:32.404Z", + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "exe": "/usr/sbin/sshd", + "pid": "32532" + }, + "source": { + "ip": "164.132.56.243" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "session": "unset", + "data": { + "op": "login", + "terminal": "sshd", + "acct": "(invalid user)" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + }, + "object": { + "primary": "sshd", + "secondary": "164.132.56.243", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 192438, + "result": "fail" + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + }, + "host": { + "name": "demo-stack-nginx-01" + }, + "beat": { + "name": "demo-stack-nginx-01", + "hostname": "demo-stack-nginx-01", + "version": "7.0.0-alpha1" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "_tGTUmcBTFzn_XoLIaG8", + "source": { + "@timestamp": "2018-11-27T00:30:32.516Z", + "beat": { + "name": "demo-stack-nginx-01", + "hostname": "demo-stack-nginx-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-nginx-01" + }, + "user": { + "name_map": { + "uid": "root" + }, + "auid": "unset", + "uid": "0" + }, + "process": { + "pid": "32532", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "164.132.56.243" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "summary": { + "object": { + "secondary": "164.132.56.243", + "type": "user-session", + "primary": "ssh" + }, + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "root" + } + }, + "sequence": 192439, + "result": "fail", + "session": "unset", + "data": { + "op": "PAM:bad_ident", + "terminal": "ssh", + "hostname": "164.132.56.243" + } + }, + "event": { + "type": "user_err", + "action": "error", + "module": "auditd", + "category": "user-login" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "n9GVUmcBTFzn_XoLvdvo", + "source": { + "@timestamp": "2018-11-27T00:33:23.454Z", + "host": { + "name": "demo-stack-apache-01" + }, + "auditd": { + "sequence": 184297, + "result": "fail", + "session": "unset", + "data": { + "terminal": "sshd", + "op": "login", + "acct": "(unknown user)" + }, + "summary": { + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + }, + "object": { + "primary": "sshd", + "secondary": "222.252.30.117", + "type": "user-session" + } + } + }, + "event": { + "action": "logged-in", + "module": "auditd", + "category": "user-login", + "type": "user_login" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "pid": "24978", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "222.252.30.117" + }, + "network": { + "direction": "incoming" + }, + "beat": { + "hostname": "demo-stack-apache-01", + "version": "7.0.0-alpha1", + "name": "demo-stack-apache-01" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "oNGVUmcBTFzn_XoLvdvo", + "source": { + "@timestamp": "2018-11-27T00:33:23.455Z", + "source": { + "ip": "222.252.30.117" + }, + "network": { + "direction": "incoming" + }, + "beat": { + "name": "demo-stack-apache-01", + "hostname": "demo-stack-apache-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-apache-01" + }, + "auditd": { + "sequence": 184298, + "result": "fail", + "session": "unset", + "data": { + "terminal": "sshd", + "acct": "(invalid user)", + "op": "login" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + }, + "object": { + "primary": "sshd", + "secondary": "222.252.30.117", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + } + }, + "event": { + "module": "auditd", + "category": "user-login", + "type": "user_login", + "action": "logged-in" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "pid": "24978", + "exe": "/usr/sbin/sshd" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "odGVUmcBTFzn_XoLvdvo", + "source": { + "@timestamp": "2018-11-27T00:33:23.682Z", + "event": { + "action": "error", + "module": "auditd", + "category": "user-login", + "type": "user_err" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "beat": { + "name": "demo-stack-apache-01", + "hostname": "demo-stack-apache-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-apache-01" + }, + "process": { + "pid": "24978", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "222.252.30.117" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "summary": { + "how": "/usr/sbin/sshd", + "actor": { + "secondary": "root", + "primary": "unset" + }, + "object": { + "secondary": "222.252.30.117", + "type": "user-session", + "primary": "ssh" + } + }, + "sequence": 184299, + "result": "fail", + "session": "unset", + "data": { + "hostname": "222.252.30.117", + "op": "PAM:bad_ident", + "terminal": "ssh" + } + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "0dGUUmcBTFzn_XoLfr-C", + "source": { + "@timestamp": "2018-11-27T00:32:01.688Z", + "host": { + "name": "demo-stack-apache-01" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "data": { + "acct": "(unknown user)", + "terminal": "sshd", + "op": "login" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + }, + "object": { + "primary": "sshd", + "secondary": "194.35.114.10", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 184294, + "result": "fail", + "session": "unset" + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + }, + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + }, + "process": { + "pid": "24969", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "194.35.114.10" + }, + "beat": { + "name": "demo-stack-apache-01", + "hostname": "demo-stack-apache-01", + "version": "7.0.0-alpha1" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "0tGUUmcBTFzn_XoLfr-C", + "source": { + "@timestamp": "2018-11-27T00:32:01.689Z", + "host": { + "name": "demo-stack-apache-01" + }, + "source": { + "ip": "194.35.114.10" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "data": { + "acct": "(invalid user)", + "op": "login", + "terminal": "sshd" + }, + "summary": { + "actor": { + "secondary": "(invalid user)", + "primary": "unset" + }, + "object": { + "secondary": "194.35.114.10", + "type": "user-session", + "primary": "sshd" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 184295, + "result": "fail", + "session": "unset" + }, + "event": { + "type": "user_login", + "action": "logged-in", + "module": "auditd", + "category": "user-login" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "exe": "/usr/sbin/sshd", + "pid": "24969" + }, + "beat": { + "name": "demo-stack-apache-01", + "hostname": "demo-stack-apache-01", + "version": "7.0.0-alpha1" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "09GUUmcBTFzn_XoLfr-C", + "source": { + "@timestamp": "2018-11-27T00:32:01.975Z", + "network": { + "direction": "incoming" + }, + "beat": { + "name": "demo-stack-apache-01", + "hostname": "demo-stack-apache-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-apache-01" + }, + "auditd": { + "data": { + "terminal": "ssh", + "hostname": "194.35.114.10", + "op": "PAM:bad_ident" + }, + "summary": { + "object": { + "primary": "ssh", + "secondary": "194.35.114.10", + "type": "user-session" + }, + "how": "/usr/sbin/sshd", + "actor": { + "secondary": "root", + "primary": "unset" + } + }, + "sequence": 184296, + "result": "fail", + "session": "unset" + }, + "event": { + "category": "user-login", + "type": "user_err", + "action": "error", + "module": "auditd" + }, + "user": { + "name_map": { + "uid": "root" + }, + "auid": "unset", + "uid": "0" + }, + "process": { + "exe": "/usr/sbin/sshd", + "pid": "24969" + }, + "source": { + "ip": "194.35.114.10" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "FdGUUmcBTFzn_XoLVrxv", + "source": { + "@timestamp": "2018-11-27T00:31:51.428Z", + "source": { + "ip": "54.222.243.60" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "session": "unset", + "data": { + "acct": "(unknown user)", + "op": "login", + "terminal": "sshd" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + }, + "object": { + "primary": "sshd", + "secondary": "54.222.243.60", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 184291, + "result": "fail" + }, + "event": { + "action": "logged-in", + "module": "auditd", + "category": "user-login", + "type": "user_login" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "exe": "/usr/sbin/sshd", + "pid": "24967" + }, + "beat": { + "name": "demo-stack-apache-01", + "hostname": "demo-stack-apache-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-apache-01" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "FtGUUmcBTFzn_XoLVrxv", + "source": { + "@timestamp": "2018-11-27T00:31:51.429Z", + "process": { + "exe": "/usr/sbin/sshd", + "pid": "24967" + }, + "beat": { + "name": "demo-stack-apache-01", + "hostname": "demo-stack-apache-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-apache-01" + }, + "source": { + "ip": "54.222.243.60" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "result": "fail", + "session": "unset", + "data": { + "acct": "(invalid user)", + "op": "login", + "terminal": "sshd" + }, + "summary": { + "object": { + "primary": "sshd", + "secondary": "54.222.243.60", + "type": "user-session" + }, + "how": "/usr/sbin/sshd", + "actor": { + "secondary": "(invalid user)", + "primary": "unset" + } + }, + "sequence": 184292 + }, + "event": { + "module": "auditd", + "category": "user-login", + "type": "user_login", + "action": "logged-in" + }, + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "F9GUUmcBTFzn_XoLVrxv", + "source": { + "@timestamp": "2018-11-27T00:31:51.655Z", + "event": { + "category": "user-login", + "type": "user_err", + "action": "error", + "module": "auditd" + }, + "user": { + "uid": "0", + "auid": "unset", + "name_map": { + "uid": "root" + } + }, + "process": { + "pid": "24967", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "54.222.243.60" + }, + "network": { + "direction": "incoming" + }, + "host": { + "name": "demo-stack-apache-01" + }, + "beat": { + "name": "demo-stack-apache-01", + "hostname": "demo-stack-apache-01", + "version": "7.0.0-alpha1" + }, + "auditd": { + "session": "unset", + "data": { + "hostname": "54.222.243.60", + "op": "PAM:bad_ident", + "terminal": "ssh" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "root" + }, + "object": { + "primary": "ssh", + "secondary": "54.222.243.60", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 184293, + "result": "fail" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "iNGWUmcBTFzn_XoLZOnx", + "source": { + "@timestamp": "2018-11-27T00:34:06.215Z", + "auditd": { + "sequence": 186263, + "result": "fail", + "session": "unset", + "data": { + "acct": "(unknown user)", + "op": "login", + "terminal": "sshd" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + }, + "object": { + "primary": "sshd", + "secondary": "187.188.146.35", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + } + }, + "event": { + "action": "logged-in", + "module": "auditd", + "category": "user-login", + "type": "user_login" + }, + "beat": { + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-redis-01" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "exe": "/usr/sbin/sshd", + "pid": "31932" + }, + "source": { + "ip": "187.188.146.35" + }, + "network": { + "direction": "incoming" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "idGWUmcBTFzn_XoLZOnx", + "source": { + "@timestamp": "2018-11-27T00:34:06.216Z", + "network": { + "direction": "incoming" + }, + "beat": { + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-redis-01" + }, + "auditd": { + "data": { + "acct": "(invalid user)", + "op": "login", + "terminal": "sshd" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + }, + "object": { + "secondary": "187.188.146.35", + "type": "user-session", + "primary": "sshd" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 186264, + "result": "fail", + "session": "unset" + }, + "event": { + "type": "user_login", + "action": "logged-in", + "module": "auditd", + "category": "user-login" + }, + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + }, + "process": { + "pid": "31932", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "187.188.146.35" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "itGWUmcBTFzn_XoLZOnx", + "source": { + "@timestamp": "2018-11-27T00:34:06.294Z", + "host": { + "name": "demo-stack-redis-01" + }, + "auditd": { + "data": { + "terminal": "ssh", + "op": "PAM:bad_ident", + "hostname": "187.188.146.35" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "root" + }, + "object": { + "primary": "ssh", + "secondary": "187.188.146.35", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 186265, + "result": "fail", + "session": "unset" + }, + "event": { + "type": "user_err", + "action": "error", + "module": "auditd", + "category": "user-login" + }, + "user": { + "name_map": { + "uid": "root" + }, + "auid": "unset", + "uid": "0" + }, + "process": { + "pid": "31932", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "187.188.146.35" + }, + "network": { + "direction": "incoming" + }, + "beat": { + "version": "7.0.0-alpha1", + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "5NGTUmcBTFzn_XoLoqzb", + "source": { + "@timestamp": "2018-11-27T00:31:05.454Z", + "source": { + "ip": "190.153.219.50" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "sequence": 43128, + "result": "fail", + "session": "unset", + "data": { + "terminal": "sshd", + "op": "login", + "acct": "(unknown user)" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + }, + "object": { + "primary": "sshd", + "secondary": "190.153.219.50", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + } + }, + "event": { + "module": "auditd", + "category": "user-login", + "type": "user_login", + "action": "logged-in" + }, + "user": { + "auid": "unset", + "uid": "0", + "name_map": { + "uid": "root" + } + }, + "beat": { + "hostname": "demo-stack-mysql-01", + "version": "7.0.0-alpha1", + "name": "demo-stack-mysql-01" + }, + "host": { + "name": "demo-stack-mysql-01" + }, + "process": { + "pid": "12380", + "exe": "/usr/sbin/sshd" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "5dGTUmcBTFzn_XoLoqzb", + "source": { + "@timestamp": "2018-11-27T00:31:05.454Z", + "process": { + "pid": "12380", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "190.153.219.50" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "data": { + "op": "login", + "acct": "(invalid user)", + "terminal": "sshd" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + }, + "object": { + "primary": "sshd", + "secondary": "190.153.219.50", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 43129, + "result": "fail", + "session": "unset" + }, + "beat": { + "name": "demo-stack-mysql-01", + "hostname": "demo-stack-mysql-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-mysql-01" + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + }, + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "5tGTUmcBTFzn_XoLoqzb", + "source": { + "@timestamp": "2018-11-27T00:31:05.610Z", + "auditd": { + "sequence": 43130, + "result": "fail", + "session": "unset", + "data": { + "hostname": "190.153.219.50", + "terminal": "ssh", + "op": "PAM:bad_ident" + }, + "summary": { + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "root" + }, + "object": { + "primary": "ssh", + "secondary": "190.153.219.50", + "type": "user-session" + } + } + }, + "event": { + "module": "auditd", + "category": "user-login", + "type": "user_err", + "action": "error" + }, + "beat": { + "name": "demo-stack-mysql-01", + "hostname": "demo-stack-mysql-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-mysql-01" + }, + "user": { + "name_map": { + "uid": "root" + }, + "auid": "unset", + "uid": "0" + }, + "process": { + "pid": "12380", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "190.153.219.50" + }, + "network": { + "direction": "incoming" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "f9GUUmcBTFzn_XoLl8LQ", + "source": { + "@timestamp": "2018-11-27T00:32:08.159Z", + "beat": { + "name": "demo-stack-mysql-01", + "hostname": "demo-stack-mysql-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-mysql-01" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "pid": "12388", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "51.75.29.64" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "summary": { + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + }, + "object": { + "primary": "sshd", + "secondary": "51.75.29.64", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 43131, + "result": "fail", + "session": "unset", + "data": { + "acct": "(unknown user)", + "op": "login", + "terminal": "sshd" + } + }, + "event": { + "type": "user_login", + "action": "logged-in", + "module": "auditd", + "category": "user-login" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "gNGUUmcBTFzn_XoLl8LQ", + "source": { + "@timestamp": "2018-11-27T00:32:08.163Z", + "auditd": { + "summary": { + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + }, + "object": { + "primary": "sshd", + "secondary": "51.75.29.64", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 43132, + "result": "fail", + "session": "unset", + "data": { + "terminal": "sshd", + "op": "login", + "acct": "(invalid user)" + } + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + }, + "beat": { + "version": "7.0.0-alpha1", + "name": "demo-stack-mysql-01", + "hostname": "demo-stack-mysql-01" + }, + "host": { + "name": "demo-stack-mysql-01" + }, + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + }, + "process": { + "pid": "12388", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "51.75.29.64" + }, + "network": { + "direction": "incoming" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "gdGUUmcBTFzn_XoLl8LQ", + "source": { + "@timestamp": "2018-11-27T00:32:08.283Z", + "source": { + "ip": "51.75.29.64" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "summary": { + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "root" + }, + "object": { + "type": "user-session", + "primary": "ssh", + "secondary": "51.75.29.64" + } + }, + "sequence": 43133, + "result": "fail", + "session": "unset", + "data": { + "hostname": "51.75.29.64", + "op": "PAM:bad_ident", + "terminal": "ssh" + } + }, + "event": { + "action": "error", + "module": "auditd", + "category": "user-login", + "type": "user_err" + }, + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + }, + "process": { + "pid": "12388", + "exe": "/usr/sbin/sshd" + }, + "beat": { + "name": "demo-stack-mysql-01", + "hostname": "demo-stack-mysql-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-mysql-01" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "K9GUUmcBTFzn_XoLpsMN", + "source": { + "@timestamp": "2018-11-27T00:32:11.807Z", + "source": { + "ip": "159.203.94.6" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "session": "unset", + "data": { + "op": "login", + "acct": "(unknown user)", + "terminal": "sshd" + }, + "summary": { + "object": { + "type": "user-session", + "primary": "sshd", + "secondary": "159.203.94.6" + }, + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + } + }, + "sequence": 43134, + "result": "fail" + }, + "beat": { + "name": "demo-stack-mysql-01", + "hostname": "demo-stack-mysql-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-mysql-01" + }, + "event": { + "module": "auditd", + "category": "user-login", + "type": "user_login", + "action": "logged-in" + }, + "user": { + "name_map": { + "uid": "root" + }, + "auid": "unset", + "uid": "0" + }, + "process": { + "pid": "12390", + "exe": "/usr/sbin/sshd" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "LNGUUmcBTFzn_XoLpsMN", + "source": { + "@timestamp": "2018-11-27T00:32:11.807Z", + "process": { + "pid": "12390", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "159.203.94.6" + }, + "network": { + "direction": "incoming" + }, + "beat": { + "name": "demo-stack-mysql-01", + "hostname": "demo-stack-mysql-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-mysql-01" + }, + "auditd": { + "result": "fail", + "session": "unset", + "data": { + "terminal": "sshd", + "op": "login", + "acct": "(invalid user)" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + }, + "object": { + "primary": "sshd", + "secondary": "159.203.94.6", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 43135 + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + }, + "user": { + "auid": "unset", + "uid": "0", + "name_map": { + "uid": "root" + } + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "LdGUUmcBTFzn_XoLpsMN", + "source": { + "@timestamp": "2018-11-27T00:32:11.839Z", + "event": { + "module": "auditd", + "category": "user-login", + "type": "user_err", + "action": "error" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "pid": "12390", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "159.203.94.6" + }, + "beat": { + "version": "7.0.0-alpha1", + "name": "demo-stack-mysql-01", + "hostname": "demo-stack-mysql-01" + }, + "host": { + "name": "demo-stack-mysql-01" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "result": "fail", + "session": "unset", + "data": { + "terminal": "ssh", + "hostname": "159.203.94.6", + "op": "PAM:bad_ident" + }, + "summary": { + "actor": { + "secondary": "root", + "primary": "unset" + }, + "object": { + "primary": "ssh", + "secondary": "159.203.94.6", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 43136 + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "49GUUmcBTFzn_XoL7sk-", + "source": { + "@timestamp": "2018-11-27T00:32:30.290Z", + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "beat": { + "hostname": "demo-stack-es-01", + "version": "7.0.0-alpha1", + "name": "demo-stack-es-01" + }, + "host": { + "name": "demo-stack-es-01" + }, + "process": { + "pid": "28397", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "51.255.35.58" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "sequence": 44118, + "result": "fail", + "session": "unset", + "data": { + "terminal": "sshd", + "op": "login", + "acct": "(unknown user)" + }, + "summary": { + "actor": { + "secondary": "(unknown user)", + "primary": "unset" + }, + "object": { + "primary": "sshd", + "secondary": "51.255.35.58", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + } + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "5NGUUmcBTFzn_XoL7sk-", + "source": { + "@timestamp": "2018-11-27T00:32:30.290Z", + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + }, + "beat": { + "name": "demo-stack-es-01", + "hostname": "demo-stack-es-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-es-01" + }, + "user": { + "name_map": { + "uid": "root" + }, + "uid": "0", + "auid": "unset" + }, + "process": { + "pid": "28397", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "51.255.35.58" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "sequence": 44119, + "result": "fail", + "session": "unset", + "data": { + "terminal": "sshd", + "acct": "(invalid user)", + "op": "login" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + }, + "object": { + "secondary": "51.255.35.58", + "type": "user-session", + "primary": "sshd" + }, + "how": "/usr/sbin/sshd" + } + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "5dGUUmcBTFzn_XoL7sk-", + "source": { + "@timestamp": "2018-11-27T00:32:30.394Z", + "auditd": { + "sequence": 44120, + "result": "fail", + "session": "unset", + "data": { + "terminal": "ssh", + "op": "PAM:bad_ident", + "hostname": "51.255.35.58" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "root" + }, + "object": { + "primary": "ssh", + "secondary": "51.255.35.58", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + } + }, + "event": { + "category": "user-login", + "type": "user_err", + "action": "error", + "module": "auditd" + }, + "user": { + "uid": "0", + "auid": "unset", + "name_map": { + "uid": "root" + } + }, + "beat": { + "name": "demo-stack-es-01", + "hostname": "demo-stack-es-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-es-01" + }, + "process": { + "pid": "28397", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "51.255.35.58" + }, + "network": { + "direction": "incoming" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "ZtKdUmcBTFzn_XoLzIys", + "source": { + "@timestamp": "2018-11-27T00:42:11.490Z", + "process": { + "pid": "28582", + "exe": "/usr/sbin/sshd" + }, + "beat": { + "name": "demo-stack-es-01", + "hostname": "demo-stack-es-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-es-01" + }, + "source": { + "ip": "51.75.23.199" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "session": "unset", + "data": { + "acct": "(unknown user)", + "terminal": "sshd", + "op": "login" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + }, + "object": { + "primary": "sshd", + "secondary": "51.75.23.199", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 44127, + "result": "fail" + }, + "event": { + "action": "logged-in", + "module": "auditd", + "category": "user-login", + "type": "user_login" + }, + "user": { + "auid": "unset", + "uid": "0", + "name_map": { + "uid": "root" + } + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "Z9KdUmcBTFzn_XoLzIys", + "source": { + "@timestamp": "2018-11-27T00:42:11.494Z", + "auditd": { + "summary": { + "actor": { + "secondary": "(invalid user)", + "primary": "unset" + }, + "object": { + "secondary": "51.75.23.199", + "type": "user-session", + "primary": "sshd" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 44128, + "result": "fail", + "session": "unset", + "data": { + "terminal": "sshd", + "acct": "(invalid user)", + "op": "login" + } + }, + "beat": { + "version": "7.0.0-alpha1", + "name": "demo-stack-es-01", + "hostname": "demo-stack-es-01" + }, + "host": { + "name": "demo-stack-es-01" + }, + "event": { + "module": "auditd", + "category": "user-login", + "type": "user_login", + "action": "logged-in" + }, + "user": { + "auid": "unset", + "uid": "0", + "name_map": { + "uid": "root" + } + }, + "process": { + "pid": "28582", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "51.75.23.199" + }, + "network": { + "direction": "incoming" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "aNKdUmcBTFzn_XoLzIys", + "source": { + "@timestamp": "2018-11-27T00:42:11.598Z", + "beat": { + "version": "7.0.0-alpha1", + "name": "demo-stack-es-01", + "hostname": "demo-stack-es-01" + }, + "host": { + "name": "demo-stack-es-01" + }, + "process": { + "exe": "/usr/sbin/sshd", + "pid": "28582" + }, + "source": { + "ip": "51.75.23.199" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "sequence": 44129, + "result": "fail", + "session": "unset", + "data": { + "terminal": "ssh", + "hostname": "51.75.23.199", + "op": "PAM:bad_ident" + }, + "summary": { + "object": { + "type": "user-session", + "primary": "ssh", + "secondary": "51.75.23.199" + }, + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "root" + } + } + }, + "event": { + "action": "error", + "module": "auditd", + "category": "user-login", + "type": "user_err" + }, + "user": { + "auid": "unset", + "uid": "0", + "name_map": { + "uid": "root" + } + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "atKdUmcBTFzn_XoLzYxc", + "source": { + "@timestamp": "2018-11-27T00:42:11.696Z", + "source": { + "ip": "180.76.100.10" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "sequence": 186281, + "result": "fail", + "session": "unset", + "data": { + "terminal": "sshd", + "acct": "(unknown user)", + "op": "login" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + }, + "object": { + "primary": "sshd", + "secondary": "180.76.100.10", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + } + }, + "beat": { + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-redis-01" + }, + "event": { + "action": "logged-in", + "module": "auditd", + "category": "user-login", + "type": "user_login" + }, + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + }, + "process": { + "exe": "/usr/sbin/sshd", + "pid": "31982" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "a9KdUmcBTFzn_XoLzYxc", + "source": { + "@timestamp": "2018-11-27T00:42:11.697Z", + "host": { + "name": "demo-stack-redis-01" + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "pid": "31982", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "180.76.100.10" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "sequence": 186282, + "result": "fail", + "session": "unset", + "data": { + "op": "login", + "acct": "(invalid user)", + "terminal": "sshd" + }, + "summary": { + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + }, + "object": { + "secondary": "180.76.100.10", + "type": "user-session", + "primary": "sshd" + } + } + }, + "beat": { + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "bNKdUmcBTFzn_XoLzYxc", + "source": { + "@timestamp": "2018-11-27T00:42:11.935Z", + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + }, + "process": { + "pid": "31982", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "180.76.100.10" + }, + "network": { + "direction": "incoming" + }, + "host": { + "name": "demo-stack-redis-01" + }, + "beat": { + "version": "7.0.0-alpha1", + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01" + }, + "auditd": { + "summary": { + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "root" + }, + "object": { + "primary": "ssh", + "secondary": "180.76.100.10", + "type": "user-session" + } + }, + "sequence": 186283, + "result": "fail", + "session": "unset", + "data": { + "op": "PAM:bad_ident", + "hostname": "180.76.100.10", + "terminal": "ssh" + } + }, + "event": { + "category": "user-login", + "type": "user_err", + "action": "error", + "module": "auditd" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "N9KfUmcBTFzn_XoLkLSD", + "source": { + "@timestamp": "2018-11-27T00:44:07.193Z", + "auditd": { + "session": "unset", + "data": { + "acct": "(unknown user)", + "op": "login", + "terminal": "sshd" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + }, + "object": { + "secondary": "115.146.127.134", + "type": "user-session", + "primary": "sshd" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 142297, + "result": "fail" + }, + "event": { + "module": "auditd", + "category": "user-login", + "type": "user_login", + "action": "logged-in" + }, + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + }, + "beat": { + "name": "demo-stack-haproxy-01", + "hostname": "demo-stack-haproxy-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-haproxy-01" + }, + "process": { + "pid": "19404", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "115.146.127.134" + }, + "network": { + "direction": "incoming" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "ONKfUmcBTFzn_XoLkLSD", + "source": { + "@timestamp": "2018-11-27T00:44:07.194Z", + "auditd": { + "data": { + "terminal": "sshd", + "op": "login", + "acct": "(invalid user)" + }, + "summary": { + "object": { + "type": "user-session", + "primary": "sshd", + "secondary": "115.146.127.134" + }, + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + } + }, + "sequence": 142298, + "result": "fail", + "session": "unset" + }, + "beat": { + "name": "demo-stack-haproxy-01", + "hostname": "demo-stack-haproxy-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-haproxy-01" + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "pid": "19404", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "115.146.127.134" + }, + "network": { + "direction": "incoming" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "OdKfUmcBTFzn_XoLkLSD", + "source": { + "@timestamp": "2018-11-27T00:44:07.394Z", + "process": { + "pid": "19404", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "115.146.127.134" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "sequence": 142299, + "result": "fail", + "session": "unset", + "data": { + "hostname": "115.146.127.134", + "op": "PAM:bad_ident", + "terminal": "ssh" + }, + "summary": { + "object": { + "secondary": "115.146.127.134", + "type": "user-session", + "primary": "ssh" + }, + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "root" + } + } + }, + "event": { + "action": "error", + "module": "auditd", + "category": "user-login", + "type": "user_err" + }, + "beat": { + "name": "demo-stack-haproxy-01", + "hostname": "demo-stack-haproxy-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-haproxy-01" + }, + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "ftKgUmcBTFzn_XoLxc3Y", + "source": { + "@timestamp": "2018-11-27T00:45:26.381Z", + "auditd": { + "sequence": 184306, + "result": "fail", + "session": "unset", + "data": { + "op": "login", + "acct": "(unknown user)", + "terminal": "sshd" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + }, + "object": { + "secondary": "201.245.191.102", + "type": "user-session", + "primary": "sshd" + }, + "how": "/usr/sbin/sshd" + } + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + }, + "user": { + "auid": "unset", + "uid": "0", + "name_map": { + "uid": "root" + } + }, + "process": { + "exe": "/usr/sbin/sshd", + "pid": "25092" + }, + "beat": { + "hostname": "demo-stack-apache-01", + "version": "7.0.0-alpha1", + "name": "demo-stack-apache-01" + }, + "host": { + "name": "demo-stack-apache-01" + }, + "source": { + "ip": "201.245.191.102" + }, + "network": { + "direction": "incoming" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "f9KgUmcBTFzn_XoLxc3Y", + "source": { + "@timestamp": "2018-11-27T00:45:26.382Z", + "source": { + "ip": "201.245.191.102" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "session": "unset", + "data": { + "terminal": "sshd", + "acct": "(invalid user)", + "op": "login" + }, + "summary": { + "object": { + "secondary": "201.245.191.102", + "type": "user-session", + "primary": "sshd" + }, + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + } + }, + "sequence": 184307, + "result": "fail" + }, + "event": { + "type": "user_login", + "action": "logged-in", + "module": "auditd", + "category": "user-login" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "beat": { + "name": "demo-stack-apache-01", + "hostname": "demo-stack-apache-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-apache-01" + }, + "process": { + "pid": "25092", + "exe": "/usr/sbin/sshd" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "gNKgUmcBTFzn_XoLxc3Y", + "source": { + "@timestamp": "2018-11-27T00:45:26.503Z", + "process": { + "pid": "25092", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "201.245.191.102" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "session": "unset", + "data": { + "terminal": "ssh", + "hostname": "201.245.191.102", + "op": "PAM:bad_ident" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "root" + }, + "object": { + "primary": "ssh", + "secondary": "201.245.191.102", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 184308, + "result": "fail" + }, + "event": { + "category": "user-login", + "type": "user_err", + "action": "error", + "module": "auditd" + }, + "user": { + "name_map": { + "uid": "root" + }, + "auid": "unset", + "uid": "0" + }, + "beat": { + "name": "demo-stack-apache-01", + "hostname": "demo-stack-apache-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-apache-01" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "59KeUmcBTFzn_XoLO5ZL", + "source": { + "@timestamp": "2018-11-27T00:42:39.841Z", + "process": { + "pid": "19396", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "209.97.173.192" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "sequence": 142294, + "result": "fail", + "session": "unset", + "data": { + "acct": "(unknown user)", + "terminal": "sshd", + "op": "login" + }, + "summary": { + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + }, + "object": { + "primary": "sshd", + "secondary": "209.97.173.192", + "type": "user-session" + } + } + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + }, + "user": { + "name_map": { + "uid": "root" + }, + "uid": "0", + "auid": "unset" + }, + "beat": { + "name": "demo-stack-haproxy-01", + "hostname": "demo-stack-haproxy-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-haproxy-01" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "6NKeUmcBTFzn_XoLO5ZL", + "source": { + "@timestamp": "2018-11-27T00:42:39.843Z", + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + }, + "user": { + "uid": "0", + "auid": "unset", + "name_map": { + "uid": "root" + } + }, + "process": { + "pid": "19396", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "209.97.173.192" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "data": { + "terminal": "sshd", + "acct": "(invalid user)", + "op": "login" + }, + "summary": { + "object": { + "secondary": "209.97.173.192", + "type": "user-session", + "primary": "sshd" + }, + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + } + }, + "sequence": 142295, + "result": "fail", + "session": "unset" + }, + "beat": { + "version": "7.0.0-alpha1", + "name": "demo-stack-haproxy-01", + "hostname": "demo-stack-haproxy-01" + }, + "host": { + "name": "demo-stack-haproxy-01" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "6dKeUmcBTFzn_XoLO5ZL", + "source": { + "@timestamp": "2018-11-27T00:42:40.035Z", + "host": { + "name": "demo-stack-haproxy-01" + }, + "user": { + "auid": "unset", + "uid": "0", + "name_map": { + "uid": "root" + } + }, + "process": { + "pid": "19396", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "209.97.173.192" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "sequence": 142296, + "result": "fail", + "session": "unset", + "data": { + "op": "PAM:bad_ident", + "terminal": "ssh", + "hostname": "209.97.173.192" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "root" + }, + "object": { + "primary": "ssh", + "secondary": "209.97.173.192", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + } + }, + "event": { + "category": "user-login", + "type": "user_err", + "action": "error", + "module": "auditd" + }, + "beat": { + "name": "demo-stack-haproxy-01", + "hostname": "demo-stack-haproxy-01", + "version": "7.0.0-alpha1" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "xdKbUmcBTFzn_XoL6WOD", + "source": { + "@timestamp": "2018-11-27T00:40:07.833Z", + "event": { + "module": "auditd", + "category": "user-login", + "type": "user_login", + "action": "logged-in" + }, + "beat": { + "name": "demo-stack-nginx-01", + "hostname": "demo-stack-nginx-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-nginx-01" + }, + "user": { + "name_map": { + "uid": "root" + }, + "auid": "unset", + "uid": "0" + }, + "process": { + "exe": "/usr/sbin/sshd", + "pid": "32633" + }, + "source": { + "ip": "134.175.28.156" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "sequence": 192449, + "result": "fail", + "session": "unset", + "data": { + "terminal": "sshd", + "op": "login", + "acct": "(unknown user)" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + }, + "object": { + "secondary": "134.175.28.156", + "type": "user-session", + "primary": "sshd" + }, + "how": "/usr/sbin/sshd" + } + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "xtKbUmcBTFzn_XoL6WOD", + "source": { + "@timestamp": "2018-11-27T00:40:07.834Z", + "beat": { + "name": "demo-stack-nginx-01", + "hostname": "demo-stack-nginx-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-nginx-01" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "pid": "32633", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "134.175.28.156" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "session": "unset", + "data": { + "op": "login", + "terminal": "sshd", + "acct": "(invalid user)" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + }, + "object": { + "primary": "sshd", + "secondary": "134.175.28.156", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 192450, + "result": "fail" + }, + "event": { + "module": "auditd", + "category": "user-login", + "type": "user_login", + "action": "logged-in" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "x9KbUmcBTFzn_XoL6WOD", + "source": { + "@timestamp": "2018-11-27T00:40:08.034Z", + "host": { + "name": "demo-stack-nginx-01" + }, + "beat": { + "name": "demo-stack-nginx-01", + "hostname": "demo-stack-nginx-01", + "version": "7.0.0-alpha1" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "result": "fail", + "session": "unset", + "data": { + "terminal": "ssh", + "hostname": "134.175.28.156", + "op": "PAM:bad_ident" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "root" + }, + "object": { + "secondary": "134.175.28.156", + "type": "user-session", + "primary": "ssh" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 192451 + }, + "event": { + "module": "auditd", + "category": "user-login", + "type": "user_err", + "action": "error" + }, + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + }, + "process": { + "pid": "32633", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "134.175.28.156" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "ntKbUmcBTFzn_XoL2WE6", + "source": { + "@timestamp": "2018-11-27T00:40:03.664Z", + "source": { + "ip": "79.134.4.138" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "result": "fail", + "session": "unset", + "data": { + "terminal": "sshd", + "acct": "(unknown user)", + "op": "login" + }, + "summary": { + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + }, + "object": { + "secondary": "79.134.4.138", + "type": "user-session", + "primary": "sshd" + } + }, + "sequence": 186278 + }, + "event": { + "type": "user_login", + "action": "logged-in", + "module": "auditd", + "category": "user-login" + }, + "beat": { + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1", + "name": "demo-stack-redis-01" + }, + "host": { + "name": "demo-stack-redis-01" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "pid": "31968", + "exe": "/usr/sbin/sshd" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "n9KbUmcBTFzn_XoL2WE6", + "source": { + "@timestamp": "2018-11-27T00:40:03.665Z", + "process": { + "pid": "31968", + "exe": "/usr/sbin/sshd" + }, + "beat": { + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-redis-01" + }, + "source": { + "ip": "79.134.4.138" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "session": "unset", + "data": { + "terminal": "sshd", + "op": "login", + "acct": "(invalid user)" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + }, + "object": { + "primary": "sshd", + "secondary": "79.134.4.138", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 186279, + "result": "fail" + }, + "event": { + "type": "user_login", + "action": "logged-in", + "module": "auditd", + "category": "user-login" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "oNKbUmcBTFzn_XoL2WE6", + "source": { + "@timestamp": "2018-11-27T00:40:03.838Z", + "host": { + "name": "demo-stack-redis-01" + }, + "beat": { + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1" + }, + "auditd": { + "sequence": 186280, + "result": "fail", + "session": "unset", + "data": { + "terminal": "ssh", + "hostname": "79.134.4.138", + "op": "PAM:bad_ident" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "root" + }, + "object": { + "primary": "ssh", + "secondary": "79.134.4.138", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + } + }, + "event": { + "module": "auditd", + "category": "user-login", + "type": "user_err", + "action": "error" + }, + "user": { + "name_map": { + "uid": "root" + }, + "uid": "0", + "auid": "unset" + }, + "process": { + "exe": "/usr/sbin/sshd", + "pid": "31968" + }, + "source": { + "ip": "79.134.4.138" + }, + "network": { + "direction": "incoming" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "lNKdUmcBTFzn_XoLiIaH", + "source": { + "@timestamp": "2018-11-27T00:41:54.077Z", + "source": { + "ip": "203.66.168.81" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "result": "fail", + "session": "unset", + "data": { + "terminal": "sshd", + "op": "login", + "acct": "(unknown user)" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + }, + "object": { + "primary": "sshd", + "secondary": "203.66.168.81", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 142291 + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + }, + "beat": { + "name": "demo-stack-haproxy-01", + "hostname": "demo-stack-haproxy-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-haproxy-01" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "exe": "/usr/sbin/sshd", + "pid": "19393" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "ldKdUmcBTFzn_XoLiIaH", + "source": { + "@timestamp": "2018-11-27T00:41:54.078Z", + "network": { + "direction": "incoming" + }, + "auditd": { + "sequence": 142292, + "result": "fail", + "session": "unset", + "data": { + "terminal": "sshd", + "op": "login", + "acct": "(invalid user)" + }, + "summary": { + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + }, + "object": { + "primary": "sshd", + "secondary": "203.66.168.81", + "type": "user-session" + } + } + }, + "beat": { + "name": "demo-stack-haproxy-01", + "hostname": "demo-stack-haproxy-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-haproxy-01" + }, + "event": { + "module": "auditd", + "category": "user-login", + "type": "user_login", + "action": "logged-in" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "pid": "19393", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "203.66.168.81" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "ltKdUmcBTFzn_XoLiIaH", + "source": { + "@timestamp": "2018-11-27T00:41:54.267Z", + "event": { + "category": "user-login", + "type": "user_err", + "action": "error", + "module": "auditd" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "exe": "/usr/sbin/sshd", + "pid": "19393" + }, + "source": { + "ip": "203.66.168.81" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "result": "fail", + "session": "unset", + "data": { + "terminal": "ssh", + "op": "PAM:bad_ident", + "hostname": "203.66.168.81" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "root" + }, + "object": { + "primary": "ssh", + "secondary": "203.66.168.81", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 142293 + }, + "beat": { + "name": "demo-stack-haproxy-01", + "hostname": "demo-stack-haproxy-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-haproxy-01" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "zNKeUmcBTFzn_XoLtKCT", + "source": { + "@timestamp": "2018-11-27T00:43:10.887Z", + "source": { + "ip": "116.93.119.13" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "data": { + "terminal": "sshd", + "op": "login", + "acct": "(unknown user)" + }, + "summary": { + "actor": { + "secondary": "(unknown user)", + "primary": "unset" + }, + "object": { + "primary": "sshd", + "secondary": "116.93.119.13", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 43137, + "result": "fail", + "session": "unset" + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + }, + "user": { + "name_map": { + "uid": "root" + }, + "uid": "0", + "auid": "unset" + }, + "beat": { + "name": "demo-stack-mysql-01", + "hostname": "demo-stack-mysql-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-mysql-01" + }, + "process": { + "pid": "12451", + "exe": "/usr/sbin/sshd" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "zdKeUmcBTFzn_XoLtKCT", + "source": { + "@timestamp": "2018-11-27T00:43:10.887Z", + "user": { + "auid": "unset", + "uid": "0", + "name_map": { + "uid": "root" + } + }, + "process": { + "pid": "12451", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "116.93.119.13" + }, + "beat": { + "name": "demo-stack-mysql-01", + "hostname": "demo-stack-mysql-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-mysql-01" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "result": "fail", + "session": "unset", + "data": { + "acct": "(invalid user)", + "terminal": "sshd", + "op": "login" + }, + "summary": { + "object": { + "primary": "sshd", + "secondary": "116.93.119.13", + "type": "user-session" + }, + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + } + }, + "sequence": 43138 + }, + "event": { + "module": "auditd", + "category": "user-login", + "type": "user_login", + "action": "logged-in" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "ztKeUmcBTFzn_XoLtKCT", + "source": { + "@timestamp": "2018-11-27T00:43:11.127Z", + "user": { + "name_map": { + "uid": "root" + }, + "auid": "unset", + "uid": "0" + }, + "process": { + "exe": "/usr/sbin/sshd", + "pid": "12451" + }, + "source": { + "ip": "116.93.119.13" + }, + "network": { + "direction": "incoming" + }, + "beat": { + "name": "demo-stack-mysql-01", + "hostname": "demo-stack-mysql-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-mysql-01" + }, + "auditd": { + "result": "fail", + "session": "unset", + "data": { + "hostname": "116.93.119.13", + "op": "PAM:bad_ident", + "terminal": "ssh" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "root" + }, + "object": { + "type": "user-session", + "primary": "ssh", + "secondary": "116.93.119.13" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 43139 + }, + "event": { + "category": "user-login", + "type": "user_err", + "action": "error", + "module": "auditd" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "YdKbUmcBTFzn_XoLs16u", + "source": { + "@timestamp": "2018-11-27T00:39:54.048Z", + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + }, + "user": { + "name_map": { + "uid": "root" + }, + "uid": "0", + "auid": "unset" + }, + "process": { + "pid": "28538", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "41.185.28.133" + }, + "beat": { + "name": "demo-stack-es-01", + "hostname": "demo-stack-es-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-es-01" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "session": "unset", + "data": { + "op": "login", + "terminal": "sshd", + "acct": "(unknown user)" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + }, + "object": { + "primary": "sshd", + "secondary": "41.185.28.133", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 44124, + "result": "fail" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "YtKbUmcBTFzn_XoLs16u", + "source": { + "@timestamp": "2018-11-27T00:39:54.052Z", + "network": { + "direction": "incoming" + }, + "auditd": { + "session": "unset", + "data": { + "op": "login", + "terminal": "sshd", + "acct": "(invalid user)" + }, + "summary": { + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + }, + "object": { + "primary": "sshd", + "secondary": "41.185.28.133", + "type": "user-session" + } + }, + "sequence": 44125, + "result": "fail" + }, + "beat": { + "hostname": "demo-stack-es-01", + "version": "7.0.0-alpha1", + "name": "demo-stack-es-01" + }, + "host": { + "name": "demo-stack-es-01" + }, + "event": { + "type": "user_login", + "action": "logged-in", + "module": "auditd", + "category": "user-login" + }, + "user": { + "name_map": { + "uid": "root" + }, + "uid": "0", + "auid": "unset" + }, + "process": { + "pid": "28538", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "41.185.28.133" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "Y9KbUmcBTFzn_XoLs16u", + "source": { + "@timestamp": "2018-11-27T00:39:54.292Z", + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "pid": "28538", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "41.185.28.133" + }, + "host": { + "name": "demo-stack-es-01" + }, + "beat": { + "name": "demo-stack-es-01", + "hostname": "demo-stack-es-01", + "version": "7.0.0-alpha1" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "data": { + "op": "PAM:bad_ident", + "hostname": "41.185.28.133", + "terminal": "ssh" + }, + "summary": { + "actor": { + "secondary": "root", + "primary": "unset" + }, + "object": { + "type": "user-session", + "primary": "ssh", + "secondary": "41.185.28.133" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 44126, + "result": "fail", + "session": "unset" + }, + "event": { + "type": "user_err", + "action": "error", + "module": "auditd", + "category": "user-login" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "otOnUmcBTFzn_XoLmmNb", + "source": { + "@timestamp": "2018-11-27T00:52:54.001Z", + "process": { + "pid": "25143", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "190.0.10.138" + }, + "beat": { + "hostname": "demo-stack-apache-01", + "version": "7.0.0-alpha1", + "name": "demo-stack-apache-01" + }, + "host": { + "name": "demo-stack-apache-01" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "sequence": 184318, + "result": "fail", + "session": "unset", + "data": { + "terminal": "sshd", + "acct": "(unknown user)", + "op": "login" + }, + "summary": { + "object": { + "type": "user-session", + "primary": "sshd", + "secondary": "190.0.10.138" + }, + "how": "/usr/sbin/sshd", + "actor": { + "secondary": "(unknown user)", + "primary": "unset" + } + } + }, + "event": { + "module": "auditd", + "category": "user-login", + "type": "user_login", + "action": "logged-in" + }, + "user": { + "auid": "unset", + "uid": "0", + "name_map": { + "uid": "root" + } + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "o9OnUmcBTFzn_XoLmmNb", + "source": { + "@timestamp": "2018-11-27T00:52:54.002Z", + "event": { + "type": "user_login", + "action": "logged-in", + "module": "auditd", + "category": "user-login" + }, + "user": { + "name_map": { + "uid": "root" + }, + "auid": "unset", + "uid": "0" + }, + "beat": { + "name": "demo-stack-apache-01", + "hostname": "demo-stack-apache-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-apache-01" + }, + "process": { + "pid": "25143", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "190.0.10.138" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "data": { + "terminal": "sshd", + "op": "login", + "acct": "(invalid user)" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + }, + "object": { + "primary": "sshd", + "secondary": "190.0.10.138", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 184319, + "result": "fail", + "session": "unset" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "pNOnUmcBTFzn_XoLmmNb", + "source": { + "@timestamp": "2018-11-27T00:52:54.109Z", + "source": { + "ip": "190.0.10.138" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "sequence": 184320, + "result": "fail", + "session": "unset", + "data": { + "op": "PAM:bad_ident", + "hostname": "190.0.10.138", + "terminal": "ssh" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "root" + }, + "object": { + "secondary": "190.0.10.138", + "type": "user-session", + "primary": "ssh" + }, + "how": "/usr/sbin/sshd" + } + }, + "beat": { + "hostname": "demo-stack-apache-01", + "version": "7.0.0-alpha1", + "name": "demo-stack-apache-01" + }, + "host": { + "name": "demo-stack-apache-01" + }, + "event": { + "category": "user-login", + "type": "user_err", + "action": "error", + "module": "auditd" + }, + "user": { + "auid": "unset", + "uid": "0", + "name_map": { + "uid": "root" + } + }, + "process": { + "exe": "/usr/sbin/sshd", + "pid": "25143" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "59OrUmcBTFzn_XoL6cFF", + "source": { + "@timestamp": "2018-11-27T00:57:36.347Z", + "network": { + "direction": "incoming" + }, + "auditd": { + "sequence": 192455, + "result": "fail", + "session": "unset", + "data": { + "terminal": "sshd", + "op": "login", + "acct": "(unknown user)" + }, + "summary": { + "actor": { + "secondary": "(unknown user)", + "primary": "unset" + }, + "object": { + "secondary": "202.28.34.200", + "type": "user-session", + "primary": "sshd" + }, + "how": "/usr/sbin/sshd" + } + }, + "beat": { + "name": "demo-stack-nginx-01", + "hostname": "demo-stack-nginx-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-nginx-01" + }, + "event": { + "type": "user_login", + "action": "logged-in", + "module": "auditd", + "category": "user-login" + }, + "user": { + "uid": "0", + "auid": "unset", + "name_map": { + "uid": "root" + } + }, + "process": { + "pid": "32742", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "202.28.34.200" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "6NOrUmcBTFzn_XoL6cFF", + "source": { + "@timestamp": "2018-11-27T00:57:36.348Z", + "user": { + "name_map": { + "uid": "root" + }, + "auid": "unset", + "uid": "0" + }, + "process": { + "exe": "/usr/sbin/sshd", + "pid": "32742" + }, + "source": { + "ip": "202.28.34.200" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "sequence": 192456, + "result": "fail", + "session": "unset", + "data": { + "terminal": "sshd", + "acct": "(invalid user)", + "op": "login" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + }, + "object": { + "primary": "sshd", + "secondary": "202.28.34.200", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + } + }, + "event": { + "action": "logged-in", + "module": "auditd", + "category": "user-login", + "type": "user_login" + }, + "beat": { + "name": "demo-stack-nginx-01", + "hostname": "demo-stack-nginx-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-nginx-01" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "6dOrUmcBTFzn_XoL6cFF", + "source": { + "@timestamp": "2018-11-27T00:57:36.577Z", + "process": { + "pid": "32742", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "202.28.34.200" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "result": "fail", + "session": "unset", + "data": { + "hostname": "202.28.34.200", + "op": "PAM:bad_ident", + "terminal": "ssh" + }, + "summary": { + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "root" + }, + "object": { + "type": "user-session", + "primary": "ssh", + "secondary": "202.28.34.200" + } + }, + "sequence": 192457 + }, + "beat": { + "name": "demo-stack-nginx-01", + "hostname": "demo-stack-nginx-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-nginx-01" + }, + "event": { + "type": "user_err", + "action": "error", + "module": "auditd", + "category": "user-login" + }, + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "P9OsUmcBTFzn_XoLBsX4", + "source": { + "@timestamp": "2018-11-27T00:57:43.944Z", + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "beat": { + "version": "7.0.0-alpha1", + "name": "demo-stack-mysql-01", + "hostname": "demo-stack-mysql-01" + }, + "host": { + "name": "demo-stack-mysql-01" + }, + "process": { + "pid": "12534", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "103.10.44.255" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "data": { + "terminal": "sshd", + "acct": "(unknown user)", + "op": "login" + }, + "summary": { + "actor": { + "secondary": "(unknown user)", + "primary": "unset" + }, + "object": { + "secondary": "103.10.44.255", + "type": "user-session", + "primary": "sshd" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 43146, + "result": "fail", + "session": "unset" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "QNOsUmcBTFzn_XoLBsX4", + "source": { + "@timestamp": "2018-11-27T00:57:43.948Z", + "process": { + "pid": "12534", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "103.10.44.255" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "sequence": 43147, + "result": "fail", + "session": "unset", + "data": { + "acct": "(invalid user)", + "op": "login", + "terminal": "sshd" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + }, + "object": { + "type": "user-session", + "primary": "sshd", + "secondary": "103.10.44.255" + }, + "how": "/usr/sbin/sshd" + } + }, + "beat": { + "name": "demo-stack-mysql-01", + "hostname": "demo-stack-mysql-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-mysql-01" + }, + "event": { + "action": "logged-in", + "module": "auditd", + "category": "user-login", + "type": "user_login" + }, + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "QdOsUmcBTFzn_XoLBsX4", + "source": { + "@timestamp": "2018-11-27T00:57:44.144Z", + "event": { + "module": "auditd", + "category": "user-login", + "type": "user_err", + "action": "error" + }, + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + }, + "process": { + "pid": "12534", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "103.10.44.255" + }, + "beat": { + "name": "demo-stack-mysql-01", + "hostname": "demo-stack-mysql-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-mysql-01" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "data": { + "hostname": "103.10.44.255", + "op": "PAM:bad_ident", + "terminal": "ssh" + }, + "summary": { + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "root" + }, + "object": { + "primary": "ssh", + "secondary": "103.10.44.255", + "type": "user-session" + } + }, + "sequence": 43148, + "result": "fail", + "session": "unset" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "FNOpUmcBTFzn_XoLlY-1", + "source": { + "@timestamp": "2018-11-27T00:55:03.881Z", + "auditd": { + "result": "fail", + "session": "unset", + "data": { + "terminal": "sshd", + "op": "login", + "acct": "(unknown user)" + }, + "summary": { + "object": { + "primary": "sshd", + "secondary": "146.0.105.29", + "type": "user-session" + }, + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + } + }, + "sequence": 186287 + }, + "beat": { + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-redis-01" + }, + "event": { + "module": "auditd", + "category": "user-login", + "type": "user_login", + "action": "logged-in" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "pid": "32040", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "146.0.105.29" + }, + "network": { + "direction": "incoming" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "FdOpUmcBTFzn_XoLlY-1", + "source": { + "@timestamp": "2018-11-27T00:55:03.882Z", + "network": { + "direction": "incoming" + }, + "auditd": { + "data": { + "op": "login", + "acct": "(invalid user)", + "terminal": "sshd" + }, + "summary": { + "object": { + "secondary": "146.0.105.29", + "type": "user-session", + "primary": "sshd" + }, + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + } + }, + "sequence": 186288, + "result": "fail", + "session": "unset" + }, + "event": { + "type": "user_login", + "action": "logged-in", + "module": "auditd", + "category": "user-login" + }, + "user": { + "name_map": { + "uid": "root" + }, + "uid": "0", + "auid": "unset" + }, + "process": { + "pid": "32040", + "exe": "/usr/sbin/sshd" + }, + "beat": { + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-redis-01" + }, + "source": { + "ip": "146.0.105.29" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "FtOpUmcBTFzn_XoLlY-1", + "source": { + "@timestamp": "2018-11-27T00:55:04.004Z", + "beat": { + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-redis-01" + }, + "auditd": { + "summary": { + "actor": { + "secondary": "root", + "primary": "unset" + }, + "object": { + "secondary": "146.0.105.29", + "type": "user-session", + "primary": "ssh" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 186289, + "result": "fail", + "session": "unset", + "data": { + "op": "PAM:bad_ident", + "terminal": "ssh", + "hostname": "146.0.105.29" + } + }, + "event": { + "category": "user-login", + "type": "user_err", + "action": "error", + "module": "auditd" + }, + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + }, + "process": { + "pid": "32040", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "146.0.105.29" + }, + "network": { + "direction": "incoming" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "FtOpUmcBTFzn_XoL5pZA", + "source": { + "@timestamp": "2018-11-27T00:55:24.501Z", + "process": { + "pid": "12520", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "217.19.148.142" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "summary": { + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + }, + "object": { + "secondary": "217.19.148.142", + "type": "user-session", + "primary": "sshd" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 43143, + "result": "fail", + "session": "unset", + "data": { + "acct": "(unknown user)", + "terminal": "sshd", + "op": "login" + } + }, + "event": { + "action": "logged-in", + "module": "auditd", + "category": "user-login", + "type": "user_login" + }, + "beat": { + "name": "demo-stack-mysql-01", + "hostname": "demo-stack-mysql-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-mysql-01" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "F9OpUmcBTFzn_XoL5pZA", + "source": { + "@timestamp": "2018-11-27T00:55:24.501Z", + "host": { + "name": "demo-stack-mysql-01" + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + }, + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + }, + "process": { + "exe": "/usr/sbin/sshd", + "pid": "12520" + }, + "source": { + "ip": "217.19.148.142" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "data": { + "terminal": "sshd", + "op": "login", + "acct": "(invalid user)" + }, + "summary": { + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + }, + "object": { + "primary": "sshd", + "secondary": "217.19.148.142", + "type": "user-session" + } + }, + "sequence": 43144, + "result": "fail", + "session": "unset" + }, + "beat": { + "name": "demo-stack-mysql-01", + "hostname": "demo-stack-mysql-01", + "version": "7.0.0-alpha1" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "GNOpUmcBTFzn_XoL5pZA", + "source": { + "@timestamp": "2018-11-27T00:55:24.637Z", + "beat": { + "name": "demo-stack-mysql-01", + "hostname": "demo-stack-mysql-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-mysql-01" + }, + "event": { + "module": "auditd", + "category": "user-login", + "type": "user_err", + "action": "error" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "pid": "12520", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "217.19.148.142" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "data": { + "op": "PAM:bad_ident", + "terminal": "ssh", + "hostname": "217.19.148.142" + }, + "summary": { + "actor": { + "secondary": "root", + "primary": "unset" + }, + "object": { + "primary": "ssh", + "secondary": "217.19.148.142", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 43145, + "result": "fail", + "session": "unset" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "2NOmUmcBTFzn_XoLfUpL", + "source": { + "@timestamp": "2018-11-27T00:51:41.026Z", + "network": { + "direction": "incoming" + }, + "auditd": { + "data": { + "acct": "(unknown user)", + "op": "login", + "terminal": "sshd" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + }, + "object": { + "primary": "sshd", + "secondary": "59.120.243.8", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 184315, + "result": "fail", + "session": "unset" + }, + "beat": { + "name": "demo-stack-apache-01", + "hostname": "demo-stack-apache-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-apache-01" + }, + "event": { + "action": "logged-in", + "module": "auditd", + "category": "user-login", + "type": "user_login" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "pid": "25134", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "59.120.243.8" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "2dOmUmcBTFzn_XoLfUpL", + "source": { + "@timestamp": "2018-11-27T00:51:41.027Z", + "network": { + "direction": "incoming" + }, + "auditd": { + "data": { + "acct": "(invalid user)", + "op": "login", + "terminal": "sshd" + }, + "summary": { + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + }, + "object": { + "primary": "sshd", + "secondary": "59.120.243.8", + "type": "user-session" + } + }, + "sequence": 184316, + "result": "fail", + "session": "unset" + }, + "event": { + "type": "user_login", + "action": "logged-in", + "module": "auditd", + "category": "user-login" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "pid": "25134", + "exe": "/usr/sbin/sshd" + }, + "beat": { + "name": "demo-stack-apache-01", + "hostname": "demo-stack-apache-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-apache-01" + }, + "source": { + "ip": "59.120.243.8" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "2tOmUmcBTFzn_XoLfUpL", + "source": { + "@timestamp": "2018-11-27T00:51:41.202Z", + "beat": { + "name": "demo-stack-apache-01", + "hostname": "demo-stack-apache-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-apache-01" + }, + "event": { + "type": "user_err", + "action": "error", + "module": "auditd", + "category": "user-login" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "exe": "/usr/sbin/sshd", + "pid": "25134" + }, + "source": { + "ip": "59.120.243.8" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "data": { + "hostname": "59.120.243.8", + "op": "PAM:bad_ident", + "terminal": "ssh" + }, + "summary": { + "object": { + "primary": "ssh", + "secondary": "59.120.243.8", + "type": "user-session" + }, + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "root" + } + }, + "sequence": 184317, + "result": "fail", + "session": "unset" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "h9OpUmcBTFzn_XoLWIru", + "source": { + "@timestamp": "2018-11-27T00:54:48.324Z", + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + }, + "beat": { + "version": "7.0.0-alpha1", + "name": "demo-stack-nginx-01", + "hostname": "demo-stack-nginx-01" + }, + "host": { + "name": "demo-stack-nginx-01" + }, + "process": { + "pid": "32723", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "124.6.139.242" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "session": "unset", + "data": { + "terminal": "sshd", + "acct": "(unknown user)", + "op": "login" + }, + "summary": { + "object": { + "primary": "sshd", + "secondary": "124.6.139.242", + "type": "user-session" + }, + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + } + }, + "sequence": 192452, + "result": "fail" + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "iNOpUmcBTFzn_XoLWIru", + "source": { + "@timestamp": "2018-11-27T00:54:48.325Z", + "process": { + "pid": "32723", + "exe": "/usr/sbin/sshd" + }, + "beat": { + "version": "7.0.0-alpha1", + "name": "demo-stack-nginx-01", + "hostname": "demo-stack-nginx-01" + }, + "host": { + "name": "demo-stack-nginx-01" + }, + "source": { + "ip": "124.6.139.242" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "session": "unset", + "data": { + "acct": "(invalid user)", + "terminal": "sshd", + "op": "login" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + }, + "object": { + "primary": "sshd", + "secondary": "124.6.139.242", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 192453, + "result": "fail" + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + }, + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "idOpUmcBTFzn_XoLWIru", + "source": { + "@timestamp": "2018-11-27T00:54:48.556Z", + "beat": { + "name": "demo-stack-nginx-01", + "hostname": "demo-stack-nginx-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-nginx-01" + }, + "event": { + "category": "user-login", + "type": "user_err", + "action": "error", + "module": "auditd" + }, + "user": { + "name_map": { + "uid": "root" + }, + "uid": "0", + "auid": "unset" + }, + "process": { + "pid": "32723", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "124.6.139.242" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "data": { + "terminal": "ssh", + "op": "PAM:bad_ident", + "hostname": "124.6.139.242" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "root" + }, + "object": { + "primary": "ssh", + "secondary": "124.6.139.242", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 192454, + "result": "fail", + "session": "unset" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "YtOqUmcBTFzn_XoLnqU0", + "source": { + "@timestamp": "2018-11-27T00:56:11.591Z", + "beat": { + "name": "demo-stack-es-01", + "hostname": "demo-stack-es-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-es-01" + }, + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + }, + "process": { + "pid": "28851", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "93.152.166.29" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "sequence": 44139, + "result": "fail", + "session": "unset", + "data": { + "terminal": "sshd", + "op": "login", + "acct": "(unknown user)" + }, + "summary": { + "object": { + "secondary": "93.152.166.29", + "type": "user-session", + "primary": "sshd" + }, + "how": "/usr/sbin/sshd", + "actor": { + "secondary": "(unknown user)", + "primary": "unset" + } + } + }, + "event": { + "module": "auditd", + "category": "user-login", + "type": "user_login", + "action": "logged-in" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "Y9OqUmcBTFzn_XoLnqU0", + "source": { + "@timestamp": "2018-11-27T00:56:11.591Z", + "source": { + "ip": "93.152.166.29" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "session": "unset", + "data": { + "acct": "(invalid user)", + "terminal": "sshd", + "op": "login" + }, + "summary": { + "actor": { + "secondary": "(invalid user)", + "primary": "unset" + }, + "object": { + "secondary": "93.152.166.29", + "type": "user-session", + "primary": "sshd" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 44140, + "result": "fail" + }, + "event": { + "type": "user_login", + "action": "logged-in", + "module": "auditd", + "category": "user-login" + }, + "beat": { + "name": "demo-stack-es-01", + "hostname": "demo-stack-es-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-es-01" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "exe": "/usr/sbin/sshd", + "pid": "28851" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "ZNOqUmcBTFzn_XoLnqU0", + "source": { + "@timestamp": "2018-11-27T00:56:11.743Z", + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "pid": "28851", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "93.152.166.29" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "summary": { + "object": { + "primary": "ssh", + "secondary": "93.152.166.29", + "type": "user-session" + }, + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "root" + } + }, + "sequence": 44141, + "result": "fail", + "session": "unset", + "data": { + "terminal": "ssh", + "hostname": "93.152.166.29", + "op": "PAM:bad_ident" + } + }, + "event": { + "category": "user-login", + "type": "user_err", + "action": "error", + "module": "auditd" + }, + "beat": { + "name": "demo-stack-es-01", + "hostname": "demo-stack-es-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-es-01" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "q9OnUmcBTFzn_XoLxWfH", + "source": { + "@timestamp": "2018-11-27T00:53:05.113Z", + "process": { + "pid": "28796", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "222.117.50.66" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "sequence": 44136, + "result": "fail", + "session": "unset", + "data": { + "acct": "(unknown user)", + "terminal": "sshd", + "op": "login" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + }, + "object": { + "primary": "sshd", + "secondary": "222.117.50.66", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + } + }, + "beat": { + "name": "demo-stack-es-01", + "hostname": "demo-stack-es-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-es-01" + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "rNOnUmcBTFzn_XoLxWfH", + "source": { + "@timestamp": "2018-11-27T00:53:05.113Z", + "user": { + "name_map": { + "uid": "root" + }, + "uid": "0", + "auid": "unset" + }, + "process": { + "pid": "28796", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "222.117.50.66" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "result": "fail", + "session": "unset", + "data": { + "op": "login", + "terminal": "sshd", + "acct": "(invalid user)" + }, + "summary": { + "object": { + "primary": "sshd", + "secondary": "222.117.50.66", + "type": "user-session" + }, + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + } + }, + "sequence": 44137 + }, + "beat": { + "name": "demo-stack-es-01", + "hostname": "demo-stack-es-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-es-01" + }, + "event": { + "action": "logged-in", + "module": "auditd", + "category": "user-login", + "type": "user_login" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "rdOnUmcBTFzn_XoLxWfH", + "source": { + "@timestamp": "2018-11-27T00:53:05.277Z", + "event": { + "type": "user_err", + "action": "error", + "module": "auditd", + "category": "user-login" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "beat": { + "name": "demo-stack-es-01", + "hostname": "demo-stack-es-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-es-01" + }, + "process": { + "pid": "28796", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "222.117.50.66" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "summary": { + "actor": { + "primary": "unset", + "secondary": "root" + }, + "object": { + "primary": "ssh", + "secondary": "222.117.50.66", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 44138, + "result": "fail", + "session": "unset", + "data": { + "terminal": "ssh", + "hostname": "222.117.50.66", + "op": "PAM:bad_ident" + } + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "_tSyUmcBTFzn_XoLI0rV", + "source": { + "@timestamp": "2018-11-27T01:04:24.552Z", + "user": { + "name_map": { + "uid": "root" + }, + "auid": "unset", + "uid": "0" + }, + "process": { + "pid": "32096", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "115.146.127.133" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "sequence": 186305, + "result": "fail", + "session": "unset", + "data": { + "op": "login", + "acct": "(unknown user)", + "terminal": "sshd" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + }, + "object": { + "type": "user-session", + "primary": "sshd", + "secondary": "115.146.127.133" + }, + "how": "/usr/sbin/sshd" + } + }, + "host": { + "name": "demo-stack-redis-01" + }, + "beat": { + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1" + }, + "event": { + "module": "auditd", + "category": "user-login", + "type": "user_login", + "action": "logged-in" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "_9SyUmcBTFzn_XoLI0rV", + "source": { + "@timestamp": "2018-11-27T01:04:24.554Z", + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + }, + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + }, + "process": { + "pid": "32096", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "115.146.127.133" + }, + "beat": { + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-redis-01" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "sequence": 186306, + "result": "fail", + "session": "unset", + "data": { + "terminal": "sshd", + "op": "login", + "acct": "(invalid user)" + }, + "summary": { + "object": { + "primary": "sshd", + "secondary": "115.146.127.133", + "type": "user-session" + }, + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + } + } + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "ANSyUmcBTFzn_XoLI0vV", + "source": { + "@timestamp": "2018-11-27T01:04:24.758Z", + "event": { + "category": "user-login", + "type": "user_err", + "action": "error", + "module": "auditd" + }, + "beat": { + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1", + "name": "demo-stack-redis-01" + }, + "host": { + "name": "demo-stack-redis-01" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "exe": "/usr/sbin/sshd", + "pid": "32096" + }, + "source": { + "ip": "115.146.127.133" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "sequence": 186307, + "result": "fail", + "session": "unset", + "data": { + "terminal": "ssh", + "op": "PAM:bad_ident", + "hostname": "115.146.127.133" + }, + "summary": { + "object": { + "secondary": "115.146.127.133", + "type": "user-session", + "primary": "ssh" + }, + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "root" + } + } + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "oNSxUmcBTFzn_XoL-0d6", + "source": { + "@timestamp": "2018-11-27T01:04:14.224Z", + "beat": { + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-redis-01" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "pid": "32089", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "107.170.65.109" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "sequence": 186302, + "result": "fail", + "session": "unset", + "data": { + "acct": "(unknown user)", + "op": "login", + "terminal": "sshd" + }, + "summary": { + "actor": { + "secondary": "(unknown user)", + "primary": "unset" + }, + "object": { + "primary": "sshd", + "secondary": "107.170.65.109", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + } + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "odSxUmcBTFzn_XoL-0d6", + "source": { + "@timestamp": "2018-11-27T01:04:14.225Z", + "process": { + "exe": "/usr/sbin/sshd", + "pid": "32089" + }, + "source": { + "ip": "107.170.65.109" + }, + "network": { + "direction": "incoming" + }, + "beat": { + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-redis-01" + }, + "auditd": { + "sequence": 186303, + "result": "fail", + "session": "unset", + "data": { + "terminal": "sshd", + "op": "login", + "acct": "(invalid user)" + }, + "summary": { + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + }, + "object": { + "type": "user-session", + "primary": "sshd", + "secondary": "107.170.65.109" + } + } + }, + "event": { + "type": "user_login", + "action": "logged-in", + "module": "auditd", + "category": "user-login" + }, + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "otSxUmcBTFzn_XoL-0d6", + "source": { + "@timestamp": "2018-11-27T01:04:14.256Z", + "event": { + "type": "user_err", + "action": "error", + "module": "auditd", + "category": "user-login" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "exe": "/usr/sbin/sshd", + "pid": "32089" + }, + "source": { + "ip": "107.170.65.109" + }, + "host": { + "name": "demo-stack-redis-01" + }, + "beat": { + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "session": "unset", + "data": { + "hostname": "107.170.65.109", + "terminal": "ssh", + "op": "PAM:bad_ident" + }, + "summary": { + "object": { + "secondary": "107.170.65.109", + "type": "user-session", + "primary": "ssh" + }, + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "root" + } + }, + "sequence": 186304, + "result": "fail" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "JNSyUmcBTFzn_XoL2FqQ", + "source": { + "@timestamp": "2018-11-27T01:05:10.789Z", + "network": { + "direction": "incoming" + }, + "beat": { + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-redis-01" + }, + "auditd": { + "result": "fail", + "session": "unset", + "data": { + "op": "login", + "acct": "(unknown user)", + "terminal": "sshd" + }, + "summary": { + "actor": { + "secondary": "(unknown user)", + "primary": "unset" + }, + "object": { + "type": "user-session", + "primary": "sshd", + "secondary": "107.170.65.109" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 186308 + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + }, + "user": { + "name_map": { + "uid": "root" + }, + "auid": "unset", + "uid": "0" + }, + "process": { + "pid": "32100", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "107.170.65.109" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "JdSyUmcBTFzn_XoL2FqQ", + "source": { + "@timestamp": "2018-11-27T01:05:10.790Z", + "host": { + "name": "demo-stack-redis-01" + }, + "event": { + "type": "user_login", + "action": "logged-in", + "module": "auditd", + "category": "user-login" + }, + "user": { + "auid": "unset", + "uid": "0", + "name_map": { + "uid": "root" + } + }, + "process": { + "pid": "32100", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "107.170.65.109" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "sequence": 186309, + "result": "fail", + "session": "unset", + "data": { + "op": "login", + "terminal": "sshd", + "acct": "(invalid user)" + }, + "summary": { + "object": { + "type": "user-session", + "primary": "sshd", + "secondary": "107.170.65.109" + }, + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + } + } + }, + "beat": { + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "JtSyUmcBTFzn_XoL2FqQ", + "source": { + "@timestamp": "2018-11-27T01:05:10.821Z", + "network": { + "direction": "incoming" + }, + "auditd": { + "sequence": 186310, + "result": "fail", + "session": "unset", + "data": { + "hostname": "107.170.65.109", + "terminal": "ssh", + "op": "PAM:bad_ident" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "root" + }, + "object": { + "primary": "ssh", + "secondary": "107.170.65.109", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + } + }, + "event": { + "module": "auditd", + "category": "user-login", + "type": "user_err", + "action": "error" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "pid": "32100", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "107.170.65.109" + }, + "beat": { + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-redis-01" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "9tSxUmcBTFzn_XoLATF1", + "source": { + "@timestamp": "2018-11-27T01:03:10.216Z", + "auditd": { + "sequence": 142318, + "result": "fail", + "session": "unset", + "data": { + "terminal": "sshd", + "op": "login", + "acct": "(unknown user)" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + }, + "object": { + "type": "user-session", + "primary": "sshd", + "secondary": "81.174.25.52" + }, + "how": "/usr/sbin/sshd" + } + }, + "event": { + "action": "logged-in", + "module": "auditd", + "category": "user-login", + "type": "user_login" + }, + "user": { + "auid": "unset", + "uid": "0", + "name_map": { + "uid": "root" + } + }, + "beat": { + "name": "demo-stack-haproxy-01", + "hostname": "demo-stack-haproxy-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-haproxy-01" + }, + "process": { + "pid": "19519", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "81.174.25.52" + }, + "network": { + "direction": "incoming" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "99SxUmcBTFzn_XoLATF1", + "source": { + "@timestamp": "2018-11-27T01:03:10.217Z", + "process": { + "pid": "19519", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "81.174.25.52" + }, + "beat": { + "name": "demo-stack-haproxy-01", + "hostname": "demo-stack-haproxy-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-haproxy-01" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "result": "fail", + "session": "unset", + "data": { + "terminal": "sshd", + "op": "login", + "acct": "(invalid user)" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + }, + "object": { + "primary": "sshd", + "secondary": "81.174.25.52", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 142319 + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + }, + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "-NSxUmcBTFzn_XoLATF1", + "source": { + "@timestamp": "2018-11-27T01:03:10.360Z", + "auditd": { + "data": { + "op": "PAM:bad_ident", + "terminal": "ssh", + "hostname": "81.174.25.52" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "root" + }, + "object": { + "primary": "ssh", + "secondary": "81.174.25.52", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 142320, + "result": "fail", + "session": "unset" + }, + "beat": { + "name": "demo-stack-haproxy-01", + "hostname": "demo-stack-haproxy-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-haproxy-01" + }, + "event": { + "category": "user-login", + "type": "user_err", + "action": "error", + "module": "auditd" + }, + "user": { + "name_map": { + "uid": "root" + }, + "uid": "0", + "auid": "unset" + }, + "process": { + "pid": "19519", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "81.174.25.52" + }, + "network": { + "direction": "incoming" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "69SyUmcBTFzn_XoLSE3q", + "source": { + "@timestamp": "2018-11-27T01:04:34.043Z", + "source": { + "ip": "110.170.166.101" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "session": "unset", + "data": { + "op": "login", + "terminal": "sshd", + "acct": "(unknown user)" + }, + "summary": { + "actor": { + "secondary": "(unknown user)", + "primary": "unset" + }, + "object": { + "primary": "sshd", + "secondary": "110.170.166.101", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 43149, + "result": "fail" + }, + "event": { + "action": "logged-in", + "module": "auditd", + "category": "user-login", + "type": "user_login" + }, + "host": { + "name": "demo-stack-mysql-01" + }, + "beat": { + "name": "demo-stack-mysql-01", + "hostname": "demo-stack-mysql-01", + "version": "7.0.0-alpha1" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "pid": "12572", + "exe": "/usr/sbin/sshd" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "7NSyUmcBTFzn_XoLSE3q", + "source": { + "@timestamp": "2018-11-27T01:04:34.043Z", + "event": { + "module": "auditd", + "category": "user-login", + "type": "user_login", + "action": "logged-in" + }, + "user": { + "auid": "unset", + "uid": "0", + "name_map": { + "uid": "root" + } + }, + "beat": { + "name": "demo-stack-mysql-01", + "hostname": "demo-stack-mysql-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-mysql-01" + }, + "process": { + "pid": "12572", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "110.170.166.101" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "sequence": 43150, + "result": "fail", + "session": "unset", + "data": { + "op": "login", + "terminal": "sshd", + "acct": "(invalid user)" + }, + "summary": { + "object": { + "type": "user-session", + "primary": "sshd", + "secondary": "110.170.166.101" + }, + "how": "/usr/sbin/sshd", + "actor": { + "secondary": "(invalid user)", + "primary": "unset" + } + } + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "7dSyUmcBTFzn_XoLSE3q", + "source": { + "@timestamp": "2018-11-27T01:04:34.263Z", + "auditd": { + "summary": { + "object": { + "secondary": "110.170.166.101", + "type": "user-session", + "primary": "ssh" + }, + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "root" + } + }, + "sequence": 43151, + "result": "fail", + "session": "unset", + "data": { + "terminal": "ssh", + "hostname": "110.170.166.101", + "op": "PAM:bad_ident" + } + }, + "event": { + "module": "auditd", + "category": "user-login", + "type": "user_err", + "action": "error" + }, + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + }, + "process": { + "exe": "/usr/sbin/sshd", + "pid": "12572" + }, + "beat": { + "name": "demo-stack-mysql-01", + "hostname": "demo-stack-mysql-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-mysql-01" + }, + "source": { + "ip": "110.170.166.101" + }, + "network": { + "direction": "incoming" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "R9SzUmcBTFzn_XoLbGcD", + "source": { + "@timestamp": "2018-11-27T01:05:48.570Z", + "network": { + "direction": "incoming" + }, + "auditd": { + "sequence": 192461, + "result": "fail", + "session": "unset", + "data": { + "op": "login", + "acct": "(unknown user)", + "terminal": "sshd" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + }, + "object": { + "primary": "sshd", + "secondary": "178.155.249.205", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + } + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + }, + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + }, + "process": { + "pid": "316", + "exe": "/usr/sbin/sshd" + }, + "beat": { + "hostname": "demo-stack-nginx-01", + "version": "7.0.0-alpha1", + "name": "demo-stack-nginx-01" + }, + "host": { + "name": "demo-stack-nginx-01" + }, + "source": { + "ip": "178.155.249.205" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "SNSzUmcBTFzn_XoLbGcD", + "source": { + "@timestamp": "2018-11-27T01:05:48.571Z", + "process": { + "pid": "316", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "178.155.249.205" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "sequence": 192462, + "result": "fail", + "session": "unset", + "data": { + "terminal": "sshd", + "op": "login", + "acct": "(invalid user)" + }, + "summary": { + "object": { + "primary": "sshd", + "secondary": "178.155.249.205", + "type": "user-session" + }, + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + } + } + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + }, + "beat": { + "name": "demo-stack-nginx-01", + "hostname": "demo-stack-nginx-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-nginx-01" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "SdSzUmcBTFzn_XoLbGcD", + "source": { + "@timestamp": "2018-11-27T01:05:48.697Z", + "event": { + "category": "user-login", + "type": "user_err", + "action": "error", + "module": "auditd" + }, + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + }, + "process": { + "pid": "316", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "178.155.249.205" + }, + "beat": { + "version": "7.0.0-alpha1", + "name": "demo-stack-nginx-01", + "hostname": "demo-stack-nginx-01" + }, + "host": { + "name": "demo-stack-nginx-01" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "result": "fail", + "session": "unset", + "data": { + "op": "PAM:bad_ident", + "terminal": "ssh", + "hostname": "178.155.249.205" + }, + "summary": { + "object": { + "primary": "ssh", + "secondary": "178.155.249.205", + "type": "user-session" + }, + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "root" + } + }, + "sequence": 192463 + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "wtSxUmcBTFzn_XoLPTZz", + "source": { + "@timestamp": "2018-11-27T01:03:25.577Z", + "host": { + "name": "demo-stack-redis-01" + }, + "event": { + "action": "logged-in", + "module": "auditd", + "category": "user-login", + "type": "user_login" + }, + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + }, + "process": { + "pid": "32085", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "107.170.65.109" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "session": "unset", + "data": { + "op": "login", + "terminal": "sshd", + "acct": "(unknown user)" + }, + "summary": { + "object": { + "primary": "sshd", + "secondary": "107.170.65.109", + "type": "user-session" + }, + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + } + }, + "sequence": 186296, + "result": "fail" + }, + "beat": { + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "w9SxUmcBTFzn_XoLPTZz", + "source": { + "@timestamp": "2018-11-27T01:03:25.578Z", + "process": { + "pid": "32085", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "107.170.65.109" + }, + "network": { + "direction": "incoming" + }, + "beat": { + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-redis-01" + }, + "auditd": { + "sequence": 186297, + "result": "fail", + "session": "unset", + "data": { + "terminal": "sshd", + "op": "login", + "acct": "(invalid user)" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + }, + "object": { + "primary": "sshd", + "secondary": "107.170.65.109", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + } + }, + "event": { + "module": "auditd", + "category": "user-login", + "type": "user_login", + "action": "logged-in" + }, + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "xNSxUmcBTFzn_XoLPTZz", + "source": { + "@timestamp": "2018-11-27T01:03:25.609Z", + "network": { + "direction": "incoming" + }, + "auditd": { + "summary": { + "actor": { + "primary": "unset", + "secondary": "root" + }, + "object": { + "primary": "ssh", + "secondary": "107.170.65.109", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 186298, + "result": "fail", + "session": "unset", + "data": { + "terminal": "ssh", + "hostname": "107.170.65.109", + "op": "PAM:bad_ident" + } + }, + "beat": { + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-redis-01" + }, + "event": { + "action": "error", + "module": "auditd", + "category": "user-login", + "type": "user_err" + }, + "user": { + "name_map": { + "uid": "root" + }, + "auid": "unset", + "uid": "0" + }, + "process": { + "pid": "32085", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "107.170.65.109" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "jdSxUmcBTFzn_XoLZToB", + "source": { + "@timestamp": "2018-11-27T01:03:35.702Z", + "host": { + "name": "demo-stack-redis-01" + }, + "event": { + "type": "user_login", + "action": "logged-in", + "module": "auditd", + "category": "user-login" + }, + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + }, + "process": { + "pid": "32087", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "104.131.37.34" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "data": { + "terminal": "sshd", + "acct": "(unknown user)", + "op": "login" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + }, + "object": { + "primary": "sshd", + "secondary": "104.131.37.34", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 186299, + "result": "fail", + "session": "unset" + }, + "beat": { + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "jtSxUmcBTFzn_XoLZToB", + "source": { + "@timestamp": "2018-11-27T01:03:35.707Z", + "network": { + "direction": "incoming" + }, + "beat": { + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1", + "name": "demo-stack-redis-01" + }, + "host": { + "name": "demo-stack-redis-01" + }, + "auditd": { + "result": "fail", + "session": "unset", + "data": { + "terminal": "sshd", + "acct": "(invalid user)", + "op": "login" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + }, + "object": { + "type": "user-session", + "primary": "sshd", + "secondary": "104.131.37.34" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 186300 + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + }, + "user": { + "name_map": { + "uid": "root" + }, + "auid": "unset", + "uid": "0" + }, + "process": { + "pid": "32087", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "104.131.37.34" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "j9SxUmcBTFzn_XoLZToB", + "source": { + "@timestamp": "2018-11-27T01:03:35.739Z", + "beat": { + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-redis-01" + }, + "source": { + "ip": "104.131.37.34" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "session": "unset", + "data": { + "terminal": "ssh", + "hostname": "104.131.37.34", + "op": "PAM:bad_ident" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "root" + }, + "object": { + "primary": "ssh", + "secondary": "104.131.37.34", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 186301, + "result": "fail" + }, + "event": { + "type": "user_err", + "action": "error", + "module": "auditd", + "category": "user-login" + }, + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + }, + "process": { + "pid": "32087", + "exe": "/usr/sbin/sshd" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "ydSzUmcBTFzn_XoLemeL", + "source": { + "@timestamp": "2018-11-27T01:05:52.289Z", + "network": { + "direction": "incoming" + }, + "auditd": { + "sequence": 192464, + "result": "fail", + "session": "unset", + "data": { + "acct": "(unknown user)", + "terminal": "sshd", + "op": "login" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + }, + "object": { + "type": "user-session", + "primary": "sshd", + "secondary": "195.68.29.234" + }, + "how": "/usr/sbin/sshd" + } + }, + "event": { + "type": "user_login", + "action": "logged-in", + "module": "auditd", + "category": "user-login" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "pid": "323", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "195.68.29.234" + }, + "beat": { + "name": "demo-stack-nginx-01", + "hostname": "demo-stack-nginx-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-nginx-01" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "ytSzUmcBTFzn_XoLemeL", + "source": { + "@timestamp": "2018-11-27T01:05:52.290Z", + "auditd": { + "summary": { + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + }, + "object": { + "type": "user-session", + "primary": "sshd", + "secondary": "195.68.29.234" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 192465, + "result": "fail", + "session": "unset", + "data": { + "terminal": "sshd", + "acct": "(invalid user)", + "op": "login" + } + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "pid": "323", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "195.68.29.234" + }, + "beat": { + "version": "7.0.0-alpha1", + "name": "demo-stack-nginx-01", + "hostname": "demo-stack-nginx-01" + }, + "host": { + "name": "demo-stack-nginx-01" + }, + "network": { + "direction": "incoming" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "y9SzUmcBTFzn_XoLemeL", + "source": { + "@timestamp": "2018-11-27T01:05:52.396Z", + "network": { + "direction": "incoming" + }, + "auditd": { + "session": "unset", + "data": { + "terminal": "ssh", + "op": "PAM:bad_ident", + "hostname": "195.68.29.234" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "root" + }, + "object": { + "type": "user-session", + "primary": "ssh", + "secondary": "195.68.29.234" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 192466, + "result": "fail" + }, + "event": { + "category": "user-login", + "type": "user_err", + "action": "error", + "module": "auditd" + }, + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + }, + "beat": { + "version": "7.0.0-alpha1", + "name": "demo-stack-nginx-01", + "hostname": "demo-stack-nginx-01" + }, + "host": { + "name": "demo-stack-nginx-01" + }, + "process": { + "exe": "/usr/sbin/sshd", + "pid": "323" + }, + "source": { + "ip": "195.68.29.234" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "sNS4UmcBTFzn_XoLe9YN", + "source": { + "@timestamp": "2018-11-27T01:11:20.098Z", + "event": { + "action": "logged-in", + "module": "auditd", + "category": "user-login", + "type": "user_login" + }, + "beat": { + "version": "7.0.0-alpha1", + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01" + }, + "host": { + "name": "demo-stack-redis-01" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "pid": "32151", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "107.170.65.109" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "sequence": 186337, + "result": "fail", + "session": "unset", + "data": { + "acct": "(unknown user)", + "terminal": "sshd", + "op": "login" + }, + "summary": { + "how": "/usr/sbin/sshd", + "actor": { + "secondary": "(unknown user)", + "primary": "unset" + }, + "object": { + "type": "user-session", + "primary": "sshd", + "secondary": "107.170.65.109" + } + } + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "sdS4UmcBTFzn_XoLe9YN", + "source": { + "@timestamp": "2018-11-27T01:11:20.099Z", + "beat": { + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-redis-01" + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + }, + "user": { + "auid": "unset", + "uid": "0", + "name_map": { + "uid": "root" + } + }, + "process": { + "pid": "32151", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "107.170.65.109" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "result": "fail", + "session": "unset", + "data": { + "terminal": "sshd", + "op": "login", + "acct": "(invalid user)" + }, + "summary": { + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + }, + "object": { + "primary": "sshd", + "secondary": "107.170.65.109", + "type": "user-session" + } + }, + "sequence": 186338 + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "stS4UmcBTFzn_XoLe9YN", + "source": { + "@timestamp": "2018-11-27T01:11:20.130Z", + "beat": { + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1" + }, + "event": { + "type": "user_err", + "action": "error", + "module": "auditd", + "category": "user-login" + }, + "user": { + "name_map": { + "uid": "root" + }, + "auid": "unset", + "uid": "0" + }, + "process": { + "exe": "/usr/sbin/sshd", + "pid": "32151" + }, + "source": { + "ip": "107.170.65.109" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "data": { + "hostname": "107.170.65.109", + "terminal": "ssh", + "op": "PAM:bad_ident" + }, + "summary": { + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "root" + }, + "object": { + "secondary": "107.170.65.109", + "type": "user-session", + "primary": "ssh" + } + }, + "sequence": 186339, + "result": "fail", + "session": "unset" + }, + "host": { + "name": "demo-stack-redis-01" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "MNS5UmcBTFzn_XoLKuU8", + "source": { + "@timestamp": "2018-11-27T01:12:04.946Z", + "auditd": { + "sequence": 192488, + "result": "fail", + "session": "unset", + "data": { + "acct": "(unknown user)", + "op": "login", + "terminal": "sshd" + }, + "summary": { + "object": { + "secondary": "192.208.184.216", + "type": "user-session", + "primary": "sshd" + }, + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + } + } + }, + "event": { + "type": "user_login", + "action": "logged-in", + "module": "auditd", + "category": "user-login" + }, + "user": { + "auid": "unset", + "uid": "0", + "name_map": { + "uid": "root" + } + }, + "process": { + "pid": "428", + "exe": "/usr/sbin/sshd" + }, + "beat": { + "name": "demo-stack-nginx-01", + "hostname": "demo-stack-nginx-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-nginx-01" + }, + "source": { + "ip": "192.208.184.216" + }, + "network": { + "direction": "incoming" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "MdS5UmcBTFzn_XoLKuU8", + "source": { + "@timestamp": "2018-11-27T01:12:04.947Z", + "network": { + "direction": "incoming" + }, + "auditd": { + "sequence": 192489, + "result": "fail", + "session": "unset", + "data": { + "terminal": "sshd", + "acct": "(invalid user)", + "op": "login" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + }, + "object": { + "primary": "sshd", + "secondary": "192.208.184.216", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + } + }, + "beat": { + "name": "demo-stack-nginx-01", + "hostname": "demo-stack-nginx-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-nginx-01" + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + }, + "user": { + "name_map": { + "uid": "root" + }, + "auid": "unset", + "uid": "0" + }, + "process": { + "pid": "428", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "192.208.184.216" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "MtS5UmcBTFzn_XoLKuU8", + "source": { + "@timestamp": "2018-11-27T01:12:04.962Z", + "user": { + "name_map": { + "uid": "root" + }, + "uid": "0", + "auid": "unset" + }, + "process": { + "pid": "428", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "192.208.184.216" + }, + "beat": { + "hostname": "demo-stack-nginx-01", + "version": "7.0.0-alpha1", + "name": "demo-stack-nginx-01" + }, + "host": { + "name": "demo-stack-nginx-01" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "sequence": 192490, + "result": "fail", + "session": "unset", + "data": { + "terminal": "ssh", + "op": "PAM:bad_ident", + "hostname": "192.208.184.216" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "root" + }, + "object": { + "primary": "ssh", + "secondary": "192.208.184.216", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + } + }, + "event": { + "category": "user-login", + "type": "user_err", + "action": "error", + "module": "auditd" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "GtW7UmcBTFzn_XoLNhOL", + "source": { + "@timestamp": "2018-11-27T01:14:19.169Z", + "beat": { + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-redis-01" + }, + "user": { + "uid": "0", + "auid": "unset", + "name_map": { + "uid": "root" + } + }, + "process": { + "exe": "/usr/sbin/sshd", + "pid": "32173" + }, + "source": { + "ip": "73.15.91.251" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "result": "fail", + "session": "unset", + "data": { + "terminal": "sshd", + "acct": "(unknown user)", + "op": "login" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + }, + "object": { + "secondary": "73.15.91.251", + "type": "user-session", + "primary": "sshd" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 186350 + }, + "event": { + "action": "logged-in", + "module": "auditd", + "category": "user-login", + "type": "user_login" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "G9W7UmcBTFzn_XoLNhOL", + "source": { + "@timestamp": "2018-11-27T01:14:19.170Z", + "source": { + "ip": "73.15.91.251" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "sequence": 186351, + "result": "fail", + "session": "unset", + "data": { + "op": "login", + "terminal": "sshd", + "acct": "(invalid user)" + }, + "summary": { + "object": { + "type": "user-session", + "primary": "sshd", + "secondary": "73.15.91.251" + }, + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + } + } + }, + "host": { + "name": "demo-stack-redis-01" + }, + "beat": { + "version": "7.0.0-alpha1", + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01" + }, + "event": { + "module": "auditd", + "category": "user-login", + "type": "user_login", + "action": "logged-in" + }, + "user": { + "auid": "unset", + "uid": "0", + "name_map": { + "uid": "root" + } + }, + "process": { + "pid": "32173", + "exe": "/usr/sbin/sshd" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "HNW7UmcBTFzn_XoLNhOL", + "source": { + "@timestamp": "2018-11-27T01:14:19.234Z", + "beat": { + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-redis-01" + }, + "event": { + "type": "user_err", + "action": "error", + "module": "auditd", + "category": "user-login" + }, + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + }, + "process": { + "pid": "32173", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "73.15.91.251" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "sequence": 186352, + "result": "fail", + "session": "unset", + "data": { + "terminal": "ssh", + "hostname": "73.15.91.251", + "op": "PAM:bad_ident" + }, + "summary": { + "object": { + "primary": "ssh", + "secondary": "73.15.91.251", + "type": "user-session" + }, + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "root" + } + } + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "R9W6UmcBTFzn_XoL9Aya", + "source": { + "@timestamp": "2018-11-27T01:14:02.288Z", + "process": { + "pid": "32171", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "201.144.84.82" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "result": "fail", + "session": "unset", + "data": { + "terminal": "sshd", + "acct": "(unknown user)", + "op": "login" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + }, + "object": { + "secondary": "201.144.84.82", + "type": "user-session", + "primary": "sshd" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 186347 + }, + "beat": { + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-redis-01" + }, + "event": { + "type": "user_login", + "action": "logged-in", + "module": "auditd", + "category": "user-login" + }, + "user": { + "auid": "unset", + "uid": "0", + "name_map": { + "uid": "root" + } + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "SNW6UmcBTFzn_XoL9Aya", + "source": { + "@timestamp": "2018-11-27T01:14:02.289Z", + "auditd": { + "session": "unset", + "data": { + "terminal": "sshd", + "op": "login", + "acct": "(invalid user)" + }, + "summary": { + "actor": { + "secondary": "(invalid user)", + "primary": "unset" + }, + "object": { + "primary": "sshd", + "secondary": "201.144.84.82", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 186348, + "result": "fail" + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + }, + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + }, + "process": { + "pid": "32171", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "201.144.84.82" + }, + "network": { + "direction": "incoming" + }, + "host": { + "name": "demo-stack-redis-01" + }, + "beat": { + "version": "7.0.0-alpha1", + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "SdW6UmcBTFzn_XoL9Aya", + "source": { + "@timestamp": "2018-11-27T01:14:02.352Z", + "source": { + "ip": "201.144.84.82" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "summary": { + "actor": { + "primary": "unset", + "secondary": "root" + }, + "object": { + "primary": "ssh", + "secondary": "201.144.84.82", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 186349, + "result": "fail", + "session": "unset", + "data": { + "hostname": "201.144.84.82", + "op": "PAM:bad_ident", + "terminal": "ssh" + } + }, + "event": { + "category": "user-login", + "type": "user_err", + "action": "error", + "module": "auditd" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "pid": "32171", + "exe": "/usr/sbin/sshd" + }, + "beat": { + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-redis-01" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "19W7UmcBTFzn_XoLRBML", + "source": { + "@timestamp": "2018-11-27T01:14:22.625Z", + "beat": { + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-redis-01" + }, + "event": { + "action": "logged-in", + "module": "auditd", + "category": "user-login", + "type": "user_login" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "pid": "32175", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "107.170.65.109" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "result": "fail", + "session": "unset", + "data": { + "op": "login", + "acct": "(unknown user)", + "terminal": "sshd" + }, + "summary": { + "object": { + "primary": "sshd", + "secondary": "107.170.65.109", + "type": "user-session" + }, + "how": "/usr/sbin/sshd", + "actor": { + "secondary": "(unknown user)", + "primary": "unset" + } + }, + "sequence": 186353 + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "2NW7UmcBTFzn_XoLRBML", + "source": { + "@timestamp": "2018-11-27T01:14:22.627Z", + "source": { + "ip": "107.170.65.109" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "data": { + "terminal": "sshd", + "acct": "(invalid user)", + "op": "login" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + }, + "object": { + "primary": "sshd", + "secondary": "107.170.65.109", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 186354, + "result": "fail", + "session": "unset" + }, + "beat": { + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-redis-01" + }, + "event": { + "action": "logged-in", + "module": "auditd", + "category": "user-login", + "type": "user_login" + }, + "user": { + "auid": "unset", + "uid": "0", + "name_map": { + "uid": "root" + } + }, + "process": { + "pid": "32175", + "exe": "/usr/sbin/sshd" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "2dW7UmcBTFzn_XoLRBML", + "source": { + "@timestamp": "2018-11-27T01:14:22.658Z", + "event": { + "type": "user_err", + "action": "error", + "module": "auditd", + "category": "user-login" + }, + "user": { + "name_map": { + "uid": "root" + }, + "auid": "unset", + "uid": "0" + }, + "process": { + "exe": "/usr/sbin/sshd", + "pid": "32175" + }, + "source": { + "ip": "107.170.65.109" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "sequence": 186355, + "result": "fail", + "session": "unset", + "data": { + "op": "PAM:bad_ident", + "terminal": "ssh", + "hostname": "107.170.65.109" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "root" + }, + "object": { + "primary": "ssh", + "secondary": "107.170.65.109", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + } + }, + "beat": { + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-redis-01" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "ltW6UmcBTFzn_XoLawEv", + "source": { + "@timestamp": "2018-11-27T01:13:27.109Z", + "auditd": { + "data": { + "terminal": "sshd", + "op": "login", + "acct": "(unknown user)" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + }, + "object": { + "primary": "sshd", + "secondary": "107.170.65.109", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 186344, + "result": "fail", + "session": "unset" + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + }, + "host": { + "name": "demo-stack-redis-01" + }, + "beat": { + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "exe": "/usr/sbin/sshd", + "pid": "32168" + }, + "source": { + "ip": "107.170.65.109" + }, + "network": { + "direction": "incoming" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "l9W6UmcBTFzn_XoLawEv", + "source": { + "@timestamp": "2018-11-27T01:13:27.110Z", + "beat": { + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1" + }, + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + }, + "process": { + "pid": "32168", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "107.170.65.109" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "session": "unset", + "data": { + "op": "login", + "terminal": "sshd", + "acct": "(invalid user)" + }, + "summary": { + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + }, + "object": { + "primary": "sshd", + "secondary": "107.170.65.109", + "type": "user-session" + } + }, + "sequence": 186345, + "result": "fail" + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + }, + "host": { + "name": "demo-stack-redis-01" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "mNW6UmcBTFzn_XoLawEv", + "source": { + "@timestamp": "2018-11-27T01:13:27.142Z", + "process": { + "pid": "32168", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "107.170.65.109" + }, + "network": { + "direction": "incoming" + }, + "beat": { + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-redis-01" + }, + "auditd": { + "session": "unset", + "data": { + "op": "PAM:bad_ident", + "terminal": "ssh", + "hostname": "107.170.65.109" + }, + "summary": { + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "root" + }, + "object": { + "type": "user-session", + "primary": "ssh", + "secondary": "107.170.65.109" + } + }, + "sequence": 186346, + "result": "fail" + }, + "event": { + "type": "user_err", + "action": "error", + "module": "auditd", + "category": "user-login" + }, + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "gdS5UmcBTFzn_XoLl-71", + "source": { + "@timestamp": "2018-11-27T01:12:33.036Z", + "auditd": { + "sequence": 186341, + "result": "fail", + "session": "unset", + "data": { + "acct": "(unknown user)", + "op": "login", + "terminal": "sshd" + }, + "summary": { + "actor": { + "secondary": "(unknown user)", + "primary": "unset" + }, + "object": { + "primary": "sshd", + "secondary": "46.148.18.163", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + } + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "exe": "/usr/sbin/sshd", + "pid": "32161" + }, + "beat": { + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-redis-01" + }, + "source": { + "ip": "46.148.18.163" + }, + "network": { + "direction": "incoming" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "gtS5UmcBTFzn_XoLl-71", + "source": { + "@timestamp": "2018-11-27T01:12:33.037Z", + "auditd": { + "sequence": 186342, + "result": "fail", + "session": "unset", + "data": { + "op": "login", + "acct": "(invalid user)", + "terminal": "sshd" + }, + "summary": { + "object": { + "primary": "sshd", + "secondary": "46.148.18.163", + "type": "user-session" + }, + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + } + } + }, + "event": { + "type": "user_login", + "action": "logged-in", + "module": "auditd", + "category": "user-login" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "pid": "32161", + "exe": "/usr/sbin/sshd" + }, + "beat": { + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-redis-01" + }, + "source": { + "ip": "46.148.18.163" + }, + "network": { + "direction": "incoming" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "g9S5UmcBTFzn_XoLl-71", + "source": { + "@timestamp": "2018-11-27T01:12:33.179Z", + "host": { + "name": "demo-stack-redis-01" + }, + "process": { + "pid": "32161", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "46.148.18.163" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "session": "unset", + "data": { + "hostname": "46.148.18.163", + "terminal": "ssh", + "op": "PAM:bad_ident" + }, + "summary": { + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "root" + }, + "object": { + "secondary": "46.148.18.163", + "type": "user-session", + "primary": "ssh" + } + }, + "sequence": 186343, + "result": "fail" + }, + "event": { + "category": "user-login", + "type": "user_err", + "action": "error", + "module": "auditd" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "beat": { + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "LdW7UmcBTFzn_XoLDA9a", + "source": { + "@timestamp": "2018-11-27T01:14:08.367Z", + "process": { + "exe": "/usr/sbin/sshd", + "pid": "438" + }, + "source": { + "ip": "193.70.38.229" + }, + "beat": { + "name": "demo-stack-nginx-01", + "hostname": "demo-stack-nginx-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-nginx-01" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "result": "fail", + "session": "unset", + "data": { + "terminal": "sshd", + "op": "login", + "acct": "(unknown user)" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + }, + "object": { + "type": "user-session", + "primary": "sshd", + "secondary": "193.70.38.229" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 192491 + }, + "event": { + "action": "logged-in", + "module": "auditd", + "category": "user-login", + "type": "user_login" + }, + "user": { + "uid": "0", + "auid": "unset", + "name_map": { + "uid": "root" + } + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "LtW7UmcBTFzn_XoLDA9a", + "source": { + "@timestamp": "2018-11-27T01:14:08.368Z", + "process": { + "exe": "/usr/sbin/sshd", + "pid": "438" + }, + "source": { + "ip": "193.70.38.229" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "sequence": 192492, + "result": "fail", + "session": "unset", + "data": { + "op": "login", + "acct": "(invalid user)", + "terminal": "sshd" + }, + "summary": { + "actor": { + "secondary": "(invalid user)", + "primary": "unset" + }, + "object": { + "secondary": "193.70.38.229", + "type": "user-session", + "primary": "sshd" + }, + "how": "/usr/sbin/sshd" + } + }, + "beat": { + "name": "demo-stack-nginx-01", + "hostname": "demo-stack-nginx-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-nginx-01" + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "L9W7UmcBTFzn_XoLDA9a", + "source": { + "@timestamp": "2018-11-27T01:14:08.480Z", + "auditd": { + "result": "fail", + "session": "unset", + "data": { + "terminal": "ssh", + "hostname": "193.70.38.229", + "op": "PAM:bad_ident" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "root" + }, + "object": { + "type": "user-session", + "primary": "ssh", + "secondary": "193.70.38.229" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 192493 + }, + "beat": { + "name": "demo-stack-nginx-01", + "hostname": "demo-stack-nginx-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-nginx-01" + }, + "event": { + "category": "user-login", + "type": "user_err", + "action": "error", + "module": "auditd" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "pid": "438", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "193.70.38.229" + }, + "network": { + "direction": "incoming" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "M9S5UmcBTFzn_XoLcevO", + "source": { + "@timestamp": "2018-11-27T01:12:23.261Z", + "beat": { + "version": "7.0.0-alpha1", + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01" + }, + "host": { + "name": "demo-stack-redis-01" + }, + "auditd": { + "result": "fail", + "session": "unset", + "data": { + "terminal": "ssh", + "op": "PAM:bad_ident", + "hostname": "107.170.65.109" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "root" + }, + "object": { + "primary": "ssh", + "secondary": "107.170.65.109", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 186340 + }, + "event": { + "category": "user-login", + "type": "user_err", + "action": "error", + "module": "auditd" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "pid": "32158", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "107.170.65.109" + }, + "network": { + "direction": "incoming" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "SdW9UmcBTFzn_XoLHz_j", + "source": { + "@timestamp": "2018-11-27T01:16:24.437Z", + "auditd": { + "sequence": 44170, + "result": "fail", + "session": "unset", + "data": { + "acct": "(unknown user)", + "op": "login", + "terminal": "sshd" + }, + "summary": { + "object": { + "primary": "sshd", + "secondary": "37.187.113.229", + "type": "user-session" + }, + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + } + } + }, + "event": { + "action": "logged-in", + "module": "auditd", + "category": "user-login", + "type": "user_login" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "beat": { + "name": "demo-stack-es-01", + "hostname": "demo-stack-es-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-es-01" + }, + "process": { + "pid": "29260", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "37.187.113.229" + }, + "network": { + "direction": "incoming" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "StW9UmcBTFzn_XoLHz_j", + "source": { + "@timestamp": "2018-11-27T01:16:24.437Z", + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + }, + "user": { + "name_map": { + "uid": "root" + }, + "uid": "0", + "auid": "unset" + }, + "process": { + "pid": "29260", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "37.187.113.229" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "sequence": 44171, + "result": "fail", + "session": "unset", + "data": { + "op": "login", + "acct": "(invalid user)", + "terminal": "sshd" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + }, + "object": { + "primary": "sshd", + "secondary": "37.187.113.229", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + } + }, + "beat": { + "name": "demo-stack-es-01", + "hostname": "demo-stack-es-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-es-01" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "S9W9UmcBTFzn_XoLHz_j", + "source": { + "@timestamp": "2018-11-27T01:16:24.541Z", + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "pid": "29260", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "37.187.113.229" + }, + "network": { + "direction": "incoming" + }, + "beat": { + "name": "demo-stack-es-01", + "hostname": "demo-stack-es-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-es-01" + }, + "auditd": { + "sequence": 44172, + "result": "fail", + "session": "unset", + "data": { + "hostname": "37.187.113.229", + "terminal": "ssh", + "op": "PAM:bad_ident" + }, + "summary": { + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "root" + }, + "object": { + "type": "user-session", + "primary": "ssh", + "secondary": "37.187.113.229" + } + } + }, + "event": { + "action": "error", + "module": "auditd", + "category": "user-login", + "type": "user_err" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "q9W9UmcBTFzn_XoLJj-I", + "source": { + "@timestamp": "2018-11-27T01:16:26.142Z", + "process": { + "pid": "25331", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "103.249.205.78" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "summary": { + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + }, + "object": { + "type": "user-session", + "primary": "sshd", + "secondary": "103.249.205.78" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 184334, + "result": "fail", + "session": "unset", + "data": { + "terminal": "sshd", + "op": "login", + "acct": "(unknown user)" + } + }, + "beat": { + "name": "demo-stack-apache-01", + "hostname": "demo-stack-apache-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-apache-01" + }, + "event": { + "module": "auditd", + "category": "user-login", + "type": "user_login", + "action": "logged-in" + }, + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "rNW9UmcBTFzn_XoLJj-I", + "source": { + "@timestamp": "2018-11-27T01:16:26.143Z", + "process": { + "pid": "25331", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "103.249.205.78" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "sequence": 184335, + "result": "fail", + "session": "unset", + "data": { + "terminal": "sshd", + "op": "login", + "acct": "(invalid user)" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + }, + "object": { + "secondary": "103.249.205.78", + "type": "user-session", + "primary": "sshd" + }, + "how": "/usr/sbin/sshd" + } + }, + "beat": { + "name": "demo-stack-apache-01", + "hostname": "demo-stack-apache-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-apache-01" + }, + "event": { + "module": "auditd", + "category": "user-login", + "type": "user_login", + "action": "logged-in" + }, + "user": { + "uid": "0", + "auid": "unset", + "name_map": { + "uid": "root" + } + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "rdW9UmcBTFzn_XoLJj-I", + "source": { + "@timestamp": "2018-11-27T01:16:26.372Z", + "source": { + "ip": "103.249.205.78" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "data": { + "terminal": "ssh", + "hostname": "103.249.205.78", + "op": "PAM:bad_ident" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "root" + }, + "object": { + "primary": "ssh", + "secondary": "103.249.205.78", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 184336, + "result": "fail", + "session": "unset" + }, + "event": { + "category": "user-login", + "type": "user_err", + "action": "error", + "module": "auditd" + }, + "beat": { + "version": "7.0.0-alpha1", + "name": "demo-stack-apache-01", + "hostname": "demo-stack-apache-01" + }, + "host": { + "name": "demo-stack-apache-01" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "exe": "/usr/sbin/sshd", + "pid": "25331" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "b9W8UmcBTFzn_XoLiTGg", + "source": { + "@timestamp": "2018-11-27T01:15:45.974Z", + "auditd": { + "sequence": 186365, + "result": "fail", + "session": "unset", + "data": { + "op": "login", + "acct": "(unknown user)", + "terminal": "sshd" + }, + "summary": { + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + }, + "object": { + "primary": "sshd", + "secondary": "46.148.18.163", + "type": "user-session" + } + } + }, + "event": { + "type": "user_login", + "action": "logged-in", + "module": "auditd", + "category": "user-login" + }, + "beat": { + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-redis-01" + }, + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + }, + "process": { + "pid": "32190", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "46.148.18.163" + }, + "network": { + "direction": "incoming" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "cNW8UmcBTFzn_XoLiTGg", + "source": { + "@timestamp": "2018-11-27T01:15:45.975Z", + "network": { + "direction": "incoming" + }, + "auditd": { + "sequence": 186366, + "result": "fail", + "session": "unset", + "data": { + "op": "login", + "acct": "(invalid user)", + "terminal": "sshd" + }, + "summary": { + "how": "/usr/sbin/sshd", + "actor": { + "secondary": "(invalid user)", + "primary": "unset" + }, + "object": { + "primary": "sshd", + "secondary": "46.148.18.163", + "type": "user-session" + } + } + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + }, + "user": { + "name_map": { + "uid": "root" + }, + "uid": "0", + "auid": "unset" + }, + "process": { + "pid": "32190", + "exe": "/usr/sbin/sshd" + }, + "beat": { + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-redis-01" + }, + "source": { + "ip": "46.148.18.163" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "cdW8UmcBTFzn_XoLiTGg", + "source": { + "@timestamp": "2018-11-27T01:15:46.119Z", + "host": { + "name": "demo-stack-redis-01" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "pid": "32190", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "46.148.18.163" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "data": { + "op": "PAM:bad_ident", + "terminal": "ssh", + "hostname": "46.148.18.163" + }, + "summary": { + "object": { + "type": "user-session", + "primary": "ssh", + "secondary": "46.148.18.163" + }, + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "root" + } + }, + "sequence": 186367, + "result": "fail", + "session": "unset" + }, + "event": { + "category": "user-login", + "type": "user_err", + "action": "error", + "module": "auditd" + }, + "beat": { + "version": "7.0.0-alpha1", + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "FtW8UmcBTFzn_XoLkzMm", + "source": { + "@timestamp": "2018-11-27T01:15:48.412Z", + "process": { + "exe": "/usr/sbin/sshd", + "pid": "32192" + }, + "source": { + "ip": "107.170.65.109" + }, + "beat": { + "version": "7.0.0-alpha1", + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01" + }, + "host": { + "name": "demo-stack-redis-01" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "summary": { + "object": { + "primary": "sshd", + "secondary": "107.170.65.109", + "type": "user-session" + }, + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + } + }, + "sequence": 186368, + "result": "fail", + "session": "unset", + "data": { + "terminal": "sshd", + "op": "login", + "acct": "(unknown user)" + } + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + }, + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "F9W8UmcBTFzn_XoLkzMm", + "source": { + "@timestamp": "2018-11-27T01:15:48.413Z", + "process": { + "pid": "32192", + "exe": "/usr/sbin/sshd" + }, + "beat": { + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-redis-01" + }, + "source": { + "ip": "107.170.65.109" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "data": { + "acct": "(invalid user)", + "terminal": "sshd", + "op": "login" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + }, + "object": { + "type": "user-session", + "primary": "sshd", + "secondary": "107.170.65.109" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 186369, + "result": "fail", + "session": "unset" + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + }, + "user": { + "auid": "unset", + "uid": "0", + "name_map": { + "uid": "root" + } + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "GNW8UmcBTFzn_XoLkzMm", + "source": { + "@timestamp": "2018-11-27T01:15:48.444Z", + "source": { + "ip": "107.170.65.109" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "sequence": 186370, + "result": "fail", + "session": "unset", + "data": { + "hostname": "107.170.65.109", + "terminal": "ssh", + "op": "PAM:bad_ident" + }, + "summary": { + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "root" + }, + "object": { + "primary": "ssh", + "secondary": "107.170.65.109", + "type": "user-session" + } + } + }, + "event": { + "category": "user-login", + "type": "user_err", + "action": "error", + "module": "auditd" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "beat": { + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-redis-01" + }, + "process": { + "pid": "32192", + "exe": "/usr/sbin/sshd" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "g9W7UmcBTFzn_XoL5iPr", + "source": { + "@timestamp": "2018-11-27T01:15:04.321Z", + "process": { + "exe": "/usr/sbin/sshd", + "pid": "32185" + }, + "beat": { + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-redis-01" + }, + "source": { + "ip": "107.170.65.109" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "data": { + "acct": "(unknown user)", + "terminal": "sshd", + "op": "login" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + }, + "object": { + "secondary": "107.170.65.109", + "type": "user-session", + "primary": "sshd" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 186359, + "result": "fail", + "session": "unset" + }, + "event": { + "type": "user_login", + "action": "logged-in", + "module": "auditd", + "category": "user-login" + }, + "user": { + "name_map": { + "uid": "root" + }, + "auid": "unset", + "uid": "0" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "hNW7UmcBTFzn_XoL5iPr", + "source": { + "@timestamp": "2018-11-27T01:15:04.322Z", + "network": { + "direction": "incoming" + }, + "auditd": { + "summary": { + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + }, + "object": { + "primary": "sshd", + "secondary": "107.170.65.109", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 186360, + "result": "fail", + "session": "unset", + "data": { + "terminal": "sshd", + "op": "login", + "acct": "(invalid user)" + } + }, + "event": { + "action": "logged-in", + "module": "auditd", + "category": "user-login", + "type": "user_login" + }, + "user": { + "name_map": { + "uid": "root" + }, + "uid": "0", + "auid": "unset" + }, + "beat": { + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-redis-01" + }, + "process": { + "pid": "32185", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "107.170.65.109" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "hdW7UmcBTFzn_XoL5iPr", + "source": { + "@timestamp": "2018-11-27T01:15:04.353Z", + "user": { + "name_map": { + "uid": "root" + }, + "uid": "0", + "auid": "unset" + }, + "process": { + "pid": "32185", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "107.170.65.109" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "data": { + "op": "PAM:bad_ident", + "hostname": "107.170.65.109", + "terminal": "ssh" + }, + "summary": { + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "root" + }, + "object": { + "primary": "ssh", + "secondary": "107.170.65.109", + "type": "user-session" + } + }, + "sequence": 186361, + "result": "fail", + "session": "unset" + }, + "beat": { + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-redis-01" + }, + "event": { + "category": "user-login", + "type": "user_err", + "action": "error", + "module": "auditd" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "ddW7UmcBTFzn_XoLfxpa", + "source": { + "@timestamp": "2018-11-27T01:14:37.808Z", + "network": { + "direction": "incoming" + }, + "auditd": { + "summary": { + "object": { + "primary": "sshd", + "secondary": "128.199.91.82", + "type": "user-session" + }, + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + } + }, + "sequence": 186356, + "result": "fail", + "session": "unset", + "data": { + "acct": "(unknown user)", + "terminal": "sshd", + "op": "login" + } + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + }, + "beat": { + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-redis-01" + }, + "user": { + "name_map": { + "uid": "root" + }, + "auid": "unset", + "uid": "0" + }, + "process": { + "pid": "32178", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "128.199.91.82" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "dtW7UmcBTFzn_XoLfxpa", + "source": { + "@timestamp": "2018-11-27T01:14:37.809Z", + "host": { + "name": "demo-stack-redis-01" + }, + "event": { + "action": "logged-in", + "module": "auditd", + "category": "user-login", + "type": "user_login" + }, + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + }, + "process": { + "exe": "/usr/sbin/sshd", + "pid": "32178" + }, + "source": { + "ip": "128.199.91.82" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "summary": { + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + }, + "object": { + "type": "user-session", + "primary": "sshd", + "secondary": "128.199.91.82" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 186357, + "result": "fail", + "session": "unset", + "data": { + "terminal": "sshd", + "acct": "(invalid user)", + "op": "login" + } + }, + "beat": { + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "d9W7UmcBTFzn_XoLfxpa", + "source": { + "@timestamp": "2018-11-27T01:14:38.002Z", + "network": { + "direction": "incoming" + }, + "auditd": { + "session": "unset", + "data": { + "op": "PAM:bad_ident", + "hostname": "128.199.91.82", + "terminal": "ssh" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "root" + }, + "object": { + "primary": "ssh", + "secondary": "128.199.91.82", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 186358, + "result": "fail" + }, + "beat": { + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-redis-01" + }, + "event": { + "category": "user-login", + "type": "user_err", + "action": "error", + "module": "auditd" + }, + "user": { + "name_map": { + "uid": "root" + }, + "auid": "unset", + "uid": "0" + }, + "process": { + "exe": "/usr/sbin/sshd", + "pid": "32178" + }, + "source": { + "ip": "128.199.91.82" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "I9W8UmcBTFzn_XoLdzAT", + "source": { + "@timestamp": "2018-11-27T01:15:41.225Z", + "network": { + "direction": "incoming" + }, + "auditd": { + "sequence": 186362, + "result": "fail", + "session": "unset", + "data": { + "acct": "(unknown user)", + "terminal": "sshd", + "op": "login" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + }, + "object": { + "primary": "sshd", + "secondary": "89.36.221.229", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + } + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "pid": "32188", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "89.36.221.229" + }, + "beat": { + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-redis-01" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "JNW8UmcBTFzn_XoLdzAT", + "source": { + "@timestamp": "2018-11-27T01:15:41.226Z", + "source": { + "ip": "89.36.221.229" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "sequence": 186363, + "result": "fail", + "session": "unset", + "data": { + "op": "login", + "terminal": "sshd", + "acct": "(invalid user)" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + }, + "object": { + "type": "user-session", + "primary": "sshd", + "secondary": "89.36.221.229" + }, + "how": "/usr/sbin/sshd" + } + }, + "beat": { + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-redis-01" + }, + "event": { + "type": "user_login", + "action": "logged-in", + "module": "auditd", + "category": "user-login" + }, + "user": { + "name_map": { + "uid": "root" + }, + "auid": "unset", + "uid": "0" + }, + "process": { + "pid": "32188", + "exe": "/usr/sbin/sshd" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "JdW8UmcBTFzn_XoLdzAT", + "source": { + "@timestamp": "2018-11-27T01:15:41.329Z", + "source": { + "ip": "89.36.221.229" + }, + "beat": { + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-redis-01" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "data": { + "op": "PAM:bad_ident", + "hostname": "89.36.221.229", + "terminal": "ssh" + }, + "summary": { + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "root" + }, + "object": { + "primary": "ssh", + "secondary": "89.36.221.229", + "type": "user-session" + } + }, + "sequence": 186364, + "result": "fail", + "session": "unset" + }, + "event": { + "type": "user_err", + "action": "error", + "module": "auditd", + "category": "user-login" + }, + "user": { + "uid": "0", + "auid": "unset", + "name_map": { + "uid": "root" + } + }, + "process": { + "pid": "32188", + "exe": "/usr/sbin/sshd" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "5dW7UmcBTFzn_XoLcBda", + "source": { + "@timestamp": "2018-11-27T01:14:33.960Z", + "network": { + "direction": "incoming" + }, + "auditd": { + "data": { + "terminal": "sshd", + "acct": "(unknown user)", + "op": "login" + }, + "summary": { + "how": "/usr/sbin/sshd", + "actor": { + "secondary": "(unknown user)", + "primary": "unset" + }, + "object": { + "primary": "sshd", + "secondary": "131.100.219.3", + "type": "user-session" + } + }, + "sequence": 44161, + "result": "fail", + "session": "unset" + }, + "event": { + "type": "user_login", + "action": "logged-in", + "module": "auditd", + "category": "user-login" + }, + "beat": { + "name": "demo-stack-es-01", + "hostname": "demo-stack-es-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-es-01" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "pid": "29218", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "131.100.219.3" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "5tW7UmcBTFzn_XoLcBda", + "source": { + "@timestamp": "2018-11-27T01:14:33.964Z", + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + }, + "process": { + "pid": "29218", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "131.100.219.3" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "session": "unset", + "data": { + "terminal": "sshd", + "op": "login", + "acct": "(invalid user)" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + }, + "object": { + "type": "user-session", + "primary": "sshd", + "secondary": "131.100.219.3" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 44162, + "result": "fail" + }, + "event": { + "action": "logged-in", + "module": "auditd", + "category": "user-login", + "type": "user_login" + }, + "beat": { + "name": "demo-stack-es-01", + "hostname": "demo-stack-es-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-es-01" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "59W7UmcBTFzn_XoLcBda", + "source": { + "@timestamp": "2018-11-27T01:14:34.176Z", + "host": { + "name": "demo-stack-es-01" + }, + "event": { + "category": "user-login", + "type": "user_err", + "action": "error", + "module": "auditd" + }, + "user": { + "name_map": { + "uid": "root" + }, + "auid": "unset", + "uid": "0" + }, + "process": { + "pid": "29218", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "131.100.219.3" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "session": "unset", + "data": { + "terminal": "ssh", + "op": "PAM:bad_ident", + "hostname": "131.100.219.3" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "root" + }, + "object": { + "primary": "ssh", + "secondary": "131.100.219.3", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 44163, + "result": "fail" + }, + "beat": { + "name": "demo-stack-es-01", + "hostname": "demo-stack-es-01", + "version": "7.0.0-alpha1" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "D9W8UmcBTFzn_XoL6Do7", + "source": { + "@timestamp": "2018-11-27T01:16:10.192Z", + "beat": { + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-redis-01" + }, + "event": { + "type": "user_login", + "action": "logged-in", + "module": "auditd", + "category": "user-login" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "pid": "32194", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "81.66.86.4" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "data": { + "acct": "(unknown user)", + "op": "login", + "terminal": "sshd" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + }, + "object": { + "type": "user-session", + "primary": "sshd", + "secondary": "81.66.86.4" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 186371, + "result": "fail", + "session": "unset" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "ENW8UmcBTFzn_XoL6Do7", + "source": { + "@timestamp": "2018-11-27T01:16:10.194Z", + "network": { + "direction": "incoming" + }, + "beat": { + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-redis-01" + }, + "auditd": { + "data": { + "terminal": "sshd", + "op": "login", + "acct": "(invalid user)" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + }, + "object": { + "type": "user-session", + "primary": "sshd", + "secondary": "81.66.86.4" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 186372, + "result": "fail", + "session": "unset" + }, + "event": { + "type": "user_login", + "action": "logged-in", + "module": "auditd", + "category": "user-login" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "exe": "/usr/sbin/sshd", + "pid": "32194" + }, + "source": { + "ip": "81.66.86.4" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "EdW8UmcBTFzn_XoL6Do7", + "source": { + "@timestamp": "2018-11-27T01:16:10.308Z", + "source": { + "ip": "81.66.86.4" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "summary": { + "actor": { + "secondary": "root", + "primary": "unset" + }, + "object": { + "primary": "ssh", + "secondary": "81.66.86.4", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 186373, + "result": "fail", + "session": "unset", + "data": { + "terminal": "ssh", + "op": "PAM:bad_ident", + "hostname": "81.66.86.4" + } + }, + "event": { + "action": "error", + "module": "auditd", + "category": "user-login", + "type": "user_err" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "beat": { + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-redis-01" + }, + "process": { + "pid": "32194", + "exe": "/usr/sbin/sshd" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "cNW8UmcBTFzn_XoLvDaC", + "source": { + "@timestamp": "2018-11-27T01:15:58.995Z", + "beat": { + "name": "demo-stack-es-01", + "hostname": "demo-stack-es-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-es-01" + }, + "auditd": { + "data": { + "op": "login", + "acct": "(unknown user)", + "terminal": "sshd" + }, + "summary": { + "actor": { + "secondary": "(unknown user)", + "primary": "unset" + }, + "object": { + "primary": "sshd", + "secondary": "204.145.5.2", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 44164, + "result": "fail", + "session": "unset" + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + }, + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + }, + "process": { + "pid": "29245", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "204.145.5.2" + }, + "network": { + "direction": "incoming" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "cdW8UmcBTFzn_XoLvDaC", + "source": { + "@timestamp": "2018-11-27T01:15:58.999Z", + "host": { + "name": "demo-stack-es-01" + }, + "auditd": { + "summary": { + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + }, + "object": { + "secondary": "204.145.5.2", + "type": "user-session", + "primary": "sshd" + } + }, + "sequence": 44165, + "result": "fail", + "session": "unset", + "data": { + "op": "login", + "terminal": "sshd", + "acct": "(invalid user)" + } + }, + "event": { + "action": "logged-in", + "module": "auditd", + "category": "user-login", + "type": "user_login" + }, + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + }, + "process": { + "pid": "29245", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "204.145.5.2" + }, + "network": { + "direction": "incoming" + }, + "beat": { + "name": "demo-stack-es-01", + "hostname": "demo-stack-es-01", + "version": "7.0.0-alpha1" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "ctW8UmcBTFzn_XoLvDaC", + "source": { + "@timestamp": "2018-11-27T01:15:59.199Z", + "process": { + "pid": "29245", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "204.145.5.2" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "session": "unset", + "data": { + "hostname": "204.145.5.2", + "terminal": "ssh", + "op": "PAM:bad_ident" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "root" + }, + "object": { + "primary": "ssh", + "secondary": "204.145.5.2", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 44166, + "result": "fail" + }, + "beat": { + "name": "demo-stack-es-01", + "hostname": "demo-stack-es-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-es-01" + }, + "event": { + "category": "user-login", + "type": "user_err", + "action": "error", + "module": "auditd" + }, + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "f9W8UmcBTFzn_XoL_Dt-", + "source": { + "@timestamp": "2018-11-27T01:16:15.376Z", + "network": { + "direction": "incoming" + }, + "auditd": { + "result": "fail", + "session": "unset", + "data": { + "op": "login", + "terminal": "sshd", + "acct": "(unknown user)" + }, + "summary": { + "object": { + "primary": "sshd", + "secondary": "51.15.40.125", + "type": "user-session" + }, + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + } + }, + "sequence": 44167 + }, + "event": { + "action": "logged-in", + "module": "auditd", + "category": "user-login", + "type": "user_login" + }, + "user": { + "auid": "unset", + "uid": "0", + "name_map": { + "uid": "root" + } + }, + "process": { + "exe": "/usr/sbin/sshd", + "pid": "29255" + }, + "source": { + "ip": "51.15.40.125" + }, + "beat": { + "name": "demo-stack-es-01", + "hostname": "demo-stack-es-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-es-01" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "gNW8UmcBTFzn_XoL_Dt-", + "source": { + "@timestamp": "2018-11-27T01:16:15.376Z", + "beat": { + "name": "demo-stack-es-01", + "hostname": "demo-stack-es-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-es-01" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "result": "fail", + "session": "unset", + "data": { + "op": "login", + "terminal": "sshd", + "acct": "(invalid user)" + }, + "summary": { + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + }, + "object": { + "primary": "sshd", + "secondary": "51.15.40.125", + "type": "user-session" + } + }, + "sequence": 44168 + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + }, + "user": { + "auid": "unset", + "uid": "0", + "name_map": { + "uid": "root" + } + }, + "process": { + "exe": "/usr/sbin/sshd", + "pid": "29255" + }, + "source": { + "ip": "51.15.40.125" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "gdW8UmcBTFzn_XoL_Dt-", + "source": { + "@timestamp": "2018-11-27T01:16:15.488Z", + "auditd": { + "sequence": 44169, + "result": "fail", + "session": "unset", + "data": { + "terminal": "ssh", + "op": "PAM:bad_ident", + "hostname": "51.15.40.125" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "root" + }, + "object": { + "primary": "ssh", + "secondary": "51.15.40.125", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + } + }, + "beat": { + "hostname": "demo-stack-es-01", + "version": "7.0.0-alpha1", + "name": "demo-stack-es-01" + }, + "host": { + "name": "demo-stack-es-01" + }, + "event": { + "type": "user_err", + "action": "error", + "module": "auditd", + "category": "user-login" + }, + "user": { + "name_map": { + "uid": "root" + }, + "auid": "unset", + "uid": "0" + }, + "process": { + "exe": "/usr/sbin/sshd", + "pid": "29255" + }, + "source": { + "ip": "51.15.40.125" + }, + "network": { + "direction": "incoming" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "INXAUmcBTFzn_XoLvI6Q", + "source": { + "@timestamp": "2018-11-27T01:20:21.158Z", + "auditd": { + "session": "unset", + "data": { + "op": "login", + "acct": "(unknown user)", + "terminal": "sshd" + }, + "summary": { + "object": { + "primary": "sshd", + "secondary": "138.68.50.250", + "type": "user-session" + }, + "how": "/usr/sbin/sshd", + "actor": { + "secondary": "(unknown user)", + "primary": "unset" + } + }, + "sequence": 142333, + "result": "fail" + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + }, + "beat": { + "name": "demo-stack-haproxy-01", + "hostname": "demo-stack-haproxy-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-haproxy-01" + }, + "user": { + "name_map": { + "uid": "root" + }, + "uid": "0", + "auid": "unset" + }, + "process": { + "pid": "19612", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "138.68.50.250" + }, + "network": { + "direction": "incoming" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "IdXAUmcBTFzn_XoLvI6Q", + "source": { + "@timestamp": "2018-11-27T01:20:21.159Z", + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + }, + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + }, + "process": { + "pid": "19612", + "exe": "/usr/sbin/sshd" + }, + "beat": { + "name": "demo-stack-haproxy-01", + "hostname": "demo-stack-haproxy-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-haproxy-01" + }, + "source": { + "ip": "138.68.50.250" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "data": { + "acct": "(invalid user)", + "terminal": "sshd", + "op": "login" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + }, + "object": { + "secondary": "138.68.50.250", + "type": "user-session", + "primary": "sshd" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 142334, + "result": "fail", + "session": "unset" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "ItXAUmcBTFzn_XoLvI6Q", + "source": { + "@timestamp": "2018-11-27T01:20:21.200Z", + "process": { + "exe": "/usr/sbin/sshd", + "pid": "19612" + }, + "beat": { + "name": "demo-stack-haproxy-01", + "hostname": "demo-stack-haproxy-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-haproxy-01" + }, + "source": { + "ip": "138.68.50.250" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "sequence": 142335, + "result": "fail", + "session": "unset", + "data": { + "hostname": "138.68.50.250", + "terminal": "ssh", + "op": "PAM:bad_ident" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "root" + }, + "object": { + "secondary": "138.68.50.250", + "type": "user-session", + "primary": "ssh" + }, + "how": "/usr/sbin/sshd" + } + }, + "event": { + "action": "error", + "module": "auditd", + "category": "user-login", + "type": "user_err" + }, + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "BdXAUmcBTFzn_XoLyZBk", + "source": { + "@timestamp": "2018-11-27T01:20:24.441Z", + "event": { + "category": "system-services", + "type": "service_start", + "action": "started-service", + "module": "auditd" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "name": "systemd", + "exe": "/lib/systemd/systemd", + "pid": "1" + }, + "auditd": { + "session": "unset", + "data": { + "unit": "apt-daily" + }, + "summary": { + "actor": { + "secondary": "root", + "primary": "unset" + }, + "object": { + "primary": "apt-daily", + "type": "service" + }, + "how": "/lib/systemd/systemd" + }, + "sequence": 184343, + "result": "success" + }, + "beat": { + "name": "demo-stack-apache-01", + "hostname": "demo-stack-apache-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-apache-01" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "BtXAUmcBTFzn_XoLyZBk", + "source": { + "@timestamp": "2018-11-27T01:20:24.441Z", + "host": { + "name": "demo-stack-apache-01" + }, + "auditd": { + "sequence": 184344, + "result": "success", + "session": "unset", + "data": { + "unit": "apt-daily" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "root" + }, + "object": { + "primary": "apt-daily", + "type": "service" + }, + "how": "/lib/systemd/systemd" + } + }, + "event": { + "type": "service_stop", + "action": "stopped-service", + "module": "auditd", + "category": "system-services" + }, + "user": { + "auid": "unset", + "uid": "0", + "name_map": { + "uid": "root" + } + }, + "process": { + "pid": "1", + "name": "systemd", + "exe": "/lib/systemd/systemd" + }, + "beat": { + "name": "demo-stack-apache-01", + "hostname": "demo-stack-apache-01", + "version": "7.0.0-alpha1" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "yNW_UmcBTFzn_XoL_n0W", + "source": { + "@timestamp": "2018-11-27T01:19:32.396Z", + "source": { + "ip": "107.170.65.109" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "sequence": 186392, + "result": "fail", + "session": "unset", + "data": { + "op": "login", + "acct": "(unknown user)", + "terminal": "sshd" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + }, + "object": { + "primary": "sshd", + "secondary": "107.170.65.109", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + } + }, + "beat": { + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-redis-01" + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + }, + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + }, + "process": { + "pid": "32225", + "exe": "/usr/sbin/sshd" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "ydW_UmcBTFzn_XoL_n0W", + "source": { + "@timestamp": "2018-11-27T01:19:32.398Z", + "auditd": { + "summary": { + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + }, + "object": { + "secondary": "107.170.65.109", + "type": "user-session", + "primary": "sshd" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 186393, + "result": "fail", + "session": "unset", + "data": { + "terminal": "sshd", + "op": "login", + "acct": "(invalid user)" + } + }, + "beat": { + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1", + "name": "demo-stack-redis-01" + }, + "host": { + "name": "demo-stack-redis-01" + }, + "event": { + "type": "user_login", + "action": "logged-in", + "module": "auditd", + "category": "user-login" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "pid": "32225", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "107.170.65.109" + }, + "network": { + "direction": "incoming" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "ytW_UmcBTFzn_XoL_n0W", + "source": { + "@timestamp": "2018-11-27T01:19:32.428Z", + "host": { + "name": "demo-stack-redis-01" + }, + "beat": { + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1" + }, + "event": { + "module": "auditd", + "category": "user-login", + "type": "user_err", + "action": "error" + }, + "user": { + "name_map": { + "uid": "root" + }, + "auid": "unset", + "uid": "0" + }, + "process": { + "exe": "/usr/sbin/sshd", + "pid": "32225" + }, + "source": { + "ip": "107.170.65.109" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "result": "fail", + "session": "unset", + "data": { + "terminal": "ssh", + "op": "PAM:bad_ident", + "hostname": "107.170.65.109" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "root" + }, + "object": { + "type": "user-session", + "primary": "ssh", + "secondary": "107.170.65.109" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 186394 + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "PNXAUmcBTFzn_XoLAX59", + "source": { + "@timestamp": "2018-11-27T01:19:33.267Z", + "auditd": { + "result": "fail", + "session": "unset", + "data": { + "acct": "(unknown user)", + "terminal": "sshd", + "op": "login" + }, + "summary": { + "object": { + "primary": "sshd", + "secondary": "83.222.240.60", + "type": "user-session" + }, + "how": "/usr/sbin/sshd", + "actor": { + "secondary": "(unknown user)", + "primary": "unset" + } + }, + "sequence": 192500 + }, + "beat": { + "name": "demo-stack-nginx-01", + "hostname": "demo-stack-nginx-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-nginx-01" + }, + "event": { + "action": "logged-in", + "module": "auditd", + "category": "user-login", + "type": "user_login" + }, + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + }, + "process": { + "pid": "473", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "83.222.240.60" + }, + "network": { + "direction": "incoming" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "PdXAUmcBTFzn_XoLAX59", + "source": { + "@timestamp": "2018-11-27T01:19:33.268Z", + "beat": { + "name": "demo-stack-nginx-01", + "hostname": "demo-stack-nginx-01", + "version": "7.0.0-alpha1" + }, + "event": { + "type": "user_login", + "action": "logged-in", + "module": "auditd", + "category": "user-login" + }, + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + }, + "process": { + "pid": "473", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "83.222.240.60" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "data": { + "terminal": "sshd", + "acct": "(invalid user)", + "op": "login" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + }, + "object": { + "primary": "sshd", + "secondary": "83.222.240.60", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 192501, + "result": "fail", + "session": "unset" + }, + "host": { + "name": "demo-stack-nginx-01" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "PtXAUmcBTFzn_XoLAX59", + "source": { + "@timestamp": "2018-11-27T01:19:33.371Z", + "beat": { + "name": "demo-stack-nginx-01", + "hostname": "demo-stack-nginx-01", + "version": "7.0.0-alpha1" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "exe": "/usr/sbin/sshd", + "pid": "473" + }, + "source": { + "ip": "83.222.240.60" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "data": { + "op": "PAM:bad_ident", + "hostname": "83.222.240.60", + "terminal": "ssh" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "root" + }, + "object": { + "primary": "ssh", + "secondary": "83.222.240.60", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 192502, + "result": "fail", + "session": "unset" + }, + "event": { + "type": "user_err", + "action": "error", + "module": "auditd", + "category": "user-login" + }, + "host": { + "name": "demo-stack-nginx-01" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "L9XBUmcBTFzn_XoLuKRN", + "source": { + "@timestamp": "2018-11-27T01:21:25.603Z", + "beat": { + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-redis-01" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "sequence": 186398, + "result": "fail", + "session": "unset", + "data": { + "op": "login", + "acct": "(unknown user)", + "terminal": "sshd" + }, + "summary": { + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + }, + "object": { + "primary": "sshd", + "secondary": "153.254.115.57", + "type": "user-session" + } + } + }, + "event": { + "module": "auditd", + "category": "user-login", + "type": "user_login", + "action": "logged-in" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "pid": "32236", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "153.254.115.57" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "MNXBUmcBTFzn_XoLuKRN", + "source": { + "@timestamp": "2018-11-27T01:21:25.604Z", + "auditd": { + "sequence": 186399, + "result": "fail", + "session": "unset", + "data": { + "op": "login", + "terminal": "sshd", + "acct": "(invalid user)" + }, + "summary": { + "actor": { + "secondary": "(invalid user)", + "primary": "unset" + }, + "object": { + "primary": "sshd", + "secondary": "153.254.115.57", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + } + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + }, + "user": { + "name_map": { + "uid": "root" + }, + "uid": "0", + "auid": "unset" + }, + "beat": { + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-redis-01" + }, + "process": { + "pid": "32236", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "153.254.115.57" + }, + "network": { + "direction": "incoming" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "MdXBUmcBTFzn_XoLuKRN", + "source": { + "@timestamp": "2018-11-27T01:21:25.817Z", + "host": { + "name": "demo-stack-redis-01" + }, + "process": { + "exe": "/usr/sbin/sshd", + "pid": "32236" + }, + "source": { + "ip": "153.254.115.57" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "data": { + "hostname": "153.254.115.57", + "op": "PAM:bad_ident", + "terminal": "ssh" + }, + "summary": { + "how": "/usr/sbin/sshd", + "actor": { + "secondary": "root", + "primary": "unset" + }, + "object": { + "primary": "ssh", + "secondary": "153.254.115.57", + "type": "user-session" + } + }, + "sequence": 186400, + "result": "fail", + "session": "unset" + }, + "event": { + "category": "user-login", + "type": "user_err", + "action": "error", + "module": "auditd" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "beat": { + "version": "7.0.0-alpha1", + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "xtXCUmcBTFzn_XoLq7my", + "source": { + "@timestamp": "2018-11-27T01:22:27.912Z", + "beat": { + "version": "7.0.0-alpha1", + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01" + }, + "host": { + "name": "demo-stack-redis-01" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "session": "unset", + "data": { + "terminal": "sshd", + "acct": "(unknown user)", + "op": "login" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + }, + "object": { + "primary": "sshd", + "secondary": "118.163.107.56", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 186404, + "result": "fail" + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "pid": "32246", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "118.163.107.56" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "x9XCUmcBTFzn_XoLq7my", + "source": { + "@timestamp": "2018-11-27T01:22:27.914Z", + "event": { + "action": "logged-in", + "module": "auditd", + "category": "user-login", + "type": "user_login" + }, + "user": { + "auid": "unset", + "uid": "0", + "name_map": { + "uid": "root" + } + }, + "host": { + "name": "demo-stack-redis-01" + }, + "beat": { + "version": "7.0.0-alpha1", + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01" + }, + "process": { + "pid": "32246", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "118.163.107.56" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "session": "unset", + "data": { + "op": "login", + "terminal": "sshd", + "acct": "(invalid user)" + }, + "summary": { + "actor": { + "secondary": "(invalid user)", + "primary": "unset" + }, + "object": { + "primary": "sshd", + "secondary": "118.163.107.56", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 186405, + "result": "fail" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "yNXCUmcBTFzn_XoLq7my", + "source": { + "@timestamp": "2018-11-27T01:22:28.078Z", + "host": { + "name": "demo-stack-redis-01" + }, + "event": { + "category": "user-login", + "type": "user_err", + "action": "error", + "module": "auditd" + }, + "user": { + "name_map": { + "uid": "root" + }, + "uid": "0", + "auid": "unset" + }, + "process": { + "exe": "/usr/sbin/sshd", + "pid": "32246" + }, + "source": { + "ip": "118.163.107.56" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "result": "fail", + "session": "unset", + "data": { + "hostname": "118.163.107.56", + "terminal": "ssh", + "op": "PAM:bad_ident" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "root" + }, + "object": { + "secondary": "118.163.107.56", + "type": "user-session", + "primary": "ssh" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 186406 + }, + "beat": { + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1", + "name": "demo-stack-redis-01" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "8dXBUmcBTFzn_XoL0KVY", + "source": { + "@timestamp": "2018-11-27T01:21:31.757Z", + "process": { + "pid": "32238", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "107.170.65.109" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "data": { + "acct": "(unknown user)", + "terminal": "sshd", + "op": "login" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + }, + "object": { + "type": "user-session", + "primary": "sshd", + "secondary": "107.170.65.109" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 186401, + "result": "fail", + "session": "unset" + }, + "event": { + "module": "auditd", + "category": "user-login", + "type": "user_login", + "action": "logged-in" + }, + "host": { + "name": "demo-stack-redis-01" + }, + "beat": { + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "8tXBUmcBTFzn_XoL0KVY", + "source": { + "@timestamp": "2018-11-27T01:21:31.758Z", + "source": { + "ip": "107.170.65.109" + }, + "beat": { + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-redis-01" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "data": { + "terminal": "sshd", + "acct": "(invalid user)", + "op": "login" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + }, + "object": { + "type": "user-session", + "primary": "sshd", + "secondary": "107.170.65.109" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 186402, + "result": "fail", + "session": "unset" + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "exe": "/usr/sbin/sshd", + "pid": "32238" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "89XBUmcBTFzn_XoL0KVY", + "source": { + "@timestamp": "2018-11-27T01:21:31.789Z", + "network": { + "direction": "incoming" + }, + "auditd": { + "session": "unset", + "data": { + "hostname": "107.170.65.109", + "terminal": "ssh", + "op": "PAM:bad_ident" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "root" + }, + "object": { + "primary": "ssh", + "secondary": "107.170.65.109", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 186403, + "result": "fail" + }, + "host": { + "name": "demo-stack-redis-01" + }, + "beat": { + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1" + }, + "event": { + "module": "auditd", + "category": "user-login", + "type": "user_err", + "action": "error" + }, + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + }, + "process": { + "pid": "32238", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "107.170.65.109" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "_dXAUmcBTFzn_XoL55GP", + "source": { + "@timestamp": "2018-11-27T01:20:32.165Z", + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + }, + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + }, + "beat": { + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-redis-01" + }, + "process": { + "pid": "32229", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "107.170.65.109" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "data": { + "op": "login", + "terminal": "sshd", + "acct": "(unknown user)" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + }, + "object": { + "secondary": "107.170.65.109", + "type": "user-session", + "primary": "sshd" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 186395, + "result": "fail", + "session": "unset" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "_tXAUmcBTFzn_XoL55GP", + "source": { + "@timestamp": "2018-11-27T01:20:32.166Z", + "beat": { + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-redis-01" + }, + "event": { + "type": "user_login", + "action": "logged-in", + "module": "auditd", + "category": "user-login" + }, + "user": { + "uid": "0", + "auid": "unset", + "name_map": { + "uid": "root" + } + }, + "process": { + "pid": "32229", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "107.170.65.109" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "summary": { + "actor": { + "secondary": "(invalid user)", + "primary": "unset" + }, + "object": { + "type": "user-session", + "primary": "sshd", + "secondary": "107.170.65.109" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 186396, + "result": "fail", + "session": "unset", + "data": { + "terminal": "sshd", + "acct": "(invalid user)", + "op": "login" + } + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "_9XAUmcBTFzn_XoL55GP", + "source": { + "@timestamp": "2018-11-27T01:20:32.197Z", + "beat": { + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1", + "name": "demo-stack-redis-01" + }, + "host": { + "name": "demo-stack-redis-01" + }, + "event": { + "category": "user-login", + "type": "user_err", + "action": "error", + "module": "auditd" + }, + "user": { + "uid": "0", + "auid": "unset", + "name_map": { + "uid": "root" + } + }, + "process": { + "pid": "32229", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "107.170.65.109" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "summary": { + "actor": { + "secondary": "root", + "primary": "unset" + }, + "object": { + "type": "user-session", + "primary": "ssh", + "secondary": "107.170.65.109" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 186397, + "result": "fail", + "session": "unset", + "data": { + "op": "PAM:bad_ident", + "hostname": "107.170.65.109", + "terminal": "ssh" + } + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "xNXCUmcBTFzn_XoLQq83", + "source": { + "@timestamp": "2018-11-27T01:22:00.907Z", + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + }, + "beat": { + "name": "demo-stack-mysql-01", + "hostname": "demo-stack-mysql-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-mysql-01" + }, + "process": { + "pid": "12675", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "145.239.237.80" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "result": "fail", + "session": "unset", + "data": { + "acct": "(unknown user)", + "terminal": "sshd", + "op": "login" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + }, + "object": { + "type": "user-session", + "primary": "sshd", + "secondary": "145.239.237.80" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 43161 + }, + "event": { + "action": "logged-in", + "module": "auditd", + "category": "user-login", + "type": "user_login" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "xdXCUmcBTFzn_XoLQq83", + "source": { + "@timestamp": "2018-11-27T01:22:00.907Z", + "source": { + "ip": "145.239.237.80" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "data": { + "op": "login", + "acct": "(invalid user)", + "terminal": "sshd" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + }, + "object": { + "primary": "sshd", + "secondary": "145.239.237.80", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 43162, + "result": "fail", + "session": "unset" + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + }, + "user": { + "name_map": { + "uid": "root" + }, + "uid": "0", + "auid": "unset" + }, + "process": { + "pid": "12675", + "exe": "/usr/sbin/sshd" + }, + "host": { + "name": "demo-stack-mysql-01" + }, + "beat": { + "name": "demo-stack-mysql-01", + "hostname": "demo-stack-mysql-01", + "version": "7.0.0-alpha1" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "xtXCUmcBTFzn_XoLQq83", + "source": { + "@timestamp": "2018-11-27T01:22:01.039Z", + "source": { + "ip": "145.239.237.80" + }, + "beat": { + "name": "demo-stack-mysql-01", + "hostname": "demo-stack-mysql-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-mysql-01" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "session": "unset", + "data": { + "hostname": "145.239.237.80", + "op": "PAM:bad_ident", + "terminal": "ssh" + }, + "summary": { + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "root" + }, + "object": { + "primary": "ssh", + "secondary": "145.239.237.80", + "type": "user-session" + } + }, + "sequence": 43163, + "result": "fail" + }, + "event": { + "action": "error", + "module": "auditd", + "category": "user-login", + "type": "user_err" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "pid": "12675", + "exe": "/usr/sbin/sshd" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "o9XAUmcBTFzn_XoLKIGO", + "source": { + "@timestamp": "2018-11-27T01:19:43.268Z", + "host": { + "name": "demo-stack-nginx-01" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "summary": { + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + }, + "object": { + "primary": "sshd", + "secondary": "141.89.111.68", + "type": "user-session" + } + }, + "sequence": 192503, + "result": "fail", + "session": "unset", + "data": { + "terminal": "sshd", + "op": "login", + "acct": "(unknown user)" + } + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + }, + "user": { + "uid": "0", + "auid": "unset", + "name_map": { + "uid": "root" + } + }, + "process": { + "pid": "475", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "141.89.111.68" + }, + "beat": { + "name": "demo-stack-nginx-01", + "hostname": "demo-stack-nginx-01", + "version": "7.0.0-alpha1" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "pNXAUmcBTFzn_XoLKIGO", + "source": { + "@timestamp": "2018-11-27T01:19:43.269Z", + "host": { + "name": "demo-stack-nginx-01" + }, + "user": { + "name_map": { + "uid": "root" + }, + "auid": "unset", + "uid": "0" + }, + "process": { + "pid": "475", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "141.89.111.68" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "result": "fail", + "session": "unset", + "data": { + "op": "login", + "acct": "(invalid user)", + "terminal": "sshd" + }, + "summary": { + "actor": { + "secondary": "(invalid user)", + "primary": "unset" + }, + "object": { + "primary": "sshd", + "secondary": "141.89.111.68", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 192504 + }, + "event": { + "module": "auditd", + "category": "user-login", + "type": "user_login", + "action": "logged-in" + }, + "beat": { + "name": "demo-stack-nginx-01", + "hostname": "demo-stack-nginx-01", + "version": "7.0.0-alpha1" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "pdXAUmcBTFzn_XoLKIGO", + "source": { + "@timestamp": "2018-11-27T01:19:43.395Z", + "network": { + "direction": "incoming" + }, + "auditd": { + "result": "fail", + "session": "unset", + "data": { + "op": "PAM:bad_ident", + "terminal": "ssh", + "hostname": "141.89.111.68" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "root" + }, + "object": { + "primary": "ssh", + "secondary": "141.89.111.68", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 192505 + }, + "beat": { + "name": "demo-stack-nginx-01", + "hostname": "demo-stack-nginx-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-nginx-01" + }, + "event": { + "action": "error", + "module": "auditd", + "category": "user-login", + "type": "user_err" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "pid": "475", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "141.89.111.68" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "O9XAUmcBTFzn_XoLzZAP", + "source": { + "@timestamp": "2018-11-27T01:20:25.380Z", + "network": { + "direction": "incoming" + }, + "auditd": { + "summary": { + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + }, + "object": { + "primary": "sshd", + "secondary": "195.84.49.20", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 44179, + "result": "fail", + "session": "unset", + "data": { + "acct": "(unknown user)", + "terminal": "sshd", + "op": "login" + } + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + }, + "user": { + "name_map": { + "uid": "root" + }, + "uid": "0", + "auid": "unset" + }, + "process": { + "pid": "29341", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "195.84.49.20" + }, + "beat": { + "version": "7.0.0-alpha1", + "name": "demo-stack-es-01", + "hostname": "demo-stack-es-01" + }, + "host": { + "name": "demo-stack-es-01" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "PNXAUmcBTFzn_XoLzZAP", + "source": { + "@timestamp": "2018-11-27T01:20:25.380Z", + "source": { + "ip": "195.84.49.20" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "data": { + "acct": "(invalid user)", + "op": "login", + "terminal": "sshd" + }, + "summary": { + "object": { + "primary": "sshd", + "secondary": "195.84.49.20", + "type": "user-session" + }, + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + } + }, + "sequence": 44180, + "result": "fail", + "session": "unset" + }, + "event": { + "module": "auditd", + "category": "user-login", + "type": "user_login", + "action": "logged-in" + }, + "beat": { + "name": "demo-stack-es-01", + "hostname": "demo-stack-es-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-es-01" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "pid": "29341", + "exe": "/usr/sbin/sshd" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "PdXAUmcBTFzn_XoLzZAP", + "source": { + "@timestamp": "2018-11-27T01:20:25.516Z", + "beat": { + "version": "7.0.0-alpha1", + "name": "demo-stack-es-01", + "hostname": "demo-stack-es-01" + }, + "host": { + "name": "demo-stack-es-01" + }, + "source": { + "ip": "195.84.49.20" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "sequence": 44181, + "result": "fail", + "session": "unset", + "data": { + "terminal": "ssh", + "op": "PAM:bad_ident", + "hostname": "195.84.49.20" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "root" + }, + "object": { + "primary": "ssh", + "secondary": "195.84.49.20", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + } + }, + "event": { + "category": "user-login", + "type": "user_err", + "action": "error", + "module": "auditd" + }, + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + }, + "process": { + "exe": "/usr/sbin/sshd", + "pid": "29341" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "SNXCUmcBTFzn_XoLvLq2", + "source": { + "@timestamp": "2018-11-27T01:22:32.268Z", + "process": { + "exe": "/usr/sbin/sshd", + "pid": "32248" + }, + "beat": { + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-redis-01" + }, + "source": { + "ip": "107.170.65.109" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "sequence": 186407, + "result": "fail", + "session": "unset", + "data": { + "terminal": "sshd", + "op": "login", + "acct": "(unknown user)" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + }, + "object": { + "primary": "sshd", + "secondary": "107.170.65.109", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + } + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "SdXCUmcBTFzn_XoLvLq2", + "source": { + "@timestamp": "2018-11-27T01:22:32.269Z", + "beat": { + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-redis-01" + }, + "source": { + "ip": "107.170.65.109" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "session": "unset", + "data": { + "terminal": "sshd", + "acct": "(invalid user)", + "op": "login" + }, + "summary": { + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + }, + "object": { + "primary": "sshd", + "secondary": "107.170.65.109", + "type": "user-session" + } + }, + "sequence": 186408, + "result": "fail" + }, + "event": { + "action": "logged-in", + "module": "auditd", + "category": "user-login", + "type": "user_login" + }, + "user": { + "uid": "0", + "auid": "unset", + "name_map": { + "uid": "root" + } + }, + "process": { + "pid": "32248", + "exe": "/usr/sbin/sshd" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "StXCUmcBTFzn_XoLvLq2", + "source": { + "@timestamp": "2018-11-27T01:22:32.300Z", + "network": { + "direction": "incoming" + }, + "auditd": { + "sequence": 186409, + "result": "fail", + "session": "unset", + "data": { + "terminal": "ssh", + "op": "PAM:bad_ident", + "hostname": "107.170.65.109" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "root" + }, + "object": { + "secondary": "107.170.65.109", + "type": "user-session", + "primary": "ssh" + }, + "how": "/usr/sbin/sshd" + } + }, + "beat": { + "version": "7.0.0-alpha1", + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01" + }, + "host": { + "name": "demo-stack-redis-01" + }, + "event": { + "category": "user-login", + "type": "user_err", + "action": "error", + "module": "auditd" + }, + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + }, + "process": { + "pid": "32248", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "107.170.65.109" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "c9XCUmcBTFzn_XoL-sCa", + "source": { + "@timestamp": "2018-11-27T01:22:48.071Z", + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "pid": "490", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "68.183.62.109" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "summary": { + "how": "/usr/sbin/sshd", + "actor": { + "secondary": "(unknown user)", + "primary": "unset" + }, + "object": { + "secondary": "68.183.62.109", + "type": "user-session", + "primary": "sshd" + } + }, + "sequence": 192506, + "result": "fail", + "session": "unset", + "data": { + "terminal": "sshd", + "op": "login", + "acct": "(unknown user)" + } + }, + "event": { + "action": "logged-in", + "module": "auditd", + "category": "user-login", + "type": "user_login" + }, + "beat": { + "version": "7.0.0-alpha1", + "name": "demo-stack-nginx-01", + "hostname": "demo-stack-nginx-01" + }, + "host": { + "name": "demo-stack-nginx-01" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "dNXCUmcBTFzn_XoL-sCa", + "source": { + "@timestamp": "2018-11-27T01:22:48.073Z", + "network": { + "direction": "incoming" + }, + "auditd": { + "session": "unset", + "data": { + "terminal": "sshd", + "acct": "(invalid user)", + "op": "login" + }, + "summary": { + "object": { + "primary": "sshd", + "secondary": "68.183.62.109", + "type": "user-session" + }, + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + } + }, + "sequence": 192507, + "result": "fail" + }, + "host": { + "name": "demo-stack-nginx-01" + }, + "beat": { + "name": "demo-stack-nginx-01", + "hostname": "demo-stack-nginx-01", + "version": "7.0.0-alpha1" + }, + "event": { + "action": "logged-in", + "module": "auditd", + "category": "user-login", + "type": "user_login" + }, + "user": { + "name_map": { + "uid": "root" + }, + "auid": "unset", + "uid": "0" + }, + "process": { + "pid": "490", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "68.183.62.109" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "ddXCUmcBTFzn_XoL-sCa", + "source": { + "@timestamp": "2018-11-27T01:22:48.104Z", + "process": { + "exe": "/usr/sbin/sshd", + "pid": "490" + }, + "source": { + "ip": "68.183.62.109" + }, + "network": { + "direction": "incoming" + }, + "beat": { + "name": "demo-stack-nginx-01", + "hostname": "demo-stack-nginx-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-nginx-01" + }, + "auditd": { + "session": "unset", + "data": { + "hostname": "68.183.62.109", + "op": "PAM:bad_ident", + "terminal": "ssh" + }, + "summary": { + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "root" + }, + "object": { + "type": "user-session", + "primary": "ssh", + "secondary": "68.183.62.109" + } + }, + "sequence": 192508, + "result": "fail" + }, + "event": { + "category": "user-login", + "type": "user_err", + "action": "error", + "module": "auditd" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "stXDUmcBTFzn_XoLwdCO", + "source": { + "@timestamp": "2018-11-27T01:23:39.044Z", + "process": { + "pid": "502", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "80.127.254.119" + }, + "network": { + "direction": "incoming" + }, + "host": { + "name": "demo-stack-nginx-01" + }, + "beat": { + "name": "demo-stack-nginx-01", + "hostname": "demo-stack-nginx-01", + "version": "7.0.0-alpha1" + }, + "auditd": { + "sequence": 192511, + "result": "fail", + "session": "unset", + "data": { + "acct": "(unknown user)", + "op": "login", + "terminal": "sshd" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + }, + "object": { + "type": "user-session", + "primary": "sshd", + "secondary": "80.127.254.119" + }, + "how": "/usr/sbin/sshd" + } + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + }, + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "s9XDUmcBTFzn_XoLwdCO", + "source": { + "@timestamp": "2018-11-27T01:23:39.045Z", + "process": { + "pid": "502", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "80.127.254.119" + }, + "network": { + "direction": "incoming" + }, + "beat": { + "name": "demo-stack-nginx-01", + "hostname": "demo-stack-nginx-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-nginx-01" + }, + "auditd": { + "sequence": 192512, + "result": "fail", + "session": "unset", + "data": { + "op": "login", + "acct": "(invalid user)", + "terminal": "sshd" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + }, + "object": { + "secondary": "80.127.254.119", + "type": "user-session", + "primary": "sshd" + }, + "how": "/usr/sbin/sshd" + } + }, + "event": { + "action": "logged-in", + "module": "auditd", + "category": "user-login", + "type": "user_login" + }, + "user": { + "uid": "0", + "auid": "unset", + "name_map": { + "uid": "root" + } + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "tNXDUmcBTFzn_XoLwdCO", + "source": { + "@timestamp": "2018-11-27T01:23:39.260Z", + "host": { + "name": "demo-stack-nginx-01" + }, + "event": { + "category": "user-login", + "type": "user_err", + "action": "error", + "module": "auditd" + }, + "user": { + "name_map": { + "uid": "root" + }, + "auid": "unset", + "uid": "0" + }, + "process": { + "pid": "502", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "80.127.254.119" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "session": "unset", + "data": { + "op": "PAM:bad_ident", + "terminal": "ssh", + "hostname": "80.127.254.119" + }, + "summary": { + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "root" + }, + "object": { + "primary": "ssh", + "secondary": "80.127.254.119", + "type": "user-session" + } + }, + "sequence": 192513, + "result": "fail" + }, + "beat": { + "name": "demo-stack-nginx-01", + "hostname": "demo-stack-nginx-01", + "version": "7.0.0-alpha1" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "TtXDUmcBTFzn_XoLkcxS", + "source": { + "@timestamp": "2018-11-27T01:23:26.696Z", + "host": { + "name": "demo-stack-redis-01" + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + }, + "user": { + "name_map": { + "uid": "root" + }, + "auid": "unset", + "uid": "0" + }, + "process": { + "pid": "32251", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "93.104.213.19" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "sequence": 186410, + "result": "fail", + "session": "unset", + "data": { + "terminal": "sshd", + "acct": "(unknown user)", + "op": "login" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + }, + "object": { + "secondary": "93.104.213.19", + "type": "user-session", + "primary": "sshd" + }, + "how": "/usr/sbin/sshd" + } + }, + "beat": { + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "T9XDUmcBTFzn_XoLkcxS", + "source": { + "@timestamp": "2018-11-27T01:23:26.697Z", + "source": { + "ip": "93.104.213.19" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "data": { + "acct": "(invalid user)", + "terminal": "sshd", + "op": "login" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + }, + "object": { + "secondary": "93.104.213.19", + "type": "user-session", + "primary": "sshd" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 186411, + "result": "fail", + "session": "unset" + }, + "event": { + "action": "logged-in", + "module": "auditd", + "category": "user-login", + "type": "user_login" + }, + "beat": { + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-redis-01" + }, + "user": { + "uid": "0", + "auid": "unset", + "name_map": { + "uid": "root" + } + }, + "process": { + "pid": "32251", + "exe": "/usr/sbin/sshd" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "UNXDUmcBTFzn_XoLkcxS", + "source": { + "@timestamp": "2018-11-27T01:23:26.812Z", + "user": { + "name_map": { + "uid": "root" + }, + "auid": "unset", + "uid": "0" + }, + "process": { + "pid": "32251", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "93.104.213.19" + }, + "network": { + "direction": "incoming" + }, + "beat": { + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-redis-01" + }, + "auditd": { + "sequence": 186412, + "result": "fail", + "session": "unset", + "data": { + "op": "PAM:bad_ident", + "hostname": "93.104.213.19", + "terminal": "ssh" + }, + "summary": { + "object": { + "primary": "ssh", + "secondary": "93.104.213.19", + "type": "user-session" + }, + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "root" + } + } + }, + "event": { + "module": "auditd", + "category": "user-login", + "type": "user_err", + "action": "error" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "ctXCUmcBTFzn_XoL3b2F", + "source": { + "@timestamp": "2018-11-27T01:22:40.662Z", + "source": { + "ip": "185.238.72.255" + }, + "network": { + "direction": "incoming" + }, + "beat": { + "name": "demo-stack-mysql-01", + "hostname": "demo-stack-mysql-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-mysql-01" + }, + "auditd": { + "sequence": 43164, + "result": "fail", + "session": "unset", + "data": { + "op": "login", + "terminal": "sshd", + "acct": "(unknown user)" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + }, + "object": { + "primary": "sshd", + "secondary": "185.238.72.255", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + } + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "pid": "12678", + "exe": "/usr/sbin/sshd" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "c9XCUmcBTFzn_XoL3b2F", + "source": { + "@timestamp": "2018-11-27T01:22:40.662Z", + "event": { + "action": "logged-in", + "module": "auditd", + "category": "user-login", + "type": "user_login" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "pid": "12678", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "185.238.72.255" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "session": "unset", + "data": { + "acct": "(invalid user)", + "terminal": "sshd", + "op": "login" + }, + "summary": { + "how": "/usr/sbin/sshd", + "actor": { + "secondary": "(invalid user)", + "primary": "unset" + }, + "object": { + "primary": "sshd", + "secondary": "185.238.72.255", + "type": "user-session" + } + }, + "sequence": 43165, + "result": "fail" + }, + "beat": { + "name": "demo-stack-mysql-01", + "hostname": "demo-stack-mysql-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-mysql-01" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "dNXCUmcBTFzn_XoL3b2F", + "source": { + "@timestamp": "2018-11-27T01:22:40.794Z", + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + }, + "beat": { + "version": "7.0.0-alpha1", + "name": "demo-stack-mysql-01", + "hostname": "demo-stack-mysql-01" + }, + "host": { + "name": "demo-stack-mysql-01" + }, + "process": { + "exe": "/usr/sbin/sshd", + "pid": "12678" + }, + "source": { + "ip": "185.238.72.255" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "data": { + "hostname": "185.238.72.255", + "terminal": "ssh", + "op": "PAM:bad_ident" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "root" + }, + "object": { + "primary": "ssh", + "secondary": "185.238.72.255", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 43166, + "result": "fail", + "session": "unset" + }, + "event": { + "action": "error", + "module": "auditd", + "category": "user-login", + "type": "user_err" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "SNXDUmcBTFzn_XoLtc-O", + "source": { + "@timestamp": "2018-11-27T01:23:35.972Z", + "user": { + "auid": "unset", + "uid": "0", + "name_map": { + "uid": "root" + } + }, + "process": { + "pid": "32253", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "107.170.65.109" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "session": "unset", + "data": { + "op": "login", + "terminal": "sshd", + "acct": "(unknown user)" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + }, + "object": { + "primary": "sshd", + "secondary": "107.170.65.109", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 186413, + "result": "fail" + }, + "beat": { + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-redis-01" + }, + "event": { + "action": "logged-in", + "module": "auditd", + "category": "user-login", + "type": "user_login" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "SdXDUmcBTFzn_XoLtc-O", + "source": { + "@timestamp": "2018-11-27T01:23:35.973Z", + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "pid": "32253", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "107.170.65.109" + }, + "network": { + "direction": "incoming" + }, + "beat": { + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-redis-01" + }, + "auditd": { + "data": { + "op": "login", + "terminal": "sshd", + "acct": "(invalid user)" + }, + "summary": { + "object": { + "primary": "sshd", + "secondary": "107.170.65.109", + "type": "user-session" + }, + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + } + }, + "sequence": 186414, + "result": "fail", + "session": "unset" + }, + "event": { + "module": "auditd", + "category": "user-login", + "type": "user_login", + "action": "logged-in" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "StXDUmcBTFzn_XoLtc-O", + "source": { + "@timestamp": "2018-11-27T01:23:36.003Z", + "event": { + "action": "error", + "module": "auditd", + "category": "user-login", + "type": "user_err" + }, + "user": { + "auid": "unset", + "uid": "0", + "name_map": { + "uid": "root" + } + }, + "process": { + "pid": "32253", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "107.170.65.109" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "data": { + "op": "PAM:bad_ident", + "hostname": "107.170.65.109", + "terminal": "ssh" + }, + "summary": { + "object": { + "secondary": "107.170.65.109", + "type": "user-session", + "primary": "ssh" + }, + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "root" + } + }, + "sequence": 186415, + "result": "fail", + "session": "unset" + }, + "host": { + "name": "demo-stack-redis-01" + }, + "beat": { + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "CNXDUmcBTFzn_XoLps53", + "source": { + "@timestamp": "2018-11-27T01:23:32.109Z", + "host": { + "name": "demo-stack-apache-01" + }, + "source": { + "ip": "125.227.77.88" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "result": "fail", + "session": "unset", + "data": { + "terminal": "ssh", + "op": "PAM:bad_ident", + "hostname": "125.227.77.88" + }, + "summary": { + "object": { + "primary": "ssh", + "secondary": "125.227.77.88", + "type": "user-session" + }, + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "root" + } + }, + "sequence": 184346 + }, + "event": { + "category": "user-login", + "type": "user_err", + "action": "error", + "module": "auditd" + }, + "user": { + "auid": "unset", + "uid": "0", + "name_map": { + "uid": "root" + } + }, + "process": { + "pid": "25735", + "exe": "/usr/sbin/sshd" + }, + "beat": { + "name": "demo-stack-apache-01", + "hostname": "demo-stack-apache-01", + "version": "7.0.0-alpha1" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "HNXDUmcBTFzn_XoLp84D", + "source": { + "@timestamp": "2018-11-27T01:23:32.249Z", + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "pid": "500", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "142.93.109.33" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "data": { + "op": "PAM:bad_ident", + "hostname": "142.93.109.33", + "terminal": "ssh" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "root" + }, + "object": { + "primary": "ssh", + "secondary": "142.93.109.33", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 192510, + "result": "fail", + "session": "unset" + }, + "beat": { + "name": "demo-stack-nginx-01", + "hostname": "demo-stack-nginx-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-nginx-01" + }, + "event": { + "type": "user_err", + "action": "error", + "module": "auditd", + "category": "user-login" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "rdXDUmcBTFzn_XoLZcgh", + "source": { + "@timestamp": "2018-11-27T01:23:15.383Z", + "host": { + "name": "demo-stack-apache-01" + }, + "process": { + "pid": "25733", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "125.227.77.88" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "session": "unset", + "data": { + "terminal": "ssh", + "hostname": "125.227.77.88", + "op": "PAM:bad_ident" + }, + "summary": { + "object": { + "primary": "ssh", + "secondary": "125.227.77.88", + "type": "user-session" + }, + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "root" + } + }, + "sequence": 184345, + "result": "fail" + }, + "event": { + "category": "user-login", + "type": "user_err", + "action": "error", + "module": "auditd" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "beat": { + "name": "demo-stack-apache-01", + "hostname": "demo-stack-apache-01", + "version": "7.0.0-alpha1" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "v9XDUmcBTFzn_XoLIMO9", + "source": { + "@timestamp": "2018-11-27T01:22:57.875Z", + "process": { + "pid": "497", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "94.16.115.155" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "session": "unset", + "data": { + "op": "PAM:bad_ident", + "terminal": "ssh", + "hostname": "94.16.115.155" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "root" + }, + "object": { + "secondary": "94.16.115.155", + "type": "user-session", + "primary": "ssh" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 192509, + "result": "fail" + }, + "beat": { + "name": "demo-stack-nginx-01", + "hostname": "demo-stack-nginx-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-nginx-01" + }, + "event": { + "action": "error", + "module": "auditd", + "category": "user-login", + "type": "user_err" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "ndXDUmcBTFzn_XoL69Tr", + "source": { + "@timestamp": "2018-11-27T01:23:49.884Z", + "host": { + "name": "demo-stack-mysql-01" + }, + "source": { + "ip": "147.229.176.122" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "session": "unset", + "data": { + "acct": "(unknown user)", + "terminal": "sshd", + "op": "login" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + }, + "object": { + "primary": "sshd", + "secondary": "147.229.176.122", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 43167, + "result": "fail" + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + }, + "user": { + "name_map": { + "uid": "root" + }, + "auid": "unset", + "uid": "0" + }, + "process": { + "exe": "/usr/sbin/sshd", + "pid": "12686" + }, + "beat": { + "name": "demo-stack-mysql-01", + "hostname": "demo-stack-mysql-01", + "version": "7.0.0-alpha1" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "ntXDUmcBTFzn_XoL69Tr", + "source": { + "@timestamp": "2018-11-27T01:23:49.884Z", + "source": { + "ip": "147.229.176.122" + }, + "beat": { + "name": "demo-stack-mysql-01", + "hostname": "demo-stack-mysql-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-mysql-01" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "result": "fail", + "session": "unset", + "data": { + "acct": "(invalid user)", + "terminal": "sshd", + "op": "login" + }, + "summary": { + "object": { + "primary": "sshd", + "secondary": "147.229.176.122", + "type": "user-session" + }, + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + } + }, + "sequence": 43168 + }, + "event": { + "type": "user_login", + "action": "logged-in", + "module": "auditd", + "category": "user-login" + }, + "user": { + "name_map": { + "uid": "root" + }, + "uid": "0", + "auid": "unset" + }, + "process": { + "exe": "/usr/sbin/sshd", + "pid": "12686" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "n9XDUmcBTFzn_XoL69Tr", + "source": { + "@timestamp": "2018-11-27T01:23:50.008Z", + "process": { + "pid": "12686", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "147.229.176.122" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "summary": { + "object": { + "primary": "ssh", + "secondary": "147.229.176.122", + "type": "user-session" + }, + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "root" + } + }, + "sequence": 43169, + "result": "fail", + "session": "unset", + "data": { + "op": "PAM:bad_ident", + "hostname": "147.229.176.122", + "terminal": "ssh" + } + }, + "beat": { + "name": "demo-stack-mysql-01", + "hostname": "demo-stack-mysql-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-mysql-01" + }, + "event": { + "module": "auditd", + "category": "user-login", + "type": "user_err", + "action": "error" + }, + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "CNXDUmcBTFzn_XoL99V8", + "source": { + "@timestamp": "2018-11-27T01:23:52.849Z", + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "beat": { + "name": "demo-stack-apache-01", + "hostname": "demo-stack-apache-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-apache-01" + }, + "process": { + "exe": "/usr/sbin/sshd", + "pid": "25737" + }, + "source": { + "ip": "125.227.77.88" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "data": { + "op": "login", + "acct": "(unknown user)", + "terminal": "sshd" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + }, + "object": { + "type": "user-session", + "primary": "sshd", + "secondary": "125.227.77.88" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 184347, + "result": "fail", + "session": "unset" + }, + "event": { + "module": "auditd", + "category": "user-login", + "type": "user_login", + "action": "logged-in" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "CdXDUmcBTFzn_XoL99V8", + "source": { + "@timestamp": "2018-11-27T01:23:52.850Z", + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + }, + "user": { + "uid": "0", + "auid": "unset", + "name_map": { + "uid": "root" + } + }, + "process": { + "exe": "/usr/sbin/sshd", + "pid": "25737" + }, + "beat": { + "name": "demo-stack-apache-01", + "hostname": "demo-stack-apache-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-apache-01" + }, + "source": { + "ip": "125.227.77.88" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "result": "fail", + "session": "unset", + "data": { + "op": "login", + "terminal": "sshd", + "acct": "(invalid user)" + }, + "summary": { + "object": { + "primary": "sshd", + "secondary": "125.227.77.88", + "type": "user-session" + }, + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + } + }, + "sequence": 184348 + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "CtXDUmcBTFzn_XoL99V8", + "source": { + "@timestamp": "2018-11-27T01:23:53.128Z", + "network": { + "direction": "incoming" + }, + "auditd": { + "result": "fail", + "session": "unset", + "data": { + "hostname": "125.227.77.88", + "terminal": "ssh", + "op": "PAM:bad_ident" + }, + "summary": { + "object": { + "secondary": "125.227.77.88", + "type": "user-session", + "primary": "ssh" + }, + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "root" + } + }, + "sequence": 184349 + }, + "event": { + "action": "error", + "module": "auditd", + "category": "user-login", + "type": "user_err" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "pid": "25737", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "125.227.77.88" + }, + "beat": { + "name": "demo-stack-apache-01", + "hostname": "demo-stack-apache-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-apache-01" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "9dXFUmcBTFzn_XoLyvxi", + "source": { + "@timestamp": "2018-11-27T01:25:52.376Z", + "host": { + "name": "demo-stack-redis-01" + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "exe": "/usr/sbin/sshd", + "pid": "32272" + }, + "source": { + "ip": "107.170.65.109" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "data": { + "acct": "(unknown user)", + "terminal": "sshd", + "op": "login" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + }, + "object": { + "type": "user-session", + "primary": "sshd", + "secondary": "107.170.65.109" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 186422, + "result": "fail", + "session": "unset" + }, + "beat": { + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "9tXFUmcBTFzn_XoLyvxi", + "source": { + "@timestamp": "2018-11-27T01:25:52.377Z", + "network": { + "direction": "incoming" + }, + "auditd": { + "summary": { + "object": { + "type": "user-session", + "primary": "sshd", + "secondary": "107.170.65.109" + }, + "how": "/usr/sbin/sshd", + "actor": { + "secondary": "(invalid user)", + "primary": "unset" + } + }, + "sequence": 186423, + "result": "fail", + "session": "unset", + "data": { + "terminal": "sshd", + "op": "login", + "acct": "(invalid user)" + } + }, + "event": { + "type": "user_login", + "action": "logged-in", + "module": "auditd", + "category": "user-login" + }, + "user": { + "name_map": { + "uid": "root" + }, + "auid": "unset", + "uid": "0" + }, + "process": { + "pid": "32272", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "107.170.65.109" + }, + "beat": { + "version": "7.0.0-alpha1", + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01" + }, + "host": { + "name": "demo-stack-redis-01" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "99XFUmcBTFzn_XoLyvxi", + "source": { + "@timestamp": "2018-11-27T01:25:52.407Z", + "process": { + "pid": "32272", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "107.170.65.109" + }, + "network": { + "direction": "incoming" + }, + "host": { + "name": "demo-stack-redis-01" + }, + "beat": { + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1" + }, + "auditd": { + "summary": { + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "root" + }, + "object": { + "primary": "ssh", + "secondary": "107.170.65.109", + "type": "user-session" + } + }, + "sequence": 186424, + "result": "fail", + "session": "unset", + "data": { + "op": "PAM:bad_ident", + "hostname": "107.170.65.109", + "terminal": "ssh" + } + }, + "event": { + "module": "auditd", + "category": "user-login", + "type": "user_err", + "action": "error" + }, + "user": { + "uid": "0", + "auid": "unset", + "name_map": { + "uid": "root" + } + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "aNXFUmcBTFzn_XoLzv1N", + "source": { + "@timestamp": "2018-11-27T01:25:53.380Z", + "beat": { + "name": "demo-stack-nginx-01", + "hostname": "demo-stack-nginx-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-nginx-01" + }, + "user": { + "uid": "0", + "auid": "unset", + "name_map": { + "uid": "root" + } + }, + "process": { + "pid": "524", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "104.236.181.158" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "data": { + "op": "login", + "acct": "(unknown user)", + "terminal": "sshd" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + }, + "object": { + "primary": "sshd", + "secondary": "104.236.181.158", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 192520, + "result": "fail", + "session": "unset" + }, + "event": { + "type": "user_login", + "action": "logged-in", + "module": "auditd", + "category": "user-login" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "adXFUmcBTFzn_XoLzv1N", + "source": { + "@timestamp": "2018-11-27T01:25:53.381Z", + "process": { + "pid": "524", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "104.236.181.158" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "sequence": 192521, + "result": "fail", + "session": "unset", + "data": { + "terminal": "sshd", + "acct": "(invalid user)", + "op": "login" + }, + "summary": { + "how": "/usr/sbin/sshd", + "actor": { + "secondary": "(invalid user)", + "primary": "unset" + }, + "object": { + "secondary": "104.236.181.158", + "type": "user-session", + "primary": "sshd" + } + } + }, + "host": { + "name": "demo-stack-nginx-01" + }, + "beat": { + "hostname": "demo-stack-nginx-01", + "version": "7.0.0-alpha1", + "name": "demo-stack-nginx-01" + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + }, + "user": { + "uid": "0", + "auid": "unset", + "name_map": { + "uid": "root" + } + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "atXFUmcBTFzn_XoLzv1N", + "source": { + "@timestamp": "2018-11-27T01:25:53.425Z", + "beat": { + "version": "7.0.0-alpha1", + "name": "demo-stack-nginx-01", + "hostname": "demo-stack-nginx-01" + }, + "host": { + "name": "demo-stack-nginx-01" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "data": { + "terminal": "ssh", + "op": "PAM:bad_ident", + "hostname": "104.236.181.158" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "root" + }, + "object": { + "type": "user-session", + "primary": "ssh", + "secondary": "104.236.181.158" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 192522, + "result": "fail", + "session": "unset" + }, + "event": { + "type": "user_err", + "action": "error", + "module": "auditd", + "category": "user-login" + }, + "user": { + "uid": "0", + "auid": "unset", + "name_map": { + "uid": "root" + } + }, + "process": { + "pid": "524", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "104.236.181.158" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "q9XDUmcBTFzn_XoL2tJr", + "source": { + "@timestamp": "2018-11-27T01:23:45.409Z", + "process": { + "pid": "19632", + "exe": "/usr/sbin/sshd" + }, + "beat": { + "name": "demo-stack-haproxy-01", + "hostname": "demo-stack-haproxy-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-haproxy-01" + }, + "source": { + "ip": "46.101.192.45" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "session": "unset", + "data": { + "acct": "(unknown user)", + "terminal": "sshd", + "op": "login" + }, + "summary": { + "object": { + "primary": "sshd", + "secondary": "46.101.192.45", + "type": "user-session" + }, + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + } + }, + "sequence": 142336, + "result": "fail" + }, + "event": { + "action": "logged-in", + "module": "auditd", + "category": "user-login", + "type": "user_login" + }, + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "rNXDUmcBTFzn_XoL2tJr", + "source": { + "@timestamp": "2018-11-27T01:23:45.410Z", + "source": { + "ip": "46.101.192.45" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "summary": { + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + }, + "object": { + "type": "user-session", + "primary": "sshd", + "secondary": "46.101.192.45" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 142337, + "result": "fail", + "session": "unset", + "data": { + "op": "login", + "acct": "(invalid user)", + "terminal": "sshd" + } + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + }, + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + }, + "beat": { + "name": "demo-stack-haproxy-01", + "hostname": "demo-stack-haproxy-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-haproxy-01" + }, + "process": { + "pid": "19632", + "exe": "/usr/sbin/sshd" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "rdXDUmcBTFzn_XoL2tJr", + "source": { + "@timestamp": "2018-11-27T01:23:45.519Z", + "auditd": { + "sequence": 142338, + "result": "fail", + "session": "unset", + "data": { + "op": "PAM:bad_ident", + "hostname": "46.101.192.45", + "terminal": "ssh" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "root" + }, + "object": { + "primary": "ssh", + "secondary": "46.101.192.45", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + } + }, + "event": { + "action": "error", + "module": "auditd", + "category": "user-login", + "type": "user_err" + }, + "beat": { + "name": "demo-stack-haproxy-01", + "hostname": "demo-stack-haproxy-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-haproxy-01" + }, + "user": { + "uid": "0", + "auid": "unset", + "name_map": { + "uid": "root" + } + }, + "process": { + "exe": "/usr/sbin/sshd", + "pid": "19632" + }, + "source": { + "ip": "46.101.192.45" + }, + "network": { + "direction": "incoming" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "kNbGUmcBTFzn_XoLcgv7", + "source": { + "@timestamp": "2018-11-27T01:26:35.537Z", + "event": { + "module": "auditd", + "category": "user-login", + "type": "user_login", + "action": "logged-in" + }, + "user": { + "name_map": { + "uid": "root" + }, + "auid": "unset", + "uid": "0" + }, + "process": { + "pid": "25757", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "167.114.153.36" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "sequence": 184350, + "result": "fail", + "session": "unset", + "data": { + "terminal": "sshd", + "op": "login", + "acct": "(unknown user)" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + }, + "object": { + "primary": "sshd", + "secondary": "167.114.153.36", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + } + }, + "beat": { + "name": "demo-stack-apache-01", + "hostname": "demo-stack-apache-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-apache-01" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "kdbGUmcBTFzn_XoLcgv7", + "source": { + "@timestamp": "2018-11-27T01:26:35.538Z", + "source": { + "ip": "167.114.153.36" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "summary": { + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + }, + "object": { + "secondary": "167.114.153.36", + "type": "user-session", + "primary": "sshd" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 184351, + "result": "fail", + "session": "unset", + "data": { + "terminal": "sshd", + "acct": "(invalid user)", + "op": "login" + } + }, + "event": { + "action": "logged-in", + "module": "auditd", + "category": "user-login", + "type": "user_login" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "exe": "/usr/sbin/sshd", + "pid": "25757" + }, + "beat": { + "name": "demo-stack-apache-01", + "hostname": "demo-stack-apache-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-apache-01" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "ktbGUmcBTFzn_XoLcgv7", + "source": { + "@timestamp": "2018-11-27T01:26:35.581Z", + "network": { + "direction": "incoming" + }, + "auditd": { + "result": "fail", + "session": "unset", + "data": { + "terminal": "ssh", + "op": "PAM:bad_ident", + "hostname": "167.114.153.36" + }, + "summary": { + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "root" + }, + "object": { + "primary": "ssh", + "secondary": "167.114.153.36", + "type": "user-session" + } + }, + "sequence": 184352 + }, + "beat": { + "name": "demo-stack-apache-01", + "hostname": "demo-stack-apache-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-apache-01" + }, + "event": { + "category": "user-login", + "type": "user_err", + "action": "error", + "module": "auditd" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "exe": "/usr/sbin/sshd", + "pid": "25757" + }, + "source": { + "ip": "167.114.153.36" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "YNXEUmcBTFzn_XoLu-bL", + "source": { + "@timestamp": "2018-11-27T01:24:43.105Z", + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + }, + "user": { + "auid": "unset", + "uid": "0", + "name_map": { + "uid": "root" + } + }, + "process": { + "pid": "32262", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "107.170.65.109" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "summary": { + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + }, + "object": { + "type": "user-session", + "primary": "sshd", + "secondary": "107.170.65.109" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 186416, + "result": "fail", + "session": "unset", + "data": { + "acct": "(unknown user)", + "op": "login", + "terminal": "sshd" + } + }, + "beat": { + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-redis-01" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "YdXEUmcBTFzn_XoLu-bL", + "source": { + "@timestamp": "2018-11-27T01:24:43.106Z", + "beat": { + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-redis-01" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "data": { + "acct": "(invalid user)", + "terminal": "sshd", + "op": "login" + }, + "summary": { + "actor": { + "secondary": "(invalid user)", + "primary": "unset" + }, + "object": { + "type": "user-session", + "primary": "sshd", + "secondary": "107.170.65.109" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 186417, + "result": "fail", + "session": "unset" + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + }, + "user": { + "uid": "0", + "auid": "unset", + "name_map": { + "uid": "root" + } + }, + "process": { + "exe": "/usr/sbin/sshd", + "pid": "32262" + }, + "source": { + "ip": "107.170.65.109" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "YtXEUmcBTFzn_XoLu-bL", + "source": { + "@timestamp": "2018-11-27T01:24:43.136Z", + "host": { + "name": "demo-stack-redis-01" + }, + "event": { + "type": "user_err", + "action": "error", + "module": "auditd", + "category": "user-login" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "exe": "/usr/sbin/sshd", + "pid": "32262" + }, + "source": { + "ip": "107.170.65.109" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "data": { + "op": "PAM:bad_ident", + "hostname": "107.170.65.109", + "terminal": "ssh" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "root" + }, + "object": { + "primary": "ssh", + "secondary": "107.170.65.109", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 186418, + "result": "fail", + "session": "unset" + }, + "beat": { + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "6dXFUmcBTFzn_XoLNvCh", + "source": { + "@timestamp": "2018-11-27T01:25:14.551Z", + "auditd": { + "data": { + "acct": "(unknown user)", + "op": "login", + "terminal": "sshd" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + }, + "object": { + "primary": "sshd", + "secondary": "34.197.73.243", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 186419, + "result": "fail", + "session": "unset" + }, + "event": { + "module": "auditd", + "category": "user-login", + "type": "user_login", + "action": "logged-in" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "pid": "32269", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "34.197.73.243" + }, + "network": { + "direction": "incoming" + }, + "beat": { + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-redis-01" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "6tXFUmcBTFzn_XoLNvCh", + "source": { + "@timestamp": "2018-11-27T01:25:14.552Z", + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + }, + "beat": { + "version": "7.0.0-alpha1", + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01" + }, + "host": { + "name": "demo-stack-redis-01" + }, + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + }, + "process": { + "pid": "32269", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "34.197.73.243" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "summary": { + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + }, + "object": { + "type": "user-session", + "primary": "sshd", + "secondary": "34.197.73.243" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 186420, + "result": "fail", + "session": "unset", + "data": { + "terminal": "sshd", + "acct": "(invalid user)", + "op": "login" + } + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "69XFUmcBTFzn_XoLNvCh", + "source": { + "@timestamp": "2018-11-27T01:25:14.587Z", + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "pid": "32269", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "34.197.73.243" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "session": "unset", + "data": { + "hostname": "34.197.73.243", + "op": "PAM:bad_ident", + "terminal": "ssh" + }, + "summary": { + "object": { + "primary": "ssh", + "secondary": "34.197.73.243", + "type": "user-session" + }, + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "root" + } + }, + "sequence": 186421, + "result": "fail" + }, + "event": { + "category": "user-login", + "type": "user_err", + "action": "error", + "module": "auditd" + }, + "beat": { + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-redis-01" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "WtXEUmcBTFzn_XoLA9aC", + "source": { + "@timestamp": "2018-11-27T01:23:55.928Z", + "auditd": { + "sequence": 192514, + "result": "fail", + "session": "unset", + "data": { + "acct": "(unknown user)", + "terminal": "sshd", + "op": "login" + }, + "summary": { + "object": { + "primary": "sshd", + "secondary": "211.21.65.57", + "type": "user-session" + }, + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + } + } + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + }, + "user": { + "auid": "unset", + "uid": "0", + "name_map": { + "uid": "root" + } + }, + "process": { + "pid": "504", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "211.21.65.57" + }, + "network": { + "direction": "incoming" + }, + "host": { + "name": "demo-stack-nginx-01" + }, + "beat": { + "name": "demo-stack-nginx-01", + "hostname": "demo-stack-nginx-01", + "version": "7.0.0-alpha1" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "W9XEUmcBTFzn_XoLA9aC", + "source": { + "@timestamp": "2018-11-27T01:23:55.929Z", + "user": { + "auid": "unset", + "uid": "0", + "name_map": { + "uid": "root" + } + }, + "process": { + "exe": "/usr/sbin/sshd", + "pid": "504" + }, + "source": { + "ip": "211.21.65.57" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "sequence": 192515, + "result": "fail", + "session": "unset", + "data": { + "terminal": "sshd", + "acct": "(invalid user)", + "op": "login" + }, + "summary": { + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + }, + "object": { + "primary": "sshd", + "secondary": "211.21.65.57", + "type": "user-session" + } + } + }, + "beat": { + "hostname": "demo-stack-nginx-01", + "version": "7.0.0-alpha1", + "name": "demo-stack-nginx-01" + }, + "host": { + "name": "demo-stack-nginx-01" + }, + "event": { + "action": "logged-in", + "module": "auditd", + "category": "user-login", + "type": "user_login" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "XNXEUmcBTFzn_XoLA9aC", + "source": { + "@timestamp": "2018-11-27T01:23:56.099Z", + "network": { + "direction": "incoming" + }, + "auditd": { + "summary": { + "actor": { + "secondary": "root", + "primary": "unset" + }, + "object": { + "type": "user-session", + "primary": "ssh", + "secondary": "211.21.65.57" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 192516, + "result": "fail", + "session": "unset", + "data": { + "op": "PAM:bad_ident", + "terminal": "ssh", + "hostname": "211.21.65.57" + } + }, + "event": { + "type": "user_err", + "action": "error", + "module": "auditd", + "category": "user-login" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "pid": "504", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "211.21.65.57" + }, + "beat": { + "name": "demo-stack-nginx-01", + "hostname": "demo-stack-nginx-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-nginx-01" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "sNXEUmcBTFzn_XoLbd__", + "source": { + "@timestamp": "2018-11-27T01:24:23.144Z", + "event": { + "action": "logged-in", + "module": "auditd", + "category": "user-login", + "type": "user_login" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "pid": "515", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "54.254.52.72" + }, + "host": { + "name": "demo-stack-nginx-01" + }, + "beat": { + "hostname": "demo-stack-nginx-01", + "version": "7.0.0-alpha1", + "name": "demo-stack-nginx-01" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "data": { + "terminal": "sshd", + "op": "login", + "acct": "(unknown user)" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + }, + "object": { + "primary": "sshd", + "secondary": "54.254.52.72", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 192517, + "result": "fail", + "session": "unset" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "sdXEUmcBTFzn_XoLbd__", + "source": { + "@timestamp": "2018-11-27T01:24:23.145Z", + "auditd": { + "data": { + "op": "login", + "terminal": "sshd", + "acct": "(invalid user)" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + }, + "object": { + "primary": "sshd", + "secondary": "54.254.52.72", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 192518, + "result": "fail", + "session": "unset" + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + }, + "host": { + "name": "demo-stack-nginx-01" + }, + "beat": { + "name": "demo-stack-nginx-01", + "hostname": "demo-stack-nginx-01", + "version": "7.0.0-alpha1" + }, + "user": { + "auid": "unset", + "uid": "0", + "name_map": { + "uid": "root" + } + }, + "process": { + "pid": "515", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "54.254.52.72" + }, + "network": { + "direction": "incoming" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "stXEUmcBTFzn_XoLbd__", + "source": { + "@timestamp": "2018-11-27T01:24:23.339Z", + "auditd": { + "data": { + "terminal": "ssh", + "op": "PAM:bad_ident", + "hostname": "54.254.52.72" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "root" + }, + "object": { + "type": "user-session", + "primary": "ssh", + "secondary": "54.254.52.72" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 192519, + "result": "fail", + "session": "unset" + }, + "event": { + "type": "user_err", + "action": "error", + "module": "auditd", + "category": "user-login" + }, + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + }, + "process": { + "pid": "515", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "54.254.52.72" + }, + "network": { + "direction": "incoming" + }, + "beat": { + "name": "demo-stack-nginx-01", + "hostname": "demo-stack-nginx-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-nginx-01" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "PtXFUmcBTFzn_XoLg_d5", + "source": { + "@timestamp": "2018-11-27T01:25:34.159Z", + "source": { + "ip": "192.240.119.252" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "data": { + "terminal": "ssh", + "hostname": "192.240.119.252", + "op": "PAM:bad_ident" + }, + "summary": { + "object": { + "type": "user-session", + "primary": "ssh", + "secondary": "192.240.119.252" + }, + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "root" + } + }, + "sequence": 44182, + "result": "fail", + "session": "unset" + }, + "event": { + "category": "user-login", + "type": "user_err", + "action": "error", + "module": "auditd" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "beat": { + "name": "demo-stack-es-01", + "hostname": "demo-stack-es-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-es-01" + }, + "process": { + "pid": "29443", + "exe": "/usr/sbin/sshd" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "2NbIUmcBTFzn_XoLSjPA", + "source": { + "@timestamp": "2018-11-27T01:28:36.309Z", + "file": { + "size": 0, + "group": "root", + "path": "/etc/sed8B6Ati", + "ctime": "2018-11-27T01:28:36.306Z", + "uid": 0, + "gid": 0, + "inode": "332", + "mode": "0000", + "owner": "root", + "mtime": "2018-11-27T01:28:36.306Z", + "type": "file" + }, + "beat": { + "name": "demo-stack-es-01", + "hostname": "demo-stack-es-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-es-01" + }, + "hash": { + "sha1": "da39a3ee5e6b4b0d3255bfef95601890afd80709" + }, + "event": { + "module": "file_integrity", + "action": [ + "created" + ] + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "2dbIUmcBTFzn_XoLSjPA", + "source": { + "@timestamp": "2018-11-27T01:28:36.311Z", + "host": { + "name": "demo-stack-es-01" + }, + "event": { + "action": [ + "updated" + ], + "module": "file_integrity" + }, + "file": { + "ctime": "2018-11-27T01:28:36.306Z", + "mtime": "2018-11-27T01:28:36.306Z", + "owner": "root", + "path": "/etc/sed8B6Ati", + "size": 21, + "type": "file", + "uid": 0, + "gid": 0, + "inode": "332", + "mode": "0000", + "group": "root" + }, + "hash": { + "sha1": "302493715263b503309437954b46d73fee714260" + }, + "beat": { + "hostname": "demo-stack-es-01", + "version": "7.0.0-alpha1", + "name": "demo-stack-es-01" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "2tbIUmcBTFzn_XoLSjPA", + "source": { + "@timestamp": "2018-11-27T01:28:36.312Z", + "event": { + "module": "file_integrity", + "action": [ + "updated" + ] + }, + "file": { + "path": "/etc/sed8B6Ati" + }, + "beat": { + "hostname": "demo-stack-es-01", + "version": "7.0.0-alpha1", + "name": "demo-stack-es-01" + }, + "host": { + "name": "demo-stack-es-01" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "29bIUmcBTFzn_XoLSjPA", + "source": { + "@timestamp": "2018-11-27T01:28:36.314Z", + "event": { + "module": "file_integrity", + "action": [ + "moved" + ] + }, + "file": { + "path": "/etc/sed8B6Ati" + }, + "beat": { + "version": "7.0.0-alpha1", + "name": "demo-stack-es-01", + "hostname": "demo-stack-es-01" + }, + "host": { + "name": "demo-stack-es-01" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "3NbIUmcBTFzn_XoLSjPA", + "source": { + "@timestamp": "2018-11-27T01:28:36.315Z", + "host": { + "name": "demo-stack-es-01" + }, + "event": { + "action": [ + "created" + ], + "module": "file_integrity" + }, + "file": { + "size": 420, + "type": "file", + "uid": 0, + "inode": "332", + "ctime": "2018-11-27T01:28:36.306Z", + "mode": "0644", + "path": "/etc/hosts", + "mtime": "2018-11-27T01:28:36.306Z", + "owner": "root", + "gid": 0, + "group": "root" + }, + "hash": { + "sha1": "3ecab8f840eff15248fdb68f4cc7c3d0d9971476" + }, + "beat": { + "version": "7.0.0-alpha1", + "name": "demo-stack-es-01", + "hostname": "demo-stack-es-01" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "3dbIUmcBTFzn_XoLSjPA", + "source": { + "@timestamp": "2018-11-27T01:28:36.410Z", + "event": { + "category": "system-services", + "type": "service_stop", + "action": "stopped-service", + "module": "auditd" + }, + "user": { + "name_map": { + "uid": "root" + }, + "auid": "unset", + "uid": "0" + }, + "process": { + "pid": "1", + "name": "systemd", + "exe": "/lib/systemd/systemd" + }, + "auditd": { + "session": "unset", + "data": { + "unit": "rsyslog" + }, + "summary": { + "object": { + "type": "service", + "primary": "rsyslog" + }, + "how": "/lib/systemd/systemd", + "actor": { + "primary": "unset", + "secondary": "root" + } + }, + "sequence": 44186, + "result": "success" + }, + "beat": { + "name": "demo-stack-es-01", + "hostname": "demo-stack-es-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-es-01" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "3tbIUmcBTFzn_XoLSjPA", + "source": { + "@timestamp": "2018-11-27T01:28:36.470Z", + "process": { + "exe": "/lib/systemd/systemd", + "pid": "1", + "name": "systemd" + }, + "auditd": { + "data": { + "unit": "rsyslog" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "root" + }, + "object": { + "type": "service", + "primary": "rsyslog" + }, + "how": "/lib/systemd/systemd" + }, + "sequence": 44187, + "result": "success", + "session": "unset" + }, + "beat": { + "name": "demo-stack-es-01", + "hostname": "demo-stack-es-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-es-01" + }, + "event": { + "type": "service_start", + "action": "started-service", + "module": "auditd", + "category": "system-services" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "MNbHUmcBTFzn_XoLFxpi", + "source": { + "@timestamp": "2018-11-27T01:27:17.624Z", + "event": { + "action": "logged-in", + "module": "auditd", + "category": "user-login", + "type": "user_login" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "pid": "25765", + "exe": "/usr/sbin/sshd" + }, + "beat": { + "name": "demo-stack-apache-01", + "hostname": "demo-stack-apache-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-apache-01" + }, + "source": { + "ip": "59.124.152.146" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "data": { + "op": "login", + "terminal": "sshd", + "acct": "(unknown user)" + }, + "summary": { + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + }, + "object": { + "primary": "sshd", + "secondary": "59.124.152.146", + "type": "user-session" + } + }, + "sequence": 184353, + "result": "fail", + "session": "unset" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "MdbHUmcBTFzn_XoLFxpi", + "source": { + "@timestamp": "2018-11-27T01:27:17.625Z", + "beat": { + "hostname": "demo-stack-apache-01", + "version": "7.0.0-alpha1", + "name": "demo-stack-apache-01" + }, + "host": { + "name": "demo-stack-apache-01" + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + }, + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + }, + "process": { + "pid": "25765", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "59.124.152.146" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "sequence": 184354, + "result": "fail", + "session": "unset", + "data": { + "op": "login", + "terminal": "sshd", + "acct": "(invalid user)" + }, + "summary": { + "how": "/usr/sbin/sshd", + "actor": { + "secondary": "(invalid user)", + "primary": "unset" + }, + "object": { + "type": "user-session", + "primary": "sshd", + "secondary": "59.124.152.146" + } + } + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "MtbHUmcBTFzn_XoLFxpi", + "source": { + "@timestamp": "2018-11-27T01:27:17.794Z", + "network": { + "direction": "incoming" + }, + "auditd": { + "sequence": 184355, + "result": "fail", + "session": "unset", + "data": { + "hostname": "59.124.152.146", + "terminal": "ssh", + "op": "PAM:bad_ident" + }, + "summary": { + "actor": { + "secondary": "root", + "primary": "unset" + }, + "object": { + "primary": "ssh", + "secondary": "59.124.152.146", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + } + }, + "beat": { + "name": "demo-stack-apache-01", + "hostname": "demo-stack-apache-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-apache-01" + }, + "event": { + "type": "user_err", + "action": "error", + "module": "auditd", + "category": "user-login" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "exe": "/usr/sbin/sshd", + "pid": "25765" + }, + "source": { + "ip": "59.124.152.146" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "M9bHUmcBTFzn_XoLFxqn", + "source": { + "@timestamp": "2018-11-27T01:27:17.693Z", + "network": { + "direction": "incoming" + }, + "beat": { + "name": "demo-stack-nginx-01", + "hostname": "demo-stack-nginx-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-nginx-01" + }, + "auditd": { + "result": "fail", + "session": "unset", + "data": { + "acct": "(unknown user)", + "terminal": "sshd", + "op": "login" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + }, + "object": { + "secondary": "167.99.171.14", + "type": "user-session", + "primary": "sshd" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 192523 + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "pid": "532", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "167.99.171.14" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "NNbHUmcBTFzn_XoLFxqn", + "source": { + "@timestamp": "2018-11-27T01:27:17.695Z", + "source": { + "ip": "167.99.171.14" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "session": "unset", + "data": { + "op": "login", + "terminal": "sshd", + "acct": "(invalid user)" + }, + "summary": { + "object": { + "primary": "sshd", + "secondary": "167.99.171.14", + "type": "user-session" + }, + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + } + }, + "sequence": 192524, + "result": "fail" + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "exe": "/usr/sbin/sshd", + "pid": "532" + }, + "host": { + "name": "demo-stack-nginx-01" + }, + "beat": { + "name": "demo-stack-nginx-01", + "hostname": "demo-stack-nginx-01", + "version": "7.0.0-alpha1" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "NdbHUmcBTFzn_XoLFxqn", + "source": { + "@timestamp": "2018-11-27T01:27:17.735Z", + "host": { + "name": "demo-stack-nginx-01" + }, + "process": { + "exe": "/usr/sbin/sshd", + "pid": "532" + }, + "source": { + "ip": "167.99.171.14" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "sequence": 192525, + "result": "fail", + "session": "unset", + "data": { + "hostname": "167.99.171.14", + "terminal": "ssh", + "op": "PAM:bad_ident" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "root" + }, + "object": { + "secondary": "167.99.171.14", + "type": "user-session", + "primary": "ssh" + }, + "how": "/usr/sbin/sshd" + } + }, + "event": { + "type": "user_err", + "action": "error", + "module": "auditd", + "category": "user-login" + }, + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + }, + "beat": { + "name": "demo-stack-nginx-01", + "hostname": "demo-stack-nginx-01", + "version": "7.0.0-alpha1" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "3dbHUmcBTFzn_XoLPR0X", + "source": { + "@timestamp": "2018-11-27T01:27:27.266Z", + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "pid": "19657", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "139.59.130.2" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "result": "fail", + "session": "unset", + "data": { + "acct": "(unknown user)", + "terminal": "sshd", + "op": "login" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + }, + "object": { + "primary": "sshd", + "secondary": "139.59.130.2", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 142339 + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + }, + "beat": { + "name": "demo-stack-haproxy-01", + "hostname": "demo-stack-haproxy-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-haproxy-01" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "3tbHUmcBTFzn_XoLPR0X", + "source": { + "@timestamp": "2018-11-27T01:27:27.267Z", + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + }, + "user": { + "name_map": { + "uid": "root" + }, + "auid": "unset", + "uid": "0" + }, + "process": { + "pid": "19657", + "exe": "/usr/sbin/sshd" + }, + "beat": { + "hostname": "demo-stack-haproxy-01", + "version": "7.0.0-alpha1", + "name": "demo-stack-haproxy-01" + }, + "host": { + "name": "demo-stack-haproxy-01" + }, + "source": { + "ip": "139.59.130.2" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "data": { + "op": "login", + "terminal": "sshd", + "acct": "(invalid user)" + }, + "summary": { + "object": { + "primary": "sshd", + "secondary": "139.59.130.2", + "type": "user-session" + }, + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + } + }, + "sequence": 142340, + "result": "fail", + "session": "unset" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "39bHUmcBTFzn_XoLPR0X", + "source": { + "@timestamp": "2018-11-27T01:27:27.376Z", + "beat": { + "name": "demo-stack-haproxy-01", + "hostname": "demo-stack-haproxy-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-haproxy-01" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "result": "fail", + "session": "unset", + "data": { + "op": "PAM:bad_ident", + "hostname": "139.59.130.2", + "terminal": "ssh" + }, + "summary": { + "how": "/usr/sbin/sshd", + "actor": { + "secondary": "root", + "primary": "unset" + }, + "object": { + "primary": "ssh", + "secondary": "139.59.130.2", + "type": "user-session" + } + }, + "sequence": 142341 + }, + "event": { + "category": "user-login", + "type": "user_err", + "action": "error", + "module": "auditd" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "pid": "19657", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "139.59.130.2" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "mNbIUmcBTFzn_XoLFi9i", + "source": { + "@timestamp": "2018-11-27T01:28:22.881Z", + "beat": { + "hostname": "demo-stack-apache-01", + "version": "7.0.0-alpha1", + "name": "demo-stack-apache-01" + }, + "host": { + "name": "demo-stack-apache-01" + }, + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + }, + "process": { + "pid": "25773", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "37.139.20.56" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "data": { + "acct": "(unknown user)", + "op": "login", + "terminal": "sshd" + }, + "summary": { + "object": { + "type": "user-session", + "primary": "sshd", + "secondary": "37.139.20.56" + }, + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + } + }, + "sequence": 184356, + "result": "fail", + "session": "unset" + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "mdbIUmcBTFzn_XoLFi9i", + "source": { + "@timestamp": "2018-11-27T01:28:22.883Z", + "auditd": { + "result": "fail", + "session": "unset", + "data": { + "terminal": "sshd", + "acct": "(invalid user)", + "op": "login" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + }, + "object": { + "primary": "sshd", + "secondary": "37.139.20.56", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 184357 + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + }, + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + }, + "process": { + "pid": "25773", + "exe": "/usr/sbin/sshd" + }, + "beat": { + "name": "demo-stack-apache-01", + "hostname": "demo-stack-apache-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-apache-01" + }, + "source": { + "ip": "37.139.20.56" + }, + "network": { + "direction": "incoming" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "mtbIUmcBTFzn_XoLFi9i", + "source": { + "@timestamp": "2018-11-27T01:28:22.989Z", + "source": { + "ip": "37.139.20.56" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "session": "unset", + "data": { + "hostname": "37.139.20.56", + "terminal": "ssh", + "op": "PAM:bad_ident" + }, + "summary": { + "how": "/usr/sbin/sshd", + "actor": { + "secondary": "root", + "primary": "unset" + }, + "object": { + "type": "user-session", + "primary": "ssh", + "secondary": "37.139.20.56" + } + }, + "sequence": 184358, + "result": "fail" + }, + "beat": { + "name": "demo-stack-apache-01", + "hostname": "demo-stack-apache-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-apache-01" + }, + "event": { + "action": "error", + "module": "auditd", + "category": "user-login", + "type": "user_err" + }, + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + }, + "process": { + "pid": "25773", + "exe": "/usr/sbin/sshd" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "0NbHUmcBTFzn_XoL7Stw", + "source": { + "@timestamp": "2018-11-27T01:28:12.420Z", + "event": { + "type": "user_login", + "action": "logged-in", + "module": "auditd", + "category": "user-login" + }, + "user": { + "auid": "unset", + "uid": "0", + "name_map": { + "uid": "root" + } + }, + "process": { + "pid": "32287", + "exe": "/usr/sbin/sshd" + }, + "beat": { + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-redis-01" + }, + "source": { + "ip": "107.170.65.109" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "session": "unset", + "data": { + "op": "login", + "terminal": "sshd", + "acct": "(unknown user)" + }, + "summary": { + "object": { + "primary": "sshd", + "secondary": "107.170.65.109", + "type": "user-session" + }, + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + } + }, + "sequence": 186428, + "result": "fail" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "0dbHUmcBTFzn_XoL7Stw", + "source": { + "@timestamp": "2018-11-27T01:28:12.422Z", + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "pid": "32287", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "107.170.65.109" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "session": "unset", + "data": { + "terminal": "sshd", + "op": "login", + "acct": "(invalid user)" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + }, + "object": { + "primary": "sshd", + "secondary": "107.170.65.109", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 186429, + "result": "fail" + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + }, + "beat": { + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-redis-01" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "0tbHUmcBTFzn_XoL7Stw", + "source": { + "@timestamp": "2018-11-27T01:28:12.453Z", + "source": { + "ip": "107.170.65.109" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "data": { + "terminal": "ssh", + "op": "PAM:bad_ident", + "hostname": "107.170.65.109" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "root" + }, + "object": { + "secondary": "107.170.65.109", + "type": "user-session", + "primary": "ssh" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 186430, + "result": "fail", + "session": "unset" + }, + "event": { + "category": "user-login", + "type": "user_err", + "action": "error", + "module": "auditd" + }, + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + }, + "beat": { + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-redis-01" + }, + "process": { + "exe": "/usr/sbin/sshd", + "pid": "32287" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "ItbIUmcBTFzn_XoLqjzc", + "source": { + "@timestamp": "2018-11-27T01:29:00.914Z", + "process": { + "pid": "545", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "209.97.173.192" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "result": "fail", + "session": "unset", + "data": { + "op": "login", + "terminal": "sshd", + "acct": "(unknown user)" + }, + "summary": { + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + }, + "object": { + "secondary": "209.97.173.192", + "type": "user-session", + "primary": "sshd" + } + }, + "sequence": 192526 + }, + "beat": { + "name": "demo-stack-nginx-01", + "hostname": "demo-stack-nginx-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-nginx-01" + }, + "event": { + "module": "auditd", + "category": "user-login", + "type": "user_login", + "action": "logged-in" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "I9bIUmcBTFzn_XoLqjzc", + "source": { + "@timestamp": "2018-11-27T01:29:00.915Z", + "beat": { + "name": "demo-stack-nginx-01", + "hostname": "demo-stack-nginx-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-nginx-01" + }, + "event": { + "module": "auditd", + "category": "user-login", + "type": "user_login", + "action": "logged-in" + }, + "user": { + "auid": "unset", + "uid": "0", + "name_map": { + "uid": "root" + } + }, + "process": { + "exe": "/usr/sbin/sshd", + "pid": "545" + }, + "source": { + "ip": "209.97.173.192" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "summary": { + "object": { + "type": "user-session", + "primary": "sshd", + "secondary": "209.97.173.192" + }, + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + } + }, + "sequence": 192527, + "result": "fail", + "session": "unset", + "data": { + "op": "login", + "acct": "(invalid user)", + "terminal": "sshd" + } + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "JNbIUmcBTFzn_XoLqjzc", + "source": { + "@timestamp": "2018-11-27T01:29:01.108Z", + "host": { + "name": "demo-stack-nginx-01" + }, + "event": { + "action": "error", + "module": "auditd", + "category": "user-login", + "type": "user_err" + }, + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + }, + "process": { + "pid": "545", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "209.97.173.192" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "sequence": 192528, + "result": "fail", + "session": "unset", + "data": { + "op": "PAM:bad_ident", + "terminal": "ssh", + "hostname": "209.97.173.192" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "root" + }, + "object": { + "primary": "ssh", + "secondary": "209.97.173.192", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + } + }, + "beat": { + "name": "demo-stack-nginx-01", + "hostname": "demo-stack-nginx-01", + "version": "7.0.0-alpha1" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "ONbGUmcBTFzn_XoL2xQn", + "source": { + "@timestamp": "2018-11-27T01:27:02.205Z", + "event": { + "action": "logged-in", + "module": "auditd", + "category": "user-login", + "type": "user_login" + }, + "beat": { + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-redis-01" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "pid": "32279", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "107.170.65.109" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "session": "unset", + "data": { + "op": "login", + "acct": "(unknown user)", + "terminal": "sshd" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + }, + "object": { + "primary": "sshd", + "secondary": "107.170.65.109", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 186425, + "result": "fail" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "OdbGUmcBTFzn_XoL2xQn", + "source": { + "@timestamp": "2018-11-27T01:27:02.206Z", + "source": { + "ip": "107.170.65.109" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "session": "unset", + "data": { + "op": "login", + "acct": "(invalid user)", + "terminal": "sshd" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + }, + "object": { + "primary": "sshd", + "secondary": "107.170.65.109", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 186426, + "result": "fail" + }, + "host": { + "name": "demo-stack-redis-01" + }, + "beat": { + "version": "7.0.0-alpha1", + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01" + }, + "event": { + "module": "auditd", + "category": "user-login", + "type": "user_login", + "action": "logged-in" + }, + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + }, + "process": { + "pid": "32279", + "exe": "/usr/sbin/sshd" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "OtbGUmcBTFzn_XoL2xQn", + "source": { + "@timestamp": "2018-11-27T01:27:02.238Z", + "event": { + "category": "user-login", + "type": "user_err", + "action": "error", + "module": "auditd" + }, + "user": { + "name_map": { + "uid": "root" + }, + "auid": "unset", + "uid": "0" + }, + "process": { + "pid": "32279", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "107.170.65.109" + }, + "network": { + "direction": "incoming" + }, + "beat": { + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-redis-01" + }, + "auditd": { + "result": "fail", + "session": "unset", + "data": { + "op": "PAM:bad_ident", + "hostname": "107.170.65.109", + "terminal": "ssh" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "root" + }, + "object": { + "secondary": "107.170.65.109", + "type": "user-session", + "primary": "ssh" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 186427 + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "ltbHUmcBTFzn_XoLWR9W", + "source": { + "@timestamp": "2018-11-27T01:27:34.501Z", + "event": { + "action": "logged-in", + "module": "auditd", + "category": "user-login", + "type": "user_login" + }, + "user": { + "name_map": { + "uid": "root" + }, + "uid": "0", + "auid": "unset" + }, + "process": { + "exe": "/usr/sbin/sshd", + "pid": "29478" + }, + "beat": { + "name": "demo-stack-es-01", + "hostname": "demo-stack-es-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-es-01" + }, + "source": { + "ip": "46.105.89.195" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "summary": { + "object": { + "type": "user-session", + "primary": "sshd", + "secondary": "46.105.89.195" + }, + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + } + }, + "sequence": 44183, + "result": "fail", + "session": "unset", + "data": { + "op": "login", + "terminal": "sshd", + "acct": "(unknown user)" + } + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "l9bHUmcBTFzn_XoLWR9W", + "source": { + "@timestamp": "2018-11-27T01:27:34.501Z", + "network": { + "direction": "incoming" + }, + "auditd": { + "result": "fail", + "session": "unset", + "data": { + "acct": "(invalid user)", + "terminal": "sshd", + "op": "login" + }, + "summary": { + "actor": { + "secondary": "(invalid user)", + "primary": "unset" + }, + "object": { + "secondary": "46.105.89.195", + "type": "user-session", + "primary": "sshd" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 44184 + }, + "event": { + "module": "auditd", + "category": "user-login", + "type": "user_login", + "action": "logged-in" + }, + "beat": { + "version": "7.0.0-alpha1", + "name": "demo-stack-es-01", + "hostname": "demo-stack-es-01" + }, + "host": { + "name": "demo-stack-es-01" + }, + "user": { + "name_map": { + "uid": "root" + }, + "uid": "0", + "auid": "unset" + }, + "process": { + "pid": "29478", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "46.105.89.195" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "mNbHUmcBTFzn_XoLWR9W", + "source": { + "@timestamp": "2018-11-27T01:27:34.613Z", + "auditd": { + "session": "unset", + "data": { + "hostname": "46.105.89.195", + "terminal": "ssh", + "op": "PAM:bad_ident" + }, + "summary": { + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "root" + }, + "object": { + "primary": "ssh", + "secondary": "46.105.89.195", + "type": "user-session" + } + }, + "sequence": 44185, + "result": "fail" + }, + "event": { + "type": "user_err", + "action": "error", + "module": "auditd", + "category": "user-login" + }, + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + }, + "host": { + "name": "demo-stack-es-01" + }, + "beat": { + "name": "demo-stack-es-01", + "hostname": "demo-stack-es-01", + "version": "7.0.0-alpha1" + }, + "process": { + "exe": "/usr/sbin/sshd", + "pid": "29478" + }, + "source": { + "ip": "46.105.89.195" + }, + "network": { + "direction": "incoming" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "QtbIUmcBTFzn_XoLVjVA", + "source": { + "@timestamp": "2018-11-27T01:28:39.253Z", + "beat": { + "hostname": "demo-stack-mysql-01", + "version": "7.0.0-alpha1", + "name": "demo-stack-mysql-01" + }, + "host": { + "name": "demo-stack-mysql-01" + }, + "auditd": { + "sequence": 43170, + "result": "fail", + "session": "unset", + "data": { + "terminal": "sshd", + "op": "login", + "acct": "(unknown user)" + }, + "summary": { + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + }, + "object": { + "primary": "sshd", + "secondary": "51.255.34.233", + "type": "user-session" + } + } + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "exe": "/usr/sbin/sshd", + "pid": "12716" + }, + "source": { + "ip": "51.255.34.233" + }, + "network": { + "direction": "incoming" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "Q9bIUmcBTFzn_XoLVjVA", + "source": { + "@timestamp": "2018-11-27T01:28:39.253Z", + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + }, + "process": { + "exe": "/usr/sbin/sshd", + "pid": "12716" + }, + "source": { + "ip": "51.255.34.233" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "result": "fail", + "session": "unset", + "data": { + "acct": "(invalid user)", + "op": "login", + "terminal": "sshd" + }, + "summary": { + "object": { + "primary": "sshd", + "secondary": "51.255.34.233", + "type": "user-session" + }, + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + } + }, + "sequence": 43171 + }, + "beat": { + "name": "demo-stack-mysql-01", + "hostname": "demo-stack-mysql-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-mysql-01" + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "RNbIUmcBTFzn_XoLVjVA", + "source": { + "@timestamp": "2018-11-27T01:28:39.361Z", + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "pid": "12716", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "51.255.34.233" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "summary": { + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "root" + }, + "object": { + "primary": "ssh", + "secondary": "51.255.34.233", + "type": "user-session" + } + }, + "sequence": 43172, + "result": "fail", + "session": "unset", + "data": { + "hostname": "51.255.34.233", + "terminal": "ssh", + "op": "PAM:bad_ident" + } + }, + "beat": { + "name": "demo-stack-mysql-01", + "hostname": "demo-stack-mysql-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-mysql-01" + }, + "event": { + "action": "error", + "module": "auditd", + "category": "user-login", + "type": "user_err" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "8tfRUmcBTFzn_XoL1ASG", + "source": { + "@timestamp": "2018-11-27T01:39:01.401Z", + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "exe": "/usr/sbin/sshd", + "pid": "12782" + }, + "source": { + "ip": "138.68.150.115" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "data": { + "hostname": "138.68.150.115", + "terminal": "ssh", + "op": "PAM:bad_ident" + }, + "summary": { + "object": { + "primary": "ssh", + "secondary": "138.68.150.115", + "type": "user-session" + }, + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "root" + } + }, + "sequence": 43186, + "result": "fail", + "session": "unset" + }, + "beat": { + "version": "7.0.0-alpha1", + "name": "demo-stack-mysql-01", + "hostname": "demo-stack-mysql-01" + }, + "host": { + "name": "demo-stack-mysql-01" + }, + "event": { + "category": "user-login", + "type": "user_err", + "action": "error", + "module": "auditd" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "S9fRUmcBTFzn_XoL1gUs", + "source": { + "@timestamp": "2018-11-27T01:39:01.825Z", + "process": { + "pid": "25839", + "exe": "/usr/sbin/cron" + }, + "beat": { + "version": "7.0.0-alpha1", + "name": "demo-stack-apache-01", + "hostname": "demo-stack-apache-01" + }, + "host": { + "name": "demo-stack-apache-01" + }, + "auditd": { + "sequence": 184368, + "result": "success", + "session": "unset", + "data": { + "op": "PAM:accounting", + "acct": "root", + "terminal": "cron" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "root" + }, + "object": { + "primary": "cron", + "type": "user-session" + }, + "how": "/usr/sbin/cron" + } + }, + "event": { + "type": "user_acct", + "action": "was-authorized", + "module": "auditd", + "category": "user-login" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "TNfRUmcBTFzn_XoL1gUs", + "source": { + "@timestamp": "2018-11-27T01:39:01.826Z", + "auditd": { + "session": "unset", + "data": { + "terminal": "cron", + "acct": "root", + "op": "PAM:setcred" + }, + "summary": { + "actor": { + "secondary": "root", + "primary": "unset" + }, + "object": { + "primary": "cron", + "type": "user-session" + }, + "how": "/usr/sbin/cron" + }, + "sequence": 184369, + "result": "success" + }, + "event": { + "type": "cred_acq", + "action": "acquired-credentials", + "module": "auditd", + "category": "user-login" + }, + "user": { + "name_map": { + "uid": "root" + }, + "auid": "unset", + "uid": "0" + }, + "process": { + "exe": "/usr/sbin/cron", + "pid": "25839" + }, + "beat": { + "name": "demo-stack-apache-01", + "hostname": "demo-stack-apache-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-apache-01" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "TdfRUmcBTFzn_XoL1gUs", + "source": { + "@timestamp": "2018-11-27T01:39:01.828Z", + "event": { + "module": "auditd", + "category": "user-login", + "type": "user_start", + "action": "started-session" + }, + "user": { + "auid": "0", + "name_map": { + "auid": "root", + "uid": "root" + }, + "uid": "0" + }, + "process": { + "pid": "25839", + "exe": "/usr/sbin/cron" + }, + "auditd": { + "sequence": 184371, + "result": "success", + "session": "9859", + "data": { + "acct": "root", + "terminal": "cron", + "op": "PAM:session_open" + }, + "summary": { + "actor": { + "primary": "root", + "secondary": "root" + }, + "object": { + "primary": "cron", + "type": "user-session" + }, + "how": "/usr/sbin/cron" + } + }, + "beat": { + "name": "demo-stack-apache-01", + "hostname": "demo-stack-apache-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-apache-01" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "TtfRUmcBTFzn_XoL1gUs", + "source": { + "@timestamp": "2018-11-27T01:39:01.923Z", + "user": { + "uid": "0", + "name_map": { + "auid": "root", + "uid": "root" + }, + "auid": "0" + }, + "process": { + "exe": "/usr/sbin/cron", + "pid": "25839" + }, + "auditd": { + "sequence": 184372, + "result": "success", + "session": "9859", + "data": { + "acct": "root", + "terminal": "cron", + "op": "PAM:setcred" + }, + "summary": { + "actor": { + "primary": "root", + "secondary": "root" + }, + "object": { + "primary": "cron", + "type": "user-session" + }, + "how": "/usr/sbin/cron" + } + }, + "beat": { + "name": "demo-stack-apache-01", + "hostname": "demo-stack-apache-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-apache-01" + }, + "event": { + "module": "auditd", + "category": "user-login", + "type": "cred_disp", + "action": "disposed-credentials" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "T9fRUmcBTFzn_XoL1gUs", + "source": { + "@timestamp": "2018-11-27T01:39:01.924Z", + "process": { + "pid": "25839", + "exe": "/usr/sbin/cron" + }, + "auditd": { + "sequence": 184373, + "result": "success", + "session": "9859", + "data": { + "acct": "root", + "op": "PAM:session_close", + "terminal": "cron" + }, + "summary": { + "actor": { + "secondary": "root", + "primary": "root" + }, + "object": { + "primary": "cron", + "type": "user-session" + }, + "how": "/usr/sbin/cron" + } + }, + "event": { + "category": "user-login", + "type": "user_end", + "action": "ended-session", + "module": "auditd" + }, + "user": { + "auid": "0", + "name_map": { + "auid": "root", + "uid": "root" + }, + "uid": "0" + }, + "beat": { + "name": "demo-stack-apache-01", + "hostname": "demo-stack-apache-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-apache-01" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "UdfRUmcBTFzn_XoL1gXc", + "source": { + "@timestamp": "2018-11-27T01:39:02.001Z", + "beat": { + "name": "demo-stack-nginx-01", + "hostname": "demo-stack-nginx-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-nginx-01" + }, + "event": { + "module": "auditd", + "category": "user-login", + "type": "user_acct", + "action": "was-authorized" + }, + "user": { + "name_map": { + "uid": "root" + }, + "auid": "unset", + "uid": "0" + }, + "process": { + "exe": "/usr/sbin/cron", + "pid": "608" + }, + "auditd": { + "sequence": 192547, + "result": "success", + "session": "unset", + "data": { + "acct": "root", + "op": "PAM:accounting", + "terminal": "cron" + }, + "summary": { + "object": { + "primary": "cron", + "type": "user-session" + }, + "how": "/usr/sbin/cron", + "actor": { + "secondary": "root", + "primary": "unset" + } + } + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "UtfRUmcBTFzn_XoL1gXc", + "source": { + "@timestamp": "2018-11-27T01:39:02.001Z", + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + }, + "process": { + "exe": "/usr/sbin/cron", + "pid": "608" + }, + "auditd": { + "sequence": 192548, + "result": "success", + "session": "unset", + "data": { + "op": "PAM:setcred", + "terminal": "cron", + "acct": "root" + }, + "summary": { + "object": { + "primary": "cron", + "type": "user-session" + }, + "how": "/usr/sbin/cron", + "actor": { + "primary": "unset", + "secondary": "root" + } + } + }, + "beat": { + "name": "demo-stack-nginx-01", + "hostname": "demo-stack-nginx-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-nginx-01" + }, + "event": { + "action": "acquired-credentials", + "module": "auditd", + "category": "user-login", + "type": "cred_acq" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "U9fRUmcBTFzn_XoL1gXc", + "source": { + "@timestamp": "2018-11-27T01:39:02.003Z", + "auditd": { + "result": "success", + "session": "9863", + "data": { + "terminal": "cron", + "op": "PAM:session_open", + "acct": "root" + }, + "summary": { + "object": { + "primary": "cron", + "type": "user-session" + }, + "how": "/usr/sbin/cron", + "actor": { + "primary": "root", + "secondary": "root" + } + }, + "sequence": 192550 + }, + "event": { + "action": "started-session", + "module": "auditd", + "category": "user-login", + "type": "user_start" + }, + "user": { + "uid": "0", + "name_map": { + "auid": "root", + "uid": "root" + }, + "auid": "0" + }, + "beat": { + "name": "demo-stack-nginx-01", + "hostname": "demo-stack-nginx-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-nginx-01" + }, + "process": { + "exe": "/usr/sbin/cron", + "pid": "608" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "VNfRUmcBTFzn_XoL1gXc", + "source": { + "@timestamp": "2018-11-27T01:39:02.100Z", + "process": { + "pid": "608", + "exe": "/usr/sbin/cron" + }, + "auditd": { + "result": "success", + "session": "9863", + "data": { + "op": "PAM:setcred", + "acct": "root", + "terminal": "cron" + }, + "summary": { + "actor": { + "primary": "root", + "secondary": "root" + }, + "object": { + "primary": "cron", + "type": "user-session" + }, + "how": "/usr/sbin/cron" + }, + "sequence": 192551 + }, + "beat": { + "name": "demo-stack-nginx-01", + "hostname": "demo-stack-nginx-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-nginx-01" + }, + "event": { + "action": "disposed-credentials", + "module": "auditd", + "category": "user-login", + "type": "cred_disp" + }, + "user": { + "name_map": { + "auid": "root", + "uid": "root" + }, + "auid": "0", + "uid": "0" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "VdfRUmcBTFzn_XoL1gXc", + "source": { + "@timestamp": "2018-11-27T01:39:02.101Z", + "beat": { + "name": "demo-stack-nginx-01", + "hostname": "demo-stack-nginx-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-nginx-01" + }, + "user": { + "auid": "0", + "name_map": { + "auid": "root", + "uid": "root" + }, + "uid": "0" + }, + "process": { + "pid": "608", + "exe": "/usr/sbin/cron" + }, + "auditd": { + "sequence": 192552, + "result": "success", + "session": "9863", + "data": { + "op": "PAM:session_close", + "terminal": "cron", + "acct": "root" + }, + "summary": { + "actor": { + "primary": "root", + "secondary": "root" + }, + "object": { + "primary": "cron", + "type": "user-session" + }, + "how": "/usr/sbin/cron" + } + }, + "event": { + "category": "user-login", + "type": "user_end", + "action": "ended-session", + "module": "auditd" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "KdbRUmcBTFzn_XoLPPiy", + "source": { + "@timestamp": "2018-11-27T01:38:22.535Z", + "user": { + "auid": "unset", + "uid": "0", + "name_map": { + "uid": "root" + } + }, + "process": { + "exe": "/usr/sbin/sshd", + "pid": "19718" + }, + "source": { + "ip": "207.154.201.218" + }, + "network": { + "direction": "incoming" + }, + "beat": { + "hostname": "demo-stack-haproxy-01", + "version": "7.0.0-alpha1", + "name": "demo-stack-haproxy-01" + }, + "host": { + "name": "demo-stack-haproxy-01" + }, + "auditd": { + "sequence": 142346, + "result": "fail", + "session": "unset", + "data": { + "terminal": "sshd", + "acct": "(unknown user)", + "op": "login" + }, + "summary": { + "object": { + "type": "user-session", + "primary": "sshd", + "secondary": "207.154.201.218" + }, + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + } + } + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "KtbRUmcBTFzn_XoLPPiy", + "source": { + "@timestamp": "2018-11-27T01:38:22.537Z", + "process": { + "pid": "19718", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "207.154.201.218" + }, + "beat": { + "hostname": "demo-stack-haproxy-01", + "version": "7.0.0-alpha1", + "name": "demo-stack-haproxy-01" + }, + "host": { + "name": "demo-stack-haproxy-01" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "sequence": 142347, + "result": "fail", + "session": "unset", + "data": { + "terminal": "sshd", + "acct": "(invalid user)", + "op": "login" + }, + "summary": { + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + }, + "object": { + "primary": "sshd", + "secondary": "207.154.201.218", + "type": "user-session" + } + } + }, + "event": { + "type": "user_login", + "action": "logged-in", + "module": "auditd", + "category": "user-login" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "K9bRUmcBTFzn_XoLPPiy", + "source": { + "@timestamp": "2018-11-27T01:38:22.645Z", + "process": { + "exe": "/usr/sbin/sshd", + "pid": "19718" + }, + "source": { + "ip": "207.154.201.218" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "sequence": 142348, + "result": "fail", + "session": "unset", + "data": { + "terminal": "ssh", + "op": "PAM:bad_ident", + "hostname": "207.154.201.218" + }, + "summary": { + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "root" + }, + "object": { + "primary": "ssh", + "secondary": "207.154.201.218", + "type": "user-session" + } + } + }, + "event": { + "category": "user-login", + "type": "user_err", + "action": "error", + "module": "auditd" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "beat": { + "name": "demo-stack-haproxy-01", + "hostname": "demo-stack-haproxy-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-haproxy-01" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "GdfTUmcBTFzn_XoLdSoA", + "source": { + "@timestamp": "2018-11-27T01:40:48.022Z", + "beat": { + "name": "demo-stack-haproxy-01", + "hostname": "demo-stack-haproxy-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-haproxy-01" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "pid": "19732", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "188.226.187.115" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "session": "unset", + "data": { + "op": "login", + "terminal": "sshd", + "acct": "(unknown user)" + }, + "summary": { + "actor": { + "secondary": "(unknown user)", + "primary": "unset" + }, + "object": { + "primary": "sshd", + "secondary": "188.226.187.115", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 142349, + "result": "fail" + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "GtfTUmcBTFzn_XoLdSoA", + "source": { + "@timestamp": "2018-11-27T01:40:48.024Z", + "host": { + "name": "demo-stack-haproxy-01" + }, + "auditd": { + "sequence": 142350, + "result": "fail", + "session": "unset", + "data": { + "acct": "(invalid user)", + "terminal": "sshd", + "op": "login" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + }, + "object": { + "primary": "sshd", + "secondary": "188.226.187.115", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + } + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + }, + "user": { + "auid": "unset", + "uid": "0", + "name_map": { + "uid": "root" + } + }, + "process": { + "pid": "19732", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "188.226.187.115" + }, + "network": { + "direction": "incoming" + }, + "beat": { + "name": "demo-stack-haproxy-01", + "hostname": "demo-stack-haproxy-01", + "version": "7.0.0-alpha1" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "G9fTUmcBTFzn_XoLdSoA", + "source": { + "@timestamp": "2018-11-27T01:40:48.126Z", + "source": { + "ip": "188.226.187.115" + }, + "host": { + "name": "demo-stack-haproxy-01" + }, + "beat": { + "name": "demo-stack-haproxy-01", + "hostname": "demo-stack-haproxy-01", + "version": "7.0.0-alpha1" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "session": "unset", + "data": { + "terminal": "ssh", + "op": "PAM:bad_ident", + "hostname": "188.226.187.115" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "root" + }, + "object": { + "primary": "ssh", + "secondary": "188.226.187.115", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 142351, + "result": "fail" + }, + "event": { + "category": "user-login", + "type": "user_err", + "action": "error", + "module": "auditd" + }, + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + }, + "process": { + "pid": "19732", + "exe": "/usr/sbin/sshd" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "jdfTUmcBTFzn_XoLsi5i", + "source": { + "@timestamp": "2018-11-27T01:41:03.736Z", + "beat": { + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1" + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + }, + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + }, + "process": { + "exe": "/usr/sbin/sshd", + "pid": "32370" + }, + "source": { + "ip": "82.200.205.71" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "session": "unset", + "data": { + "op": "login", + "terminal": "sshd", + "acct": "(unknown user)" + }, + "summary": { + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + }, + "object": { + "secondary": "82.200.205.71", + "type": "user-session", + "primary": "sshd" + } + }, + "sequence": 186473, + "result": "fail" + }, + "host": { + "name": "demo-stack-redis-01" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "jtfTUmcBTFzn_XoLsi5i", + "source": { + "@timestamp": "2018-11-27T01:41:03.737Z", + "source": { + "ip": "82.200.205.71" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "session": "unset", + "data": { + "terminal": "sshd", + "acct": "(invalid user)", + "op": "login" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + }, + "object": { + "type": "user-session", + "primary": "sshd", + "secondary": "82.200.205.71" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 186474, + "result": "fail" + }, + "beat": { + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-redis-01" + }, + "event": { + "type": "user_login", + "action": "logged-in", + "module": "auditd", + "category": "user-login" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "pid": "32370", + "exe": "/usr/sbin/sshd" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "j9fTUmcBTFzn_XoLsi5i", + "source": { + "@timestamp": "2018-11-27T01:41:03.993Z", + "auditd": { + "data": { + "op": "PAM:bad_ident", + "terminal": "ssh", + "hostname": "82.200.205.71" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "root" + }, + "object": { + "type": "user-session", + "primary": "ssh", + "secondary": "82.200.205.71" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 186475, + "result": "fail", + "session": "unset" + }, + "event": { + "module": "auditd", + "category": "user-login", + "type": "user_err", + "action": "error" + }, + "beat": { + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1", + "name": "demo-stack-redis-01" + }, + "host": { + "name": "demo-stack-redis-01" + }, + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + }, + "process": { + "pid": "32370", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "82.200.205.71" + }, + "network": { + "direction": "incoming" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "a9bRUmcBTFzn_XoLcPxx", + "source": { + "@timestamp": "2018-11-27T01:38:35.782Z", + "auditd": { + "result": "fail", + "session": "unset", + "data": { + "acct": "(unknown user)", + "terminal": "sshd", + "op": "login" + }, + "summary": { + "object": { + "secondary": "107.170.65.109", + "type": "user-session", + "primary": "sshd" + }, + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + } + }, + "sequence": 186464 + }, + "beat": { + "version": "7.0.0-alpha1", + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01" + }, + "host": { + "name": "demo-stack-redis-01" + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + }, + "user": { + "name_map": { + "uid": "root" + }, + "uid": "0", + "auid": "unset" + }, + "process": { + "pid": "32356", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "107.170.65.109" + }, + "network": { + "direction": "incoming" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "bNbRUmcBTFzn_XoLcPxx", + "source": { + "@timestamp": "2018-11-27T01:38:35.783Z", + "process": { + "exe": "/usr/sbin/sshd", + "pid": "32356" + }, + "source": { + "ip": "107.170.65.109" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "result": "fail", + "session": "unset", + "data": { + "terminal": "sshd", + "acct": "(invalid user)", + "op": "login" + }, + "summary": { + "object": { + "primary": "sshd", + "secondary": "107.170.65.109", + "type": "user-session" + }, + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + } + }, + "sequence": 186465 + }, + "beat": { + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-redis-01" + }, + "event": { + "type": "user_login", + "action": "logged-in", + "module": "auditd", + "category": "user-login" + }, + "user": { + "name_map": { + "uid": "root" + }, + "auid": "unset", + "uid": "0" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "bdbRUmcBTFzn_XoLcPxx", + "source": { + "@timestamp": "2018-11-27T01:38:35.814Z", + "beat": { + "version": "7.0.0-alpha1", + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01" + }, + "host": { + "name": "demo-stack-redis-01" + }, + "event": { + "action": "error", + "module": "auditd", + "category": "user-login", + "type": "user_err" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "pid": "32356", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "107.170.65.109" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "data": { + "terminal": "ssh", + "op": "PAM:bad_ident", + "hostname": "107.170.65.109" + }, + "summary": { + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "root" + }, + "object": { + "primary": "ssh", + "secondary": "107.170.65.109", + "type": "user-session" + } + }, + "sequence": 186466, + "result": "fail", + "session": "unset" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "2dfSUmcBTFzn_XoLXhCA", + "source": { + "@timestamp": "2018-11-27T01:39:36.720Z", + "auditd": { + "sequence": 43187, + "result": "fail", + "session": "unset", + "data": { + "acct": "(unknown user)", + "terminal": "sshd", + "op": "login" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + }, + "object": { + "secondary": "89.221.217.8", + "type": "user-session", + "primary": "sshd" + }, + "how": "/usr/sbin/sshd" + } + }, + "host": { + "name": "demo-stack-mysql-01" + }, + "beat": { + "name": "demo-stack-mysql-01", + "hostname": "demo-stack-mysql-01", + "version": "7.0.0-alpha1" + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + }, + "user": { + "auid": "unset", + "uid": "0", + "name_map": { + "uid": "root" + } + }, + "process": { + "pid": "12790", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "89.221.217.8" + }, + "network": { + "direction": "incoming" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "2tfSUmcBTFzn_XoLXhCA", + "source": { + "@timestamp": "2018-11-27T01:39:36.724Z", + "source": { + "ip": "89.221.217.8" + }, + "beat": { + "name": "demo-stack-mysql-01", + "hostname": "demo-stack-mysql-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-mysql-01" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "sequence": 43188, + "result": "fail", + "session": "unset", + "data": { + "terminal": "sshd", + "acct": "(invalid user)", + "op": "login" + }, + "summary": { + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + }, + "object": { + "secondary": "89.221.217.8", + "type": "user-session", + "primary": "sshd" + } + } + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + }, + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + }, + "process": { + "pid": "12790", + "exe": "/usr/sbin/sshd" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "29fSUmcBTFzn_XoLXhCA", + "source": { + "@timestamp": "2018-11-27T01:39:36.852Z", + "network": { + "direction": "incoming" + }, + "auditd": { + "session": "unset", + "data": { + "hostname": "89.221.217.8", + "op": "PAM:bad_ident", + "terminal": "ssh" + }, + "summary": { + "actor": { + "secondary": "root", + "primary": "unset" + }, + "object": { + "primary": "ssh", + "secondary": "89.221.217.8", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 43189, + "result": "fail" + }, + "event": { + "type": "user_err", + "action": "error", + "module": "auditd", + "category": "user-login" + }, + "user": { + "uid": "0", + "auid": "unset", + "name_map": { + "uid": "root" + } + }, + "process": { + "pid": "12790", + "exe": "/usr/sbin/sshd" + }, + "beat": { + "version": "7.0.0-alpha1", + "name": "demo-stack-mysql-01", + "hostname": "demo-stack-mysql-01" + }, + "host": { + "name": "demo-stack-mysql-01" + }, + "source": { + "ip": "89.221.217.8" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "adfSUmcBTFzn_XoLgRS2", + "source": { + "@timestamp": "2018-11-27T01:39:45.740Z", + "event": { + "module": "auditd", + "category": "user-login", + "type": "user_login", + "action": "logged-in" + }, + "user": { + "name_map": { + "uid": "root" + }, + "uid": "0", + "auid": "unset" + }, + "process": { + "pid": "32360", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "107.170.65.109" + }, + "network": { + "direction": "incoming" + }, + "host": { + "name": "demo-stack-redis-01" + }, + "beat": { + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1" + }, + "auditd": { + "sequence": 186467, + "result": "fail", + "session": "unset", + "data": { + "op": "login", + "acct": "(unknown user)", + "terminal": "sshd" + }, + "summary": { + "actor": { + "secondary": "(unknown user)", + "primary": "unset" + }, + "object": { + "primary": "sshd", + "secondary": "107.170.65.109", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + } + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "atfSUmcBTFzn_XoLgRS2", + "source": { + "@timestamp": "2018-11-27T01:39:45.741Z", + "process": { + "pid": "32360", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "107.170.65.109" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "sequence": 186468, + "result": "fail", + "session": "unset", + "data": { + "op": "login", + "terminal": "sshd", + "acct": "(invalid user)" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + }, + "object": { + "primary": "sshd", + "secondary": "107.170.65.109", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + } + }, + "event": { + "action": "logged-in", + "module": "auditd", + "category": "user-login", + "type": "user_login" + }, + "host": { + "name": "demo-stack-redis-01" + }, + "beat": { + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "a9fSUmcBTFzn_XoLgRS2", + "source": { + "@timestamp": "2018-11-27T01:39:45.771Z", + "network": { + "direction": "incoming" + }, + "auditd": { + "session": "unset", + "data": { + "op": "PAM:bad_ident", + "hostname": "107.170.65.109", + "terminal": "ssh" + }, + "summary": { + "actor": { + "secondary": "root", + "primary": "unset" + }, + "object": { + "type": "user-session", + "primary": "ssh", + "secondary": "107.170.65.109" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 186469, + "result": "fail" + }, + "beat": { + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-redis-01" + }, + "event": { + "module": "auditd", + "category": "user-login", + "type": "user_err", + "action": "error" + }, + "user": { + "name_map": { + "uid": "root" + }, + "uid": "0", + "auid": "unset" + }, + "process": { + "pid": "32360", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "107.170.65.109" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "FdfTUmcBTFzn_XoLmy0i", + "source": { + "@timestamp": "2018-11-27T01:40:57.784Z", + "host": { + "name": "demo-stack-redis-01" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "pid": "32368", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "107.170.65.109" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "data": { + "op": "login", + "acct": "(unknown user)", + "terminal": "sshd" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + }, + "object": { + "primary": "sshd", + "secondary": "107.170.65.109", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 186470, + "result": "fail", + "session": "unset" + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + }, + "beat": { + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "FtfTUmcBTFzn_XoLmy0i", + "source": { + "@timestamp": "2018-11-27T01:40:57.785Z", + "source": { + "ip": "107.170.65.109" + }, + "network": { + "direction": "incoming" + }, + "beat": { + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-redis-01" + }, + "auditd": { + "result": "fail", + "session": "unset", + "data": { + "terminal": "sshd", + "op": "login", + "acct": "(invalid user)" + }, + "summary": { + "actor": { + "secondary": "(invalid user)", + "primary": "unset" + }, + "object": { + "primary": "sshd", + "secondary": "107.170.65.109", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 186471 + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + }, + "user": { + "name_map": { + "uid": "root" + }, + "uid": "0", + "auid": "unset" + }, + "process": { + "pid": "32368", + "exe": "/usr/sbin/sshd" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "F9fTUmcBTFzn_XoLmy0i", + "source": { + "@timestamp": "2018-11-27T01:40:57.815Z", + "network": { + "direction": "incoming" + }, + "auditd": { + "data": { + "terminal": "ssh", + "op": "PAM:bad_ident", + "hostname": "107.170.65.109" + }, + "summary": { + "actor": { + "secondary": "root", + "primary": "unset" + }, + "object": { + "primary": "ssh", + "secondary": "107.170.65.109", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 186472, + "result": "fail", + "session": "unset" + }, + "event": { + "category": "user-login", + "type": "user_err", + "action": "error", + "module": "auditd" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "exe": "/usr/sbin/sshd", + "pid": "32368" + }, + "source": { + "ip": "107.170.65.109" + }, + "beat": { + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-redis-01" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "rNfUUmcBTFzn_XoLBTW-", + "source": { + "@timestamp": "2018-11-27T01:41:25.073Z", + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + }, + "beat": { + "hostname": "demo-stack-mysql-01", + "version": "7.0.0-alpha1", + "name": "demo-stack-mysql-01" + }, + "host": { + "name": "demo-stack-mysql-01" + }, + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + }, + "process": { + "pid": "12798", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "104.131.37.34" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "sequence": 43190, + "result": "fail", + "session": "unset", + "data": { + "terminal": "sshd", + "op": "login", + "acct": "(unknown user)" + }, + "summary": { + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + }, + "object": { + "primary": "sshd", + "secondary": "104.131.37.34", + "type": "user-session" + } + } + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "rdfUUmcBTFzn_XoLBTW-", + "source": { + "@timestamp": "2018-11-27T01:41:25.073Z", + "user": { + "uid": "0", + "auid": "unset", + "name_map": { + "uid": "root" + } + }, + "process": { + "pid": "12798", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "104.131.37.34" + }, + "network": { + "direction": "incoming" + }, + "beat": { + "name": "demo-stack-mysql-01", + "hostname": "demo-stack-mysql-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-mysql-01" + }, + "auditd": { + "sequence": 43191, + "result": "fail", + "session": "unset", + "data": { + "acct": "(invalid user)", + "terminal": "sshd", + "op": "login" + }, + "summary": { + "actor": { + "secondary": "(invalid user)", + "primary": "unset" + }, + "object": { + "primary": "sshd", + "secondary": "104.131.37.34", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + } + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "rtfUUmcBTFzn_XoLBTW-", + "source": { + "@timestamp": "2018-11-27T01:41:25.105Z", + "host": { + "name": "demo-stack-mysql-01" + }, + "event": { + "category": "user-login", + "type": "user_err", + "action": "error", + "module": "auditd" + }, + "user": { + "auid": "unset", + "uid": "0", + "name_map": { + "uid": "root" + } + }, + "process": { + "exe": "/usr/sbin/sshd", + "pid": "12798" + }, + "source": { + "ip": "104.131.37.34" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "sequence": 43192, + "result": "fail", + "session": "unset", + "data": { + "terminal": "ssh", + "op": "PAM:bad_ident", + "hostname": "104.131.37.34" + }, + "summary": { + "object": { + "primary": "ssh", + "secondary": "104.131.37.34", + "type": "user-session" + }, + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "root" + } + } + }, + "beat": { + "name": "demo-stack-mysql-01", + "hostname": "demo-stack-mysql-01", + "version": "7.0.0-alpha1" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "TNfWUmcBTFzn_XoLkW2H", + "source": { + "@timestamp": "2018-11-27T01:44:11.932Z", + "beat": { + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-redis-01" + }, + "source": { + "ip": "128.199.106.169" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "session": "unset", + "data": { + "terminal": "sshd", + "op": "login", + "acct": "(unknown user)" + }, + "summary": { + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + }, + "object": { + "primary": "sshd", + "secondary": "128.199.106.169", + "type": "user-session" + } + }, + "sequence": 186485, + "result": "fail" + }, + "event": { + "module": "auditd", + "category": "user-login", + "type": "user_login", + "action": "logged-in" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "pid": "32391", + "exe": "/usr/sbin/sshd" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "TdfWUmcBTFzn_XoLkW2H", + "source": { + "@timestamp": "2018-11-27T01:44:11.934Z", + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + }, + "process": { + "pid": "32391", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "128.199.106.169" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "result": "fail", + "session": "unset", + "data": { + "acct": "(invalid user)", + "op": "login", + "terminal": "sshd" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + }, + "object": { + "primary": "sshd", + "secondary": "128.199.106.169", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 186486 + }, + "host": { + "name": "demo-stack-redis-01" + }, + "beat": { + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1", + "name": "demo-stack-redis-01" + }, + "event": { + "action": "logged-in", + "module": "auditd", + "category": "user-login", + "type": "user_login" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "TtfWUmcBTFzn_XoLkW2H", + "source": { + "@timestamp": "2018-11-27T01:44:12.126Z", + "process": { + "pid": "32391", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "128.199.106.169" + }, + "network": { + "direction": "incoming" + }, + "beat": { + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-redis-01" + }, + "auditd": { + "data": { + "terminal": "ssh", + "hostname": "128.199.106.169", + "op": "PAM:bad_ident" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "root" + }, + "object": { + "secondary": "128.199.106.169", + "type": "user-session", + "primary": "ssh" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 186487, + "result": "fail", + "session": "unset" + }, + "event": { + "category": "user-login", + "type": "user_err", + "action": "error", + "module": "auditd" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "CtfWUmcBTFzn_XoLl27w", + "source": { + "@timestamp": "2018-11-27T01:44:13.574Z", + "source": { + "ip": "45.122.222.253" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "result": "fail", + "session": "unset", + "data": { + "terminal": "sshd", + "acct": "(unknown user)", + "op": "login" + }, + "summary": { + "object": { + "primary": "sshd", + "secondary": "45.122.222.253", + "type": "user-session" + }, + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + } + }, + "sequence": 142361 + }, + "event": { + "action": "logged-in", + "module": "auditd", + "category": "user-login", + "type": "user_login" + }, + "user": { + "name_map": { + "uid": "root" + }, + "auid": "unset", + "uid": "0" + }, + "process": { + "pid": "19759", + "exe": "/usr/sbin/sshd" + }, + "beat": { + "hostname": "demo-stack-haproxy-01", + "version": "7.0.0-alpha1", + "name": "demo-stack-haproxy-01" + }, + "host": { + "name": "demo-stack-haproxy-01" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "C9fWUmcBTFzn_XoLl27w", + "source": { + "@timestamp": "2018-11-27T01:44:13.575Z", + "event": { + "module": "auditd", + "category": "user-login", + "type": "user_login", + "action": "logged-in" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "pid": "19759", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "45.122.222.253" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "sequence": 142362, + "result": "fail", + "session": "unset", + "data": { + "acct": "(invalid user)", + "op": "login", + "terminal": "sshd" + }, + "summary": { + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + }, + "object": { + "type": "user-session", + "primary": "sshd", + "secondary": "45.122.222.253" + } + } + }, + "beat": { + "name": "demo-stack-haproxy-01", + "hostname": "demo-stack-haproxy-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-haproxy-01" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "DNfWUmcBTFzn_XoLl27w", + "source": { + "@timestamp": "2018-11-27T01:44:13.839Z", + "source": { + "ip": "45.122.222.253" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "data": { + "terminal": "ssh", + "hostname": "45.122.222.253", + "op": "PAM:bad_ident" + }, + "summary": { + "object": { + "type": "user-session", + "primary": "ssh", + "secondary": "45.122.222.253" + }, + "how": "/usr/sbin/sshd", + "actor": { + "secondary": "root", + "primary": "unset" + } + }, + "sequence": 142363, + "result": "fail", + "session": "unset" + }, + "beat": { + "name": "demo-stack-haproxy-01", + "hostname": "demo-stack-haproxy-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-haproxy-01" + }, + "event": { + "category": "user-login", + "type": "user_err", + "action": "error", + "module": "auditd" + }, + "user": { + "uid": "0", + "auid": "unset", + "name_map": { + "uid": "root" + } + }, + "process": { + "pid": "19759", + "exe": "/usr/sbin/sshd" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "utfYUmcBTFzn_XoLQpK3", + "source": { + "@timestamp": "2018-11-27T01:46:02.828Z", + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "exe": "/usr/sbin/sshd", + "pid": "19772" + }, + "beat": { + "hostname": "demo-stack-haproxy-01", + "version": "7.0.0-alpha1", + "name": "demo-stack-haproxy-01" + }, + "host": { + "name": "demo-stack-haproxy-01" + }, + "source": { + "ip": "151.203.70.218" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "summary": { + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + }, + "object": { + "primary": "sshd", + "secondary": "151.203.70.218", + "type": "user-session" + } + }, + "sequence": 142364, + "result": "fail", + "session": "unset", + "data": { + "terminal": "sshd", + "acct": "(unknown user)", + "op": "login" + } + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "u9fYUmcBTFzn_XoLQpK3", + "source": { + "@timestamp": "2018-11-27T01:46:02.829Z", + "source": { + "ip": "151.203.70.218" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "sequence": 142365, + "result": "fail", + "session": "unset", + "data": { + "terminal": "sshd", + "acct": "(invalid user)", + "op": "login" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + }, + "object": { + "type": "user-session", + "primary": "sshd", + "secondary": "151.203.70.218" + }, + "how": "/usr/sbin/sshd" + } + }, + "event": { + "module": "auditd", + "category": "user-login", + "type": "user_login", + "action": "logged-in" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "exe": "/usr/sbin/sshd", + "pid": "19772" + }, + "beat": { + "name": "demo-stack-haproxy-01", + "hostname": "demo-stack-haproxy-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-haproxy-01" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "vNfYUmcBTFzn_XoLQpK3", + "source": { + "@timestamp": "2018-11-27T01:46:02.868Z", + "source": { + "ip": "151.203.70.218" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "summary": { + "actor": { + "primary": "unset", + "secondary": "root" + }, + "object": { + "type": "user-session", + "primary": "ssh", + "secondary": "151.203.70.218" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 142366, + "result": "fail", + "session": "unset", + "data": { + "hostname": "151.203.70.218", + "terminal": "ssh", + "op": "PAM:bad_ident" + } + }, + "event": { + "category": "user-login", + "type": "user_err", + "action": "error", + "module": "auditd" + }, + "beat": { + "name": "demo-stack-haproxy-01", + "hostname": "demo-stack-haproxy-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-haproxy-01" + }, + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + }, + "process": { + "pid": "19772", + "exe": "/usr/sbin/sshd" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "SdfYUmcBTFzn_XoLRpPT", + "source": { + "@timestamp": "2018-11-27T01:46:03.873Z", + "process": { + "pid": "12823", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "152.115.61.52" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "sequence": 43193, + "result": "fail", + "session": "unset", + "data": { + "acct": "(unknown user)", + "terminal": "sshd", + "op": "login" + }, + "summary": { + "actor": { + "secondary": "(unknown user)", + "primary": "unset" + }, + "object": { + "primary": "sshd", + "secondary": "152.115.61.52", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + } + }, + "event": { + "module": "auditd", + "category": "user-login", + "type": "user_login", + "action": "logged-in" + }, + "beat": { + "name": "demo-stack-mysql-01", + "hostname": "demo-stack-mysql-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-mysql-01" + }, + "user": { + "name_map": { + "uid": "root" + }, + "auid": "unset", + "uid": "0" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "StfYUmcBTFzn_XoLRpPT", + "source": { + "@timestamp": "2018-11-27T01:46:03.873Z", + "auditd": { + "data": { + "terminal": "sshd", + "acct": "(invalid user)", + "op": "login" + }, + "summary": { + "object": { + "primary": "sshd", + "secondary": "152.115.61.52", + "type": "user-session" + }, + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + } + }, + "sequence": 43194, + "result": "fail", + "session": "unset" + }, + "event": { + "module": "auditd", + "category": "user-login", + "type": "user_login", + "action": "logged-in" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "pid": "12823", + "exe": "/usr/sbin/sshd" + }, + "beat": { + "version": "7.0.0-alpha1", + "name": "demo-stack-mysql-01", + "hostname": "demo-stack-mysql-01" + }, + "host": { + "name": "demo-stack-mysql-01" + }, + "source": { + "ip": "152.115.61.52" + }, + "network": { + "direction": "incoming" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "S9fYUmcBTFzn_XoLRpPT", + "source": { + "@timestamp": "2018-11-27T01:46:04.009Z", + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + }, + "process": { + "pid": "12823", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "152.115.61.52" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "summary": { + "how": "/usr/sbin/sshd", + "actor": { + "secondary": "root", + "primary": "unset" + }, + "object": { + "secondary": "152.115.61.52", + "type": "user-session", + "primary": "ssh" + } + }, + "sequence": 43195, + "result": "fail", + "session": "unset", + "data": { + "hostname": "152.115.61.52", + "op": "PAM:bad_ident", + "terminal": "ssh" + } + }, + "beat": { + "name": "demo-stack-mysql-01", + "hostname": "demo-stack-mysql-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-mysql-01" + }, + "event": { + "module": "auditd", + "category": "user-login", + "type": "user_err", + "action": "error" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "adfYUmcBTFzn_XoLXJVb", + "source": { + "@timestamp": "2018-11-27T01:46:09.392Z", + "host": { + "name": "demo-stack-redis-01" + }, + "event": { + "module": "auditd", + "category": "user-login", + "type": "user_login", + "action": "logged-in" + }, + "user": { + "name_map": { + "uid": "root" + }, + "uid": "0", + "auid": "unset" + }, + "process": { + "exe": "/usr/sbin/sshd", + "pid": "32410" + }, + "source": { + "ip": "106.51.66.214" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "sequence": 186494, + "result": "fail", + "session": "unset", + "data": { + "terminal": "sshd", + "acct": "(unknown user)", + "op": "login" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + }, + "object": { + "primary": "sshd", + "secondary": "106.51.66.214", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + } + }, + "beat": { + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "atfYUmcBTFzn_XoLXJVb", + "source": { + "@timestamp": "2018-11-27T01:46:09.394Z", + "auditd": { + "data": { + "terminal": "sshd", + "op": "login", + "acct": "(invalid user)" + }, + "summary": { + "object": { + "primary": "sshd", + "secondary": "106.51.66.214", + "type": "user-session" + }, + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + } + }, + "sequence": 186495, + "result": "fail", + "session": "unset" + }, + "beat": { + "version": "7.0.0-alpha1", + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01" + }, + "host": { + "name": "demo-stack-redis-01" + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + }, + "user": { + "name_map": { + "uid": "root" + }, + "uid": "0", + "auid": "unset" + }, + "process": { + "pid": "32410", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "106.51.66.214" + }, + "network": { + "direction": "incoming" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "a9fYUmcBTFzn_XoLXJVb", + "source": { + "@timestamp": "2018-11-27T01:46:09.624Z", + "process": { + "exe": "/usr/sbin/sshd", + "pid": "32410" + }, + "source": { + "ip": "106.51.66.214" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "sequence": 186496, + "result": "fail", + "session": "unset", + "data": { + "hostname": "106.51.66.214", + "terminal": "ssh", + "op": "PAM:bad_ident" + }, + "summary": { + "object": { + "primary": "ssh", + "secondary": "106.51.66.214", + "type": "user-session" + }, + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "root" + } + } + }, + "event": { + "category": "user-login", + "type": "user_err", + "action": "error", + "module": "auditd" + }, + "user": { + "auid": "unset", + "uid": "0", + "name_map": { + "uid": "root" + } + }, + "beat": { + "version": "7.0.0-alpha1", + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01" + }, + "host": { + "name": "demo-stack-redis-01" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "y9fYUmcBTFzn_XoLZZX6", + "source": { + "@timestamp": "2018-11-27T01:46:11.847Z", + "source": { + "ip": "92.86.47.26" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "session": "unset", + "data": { + "acct": "(unknown user)", + "op": "login", + "terminal": "sshd" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + }, + "object": { + "type": "user-session", + "primary": "sshd", + "secondary": "92.86.47.26" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 192553, + "result": "fail" + }, + "beat": { + "name": "demo-stack-nginx-01", + "hostname": "demo-stack-nginx-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-nginx-01" + }, + "event": { + "type": "user_login", + "action": "logged-in", + "module": "auditd", + "category": "user-login" + }, + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + }, + "process": { + "pid": "700", + "exe": "/usr/sbin/sshd" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "zNfYUmcBTFzn_XoLZZX6", + "source": { + "@timestamp": "2018-11-27T01:46:11.848Z", + "beat": { + "name": "demo-stack-nginx-01", + "hostname": "demo-stack-nginx-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-nginx-01" + }, + "auditd": { + "result": "fail", + "session": "unset", + "data": { + "terminal": "sshd", + "acct": "(invalid user)", + "op": "login" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + }, + "object": { + "primary": "sshd", + "secondary": "92.86.47.26", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 192554 + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + }, + "user": { + "name_map": { + "uid": "root" + }, + "auid": "unset", + "uid": "0" + }, + "process": { + "pid": "700", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "92.86.47.26" + }, + "network": { + "direction": "incoming" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "zdfYUmcBTFzn_XoLZZX6", + "source": { + "@timestamp": "2018-11-27T01:46:11.996Z", + "event": { + "module": "auditd", + "category": "user-login", + "type": "user_err", + "action": "error" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "pid": "700", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "92.86.47.26" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "sequence": 192555, + "result": "fail", + "session": "unset", + "data": { + "terminal": "ssh", + "hostname": "92.86.47.26", + "op": "PAM:bad_ident" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "root" + }, + "object": { + "primary": "ssh", + "secondary": "92.86.47.26", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + } + }, + "host": { + "name": "demo-stack-nginx-01" + }, + "beat": { + "version": "7.0.0-alpha1", + "name": "demo-stack-nginx-01", + "hostname": "demo-stack-nginx-01" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "JNfWUmcBTFzn_XoLc2tJ", + "source": { + "@timestamp": "2018-11-27T01:44:04.191Z", + "process": { + "pid": "19756", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "177.137.205.150" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "result": "fail", + "session": "unset", + "data": { + "terminal": "sshd", + "acct": "(unknown user)", + "op": "login" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + }, + "object": { + "secondary": "177.137.205.150", + "type": "user-session", + "primary": "sshd" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 142358 + }, + "beat": { + "name": "demo-stack-haproxy-01", + "hostname": "demo-stack-haproxy-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-haproxy-01" + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + }, + "user": { + "uid": "0", + "auid": "unset", + "name_map": { + "uid": "root" + } + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "JdfWUmcBTFzn_XoLc2tJ", + "source": { + "@timestamp": "2018-11-27T01:44:04.192Z", + "auditd": { + "summary": { + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + }, + "object": { + "primary": "sshd", + "secondary": "177.137.205.150", + "type": "user-session" + } + }, + "sequence": 142359, + "result": "fail", + "session": "unset", + "data": { + "acct": "(invalid user)", + "terminal": "sshd", + "op": "login" + } + }, + "beat": { + "name": "demo-stack-haproxy-01", + "hostname": "demo-stack-haproxy-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-haproxy-01" + }, + "event": { + "action": "logged-in", + "module": "auditd", + "category": "user-login", + "type": "user_login" + }, + "user": { + "name_map": { + "uid": "root" + }, + "uid": "0", + "auid": "unset" + }, + "process": { + "exe": "/usr/sbin/sshd", + "pid": "19756" + }, + "source": { + "ip": "177.137.205.150" + }, + "network": { + "direction": "incoming" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "JtfWUmcBTFzn_XoLc2tJ", + "source": { + "@timestamp": "2018-11-27T01:44:04.375Z", + "process": { + "pid": "19756", + "exe": "/usr/sbin/sshd" + }, + "beat": { + "name": "demo-stack-haproxy-01", + "hostname": "demo-stack-haproxy-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-haproxy-01" + }, + "source": { + "ip": "177.137.205.150" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "data": { + "op": "PAM:bad_ident", + "hostname": "177.137.205.150", + "terminal": "ssh" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "root" + }, + "object": { + "type": "user-session", + "primary": "ssh", + "secondary": "177.137.205.150" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 142360, + "result": "fail", + "session": "unset" + }, + "event": { + "type": "user_err", + "action": "error", + "module": "auditd", + "category": "user-login" + }, + "user": { + "name_map": { + "uid": "root" + }, + "auid": "unset", + "uid": "0" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "atfYUmcBTFzn_XoLgpgd", + "source": { + "@timestamp": "2018-11-27T01:46:19.059Z", + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + }, + "process": { + "pid": "19774", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "140.143.190.243" + }, + "network": { + "direction": "incoming" + }, + "beat": { + "name": "demo-stack-haproxy-01", + "hostname": "demo-stack-haproxy-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-haproxy-01" + }, + "auditd": { + "sequence": 142367, + "result": "fail", + "session": "unset", + "data": { + "op": "login", + "acct": "(unknown user)", + "terminal": "sshd" + }, + "summary": { + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + }, + "object": { + "secondary": "140.143.190.243", + "type": "user-session", + "primary": "sshd" + } + } + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "a9fYUmcBTFzn_XoLgpgd", + "source": { + "@timestamp": "2018-11-27T01:46:19.060Z", + "process": { + "pid": "19774", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "140.143.190.243" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "sequence": 142368, + "result": "fail", + "session": "unset", + "data": { + "acct": "(invalid user)", + "op": "login", + "terminal": "sshd" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + }, + "object": { + "secondary": "140.143.190.243", + "type": "user-session", + "primary": "sshd" + }, + "how": "/usr/sbin/sshd" + } + }, + "beat": { + "name": "demo-stack-haproxy-01", + "hostname": "demo-stack-haproxy-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-haproxy-01" + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + }, + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "bNfYUmcBTFzn_XoLgpgd", + "source": { + "@timestamp": "2018-11-27T01:46:19.278Z", + "auditd": { + "sequence": 142369, + "result": "fail", + "session": "unset", + "data": { + "op": "PAM:bad_ident", + "terminal": "ssh", + "hostname": "140.143.190.243" + }, + "summary": { + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "root" + }, + "object": { + "primary": "ssh", + "secondary": "140.143.190.243", + "type": "user-session" + } + } + }, + "event": { + "type": "user_err", + "action": "error", + "module": "auditd", + "category": "user-login" + }, + "user": { + "auid": "unset", + "uid": "0", + "name_map": { + "uid": "root" + } + }, + "process": { + "pid": "19774", + "exe": "/usr/sbin/sshd" + }, + "beat": { + "version": "7.0.0-alpha1", + "name": "demo-stack-haproxy-01", + "hostname": "demo-stack-haproxy-01" + }, + "host": { + "name": "demo-stack-haproxy-01" + }, + "source": { + "ip": "140.143.190.243" + }, + "network": { + "direction": "incoming" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "AtfXUmcBTFzn_XoLaoE9", + "source": { + "@timestamp": "2018-11-27T01:45:07.411Z", + "auditd": { + "sequence": 184386, + "result": "fail", + "session": "unset", + "data": { + "acct": "(unknown user)", + "op": "login", + "terminal": "sshd" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + }, + "object": { + "primary": "sshd", + "secondary": "217.19.148.142", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + } + }, + "beat": { + "name": "demo-stack-apache-01", + "hostname": "demo-stack-apache-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-apache-01" + }, + "event": { + "action": "logged-in", + "module": "auditd", + "category": "user-login", + "type": "user_login" + }, + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + }, + "process": { + "pid": "25932", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "217.19.148.142" + }, + "network": { + "direction": "incoming" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "A9fXUmcBTFzn_XoLaoE9", + "source": { + "@timestamp": "2018-11-27T01:45:07.412Z", + "user": { + "auid": "unset", + "uid": "0", + "name_map": { + "uid": "root" + } + }, + "process": { + "pid": "25932", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "217.19.148.142" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "result": "fail", + "session": "unset", + "data": { + "acct": "(invalid user)", + "terminal": "sshd", + "op": "login" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + }, + "object": { + "primary": "sshd", + "secondary": "217.19.148.142", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 184387 + }, + "event": { + "action": "logged-in", + "module": "auditd", + "category": "user-login", + "type": "user_login" + }, + "beat": { + "name": "demo-stack-apache-01", + "hostname": "demo-stack-apache-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-apache-01" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "BNfXUmcBTFzn_XoLaoE9", + "source": { + "@timestamp": "2018-11-27T01:45:07.545Z", + "event": { + "category": "user-login", + "type": "user_err", + "action": "error", + "module": "auditd" + }, + "user": { + "name_map": { + "uid": "root" + }, + "auid": "unset", + "uid": "0" + }, + "beat": { + "name": "demo-stack-apache-01", + "hostname": "demo-stack-apache-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-apache-01" + }, + "process": { + "pid": "25932", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "217.19.148.142" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "data": { + "op": "PAM:bad_ident", + "terminal": "ssh", + "hostname": "217.19.148.142" + }, + "summary": { + "how": "/usr/sbin/sshd", + "actor": { + "secondary": "root", + "primary": "unset" + }, + "object": { + "primary": "ssh", + "secondary": "217.19.148.142", + "type": "user-session" + } + }, + "sequence": 184388, + "result": "fail", + "session": "unset" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "49fWUmcBTFzn_XoL_XYj", + "source": { + "@timestamp": "2018-11-27T01:44:39.480Z", + "host": { + "name": "demo-stack-redis-01" + }, + "auditd": { + "result": "fail", + "session": "unset", + "data": { + "acct": "(unknown user)", + "op": "login", + "terminal": "sshd" + }, + "summary": { + "actor": { + "secondary": "(unknown user)", + "primary": "unset" + }, + "object": { + "primary": "sshd", + "secondary": "107.170.65.109", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 186488 + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "pid": "32399", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "107.170.65.109" + }, + "network": { + "direction": "incoming" + }, + "beat": { + "version": "7.0.0-alpha1", + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "5NfWUmcBTFzn_XoL_XYj", + "source": { + "@timestamp": "2018-11-27T01:44:39.481Z", + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + }, + "process": { + "pid": "32399", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "107.170.65.109" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "sequence": 186489, + "result": "fail", + "session": "unset", + "data": { + "op": "login", + "acct": "(invalid user)", + "terminal": "sshd" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + }, + "object": { + "primary": "sshd", + "secondary": "107.170.65.109", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + } + }, + "beat": { + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-redis-01" + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "5dfWUmcBTFzn_XoL_XYj", + "source": { + "@timestamp": "2018-11-27T01:44:39.512Z", + "auditd": { + "summary": { + "how": "/usr/sbin/sshd", + "actor": { + "secondary": "root", + "primary": "unset" + }, + "object": { + "secondary": "107.170.65.109", + "type": "user-session", + "primary": "ssh" + } + }, + "sequence": 186490, + "result": "fail", + "session": "unset", + "data": { + "terminal": "ssh", + "op": "PAM:bad_ident", + "hostname": "107.170.65.109" + } + }, + "event": { + "category": "user-login", + "type": "user_err", + "action": "error", + "module": "auditd" + }, + "beat": { + "version": "7.0.0-alpha1", + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01" + }, + "host": { + "name": "demo-stack-redis-01" + }, + "user": { + "uid": "0", + "auid": "unset", + "name_map": { + "uid": "root" + } + }, + "process": { + "pid": "32399", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "107.170.65.109" + }, + "network": { + "direction": "incoming" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "GtfVUmcBTFzn_XoL2l5j", + "source": { + "@timestamp": "2018-11-27T01:43:25.049Z", + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + }, + "process": { + "pid": "32389", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "107.170.65.109" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "result": "fail", + "session": "unset", + "data": { + "terminal": "sshd", + "op": "login", + "acct": "(unknown user)" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + }, + "object": { + "type": "user-session", + "primary": "sshd", + "secondary": "107.170.65.109" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 186482 + }, + "event": { + "action": "logged-in", + "module": "auditd", + "category": "user-login", + "type": "user_login" + }, + "beat": { + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-redis-01" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "G9fVUmcBTFzn_XoL2l5j", + "source": { + "@timestamp": "2018-11-27T01:43:25.050Z", + "event": { + "module": "auditd", + "category": "user-login", + "type": "user_login", + "action": "logged-in" + }, + "user": { + "name_map": { + "uid": "root" + }, + "uid": "0", + "auid": "unset" + }, + "process": { + "exe": "/usr/sbin/sshd", + "pid": "32389" + }, + "source": { + "ip": "107.170.65.109" + }, + "beat": { + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-redis-01" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "sequence": 186483, + "result": "fail", + "session": "unset", + "data": { + "op": "login", + "acct": "(invalid user)", + "terminal": "sshd" + }, + "summary": { + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + }, + "object": { + "type": "user-session", + "primary": "sshd", + "secondary": "107.170.65.109" + } + } + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "HNfVUmcBTFzn_XoL2l5j", + "source": { + "@timestamp": "2018-11-27T01:43:25.081Z", + "beat": { + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1" + }, + "event": { + "type": "user_err", + "action": "error", + "module": "auditd", + "category": "user-login" + }, + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + }, + "process": { + "pid": "32389", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "107.170.65.109" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "data": { + "op": "PAM:bad_ident", + "hostname": "107.170.65.109", + "terminal": "ssh" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "root" + }, + "object": { + "primary": "ssh", + "secondary": "107.170.65.109", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 186484, + "result": "fail", + "session": "unset" + }, + "host": { + "name": "demo-stack-redis-01" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "ANfYUmcBTFzn_XoLIJDK", + "source": { + "@timestamp": "2018-11-27T01:45:54.144Z", + "process": { + "exe": "/usr/sbin/sshd", + "pid": "32408" + }, + "source": { + "ip": "107.170.65.109" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "session": "unset", + "data": { + "op": "login", + "acct": "(unknown user)", + "terminal": "sshd" + }, + "summary": { + "object": { + "primary": "sshd", + "secondary": "107.170.65.109", + "type": "user-session" + }, + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + } + }, + "sequence": 186491, + "result": "fail" + }, + "event": { + "action": "logged-in", + "module": "auditd", + "category": "user-login", + "type": "user_login" + }, + "beat": { + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-redis-01" + }, + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "AdfYUmcBTFzn_XoLIJDK", + "source": { + "@timestamp": "2018-11-27T01:45:54.146Z", + "host": { + "name": "demo-stack-redis-01" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "pid": "32408", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "107.170.65.109" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "session": "unset", + "data": { + "terminal": "sshd", + "op": "login", + "acct": "(invalid user)" + }, + "summary": { + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + }, + "object": { + "type": "user-session", + "primary": "sshd", + "secondary": "107.170.65.109" + } + }, + "sequence": 186492, + "result": "fail" + }, + "event": { + "module": "auditd", + "category": "user-login", + "type": "user_login", + "action": "logged-in" + }, + "beat": { + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "AtfYUmcBTFzn_XoLIJDK", + "source": { + "@timestamp": "2018-11-27T01:45:54.176Z", + "auditd": { + "session": "unset", + "data": { + "terminal": "ssh", + "hostname": "107.170.65.109", + "op": "PAM:bad_ident" + }, + "summary": { + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "root" + }, + "object": { + "primary": "ssh", + "secondary": "107.170.65.109", + "type": "user-session" + } + }, + "sequence": 186493, + "result": "fail" + }, + "beat": { + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-redis-01" + }, + "event": { + "type": "user_err", + "action": "error", + "module": "auditd", + "category": "user-login" + }, + "user": { + "name_map": { + "uid": "root" + }, + "uid": "0", + "auid": "unset" + }, + "process": { + "exe": "/usr/sbin/sshd", + "pid": "32408" + }, + "source": { + "ip": "107.170.65.109" + }, + "network": { + "direction": "incoming" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "kNjeUmcBTFzn_XoLchqO", + "source": { + "@timestamp": "2018-11-27T01:52:48.274Z", + "auditd": { + "session": "unset", + "data": { + "terminal": "sshd", + "op": "login", + "acct": "(unknown user)" + }, + "summary": { + "actor": { + "secondary": "(unknown user)", + "primary": "unset" + }, + "object": { + "primary": "sshd", + "secondary": "92.222.218.139", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 184392, + "result": "fail" + }, + "host": { + "name": "demo-stack-apache-01" + }, + "beat": { + "name": "demo-stack-apache-01", + "hostname": "demo-stack-apache-01", + "version": "7.0.0-alpha1" + }, + "event": { + "type": "user_login", + "action": "logged-in", + "module": "auditd", + "category": "user-login" + }, + "user": { + "name_map": { + "uid": "root" + }, + "auid": "unset", + "uid": "0" + }, + "process": { + "pid": "25980", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "92.222.218.139" + }, + "network": { + "direction": "incoming" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "kdjeUmcBTFzn_XoLchqO", + "source": { + "@timestamp": "2018-11-27T01:52:48.275Z", + "process": { + "exe": "/usr/sbin/sshd", + "pid": "25980" + }, + "source": { + "ip": "92.222.218.139" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "data": { + "terminal": "sshd", + "op": "login", + "acct": "(invalid user)" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + }, + "object": { + "type": "user-session", + "primary": "sshd", + "secondary": "92.222.218.139" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 184393, + "result": "fail", + "session": "unset" + }, + "beat": { + "name": "demo-stack-apache-01", + "hostname": "demo-stack-apache-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-apache-01" + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + }, + "user": { + "uid": "0", + "auid": "unset", + "name_map": { + "uid": "root" + } + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "ktjeUmcBTFzn_XoLchqO", + "source": { + "@timestamp": "2018-11-27T01:52:48.381Z", + "event": { + "category": "user-login", + "type": "user_err", + "action": "error", + "module": "auditd" + }, + "host": { + "name": "demo-stack-apache-01" + }, + "beat": { + "name": "demo-stack-apache-01", + "hostname": "demo-stack-apache-01", + "version": "7.0.0-alpha1" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "pid": "25980", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "92.222.218.139" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "session": "unset", + "data": { + "terminal": "ssh", + "op": "PAM:bad_ident", + "hostname": "92.222.218.139" + }, + "summary": { + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "root" + }, + "object": { + "type": "user-session", + "primary": "ssh", + "secondary": "92.222.218.139" + } + }, + "sequence": 184394, + "result": "fail" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "ANjeUmcBTFzn_XoLgBst", + "source": { + "@timestamp": "2018-11-27T01:52:51.775Z", + "source": { + "ip": "174.138.17.18" + }, + "host": { + "name": "demo-stack-mysql-01" + }, + "beat": { + "name": "demo-stack-mysql-01", + "hostname": "demo-stack-mysql-01", + "version": "7.0.0-alpha1" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "data": { + "terminal": "sshd", + "acct": "(unknown user)", + "op": "login" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + }, + "object": { + "secondary": "174.138.17.18", + "type": "user-session", + "primary": "sshd" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 43202, + "result": "fail", + "session": "unset" + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + }, + "user": { + "name_map": { + "uid": "root" + }, + "auid": "unset", + "uid": "0" + }, + "process": { + "exe": "/usr/sbin/sshd", + "pid": "12866" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "AdjeUmcBTFzn_XoLgBst", + "source": { + "@timestamp": "2018-11-27T01:52:51.775Z", + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "beat": { + "name": "demo-stack-mysql-01", + "hostname": "demo-stack-mysql-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-mysql-01" + }, + "process": { + "exe": "/usr/sbin/sshd", + "pid": "12866" + }, + "source": { + "ip": "174.138.17.18" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "session": "unset", + "data": { + "terminal": "sshd", + "acct": "(invalid user)", + "op": "login" + }, + "summary": { + "object": { + "primary": "sshd", + "secondary": "174.138.17.18", + "type": "user-session" + }, + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + } + }, + "sequence": 43203, + "result": "fail" + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "AtjeUmcBTFzn_XoLgBst", + "source": { + "@timestamp": "2018-11-27T01:52:51.851Z", + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + }, + "user": { + "name_map": { + "uid": "root" + }, + "auid": "unset", + "uid": "0" + }, + "beat": { + "hostname": "demo-stack-mysql-01", + "version": "7.0.0-alpha1", + "name": "demo-stack-mysql-01" + }, + "host": { + "name": "demo-stack-mysql-01" + }, + "process": { + "exe": "/usr/sbin/sshd", + "pid": "12868" + }, + "source": { + "ip": "54.38.47.28" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "sequence": 43204, + "result": "fail", + "session": "unset", + "data": { + "op": "login", + "acct": "(unknown user)", + "terminal": "sshd" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + }, + "object": { + "primary": "sshd", + "secondary": "54.38.47.28", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + } + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "A9jeUmcBTFzn_XoLgBst", + "source": { + "@timestamp": "2018-11-27T01:52:51.851Z", + "beat": { + "name": "demo-stack-mysql-01", + "hostname": "demo-stack-mysql-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-mysql-01" + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + }, + "user": { + "uid": "0", + "auid": "unset", + "name_map": { + "uid": "root" + } + }, + "process": { + "pid": "12868", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "54.38.47.28" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "sequence": 43205, + "result": "fail", + "session": "unset", + "data": { + "op": "login", + "terminal": "sshd", + "acct": "(invalid user)" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + }, + "object": { + "primary": "sshd", + "secondary": "54.38.47.28", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + } + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "BNjeUmcBTFzn_XoLgBst", + "source": { + "@timestamp": "2018-11-27T01:52:51.963Z", + "event": { + "category": "user-login", + "type": "user_err", + "action": "error", + "module": "auditd" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "pid": "12868", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "54.38.47.28" + }, + "network": { + "direction": "incoming" + }, + "beat": { + "version": "7.0.0-alpha1", + "name": "demo-stack-mysql-01", + "hostname": "demo-stack-mysql-01" + }, + "host": { + "name": "demo-stack-mysql-01" + }, + "auditd": { + "data": { + "op": "PAM:bad_ident", + "terminal": "ssh", + "hostname": "54.38.47.28" + }, + "summary": { + "object": { + "primary": "ssh", + "secondary": "54.38.47.28", + "type": "user-session" + }, + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "root" + } + }, + "sequence": 43206, + "result": "fail", + "session": "unset" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "BdjeUmcBTFzn_XoLgBst", + "source": { + "@timestamp": "2018-11-27T01:52:51.967Z", + "beat": { + "name": "demo-stack-mysql-01", + "hostname": "demo-stack-mysql-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-mysql-01" + }, + "event": { + "action": "error", + "module": "auditd", + "category": "user-login", + "type": "user_err" + }, + "user": { + "auid": "unset", + "uid": "0", + "name_map": { + "uid": "root" + } + }, + "process": { + "pid": "12866", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "174.138.17.18" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "result": "fail", + "session": "unset", + "data": { + "hostname": "174.138.17.18", + "op": "PAM:bad_ident", + "terminal": "ssh" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "root" + }, + "object": { + "secondary": "174.138.17.18", + "type": "user-session", + "primary": "ssh" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 43207 + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "vtjdUmcBTFzn_XoLhQbg", + "source": { + "@timestamp": "2018-11-27T01:51:47.702Z", + "process": { + "pid": "25972", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "201.151.178.139" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "sequence": 184389, + "result": "fail", + "session": "unset", + "data": { + "terminal": "sshd", + "op": "login", + "acct": "(unknown user)" + }, + "summary": { + "object": { + "primary": "sshd", + "secondary": "201.151.178.139", + "type": "user-session" + }, + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + } + } + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + }, + "beat": { + "version": "7.0.0-alpha1", + "name": "demo-stack-apache-01", + "hostname": "demo-stack-apache-01" + }, + "host": { + "name": "demo-stack-apache-01" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "v9jdUmcBTFzn_XoLhQbg", + "source": { + "@timestamp": "2018-11-27T01:51:47.704Z", + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "pid": "25972", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "201.151.178.139" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "result": "fail", + "session": "unset", + "data": { + "acct": "(invalid user)", + "op": "login", + "terminal": "sshd" + }, + "summary": { + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + }, + "object": { + "secondary": "201.151.178.139", + "type": "user-session", + "primary": "sshd" + } + }, + "sequence": 184390 + }, + "host": { + "name": "demo-stack-apache-01" + }, + "beat": { + "name": "demo-stack-apache-01", + "hostname": "demo-stack-apache-01", + "version": "7.0.0-alpha1" + }, + "event": { + "action": "logged-in", + "module": "auditd", + "category": "user-login", + "type": "user_login" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "wNjdUmcBTFzn_XoLhQbg", + "source": { + "@timestamp": "2018-11-27T01:51:47.788Z", + "process": { + "pid": "25972", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "201.151.178.139" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "summary": { + "actor": { + "primary": "unset", + "secondary": "root" + }, + "object": { + "primary": "ssh", + "secondary": "201.151.178.139", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 184391, + "result": "fail", + "session": "unset", + "data": { + "op": "PAM:bad_ident", + "hostname": "201.151.178.139", + "terminal": "ssh" + } + }, + "event": { + "category": "user-login", + "type": "user_err", + "action": "error", + "module": "auditd" + }, + "beat": { + "name": "demo-stack-apache-01", + "hostname": "demo-stack-apache-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-apache-01" + }, + "user": { + "auid": "unset", + "uid": "0", + "name_map": { + "uid": "root" + } + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "N9jdUmcBTFzn_XoLlgd5", + "source": { + "@timestamp": "2018-11-27T01:51:51.949Z", + "process": { + "pid": "19818", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "121.124.124.73" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "session": "unset", + "data": { + "op": "login", + "terminal": "sshd", + "acct": "(unknown user)" + }, + "summary": { + "object": { + "type": "user-session", + "primary": "sshd", + "secondary": "121.124.124.73" + }, + "how": "/usr/sbin/sshd", + "actor": { + "secondary": "(unknown user)", + "primary": "unset" + } + }, + "sequence": 142389, + "result": "fail" + }, + "beat": { + "name": "demo-stack-haproxy-01", + "hostname": "demo-stack-haproxy-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-haproxy-01" + }, + "event": { + "action": "logged-in", + "module": "auditd", + "category": "user-login", + "type": "user_login" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "ONjdUmcBTFzn_XoLlgd5", + "source": { + "@timestamp": "2018-11-27T01:51:51.951Z", + "beat": { + "name": "demo-stack-haproxy-01", + "hostname": "demo-stack-haproxy-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-haproxy-01" + }, + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + }, + "process": { + "pid": "19818", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "121.124.124.73" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "data": { + "acct": "(invalid user)", + "terminal": "sshd", + "op": "login" + }, + "summary": { + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + }, + "object": { + "secondary": "121.124.124.73", + "type": "user-session", + "primary": "sshd" + } + }, + "sequence": 142390, + "result": "fail", + "session": "unset" + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "OdjdUmcBTFzn_XoLlgd5", + "source": { + "@timestamp": "2018-11-27T01:51:52.141Z", + "event": { + "category": "user-login", + "type": "user_err", + "action": "error", + "module": "auditd" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "pid": "19818", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "121.124.124.73" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "result": "fail", + "session": "unset", + "data": { + "terminal": "ssh", + "op": "PAM:bad_ident", + "hostname": "121.124.124.73" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "root" + }, + "object": { + "type": "user-session", + "primary": "ssh", + "secondary": "121.124.124.73" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 142391 + }, + "beat": { + "name": "demo-stack-haproxy-01", + "hostname": "demo-stack-haproxy-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-haproxy-01" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "EdjfUmcBTFzn_XoLJSnD", + "source": { + "@timestamp": "2018-11-27T01:53:34.169Z", + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "pid": "19831", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "79.137.64.132" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "data": { + "acct": "(unknown user)", + "terminal": "sshd", + "op": "login" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + }, + "object": { + "primary": "sshd", + "secondary": "79.137.64.132", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 142392, + "result": "fail", + "session": "unset" + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + }, + "beat": { + "name": "demo-stack-haproxy-01", + "hostname": "demo-stack-haproxy-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-haproxy-01" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "EtjfUmcBTFzn_XoLJSnD", + "source": { + "@timestamp": "2018-11-27T01:53:34.170Z", + "source": { + "ip": "79.137.64.132" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "data": { + "acct": "(invalid user)", + "op": "login", + "terminal": "sshd" + }, + "summary": { + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + }, + "object": { + "type": "user-session", + "primary": "sshd", + "secondary": "79.137.64.132" + } + }, + "sequence": 142393, + "result": "fail", + "session": "unset" + }, + "host": { + "name": "demo-stack-haproxy-01" + }, + "beat": { + "hostname": "demo-stack-haproxy-01", + "version": "7.0.0-alpha1", + "name": "demo-stack-haproxy-01" + }, + "event": { + "type": "user_login", + "action": "logged-in", + "module": "auditd", + "category": "user-login" + }, + "user": { + "name_map": { + "uid": "root" + }, + "uid": "0", + "auid": "unset" + }, + "process": { + "pid": "19831", + "exe": "/usr/sbin/sshd" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "E9jfUmcBTFzn_XoLJSnD", + "source": { + "@timestamp": "2018-11-27T01:53:34.276Z", + "source": { + "ip": "79.137.64.132" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "session": "unset", + "data": { + "terminal": "ssh", + "hostname": "79.137.64.132", + "op": "PAM:bad_ident" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "root" + }, + "object": { + "primary": "ssh", + "secondary": "79.137.64.132", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 142394, + "result": "fail" + }, + "beat": { + "name": "demo-stack-haproxy-01", + "hostname": "demo-stack-haproxy-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-haproxy-01" + }, + "event": { + "type": "user_err", + "action": "error", + "module": "auditd", + "category": "user-login" + }, + "user": { + "name_map": { + "uid": "root" + }, + "auid": "unset", + "uid": "0" + }, + "process": { + "pid": "19831", + "exe": "/usr/sbin/sshd" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "ZtjfUmcBTFzn_XoLJila", + "source": { + "@timestamp": "2018-11-27T01:53:34.315Z", + "network": { + "direction": "incoming" + }, + "auditd": { + "result": "fail", + "session": "unset", + "data": { + "acct": "(unknown user)", + "terminal": "sshd", + "op": "login" + }, + "summary": { + "object": { + "primary": "sshd", + "secondary": "161.132.195.76", + "type": "user-session" + }, + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + } + }, + "sequence": 43211 + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + }, + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + }, + "beat": { + "name": "demo-stack-mysql-01", + "hostname": "demo-stack-mysql-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-mysql-01" + }, + "process": { + "pid": "12877", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "161.132.195.76" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "Z9jfUmcBTFzn_XoLJila", + "source": { + "@timestamp": "2018-11-27T01:53:34.315Z", + "event": { + "module": "auditd", + "category": "user-login", + "type": "user_login", + "action": "logged-in" + }, + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + }, + "beat": { + "name": "demo-stack-mysql-01", + "hostname": "demo-stack-mysql-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-mysql-01" + }, + "process": { + "pid": "12877", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "161.132.195.76" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "summary": { + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + }, + "object": { + "primary": "sshd", + "secondary": "161.132.195.76", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 43212, + "result": "fail", + "session": "unset", + "data": { + "op": "login", + "acct": "(invalid user)", + "terminal": "sshd" + } + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "aNjfUmcBTFzn_XoLJila", + "source": { + "@timestamp": "2018-11-27T01:53:34.427Z", + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + }, + "process": { + "pid": "12877", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "161.132.195.76" + }, + "beat": { + "name": "demo-stack-mysql-01", + "hostname": "demo-stack-mysql-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-mysql-01" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "data": { + "terminal": "ssh", + "hostname": "161.132.195.76", + "op": "PAM:bad_ident" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "root" + }, + "object": { + "primary": "ssh", + "secondary": "161.132.195.76", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 43213, + "result": "fail", + "session": "unset" + }, + "event": { + "module": "auditd", + "category": "user-login", + "type": "user_err", + "action": "error" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "Y9jdUmcBTFzn_XoLdARP", + "source": { + "@timestamp": "2018-11-27T01:51:43.201Z", + "auditd": { + "sequence": 43196, + "result": "fail", + "session": "unset", + "data": { + "op": "login", + "terminal": "sshd", + "acct": "(unknown user)" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + }, + "object": { + "type": "user-session", + "primary": "sshd", + "secondary": "83.222.240.60" + }, + "how": "/usr/sbin/sshd" + } + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + }, + "user": { + "auid": "unset", + "uid": "0", + "name_map": { + "uid": "root" + } + }, + "process": { + "pid": "12856", + "exe": "/usr/sbin/sshd" + }, + "beat": { + "name": "demo-stack-mysql-01", + "hostname": "demo-stack-mysql-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-mysql-01" + }, + "source": { + "ip": "83.222.240.60" + }, + "network": { + "direction": "incoming" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "ZNjdUmcBTFzn_XoLdARP", + "source": { + "@timestamp": "2018-11-27T01:51:43.205Z", + "source": { + "ip": "83.222.240.60" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "sequence": 43197, + "result": "fail", + "session": "unset", + "data": { + "acct": "(invalid user)", + "terminal": "sshd", + "op": "login" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + }, + "object": { + "primary": "sshd", + "secondary": "83.222.240.60", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + } + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + }, + "user": { + "uid": "0", + "auid": "unset", + "name_map": { + "uid": "root" + } + }, + "process": { + "exe": "/usr/sbin/sshd", + "pid": "12856" + }, + "beat": { + "version": "7.0.0-alpha1", + "name": "demo-stack-mysql-01", + "hostname": "demo-stack-mysql-01" + }, + "host": { + "name": "demo-stack-mysql-01" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "ZdjdUmcBTFzn_XoLdARP", + "source": { + "@timestamp": "2018-11-27T01:51:43.309Z", + "network": { + "direction": "incoming" + }, + "auditd": { + "sequence": 43198, + "result": "fail", + "session": "unset", + "data": { + "op": "PAM:bad_ident", + "terminal": "ssh", + "hostname": "83.222.240.60" + }, + "summary": { + "actor": { + "secondary": "root", + "primary": "unset" + }, + "object": { + "primary": "ssh", + "secondary": "83.222.240.60", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + } + }, + "event": { + "category": "user-login", + "type": "user_err", + "action": "error", + "module": "auditd" + }, + "beat": { + "name": "demo-stack-mysql-01", + "hostname": "demo-stack-mysql-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-mysql-01" + }, + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + }, + "process": { + "pid": "12856", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "83.222.240.60" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "INjdUmcBTFzn_XoLggVd", + "source": { + "@timestamp": "2018-11-27T01:51:46.789Z", + "network": { + "direction": "incoming" + }, + "auditd": { + "data": { + "op": "login", + "acct": "(unknown user)", + "terminal": "sshd" + }, + "summary": { + "object": { + "secondary": "142.93.210.90", + "type": "user-session", + "primary": "sshd" + }, + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + } + }, + "sequence": 44207, + "result": "fail", + "session": "unset" + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + }, + "user": { + "uid": "0", + "auid": "unset", + "name_map": { + "uid": "root" + } + }, + "process": { + "pid": "30014", + "exe": "/usr/sbin/sshd" + }, + "host": { + "name": "demo-stack-es-01" + }, + "beat": { + "name": "demo-stack-es-01", + "hostname": "demo-stack-es-01", + "version": "7.0.0-alpha1" + }, + "source": { + "ip": "142.93.210.90" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "IdjdUmcBTFzn_XoLggVd", + "source": { + "@timestamp": "2018-11-27T01:51:46.789Z", + "host": { + "name": "demo-stack-es-01" + }, + "event": { + "type": "user_login", + "action": "logged-in", + "module": "auditd", + "category": "user-login" + }, + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + }, + "process": { + "pid": "30014", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "142.93.210.90" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "session": "unset", + "data": { + "terminal": "sshd", + "op": "login", + "acct": "(invalid user)" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + }, + "object": { + "type": "user-session", + "primary": "sshd", + "secondary": "142.93.210.90" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 44208, + "result": "fail" + }, + "beat": { + "name": "demo-stack-es-01", + "hostname": "demo-stack-es-01", + "version": "7.0.0-alpha1" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "ItjdUmcBTFzn_XoLggVd", + "source": { + "@timestamp": "2018-11-27T01:51:47.021Z", + "network": { + "direction": "incoming" + }, + "auditd": { + "summary": { + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "root" + }, + "object": { + "type": "user-session", + "primary": "ssh", + "secondary": "142.93.210.90" + } + }, + "sequence": 44209, + "result": "fail", + "session": "unset", + "data": { + "op": "PAM:bad_ident", + "terminal": "ssh", + "hostname": "142.93.210.90" + } + }, + "event": { + "category": "user-login", + "type": "user_err", + "action": "error", + "module": "auditd" + }, + "user": { + "name_map": { + "uid": "root" + }, + "uid": "0", + "auid": "unset" + }, + "beat": { + "name": "demo-stack-es-01", + "hostname": "demo-stack-es-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-es-01" + }, + "process": { + "pid": "30014", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "142.93.210.90" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "FtjdUmcBTFzn_XoLYAMi", + "source": { + "@timestamp": "2018-11-27T01:51:38.040Z", + "user": { + "name_map": { + "uid": "root" + }, + "uid": "0", + "auid": "unset" + }, + "process": { + "pid": "19814", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "121.124.124.73" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "session": "unset", + "data": { + "hostname": "121.124.124.73", + "op": "PAM:bad_ident", + "terminal": "ssh" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "root" + }, + "object": { + "primary": "ssh", + "secondary": "121.124.124.73", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 142385, + "result": "fail" + }, + "event": { + "category": "user-login", + "type": "user_err", + "action": "error", + "module": "auditd" + }, + "beat": { + "name": "demo-stack-haproxy-01", + "hostname": "demo-stack-haproxy-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-haproxy-01" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "rtjdUmcBTFzn_XoLaAOj", + "source": { + "@timestamp": "2018-11-27T01:51:40.216Z", + "event": { + "action": "logged-in", + "module": "auditd", + "category": "user-login", + "type": "user_login" + }, + "user": { + "name_map": { + "uid": "root" + }, + "uid": "0", + "auid": "unset" + }, + "process": { + "pid": "19816", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "121.124.124.73" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "summary": { + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + }, + "object": { + "primary": "sshd", + "secondary": "121.124.124.73", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 142386, + "result": "fail", + "session": "unset", + "data": { + "op": "login", + "terminal": "sshd", + "acct": "(unknown user)" + } + }, + "host": { + "name": "demo-stack-haproxy-01" + }, + "beat": { + "name": "demo-stack-haproxy-01", + "hostname": "demo-stack-haproxy-01", + "version": "7.0.0-alpha1" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "r9jdUmcBTFzn_XoLaAOj", + "source": { + "@timestamp": "2018-11-27T01:51:40.217Z", + "host": { + "name": "demo-stack-haproxy-01" + }, + "beat": { + "name": "demo-stack-haproxy-01", + "hostname": "demo-stack-haproxy-01", + "version": "7.0.0-alpha1" + }, + "auditd": { + "summary": { + "actor": { + "secondary": "(invalid user)", + "primary": "unset" + }, + "object": { + "secondary": "121.124.124.73", + "type": "user-session", + "primary": "sshd" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 142387, + "result": "fail", + "session": "unset", + "data": { + "op": "login", + "terminal": "sshd", + "acct": "(invalid user)" + } + }, + "event": { + "type": "user_login", + "action": "logged-in", + "module": "auditd", + "category": "user-login" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "pid": "19816", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "121.124.124.73" + }, + "network": { + "direction": "incoming" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "sNjdUmcBTFzn_XoLaAOj", + "source": { + "@timestamp": "2018-11-27T01:51:40.395Z", + "auditd": { + "sequence": 142388, + "result": "fail", + "session": "unset", + "data": { + "op": "PAM:bad_ident", + "terminal": "ssh", + "hostname": "121.124.124.73" + }, + "summary": { + "actor": { + "secondary": "root", + "primary": "unset" + }, + "object": { + "primary": "ssh", + "secondary": "121.124.124.73", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + } + }, + "event": { + "category": "user-login", + "type": "user_err", + "action": "error", + "module": "auditd" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "pid": "19816", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "121.124.124.73" + }, + "network": { + "direction": "incoming" + }, + "beat": { + "name": "demo-stack-haproxy-01", + "hostname": "demo-stack-haproxy-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-haproxy-01" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "FtjdUmcBTFzn_XoL0w1m", + "source": { + "@timestamp": "2018-11-27T01:52:07.547Z", + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "pid": "32446", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "107.170.65.109" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "sequence": 186509, + "result": "fail", + "session": "unset", + "data": { + "acct": "(unknown user)", + "op": "login", + "terminal": "sshd" + }, + "summary": { + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + }, + "object": { + "type": "user-session", + "primary": "sshd", + "secondary": "107.170.65.109" + } + } + }, + "beat": { + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-redis-01" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "F9jdUmcBTFzn_XoL0w1m", + "source": { + "@timestamp": "2018-11-27T01:52:07.548Z", + "source": { + "ip": "107.170.65.109" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "sequence": 186510, + "result": "fail", + "session": "unset", + "data": { + "op": "login", + "acct": "(invalid user)", + "terminal": "sshd" + }, + "summary": { + "object": { + "primary": "sshd", + "secondary": "107.170.65.109", + "type": "user-session" + }, + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + } + } + }, + "host": { + "name": "demo-stack-redis-01" + }, + "beat": { + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1" + }, + "event": { + "action": "logged-in", + "module": "auditd", + "category": "user-login", + "type": "user_login" + }, + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + }, + "process": { + "pid": "32446", + "exe": "/usr/sbin/sshd" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "GNjdUmcBTFzn_XoL0w1m", + "source": { + "@timestamp": "2018-11-27T01:52:07.578Z", + "event": { + "category": "user-login", + "type": "user_err", + "action": "error", + "module": "auditd" + }, + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + }, + "process": { + "exe": "/usr/sbin/sshd", + "pid": "32446" + }, + "source": { + "ip": "107.170.65.109" + }, + "beat": { + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1", + "name": "demo-stack-redis-01" + }, + "host": { + "name": "demo-stack-redis-01" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "session": "unset", + "data": { + "hostname": "107.170.65.109", + "op": "PAM:bad_ident", + "terminal": "ssh" + }, + "summary": { + "actor": { + "secondary": "root", + "primary": "unset" + }, + "object": { + "secondary": "107.170.65.109", + "type": "user-session", + "primary": "ssh" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 186511, + "result": "fail" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "hdjeUmcBTFzn_XoLyiGI", + "source": { + "@timestamp": "2018-11-27T01:53:10.809Z", + "beat": { + "name": "demo-stack-mysql-01", + "hostname": "demo-stack-mysql-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-mysql-01" + }, + "auditd": { + "session": "unset", + "data": { + "acct": "(unknown user)", + "terminal": "sshd", + "op": "login" + }, + "summary": { + "actor": { + "secondary": "(unknown user)", + "primary": "unset" + }, + "object": { + "type": "user-session", + "primary": "sshd", + "secondary": "128.199.128.215" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 43208, + "result": "fail" + }, + "event": { + "action": "logged-in", + "module": "auditd", + "category": "user-login", + "type": "user_login" + }, + "user": { + "auid": "unset", + "uid": "0", + "name_map": { + "uid": "root" + } + }, + "process": { + "pid": "12875", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "128.199.128.215" + }, + "network": { + "direction": "incoming" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "htjeUmcBTFzn_XoLyiGI", + "source": { + "@timestamp": "2018-11-27T01:53:10.813Z", + "event": { + "type": "user_login", + "action": "logged-in", + "module": "auditd", + "category": "user-login" + }, + "user": { + "uid": "0", + "auid": "unset", + "name_map": { + "uid": "root" + } + }, + "process": { + "pid": "12875", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "128.199.128.215" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "session": "unset", + "data": { + "terminal": "sshd", + "op": "login", + "acct": "(invalid user)" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + }, + "object": { + "primary": "sshd", + "secondary": "128.199.128.215", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 43209, + "result": "fail" + }, + "beat": { + "name": "demo-stack-mysql-01", + "hostname": "demo-stack-mysql-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-mysql-01" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "h9jeUmcBTFzn_XoLyiGI", + "source": { + "@timestamp": "2018-11-27T01:53:11.005Z", + "host": { + "name": "demo-stack-mysql-01" + }, + "beat": { + "name": "demo-stack-mysql-01", + "hostname": "demo-stack-mysql-01", + "version": "7.0.0-alpha1" + }, + "event": { + "module": "auditd", + "category": "user-login", + "type": "user_err", + "action": "error" + }, + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + }, + "process": { + "pid": "12875", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "128.199.128.215" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "summary": { + "object": { + "primary": "ssh", + "secondary": "128.199.128.215", + "type": "user-session" + }, + "how": "/usr/sbin/sshd", + "actor": { + "secondary": "root", + "primary": "unset" + } + }, + "sequence": 43210, + "result": "fail", + "session": "unset", + "data": { + "hostname": "128.199.128.215", + "terminal": "ssh", + "op": "PAM:bad_ident" + } + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "hdjeUmcBTFzn_XoL5SQF", + "source": { + "@timestamp": "2018-11-27T01:53:17.595Z", + "beat": { + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-redis-01" + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + }, + "user": { + "name_map": { + "uid": "root" + }, + "auid": "unset", + "uid": "0" + }, + "process": { + "pid": "32449", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "107.170.65.109" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "result": "fail", + "session": "unset", + "data": { + "op": "login", + "terminal": "sshd", + "acct": "(unknown user)" + }, + "summary": { + "actor": { + "secondary": "(unknown user)", + "primary": "unset" + }, + "object": { + "secondary": "107.170.65.109", + "type": "user-session", + "primary": "sshd" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 186512 + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "htjeUmcBTFzn_XoL5SQF", + "source": { + "@timestamp": "2018-11-27T01:53:17.596Z", + "auditd": { + "data": { + "op": "login", + "acct": "(invalid user)", + "terminal": "sshd" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + }, + "object": { + "type": "user-session", + "primary": "sshd", + "secondary": "107.170.65.109" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 186513, + "result": "fail", + "session": "unset" + }, + "event": { + "action": "logged-in", + "module": "auditd", + "category": "user-login", + "type": "user_login" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "beat": { + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-redis-01" + }, + "process": { + "exe": "/usr/sbin/sshd", + "pid": "32449" + }, + "source": { + "ip": "107.170.65.109" + }, + "network": { + "direction": "incoming" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "h9jeUmcBTFzn_XoL5SQF", + "source": { + "@timestamp": "2018-11-27T01:53:17.627Z", + "beat": { + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1" + }, + "event": { + "category": "user-login", + "type": "user_err", + "action": "error", + "module": "auditd" + }, + "user": { + "auid": "unset", + "uid": "0", + "name_map": { + "uid": "root" + } + }, + "process": { + "pid": "32449", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "107.170.65.109" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "summary": { + "actor": { + "primary": "unset", + "secondary": "root" + }, + "object": { + "primary": "ssh", + "secondary": "107.170.65.109", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 186514, + "result": "fail", + "session": "unset", + "data": { + "terminal": "ssh", + "op": "PAM:bad_ident", + "hostname": "107.170.65.109" + } + }, + "host": { + "name": "demo-stack-redis-01" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "ytjdUmcBTFzn_XoL0gs9", + "source": { + "@timestamp": "2018-11-27T01:52:07.159Z", + "network": { + "direction": "incoming" + }, + "auditd": { + "session": "unset", + "data": { + "acct": "(unknown user)", + "terminal": "sshd", + "op": "login" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + }, + "object": { + "type": "user-session", + "primary": "sshd", + "secondary": "153.19.40.20" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 43199, + "result": "fail" + }, + "event": { + "module": "auditd", + "category": "user-login", + "type": "user_login", + "action": "logged-in" + }, + "beat": { + "name": "demo-stack-mysql-01", + "hostname": "demo-stack-mysql-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-mysql-01" + }, + "user": { + "name_map": { + "uid": "root" + }, + "auid": "unset", + "uid": "0" + }, + "process": { + "pid": "12863", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "153.19.40.20" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "y9jdUmcBTFzn_XoL0gs9", + "source": { + "@timestamp": "2018-11-27T01:52:07.159Z", + "beat": { + "name": "demo-stack-mysql-01", + "hostname": "demo-stack-mysql-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-mysql-01" + }, + "user": { + "auid": "unset", + "uid": "0", + "name_map": { + "uid": "root" + } + }, + "process": { + "exe": "/usr/sbin/sshd", + "pid": "12863" + }, + "source": { + "ip": "153.19.40.20" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "sequence": 43200, + "result": "fail", + "session": "unset", + "data": { + "acct": "(invalid user)", + "op": "login", + "terminal": "sshd" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + }, + "object": { + "type": "user-session", + "primary": "sshd", + "secondary": "153.19.40.20" + }, + "how": "/usr/sbin/sshd" + } + }, + "event": { + "action": "logged-in", + "module": "auditd", + "category": "user-login", + "type": "user_login" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "zNjdUmcBTFzn_XoL0gs9", + "source": { + "@timestamp": "2018-11-27T01:52:07.287Z", + "network": { + "direction": "incoming" + }, + "auditd": { + "session": "unset", + "data": { + "terminal": "ssh", + "op": "PAM:bad_ident", + "hostname": "153.19.40.20" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "root" + }, + "object": { + "type": "user-session", + "primary": "ssh", + "secondary": "153.19.40.20" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 43201, + "result": "fail" + }, + "event": { + "category": "user-login", + "type": "user_err", + "action": "error", + "module": "auditd" + }, + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + }, + "beat": { + "hostname": "demo-stack-mysql-01", + "version": "7.0.0-alpha1", + "name": "demo-stack-mysql-01" + }, + "host": { + "name": "demo-stack-mysql-01" + }, + "process": { + "pid": "12863", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "153.19.40.20" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "KNjkUmcBTFzn_XoLfZ-j", + "source": { + "@timestamp": "2018-11-27T01:59:24.344Z", + "process": { + "pid": "783", + "exe": "/usr/sbin/sshd" + }, + "beat": { + "name": "demo-stack-nginx-01", + "hostname": "demo-stack-nginx-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-nginx-01" + }, + "source": { + "ip": "91.134.241.32" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "result": "fail", + "session": "unset", + "data": { + "terminal": "sshd", + "acct": "(unknown user)", + "op": "login" + }, + "summary": { + "actor": { + "secondary": "(unknown user)", + "primary": "unset" + }, + "object": { + "type": "user-session", + "primary": "sshd", + "secondary": "91.134.241.32" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 192562 + }, + "event": { + "action": "logged-in", + "module": "auditd", + "category": "user-login", + "type": "user_login" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "KdjkUmcBTFzn_XoLfZ-j", + "source": { + "@timestamp": "2018-11-27T01:59:24.345Z", + "network": { + "direction": "incoming" + }, + "auditd": { + "session": "unset", + "data": { + "op": "login", + "acct": "(invalid user)", + "terminal": "sshd" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + }, + "object": { + "primary": "sshd", + "secondary": "91.134.241.32", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 192563, + "result": "fail" + }, + "event": { + "type": "user_login", + "action": "logged-in", + "module": "auditd", + "category": "user-login" + }, + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + }, + "beat": { + "name": "demo-stack-nginx-01", + "hostname": "demo-stack-nginx-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-nginx-01" + }, + "process": { + "exe": "/usr/sbin/sshd", + "pid": "783" + }, + "source": { + "ip": "91.134.241.32" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "KtjkUmcBTFzn_XoLfZ-j", + "source": { + "@timestamp": "2018-11-27T01:59:24.452Z", + "beat": { + "name": "demo-stack-nginx-01", + "hostname": "demo-stack-nginx-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-nginx-01" + }, + "source": { + "ip": "91.134.241.32" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "data": { + "op": "PAM:bad_ident", + "hostname": "91.134.241.32", + "terminal": "ssh" + }, + "summary": { + "actor": { + "secondary": "root", + "primary": "unset" + }, + "object": { + "primary": "ssh", + "secondary": "91.134.241.32", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 192564, + "result": "fail", + "session": "unset" + }, + "event": { + "module": "auditd", + "category": "user-login", + "type": "user_err", + "action": "error" + }, + "user": { + "name_map": { + "uid": "root" + }, + "uid": "0", + "auid": "unset" + }, + "process": { + "pid": "783", + "exe": "/usr/sbin/sshd" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "QdjkUmcBTFzn_XoLgZ_0", + "source": { + "@timestamp": "2018-11-27T01:59:25.449Z", + "beat": { + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1" + }, + "event": { + "type": "user_login", + "action": "logged-in", + "module": "auditd", + "category": "user-login" + }, + "user": { + "uid": "0", + "auid": "unset", + "name_map": { + "uid": "root" + } + }, + "process": { + "exe": "/usr/sbin/sshd", + "pid": "32500" + }, + "source": { + "ip": "107.170.65.109" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "sequence": 186542, + "result": "fail", + "session": "unset", + "data": { + "terminal": "sshd", + "acct": "(unknown user)", + "op": "login" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + }, + "object": { + "primary": "sshd", + "secondary": "107.170.65.109", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + } + }, + "host": { + "name": "demo-stack-redis-01" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "QtjkUmcBTFzn_XoLgZ_0", + "source": { + "@timestamp": "2018-11-27T01:59:25.450Z", + "host": { + "name": "demo-stack-redis-01" + }, + "event": { + "type": "user_login", + "action": "logged-in", + "module": "auditd", + "category": "user-login" + }, + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + }, + "process": { + "pid": "32500", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "107.170.65.109" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "sequence": 186543, + "result": "fail", + "session": "unset", + "data": { + "op": "login", + "acct": "(invalid user)", + "terminal": "sshd" + }, + "summary": { + "object": { + "type": "user-session", + "primary": "sshd", + "secondary": "107.170.65.109" + }, + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + } + } + }, + "beat": { + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "Q9jkUmcBTFzn_XoLgZ_0", + "source": { + "@timestamp": "2018-11-27T01:59:25.481Z", + "network": { + "direction": "incoming" + }, + "auditd": { + "summary": { + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "root" + }, + "object": { + "primary": "ssh", + "secondary": "107.170.65.109", + "type": "user-session" + } + }, + "sequence": 186544, + "result": "fail", + "session": "unset", + "data": { + "op": "PAM:bad_ident", + "hostname": "107.170.65.109", + "terminal": "ssh" + } + }, + "event": { + "category": "user-login", + "type": "user_err", + "action": "error", + "module": "auditd" + }, + "beat": { + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-redis-01" + }, + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + }, + "process": { + "pid": "32500", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "107.170.65.109" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "jdjjUmcBTFzn_XoLToQx", + "source": { + "@timestamp": "2018-11-27T01:58:06.663Z", + "auditd": { + "data": { + "op": "login", + "terminal": "sshd", + "acct": "(unknown user)" + }, + "summary": { + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + }, + "object": { + "primary": "sshd", + "secondary": "107.170.65.109", + "type": "user-session" + } + }, + "sequence": 186539, + "result": "fail", + "session": "unset" + }, + "beat": { + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-redis-01" + }, + "event": { + "action": "logged-in", + "module": "auditd", + "category": "user-login", + "type": "user_login" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "pid": "32492", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "107.170.65.109" + }, + "network": { + "direction": "incoming" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "jtjjUmcBTFzn_XoLToQx", + "source": { + "@timestamp": "2018-11-27T01:58:06.664Z", + "host": { + "name": "demo-stack-redis-01" + }, + "process": { + "pid": "32492", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "107.170.65.109" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "sequence": 186540, + "result": "fail", + "session": "unset", + "data": { + "terminal": "sshd", + "op": "login", + "acct": "(invalid user)" + }, + "summary": { + "object": { + "type": "user-session", + "primary": "sshd", + "secondary": "107.170.65.109" + }, + "how": "/usr/sbin/sshd", + "actor": { + "secondary": "(invalid user)", + "primary": "unset" + } + } + }, + "event": { + "module": "auditd", + "category": "user-login", + "type": "user_login", + "action": "logged-in" + }, + "user": { + "uid": "0", + "auid": "unset", + "name_map": { + "uid": "root" + } + }, + "beat": { + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "j9jjUmcBTFzn_XoLToQx", + "source": { + "@timestamp": "2018-11-27T01:58:06.694Z", + "event": { + "category": "user-login", + "type": "user_err", + "action": "error", + "module": "auditd" + }, + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + }, + "beat": { + "version": "7.0.0-alpha1", + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01" + }, + "host": { + "name": "demo-stack-redis-01" + }, + "process": { + "exe": "/usr/sbin/sshd", + "pid": "32492" + }, + "source": { + "ip": "107.170.65.109" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "result": "fail", + "session": "unset", + "data": { + "hostname": "107.170.65.109", + "terminal": "ssh", + "op": "PAM:bad_ident" + }, + "summary": { + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "root" + }, + "object": { + "primary": "ssh", + "secondary": "107.170.65.109", + "type": "user-session" + } + }, + "sequence": 186541 + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "ZdjiUmcBTFzn_XoLImvA", + "source": { + "@timestamp": "2018-11-27T01:56:50.005Z", + "auditd": { + "result": "fail", + "session": "unset", + "data": { + "acct": "(unknown user)", + "op": "login", + "terminal": "sshd" + }, + "summary": { + "object": { + "secondary": "107.170.65.109", + "type": "user-session", + "primary": "sshd" + }, + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + } + }, + "sequence": 186530 + }, + "event": { + "type": "user_login", + "action": "logged-in", + "module": "auditd", + "category": "user-login" + }, + "user": { + "name_map": { + "uid": "root" + }, + "auid": "unset", + "uid": "0" + }, + "process": { + "pid": "32480", + "exe": "/usr/sbin/sshd" + }, + "beat": { + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-redis-01" + }, + "source": { + "ip": "107.170.65.109" + }, + "network": { + "direction": "incoming" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "ZtjiUmcBTFzn_XoLImvA", + "source": { + "@timestamp": "2018-11-27T01:56:50.006Z", + "network": { + "direction": "incoming" + }, + "auditd": { + "sequence": 186531, + "result": "fail", + "session": "unset", + "data": { + "op": "login", + "acct": "(invalid user)", + "terminal": "sshd" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + }, + "object": { + "primary": "sshd", + "secondary": "107.170.65.109", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + } + }, + "host": { + "name": "demo-stack-redis-01" + }, + "beat": { + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1" + }, + "event": { + "action": "logged-in", + "module": "auditd", + "category": "user-login", + "type": "user_login" + }, + "user": { + "name_map": { + "uid": "root" + }, + "uid": "0", + "auid": "unset" + }, + "process": { + "pid": "32480", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "107.170.65.109" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "Z9jiUmcBTFzn_XoLImvA", + "source": { + "@timestamp": "2018-11-27T01:56:50.037Z", + "host": { + "name": "demo-stack-redis-01" + }, + "event": { + "category": "user-login", + "type": "user_err", + "action": "error", + "module": "auditd" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "pid": "32480", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "107.170.65.109" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "data": { + "terminal": "ssh", + "hostname": "107.170.65.109", + "op": "PAM:bad_ident" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "root" + }, + "object": { + "secondary": "107.170.65.109", + "type": "user-session", + "primary": "ssh" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 186532, + "result": "fail", + "session": "unset" + }, + "beat": { + "version": "7.0.0-alpha1", + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "etjlUmcBTFzn_XoLHawN", + "source": { + "@timestamp": "2018-11-27T02:00:05.155Z", + "user": { + "name_map": { + "uid": "root" + }, + "uid": "0", + "auid": "unset" + }, + "process": { + "exe": "/usr/sbin/sshd", + "pid": "785" + }, + "source": { + "ip": "212.159.18.107" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "sequence": 192565, + "result": "fail", + "session": "unset", + "data": { + "acct": "(unknown user)", + "op": "login", + "terminal": "sshd" + }, + "summary": { + "object": { + "secondary": "212.159.18.107", + "type": "user-session", + "primary": "sshd" + }, + "how": "/usr/sbin/sshd", + "actor": { + "secondary": "(unknown user)", + "primary": "unset" + } + } + }, + "beat": { + "name": "demo-stack-nginx-01", + "hostname": "demo-stack-nginx-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-nginx-01" + }, + "event": { + "module": "auditd", + "category": "user-login", + "type": "user_login", + "action": "logged-in" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "e9jlUmcBTFzn_XoLHawN", + "source": { + "@timestamp": "2018-11-27T02:00:05.156Z", + "process": { + "pid": "785", + "exe": "/usr/sbin/sshd" + }, + "beat": { + "hostname": "demo-stack-nginx-01", + "version": "7.0.0-alpha1", + "name": "demo-stack-nginx-01" + }, + "host": { + "name": "demo-stack-nginx-01" + }, + "source": { + "ip": "212.159.18.107" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "session": "unset", + "data": { + "op": "login", + "terminal": "sshd", + "acct": "(invalid user)" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + }, + "object": { + "primary": "sshd", + "secondary": "212.159.18.107", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 192566, + "result": "fail" + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + }, + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "fNjlUmcBTFzn_XoLHawN", + "source": { + "@timestamp": "2018-11-27T02:00:05.265Z", + "beat": { + "name": "demo-stack-nginx-01", + "hostname": "demo-stack-nginx-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-nginx-01" + }, + "source": { + "ip": "212.159.18.107" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "data": { + "op": "PAM:bad_ident", + "hostname": "212.159.18.107", + "terminal": "ssh" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "root" + }, + "object": { + "primary": "ssh", + "secondary": "212.159.18.107", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 192567, + "result": "fail", + "session": "unset" + }, + "event": { + "type": "user_err", + "action": "error", + "module": "auditd", + "category": "user-login" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "pid": "785", + "exe": "/usr/sbin/sshd" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "ZtjjUmcBTFzn_XoLIYEi", + "source": { + "@timestamp": "2018-11-27T01:57:55.128Z", + "user": { + "name_map": { + "uid": "root" + }, + "uid": "0", + "auid": "unset" + }, + "process": { + "pid": "32490", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "190.153.219.50" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "sequence": 186536, + "result": "fail", + "session": "unset", + "data": { + "acct": "(unknown user)", + "op": "login", + "terminal": "sshd" + }, + "summary": { + "actor": { + "secondary": "(unknown user)", + "primary": "unset" + }, + "object": { + "primary": "sshd", + "secondary": "190.153.219.50", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + } + }, + "event": { + "module": "auditd", + "category": "user-login", + "type": "user_login", + "action": "logged-in" + }, + "beat": { + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-redis-01" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "Z9jjUmcBTFzn_XoLIYEi", + "source": { + "@timestamp": "2018-11-27T01:57:55.129Z", + "host": { + "name": "demo-stack-redis-01" + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "pid": "32490", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "190.153.219.50" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "data": { + "terminal": "sshd", + "acct": "(invalid user)", + "op": "login" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + }, + "object": { + "secondary": "190.153.219.50", + "type": "user-session", + "primary": "sshd" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 186537, + "result": "fail", + "session": "unset" + }, + "beat": { + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "aNjjUmcBTFzn_XoLIYEi", + "source": { + "@timestamp": "2018-11-27T01:57:55.284Z", + "network": { + "direction": "incoming" + }, + "beat": { + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-redis-01" + }, + "auditd": { + "sequence": 186538, + "result": "fail", + "session": "unset", + "data": { + "hostname": "190.153.219.50", + "terminal": "ssh", + "op": "PAM:bad_ident" + }, + "summary": { + "object": { + "primary": "ssh", + "secondary": "190.153.219.50", + "type": "user-session" + }, + "how": "/usr/sbin/sshd", + "actor": { + "secondary": "root", + "primary": "unset" + } + } + }, + "event": { + "category": "user-login", + "type": "user_err", + "action": "error", + "module": "auditd" + }, + "user": { + "name_map": { + "uid": "root" + }, + "uid": "0", + "auid": "unset" + }, + "process": { + "pid": "32490", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "190.153.219.50" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "ItjiUmcBTFzn_XoLZXBu", + "source": { + "@timestamp": "2018-11-27T01:57:07.073Z", + "user": { + "uid": "0", + "auid": "unset", + "name_map": { + "uid": "root" + } + }, + "process": { + "pid": "12897", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "151.80.144.39" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "data": { + "op": "login", + "acct": "(unknown user)", + "terminal": "sshd" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + }, + "object": { + "type": "user-session", + "primary": "sshd", + "secondary": "151.80.144.39" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 43214, + "result": "fail", + "session": "unset" + }, + "event": { + "module": "auditd", + "category": "user-login", + "type": "user_login", + "action": "logged-in" + }, + "beat": { + "name": "demo-stack-mysql-01", + "hostname": "demo-stack-mysql-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-mysql-01" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "I9jiUmcBTFzn_XoLZXBu", + "source": { + "@timestamp": "2018-11-27T01:57:07.073Z", + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + }, + "user": { + "auid": "unset", + "uid": "0", + "name_map": { + "uid": "root" + } + }, + "process": { + "pid": "12897", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "151.80.144.39" + }, + "beat": { + "version": "7.0.0-alpha1", + "name": "demo-stack-mysql-01", + "hostname": "demo-stack-mysql-01" + }, + "host": { + "name": "demo-stack-mysql-01" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "result": "fail", + "session": "unset", + "data": { + "acct": "(invalid user)", + "terminal": "sshd", + "op": "login" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + }, + "object": { + "secondary": "151.80.144.39", + "type": "user-session", + "primary": "sshd" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 43215 + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "JNjiUmcBTFzn_XoLZXBu", + "source": { + "@timestamp": "2018-11-27T01:57:07.181Z", + "network": { + "direction": "incoming" + }, + "auditd": { + "summary": { + "object": { + "primary": "ssh", + "secondary": "151.80.144.39", + "type": "user-session" + }, + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "root" + } + }, + "sequence": 43216, + "result": "fail", + "session": "unset", + "data": { + "op": "PAM:bad_ident", + "hostname": "151.80.144.39", + "terminal": "ssh" + } + }, + "event": { + "action": "error", + "module": "auditd", + "category": "user-login", + "type": "user_err" + }, + "user": { + "name_map": { + "uid": "root" + }, + "uid": "0", + "auid": "unset" + }, + "beat": { + "hostname": "demo-stack-mysql-01", + "version": "7.0.0-alpha1", + "name": "demo-stack-mysql-01" + }, + "host": { + "name": "demo-stack-mysql-01" + }, + "process": { + "exe": "/usr/sbin/sshd", + "pid": "12897" + }, + "source": { + "ip": "151.80.144.39" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "1djjUmcBTFzn_XoLD39T", + "source": { + "@timestamp": "2018-11-27T01:57:50.568Z", + "network": { + "direction": "incoming" + }, + "auditd": { + "session": "unset", + "data": { + "op": "login", + "terminal": "sshd", + "acct": "(unknown user)" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + }, + "object": { + "primary": "sshd", + "secondary": "61.73.98.60", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 186533, + "result": "fail" + }, + "beat": { + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-redis-01" + }, + "event": { + "type": "user_login", + "action": "logged-in", + "module": "auditd", + "category": "user-login" + }, + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + }, + "process": { + "pid": "32487", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "61.73.98.60" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "1tjjUmcBTFzn_XoLD39T", + "source": { + "@timestamp": "2018-11-27T01:57:50.570Z", + "host": { + "name": "demo-stack-redis-01" + }, + "beat": { + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1", + "name": "demo-stack-redis-01" + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + }, + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + }, + "process": { + "pid": "32487", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "61.73.98.60" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "session": "unset", + "data": { + "op": "login", + "acct": "(invalid user)", + "terminal": "sshd" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + }, + "object": { + "type": "user-session", + "primary": "sshd", + "secondary": "61.73.98.60" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 186534, + "result": "fail" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "19jjUmcBTFzn_XoLD39T", + "source": { + "@timestamp": "2018-11-27T01:57:50.730Z", + "host": { + "name": "demo-stack-redis-01" + }, + "beat": { + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1" + }, + "event": { + "category": "user-login", + "type": "user_err", + "action": "error", + "module": "auditd" + }, + "user": { + "uid": "0", + "auid": "unset", + "name_map": { + "uid": "root" + } + }, + "process": { + "pid": "32487", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "61.73.98.60" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "sequence": 186535, + "result": "fail", + "session": "unset", + "data": { + "hostname": "61.73.98.60", + "terminal": "ssh", + "op": "PAM:bad_ident" + }, + "summary": { + "actor": { + "secondary": "root", + "primary": "unset" + }, + "object": { + "primary": "ssh", + "secondary": "61.73.98.60", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + } + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "c9jiUmcBTFzn_XoL9X2Y", + "source": { + "@timestamp": "2018-11-27T01:57:43.982Z", + "network": { + "direction": "incoming" + }, + "auditd": { + "sequence": 192559, + "result": "fail", + "session": "unset", + "data": { + "op": "login", + "acct": "(unknown user)", + "terminal": "sshd" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + }, + "object": { + "type": "user-session", + "primary": "sshd", + "secondary": "193.70.39.84" + }, + "how": "/usr/sbin/sshd" + } + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "beat": { + "name": "demo-stack-nginx-01", + "hostname": "demo-stack-nginx-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-nginx-01" + }, + "process": { + "pid": "769", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "193.70.39.84" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "dNjiUmcBTFzn_XoL9X2Y", + "source": { + "@timestamp": "2018-11-27T01:57:43.983Z", + "beat": { + "name": "demo-stack-nginx-01", + "hostname": "demo-stack-nginx-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-nginx-01" + }, + "process": { + "exe": "/usr/sbin/sshd", + "pid": "769" + }, + "source": { + "ip": "193.70.39.84" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "session": "unset", + "data": { + "op": "login", + "acct": "(invalid user)", + "terminal": "sshd" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + }, + "object": { + "primary": "sshd", + "secondary": "193.70.39.84", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 192560, + "result": "fail" + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + }, + "user": { + "auid": "unset", + "uid": "0", + "name_map": { + "uid": "root" + } + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "ddjiUmcBTFzn_XoL9X2Y", + "source": { + "@timestamp": "2018-11-27T01:57:44.094Z", + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "pid": "769", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "193.70.39.84" + }, + "beat": { + "name": "demo-stack-nginx-01", + "hostname": "demo-stack-nginx-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-nginx-01" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "session": "unset", + "data": { + "terminal": "ssh", + "hostname": "193.70.39.84", + "op": "PAM:bad_ident" + }, + "summary": { + "actor": { + "secondary": "root", + "primary": "unset" + }, + "object": { + "primary": "ssh", + "secondary": "193.70.39.84", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 192561, + "result": "fail" + }, + "event": { + "action": "error", + "module": "auditd", + "category": "user-login", + "type": "user_err" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "lNjkUmcBTFzn_XoLRpqM", + "source": { + "@timestamp": "2018-11-27T01:59:10.239Z", + "host": { + "name": "demo-stack-es-01" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "summary": { + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + }, + "object": { + "secondary": "104.208.143.92", + "type": "user-session", + "primary": "sshd" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 44219, + "result": "fail", + "session": "unset", + "data": { + "op": "login", + "acct": "(unknown user)", + "terminal": "sshd" + } + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + }, + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + }, + "process": { + "pid": "30166", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "104.208.143.92" + }, + "beat": { + "version": "7.0.0-alpha1", + "name": "demo-stack-es-01", + "hostname": "demo-stack-es-01" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "ldjkUmcBTFzn_XoLRpqM", + "source": { + "@timestamp": "2018-11-27T01:59:10.239Z", + "source": { + "ip": "104.208.143.92" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "data": { + "terminal": "sshd", + "op": "login", + "acct": "(invalid user)" + }, + "summary": { + "object": { + "primary": "sshd", + "secondary": "104.208.143.92", + "type": "user-session" + }, + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + } + }, + "sequence": 44220, + "result": "fail", + "session": "unset" + }, + "beat": { + "name": "demo-stack-es-01", + "hostname": "demo-stack-es-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-es-01" + }, + "event": { + "module": "auditd", + "category": "user-login", + "type": "user_login", + "action": "logged-in" + }, + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + }, + "process": { + "pid": "30166", + "exe": "/usr/sbin/sshd" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "ltjkUmcBTFzn_XoLRpqM", + "source": { + "@timestamp": "2018-11-27T01:59:10.283Z", + "host": { + "name": "demo-stack-es-01" + }, + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + }, + "process": { + "exe": "/usr/sbin/sshd", + "pid": "30166" + }, + "source": { + "ip": "104.208.143.92" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "sequence": 44221, + "result": "fail", + "session": "unset", + "data": { + "terminal": "ssh", + "op": "PAM:bad_ident", + "hostname": "104.208.143.92" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "root" + }, + "object": { + "secondary": "104.208.143.92", + "type": "user-session", + "primary": "ssh" + }, + "how": "/usr/sbin/sshd" + } + }, + "event": { + "category": "user-login", + "type": "user_err", + "action": "error", + "module": "auditd" + }, + "beat": { + "hostname": "demo-stack-es-01", + "version": "7.0.0-alpha1", + "name": "demo-stack-es-01" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "NdnsUmcBTFzn_XoLslKD", + "source": { + "@timestamp": "2018-11-27T02:08:22.166Z", + "process": { + "pid": "30352", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "110.36.221.182" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "summary": { + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + }, + "object": { + "primary": "sshd", + "secondary": "110.36.221.182", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 44231, + "result": "fail", + "session": "unset", + "data": { + "terminal": "sshd", + "op": "login", + "acct": "(unknown user)" + } + }, + "beat": { + "name": "demo-stack-es-01", + "hostname": "demo-stack-es-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-es-01" + }, + "event": { + "module": "auditd", + "category": "user-login", + "type": "user_login", + "action": "logged-in" + }, + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "NtnsUmcBTFzn_XoLslKD", + "source": { + "@timestamp": "2018-11-27T02:08:22.166Z", + "auditd": { + "sequence": 44232, + "result": "fail", + "session": "unset", + "data": { + "terminal": "sshd", + "acct": "(invalid user)", + "op": "login" + }, + "summary": { + "object": { + "primary": "sshd", + "secondary": "110.36.221.182", + "type": "user-session" + }, + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + } + } + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + }, + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + }, + "beat": { + "hostname": "demo-stack-es-01", + "version": "7.0.0-alpha1", + "name": "demo-stack-es-01" + }, + "host": { + "name": "demo-stack-es-01" + }, + "process": { + "pid": "30352", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "110.36.221.182" + }, + "network": { + "direction": "incoming" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "N9nsUmcBTFzn_XoLslKD", + "source": { + "@timestamp": "2018-11-27T02:08:22.414Z", + "beat": { + "name": "demo-stack-es-01", + "hostname": "demo-stack-es-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-es-01" + }, + "event": { + "module": "auditd", + "category": "user-login", + "type": "user_err", + "action": "error" + }, + "user": { + "auid": "unset", + "uid": "0", + "name_map": { + "uid": "root" + } + }, + "process": { + "pid": "30352", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "110.36.221.182" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "result": "fail", + "session": "unset", + "data": { + "terminal": "ssh", + "hostname": "110.36.221.182", + "op": "PAM:bad_ident" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "root" + }, + "object": { + "type": "user-session", + "primary": "ssh", + "secondary": "110.36.221.182" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 44233 + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "9tnsUmcBTFzn_XoLt1Lw", + "source": { + "@timestamp": "2018-11-27T02:08:23.554Z", + "event": { + "type": "user_login", + "action": "logged-in", + "module": "auditd", + "category": "user-login" + }, + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + }, + "process": { + "exe": "/usr/sbin/sshd", + "pid": "30354" + }, + "source": { + "ip": "61.73.98.60" + }, + "network": { + "direction": "incoming" + }, + "beat": { + "hostname": "demo-stack-es-01", + "version": "7.0.0-alpha1", + "name": "demo-stack-es-01" + }, + "host": { + "name": "demo-stack-es-01" + }, + "auditd": { + "sequence": 44234, + "result": "fail", + "session": "unset", + "data": { + "op": "login", + "acct": "(unknown user)", + "terminal": "sshd" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + }, + "object": { + "primary": "sshd", + "secondary": "61.73.98.60", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + } + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "99nsUmcBTFzn_XoLt1Lw", + "source": { + "@timestamp": "2018-11-27T02:08:23.554Z", + "source": { + "ip": "61.73.98.60" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "result": "fail", + "session": "unset", + "data": { + "op": "login", + "terminal": "sshd", + "acct": "(invalid user)" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + }, + "object": { + "type": "user-session", + "primary": "sshd", + "secondary": "61.73.98.60" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 44235 + }, + "event": { + "type": "user_login", + "action": "logged-in", + "module": "auditd", + "category": "user-login" + }, + "beat": { + "name": "demo-stack-es-01", + "hostname": "demo-stack-es-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-es-01" + }, + "user": { + "uid": "0", + "auid": "unset", + "name_map": { + "uid": "root" + } + }, + "process": { + "pid": "30354", + "exe": "/usr/sbin/sshd" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "-NnsUmcBTFzn_XoLt1Lw", + "source": { + "@timestamp": "2018-11-27T02:08:23.714Z", + "network": { + "direction": "incoming" + }, + "auditd": { + "result": "fail", + "session": "unset", + "data": { + "terminal": "ssh", + "op": "PAM:bad_ident", + "hostname": "61.73.98.60" + }, + "summary": { + "actor": { + "secondary": "root", + "primary": "unset" + }, + "object": { + "primary": "ssh", + "secondary": "61.73.98.60", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 44236 + }, + "event": { + "type": "user_err", + "action": "error", + "module": "auditd", + "category": "user-login" + }, + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + }, + "process": { + "exe": "/usr/sbin/sshd", + "pid": "30354" + }, + "beat": { + "hostname": "demo-stack-es-01", + "version": "7.0.0-alpha1", + "name": "demo-stack-es-01" + }, + "host": { + "name": "demo-stack-es-01" + }, + "source": { + "ip": "61.73.98.60" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "1dnpUmcBTFzn_XoLNAWm", + "source": { + "@timestamp": "2018-11-27T02:04:33.307Z", + "event": { + "type": "user_login", + "action": "logged-in", + "module": "auditd", + "category": "user-login" + }, + "user": { + "auid": "unset", + "uid": "0", + "name_map": { + "uid": "root" + } + }, + "process": { + "pid": "26060", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "151.80.136.92" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "session": "unset", + "data": { + "terminal": "sshd", + "acct": "(unknown user)", + "op": "login" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + }, + "object": { + "primary": "sshd", + "secondary": "151.80.136.92", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 184405, + "result": "fail" + }, + "host": { + "name": "demo-stack-apache-01" + }, + "beat": { + "name": "demo-stack-apache-01", + "hostname": "demo-stack-apache-01", + "version": "7.0.0-alpha1" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "1tnpUmcBTFzn_XoLNAWm", + "source": { + "@timestamp": "2018-11-27T02:04:33.309Z", + "source": { + "ip": "151.80.136.92" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "sequence": 184406, + "result": "fail", + "session": "unset", + "data": { + "terminal": "sshd", + "acct": "(invalid user)", + "op": "login" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + }, + "object": { + "primary": "sshd", + "secondary": "151.80.136.92", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + } + }, + "beat": { + "name": "demo-stack-apache-01", + "hostname": "demo-stack-apache-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-apache-01" + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "pid": "26060", + "exe": "/usr/sbin/sshd" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "19npUmcBTFzn_XoLNAWm", + "source": { + "@timestamp": "2018-11-27T02:04:33.423Z", + "beat": { + "name": "demo-stack-apache-01", + "hostname": "demo-stack-apache-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-apache-01" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "data": { + "hostname": "151.80.136.92", + "terminal": "ssh", + "op": "PAM:bad_ident" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "root" + }, + "object": { + "type": "user-session", + "primary": "ssh", + "secondary": "151.80.136.92" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 184407, + "result": "fail", + "session": "unset" + }, + "event": { + "category": "user-login", + "type": "user_err", + "action": "error", + "module": "auditd" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "pid": "26060", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "151.80.136.92" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "3tnpUmcBTFzn_XoLOwYm", + "source": { + "@timestamp": "2018-11-27T02:04:35.004Z", + "network": { + "direction": "incoming" + }, + "auditd": { + "result": "fail", + "session": "unset", + "data": { + "hostname": "177.124.89.14", + "op": "PAM:bad_ident", + "terminal": "ssh" + }, + "summary": { + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "root" + }, + "object": { + "secondary": "177.124.89.14", + "type": "user-session", + "primary": "ssh" + } + }, + "sequence": 184408 + }, + "event": { + "category": "user-login", + "type": "user_err", + "action": "error", + "module": "auditd" + }, + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + }, + "process": { + "pid": "26062", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "177.124.89.14" + }, + "beat": { + "name": "demo-stack-apache-01", + "hostname": "demo-stack-apache-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-apache-01" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "6tnpUmcBTFzn_XoLZAmP", + "source": { + "@timestamp": "2018-11-27T02:04:45.605Z", + "process": { + "pid": "32532", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "107.170.65.109" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "result": "fail", + "session": "unset", + "data": { + "acct": "(unknown user)", + "op": "login", + "terminal": "sshd" + }, + "summary": { + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + }, + "object": { + "primary": "sshd", + "secondary": "107.170.65.109", + "type": "user-session" + } + }, + "sequence": 186557 + }, + "beat": { + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1", + "name": "demo-stack-redis-01" + }, + "host": { + "name": "demo-stack-redis-01" + }, + "event": { + "action": "logged-in", + "module": "auditd", + "category": "user-login", + "type": "user_login" + }, + "user": { + "name_map": { + "uid": "root" + }, + "uid": "0", + "auid": "unset" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "69npUmcBTFzn_XoLZAmP", + "source": { + "@timestamp": "2018-11-27T02:04:45.606Z", + "host": { + "name": "demo-stack-redis-01" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "result": "fail", + "session": "unset", + "data": { + "terminal": "sshd", + "acct": "(invalid user)", + "op": "login" + }, + "summary": { + "actor": { + "secondary": "(invalid user)", + "primary": "unset" + }, + "object": { + "type": "user-session", + "primary": "sshd", + "secondary": "107.170.65.109" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 186558 + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + }, + "user": { + "uid": "0", + "auid": "unset", + "name_map": { + "uid": "root" + } + }, + "process": { + "exe": "/usr/sbin/sshd", + "pid": "32532" + }, + "source": { + "ip": "107.170.65.109" + }, + "beat": { + "version": "7.0.0-alpha1", + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "7NnpUmcBTFzn_XoLZAmP", + "source": { + "@timestamp": "2018-11-27T02:04:45.638Z", + "beat": { + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-redis-01" + }, + "event": { + "module": "auditd", + "category": "user-login", + "type": "user_err", + "action": "error" + }, + "user": { + "name_map": { + "uid": "root" + }, + "auid": "unset", + "uid": "0" + }, + "process": { + "pid": "32532", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "107.170.65.109" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "summary": { + "how": "/usr/sbin/sshd", + "actor": { + "secondary": "root", + "primary": "unset" + }, + "object": { + "type": "user-session", + "primary": "ssh", + "secondary": "107.170.65.109" + } + }, + "sequence": 186559, + "result": "fail", + "session": "unset", + "data": { + "terminal": "ssh", + "op": "PAM:bad_ident", + "hostname": "107.170.65.109" + } + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "FNnsUmcBTFzn_XoLVUul", + "source": { + "@timestamp": "2018-11-27T02:07:58.394Z", + "process": { + "exe": "/usr/sbin/sshd", + "pid": "19916" + }, + "source": { + "ip": "74.208.43.208" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "sequence": 142410, + "result": "fail", + "session": "unset", + "data": { + "acct": "(unknown user)", + "terminal": "sshd", + "op": "login" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + }, + "object": { + "primary": "sshd", + "secondary": "74.208.43.208", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + } + }, + "beat": { + "version": "7.0.0-alpha1", + "name": "demo-stack-haproxy-01", + "hostname": "demo-stack-haproxy-01" + }, + "host": { + "name": "demo-stack-haproxy-01" + }, + "event": { + "module": "auditd", + "category": "user-login", + "type": "user_login", + "action": "logged-in" + }, + "user": { + "name_map": { + "uid": "root" + }, + "auid": "unset", + "uid": "0" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "FdnsUmcBTFzn_XoLVUul", + "source": { + "@timestamp": "2018-11-27T02:07:58.395Z", + "event": { + "module": "auditd", + "category": "user-login", + "type": "user_login", + "action": "logged-in" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "pid": "19916", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "74.208.43.208" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "session": "unset", + "data": { + "terminal": "sshd", + "op": "login", + "acct": "(invalid user)" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + }, + "object": { + "type": "user-session", + "primary": "sshd", + "secondary": "74.208.43.208" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 142411, + "result": "fail" + }, + "beat": { + "name": "demo-stack-haproxy-01", + "hostname": "demo-stack-haproxy-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-haproxy-01" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "FtnsUmcBTFzn_XoLVUul", + "source": { + "@timestamp": "2018-11-27T02:07:58.422Z", + "user": { + "uid": "0", + "auid": "unset", + "name_map": { + "uid": "root" + } + }, + "beat": { + "name": "demo-stack-haproxy-01", + "hostname": "demo-stack-haproxy-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-haproxy-01" + }, + "process": { + "pid": "19916", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "74.208.43.208" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "sequence": 142412, + "result": "fail", + "session": "unset", + "data": { + "op": "PAM:bad_ident", + "terminal": "ssh", + "hostname": "74.208.43.208" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "root" + }, + "object": { + "primary": "ssh", + "secondary": "74.208.43.208", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + } + }, + "event": { + "category": "user-login", + "type": "user_err", + "action": "error", + "module": "auditd" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "rtnqUmcBTFzn_XoLniSL", + "source": { + "@timestamp": "2018-11-27T02:06:05.967Z", + "source": { + "ip": "107.170.65.109" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "data": { + "acct": "(unknown user)", + "terminal": "sshd", + "op": "login" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + }, + "object": { + "type": "user-session", + "primary": "sshd", + "secondary": "107.170.65.109" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 186560, + "result": "fail", + "session": "unset" + }, + "event": { + "type": "user_login", + "action": "logged-in", + "module": "auditd", + "category": "user-login" + }, + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + }, + "process": { + "exe": "/usr/sbin/sshd", + "pid": "32540" + }, + "beat": { + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-redis-01" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "r9nqUmcBTFzn_XoLniSL", + "source": { + "@timestamp": "2018-11-27T02:06:05.968Z", + "network": { + "direction": "incoming" + }, + "auditd": { + "sequence": 186561, + "result": "fail", + "session": "unset", + "data": { + "acct": "(invalid user)", + "op": "login", + "terminal": "sshd" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + }, + "object": { + "primary": "sshd", + "secondary": "107.170.65.109", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + } + }, + "beat": { + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-redis-01" + }, + "event": { + "action": "logged-in", + "module": "auditd", + "category": "user-login", + "type": "user_login" + }, + "user": { + "auid": "unset", + "uid": "0", + "name_map": { + "uid": "root" + } + }, + "process": { + "pid": "32540", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "107.170.65.109" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "sNnqUmcBTFzn_XoLniSL", + "source": { + "@timestamp": "2018-11-27T02:06:05.999Z", + "process": { + "pid": "32540", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "107.170.65.109" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "session": "unset", + "data": { + "hostname": "107.170.65.109", + "terminal": "ssh", + "op": "PAM:bad_ident" + }, + "summary": { + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "root" + }, + "object": { + "type": "user-session", + "primary": "ssh", + "secondary": "107.170.65.109" + } + }, + "sequence": 186562, + "result": "fail" + }, + "beat": { + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-redis-01" + }, + "event": { + "module": "auditd", + "category": "user-login", + "type": "user_err", + "action": "error" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "KtjoUmcBTFzn_XoLSvJx", + "source": { + "@timestamp": "2018-11-27T02:03:33.383Z", + "event": { + "action": "logged-in", + "module": "auditd", + "category": "user-login", + "type": "user_login" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "pid": "26052", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "104.236.181.158" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "sequence": 184402, + "result": "fail", + "session": "unset", + "data": { + "terminal": "sshd", + "op": "login", + "acct": "(unknown user)" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + }, + "object": { + "primary": "sshd", + "secondary": "104.236.181.158", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + } + }, + "beat": { + "name": "demo-stack-apache-01", + "hostname": "demo-stack-apache-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-apache-01" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "K9joUmcBTFzn_XoLSvJx", + "source": { + "@timestamp": "2018-11-27T02:03:33.384Z", + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "pid": "26052", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "104.236.181.158" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "result": "fail", + "session": "unset", + "data": { + "acct": "(invalid user)", + "op": "login", + "terminal": "sshd" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + }, + "object": { + "primary": "sshd", + "secondary": "104.236.181.158", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 184403 + }, + "beat": { + "name": "demo-stack-apache-01", + "hostname": "demo-stack-apache-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-apache-01" + }, + "event": { + "action": "logged-in", + "module": "auditd", + "category": "user-login", + "type": "user_login" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "LNjoUmcBTFzn_XoLSvJx", + "source": { + "@timestamp": "2018-11-27T02:03:33.426Z", + "host": { + "name": "demo-stack-apache-01" + }, + "auditd": { + "data": { + "op": "PAM:bad_ident", + "terminal": "ssh", + "hostname": "104.236.181.158" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "root" + }, + "object": { + "type": "user-session", + "primary": "ssh", + "secondary": "104.236.181.158" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 184404, + "result": "fail", + "session": "unset" + }, + "event": { + "category": "user-login", + "type": "user_err", + "action": "error", + "module": "auditd" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "exe": "/usr/sbin/sshd", + "pid": "26052" + }, + "source": { + "ip": "104.236.181.158" + }, + "network": { + "direction": "incoming" + }, + "beat": { + "version": "7.0.0-alpha1", + "name": "demo-stack-apache-01", + "hostname": "demo-stack-apache-01" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "kdnrUmcBTFzn_XoL2j_v", + "source": { + "@timestamp": "2018-11-27T02:07:26.981Z", + "process": { + "pid": "32548", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "107.170.65.109" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "summary": { + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + }, + "object": { + "primary": "sshd", + "secondary": "107.170.65.109", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 186563, + "result": "fail", + "session": "unset", + "data": { + "terminal": "sshd", + "acct": "(unknown user)", + "op": "login" + } + }, + "event": { + "module": "auditd", + "category": "user-login", + "type": "user_login", + "action": "logged-in" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "beat": { + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-redis-01" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "ktnrUmcBTFzn_XoL2j_v", + "source": { + "@timestamp": "2018-11-27T02:07:26.982Z", + "auditd": { + "result": "fail", + "session": "unset", + "data": { + "op": "login", + "acct": "(invalid user)", + "terminal": "sshd" + }, + "summary": { + "actor": { + "secondary": "(invalid user)", + "primary": "unset" + }, + "object": { + "primary": "sshd", + "secondary": "107.170.65.109", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 186564 + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + }, + "beat": { + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-redis-01" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "pid": "32548", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "107.170.65.109" + }, + "network": { + "direction": "incoming" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "k9nrUmcBTFzn_XoL2j_v", + "source": { + "@timestamp": "2018-11-27T02:07:27.012Z", + "source": { + "ip": "107.170.65.109" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "sequence": 186565, + "result": "fail", + "session": "unset", + "data": { + "op": "PAM:bad_ident", + "terminal": "ssh", + "hostname": "107.170.65.109" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "root" + }, + "object": { + "primary": "ssh", + "secondary": "107.170.65.109", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + } + }, + "event": { + "module": "auditd", + "category": "user-login", + "type": "user_err", + "action": "error" + }, + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + }, + "beat": { + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-redis-01" + }, + "process": { + "pid": "32548", + "exe": "/usr/sbin/sshd" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "ntnpUmcBTFzn_XoLkg3n", + "source": { + "@timestamp": "2018-11-27T02:04:57.466Z", + "beat": { + "name": "demo-stack-es-01", + "hostname": "demo-stack-es-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-es-01" + }, + "process": { + "pid": "30281", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "89.156.152.134" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "sequence": 44225, + "result": "fail", + "session": "unset", + "data": { + "acct": "(unknown user)", + "op": "login", + "terminal": "sshd" + }, + "summary": { + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + }, + "object": { + "secondary": "89.156.152.134", + "type": "user-session", + "primary": "sshd" + } + } + }, + "event": { + "type": "user_login", + "action": "logged-in", + "module": "auditd", + "category": "user-login" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "n9npUmcBTFzn_XoLkg3n", + "source": { + "@timestamp": "2018-11-27T02:04:57.466Z", + "beat": { + "version": "7.0.0-alpha1", + "name": "demo-stack-es-01", + "hostname": "demo-stack-es-01" + }, + "host": { + "name": "demo-stack-es-01" + }, + "process": { + "exe": "/usr/sbin/sshd", + "pid": "30281" + }, + "source": { + "ip": "89.156.152.134" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "data": { + "terminal": "sshd", + "acct": "(invalid user)", + "op": "login" + }, + "summary": { + "actor": { + "secondary": "(invalid user)", + "primary": "unset" + }, + "object": { + "primary": "sshd", + "secondary": "89.156.152.134", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 44226, + "result": "fail", + "session": "unset" + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + }, + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "oNnpUmcBTFzn_XoLkg3n", + "source": { + "@timestamp": "2018-11-27T02:04:57.574Z", + "process": { + "pid": "30281", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "89.156.152.134" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "sequence": 44227, + "result": "fail", + "session": "unset", + "data": { + "hostname": "89.156.152.134", + "terminal": "ssh", + "op": "PAM:bad_ident" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "root" + }, + "object": { + "type": "user-session", + "primary": "ssh", + "secondary": "89.156.152.134" + }, + "how": "/usr/sbin/sshd" + } + }, + "beat": { + "name": "demo-stack-es-01", + "hostname": "demo-stack-es-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-es-01" + }, + "event": { + "module": "auditd", + "category": "user-login", + "type": "user_err", + "action": "error" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "VdnrUmcBTFzn_XoLLzF2", + "source": { + "@timestamp": "2018-11-27T02:06:43.078Z", + "event": { + "module": "auditd", + "category": "user-login", + "type": "user_login", + "action": "logged-in" + }, + "user": { + "uid": "0", + "auid": "unset", + "name_map": { + "uid": "root" + } + }, + "beat": { + "name": "demo-stack-es-01", + "hostname": "demo-stack-es-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-es-01" + }, + "process": { + "pid": "30322", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "210.71.197.80" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "data": { + "acct": "(unknown user)", + "terminal": "sshd", + "op": "login" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + }, + "object": { + "primary": "sshd", + "secondary": "210.71.197.80", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 44228, + "result": "fail", + "session": "unset" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "VtnrUmcBTFzn_XoLLzF2", + "source": { + "@timestamp": "2018-11-27T02:06:43.078Z", + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + }, + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + }, + "process": { + "pid": "30322", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "210.71.197.80" + }, + "network": { + "direction": "incoming" + }, + "beat": { + "name": "demo-stack-es-01", + "hostname": "demo-stack-es-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-es-01" + }, + "auditd": { + "sequence": 44229, + "result": "fail", + "session": "unset", + "data": { + "acct": "(invalid user)", + "terminal": "sshd", + "op": "login" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + }, + "object": { + "primary": "sshd", + "secondary": "210.71.197.80", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + } + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "V9nrUmcBTFzn_XoLLzF2", + "source": { + "@timestamp": "2018-11-27T02:06:43.254Z", + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "pid": "30322", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "210.71.197.80" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "sequence": 44230, + "result": "fail", + "session": "unset", + "data": { + "hostname": "210.71.197.80", + "terminal": "ssh", + "op": "PAM:bad_ident" + }, + "summary": { + "object": { + "type": "user-session", + "primary": "ssh", + "secondary": "210.71.197.80" + }, + "how": "/usr/sbin/sshd", + "actor": { + "secondary": "root", + "primary": "unset" + } + } + }, + "beat": { + "name": "demo-stack-es-01", + "hostname": "demo-stack-es-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-es-01" + }, + "event": { + "module": "auditd", + "category": "user-login", + "type": "user_err", + "action": "error" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "8tnwUmcBTFzn_XoLk6fE", + "source": { + "@timestamp": "2018-11-27T02:12:36.443Z", + "beat": { + "name": "demo-stack-nginx-01", + "hostname": "demo-stack-nginx-01", + "version": "7.0.0-alpha1" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "result": "fail", + "session": "unset", + "data": { + "acct": "(unknown user)", + "terminal": "sshd", + "op": "login" + }, + "summary": { + "object": { + "secondary": "37.187.195.209", + "type": "user-session", + "primary": "sshd" + }, + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + } + }, + "sequence": 192577 + }, + "event": { + "type": "user_login", + "action": "logged-in", + "module": "auditd", + "category": "user-login" + }, + "user": { + "auid": "unset", + "uid": "0", + "name_map": { + "uid": "root" + } + }, + "process": { + "pid": "916", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "37.187.195.209" + }, + "host": { + "name": "demo-stack-nginx-01" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "89nwUmcBTFzn_XoLk6fE", + "source": { + "@timestamp": "2018-11-27T02:12:36.443Z", + "beat": { + "name": "demo-stack-nginx-01", + "hostname": "demo-stack-nginx-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-nginx-01" + }, + "source": { + "ip": "37.187.195.209" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "sequence": 192578, + "result": "fail", + "session": "unset", + "data": { + "op": "login", + "acct": "(invalid user)", + "terminal": "sshd" + }, + "summary": { + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + }, + "object": { + "primary": "sshd", + "secondary": "37.187.195.209", + "type": "user-session" + } + } + }, + "event": { + "action": "logged-in", + "module": "auditd", + "category": "user-login", + "type": "user_login" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "pid": "916", + "exe": "/usr/sbin/sshd" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "9NnwUmcBTFzn_XoLk6fE", + "source": { + "@timestamp": "2018-11-27T02:12:36.550Z", + "auditd": { + "result": "fail", + "session": "unset", + "data": { + "terminal": "ssh", + "op": "PAM:bad_ident", + "hostname": "37.187.195.209" + }, + "summary": { + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "root" + }, + "object": { + "secondary": "37.187.195.209", + "type": "user-session", + "primary": "ssh" + } + }, + "sequence": 192579 + }, + "beat": { + "name": "demo-stack-nginx-01", + "hostname": "demo-stack-nginx-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-nginx-01" + }, + "event": { + "category": "user-login", + "type": "user_err", + "action": "error", + "module": "auditd" + }, + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + }, + "process": { + "pid": "916", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "37.187.195.209" + }, + "network": { + "direction": "incoming" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "D9nwUmcBTFzn_XoLlqgH", + "source": { + "@timestamp": "2018-11-27T02:12:37.021Z", + "source": { + "ip": "51.38.176.147" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "sequence": 184424, + "result": "fail", + "session": "unset", + "data": { + "acct": "(unknown user)", + "terminal": "sshd", + "op": "login" + }, + "summary": { + "object": { + "primary": "sshd", + "secondary": "51.38.176.147", + "type": "user-session" + }, + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + } + } + }, + "beat": { + "hostname": "demo-stack-apache-01", + "version": "7.0.0-alpha1", + "name": "demo-stack-apache-01" + }, + "host": { + "name": "demo-stack-apache-01" + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "exe": "/usr/sbin/sshd", + "pid": "26164" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "ENnwUmcBTFzn_XoLlqgH", + "source": { + "@timestamp": "2018-11-27T02:12:37.022Z", + "auditd": { + "summary": { + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + }, + "object": { + "primary": "sshd", + "secondary": "51.38.176.147", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 184425, + "result": "fail", + "session": "unset", + "data": { + "acct": "(invalid user)", + "terminal": "sshd", + "op": "login" + } + }, + "event": { + "module": "auditd", + "category": "user-login", + "type": "user_login", + "action": "logged-in" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "pid": "26164", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "51.38.176.147" + }, + "network": { + "direction": "incoming" + }, + "host": { + "name": "demo-stack-apache-01" + }, + "beat": { + "name": "demo-stack-apache-01", + "hostname": "demo-stack-apache-01", + "version": "7.0.0-alpha1" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "EdnwUmcBTFzn_XoLlqgH", + "source": { + "@timestamp": "2018-11-27T02:12:37.127Z", + "host": { + "name": "demo-stack-apache-01" + }, + "user": { + "auid": "unset", + "uid": "0", + "name_map": { + "uid": "root" + } + }, + "process": { + "pid": "26164", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "51.38.176.147" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "summary": { + "actor": { + "secondary": "root", + "primary": "unset" + }, + "object": { + "secondary": "51.38.176.147", + "type": "user-session", + "primary": "ssh" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 184426, + "result": "fail", + "session": "unset", + "data": { + "terminal": "ssh", + "op": "PAM:bad_ident", + "hostname": "51.38.176.147" + } + }, + "event": { + "category": "user-login", + "type": "user_err", + "action": "error", + "module": "auditd" + }, + "beat": { + "name": "demo-stack-apache-01", + "hostname": "demo-stack-apache-01", + "version": "7.0.0-alpha1" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "HNnwUmcBTFzn_XoLl6g8", + "source": { + "@timestamp": "2018-11-27T02:12:37.327Z", + "process": { + "pid": "12992", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "81.174.227.27" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "data": { + "acct": "(unknown user)", + "op": "login", + "terminal": "sshd" + }, + "summary": { + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + }, + "object": { + "primary": "sshd", + "secondary": "81.174.227.27", + "type": "user-session" + } + }, + "sequence": 43232, + "result": "fail", + "session": "unset" + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "beat": { + "name": "demo-stack-mysql-01", + "hostname": "demo-stack-mysql-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-mysql-01" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "HdnwUmcBTFzn_XoLl6g8", + "source": { + "@timestamp": "2018-11-27T02:12:37.327Z", + "auditd": { + "data": { + "terminal": "sshd", + "op": "login", + "acct": "(invalid user)" + }, + "summary": { + "actor": { + "secondary": "(invalid user)", + "primary": "unset" + }, + "object": { + "primary": "sshd", + "secondary": "81.174.227.27", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 43233, + "result": "fail", + "session": "unset" + }, + "event": { + "module": "auditd", + "category": "user-login", + "type": "user_login", + "action": "logged-in" + }, + "user": { + "name_map": { + "uid": "root" + }, + "auid": "unset", + "uid": "0" + }, + "process": { + "pid": "12992", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "81.174.227.27" + }, + "beat": { + "name": "demo-stack-mysql-01", + "hostname": "demo-stack-mysql-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-mysql-01" + }, + "network": { + "direction": "incoming" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "HtnwUmcBTFzn_XoLl6g8", + "source": { + "@timestamp": "2018-11-27T02:12:37.435Z", + "beat": { + "version": "7.0.0-alpha1", + "name": "demo-stack-mysql-01", + "hostname": "demo-stack-mysql-01" + }, + "host": { + "name": "demo-stack-mysql-01" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "sequence": 43234, + "result": "fail", + "session": "unset", + "data": { + "op": "PAM:bad_ident", + "hostname": "81.174.227.27", + "terminal": "ssh" + }, + "summary": { + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "root" + }, + "object": { + "type": "user-session", + "primary": "ssh", + "secondary": "81.174.227.27" + } + } + }, + "event": { + "type": "user_err", + "action": "error", + "module": "auditd", + "category": "user-login" + }, + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + }, + "process": { + "pid": "12992", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "81.174.227.27" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "DdnwUmcBTFzn_XoLRqHL", + "source": { + "@timestamp": "2018-11-27T02:12:16.736Z", + "source": { + "ip": "159.65.225.184" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "result": "fail", + "session": "unset", + "data": { + "op": "login", + "acct": "(invalid user)", + "terminal": "sshd" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + }, + "object": { + "primary": "sshd", + "secondary": "159.65.225.184", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 44250 + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + }, + "beat": { + "hostname": "demo-stack-es-01", + "version": "7.0.0-alpha1", + "name": "demo-stack-es-01" + }, + "host": { + "name": "demo-stack-es-01" + }, + "user": { + "auid": "unset", + "uid": "0", + "name_map": { + "uid": "root" + } + }, + "process": { + "exe": "/usr/sbin/sshd", + "pid": "30449" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "DtnwUmcBTFzn_XoLRqHL", + "source": { + "@timestamp": "2018-11-27T02:12:16.736Z", + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + }, + "process": { + "exe": "/usr/sbin/sshd", + "pid": "30449" + }, + "source": { + "ip": "159.65.225.184" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "sequence": 44249, + "result": "fail", + "session": "unset", + "data": { + "op": "login", + "acct": "(unknown user)", + "terminal": "sshd" + }, + "summary": { + "object": { + "primary": "sshd", + "secondary": "159.65.225.184", + "type": "user-session" + }, + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + } + } + }, + "beat": { + "name": "demo-stack-es-01", + "hostname": "demo-stack-es-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-es-01" + }, + "event": { + "module": "auditd", + "category": "user-login", + "type": "user_login", + "action": "logged-in" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "D9nwUmcBTFzn_XoLRqHL", + "source": { + "@timestamp": "2018-11-27T02:12:16.764Z", + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + }, + "process": { + "pid": "30449", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "159.65.225.184" + }, + "network": { + "direction": "incoming" + }, + "beat": { + "name": "demo-stack-es-01", + "hostname": "demo-stack-es-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-es-01" + }, + "auditd": { + "sequence": 44251, + "result": "fail", + "session": "unset", + "data": { + "terminal": "ssh", + "hostname": "159.65.225.184", + "op": "PAM:bad_ident" + }, + "summary": { + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "root" + }, + "object": { + "primary": "ssh", + "secondary": "159.65.225.184", + "type": "user-session" + } + } + }, + "event": { + "category": "user-login", + "type": "user_err", + "action": "error", + "module": "auditd" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "qtnwUmcBTFzn_XoLUqId", + "source": { + "@timestamp": "2018-11-27T02:12:19.633Z", + "network": { + "direction": "incoming" + }, + "auditd": { + "sequence": 43226, + "result": "fail", + "session": "unset", + "data": { + "acct": "(unknown user)", + "terminal": "sshd", + "op": "login" + }, + "summary": { + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + }, + "object": { + "primary": "sshd", + "secondary": "185.91.116.197", + "type": "user-session" + } + } + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "pid": "12988", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "185.91.116.197" + }, + "beat": { + "version": "7.0.0-alpha1", + "name": "demo-stack-mysql-01", + "hostname": "demo-stack-mysql-01" + }, + "host": { + "name": "demo-stack-mysql-01" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "q9nwUmcBTFzn_XoLUqId", + "source": { + "@timestamp": "2018-11-27T02:12:19.633Z", + "network": { + "direction": "incoming" + }, + "host": { + "name": "demo-stack-mysql-01" + }, + "beat": { + "name": "demo-stack-mysql-01", + "hostname": "demo-stack-mysql-01", + "version": "7.0.0-alpha1" + }, + "auditd": { + "session": "unset", + "data": { + "op": "login", + "terminal": "sshd", + "acct": "(invalid user)" + }, + "summary": { + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + }, + "object": { + "type": "user-session", + "primary": "sshd", + "secondary": "185.91.116.197" + } + }, + "sequence": 43227, + "result": "fail" + }, + "event": { + "action": "logged-in", + "module": "auditd", + "category": "user-login", + "type": "user_login" + }, + "user": { + "auid": "unset", + "uid": "0", + "name_map": { + "uid": "root" + } + }, + "process": { + "pid": "12988", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "185.91.116.197" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "rNnwUmcBTFzn_XoLUqId", + "source": { + "@timestamp": "2018-11-27T02:12:19.753Z", + "network": { + "direction": "incoming" + }, + "auditd": { + "data": { + "hostname": "185.91.116.197", + "op": "PAM:bad_ident", + "terminal": "ssh" + }, + "summary": { + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "root" + }, + "object": { + "type": "user-session", + "primary": "ssh", + "secondary": "185.91.116.197" + } + }, + "sequence": 43228, + "result": "fail", + "session": "unset" + }, + "event": { + "action": "error", + "module": "auditd", + "category": "user-login", + "type": "user_err" + }, + "user": { + "name_map": { + "uid": "root" + }, + "auid": "unset", + "uid": "0" + }, + "process": { + "exe": "/usr/sbin/sshd", + "pid": "12988" + }, + "source": { + "ip": "185.91.116.197" + }, + "beat": { + "hostname": "demo-stack-mysql-01", + "version": "7.0.0-alpha1", + "name": "demo-stack-mysql-01" + }, + "host": { + "name": "demo-stack-mysql-01" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "6NnwUmcBTFzn_XoLjqfh", + "source": { + "@timestamp": "2018-11-27T02:12:35.140Z", + "host": { + "name": "demo-stack-apache-01" + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "pid": "26162", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "192.252.209.190" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "result": "fail", + "session": "unset", + "data": { + "terminal": "sshd", + "acct": "(unknown user)", + "op": "login" + }, + "summary": { + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + }, + "object": { + "primary": "sshd", + "secondary": "192.252.209.190", + "type": "user-session" + } + }, + "sequence": 184421 + }, + "beat": { + "name": "demo-stack-apache-01", + "hostname": "demo-stack-apache-01", + "version": "7.0.0-alpha1" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "6dnwUmcBTFzn_XoLjqfh", + "source": { + "@timestamp": "2018-11-27T02:12:35.141Z", + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "pid": "26162", + "exe": "/usr/sbin/sshd" + }, + "beat": { + "name": "demo-stack-apache-01", + "hostname": "demo-stack-apache-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-apache-01" + }, + "source": { + "ip": "192.252.209.190" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "session": "unset", + "data": { + "op": "login", + "terminal": "sshd", + "acct": "(invalid user)" + }, + "summary": { + "object": { + "secondary": "192.252.209.190", + "type": "user-session", + "primary": "sshd" + }, + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + } + }, + "sequence": 184422, + "result": "fail" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "6tnwUmcBTFzn_XoLjqfh", + "source": { + "@timestamp": "2018-11-27T02:12:35.173Z", + "process": { + "pid": "26162", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "192.252.209.190" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "sequence": 184423, + "result": "fail", + "session": "unset", + "data": { + "terminal": "ssh", + "hostname": "192.252.209.190", + "op": "PAM:bad_ident" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "root" + }, + "object": { + "type": "user-session", + "primary": "ssh", + "secondary": "192.252.209.190" + }, + "how": "/usr/sbin/sshd" + } + }, + "beat": { + "name": "demo-stack-apache-01", + "hostname": "demo-stack-apache-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-apache-01" + }, + "event": { + "module": "auditd", + "category": "user-login", + "type": "user_err", + "action": "error" + }, + "user": { + "name_map": { + "uid": "root" + }, + "auid": "unset", + "uid": "0" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "ctnvUmcBTFzn_XoLp5MU", + "source": { + "@timestamp": "2018-11-27T02:11:35.850Z", + "user": { + "name_map": { + "uid": "root" + }, + "auid": "unset", + "uid": "0" + }, + "process": { + "pid": "912", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "105.16.153.210" + }, + "network": { + "direction": "incoming" + }, + "beat": { + "version": "7.0.0-alpha1", + "name": "demo-stack-nginx-01", + "hostname": "demo-stack-nginx-01" + }, + "host": { + "name": "demo-stack-nginx-01" + }, + "auditd": { + "sequence": 192574, + "result": "fail", + "session": "unset", + "data": { + "op": "login", + "acct": "(unknown user)", + "terminal": "sshd" + }, + "summary": { + "actor": { + "secondary": "(unknown user)", + "primary": "unset" + }, + "object": { + "primary": "sshd", + "secondary": "105.16.153.210", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + } + }, + "event": { + "action": "logged-in", + "module": "auditd", + "category": "user-login", + "type": "user_login" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "c9nvUmcBTFzn_XoLp5MU", + "source": { + "@timestamp": "2018-11-27T02:11:35.851Z", + "auditd": { + "data": { + "terminal": "sshd", + "acct": "(invalid user)", + "op": "login" + }, + "summary": { + "object": { + "primary": "sshd", + "secondary": "105.16.153.210", + "type": "user-session" + }, + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + } + }, + "sequence": 192575, + "result": "fail", + "session": "unset" + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + }, + "user": { + "uid": "0", + "auid": "unset", + "name_map": { + "uid": "root" + } + }, + "process": { + "exe": "/usr/sbin/sshd", + "pid": "912" + }, + "source": { + "ip": "105.16.153.210" + }, + "network": { + "direction": "incoming" + }, + "beat": { + "hostname": "demo-stack-nginx-01", + "version": "7.0.0-alpha1", + "name": "demo-stack-nginx-01" + }, + "host": { + "name": "demo-stack-nginx-01" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "dNnvUmcBTFzn_XoLp5MU", + "source": { + "@timestamp": "2018-11-27T02:11:36.114Z", + "network": { + "direction": "incoming" + }, + "auditd": { + "summary": { + "actor": { + "secondary": "root", + "primary": "unset" + }, + "object": { + "primary": "ssh", + "secondary": "105.16.153.210", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 192576, + "result": "fail", + "session": "unset", + "data": { + "op": "PAM:bad_ident", + "hostname": "105.16.153.210", + "terminal": "ssh" + } + }, + "event": { + "category": "user-login", + "type": "user_err", + "action": "error", + "module": "auditd" + }, + "user": { + "name_map": { + "uid": "root" + }, + "auid": "unset", + "uid": "0" + }, + "process": { + "exe": "/usr/sbin/sshd", + "pid": "912" + }, + "source": { + "ip": "105.16.153.210" + }, + "host": { + "name": "demo-stack-nginx-01" + }, + "beat": { + "version": "7.0.0-alpha1", + "name": "demo-stack-nginx-01", + "hostname": "demo-stack-nginx-01" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "2dnvUmcBTFzn_XoLwpV9", + "source": { + "@timestamp": "2018-11-27T02:11:42.866Z", + "process": { + "pid": "19940", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "167.99.212.179" + }, + "network": { + "direction": "incoming" + }, + "beat": { + "name": "demo-stack-haproxy-01", + "hostname": "demo-stack-haproxy-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-haproxy-01" + }, + "auditd": { + "summary": { + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + }, + "object": { + "type": "user-session", + "primary": "sshd", + "secondary": "167.99.212.179" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 142419, + "result": "fail", + "session": "unset", + "data": { + "terminal": "sshd", + "acct": "(unknown user)", + "op": "login" + } + }, + "event": { + "type": "user_login", + "action": "logged-in", + "module": "auditd", + "category": "user-login" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "2tnvUmcBTFzn_XoLwpV9", + "source": { + "@timestamp": "2018-11-27T02:11:42.867Z", + "user": { + "uid": "0", + "auid": "unset", + "name_map": { + "uid": "root" + } + }, + "process": { + "pid": "19940", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "167.99.212.179" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "result": "fail", + "session": "unset", + "data": { + "terminal": "sshd", + "op": "login", + "acct": "(invalid user)" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + }, + "object": { + "type": "user-session", + "primary": "sshd", + "secondary": "167.99.212.179" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 142420 + }, + "beat": { + "name": "demo-stack-haproxy-01", + "hostname": "demo-stack-haproxy-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-haproxy-01" + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "29nvUmcBTFzn_XoLwpV9", + "source": { + "@timestamp": "2018-11-27T02:11:42.971Z", + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "pid": "19940", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "167.99.212.179" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "sequence": 142421, + "result": "fail", + "session": "unset", + "data": { + "hostname": "167.99.212.179", + "terminal": "ssh", + "op": "PAM:bad_ident" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "root" + }, + "object": { + "primary": "ssh", + "secondary": "167.99.212.179", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + } + }, + "event": { + "module": "auditd", + "category": "user-login", + "type": "user_err", + "action": "error" + }, + "host": { + "name": "demo-stack-haproxy-01" + }, + "beat": { + "name": "demo-stack-haproxy-01", + "hostname": "demo-stack-haproxy-01", + "version": "7.0.0-alpha1" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "8tnvUmcBTFzn_XoLn5Ih", + "source": { + "@timestamp": "2018-11-27T02:11:33.815Z", + "process": { + "pid": "32575", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "107.170.65.109" + }, + "network": { + "direction": "incoming" + }, + "host": { + "name": "demo-stack-redis-01" + }, + "beat": { + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1" + }, + "auditd": { + "data": { + "terminal": "sshd", + "op": "login", + "acct": "(unknown user)" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + }, + "object": { + "type": "user-session", + "primary": "sshd", + "secondary": "107.170.65.109" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 186575, + "result": "fail", + "session": "unset" + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + }, + "user": { + "name_map": { + "uid": "root" + }, + "uid": "0", + "auid": "unset" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "89nvUmcBTFzn_XoLn5Ih", + "source": { + "@timestamp": "2018-11-27T02:11:33.816Z", + "process": { + "exe": "/usr/sbin/sshd", + "pid": "32575" + }, + "source": { + "ip": "107.170.65.109" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "data": { + "terminal": "sshd", + "acct": "(invalid user)", + "op": "login" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + }, + "object": { + "primary": "sshd", + "secondary": "107.170.65.109", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 186576, + "result": "fail", + "session": "unset" + }, + "beat": { + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-redis-01" + }, + "event": { + "module": "auditd", + "category": "user-login", + "type": "user_login", + "action": "logged-in" + }, + "user": { + "auid": "unset", + "uid": "0", + "name_map": { + "uid": "root" + } + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "9NnvUmcBTFzn_XoLn5Ih", + "source": { + "@timestamp": "2018-11-27T02:11:33.846Z", + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + }, + "process": { + "pid": "32575", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "107.170.65.109" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "sequence": 186577, + "result": "fail", + "session": "unset", + "data": { + "terminal": "ssh", + "op": "PAM:bad_ident", + "hostname": "107.170.65.109" + }, + "summary": { + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "root" + }, + "object": { + "primary": "ssh", + "secondary": "107.170.65.109", + "type": "user-session" + } + } + }, + "beat": { + "version": "7.0.0-alpha1", + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01" + }, + "host": { + "name": "demo-stack-redis-01" + }, + "event": { + "category": "user-login", + "type": "user_err", + "action": "error", + "module": "auditd" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "L9nvUmcBTFzn_XoLVo3n", + "source": { + "@timestamp": "2018-11-27T02:11:15.325Z", + "auditd": { + "data": { + "terminal": "sshd", + "acct": "(unknown user)", + "op": "login" + }, + "summary": { + "object": { + "primary": "sshd", + "secondary": "67.166.24.55", + "type": "user-session" + }, + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + } + }, + "sequence": 186572, + "result": "fail", + "session": "unset" + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "pid": "32573", + "exe": "/usr/sbin/sshd" + }, + "beat": { + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-redis-01" + }, + "source": { + "ip": "67.166.24.55" + }, + "network": { + "direction": "incoming" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "MNnvUmcBTFzn_XoLVo3n", + "source": { + "@timestamp": "2018-11-27T02:11:15.326Z", + "source": { + "ip": "67.166.24.55" + }, + "beat": { + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-redis-01" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "sequence": 186573, + "result": "fail", + "session": "unset", + "data": { + "terminal": "sshd", + "op": "login", + "acct": "(invalid user)" + }, + "summary": { + "how": "/usr/sbin/sshd", + "actor": { + "secondary": "(invalid user)", + "primary": "unset" + }, + "object": { + "primary": "sshd", + "secondary": "67.166.24.55", + "type": "user-session" + } + } + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + }, + "user": { + "uid": "0", + "auid": "unset", + "name_map": { + "uid": "root" + } + }, + "process": { + "pid": "32573", + "exe": "/usr/sbin/sshd" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "MdnvUmcBTFzn_XoLVo3n", + "source": { + "@timestamp": "2018-11-27T02:11:15.490Z", + "beat": { + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1", + "name": "demo-stack-redis-01" + }, + "host": { + "name": "demo-stack-redis-01" + }, + "source": { + "ip": "67.166.24.55" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "sequence": 186574, + "result": "fail", + "session": "unset", + "data": { + "op": "PAM:bad_ident", + "hostname": "67.166.24.55", + "terminal": "ssh" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "root" + }, + "object": { + "secondary": "67.166.24.55", + "type": "user-session", + "primary": "ssh" + }, + "how": "/usr/sbin/sshd" + } + }, + "event": { + "action": "error", + "module": "auditd", + "category": "user-login", + "type": "user_err" + }, + "user": { + "auid": "unset", + "uid": "0", + "name_map": { + "uid": "root" + } + }, + "process": { + "pid": "32573", + "exe": "/usr/sbin/sshd" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "N9nvUmcBTFzn_XoL2Zh8", + "source": { + "@timestamp": "2018-11-27T02:11:48.750Z", + "user": { + "name_map": { + "uid": "root" + }, + "uid": "0", + "auid": "unset" + }, + "process": { + "exe": "/usr/sbin/sshd", + "pid": "30433" + }, + "source": { + "ip": "217.182.55.191" + }, + "network": { + "direction": "incoming" + }, + "beat": { + "name": "demo-stack-es-01", + "hostname": "demo-stack-es-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-es-01" + }, + "auditd": { + "session": "unset", + "data": { + "op": "login", + "acct": "(unknown user)", + "terminal": "sshd" + }, + "summary": { + "object": { + "primary": "sshd", + "secondary": "217.182.55.191", + "type": "user-session" + }, + "how": "/usr/sbin/sshd", + "actor": { + "secondary": "(unknown user)", + "primary": "unset" + } + }, + "sequence": 44246, + "result": "fail" + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "ONnvUmcBTFzn_XoL2Zh8", + "source": { + "@timestamp": "2018-11-27T02:11:48.750Z", + "source": { + "ip": "217.182.55.191" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "result": "fail", + "session": "unset", + "data": { + "op": "login", + "acct": "(invalid user)", + "terminal": "sshd" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + }, + "object": { + "primary": "sshd", + "secondary": "217.182.55.191", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 44247 + }, + "beat": { + "version": "7.0.0-alpha1", + "name": "demo-stack-es-01", + "hostname": "demo-stack-es-01" + }, + "host": { + "name": "demo-stack-es-01" + }, + "event": { + "module": "auditd", + "category": "user-login", + "type": "user_login", + "action": "logged-in" + }, + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + }, + "process": { + "pid": "30433", + "exe": "/usr/sbin/sshd" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "OdnvUmcBTFzn_XoL2Zh8", + "source": { + "@timestamp": "2018-11-27T02:11:48.858Z", + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "beat": { + "name": "demo-stack-es-01", + "hostname": "demo-stack-es-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-es-01" + }, + "process": { + "pid": "30433", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "217.182.55.191" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "sequence": 44248, + "result": "fail", + "session": "unset", + "data": { + "hostname": "217.182.55.191", + "terminal": "ssh", + "op": "PAM:bad_ident" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "root" + }, + "object": { + "type": "user-session", + "primary": "ssh", + "secondary": "217.182.55.191" + }, + "how": "/usr/sbin/sshd" + } + }, + "event": { + "type": "user_err", + "action": "error", + "module": "auditd", + "category": "user-login" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "QNnwUmcBTFzn_XoLaKRf", + "source": { + "@timestamp": "2018-11-27T02:12:25.330Z", + "source": { + "ip": "94.16.115.155" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "summary": { + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + }, + "object": { + "primary": "sshd", + "secondary": "94.16.115.155", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 43229, + "result": "fail", + "session": "unset", + "data": { + "terminal": "sshd", + "op": "login", + "acct": "(unknown user)" + } + }, + "beat": { + "name": "demo-stack-mysql-01", + "hostname": "demo-stack-mysql-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-mysql-01" + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "pid": "12990", + "exe": "/usr/sbin/sshd" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "QdnwUmcBTFzn_XoLaKRf", + "source": { + "@timestamp": "2018-11-27T02:12:25.330Z", + "beat": { + "name": "demo-stack-mysql-01", + "hostname": "demo-stack-mysql-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-mysql-01" + }, + "process": { + "pid": "12990", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "94.16.115.155" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "result": "fail", + "session": "unset", + "data": { + "op": "login", + "acct": "(invalid user)", + "terminal": "sshd" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + }, + "object": { + "primary": "sshd", + "secondary": "94.16.115.155", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 43230 + }, + "event": { + "module": "auditd", + "category": "user-login", + "type": "user_login", + "action": "logged-in" + }, + "user": { + "auid": "unset", + "uid": "0", + "name_map": { + "uid": "root" + } + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "QtnwUmcBTFzn_XoLaKRf", + "source": { + "@timestamp": "2018-11-27T02:12:25.442Z", + "host": { + "name": "demo-stack-mysql-01" + }, + "event": { + "category": "user-login", + "type": "user_err", + "action": "error", + "module": "auditd" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "exe": "/usr/sbin/sshd", + "pid": "12990" + }, + "source": { + "ip": "94.16.115.155" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "result": "fail", + "session": "unset", + "data": { + "terminal": "ssh", + "op": "PAM:bad_ident", + "hostname": "94.16.115.155" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "root" + }, + "object": { + "primary": "ssh", + "secondary": "94.16.115.155", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 43231 + }, + "beat": { + "hostname": "demo-stack-mysql-01", + "version": "7.0.0-alpha1", + "name": "demo-stack-mysql-01" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "6dr0UmcBTFzn_XoLnQBb", + "source": { + "@timestamp": "2018-11-27T02:17:01.040Z", + "host": { + "name": "demo-stack-apache-01" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "pid": "26196", + "exe": "/usr/sbin/cron" + }, + "auditd": { + "summary": { + "actor": { + "secondary": "root", + "primary": "unset" + }, + "object": { + "type": "user-session", + "primary": "cron" + }, + "how": "/usr/sbin/cron" + }, + "sequence": 184433, + "result": "success", + "session": "unset", + "data": { + "op": "PAM:accounting", + "terminal": "cron", + "acct": "root" + } + }, + "event": { + "module": "auditd", + "category": "user-login", + "type": "user_acct", + "action": "was-authorized" + }, + "beat": { + "name": "demo-stack-apache-01", + "hostname": "demo-stack-apache-01", + "version": "7.0.0-alpha1" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "6tr0UmcBTFzn_XoLnQBb", + "source": { + "@timestamp": "2018-11-27T02:17:01.040Z", + "event": { + "category": "user-login", + "type": "cred_acq", + "action": "acquired-credentials", + "module": "auditd" + }, + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + }, + "process": { + "pid": "26196", + "exe": "/usr/sbin/cron" + }, + "auditd": { + "sequence": 184434, + "result": "success", + "session": "unset", + "data": { + "terminal": "cron", + "op": "PAM:setcred", + "acct": "root" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "root" + }, + "object": { + "primary": "cron", + "type": "user-session" + }, + "how": "/usr/sbin/cron" + } + }, + "beat": { + "name": "demo-stack-apache-01", + "hostname": "demo-stack-apache-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-apache-01" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "69r0UmcBTFzn_XoLnQBb", + "source": { + "@timestamp": "2018-11-27T02:17:01.042Z", + "user": { + "uid": "0", + "name_map": { + "auid": "root", + "uid": "root" + }, + "auid": "0" + }, + "process": { + "pid": "26196", + "exe": "/usr/sbin/cron" + }, + "auditd": { + "sequence": 184436, + "result": "success", + "session": "9861", + "data": { + "op": "PAM:session_open", + "acct": "root", + "terminal": "cron" + }, + "summary": { + "actor": { + "primary": "root", + "secondary": "root" + }, + "object": { + "primary": "cron", + "type": "user-session" + }, + "how": "/usr/sbin/cron" + } + }, + "beat": { + "name": "demo-stack-apache-01", + "hostname": "demo-stack-apache-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-apache-01" + }, + "event": { + "category": "user-login", + "type": "user_start", + "action": "started-session", + "module": "auditd" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "7Nr0UmcBTFzn_XoLnQBb", + "source": { + "@timestamp": "2018-11-27T02:17:01.045Z", + "host": { + "name": "demo-stack-apache-01" + }, + "process": { + "exe": "/usr/sbin/cron", + "pid": "26196" + }, + "auditd": { + "sequence": 184437, + "result": "success", + "session": "9861", + "data": { + "terminal": "cron", + "acct": "root", + "op": "PAM:setcred" + }, + "summary": { + "object": { + "primary": "cron", + "type": "user-session" + }, + "how": "/usr/sbin/cron", + "actor": { + "primary": "root", + "secondary": "root" + } + } + }, + "event": { + "category": "user-login", + "type": "cred_disp", + "action": "disposed-credentials", + "module": "auditd" + }, + "user": { + "name_map": { + "auid": "root", + "uid": "root" + }, + "auid": "0", + "uid": "0" + }, + "beat": { + "name": "demo-stack-apache-01", + "hostname": "demo-stack-apache-01", + "version": "7.0.0-alpha1" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "7dr0UmcBTFzn_XoLnQBb", + "source": { + "@timestamp": "2018-11-27T02:17:01.045Z", + "user": { + "uid": "0", + "name_map": { + "auid": "root", + "uid": "root" + }, + "auid": "0" + }, + "process": { + "exe": "/usr/sbin/cron", + "pid": "26196" + }, + "beat": { + "name": "demo-stack-apache-01", + "hostname": "demo-stack-apache-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-apache-01" + }, + "auditd": { + "data": { + "acct": "root", + "op": "PAM:session_close", + "terminal": "cron" + }, + "summary": { + "actor": { + "secondary": "root", + "primary": "root" + }, + "object": { + "type": "user-session", + "primary": "cron" + }, + "how": "/usr/sbin/cron" + }, + "sequence": 184438, + "result": "success", + "session": "9861" + }, + "event": { + "category": "user-login", + "type": "user_end", + "action": "ended-session", + "module": "auditd" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "8dr0UmcBTFzn_XoLnQD4", + "source": { + "@timestamp": "2018-11-27T02:17:01.194Z", + "process": { + "pid": "30546", + "exe": "/usr/sbin/cron" + }, + "auditd": { + "result": "success", + "session": "unset", + "data": { + "acct": "root", + "terminal": "cron", + "op": "PAM:setcred" + }, + "summary": { + "how": "/usr/sbin/cron", + "actor": { + "primary": "unset", + "secondary": "root" + }, + "object": { + "primary": "cron", + "type": "user-session" + } + }, + "sequence": 44259 + }, + "beat": { + "name": "demo-stack-es-01", + "hostname": "demo-stack-es-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-es-01" + }, + "event": { + "module": "auditd", + "category": "user-login", + "type": "cred_acq", + "action": "acquired-credentials" + }, + "user": { + "name_map": { + "uid": "root" + }, + "auid": "unset", + "uid": "0" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "8tr0UmcBTFzn_XoLnQD4", + "source": { + "@timestamp": "2018-11-27T02:17:01.194Z", + "user": { + "name_map": { + "uid": "root" + }, + "auid": "unset", + "uid": "0" + }, + "process": { + "pid": "30546", + "exe": "/usr/sbin/cron" + }, + "auditd": { + "result": "success", + "session": "unset", + "data": { + "op": "PAM:accounting", + "terminal": "cron", + "acct": "root" + }, + "summary": { + "object": { + "primary": "cron", + "type": "user-session" + }, + "how": "/usr/sbin/cron", + "actor": { + "primary": "unset", + "secondary": "root" + } + }, + "sequence": 44258 + }, + "beat": { + "hostname": "demo-stack-es-01", + "version": "7.0.0-alpha1", + "name": "demo-stack-es-01" + }, + "host": { + "name": "demo-stack-es-01" + }, + "event": { + "module": "auditd", + "category": "user-login", + "type": "user_acct", + "action": "was-authorized" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "89r0UmcBTFzn_XoLnQD4", + "source": { + "@timestamp": "2018-11-27T02:17:01.194Z", + "event": { + "type": "user_start", + "action": "started-session", + "module": "auditd", + "category": "user-login" + }, + "user": { + "name_map": { + "auid": "root", + "uid": "root" + }, + "auid": "0", + "uid": "0" + }, + "process": { + "exe": "/usr/sbin/cron", + "pid": "30546" + }, + "auditd": { + "result": "success", + "session": "1445", + "data": { + "acct": "root", + "op": "PAM:session_open", + "terminal": "cron" + }, + "summary": { + "how": "/usr/sbin/cron", + "actor": { + "primary": "root", + "secondary": "root" + }, + "object": { + "primary": "cron", + "type": "user-session" + } + }, + "sequence": 44261 + }, + "beat": { + "name": "demo-stack-es-01", + "hostname": "demo-stack-es-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-es-01" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "9Nr0UmcBTFzn_XoLnQD4", + "source": { + "@timestamp": "2018-11-27T02:17:01.198Z", + "event": { + "type": "cred_disp", + "action": "disposed-credentials", + "module": "auditd", + "category": "user-login" + }, + "user": { + "uid": "0", + "name_map": { + "auid": "root", + "uid": "root" + }, + "auid": "0" + }, + "beat": { + "name": "demo-stack-es-01", + "hostname": "demo-stack-es-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-es-01" + }, + "process": { + "pid": "30546", + "exe": "/usr/sbin/cron" + }, + "auditd": { + "result": "success", + "session": "1445", + "data": { + "terminal": "cron", + "acct": "root", + "op": "PAM:setcred" + }, + "summary": { + "actor": { + "primary": "root", + "secondary": "root" + }, + "object": { + "primary": "cron", + "type": "user-session" + }, + "how": "/usr/sbin/cron" + }, + "sequence": 44262 + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "9dr0UmcBTFzn_XoLnQD4", + "source": { + "@timestamp": "2018-11-27T02:17:01.198Z", + "process": { + "pid": "30546", + "exe": "/usr/sbin/cron" + }, + "beat": { + "name": "demo-stack-es-01", + "hostname": "demo-stack-es-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-es-01" + }, + "auditd": { + "sequence": 44263, + "result": "success", + "session": "1445", + "data": { + "terminal": "cron", + "op": "PAM:session_close", + "acct": "root" + }, + "summary": { + "actor": { + "primary": "root", + "secondary": "root" + }, + "object": { + "primary": "cron", + "type": "user-session" + }, + "how": "/usr/sbin/cron" + } + }, + "event": { + "category": "user-login", + "type": "user_end", + "action": "ended-session", + "module": "auditd" + }, + "user": { + "auid": "0", + "name_map": { + "auid": "root", + "uid": "root" + }, + "uid": "0" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "CNr0UmcBTFzn_XoLngEH", + "source": { + "@timestamp": "2018-11-27T02:17:01.212Z", + "user": { + "name_map": { + "uid": "root" + }, + "auid": "unset", + "uid": "0" + }, + "process": { + "exe": "/usr/sbin/cron", + "pid": "19971" + }, + "auditd": { + "sequence": 142422, + "result": "success", + "session": "unset", + "data": { + "op": "PAM:accounting", + "acct": "root", + "terminal": "cron" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "root" + }, + "object": { + "primary": "cron", + "type": "user-session" + }, + "how": "/usr/sbin/cron" + } + }, + "beat": { + "hostname": "demo-stack-haproxy-01", + "version": "7.0.0-alpha1", + "name": "demo-stack-haproxy-01" + }, + "host": { + "name": "demo-stack-haproxy-01" + }, + "event": { + "type": "user_acct", + "action": "was-authorized", + "module": "auditd", + "category": "user-login" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "Cdr0UmcBTFzn_XoLngEH", + "source": { + "@timestamp": "2018-11-27T02:17:01.213Z", + "process": { + "pid": "19971", + "exe": "/usr/sbin/cron" + }, + "auditd": { + "data": { + "op": "PAM:setcred", + "acct": "root", + "terminal": "cron" + }, + "summary": { + "object": { + "primary": "cron", + "type": "user-session" + }, + "how": "/usr/sbin/cron", + "actor": { + "secondary": "root", + "primary": "unset" + } + }, + "sequence": 142423, + "result": "success", + "session": "unset" + }, + "beat": { + "name": "demo-stack-haproxy-01", + "hostname": "demo-stack-haproxy-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-haproxy-01" + }, + "event": { + "action": "acquired-credentials", + "module": "auditd", + "category": "user-login", + "type": "cred_acq" + }, + "user": { + "auid": "unset", + "uid": "0", + "name_map": { + "uid": "root" + } + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "Ctr0UmcBTFzn_XoLngEH", + "source": { + "@timestamp": "2018-11-27T02:17:01.214Z", + "host": { + "name": "demo-stack-haproxy-01" + }, + "event": { + "module": "auditd", + "category": "user-login", + "type": "user_start", + "action": "started-session" + }, + "user": { + "auid": "0", + "name_map": { + "auid": "root", + "uid": "root" + }, + "uid": "0" + }, + "process": { + "pid": "19971", + "exe": "/usr/sbin/cron" + }, + "auditd": { + "result": "success", + "session": "3504", + "data": { + "terminal": "cron", + "acct": "root", + "op": "PAM:session_open" + }, + "summary": { + "actor": { + "primary": "root", + "secondary": "root" + }, + "object": { + "type": "user-session", + "primary": "cron" + }, + "how": "/usr/sbin/cron" + }, + "sequence": 142425 + }, + "beat": { + "name": "demo-stack-haproxy-01", + "hostname": "demo-stack-haproxy-01", + "version": "7.0.0-alpha1" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "C9r0UmcBTFzn_XoLngEH", + "source": { + "@timestamp": "2018-11-27T02:17:01.217Z", + "user": { + "name_map": { + "auid": "root", + "uid": "root" + }, + "auid": "0", + "uid": "0" + }, + "process": { + "pid": "19971", + "exe": "/usr/sbin/cron" + }, + "auditd": { + "result": "success", + "session": "3504", + "data": { + "acct": "root", + "op": "PAM:setcred", + "terminal": "cron" + }, + "summary": { + "actor": { + "primary": "root", + "secondary": "root" + }, + "object": { + "primary": "cron", + "type": "user-session" + }, + "how": "/usr/sbin/cron" + }, + "sequence": 142426 + }, + "host": { + "name": "demo-stack-haproxy-01" + }, + "beat": { + "name": "demo-stack-haproxy-01", + "hostname": "demo-stack-haproxy-01", + "version": "7.0.0-alpha1" + }, + "event": { + "category": "user-login", + "type": "cred_disp", + "action": "disposed-credentials", + "module": "auditd" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "DNr0UmcBTFzn_XoLngEH", + "source": { + "@timestamp": "2018-11-27T02:17:01.218Z", + "host": { + "name": "demo-stack-haproxy-01" + }, + "user": { + "uid": "0", + "name_map": { + "auid": "root", + "uid": "root" + }, + "auid": "0" + }, + "process": { + "pid": "19971", + "exe": "/usr/sbin/cron" + }, + "auditd": { + "sequence": 142427, + "result": "success", + "session": "3504", + "data": { + "terminal": "cron", + "acct": "root", + "op": "PAM:session_close" + }, + "summary": { + "how": "/usr/sbin/cron", + "actor": { + "primary": "root", + "secondary": "root" + }, + "object": { + "primary": "cron", + "type": "user-session" + } + } + }, + "event": { + "category": "user-login", + "type": "user_end", + "action": "ended-session", + "module": "auditd" + }, + "beat": { + "name": "demo-stack-haproxy-01", + "hostname": "demo-stack-haproxy-01", + "version": "7.0.0-alpha1" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "Ddr0UmcBTFzn_XoLngEO", + "source": { + "@timestamp": "2018-11-27T02:17:01.220Z", + "beat": { + "name": "demo-stack-nginx-01", + "hostname": "demo-stack-nginx-01", + "version": "7.0.0-alpha1" + }, + "auditd": { + "data": { + "acct": "root", + "op": "PAM:accounting", + "terminal": "cron" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "root" + }, + "object": { + "primary": "cron", + "type": "user-session" + }, + "how": "/usr/sbin/cron" + }, + "sequence": 192589, + "result": "success", + "session": "unset" + }, + "event": { + "category": "user-login", + "type": "user_acct", + "action": "was-authorized", + "module": "auditd" + }, + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + }, + "process": { + "pid": "947", + "exe": "/usr/sbin/cron" + }, + "host": { + "name": "demo-stack-nginx-01" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "Dtr0UmcBTFzn_XoLngEO", + "source": { + "@timestamp": "2018-11-27T02:17:01.220Z", + "event": { + "category": "user-login", + "type": "cred_acq", + "action": "acquired-credentials", + "module": "auditd" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "pid": "947", + "exe": "/usr/sbin/cron" + }, + "auditd": { + "session": "unset", + "data": { + "acct": "root", + "terminal": "cron", + "op": "PAM:setcred" + }, + "summary": { + "actor": { + "secondary": "root", + "primary": "unset" + }, + "object": { + "primary": "cron", + "type": "user-session" + }, + "how": "/usr/sbin/cron" + }, + "sequence": 192590, + "result": "success" + }, + "beat": { + "hostname": "demo-stack-nginx-01", + "version": "7.0.0-alpha1", + "name": "demo-stack-nginx-01" + }, + "host": { + "name": "demo-stack-nginx-01" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "D9r0UmcBTFzn_XoLngEO", + "source": { + "@timestamp": "2018-11-27T02:17:01.222Z", + "beat": { + "version": "7.0.0-alpha1", + "name": "demo-stack-nginx-01", + "hostname": "demo-stack-nginx-01" + }, + "host": { + "name": "demo-stack-nginx-01" + }, + "event": { + "category": "user-login", + "type": "user_start", + "action": "started-session", + "module": "auditd" + }, + "user": { + "uid": "0", + "name_map": { + "auid": "root", + "uid": "root" + }, + "auid": "0" + }, + "process": { + "pid": "947", + "exe": "/usr/sbin/cron" + }, + "auditd": { + "session": "9865", + "data": { + "acct": "root", + "terminal": "cron", + "op": "PAM:session_open" + }, + "summary": { + "actor": { + "secondary": "root", + "primary": "root" + }, + "object": { + "primary": "cron", + "type": "user-session" + }, + "how": "/usr/sbin/cron" + }, + "sequence": 192592, + "result": "success" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "ENr0UmcBTFzn_XoLngEO", + "source": { + "@timestamp": "2018-11-27T02:17:01.225Z", + "beat": { + "version": "7.0.0-alpha1", + "name": "demo-stack-nginx-01", + "hostname": "demo-stack-nginx-01" + }, + "host": { + "name": "demo-stack-nginx-01" + }, + "auditd": { + "result": "success", + "session": "9865", + "data": { + "acct": "root", + "op": "PAM:setcred", + "terminal": "cron" + }, + "summary": { + "actor": { + "primary": "root", + "secondary": "root" + }, + "object": { + "primary": "cron", + "type": "user-session" + }, + "how": "/usr/sbin/cron" + }, + "sequence": 192593 + }, + "event": { + "category": "user-login", + "type": "cred_disp", + "action": "disposed-credentials", + "module": "auditd" + }, + "user": { + "uid": "0", + "name_map": { + "auid": "root", + "uid": "root" + }, + "auid": "0" + }, + "process": { + "pid": "947", + "exe": "/usr/sbin/cron" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "Edr0UmcBTFzn_XoLngEO", + "source": { + "@timestamp": "2018-11-27T02:17:01.226Z", + "user": { + "name_map": { + "auid": "root", + "uid": "root" + }, + "uid": "0", + "auid": "0" + }, + "host": { + "name": "demo-stack-nginx-01" + }, + "beat": { + "name": "demo-stack-nginx-01", + "hostname": "demo-stack-nginx-01", + "version": "7.0.0-alpha1" + }, + "process": { + "pid": "947", + "exe": "/usr/sbin/cron" + }, + "auditd": { + "sequence": 192594, + "result": "success", + "session": "9865", + "data": { + "op": "PAM:session_close", + "acct": "root", + "terminal": "cron" + }, + "summary": { + "how": "/usr/sbin/cron", + "actor": { + "primary": "root", + "secondary": "root" + }, + "object": { + "type": "user-session", + "primary": "cron" + } + } + }, + "event": { + "category": "user-login", + "type": "user_end", + "action": "ended-session", + "module": "auditd" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "Etr0UmcBTFzn_XoLngEt", + "source": { + "@timestamp": "2018-11-27T02:17:01.245Z", + "process": { + "exe": "/usr/sbin/cron", + "pid": "13026" + }, + "auditd": { + "result": "success", + "session": "unset", + "data": { + "acct": "root", + "terminal": "cron", + "op": "PAM:accounting" + }, + "summary": { + "object": { + "primary": "cron", + "type": "user-session" + }, + "how": "/usr/sbin/cron", + "actor": { + "primary": "unset", + "secondary": "root" + } + }, + "sequence": 43247 + }, + "beat": { + "hostname": "demo-stack-mysql-01", + "version": "7.0.0-alpha1", + "name": "demo-stack-mysql-01" + }, + "host": { + "name": "demo-stack-mysql-01" + }, + "event": { + "category": "user-login", + "type": "user_acct", + "action": "was-authorized", + "module": "auditd" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "E9r0UmcBTFzn_XoLngEt", + "source": { + "@timestamp": "2018-11-27T02:17:01.249Z", + "event": { + "category": "user-login", + "type": "cred_acq", + "action": "acquired-credentials", + "module": "auditd" + }, + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + }, + "process": { + "pid": "13026", + "exe": "/usr/sbin/cron" + }, + "auditd": { + "sequence": 43248, + "result": "success", + "session": "unset", + "data": { + "op": "PAM:setcred", + "terminal": "cron", + "acct": "root" + }, + "summary": { + "actor": { + "secondary": "root", + "primary": "unset" + }, + "object": { + "primary": "cron", + "type": "user-session" + }, + "how": "/usr/sbin/cron" + } + }, + "beat": { + "name": "demo-stack-mysql-01", + "hostname": "demo-stack-mysql-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-mysql-01" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "FNr0UmcBTFzn_XoLngEt", + "source": { + "@timestamp": "2018-11-27T02:17:01.249Z", + "host": { + "name": "demo-stack-mysql-01" + }, + "process": { + "exe": "/usr/sbin/cron", + "pid": "13026" + }, + "auditd": { + "sequence": 43250, + "result": "success", + "session": "1253", + "data": { + "acct": "root", + "terminal": "cron", + "op": "PAM:session_open" + }, + "summary": { + "actor": { + "secondary": "root", + "primary": "root" + }, + "object": { + "primary": "cron", + "type": "user-session" + }, + "how": "/usr/sbin/cron" + } + }, + "event": { + "category": "user-login", + "type": "user_start", + "action": "started-session", + "module": "auditd" + }, + "user": { + "uid": "0", + "name_map": { + "auid": "root", + "uid": "root" + }, + "auid": "0" + }, + "beat": { + "name": "demo-stack-mysql-01", + "hostname": "demo-stack-mysql-01", + "version": "7.0.0-alpha1" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "Fdr0UmcBTFzn_XoLngEt", + "source": { + "@timestamp": "2018-11-27T02:17:01.257Z", + "beat": { + "name": "demo-stack-mysql-01", + "hostname": "demo-stack-mysql-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-mysql-01" + }, + "event": { + "action": "disposed-credentials", + "module": "auditd", + "category": "user-login", + "type": "cred_disp" + }, + "user": { + "auid": "0", + "name_map": { + "auid": "root", + "uid": "root" + }, + "uid": "0" + }, + "process": { + "pid": "13026", + "exe": "/usr/sbin/cron" + }, + "auditd": { + "session": "1253", + "data": { + "op": "PAM:setcred", + "acct": "root", + "terminal": "cron" + }, + "summary": { + "how": "/usr/sbin/cron", + "actor": { + "secondary": "root", + "primary": "root" + }, + "object": { + "primary": "cron", + "type": "user-session" + } + }, + "sequence": 43251, + "result": "success" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "Ftr0UmcBTFzn_XoLngEt", + "source": { + "@timestamp": "2018-11-27T02:17:01.257Z", + "auditd": { + "sequence": 43252, + "result": "success", + "session": "1253", + "data": { + "terminal": "cron", + "op": "PAM:session_close", + "acct": "root" + }, + "summary": { + "actor": { + "secondary": "root", + "primary": "root" + }, + "object": { + "primary": "cron", + "type": "user-session" + }, + "how": "/usr/sbin/cron" + } + }, + "event": { + "category": "user-login", + "type": "user_end", + "action": "ended-session", + "module": "auditd" + }, + "user": { + "uid": "0", + "name_map": { + "auid": "root", + "uid": "root" + }, + "auid": "0" + }, + "beat": { + "name": "demo-stack-mysql-01", + "hostname": "demo-stack-mysql-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-mysql-01" + }, + "process": { + "exe": "/usr/sbin/cron", + "pid": "13026" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "INr0UmcBTFzn_XoLoAHh", + "source": { + "@timestamp": "2018-11-27T02:17:01.906Z", + "event": { + "category": "user-login", + "type": "user_acct", + "action": "was-authorized", + "module": "auditd" + }, + "user": { + "name_map": { + "uid": "root" + }, + "auid": "unset", + "uid": "0" + }, + "process": { + "pid": "32605", + "exe": "/usr/sbin/cron" + }, + "auditd": { + "sequence": 186590, + "result": "success", + "session": "unset", + "data": { + "acct": "root", + "terminal": "cron", + "op": "PAM:accounting" + }, + "summary": { + "how": "/usr/sbin/cron", + "actor": { + "primary": "unset", + "secondary": "root" + }, + "object": { + "primary": "cron", + "type": "user-session" + } + } + }, + "beat": { + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-redis-01" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "Idr0UmcBTFzn_XoLoAHh", + "source": { + "@timestamp": "2018-11-27T02:17:01.907Z", + "beat": { + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-redis-01" + }, + "event": { + "category": "user-login", + "type": "cred_acq", + "action": "acquired-credentials", + "module": "auditd" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "pid": "32605", + "exe": "/usr/sbin/cron" + }, + "auditd": { + "session": "unset", + "data": { + "acct": "root", + "op": "PAM:setcred", + "terminal": "cron" + }, + "summary": { + "how": "/usr/sbin/cron", + "actor": { + "secondary": "root", + "primary": "unset" + }, + "object": { + "primary": "cron", + "type": "user-session" + } + }, + "sequence": 186591, + "result": "success" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "Itr0UmcBTFzn_XoLoAHh", + "source": { + "@timestamp": "2018-11-27T02:17:01.908Z", + "process": { + "pid": "32605", + "exe": "/usr/sbin/cron" + }, + "auditd": { + "session": "3512", + "data": { + "op": "PAM:session_open", + "terminal": "cron", + "acct": "root" + }, + "summary": { + "object": { + "primary": "cron", + "type": "user-session" + }, + "how": "/usr/sbin/cron", + "actor": { + "secondary": "root", + "primary": "root" + } + }, + "sequence": 186593, + "result": "success" + }, + "event": { + "category": "user-login", + "type": "user_start", + "action": "started-session", + "module": "auditd" + }, + "beat": { + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-redis-01" + }, + "user": { + "auid": "0", + "name_map": { + "auid": "root", + "uid": "root" + }, + "uid": "0" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "I9r0UmcBTFzn_XoLoAHh", + "source": { + "@timestamp": "2018-11-27T02:17:01.911Z", + "beat": { + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1" + }, + "process": { + "pid": "32605", + "exe": "/usr/sbin/cron" + }, + "auditd": { + "data": { + "terminal": "cron", + "acct": "root", + "op": "PAM:setcred" + }, + "summary": { + "object": { + "type": "user-session", + "primary": "cron" + }, + "how": "/usr/sbin/cron", + "actor": { + "primary": "root", + "secondary": "root" + } + }, + "sequence": 186594, + "result": "success", + "session": "3512" + }, + "event": { + "category": "user-login", + "type": "cred_disp", + "action": "disposed-credentials", + "module": "auditd" + }, + "user": { + "uid": "0", + "name_map": { + "auid": "root", + "uid": "root" + }, + "auid": "0" + }, + "host": { + "name": "demo-stack-redis-01" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "JNr0UmcBTFzn_XoLoAHh", + "source": { + "@timestamp": "2018-11-27T02:17:01.912Z", + "event": { + "category": "user-login", + "type": "user_end", + "action": "ended-session", + "module": "auditd" + }, + "user": { + "uid": "0", + "auid": "0", + "name_map": { + "auid": "root", + "uid": "root" + } + }, + "process": { + "pid": "32605", + "exe": "/usr/sbin/cron" + }, + "auditd": { + "summary": { + "actor": { + "primary": "root", + "secondary": "root" + }, + "object": { + "primary": "cron", + "type": "user-session" + }, + "how": "/usr/sbin/cron" + }, + "sequence": 186595, + "result": "success", + "session": "3512", + "data": { + "op": "PAM:session_close", + "terminal": "cron", + "acct": "root" + } + }, + "beat": { + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-redis-01" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "G9r1UmcBTFzn_XoLvBrE", + "source": { + "@timestamp": "2018-11-27T02:18:14.617Z", + "network": { + "direction": "incoming" + }, + "auditd": { + "result": "fail", + "session": "unset", + "data": { + "op": "login", + "terminal": "sshd", + "acct": "(unknown user)" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + }, + "object": { + "primary": "sshd", + "secondary": "122.160.137.37", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 142428 + }, + "beat": { + "name": "demo-stack-haproxy-01", + "hostname": "demo-stack-haproxy-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-haproxy-01" + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "pid": "19981", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "122.160.137.37" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "HNr1UmcBTFzn_XoLvBrE", + "source": { + "@timestamp": "2018-11-27T02:18:14.619Z", + "network": { + "direction": "incoming" + }, + "auditd": { + "summary": { + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + }, + "object": { + "secondary": "122.160.137.37", + "type": "user-session", + "primary": "sshd" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 142429, + "result": "fail", + "session": "unset", + "data": { + "terminal": "sshd", + "op": "login", + "acct": "(invalid user)" + } + }, + "event": { + "module": "auditd", + "category": "user-login", + "type": "user_login", + "action": "logged-in" + }, + "beat": { + "name": "demo-stack-haproxy-01", + "hostname": "demo-stack-haproxy-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-haproxy-01" + }, + "user": { + "auid": "unset", + "uid": "0", + "name_map": { + "uid": "root" + } + }, + "process": { + "pid": "19981", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "122.160.137.37" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "Hdr1UmcBTFzn_XoLvBrE", + "source": { + "@timestamp": "2018-11-27T02:18:14.905Z", + "source": { + "ip": "122.160.137.37" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "sequence": 142430, + "result": "fail", + "session": "unset", + "data": { + "hostname": "122.160.137.37", + "op": "PAM:bad_ident", + "terminal": "ssh" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "root" + }, + "object": { + "primary": "ssh", + "secondary": "122.160.137.37", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + } + }, + "beat": { + "name": "demo-stack-haproxy-01", + "hostname": "demo-stack-haproxy-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-haproxy-01" + }, + "event": { + "category": "user-login", + "type": "user_err", + "action": "error", + "module": "auditd" + }, + "user": { + "auid": "unset", + "uid": "0", + "name_map": { + "uid": "root" + } + }, + "process": { + "pid": "19981", + "exe": "/usr/sbin/sshd" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "Htr1UmcBTFzn_XoLvRof", + "source": { + "@timestamp": "2018-11-27T02:18:14.709Z", + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + }, + "user": { + "auid": "unset", + "uid": "0", + "name_map": { + "uid": "root" + } + }, + "beat": { + "name": "demo-stack-nginx-01", + "hostname": "demo-stack-nginx-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-nginx-01" + }, + "process": { + "pid": "960", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "200.207.220.128" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "sequence": 192598, + "result": "fail", + "session": "unset", + "data": { + "terminal": "sshd", + "op": "login", + "acct": "(unknown user)" + }, + "summary": { + "object": { + "primary": "sshd", + "secondary": "200.207.220.128", + "type": "user-session" + }, + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + } + } + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "H9r1UmcBTFzn_XoLvRof", + "source": { + "@timestamp": "2018-11-27T02:18:14.710Z", + "user": { + "name_map": { + "uid": "root" + }, + "uid": "0", + "auid": "unset" + }, + "process": { + "pid": "960", + "exe": "/usr/sbin/sshd" + }, + "beat": { + "name": "demo-stack-nginx-01", + "hostname": "demo-stack-nginx-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-nginx-01" + }, + "source": { + "ip": "200.207.220.128" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "data": { + "terminal": "sshd", + "op": "login", + "acct": "(invalid user)" + }, + "summary": { + "actor": { + "secondary": "(invalid user)", + "primary": "unset" + }, + "object": { + "type": "user-session", + "primary": "sshd", + "secondary": "200.207.220.128" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 192599, + "result": "fail", + "session": "unset" + }, + "event": { + "action": "logged-in", + "module": "auditd", + "category": "user-login", + "type": "user_login" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "INr1UmcBTFzn_XoLvRof", + "source": { + "@timestamp": "2018-11-27T02:18:14.895Z", + "auditd": { + "data": { + "hostname": "200.207.220.128", + "op": "PAM:bad_ident", + "terminal": "ssh" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "root" + }, + "object": { + "type": "user-session", + "primary": "ssh", + "secondary": "200.207.220.128" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 192600, + "result": "fail", + "session": "unset" + }, + "event": { + "module": "auditd", + "category": "user-login", + "type": "user_err", + "action": "error" + }, + "beat": { + "name": "demo-stack-nginx-01", + "hostname": "demo-stack-nginx-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-nginx-01" + }, + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + }, + "process": { + "pid": "960", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "200.207.220.128" + }, + "network": { + "direction": "incoming" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "MtnzUmcBTFzn_XoLcefM", + "source": { + "@timestamp": "2018-11-27T02:15:44.351Z", + "source": { + "ip": "147.135.208.7" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "result": "fail", + "session": "unset", + "data": { + "terminal": "sshd", + "acct": "(unknown user)", + "op": "login" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + }, + "object": { + "primary": "sshd", + "secondary": "147.135.208.7", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 43241 + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + }, + "beat": { + "name": "demo-stack-mysql-01", + "hostname": "demo-stack-mysql-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-mysql-01" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "exe": "/usr/sbin/sshd", + "pid": "13016" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "M9nzUmcBTFzn_XoLcefM", + "source": { + "@timestamp": "2018-11-27T02:15:44.351Z", + "beat": { + "name": "demo-stack-mysql-01", + "hostname": "demo-stack-mysql-01", + "version": "7.0.0-alpha1" + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "pid": "13016", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "147.135.208.7" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "data": { + "terminal": "sshd", + "op": "login", + "acct": "(invalid user)" + }, + "summary": { + "object": { + "primary": "sshd", + "secondary": "147.135.208.7", + "type": "user-session" + }, + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + } + }, + "sequence": 43242, + "result": "fail", + "session": "unset" + }, + "host": { + "name": "demo-stack-mysql-01" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "NNnzUmcBTFzn_XoLcefM", + "source": { + "@timestamp": "2018-11-27T02:15:44.487Z", + "source": { + "ip": "147.135.208.7" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "session": "unset", + "data": { + "op": "PAM:bad_ident", + "terminal": "ssh", + "hostname": "147.135.208.7" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "root" + }, + "object": { + "secondary": "147.135.208.7", + "type": "user-session", + "primary": "ssh" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 43243, + "result": "fail" + }, + "event": { + "type": "user_err", + "action": "error", + "module": "auditd", + "category": "user-login" + }, + "user": { + "name_map": { + "uid": "root" + }, + "uid": "0", + "auid": "unset" + }, + "process": { + "pid": "13016", + "exe": "/usr/sbin/sshd" + }, + "beat": { + "name": "demo-stack-mysql-01", + "hostname": "demo-stack-mysql-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-mysql-01" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "S9nzUmcBTFzn_XoLdeex", + "source": { + "@timestamp": "2018-11-27T02:15:45.351Z", + "beat": { + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-redis-01" + }, + "event": { + "action": "logged-in", + "module": "auditd", + "category": "user-login", + "type": "user_login" + }, + "user": { + "name_map": { + "uid": "root" + }, + "uid": "0", + "auid": "unset" + }, + "process": { + "pid": "32602", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "107.170.65.109" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "summary": { + "actor": { + "secondary": "(unknown user)", + "primary": "unset" + }, + "object": { + "type": "user-session", + "primary": "sshd", + "secondary": "107.170.65.109" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 186587, + "result": "fail", + "session": "unset", + "data": { + "op": "login", + "terminal": "sshd", + "acct": "(unknown user)" + } + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "TNnzUmcBTFzn_XoLdeex", + "source": { + "@timestamp": "2018-11-27T02:15:45.352Z", + "source": { + "ip": "107.170.65.109" + }, + "network": { + "direction": "incoming" + }, + "beat": { + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-redis-01" + }, + "auditd": { + "summary": { + "actor": { + "secondary": "(invalid user)", + "primary": "unset" + }, + "object": { + "primary": "sshd", + "secondary": "107.170.65.109", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 186588, + "result": "fail", + "session": "unset", + "data": { + "acct": "(invalid user)", + "terminal": "sshd", + "op": "login" + } + }, + "event": { + "type": "user_login", + "action": "logged-in", + "module": "auditd", + "category": "user-login" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "pid": "32602", + "exe": "/usr/sbin/sshd" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "TdnzUmcBTFzn_XoLdeex", + "source": { + "@timestamp": "2018-11-27T02:15:45.383Z", + "source": { + "ip": "107.170.65.109" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "result": "fail", + "session": "unset", + "data": { + "hostname": "107.170.65.109", + "terminal": "ssh", + "op": "PAM:bad_ident" + }, + "summary": { + "object": { + "primary": "ssh", + "secondary": "107.170.65.109", + "type": "user-session" + }, + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "root" + } + }, + "sequence": 186589 + }, + "event": { + "type": "user_err", + "action": "error", + "module": "auditd", + "category": "user-login" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "pid": "32602", + "exe": "/usr/sbin/sshd" + }, + "beat": { + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-redis-01" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "J9r1UmcBTFzn_XoLwBpB", + "source": { + "@timestamp": "2018-11-27T02:18:15.507Z", + "beat": { + "name": "demo-stack-mysql-01", + "hostname": "demo-stack-mysql-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-mysql-01" + }, + "user": { + "name_map": { + "uid": "root" + }, + "uid": "0", + "auid": "unset" + }, + "process": { + "pid": "13035", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "109.75.216.201" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "session": "unset", + "data": { + "terminal": "sshd", + "op": "login", + "acct": "(unknown user)" + }, + "summary": { + "object": { + "primary": "sshd", + "secondary": "109.75.216.201", + "type": "user-session" + }, + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + } + }, + "sequence": 43253, + "result": "fail" + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "KNr1UmcBTFzn_XoLwBpB", + "source": { + "@timestamp": "2018-11-27T02:18:15.507Z", + "process": { + "pid": "13035", + "exe": "/usr/sbin/sshd" + }, + "beat": { + "name": "demo-stack-mysql-01", + "hostname": "demo-stack-mysql-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-mysql-01" + }, + "source": { + "ip": "109.75.216.201" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "session": "unset", + "data": { + "op": "login", + "terminal": "sshd", + "acct": "(invalid user)" + }, + "summary": { + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + }, + "object": { + "primary": "sshd", + "secondary": "109.75.216.201", + "type": "user-session" + } + }, + "sequence": 43254, + "result": "fail" + }, + "event": { + "type": "user_login", + "action": "logged-in", + "module": "auditd", + "category": "user-login" + }, + "user": { + "auid": "unset", + "uid": "0", + "name_map": { + "uid": "root" + } + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "Kdr1UmcBTFzn_XoLwBpB", + "source": { + "@timestamp": "2018-11-27T02:18:15.647Z", + "event": { + "type": "user_err", + "action": "error", + "module": "auditd", + "category": "user-login" + }, + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + }, + "process": { + "pid": "13035", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "109.75.216.201" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "summary": { + "object": { + "primary": "ssh", + "secondary": "109.75.216.201", + "type": "user-session" + }, + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "root" + } + }, + "sequence": 43255, + "result": "fail", + "session": "unset", + "data": { + "op": "PAM:bad_ident", + "terminal": "ssh", + "hostname": "109.75.216.201" + } + }, + "beat": { + "name": "demo-stack-mysql-01", + "hostname": "demo-stack-mysql-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-mysql-01" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "htr1UmcBTFzn_XoLxhrF", + "source": { + "@timestamp": "2018-11-27T02:18:17.176Z", + "auditd": { + "summary": { + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + }, + "object": { + "type": "user-session", + "primary": "sshd", + "secondary": "165.227.5.206" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 43256, + "result": "fail", + "session": "unset", + "data": { + "acct": "(unknown user)", + "terminal": "sshd", + "op": "login" + } + }, + "beat": { + "name": "demo-stack-mysql-01", + "hostname": "demo-stack-mysql-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-mysql-01" + }, + "event": { + "type": "user_login", + "action": "logged-in", + "module": "auditd", + "category": "user-login" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "exe": "/usr/sbin/sshd", + "pid": "13037" + }, + "source": { + "ip": "165.227.5.206" + }, + "network": { + "direction": "incoming" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "h9r1UmcBTFzn_XoLxhrF", + "source": { + "@timestamp": "2018-11-27T02:18:17.176Z", + "network": { + "direction": "incoming" + }, + "beat": { + "name": "demo-stack-mysql-01", + "hostname": "demo-stack-mysql-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-mysql-01" + }, + "auditd": { + "session": "unset", + "data": { + "acct": "(invalid user)", + "terminal": "sshd", + "op": "login" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + }, + "object": { + "primary": "sshd", + "secondary": "165.227.5.206", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 43257, + "result": "fail" + }, + "event": { + "module": "auditd", + "category": "user-login", + "type": "user_login", + "action": "logged-in" + }, + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + }, + "process": { + "exe": "/usr/sbin/sshd", + "pid": "13037" + }, + "source": { + "ip": "165.227.5.206" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "iNr1UmcBTFzn_XoLxhrF", + "source": { + "@timestamp": "2018-11-27T02:18:17.220Z", + "auditd": { + "sequence": 43258, + "result": "fail", + "session": "unset", + "data": { + "terminal": "ssh", + "hostname": "165.227.5.206", + "op": "PAM:bad_ident" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "root" + }, + "object": { + "secondary": "165.227.5.206", + "type": "user-session", + "primary": "ssh" + }, + "how": "/usr/sbin/sshd" + } + }, + "event": { + "type": "user_err", + "action": "error", + "module": "auditd", + "category": "user-login" + }, + "user": { + "auid": "unset", + "uid": "0", + "name_map": { + "uid": "root" + } + }, + "process": { + "pid": "13037", + "exe": "/usr/sbin/sshd" + }, + "beat": { + "name": "demo-stack-mysql-01", + "hostname": "demo-stack-mysql-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-mysql-01" + }, + "source": { + "ip": "165.227.5.206" + }, + "network": { + "direction": "incoming" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "4tr2UmcBTFzn_XoLCyDa", + "source": { + "@timestamp": "2018-11-27T02:18:34.864Z", + "auditd": { + "summary": { + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + }, + "object": { + "primary": "sshd", + "secondary": "107.170.65.109", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 186599, + "result": "fail", + "session": "unset", + "data": { + "terminal": "sshd", + "op": "login", + "acct": "(unknown user)" + } + }, + "beat": { + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-redis-01" + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + }, + "user": { + "name_map": { + "uid": "root" + }, + "auid": "unset", + "uid": "0" + }, + "process": { + "pid": "32621", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "107.170.65.109" + }, + "network": { + "direction": "incoming" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "49r2UmcBTFzn_XoLCyDa", + "source": { + "@timestamp": "2018-11-27T02:18:34.866Z", + "process": { + "pid": "32621", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "107.170.65.109" + }, + "beat": { + "version": "7.0.0-alpha1", + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01" + }, + "host": { + "name": "demo-stack-redis-01" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "sequence": 186600, + "result": "fail", + "session": "unset", + "data": { + "terminal": "sshd", + "acct": "(invalid user)", + "op": "login" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + }, + "object": { + "type": "user-session", + "primary": "sshd", + "secondary": "107.170.65.109" + }, + "how": "/usr/sbin/sshd" + } + }, + "event": { + "module": "auditd", + "category": "user-login", + "type": "user_login", + "action": "logged-in" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "5Nr2UmcBTFzn_XoLCyDa", + "source": { + "@timestamp": "2018-11-27T02:18:34.896Z", + "process": { + "pid": "32621", + "exe": "/usr/sbin/sshd" + }, + "beat": { + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-redis-01" + }, + "source": { + "ip": "107.170.65.109" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "sequence": 186601, + "result": "fail", + "session": "unset", + "data": { + "hostname": "107.170.65.109", + "terminal": "ssh", + "op": "PAM:bad_ident" + }, + "summary": { + "object": { + "secondary": "107.170.65.109", + "type": "user-session", + "primary": "ssh" + }, + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "root" + } + } + }, + "event": { + "category": "user-login", + "type": "user_err", + "action": "error", + "module": "auditd" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "A9r0UmcBTFzn_XoLvwRX", + "source": { + "@timestamp": "2018-11-27T02:17:09.740Z", + "process": { + "pid": "32613", + "exe": "/usr/sbin/sshd" + }, + "beat": { + "version": "7.0.0-alpha1", + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01" + }, + "host": { + "name": "demo-stack-redis-01" + }, + "source": { + "ip": "107.170.65.109" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "data": { + "op": "login", + "terminal": "sshd", + "acct": "(unknown user)" + }, + "summary": { + "object": { + "primary": "sshd", + "secondary": "107.170.65.109", + "type": "user-session" + }, + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + } + }, + "sequence": 186596, + "result": "fail", + "session": "unset" + }, + "event": { + "module": "auditd", + "category": "user-login", + "type": "user_login", + "action": "logged-in" + }, + "user": { + "auid": "unset", + "uid": "0", + "name_map": { + "uid": "root" + } + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "BNr0UmcBTFzn_XoLvwRX", + "source": { + "@timestamp": "2018-11-27T02:17:09.742Z", + "network": { + "direction": "incoming" + }, + "auditd": { + "result": "fail", + "session": "unset", + "data": { + "terminal": "sshd", + "op": "login", + "acct": "(invalid user)" + }, + "summary": { + "object": { + "primary": "sshd", + "secondary": "107.170.65.109", + "type": "user-session" + }, + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + } + }, + "sequence": 186597 + }, + "beat": { + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-redis-01" + }, + "event": { + "type": "user_login", + "action": "logged-in", + "module": "auditd", + "category": "user-login" + }, + "user": { + "uid": "0", + "auid": "unset", + "name_map": { + "uid": "root" + } + }, + "process": { + "pid": "32613", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "107.170.65.109" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "Bdr0UmcBTFzn_XoLvwRX", + "source": { + "@timestamp": "2018-11-27T02:17:09.772Z", + "source": { + "ip": "107.170.65.109" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "data": { + "op": "PAM:bad_ident", + "hostname": "107.170.65.109", + "terminal": "ssh" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "root" + }, + "object": { + "secondary": "107.170.65.109", + "type": "user-session", + "primary": "ssh" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 186598, + "result": "fail", + "session": "unset" + }, + "event": { + "type": "user_err", + "action": "error", + "module": "auditd", + "category": "user-login" + }, + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + }, + "process": { + "pid": "32613", + "exe": "/usr/sbin/sshd" + }, + "beat": { + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-redis-01" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "Z9n0UmcBTFzn_XoLLvfV", + "source": { + "@timestamp": "2018-11-27T02:16:32.747Z", + "event": { + "module": "auditd", + "category": "user-login", + "type": "user_login", + "action": "logged-in" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "beat": { + "name": "demo-stack-apache-01", + "hostname": "demo-stack-apache-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-apache-01" + }, + "process": { + "pid": "26188", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "104.131.79.34" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "sequence": 184430, + "result": "fail", + "session": "unset", + "data": { + "op": "login", + "terminal": "sshd", + "acct": "(unknown user)" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + }, + "object": { + "type": "user-session", + "primary": "sshd", + "secondary": "104.131.79.34" + }, + "how": "/usr/sbin/sshd" + } + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "aNn0UmcBTFzn_XoLLvfV", + "source": { + "@timestamp": "2018-11-27T02:16:32.748Z", + "process": { + "pid": "26188", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "104.131.79.34" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "sequence": 184431, + "result": "fail", + "session": "unset", + "data": { + "op": "login", + "acct": "(invalid user)", + "terminal": "sshd" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + }, + "object": { + "type": "user-session", + "primary": "sshd", + "secondary": "104.131.79.34" + }, + "how": "/usr/sbin/sshd" + } + }, + "beat": { + "name": "demo-stack-apache-01", + "hostname": "demo-stack-apache-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-apache-01" + }, + "event": { + "action": "logged-in", + "module": "auditd", + "category": "user-login", + "type": "user_login" + }, + "user": { + "name_map": { + "uid": "root" + }, + "auid": "unset", + "uid": "0" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "adn0UmcBTFzn_XoLLvfV", + "source": { + "@timestamp": "2018-11-27T02:16:32.779Z", + "host": { + "name": "demo-stack-apache-01" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "data": { + "op": "PAM:bad_ident", + "terminal": "ssh", + "hostname": "104.131.79.34" + }, + "summary": { + "how": "/usr/sbin/sshd", + "actor": { + "secondary": "root", + "primary": "unset" + }, + "object": { + "primary": "ssh", + "secondary": "104.131.79.34", + "type": "user-session" + } + }, + "sequence": 184432, + "result": "fail", + "session": "unset" + }, + "event": { + "action": "error", + "module": "auditd", + "category": "user-login", + "type": "user_err" + }, + "user": { + "name_map": { + "uid": "root" + }, + "auid": "unset", + "uid": "0" + }, + "process": { + "pid": "26188", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "104.131.79.34" + }, + "beat": { + "name": "demo-stack-apache-01", + "hostname": "demo-stack-apache-01", + "version": "7.0.0-alpha1" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "wdr1UmcBTFzn_XoLdBNI", + "source": { + "@timestamp": "2018-11-27T02:17:56.062Z", + "source": { + "ip": "89.156.152.134" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "summary": { + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + }, + "object": { + "secondary": "89.156.152.134", + "type": "user-session", + "primary": "sshd" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 192595, + "result": "fail", + "session": "unset", + "data": { + "op": "login", + "terminal": "sshd", + "acct": "(unknown user)" + } + }, + "beat": { + "name": "demo-stack-nginx-01", + "hostname": "demo-stack-nginx-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-nginx-01" + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + }, + "user": { + "name_map": { + "uid": "root" + }, + "auid": "unset", + "uid": "0" + }, + "process": { + "pid": "957", + "exe": "/usr/sbin/sshd" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "wtr1UmcBTFzn_XoLdBNI", + "source": { + "@timestamp": "2018-11-27T02:17:56.063Z", + "network": { + "direction": "incoming" + }, + "auditd": { + "sequence": 192596, + "result": "fail", + "session": "unset", + "data": { + "acct": "(invalid user)", + "op": "login", + "terminal": "sshd" + }, + "summary": { + "actor": { + "secondary": "(invalid user)", + "primary": "unset" + }, + "object": { + "primary": "sshd", + "secondary": "89.156.152.134", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + } + }, + "beat": { + "name": "demo-stack-nginx-01", + "hostname": "demo-stack-nginx-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-nginx-01" + }, + "event": { + "action": "logged-in", + "module": "auditd", + "category": "user-login", + "type": "user_login" + }, + "user": { + "name_map": { + "uid": "root" + }, + "auid": "unset", + "uid": "0" + }, + "process": { + "pid": "957", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "89.156.152.134" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "w9r1UmcBTFzn_XoLdBNI", + "source": { + "@timestamp": "2018-11-27T02:17:56.190Z", + "beat": { + "name": "demo-stack-nginx-01", + "hostname": "demo-stack-nginx-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-nginx-01" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "data": { + "op": "PAM:bad_ident", + "terminal": "ssh", + "hostname": "89.156.152.134" + }, + "summary": { + "actor": { + "secondary": "root", + "primary": "unset" + }, + "object": { + "primary": "ssh", + "secondary": "89.156.152.134", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 192597, + "result": "fail", + "session": "unset" + }, + "event": { + "module": "auditd", + "category": "user-login", + "type": "user_err", + "action": "error" + }, + "user": { + "uid": "0", + "auid": "unset", + "name_map": { + "uid": "root" + } + }, + "process": { + "pid": "957", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "89.156.152.134" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "UNnzUmcBTFzn_XoLwu4u", + "source": { + "@timestamp": "2018-11-27T02:16:04.928Z", + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "pid": "13018", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "178.33.168.254" + }, + "network": { + "direction": "incoming" + }, + "beat": { + "name": "demo-stack-mysql-01", + "hostname": "demo-stack-mysql-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-mysql-01" + }, + "auditd": { + "summary": { + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + }, + "object": { + "primary": "sshd", + "secondary": "178.33.168.254", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 43244, + "result": "fail", + "session": "unset", + "data": { + "terminal": "sshd", + "op": "login", + "acct": "(unknown user)" + } + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "UdnzUmcBTFzn_XoLwu4u", + "source": { + "@timestamp": "2018-11-27T02:16:04.928Z", + "auditd": { + "data": { + "acct": "(invalid user)", + "terminal": "sshd", + "op": "login" + }, + "summary": { + "object": { + "primary": "sshd", + "secondary": "178.33.168.254", + "type": "user-session" + }, + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + } + }, + "sequence": 43245, + "result": "fail", + "session": "unset" + }, + "host": { + "name": "demo-stack-mysql-01" + }, + "beat": { + "version": "7.0.0-alpha1", + "name": "demo-stack-mysql-01", + "hostname": "demo-stack-mysql-01" + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + }, + "user": { + "uid": "0", + "auid": "unset", + "name_map": { + "uid": "root" + } + }, + "process": { + "exe": "/usr/sbin/sshd", + "pid": "13018" + }, + "source": { + "ip": "178.33.168.254" + }, + "network": { + "direction": "incoming" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "UtnzUmcBTFzn_XoLwu4u", + "source": { + "@timestamp": "2018-11-27T02:16:05.048Z", + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "pid": "13018", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "178.33.168.254" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "data": { + "hostname": "178.33.168.254", + "terminal": "ssh", + "op": "PAM:bad_ident" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "root" + }, + "object": { + "secondary": "178.33.168.254", + "type": "user-session", + "primary": "ssh" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 43246, + "result": "fail", + "session": "unset" + }, + "event": { + "category": "user-login", + "type": "user_err", + "action": "error", + "module": "auditd" + }, + "beat": { + "name": "demo-stack-mysql-01", + "hostname": "demo-stack-mysql-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-mysql-01" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "DdsBU2cBTFzn_XoL2SOm", + "source": { + "@timestamp": "2018-11-27T02:31:28.442Z", + "auditd": { + "session": "unset", + "data": { + "acct": "(unknown user)", + "terminal": "sshd", + "op": "login" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + }, + "object": { + "primary": "sshd", + "secondary": "147.135.208.7", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 43274, + "result": "fail" + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "pid": "13130", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "147.135.208.7" + }, + "beat": { + "name": "demo-stack-mysql-01", + "hostname": "demo-stack-mysql-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-mysql-01" + }, + "network": { + "direction": "incoming" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "DtsBU2cBTFzn_XoL2SOm", + "source": { + "@timestamp": "2018-11-27T02:31:28.442Z", + "process": { + "pid": "13130", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "147.135.208.7" + }, + "beat": { + "version": "7.0.0-alpha1", + "name": "demo-stack-mysql-01", + "hostname": "demo-stack-mysql-01" + }, + "host": { + "name": "demo-stack-mysql-01" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "sequence": 43275, + "result": "fail", + "session": "unset", + "data": { + "terminal": "sshd", + "op": "login", + "acct": "(invalid user)" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + }, + "object": { + "type": "user-session", + "primary": "sshd", + "secondary": "147.135.208.7" + }, + "how": "/usr/sbin/sshd" + } + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + }, + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "D9sBU2cBTFzn_XoL2SOm", + "source": { + "@timestamp": "2018-11-27T02:31:28.574Z", + "network": { + "direction": "incoming" + }, + "auditd": { + "data": { + "terminal": "ssh", + "op": "PAM:bad_ident", + "hostname": "147.135.208.7" + }, + "summary": { + "object": { + "secondary": "147.135.208.7", + "type": "user-session", + "primary": "ssh" + }, + "how": "/usr/sbin/sshd", + "actor": { + "secondary": "root", + "primary": "unset" + } + }, + "sequence": 43276, + "result": "fail", + "session": "unset" + }, + "host": { + "name": "demo-stack-mysql-01" + }, + "beat": { + "hostname": "demo-stack-mysql-01", + "version": "7.0.0-alpha1", + "name": "demo-stack-mysql-01" + }, + "event": { + "category": "user-login", + "type": "user_err", + "action": "error", + "module": "auditd" + }, + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + }, + "process": { + "pid": "13130", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "147.135.208.7" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "ENsBU2cBTFzn_XoL2SOm", + "source": { + "@timestamp": "2018-11-27T02:31:28.994Z", + "user": { + "suid": "0", + "name_map": { + "fsuid": "root", + "gid": "root", + "sgid": "root", + "suid": "root", + "uid": "root", + "egid": "root", + "euid": "root", + "fsgid": "root" + }, + "gid": "0", + "auid": "unset", + "fsgid": "0", + "fsuid": "0", + "uid": "0", + "egid": "0", + "sgid": "0", + "euid": "0" + }, + "beat": { + "name": "demo-stack-mysql-01", + "hostname": "demo-stack-mysql-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-mysql-01" + }, + "process": { + "ppid": "1379", + "title": "/sbin/iptables -w -I sshguard -s 147.135.208.7 -j DROP", + "name": "iptables", + "exe": "/sbin/xtables-multi", + "pid": "13132" + }, + "auditd": { + "result": "success", + "session": "unset", + "data": { + "syscall": "setsockopt", + "a0": "5", + "tty": "(none)", + "table": "filter", + "a2": "40", + "a3": "8ae870", + "a1": "0", + "family": "2", + "entries": "154", + "arch": "x86_64", + "exit": "0" + }, + "summary": { + "object": { + "primary": "filter", + "type": "firewall" + }, + "how": "/sbin/xtables-multi", + "actor": { + "secondary": "root", + "primary": "unset" + } + }, + "sequence": 43277 + }, + "event": { + "category": "configuration", + "type": "netfilter_cfg", + "action": "loaded-firewall-rule-to", + "module": "auditd" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "Ztr_UmcBTFzn_XoLP-rA", + "source": { + "@timestamp": "2018-11-27T02:28:37.974Z", + "source": { + "ip": "107.170.65.109" + }, + "network": { + "direction": "incoming" + }, + "beat": { + "version": "7.0.0-alpha1", + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01" + }, + "host": { + "name": "demo-stack-redis-01" + }, + "auditd": { + "result": "fail", + "session": "unset", + "data": { + "op": "login", + "acct": "(unknown user)", + "terminal": "sshd" + }, + "summary": { + "object": { + "primary": "sshd", + "secondary": "107.170.65.109", + "type": "user-session" + }, + "how": "/usr/sbin/sshd", + "actor": { + "secondary": "(unknown user)", + "primary": "unset" + } + }, + "sequence": 186620 + }, + "event": { + "type": "user_login", + "action": "logged-in", + "module": "auditd", + "category": "user-login" + }, + "user": { + "name_map": { + "uid": "root" + }, + "auid": "unset", + "uid": "0" + }, + "process": { + "pid": "32675", + "exe": "/usr/sbin/sshd" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "Z9r_UmcBTFzn_XoLP-rA", + "source": { + "@timestamp": "2018-11-27T02:28:37.975Z", + "auditd": { + "sequence": 186621, + "result": "fail", + "session": "unset", + "data": { + "op": "login", + "acct": "(invalid user)", + "terminal": "sshd" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + }, + "object": { + "type": "user-session", + "primary": "sshd", + "secondary": "107.170.65.109" + }, + "how": "/usr/sbin/sshd" + } + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "beat": { + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-redis-01" + }, + "process": { + "pid": "32675", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "107.170.65.109" + }, + "network": { + "direction": "incoming" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "aNr_UmcBTFzn_XoLP-rA", + "source": { + "@timestamp": "2018-11-27T02:28:38.007Z", + "auditd": { + "session": "unset", + "data": { + "terminal": "ssh", + "op": "PAM:bad_ident", + "hostname": "107.170.65.109" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "root" + }, + "object": { + "type": "user-session", + "primary": "ssh", + "secondary": "107.170.65.109" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 186622, + "result": "fail" + }, + "event": { + "category": "user-login", + "type": "user_err", + "action": "error", + "module": "auditd" + }, + "user": { + "uid": "0", + "auid": "unset", + "name_map": { + "uid": "root" + } + }, + "host": { + "name": "demo-stack-redis-01" + }, + "beat": { + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1" + }, + "process": { + "exe": "/usr/sbin/sshd", + "pid": "32675" + }, + "source": { + "ip": "107.170.65.109" + }, + "network": { + "direction": "incoming" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "-dsAU2cBTFzn_XoLlQYl", + "source": { + "@timestamp": "2018-11-27T02:30:05.371Z", + "process": { + "exe": "/usr/sbin/sshd", + "pid": "32684" + }, + "source": { + "ip": "107.170.65.109" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "sequence": 186623, + "result": "fail", + "session": "unset", + "data": { + "terminal": "sshd", + "op": "login", + "acct": "(unknown user)" + }, + "summary": { + "actor": { + "secondary": "(unknown user)", + "primary": "unset" + }, + "object": { + "primary": "sshd", + "secondary": "107.170.65.109", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + } + }, + "beat": { + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1", + "name": "demo-stack-redis-01" + }, + "host": { + "name": "demo-stack-redis-01" + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "-tsAU2cBTFzn_XoLlQYl", + "source": { + "@timestamp": "2018-11-27T02:30:05.372Z", + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + }, + "user": { + "uid": "0", + "auid": "unset", + "name_map": { + "uid": "root" + } + }, + "process": { + "exe": "/usr/sbin/sshd", + "pid": "32684" + }, + "source": { + "ip": "107.170.65.109" + }, + "network": { + "direction": "incoming" + }, + "beat": { + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-redis-01" + }, + "auditd": { + "data": { + "op": "login", + "terminal": "sshd", + "acct": "(invalid user)" + }, + "summary": { + "object": { + "type": "user-session", + "primary": "sshd", + "secondary": "107.170.65.109" + }, + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + } + }, + "sequence": 186624, + "result": "fail", + "session": "unset" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "-9sAU2cBTFzn_XoLlQYl", + "source": { + "@timestamp": "2018-11-27T02:30:05.403Z", + "beat": { + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-redis-01" + }, + "process": { + "exe": "/usr/sbin/sshd", + "pid": "32684" + }, + "source": { + "ip": "107.170.65.109" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "sequence": 186625, + "result": "fail", + "session": "unset", + "data": { + "terminal": "ssh", + "hostname": "107.170.65.109", + "op": "PAM:bad_ident" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "root" + }, + "object": { + "type": "user-session", + "primary": "ssh", + "secondary": "107.170.65.109" + }, + "how": "/usr/sbin/sshd" + } + }, + "event": { + "module": "auditd", + "category": "user-login", + "type": "user_err", + "action": "error" + }, + "user": { + "name_map": { + "uid": "root" + }, + "uid": "0", + "auid": "unset" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "M9sBU2cBTFzn_XoLwCBF", + "source": { + "@timestamp": "2018-11-27T02:31:21.946Z", + "auditd": { + "sequence": 186626, + "result": "fail", + "session": "unset", + "data": { + "acct": "(unknown user)", + "op": "login", + "terminal": "sshd" + }, + "summary": { + "actor": { + "secondary": "(unknown user)", + "primary": "unset" + }, + "object": { + "primary": "sshd", + "secondary": "118.25.133.243", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + } + }, + "event": { + "action": "logged-in", + "module": "auditd", + "category": "user-login", + "type": "user_login" + }, + "user": { + "name_map": { + "uid": "root" + }, + "auid": "unset", + "uid": "0" + }, + "process": { + "exe": "/usr/sbin/sshd", + "pid": "32692" + }, + "source": { + "ip": "118.25.133.243" + }, + "network": { + "direction": "incoming" + }, + "beat": { + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-redis-01" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "NNsBU2cBTFzn_XoLwCBF", + "source": { + "@timestamp": "2018-11-27T02:31:21.947Z", + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "pid": "32692", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "118.25.133.243" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "sequence": 186627, + "result": "fail", + "session": "unset", + "data": { + "terminal": "sshd", + "op": "login", + "acct": "(invalid user)" + }, + "summary": { + "actor": { + "secondary": "(invalid user)", + "primary": "unset" + }, + "object": { + "primary": "sshd", + "secondary": "118.25.133.243", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + } + }, + "beat": { + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-redis-01" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "NdsBU2cBTFzn_XoLwCBF", + "source": { + "@timestamp": "2018-11-27T02:31:22.162Z", + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "beat": { + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-redis-01" + }, + "process": { + "pid": "32692", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "118.25.133.243" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "session": "unset", + "data": { + "terminal": "ssh", + "hostname": "118.25.133.243", + "op": "PAM:bad_ident" + }, + "summary": { + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "root" + }, + "object": { + "type": "user-session", + "primary": "ssh", + "secondary": "118.25.133.243" + } + }, + "sequence": 186628, + "result": "fail" + }, + "event": { + "module": "auditd", + "category": "user-login", + "type": "user_err", + "action": "error" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "D9oAU2cBTFzn_XoLOP8t", + "source": { + "@timestamp": "2018-11-27T02:29:41.565Z", + "beat": { + "hostname": "demo-stack-mysql-01", + "version": "7.0.0-alpha1", + "name": "demo-stack-mysql-01" + }, + "host": { + "name": "demo-stack-mysql-01" + }, + "event": { + "module": "auditd", + "category": "user-login", + "type": "user_login", + "action": "logged-in" + }, + "user": { + "uid": "0", + "auid": "unset", + "name_map": { + "uid": "root" + } + }, + "process": { + "pid": "13117", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "128.0.121.176" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "data": { + "terminal": "sshd", + "op": "login", + "acct": "(unknown user)" + }, + "summary": { + "actor": { + "secondary": "(unknown user)", + "primary": "unset" + }, + "object": { + "primary": "sshd", + "secondary": "128.0.121.176", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 43271, + "result": "fail", + "session": "unset" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "ENoAU2cBTFzn_XoLOP8t", + "source": { + "@timestamp": "2018-11-27T02:29:41.569Z", + "host": { + "name": "demo-stack-mysql-01" + }, + "auditd": { + "summary": { + "how": "/usr/sbin/sshd", + "actor": { + "secondary": "(invalid user)", + "primary": "unset" + }, + "object": { + "primary": "sshd", + "secondary": "128.0.121.176", + "type": "user-session" + } + }, + "sequence": 43272, + "result": "fail", + "session": "unset", + "data": { + "op": "login", + "acct": "(invalid user)", + "terminal": "sshd" + } + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + }, + "user": { + "name_map": { + "uid": "root" + }, + "auid": "unset", + "uid": "0" + }, + "process": { + "pid": "13117", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "128.0.121.176" + }, + "network": { + "direction": "incoming" + }, + "beat": { + "hostname": "demo-stack-mysql-01", + "version": "7.0.0-alpha1", + "name": "demo-stack-mysql-01" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "EdoAU2cBTFzn_XoLOP8t", + "source": { + "@timestamp": "2018-11-27T02:29:41.677Z", + "host": { + "name": "demo-stack-mysql-01" + }, + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + }, + "process": { + "pid": "13117", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "128.0.121.176" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "result": "fail", + "session": "unset", + "data": { + "terminal": "ssh", + "op": "PAM:bad_ident", + "hostname": "128.0.121.176" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "root" + }, + "object": { + "secondary": "128.0.121.176", + "type": "user-session", + "primary": "ssh" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 43273 + }, + "event": { + "category": "user-login", + "type": "user_err", + "action": "error", + "module": "auditd" + }, + "beat": { + "version": "7.0.0-alpha1", + "name": "demo-stack-mysql-01", + "hostname": "demo-stack-mysql-01" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "dNsBU2cBTFzn_XoL7CTn", + "source": { + "@timestamp": "2018-11-27T02:31:33.373Z", + "host": { + "name": "demo-stack-redis-01" + }, + "event": { + "type": "user_login", + "action": "logged-in", + "module": "auditd", + "category": "user-login" + }, + "user": { + "uid": "0", + "auid": "unset", + "name_map": { + "uid": "root" + } + }, + "process": { + "pid": "32694", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "107.170.65.109" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "summary": { + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + }, + "object": { + "type": "user-session", + "primary": "sshd", + "secondary": "107.170.65.109" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 186629, + "result": "fail", + "session": "unset", + "data": { + "acct": "(unknown user)", + "terminal": "sshd", + "op": "login" + } + }, + "beat": { + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "ddsBU2cBTFzn_XoL7CTn", + "source": { + "@timestamp": "2018-11-27T02:31:33.375Z", + "process": { + "pid": "32694", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "107.170.65.109" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "sequence": 186630, + "result": "fail", + "session": "unset", + "data": { + "terminal": "sshd", + "acct": "(invalid user)", + "op": "login" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + }, + "object": { + "type": "user-session", + "primary": "sshd", + "secondary": "107.170.65.109" + }, + "how": "/usr/sbin/sshd" + } + }, + "beat": { + "version": "7.0.0-alpha1", + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01" + }, + "host": { + "name": "demo-stack-redis-01" + }, + "event": { + "module": "auditd", + "category": "user-login", + "type": "user_login", + "action": "logged-in" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "dtsBU2cBTFzn_XoL7CTn", + "source": { + "@timestamp": "2018-11-27T02:31:33.406Z", + "user": { + "uid": "0", + "auid": "unset", + "name_map": { + "uid": "root" + } + }, + "process": { + "pid": "32694", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "107.170.65.109" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "sequence": 186631, + "result": "fail", + "session": "unset", + "data": { + "terminal": "ssh", + "hostname": "107.170.65.109", + "op": "PAM:bad_ident" + }, + "summary": { + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "root" + }, + "object": { + "secondary": "107.170.65.109", + "type": "user-session", + "primary": "ssh" + } + } + }, + "beat": { + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-redis-01" + }, + "event": { + "action": "error", + "module": "auditd", + "category": "user-login", + "type": "user_err" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "G9sCU2cBTFzn_XoLvzai", + "source": { + "@timestamp": "2018-11-27T02:32:27.319Z", + "auditd": { + "sequence": 192613, + "result": "fail", + "session": "unset", + "data": { + "op": "login", + "acct": "(unknown user)", + "terminal": "sshd" + }, + "summary": { + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + }, + "object": { + "primary": "sshd", + "secondary": "198.27.80.211", + "type": "user-session" + } + } + }, + "beat": { + "name": "demo-stack-nginx-01", + "hostname": "demo-stack-nginx-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-nginx-01" + }, + "event": { + "module": "auditd", + "category": "user-login", + "type": "user_login", + "action": "logged-in" + }, + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + }, + "process": { + "exe": "/usr/sbin/sshd", + "pid": "1045" + }, + "source": { + "ip": "198.27.80.211" + }, + "network": { + "direction": "incoming" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "HNsCU2cBTFzn_XoLvzai", + "source": { + "@timestamp": "2018-11-27T02:32:27.320Z", + "source": { + "ip": "198.27.80.211" + }, + "network": { + "direction": "incoming" + }, + "host": { + "name": "demo-stack-nginx-01" + }, + "beat": { + "name": "demo-stack-nginx-01", + "hostname": "demo-stack-nginx-01", + "version": "7.0.0-alpha1" + }, + "auditd": { + "data": { + "op": "login", + "acct": "(invalid user)", + "terminal": "sshd" + }, + "summary": { + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + }, + "object": { + "primary": "sshd", + "secondary": "198.27.80.211", + "type": "user-session" + } + }, + "sequence": 192614, + "result": "fail", + "session": "unset" + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + }, + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + }, + "process": { + "pid": "1045", + "exe": "/usr/sbin/sshd" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "HdsCU2cBTFzn_XoLvzai", + "source": { + "@timestamp": "2018-11-27T02:32:27.362Z", + "auditd": { + "data": { + "op": "PAM:bad_ident", + "terminal": "ssh", + "hostname": "198.27.80.211" + }, + "summary": { + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "root" + }, + "object": { + "primary": "ssh", + "secondary": "198.27.80.211", + "type": "user-session" + } + }, + "sequence": 192615, + "result": "fail", + "session": "unset" + }, + "event": { + "type": "user_err", + "action": "error", + "module": "auditd", + "category": "user-login" + }, + "user": { + "auid": "unset", + "uid": "0", + "name_map": { + "uid": "root" + } + }, + "process": { + "pid": "1045", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "198.27.80.211" + }, + "beat": { + "name": "demo-stack-nginx-01", + "hostname": "demo-stack-nginx-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-nginx-01" + }, + "network": { + "direction": "incoming" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "Sdr-UmcBTFzn_XoLMtPX", + "source": { + "@timestamp": "2018-11-27T02:27:29.130Z", + "event": { + "module": "auditd", + "category": "user-login", + "type": "user_login", + "action": "logged-in" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "pid": "13103", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "54.37.67.193" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "result": "fail", + "session": "unset", + "data": { + "acct": "(unknown user)", + "terminal": "sshd", + "op": "login" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + }, + "object": { + "type": "user-session", + "primary": "sshd", + "secondary": "54.37.67.193" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 43268 + }, + "beat": { + "name": "demo-stack-mysql-01", + "hostname": "demo-stack-mysql-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-mysql-01" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "Str-UmcBTFzn_XoLMtPX", + "source": { + "@timestamp": "2018-11-27T02:27:29.130Z", + "user": { + "name_map": { + "uid": "root" + }, + "uid": "0", + "auid": "unset" + }, + "process": { + "exe": "/usr/sbin/sshd", + "pid": "13103" + }, + "source": { + "ip": "54.37.67.193" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "session": "unset", + "data": { + "op": "login", + "acct": "(invalid user)", + "terminal": "sshd" + }, + "summary": { + "object": { + "type": "user-session", + "primary": "sshd", + "secondary": "54.37.67.193" + }, + "how": "/usr/sbin/sshd", + "actor": { + "secondary": "(invalid user)", + "primary": "unset" + } + }, + "sequence": 43269, + "result": "fail" + }, + "beat": { + "name": "demo-stack-mysql-01", + "hostname": "demo-stack-mysql-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-mysql-01" + }, + "event": { + "module": "auditd", + "category": "user-login", + "type": "user_login", + "action": "logged-in" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "S9r-UmcBTFzn_XoLMtPX", + "source": { + "@timestamp": "2018-11-27T02:27:29.242Z", + "event": { + "action": "error", + "module": "auditd", + "category": "user-login", + "type": "user_err" + }, + "beat": { + "hostname": "demo-stack-mysql-01", + "version": "7.0.0-alpha1", + "name": "demo-stack-mysql-01" + }, + "host": { + "name": "demo-stack-mysql-01" + }, + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + }, + "process": { + "pid": "13103", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "54.37.67.193" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "session": "unset", + "data": { + "hostname": "54.37.67.193", + "terminal": "ssh", + "op": "PAM:bad_ident" + }, + "summary": { + "object": { + "secondary": "54.37.67.193", + "type": "user-session", + "primary": "ssh" + }, + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "root" + } + }, + "sequence": 43270, + "result": "fail" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "q9sAU2cBTFzn_XoLYwI6", + "source": { + "@timestamp": "2018-11-27T02:29:52.590Z", + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "beat": { + "hostname": "demo-stack-es-01", + "version": "7.0.0-alpha1", + "name": "demo-stack-es-01" + }, + "host": { + "name": "demo-stack-es-01" + }, + "process": { + "pid": "30802", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "128.0.118.65" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "sequence": 44276, + "result": "fail", + "session": "unset", + "data": { + "op": "login", + "acct": "(unknown user)", + "terminal": "sshd" + }, + "summary": { + "object": { + "secondary": "128.0.118.65", + "type": "user-session", + "primary": "sshd" + }, + "how": "/usr/sbin/sshd", + "actor": { + "secondary": "(unknown user)", + "primary": "unset" + } + } + }, + "event": { + "action": "logged-in", + "module": "auditd", + "category": "user-login", + "type": "user_login" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "rNsAU2cBTFzn_XoLYwI6", + "source": { + "@timestamp": "2018-11-27T02:29:52.590Z", + "network": { + "direction": "incoming" + }, + "auditd": { + "data": { + "op": "login", + "acct": "(invalid user)", + "terminal": "sshd" + }, + "summary": { + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + }, + "object": { + "secondary": "128.0.118.65", + "type": "user-session", + "primary": "sshd" + } + }, + "sequence": 44277, + "result": "fail", + "session": "unset" + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + }, + "user": { + "auid": "unset", + "uid": "0", + "name_map": { + "uid": "root" + } + }, + "process": { + "exe": "/usr/sbin/sshd", + "pid": "30802" + }, + "source": { + "ip": "128.0.118.65" + }, + "beat": { + "name": "demo-stack-es-01", + "hostname": "demo-stack-es-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-es-01" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "rdsAU2cBTFzn_XoLYwI6", + "source": { + "@timestamp": "2018-11-27T02:29:52.694Z", + "beat": { + "hostname": "demo-stack-es-01", + "version": "7.0.0-alpha1", + "name": "demo-stack-es-01" + }, + "event": { + "type": "user_err", + "action": "error", + "module": "auditd", + "category": "user-login" + }, + "user": { + "auid": "unset", + "uid": "0", + "name_map": { + "uid": "root" + } + }, + "process": { + "pid": "30802", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "128.0.118.65" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "session": "unset", + "data": { + "op": "PAM:bad_ident", + "terminal": "ssh", + "hostname": "128.0.118.65" + }, + "summary": { + "actor": { + "secondary": "root", + "primary": "unset" + }, + "object": { + "primary": "ssh", + "secondary": "128.0.118.65", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 44278, + "result": "fail" + }, + "host": { + "name": "demo-stack-es-01" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "0twMU2cBTFzn_XoL7xUF", + "source": { + "@timestamp": "2018-11-27T02:43:34.811Z", + "source": { + "ip": "167.99.54.4" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "sequence": 184466, + "result": "fail", + "session": "unset", + "data": { + "acct": "(unknown user)", + "terminal": "sshd", + "op": "login" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + }, + "object": { + "type": "user-session", + "primary": "sshd", + "secondary": "167.99.54.4" + }, + "how": "/usr/sbin/sshd" + } + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + }, + "beat": { + "name": "demo-stack-apache-01", + "hostname": "demo-stack-apache-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-apache-01" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "exe": "/usr/sbin/sshd", + "pid": "26446" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "09wMU2cBTFzn_XoL7xUF", + "source": { + "@timestamp": "2018-11-27T02:43:34.812Z", + "source": { + "ip": "167.99.54.4" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "data": { + "acct": "(invalid user)", + "terminal": "sshd", + "op": "login" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + }, + "object": { + "type": "user-session", + "primary": "sshd", + "secondary": "167.99.54.4" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 184467, + "result": "fail", + "session": "unset" + }, + "beat": { + "name": "demo-stack-apache-01", + "hostname": "demo-stack-apache-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-apache-01" + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "exe": "/usr/sbin/sshd", + "pid": "26446" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "1NwMU2cBTFzn_XoL7xUF", + "source": { + "@timestamp": "2018-11-27T02:43:34.843Z", + "process": { + "pid": "26446", + "exe": "/usr/sbin/sshd" + }, + "beat": { + "name": "demo-stack-apache-01", + "hostname": "demo-stack-apache-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-apache-01" + }, + "source": { + "ip": "167.99.54.4" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "data": { + "hostname": "167.99.54.4", + "op": "PAM:bad_ident", + "terminal": "ssh" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "root" + }, + "object": { + "primary": "ssh", + "secondary": "167.99.54.4", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 184468, + "result": "fail", + "session": "unset" + }, + "event": { + "action": "error", + "module": "auditd", + "category": "user-login", + "type": "user_err" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "3dwMU2cBTFzn_XoL9RW0", + "source": { + "@timestamp": "2018-11-27T02:43:36.522Z", + "event": { + "action": "logged-in", + "module": "auditd", + "category": "user-login", + "type": "user_login" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "pid": "26448", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "37.120.174.127" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "sequence": 184469, + "result": "fail", + "session": "unset", + "data": { + "terminal": "sshd", + "acct": "(unknown user)", + "op": "login" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + }, + "object": { + "secondary": "37.120.174.127", + "type": "user-session", + "primary": "sshd" + }, + "how": "/usr/sbin/sshd" + } + }, + "host": { + "name": "demo-stack-apache-01" + }, + "beat": { + "name": "demo-stack-apache-01", + "hostname": "demo-stack-apache-01", + "version": "7.0.0-alpha1" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "3twMU2cBTFzn_XoL9RW0", + "source": { + "@timestamp": "2018-11-27T02:43:36.524Z", + "source": { + "ip": "37.120.174.127" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "result": "fail", + "session": "unset", + "data": { + "acct": "(invalid user)", + "terminal": "sshd", + "op": "login" + }, + "summary": { + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + }, + "object": { + "primary": "sshd", + "secondary": "37.120.174.127", + "type": "user-session" + } + }, + "sequence": 184470 + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + }, + "beat": { + "name": "demo-stack-apache-01", + "hostname": "demo-stack-apache-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-apache-01" + }, + "user": { + "name_map": { + "uid": "root" + }, + "uid": "0", + "auid": "unset" + }, + "process": { + "pid": "26448", + "exe": "/usr/sbin/sshd" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "39wMU2cBTFzn_XoL9RW0", + "source": { + "@timestamp": "2018-11-27T02:43:36.635Z", + "auditd": { + "sequence": 184471, + "result": "fail", + "session": "unset", + "data": { + "terminal": "ssh", + "hostname": "37.120.174.127", + "op": "PAM:bad_ident" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "root" + }, + "object": { + "primary": "ssh", + "secondary": "37.120.174.127", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + } + }, + "event": { + "category": "user-login", + "type": "user_err", + "action": "error", + "module": "auditd" + }, + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + }, + "process": { + "pid": "26448", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "37.120.174.127" + }, + "beat": { + "name": "demo-stack-apache-01", + "hostname": "demo-stack-apache-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-apache-01" + }, + "network": { + "direction": "incoming" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "1twNU2cBTFzn_XoL_CyZ", + "source": { + "@timestamp": "2018-11-27T02:44:43.822Z", + "source": { + "ip": "104.248.123.206" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "data": { + "terminal": "sshd", + "op": "login", + "acct": "(unknown user)" + }, + "summary": { + "object": { + "primary": "sshd", + "secondary": "104.248.123.206", + "type": "user-session" + }, + "how": "/usr/sbin/sshd", + "actor": { + "secondary": "(unknown user)", + "primary": "unset" + } + }, + "sequence": 142450, + "result": "fail", + "session": "unset" + }, + "event": { + "type": "user_login", + "action": "logged-in", + "module": "auditd", + "category": "user-login" + }, + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + }, + "process": { + "pid": "20137", + "exe": "/usr/sbin/sshd" + }, + "beat": { + "name": "demo-stack-haproxy-01", + "hostname": "demo-stack-haproxy-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-haproxy-01" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "19wNU2cBTFzn_XoL_CyZ", + "source": { + "@timestamp": "2018-11-27T02:44:43.823Z", + "host": { + "name": "demo-stack-haproxy-01" + }, + "process": { + "exe": "/usr/sbin/sshd", + "pid": "20137" + }, + "source": { + "ip": "104.248.123.206" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "data": { + "op": "login", + "acct": "(invalid user)", + "terminal": "sshd" + }, + "summary": { + "actor": { + "secondary": "(invalid user)", + "primary": "unset" + }, + "object": { + "secondary": "104.248.123.206", + "type": "user-session", + "primary": "sshd" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 142451, + "result": "fail", + "session": "unset" + }, + "event": { + "action": "logged-in", + "module": "auditd", + "category": "user-login", + "type": "user_login" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "beat": { + "name": "demo-stack-haproxy-01", + "hostname": "demo-stack-haproxy-01", + "version": "7.0.0-alpha1" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "2NwNU2cBTFzn_XoL_CyZ", + "source": { + "@timestamp": "2018-11-27T02:44:43.854Z", + "process": { + "pid": "20137", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "104.248.123.206" + }, + "beat": { + "hostname": "demo-stack-haproxy-01", + "version": "7.0.0-alpha1", + "name": "demo-stack-haproxy-01" + }, + "host": { + "name": "demo-stack-haproxy-01" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "sequence": 142452, + "result": "fail", + "session": "unset", + "data": { + "hostname": "104.248.123.206", + "op": "PAM:bad_ident", + "terminal": "ssh" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "root" + }, + "object": { + "primary": "ssh", + "secondary": "104.248.123.206", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + } + }, + "event": { + "action": "error", + "module": "auditd", + "category": "user-login", + "type": "user_err" + }, + "user": { + "auid": "unset", + "uid": "0", + "name_map": { + "uid": "root" + } + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "sdwMU2cBTFzn_XoLxRBj", + "source": { + "@timestamp": "2018-11-27T02:43:22.108Z", + "source": { + "ip": "35.189.59.154" + }, + "network": { + "direction": "incoming" + }, + "beat": { + "name": "demo-stack-apache-01", + "hostname": "demo-stack-apache-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-apache-01" + }, + "auditd": { + "data": { + "terminal": "sshd", + "acct": "(unknown user)", + "op": "login" + }, + "summary": { + "actor": { + "secondary": "(unknown user)", + "primary": "unset" + }, + "object": { + "primary": "sshd", + "secondary": "35.189.59.154", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 184463, + "result": "fail", + "session": "unset" + }, + "event": { + "type": "user_login", + "action": "logged-in", + "module": "auditd", + "category": "user-login" + }, + "user": { + "uid": "0", + "auid": "unset", + "name_map": { + "uid": "root" + } + }, + "process": { + "pid": "26443", + "exe": "/usr/sbin/sshd" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "stwMU2cBTFzn_XoLxRBj", + "source": { + "@timestamp": "2018-11-27T02:43:22.109Z", + "host": { + "name": "demo-stack-apache-01" + }, + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + }, + "process": { + "pid": "26443", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "35.189.59.154" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "summary": { + "object": { + "secondary": "35.189.59.154", + "type": "user-session", + "primary": "sshd" + }, + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + } + }, + "sequence": 184464, + "result": "fail", + "session": "unset", + "data": { + "acct": "(invalid user)", + "op": "login", + "terminal": "sshd" + } + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + }, + "beat": { + "name": "demo-stack-apache-01", + "hostname": "demo-stack-apache-01", + "version": "7.0.0-alpha1" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "s9wMU2cBTFzn_XoLxRBj", + "source": { + "@timestamp": "2018-11-27T02:43:22.284Z", + "beat": { + "hostname": "demo-stack-apache-01", + "version": "7.0.0-alpha1", + "name": "demo-stack-apache-01" + }, + "host": { + "name": "demo-stack-apache-01" + }, + "auditd": { + "data": { + "terminal": "ssh", + "hostname": "35.189.59.154", + "op": "PAM:bad_ident" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "root" + }, + "object": { + "type": "user-session", + "primary": "ssh", + "secondary": "35.189.59.154" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 184465, + "result": "fail", + "session": "unset" + }, + "event": { + "category": "user-login", + "type": "user_err", + "action": "error", + "module": "auditd" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "pid": "26443", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "35.189.59.154" + }, + "network": { + "direction": "incoming" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "S9wNU2cBTFzn_XoLwCiw", + "source": { + "@timestamp": "2018-11-27T02:44:28.486Z", + "host": { + "name": "demo-stack-redis-01" + }, + "source": { + "ip": "209.240.59.106" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "sequence": 186642, + "result": "fail", + "session": "unset", + "data": { + "acct": "(unknown user)", + "terminal": "sshd", + "op": "login" + }, + "summary": { + "object": { + "type": "user-session", + "primary": "sshd", + "secondary": "209.240.59.106" + }, + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + } + } + }, + "event": { + "module": "auditd", + "category": "user-login", + "type": "user_login", + "action": "logged-in" + }, + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + }, + "process": { + "pid": "32760", + "exe": "/usr/sbin/sshd" + }, + "beat": { + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "TNwNU2cBTFzn_XoLwCiw", + "source": { + "@timestamp": "2018-11-27T02:44:28.487Z", + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + }, + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + }, + "process": { + "pid": "32760", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "209.240.59.106" + }, + "network": { + "direction": "incoming" + }, + "beat": { + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-redis-01" + }, + "auditd": { + "data": { + "op": "login", + "acct": "(invalid user)", + "terminal": "sshd" + }, + "summary": { + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + }, + "object": { + "primary": "sshd", + "secondary": "209.240.59.106", + "type": "user-session" + } + }, + "sequence": 186643, + "result": "fail", + "session": "unset" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "TdwNU2cBTFzn_XoLwCiw", + "source": { + "@timestamp": "2018-11-27T02:44:28.539Z", + "process": { + "pid": "32760", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "209.240.59.106" + }, + "network": { + "direction": "incoming" + }, + "beat": { + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-redis-01" + }, + "auditd": { + "summary": { + "actor": { + "secondary": "root", + "primary": "unset" + }, + "object": { + "primary": "ssh", + "secondary": "209.240.59.106", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 186644, + "result": "fail", + "session": "unset", + "data": { + "op": "PAM:bad_ident", + "hostname": "209.240.59.106", + "terminal": "ssh" + } + }, + "event": { + "category": "user-login", + "type": "user_err", + "action": "error", + "module": "auditd" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "FNwNU2cBTFzn_XoL4yrB", + "source": { + "@timestamp": "2018-11-27T02:44:37.463Z", + "event": { + "module": "auditd", + "category": "user-login", + "type": "user_login", + "action": "logged-in" + }, + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + }, + "process": { + "pid": "32763", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "51.254.123.131" + }, + "host": { + "name": "demo-stack-redis-01" + }, + "beat": { + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1", + "name": "demo-stack-redis-01" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "session": "unset", + "data": { + "acct": "(unknown user)", + "op": "login", + "terminal": "sshd" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + }, + "object": { + "primary": "sshd", + "secondary": "51.254.123.131", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 186645, + "result": "fail" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "FdwNU2cBTFzn_XoL4yrB", + "source": { + "@timestamp": "2018-11-27T02:44:37.464Z", + "auditd": { + "result": "fail", + "session": "unset", + "data": { + "acct": "(invalid user)", + "op": "login", + "terminal": "sshd" + }, + "summary": { + "actor": { + "secondary": "(invalid user)", + "primary": "unset" + }, + "object": { + "secondary": "51.254.123.131", + "type": "user-session", + "primary": "sshd" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 186646 + }, + "event": { + "type": "user_login", + "action": "logged-in", + "module": "auditd", + "category": "user-login" + }, + "user": { + "auid": "unset", + "uid": "0", + "name_map": { + "uid": "root" + } + }, + "process": { + "pid": "32763", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "51.254.123.131" + }, + "network": { + "direction": "incoming" + }, + "beat": { + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1", + "name": "demo-stack-redis-01" + }, + "host": { + "name": "demo-stack-redis-01" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "FtwNU2cBTFzn_XoL4yrB", + "source": { + "@timestamp": "2018-11-27T02:44:37.575Z", + "host": { + "name": "demo-stack-redis-01" + }, + "process": { + "pid": "32763", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "51.254.123.131" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "result": "fail", + "session": "unset", + "data": { + "terminal": "ssh", + "op": "PAM:bad_ident", + "hostname": "51.254.123.131" + }, + "summary": { + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "root" + }, + "object": { + "primary": "ssh", + "secondary": "51.254.123.131", + "type": "user-session" + } + }, + "sequence": 186647 + }, + "event": { + "category": "user-login", + "type": "user_err", + "action": "error", + "module": "auditd" + }, + "user": { + "name_map": { + "uid": "root" + }, + "auid": "unset", + "uid": "0" + }, + "beat": { + "version": "7.0.0-alpha1", + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "ldwMU2cBTFzn_XoLmw6z", + "source": { + "@timestamp": "2018-11-27T02:43:13.482Z", + "process": { + "pid": "1168", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "158.69.59.90" + }, + "beat": { + "name": "demo-stack-nginx-01", + "hostname": "demo-stack-nginx-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-nginx-01" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "data": { + "terminal": "sshd", + "acct": "(unknown user)", + "op": "login" + }, + "summary": { + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + }, + "object": { + "type": "user-session", + "primary": "sshd", + "secondary": "158.69.59.90" + } + }, + "sequence": 192646, + "result": "fail", + "session": "unset" + }, + "event": { + "action": "logged-in", + "module": "auditd", + "category": "user-login", + "type": "user_login" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "ltwMU2cBTFzn_XoLmw6z", + "source": { + "@timestamp": "2018-11-27T02:43:13.483Z", + "host": { + "name": "demo-stack-nginx-01" + }, + "source": { + "ip": "158.69.59.90" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "result": "fail", + "session": "unset", + "data": { + "terminal": "sshd", + "acct": "(invalid user)", + "op": "login" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + }, + "object": { + "type": "user-session", + "primary": "sshd", + "secondary": "158.69.59.90" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 192647 + }, + "event": { + "type": "user_login", + "action": "logged-in", + "module": "auditd", + "category": "user-login" + }, + "user": { + "auid": "unset", + "uid": "0", + "name_map": { + "uid": "root" + } + }, + "process": { + "pid": "1168", + "exe": "/usr/sbin/sshd" + }, + "beat": { + "name": "demo-stack-nginx-01", + "hostname": "demo-stack-nginx-01", + "version": "7.0.0-alpha1" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "l9wMU2cBTFzn_XoLmw6z", + "source": { + "@timestamp": "2018-11-27T02:43:13.525Z", + "network": { + "direction": "incoming" + }, + "auditd": { + "result": "fail", + "session": "unset", + "data": { + "op": "PAM:bad_ident", + "hostname": "158.69.59.90", + "terminal": "ssh" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "root" + }, + "object": { + "primary": "ssh", + "secondary": "158.69.59.90", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 192648 + }, + "event": { + "module": "auditd", + "category": "user-login", + "type": "user_err", + "action": "error" + }, + "beat": { + "name": "demo-stack-nginx-01", + "hostname": "demo-stack-nginx-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-nginx-01" + }, + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + }, + "process": { + "pid": "1168", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "158.69.59.90" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "ZdwOU2cBTFzn_XoLGy-N", + "source": { + "@timestamp": "2018-11-27T02:44:51.746Z", + "network": { + "direction": "incoming" + }, + "auditd": { + "summary": { + "object": { + "primary": "sshd", + "secondary": "71.174.75.11", + "type": "user-session" + }, + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + } + }, + "sequence": 186648, + "result": "fail", + "session": "unset", + "data": { + "op": "login", + "terminal": "sshd", + "acct": "(unknown user)" + } + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + }, + "user": { + "auid": "unset", + "uid": "0", + "name_map": { + "uid": "root" + } + }, + "host": { + "name": "demo-stack-redis-01" + }, + "beat": { + "version": "7.0.0-alpha1", + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01" + }, + "process": { + "pid": "32765", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "71.174.75.11" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "ZtwOU2cBTFzn_XoLGy-N", + "source": { + "@timestamp": "2018-11-27T02:44:51.747Z", + "beat": { + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-redis-01" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "session": "unset", + "data": { + "terminal": "sshd", + "acct": "(invalid user)", + "op": "login" + }, + "summary": { + "object": { + "primary": "sshd", + "secondary": "71.174.75.11", + "type": "user-session" + }, + "how": "/usr/sbin/sshd", + "actor": { + "secondary": "(invalid user)", + "primary": "unset" + } + }, + "sequence": 186649, + "result": "fail" + }, + "event": { + "type": "user_login", + "action": "logged-in", + "module": "auditd", + "category": "user-login" + }, + "user": { + "name_map": { + "uid": "root" + }, + "auid": "unset", + "uid": "0" + }, + "process": { + "pid": "32765", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "71.174.75.11" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "Z9wOU2cBTFzn_XoLGy-N", + "source": { + "@timestamp": "2018-11-27T02:44:51.787Z", + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "pid": "32765", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "71.174.75.11" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "session": "unset", + "data": { + "hostname": "71.174.75.11", + "op": "PAM:bad_ident", + "terminal": "ssh" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "root" + }, + "object": { + "primary": "ssh", + "secondary": "71.174.75.11", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 186650, + "result": "fail" + }, + "event": { + "module": "auditd", + "category": "user-login", + "type": "user_err", + "action": "error" + }, + "beat": { + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-redis-01" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "C9wPU2cBTFzn_XoLYUv1", + "source": { + "@timestamp": "2018-11-27T02:46:15.305Z", + "process": { + "pid": "13218", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "159.89.180.93" + }, + "network": { + "direction": "incoming" + }, + "beat": { + "name": "demo-stack-mysql-01", + "hostname": "demo-stack-mysql-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-mysql-01" + }, + "auditd": { + "sequence": 43288, + "result": "fail", + "session": "unset", + "data": { + "op": "login", + "acct": "(unknown user)", + "terminal": "sshd" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + }, + "object": { + "primary": "sshd", + "secondary": "159.89.180.93", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + } + }, + "event": { + "module": "auditd", + "category": "user-login", + "type": "user_login", + "action": "logged-in" + }, + "user": { + "uid": "0", + "auid": "unset", + "name_map": { + "uid": "root" + } + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "DNwPU2cBTFzn_XoLYUv1", + "source": { + "@timestamp": "2018-11-27T02:46:15.305Z", + "event": { + "action": "logged-in", + "module": "auditd", + "category": "user-login", + "type": "user_login" + }, + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + }, + "process": { + "exe": "/usr/sbin/sshd", + "pid": "13218" + }, + "source": { + "ip": "159.89.180.93" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "sequence": 43289, + "result": "fail", + "session": "unset", + "data": { + "acct": "(invalid user)", + "terminal": "sshd", + "op": "login" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + }, + "object": { + "primary": "sshd", + "secondary": "159.89.180.93", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + } + }, + "beat": { + "name": "demo-stack-mysql-01", + "hostname": "demo-stack-mysql-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-mysql-01" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "DdwPU2cBTFzn_XoLYUv1", + "source": { + "@timestamp": "2018-11-27T02:46:15.337Z", + "source": { + "ip": "159.89.180.93" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "session": "unset", + "data": { + "hostname": "159.89.180.93", + "op": "PAM:bad_ident", + "terminal": "ssh" + }, + "summary": { + "how": "/usr/sbin/sshd", + "actor": { + "secondary": "root", + "primary": "unset" + }, + "object": { + "primary": "ssh", + "secondary": "159.89.180.93", + "type": "user-session" + } + }, + "sequence": 43290, + "result": "fail" + }, + "event": { + "type": "user_err", + "action": "error", + "module": "auditd", + "category": "user-login" + }, + "beat": { + "name": "demo-stack-mysql-01", + "hostname": "demo-stack-mysql-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-mysql-01" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "pid": "13218", + "exe": "/usr/sbin/sshd" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "_twNU2cBTFzn_XoLjiIW", + "source": { + "@timestamp": "2018-11-27T02:44:15.532Z", + "network": { + "direction": "incoming" + }, + "auditd": { + "result": "fail", + "session": "unset", + "data": { + "op": "PAM:bad_ident", + "terminal": "ssh", + "hostname": "217.141.88.34" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "root" + }, + "object": { + "type": "user-session", + "primary": "ssh", + "secondary": "217.141.88.34" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 142449 + }, + "event": { + "action": "error", + "module": "auditd", + "category": "user-login", + "type": "user_err" + }, + "beat": { + "name": "demo-stack-haproxy-01", + "hostname": "demo-stack-haproxy-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-haproxy-01" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "pid": "20129", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "217.141.88.34" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "5NwRU2cBTFzn_XoLtH2C", + "source": { + "@timestamp": "2018-11-27T02:48:47.512Z", + "network": { + "direction": "incoming" + }, + "beat": { + "name": "demo-stack-haproxy-01", + "hostname": "demo-stack-haproxy-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-haproxy-01" + }, + "auditd": { + "sequence": 142454, + "result": "fail", + "session": "unset", + "data": { + "acct": "(unknown user)", + "op": "login", + "terminal": "sshd" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + }, + "object": { + "type": "user-session", + "primary": "sshd", + "secondary": "51.15.251.165" + }, + "how": "/usr/sbin/sshd" + } + }, + "event": { + "action": "logged-in", + "module": "auditd", + "category": "user-login", + "type": "user_login" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "pid": "20159", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "51.15.251.165" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "5dwRU2cBTFzn_XoLtH2C", + "source": { + "@timestamp": "2018-11-27T02:48:47.513Z", + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "exe": "/usr/sbin/sshd", + "pid": "20159" + }, + "source": { + "ip": "51.15.251.165" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "summary": { + "object": { + "secondary": "51.15.251.165", + "type": "user-session", + "primary": "sshd" + }, + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + } + }, + "sequence": 142455, + "result": "fail", + "session": "unset", + "data": { + "op": "login", + "acct": "(invalid user)", + "terminal": "sshd" + } + }, + "beat": { + "hostname": "demo-stack-haproxy-01", + "version": "7.0.0-alpha1", + "name": "demo-stack-haproxy-01" + }, + "host": { + "name": "demo-stack-haproxy-01" + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "5twRU2cBTFzn_XoLtH2C", + "source": { + "@timestamp": "2018-11-27T02:48:47.619Z", + "event": { + "type": "user_err", + "action": "error", + "module": "auditd", + "category": "user-login" + }, + "user": { + "name_map": { + "uid": "root" + }, + "auid": "unset", + "uid": "0" + }, + "process": { + "pid": "20159", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "51.15.251.165" + }, + "network": { + "direction": "incoming" + }, + "beat": { + "name": "demo-stack-haproxy-01", + "hostname": "demo-stack-haproxy-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-haproxy-01" + }, + "auditd": { + "session": "unset", + "data": { + "op": "PAM:bad_ident", + "hostname": "51.15.251.165", + "terminal": "ssh" + }, + "summary": { + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "root" + }, + "object": { + "primary": "ssh", + "secondary": "51.15.251.165", + "type": "user-session" + } + }, + "sequence": 142456, + "result": "fail" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "sdwQU2cBTFzn_XoLA1gL", + "source": { + "@timestamp": "2018-11-27T02:46:56.545Z", + "process": { + "pid": "26473", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "35.243.183.165" + }, + "network": { + "direction": "incoming" + }, + "beat": { + "name": "demo-stack-apache-01", + "hostname": "demo-stack-apache-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-apache-01" + }, + "auditd": { + "session": "unset", + "data": { + "op": "login", + "acct": "(unknown user)", + "terminal": "sshd" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + }, + "object": { + "primary": "sshd", + "secondary": "35.243.183.165", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 184472, + "result": "fail" + }, + "event": { + "type": "user_login", + "action": "logged-in", + "module": "auditd", + "category": "user-login" + }, + "user": { + "name_map": { + "uid": "root" + }, + "uid": "0", + "auid": "unset" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "stwQU2cBTFzn_XoLA1gL", + "source": { + "@timestamp": "2018-11-27T02:46:56.546Z", + "host": { + "name": "demo-stack-apache-01" + }, + "beat": { + "name": "demo-stack-apache-01", + "hostname": "demo-stack-apache-01", + "version": "7.0.0-alpha1" + }, + "user": { + "name_map": { + "uid": "root" + }, + "uid": "0", + "auid": "unset" + }, + "process": { + "pid": "26473", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "35.243.183.165" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "data": { + "op": "login", + "acct": "(invalid user)", + "terminal": "sshd" + }, + "summary": { + "object": { + "primary": "sshd", + "secondary": "35.243.183.165", + "type": "user-session" + }, + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + } + }, + "sequence": 184473, + "result": "fail", + "session": "unset" + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "s9wQU2cBTFzn_XoLA1gL", + "source": { + "@timestamp": "2018-11-27T02:46:56.586Z", + "user": { + "auid": "unset", + "uid": "0", + "name_map": { + "uid": "root" + } + }, + "process": { + "exe": "/usr/sbin/sshd", + "pid": "26473" + }, + "source": { + "ip": "35.243.183.165" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "summary": { + "object": { + "primary": "ssh", + "secondary": "35.243.183.165", + "type": "user-session" + }, + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "root" + } + }, + "sequence": 184474, + "result": "fail", + "session": "unset", + "data": { + "hostname": "35.243.183.165", + "terminal": "ssh", + "op": "PAM:bad_ident" + } + }, + "beat": { + "hostname": "demo-stack-apache-01", + "version": "7.0.0-alpha1", + "name": "demo-stack-apache-01" + }, + "host": { + "name": "demo-stack-apache-01" + }, + "event": { + "category": "user-login", + "type": "user_err", + "action": "error", + "module": "auditd" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "mdwQU2cBTFzn_XoLL132", + "source": { + "@timestamp": "2018-11-27T02:47:08.044Z", + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + }, + "process": { + "pid": "1190", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "219.65.51.21" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "data": { + "acct": "(unknown user)", + "terminal": "sshd", + "op": "login" + }, + "summary": { + "object": { + "primary": "sshd", + "secondary": "219.65.51.21", + "type": "user-session" + }, + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + } + }, + "sequence": 192649, + "result": "fail", + "session": "unset" + }, + "beat": { + "name": "demo-stack-nginx-01", + "hostname": "demo-stack-nginx-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-nginx-01" + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "mtwQU2cBTFzn_XoLL132", + "source": { + "@timestamp": "2018-11-27T02:47:08.045Z", + "process": { + "pid": "1190", + "exe": "/usr/sbin/sshd" + }, + "beat": { + "hostname": "demo-stack-nginx-01", + "version": "7.0.0-alpha1", + "name": "demo-stack-nginx-01" + }, + "host": { + "name": "demo-stack-nginx-01" + }, + "source": { + "ip": "219.65.51.21" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "result": "fail", + "session": "unset", + "data": { + "op": "login", + "terminal": "sshd", + "acct": "(invalid user)" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + }, + "object": { + "primary": "sshd", + "secondary": "219.65.51.21", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 192650 + }, + "event": { + "action": "logged-in", + "module": "auditd", + "category": "user-login", + "type": "user_login" + }, + "user": { + "auid": "unset", + "uid": "0", + "name_map": { + "uid": "root" + } + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "m9wQU2cBTFzn_XoLL132", + "source": { + "@timestamp": "2018-11-27T02:47:08.272Z", + "host": { + "name": "demo-stack-nginx-01" + }, + "event": { + "module": "auditd", + "category": "user-login", + "type": "user_err", + "action": "error" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "pid": "1190", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "219.65.51.21" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "summary": { + "object": { + "secondary": "219.65.51.21", + "type": "user-session", + "primary": "ssh" + }, + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "root" + } + }, + "sequence": 192651, + "result": "fail", + "session": "unset", + "data": { + "terminal": "ssh", + "op": "PAM:bad_ident", + "hostname": "219.65.51.21" + } + }, + "beat": { + "name": "demo-stack-nginx-01", + "hostname": "demo-stack-nginx-01", + "version": "7.0.0-alpha1" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "EdwQU2cBTFzn_XoLXmE8", + "source": { + "@timestamp": "2018-11-27T02:47:19.890Z", + "auditd": { + "sequence": 184475, + "result": "fail", + "session": "unset", + "data": { + "terminal": "sshd", + "op": "login", + "acct": "(unknown user)" + }, + "summary": { + "object": { + "primary": "sshd", + "secondary": "178.128.119.59", + "type": "user-session" + }, + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + } + } + }, + "beat": { + "name": "demo-stack-apache-01", + "hostname": "demo-stack-apache-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-apache-01" + }, + "event": { + "type": "user_login", + "action": "logged-in", + "module": "auditd", + "category": "user-login" + }, + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + }, + "process": { + "exe": "/usr/sbin/sshd", + "pid": "26475" + }, + "source": { + "ip": "178.128.119.59" + }, + "network": { + "direction": "incoming" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "EtwQU2cBTFzn_XoLXmE8", + "source": { + "@timestamp": "2018-11-27T02:47:19.892Z", + "auditd": { + "data": { + "terminal": "sshd", + "op": "login", + "acct": "(invalid user)" + }, + "summary": { + "object": { + "primary": "sshd", + "secondary": "178.128.119.59", + "type": "user-session" + }, + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + } + }, + "sequence": 184476, + "result": "fail", + "session": "unset" + }, + "event": { + "type": "user_login", + "action": "logged-in", + "module": "auditd", + "category": "user-login" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "pid": "26475", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "178.128.119.59" + }, + "beat": { + "name": "demo-stack-apache-01", + "hostname": "demo-stack-apache-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-apache-01" + }, + "network": { + "direction": "incoming" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "E9wQU2cBTFzn_XoLXmE8", + "source": { + "@timestamp": "2018-11-27T02:47:20.084Z", + "event": { + "type": "user_err", + "action": "error", + "module": "auditd", + "category": "user-login" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "pid": "26475", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "178.128.119.59" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "sequence": 184477, + "result": "fail", + "session": "unset", + "data": { + "hostname": "178.128.119.59", + "terminal": "ssh", + "op": "PAM:bad_ident" + }, + "summary": { + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "root" + }, + "object": { + "primary": "ssh", + "secondary": "178.128.119.59", + "type": "user-session" + } + } + }, + "beat": { + "name": "demo-stack-apache-01", + "hostname": "demo-stack-apache-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-apache-01" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "LNwRU2cBTFzn_XoLM3Pb", + "source": { + "@timestamp": "2018-11-27T02:48:14.577Z", + "process": { + "exe": "/usr/sbin/sshd", + "pid": "319" + }, + "source": { + "ip": "120.197.130.118" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "session": "unset", + "data": { + "op": "login", + "acct": "(unknown user)", + "terminal": "sshd" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + }, + "object": { + "primary": "sshd", + "secondary": "120.197.130.118", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 186654, + "result": "fail" + }, + "beat": { + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-redis-01" + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + }, + "user": { + "name_map": { + "uid": "root" + }, + "auid": "unset", + "uid": "0" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "LdwRU2cBTFzn_XoLM3Pb", + "source": { + "@timestamp": "2018-11-27T02:48:14.578Z", + "auditd": { + "sequence": 186655, + "result": "fail", + "session": "unset", + "data": { + "acct": "(invalid user)", + "terminal": "sshd", + "op": "login" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + }, + "object": { + "primary": "sshd", + "secondary": "120.197.130.118", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + } + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + }, + "user": { + "name_map": { + "uid": "root" + }, + "auid": "unset", + "uid": "0" + }, + "beat": { + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-redis-01" + }, + "process": { + "exe": "/usr/sbin/sshd", + "pid": "319" + }, + "source": { + "ip": "120.197.130.118" + }, + "network": { + "direction": "incoming" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "LtwRU2cBTFzn_XoLM3Pb", + "source": { + "@timestamp": "2018-11-27T02:48:14.782Z", + "process": { + "pid": "319", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "120.197.130.118" + }, + "network": { + "direction": "incoming" + }, + "beat": { + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-redis-01" + }, + "auditd": { + "summary": { + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "root" + }, + "object": { + "secondary": "120.197.130.118", + "type": "user-session", + "primary": "ssh" + } + }, + "sequence": 186656, + "result": "fail", + "session": "unset", + "data": { + "op": "PAM:bad_ident", + "terminal": "ssh", + "hostname": "120.197.130.118" + } + }, + "event": { + "category": "user-login", + "type": "user_err", + "action": "error", + "module": "auditd" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "gtwRU2cBTFzn_XoLA25t", + "source": { + "@timestamp": "2018-11-27T02:48:02.179Z", + "process": { + "pid": "26483", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "128.0.118.65" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "summary": { + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + }, + "object": { + "type": "user-session", + "primary": "sshd", + "secondary": "128.0.118.65" + } + }, + "sequence": 184478, + "result": "fail", + "session": "unset", + "data": { + "terminal": "sshd", + "op": "login", + "acct": "(unknown user)" + } + }, + "event": { + "action": "logged-in", + "module": "auditd", + "category": "user-login", + "type": "user_login" + }, + "user": { + "uid": "0", + "auid": "unset", + "name_map": { + "uid": "root" + } + }, + "beat": { + "name": "demo-stack-apache-01", + "hostname": "demo-stack-apache-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-apache-01" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "g9wRU2cBTFzn_XoLA25t", + "source": { + "@timestamp": "2018-11-27T02:48:02.180Z", + "process": { + "pid": "26483", + "exe": "/usr/sbin/sshd" + }, + "host": { + "name": "demo-stack-apache-01" + }, + "beat": { + "name": "demo-stack-apache-01", + "hostname": "demo-stack-apache-01", + "version": "7.0.0-alpha1" + }, + "source": { + "ip": "128.0.118.65" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "sequence": 184479, + "result": "fail", + "session": "unset", + "data": { + "terminal": "sshd", + "op": "login", + "acct": "(invalid user)" + }, + "summary": { + "object": { + "primary": "sshd", + "secondary": "128.0.118.65", + "type": "user-session" + }, + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + } + } + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + }, + "user": { + "uid": "0", + "auid": "unset", + "name_map": { + "uid": "root" + } + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "hNwRU2cBTFzn_XoLA25t", + "source": { + "@timestamp": "2018-11-27T02:48:02.288Z", + "beat": { + "name": "demo-stack-apache-01", + "hostname": "demo-stack-apache-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-apache-01" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "session": "unset", + "data": { + "terminal": "ssh", + "op": "PAM:bad_ident", + "hostname": "128.0.118.65" + }, + "summary": { + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "root" + }, + "object": { + "secondary": "128.0.118.65", + "type": "user-session", + "primary": "ssh" + } + }, + "sequence": 184480, + "result": "fail" + }, + "event": { + "category": "user-login", + "type": "user_err", + "action": "error", + "module": "auditd" + }, + "user": { + "auid": "unset", + "uid": "0", + "name_map": { + "uid": "root" + } + }, + "process": { + "pid": "26483", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "128.0.118.65" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "1dwQU2cBTFzn_XoLnGVv", + "source": { + "@timestamp": "2018-11-27T02:47:35.813Z", + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "pid": "312", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "169.61.96.71" + }, + "network": { + "direction": "incoming" + }, + "beat": { + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-redis-01" + }, + "auditd": { + "result": "fail", + "session": "unset", + "data": { + "op": "login", + "terminal": "sshd", + "acct": "(unknown user)" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + }, + "object": { + "primary": "sshd", + "secondary": "169.61.96.71", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 186651 + }, + "event": { + "module": "auditd", + "category": "user-login", + "type": "user_login", + "action": "logged-in" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "1twQU2cBTFzn_XoLnGVv", + "source": { + "@timestamp": "2018-11-27T02:47:35.815Z", + "network": { + "direction": "incoming" + }, + "beat": { + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-redis-01" + }, + "auditd": { + "session": "unset", + "data": { + "terminal": "sshd", + "acct": "(invalid user)", + "op": "login" + }, + "summary": { + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + }, + "object": { + "secondary": "169.61.96.71", + "type": "user-session", + "primary": "sshd" + } + }, + "sequence": 186652, + "result": "fail" + }, + "event": { + "module": "auditd", + "category": "user-login", + "type": "user_login", + "action": "logged-in" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "pid": "312", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "169.61.96.71" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "19wQU2cBTFzn_XoLnGVv", + "source": { + "@timestamp": "2018-11-27T02:47:35.854Z", + "auditd": { + "data": { + "hostname": "169.61.96.71", + "terminal": "ssh", + "op": "PAM:bad_ident" + }, + "summary": { + "how": "/usr/sbin/sshd", + "actor": { + "secondary": "root", + "primary": "unset" + }, + "object": { + "primary": "ssh", + "secondary": "169.61.96.71", + "type": "user-session" + } + }, + "sequence": 186653, + "result": "fail", + "session": "unset" + }, + "event": { + "type": "user_err", + "action": "error", + "module": "auditd", + "category": "user-login" + }, + "user": { + "name_map": { + "uid": "root" + }, + "auid": "unset", + "uid": "0" + }, + "process": { + "pid": "312", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "169.61.96.71" + }, + "beat": { + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1", + "name": "demo-stack-redis-01" + }, + "host": { + "name": "demo-stack-redis-01" + }, + "network": { + "direction": "incoming" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "ItwQU2cBTFzn_XoL2Gtu", + "source": { + "@timestamp": "2018-11-27T02:47:51.172Z", + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "exe": "/usr/sbin/sshd", + "pid": "20151" + }, + "source": { + "ip": "104.248.157.6" + }, + "host": { + "name": "demo-stack-haproxy-01" + }, + "beat": { + "name": "demo-stack-haproxy-01", + "hostname": "demo-stack-haproxy-01", + "version": "7.0.0-alpha1" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "data": { + "hostname": "104.248.157.6", + "terminal": "ssh", + "op": "PAM:bad_ident" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "root" + }, + "object": { + "primary": "ssh", + "secondary": "104.248.157.6", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 142453, + "result": "fail", + "session": "unset" + }, + "event": { + "category": "user-login", + "type": "user_err", + "action": "error", + "module": "auditd" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "adwPU2cBTFzn_XoLb0w5", + "source": { + "@timestamp": "2018-11-27T02:46:18.698Z", + "beat": { + "name": "demo-stack-es-01", + "hostname": "demo-stack-es-01", + "version": "7.0.0-alpha1" + }, + "source": { + "ip": "5.196.69.191" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "summary": { + "how": "/usr/sbin/sshd", + "actor": { + "secondary": "root", + "primary": "unset" + }, + "object": { + "primary": "ssh", + "secondary": "5.196.69.191", + "type": "user-session" + } + }, + "sequence": 44301, + "result": "fail", + "session": "unset", + "data": { + "terminal": "ssh", + "op": "PAM:bad_ident", + "hostname": "5.196.69.191" + } + }, + "event": { + "type": "user_err", + "action": "error", + "module": "auditd", + "category": "user-login" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "pid": "31309", + "exe": "/usr/sbin/sshd" + }, + "host": { + "name": "demo-stack-es-01" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "VNwTU2cBTFzn_XoL0qyL", + "source": { + "@timestamp": "2018-11-27T02:51:06.273Z", + "auditd": { + "result": "fail", + "session": "unset", + "data": { + "op": "login", + "terminal": "sshd", + "acct": "(unknown user)" + }, + "summary": { + "actor": { + "secondary": "(unknown user)", + "primary": "unset" + }, + "object": { + "primary": "sshd", + "secondary": "217.182.170.81", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 184484 + }, + "event": { + "module": "auditd", + "category": "user-login", + "type": "user_login", + "action": "logged-in" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "pid": "26505", + "exe": "/usr/sbin/sshd" + }, + "beat": { + "hostname": "demo-stack-apache-01", + "version": "7.0.0-alpha1", + "name": "demo-stack-apache-01" + }, + "host": { + "name": "demo-stack-apache-01" + }, + "source": { + "ip": "217.182.170.81" + }, + "network": { + "direction": "incoming" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "VdwTU2cBTFzn_XoL0qyL", + "source": { + "@timestamp": "2018-11-27T02:51:06.274Z", + "source": { + "ip": "217.182.170.81" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "summary": { + "how": "/usr/sbin/sshd", + "actor": { + "secondary": "(invalid user)", + "primary": "unset" + }, + "object": { + "primary": "sshd", + "secondary": "217.182.170.81", + "type": "user-session" + } + }, + "sequence": 184485, + "result": "fail", + "session": "unset", + "data": { + "op": "login", + "acct": "(invalid user)", + "terminal": "sshd" + } + }, + "event": { + "action": "logged-in", + "module": "auditd", + "category": "user-login", + "type": "user_login" + }, + "user": { + "uid": "0", + "auid": "unset", + "name_map": { + "uid": "root" + } + }, + "beat": { + "name": "demo-stack-apache-01", + "hostname": "demo-stack-apache-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-apache-01" + }, + "process": { + "exe": "/usr/sbin/sshd", + "pid": "26505" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "VtwTU2cBTFzn_XoL0qyL", + "source": { + "@timestamp": "2018-11-27T02:51:06.381Z", + "user": { + "uid": "0", + "auid": "unset", + "name_map": { + "uid": "root" + } + }, + "process": { + "pid": "26505", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "217.182.170.81" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "data": { + "terminal": "ssh", + "hostname": "217.182.170.81", + "op": "PAM:bad_ident" + }, + "summary": { + "actor": { + "secondary": "root", + "primary": "unset" + }, + "object": { + "primary": "ssh", + "secondary": "217.182.170.81", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 184486, + "result": "fail", + "session": "unset" + }, + "beat": { + "name": "demo-stack-apache-01", + "hostname": "demo-stack-apache-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-apache-01" + }, + "event": { + "type": "user_err", + "action": "error", + "module": "auditd", + "category": "user-login" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "R9wSU2cBTFzn_XoLfY-L", + "source": { + "@timestamp": "2018-11-27T02:49:38.977Z", + "host": { + "name": "demo-stack-redis-01" + }, + "source": { + "ip": "188.123.122.128" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "sequence": 186657, + "result": "fail", + "session": "unset", + "data": { + "op": "login", + "acct": "(unknown user)", + "terminal": "sshd" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + }, + "object": { + "primary": "sshd", + "secondary": "188.123.122.128", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + } + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "exe": "/usr/sbin/sshd", + "pid": "322" + }, + "beat": { + "version": "7.0.0-alpha1", + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "SNwSU2cBTFzn_XoLfY-L", + "source": { + "@timestamp": "2018-11-27T02:49:38.978Z", + "auditd": { + "sequence": 186658, + "result": "fail", + "session": "unset", + "data": { + "terminal": "sshd", + "acct": "(invalid user)", + "op": "login" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + }, + "object": { + "primary": "sshd", + "secondary": "188.123.122.128", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + } + }, + "beat": { + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1", + "name": "demo-stack-redis-01" + }, + "host": { + "name": "demo-stack-redis-01" + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + }, + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + }, + "process": { + "exe": "/usr/sbin/sshd", + "pid": "322" + }, + "source": { + "ip": "188.123.122.128" + }, + "network": { + "direction": "incoming" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "SdwSU2cBTFzn_XoLfY-L", + "source": { + "@timestamp": "2018-11-27T02:49:39.106Z", + "process": { + "exe": "/usr/sbin/sshd", + "pid": "322" + }, + "source": { + "ip": "188.123.122.128" + }, + "host": { + "name": "demo-stack-redis-01" + }, + "beat": { + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "summary": { + "object": { + "type": "user-session", + "primary": "ssh", + "secondary": "188.123.122.128" + }, + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "root" + } + }, + "sequence": 186659, + "result": "fail", + "session": "unset", + "data": { + "op": "PAM:bad_ident", + "hostname": "188.123.122.128", + "terminal": "ssh" + } + }, + "event": { + "module": "auditd", + "category": "user-login", + "type": "user_err", + "action": "error" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "MNwUU2cBTFzn_XoL4MOf", + "source": { + "@timestamp": "2018-11-27T02:52:15.413Z", + "host": { + "name": "demo-stack-haproxy-01" + }, + "source": { + "ip": "37.187.0.20" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "summary": { + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + }, + "object": { + "secondary": "37.187.0.20", + "type": "user-session", + "primary": "sshd" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 142457, + "result": "fail", + "session": "unset", + "data": { + "acct": "(unknown user)", + "terminal": "sshd", + "op": "login" + } + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + }, + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + }, + "process": { + "pid": "20179", + "exe": "/usr/sbin/sshd" + }, + "beat": { + "hostname": "demo-stack-haproxy-01", + "version": "7.0.0-alpha1", + "name": "demo-stack-haproxy-01" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "MdwUU2cBTFzn_XoL4MOf", + "source": { + "@timestamp": "2018-11-27T02:52:15.414Z", + "beat": { + "name": "demo-stack-haproxy-01", + "hostname": "demo-stack-haproxy-01", + "version": "7.0.0-alpha1" + }, + "source": { + "ip": "37.187.0.20" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "sequence": 142458, + "result": "fail", + "session": "unset", + "data": { + "terminal": "sshd", + "acct": "(invalid user)", + "op": "login" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + }, + "object": { + "type": "user-session", + "primary": "sshd", + "secondary": "37.187.0.20" + }, + "how": "/usr/sbin/sshd" + } + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + }, + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + }, + "process": { + "pid": "20179", + "exe": "/usr/sbin/sshd" + }, + "host": { + "name": "demo-stack-haproxy-01" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "MtwUU2cBTFzn_XoL4MOf", + "source": { + "@timestamp": "2018-11-27T02:52:15.522Z", + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "exe": "/usr/sbin/sshd", + "pid": "20179" + }, + "source": { + "ip": "37.187.0.20" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "sequence": 142459, + "result": "fail", + "session": "unset", + "data": { + "hostname": "37.187.0.20", + "op": "PAM:bad_ident", + "terminal": "ssh" + }, + "summary": { + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "root" + }, + "object": { + "primary": "ssh", + "secondary": "37.187.0.20", + "type": "user-session" + } + } + }, + "beat": { + "name": "demo-stack-haproxy-01", + "hostname": "demo-stack-haproxy-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-haproxy-01" + }, + "event": { + "module": "auditd", + "category": "user-login", + "type": "user_err", + "action": "error" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "AdwTU2cBTFzn_XoLjKds", + "source": { + "@timestamp": "2018-11-27T02:50:48.323Z", + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "pid": "26498", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "162.243.253.67" + }, + "network": { + "direction": "incoming" + }, + "beat": { + "name": "demo-stack-apache-01", + "hostname": "demo-stack-apache-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-apache-01" + }, + "auditd": { + "sequence": 184481, + "result": "fail", + "session": "unset", + "data": { + "op": "login", + "terminal": "sshd", + "acct": "(unknown user)" + }, + "summary": { + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + }, + "object": { + "primary": "sshd", + "secondary": "162.243.253.67", + "type": "user-session" + } + } + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "AtwTU2cBTFzn_XoLjKds", + "source": { + "@timestamp": "2018-11-27T02:50:48.324Z", + "beat": { + "name": "demo-stack-apache-01", + "hostname": "demo-stack-apache-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-apache-01" + }, + "auditd": { + "sequence": 184482, + "result": "fail", + "session": "unset", + "data": { + "op": "login", + "acct": "(invalid user)", + "terminal": "sshd" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + }, + "object": { + "primary": "sshd", + "secondary": "162.243.253.67", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + } + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + }, + "user": { + "name_map": { + "uid": "root" + }, + "auid": "unset", + "uid": "0" + }, + "process": { + "pid": "26498", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "162.243.253.67" + }, + "network": { + "direction": "incoming" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "A9wTU2cBTFzn_XoLjKds", + "source": { + "@timestamp": "2018-11-27T02:50:48.355Z", + "source": { + "ip": "162.243.253.67" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "session": "unset", + "data": { + "hostname": "162.243.253.67", + "terminal": "ssh", + "op": "PAM:bad_ident" + }, + "summary": { + "how": "/usr/sbin/sshd", + "actor": { + "secondary": "root", + "primary": "unset" + }, + "object": { + "primary": "ssh", + "secondary": "162.243.253.67", + "type": "user-session" + } + }, + "sequence": 184483, + "result": "fail" + }, + "event": { + "category": "user-login", + "type": "user_err", + "action": "error", + "module": "auditd" + }, + "user": { + "uid": "0", + "auid": "unset", + "name_map": { + "uid": "root" + } + }, + "beat": { + "name": "demo-stack-apache-01", + "hostname": "demo-stack-apache-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-apache-01" + }, + "process": { + "pid": "26498", + "exe": "/usr/sbin/sshd" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "KNwSU2cBTFzn_XoL6pgK", + "source": { + "@timestamp": "2018-11-27T02:50:06.744Z", + "network": { + "direction": "incoming" + }, + "auditd": { + "sequence": 43291, + "result": "fail", + "session": "unset", + "data": { + "terminal": "sshd", + "op": "login", + "acct": "(unknown user)" + }, + "summary": { + "actor": { + "secondary": "(unknown user)", + "primary": "unset" + }, + "object": { + "type": "user-session", + "primary": "sshd", + "secondary": "52.189.217.7" + }, + "how": "/usr/sbin/sshd" + } + }, + "event": { + "type": "user_login", + "action": "logged-in", + "module": "auditd", + "category": "user-login" + }, + "user": { + "name_map": { + "uid": "root" + }, + "uid": "0", + "auid": "unset" + }, + "process": { + "pid": "13243", + "exe": "/usr/sbin/sshd" + }, + "beat": { + "version": "7.0.0-alpha1", + "name": "demo-stack-mysql-01", + "hostname": "demo-stack-mysql-01" + }, + "host": { + "name": "demo-stack-mysql-01" + }, + "source": { + "ip": "52.189.217.7" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "KdwSU2cBTFzn_XoL6pgK", + "source": { + "@timestamp": "2018-11-27T02:50:06.748Z", + "process": { + "pid": "13243", + "exe": "/usr/sbin/sshd" + }, + "beat": { + "name": "demo-stack-mysql-01", + "hostname": "demo-stack-mysql-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-mysql-01" + }, + "source": { + "ip": "52.189.217.7" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "sequence": 43292, + "result": "fail", + "session": "unset", + "data": { + "acct": "(invalid user)", + "terminal": "sshd", + "op": "login" + }, + "summary": { + "object": { + "primary": "sshd", + "secondary": "52.189.217.7", + "type": "user-session" + }, + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + } + } + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + }, + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "KtwSU2cBTFzn_XoL6pgK", + "source": { + "@timestamp": "2018-11-27T02:50:06.964Z", + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "pid": "13243", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "52.189.217.7" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "result": "fail", + "session": "unset", + "data": { + "op": "PAM:bad_ident", + "terminal": "ssh", + "hostname": "52.189.217.7" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "root" + }, + "object": { + "type": "user-session", + "primary": "ssh", + "secondary": "52.189.217.7" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 43293 + }, + "beat": { + "name": "demo-stack-mysql-01", + "hostname": "demo-stack-mysql-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-mysql-01" + }, + "event": { + "action": "error", + "module": "auditd", + "category": "user-login", + "type": "user_err" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "pdwUU2cBTFzn_XoLmrwL", + "source": { + "@timestamp": "2018-11-27T02:51:57.342Z", + "process": { + "pid": "13252", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "45.122.222.185" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "data": { + "acct": "(unknown user)", + "terminal": "sshd", + "op": "login" + }, + "summary": { + "actor": { + "secondary": "(unknown user)", + "primary": "unset" + }, + "object": { + "type": "user-session", + "primary": "sshd", + "secondary": "45.122.222.185" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 43294, + "result": "fail", + "session": "unset" + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + }, + "beat": { + "name": "demo-stack-mysql-01", + "hostname": "demo-stack-mysql-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-mysql-01" + }, + "user": { + "name_map": { + "uid": "root" + }, + "auid": "unset", + "uid": "0" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "ptwUU2cBTFzn_XoLmrwL", + "source": { + "@timestamp": "2018-11-27T02:51:57.342Z", + "host": { + "name": "demo-stack-mysql-01" + }, + "source": { + "ip": "45.122.222.185" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "session": "unset", + "data": { + "op": "login", + "terminal": "sshd", + "acct": "(invalid user)" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + }, + "object": { + "primary": "sshd", + "secondary": "45.122.222.185", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 43295, + "result": "fail" + }, + "event": { + "module": "auditd", + "category": "user-login", + "type": "user_login", + "action": "logged-in" + }, + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + }, + "process": { + "exe": "/usr/sbin/sshd", + "pid": "13252" + }, + "beat": { + "name": "demo-stack-mysql-01", + "hostname": "demo-stack-mysql-01", + "version": "7.0.0-alpha1" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "p9wUU2cBTFzn_XoLmrwL", + "source": { + "@timestamp": "2018-11-27T02:51:57.590Z", + "event": { + "category": "user-login", + "type": "user_err", + "action": "error", + "module": "auditd" + }, + "user": { + "auid": "unset", + "uid": "0", + "name_map": { + "uid": "root" + } + }, + "process": { + "pid": "13252", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "45.122.222.185" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "sequence": 43296, + "result": "fail", + "session": "unset", + "data": { + "hostname": "45.122.222.185", + "op": "PAM:bad_ident", + "terminal": "ssh" + }, + "summary": { + "object": { + "primary": "ssh", + "secondary": "45.122.222.185", + "type": "user-session" + }, + "how": "/usr/sbin/sshd", + "actor": { + "secondary": "root", + "primary": "unset" + } + } + }, + "host": { + "name": "demo-stack-mysql-01" + }, + "beat": { + "name": "demo-stack-mysql-01", + "hostname": "demo-stack-mysql-01", + "version": "7.0.0-alpha1" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "0dwSU2cBTFzn_XoLxpVy", + "source": { + "@timestamp": "2018-11-27T02:49:57.640Z", + "event": { + "type": "user_login", + "action": "logged-in", + "module": "auditd", + "category": "user-login" + }, + "user": { + "auid": "unset", + "uid": "0", + "name_map": { + "uid": "root" + } + }, + "process": { + "exe": "/usr/sbin/sshd", + "pid": "331" + }, + "beat": { + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-redis-01" + }, + "source": { + "ip": "62.93.166.91" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "session": "unset", + "data": { + "acct": "(unknown user)", + "terminal": "sshd", + "op": "login" + }, + "summary": { + "actor": { + "secondary": "(unknown user)", + "primary": "unset" + }, + "object": { + "primary": "sshd", + "secondary": "62.93.166.91", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 186660, + "result": "fail" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "0twSU2cBTFzn_XoLxpVy", + "source": { + "@timestamp": "2018-11-27T02:49:57.641Z", + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "pid": "331", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "62.93.166.91" + }, + "beat": { + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-redis-01" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "summary": { + "actor": { + "secondary": "(invalid user)", + "primary": "unset" + }, + "object": { + "primary": "sshd", + "secondary": "62.93.166.91", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 186661, + "result": "fail", + "session": "unset", + "data": { + "op": "login", + "acct": "(invalid user)", + "terminal": "sshd" + } + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "09wSU2cBTFzn_XoLxpVy", + "source": { + "@timestamp": "2018-11-27T02:49:57.762Z", + "process": { + "pid": "331", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "62.93.166.91" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "data": { + "hostname": "62.93.166.91", + "op": "PAM:bad_ident", + "terminal": "ssh" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "root" + }, + "object": { + "type": "user-session", + "primary": "ssh", + "secondary": "62.93.166.91" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 186662, + "result": "fail", + "session": "unset" + }, + "event": { + "category": "user-login", + "type": "user_err", + "action": "error", + "module": "auditd" + }, + "beat": { + "name": "demo-stack-redis-01", + "hostname": "demo-stack-redis-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-redis-01" + }, + "user": { + "auid": "unset", + "uid": "0", + "name_map": { + "uid": "root" + } + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "UtwVU2cBTFzn_XoLNcpH", + "source": { + "@timestamp": "2018-11-27T02:52:37.083Z", + "network": { + "direction": "incoming" + }, + "auditd": { + "result": "fail", + "session": "unset", + "data": { + "op": "login", + "acct": "(unknown user)", + "terminal": "sshd" + }, + "summary": { + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + }, + "object": { + "secondary": "86.104.220.26", + "type": "user-session", + "primary": "sshd" + } + }, + "sequence": 44305 + }, + "event": { + "module": "auditd", + "category": "user-login", + "type": "user_login", + "action": "logged-in" + }, + "beat": { + "name": "demo-stack-es-01", + "hostname": "demo-stack-es-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-es-01" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "exe": "/usr/sbin/sshd", + "pid": "31435" + }, + "source": { + "ip": "86.104.220.26" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "U9wVU2cBTFzn_XoLNcpH", + "source": { + "@timestamp": "2018-11-27T02:52:37.083Z", + "network": { + "direction": "incoming" + }, + "auditd": { + "sequence": 44306, + "result": "fail", + "session": "unset", + "data": { + "acct": "(invalid user)", + "terminal": "sshd", + "op": "login" + }, + "summary": { + "object": { + "primary": "sshd", + "secondary": "86.104.220.26", + "type": "user-session" + }, + "how": "/usr/sbin/sshd", + "actor": { + "secondary": "(invalid user)", + "primary": "unset" + } + } + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "beat": { + "name": "demo-stack-es-01", + "hostname": "demo-stack-es-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-es-01" + }, + "process": { + "pid": "31435", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "86.104.220.26" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "VNwVU2cBTFzn_XoLNcpH", + "source": { + "@timestamp": "2018-11-27T02:52:37.223Z", + "auditd": { + "session": "unset", + "data": { + "hostname": "86.104.220.26", + "terminal": "ssh", + "op": "PAM:bad_ident" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "root" + }, + "object": { + "primary": "ssh", + "secondary": "86.104.220.26", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 44307, + "result": "fail" + }, + "event": { + "action": "error", + "module": "auditd", + "category": "user-login", + "type": "user_err" + }, + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + }, + "process": { + "pid": "31435", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "86.104.220.26" + }, + "beat": { + "name": "demo-stack-es-01", + "hostname": "demo-stack-es-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-es-01" + }, + "network": { + "direction": "incoming" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "qtwTU2cBTFzn_XoLRqAf", + "source": { + "@timestamp": "2018-11-27T02:50:30.321Z", + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "pid": "31389", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "178.62.61.192" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "data": { + "terminal": "sshd", + "op": "login", + "acct": "(unknown user)" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + }, + "object": { + "primary": "sshd", + "secondary": "178.62.61.192", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 44302, + "result": "fail", + "session": "unset" + }, + "beat": { + "name": "demo-stack-es-01", + "hostname": "demo-stack-es-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-es-01" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "q9wTU2cBTFzn_XoLRqAf", + "source": { + "@timestamp": "2018-11-27T02:50:30.321Z", + "auditd": { + "summary": { + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + }, + "object": { + "type": "user-session", + "primary": "sshd", + "secondary": "178.62.61.192" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 44303, + "result": "fail", + "session": "unset", + "data": { + "op": "login", + "acct": "(invalid user)", + "terminal": "sshd" + } + }, + "beat": { + "hostname": "demo-stack-es-01", + "version": "7.0.0-alpha1", + "name": "demo-stack-es-01" + }, + "host": { + "name": "demo-stack-es-01" + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + }, + "user": { + "uid": "0", + "auid": "unset", + "name_map": { + "uid": "root" + } + }, + "process": { + "pid": "31389", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "178.62.61.192" + }, + "network": { + "direction": "incoming" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "rNwTU2cBTFzn_XoLRqAf", + "source": { + "@timestamp": "2018-11-27T02:50:30.421Z", + "process": { + "exe": "/usr/sbin/sshd", + "pid": "31389" + }, + "source": { + "ip": "178.62.61.192" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "summary": { + "actor": { + "secondary": "root", + "primary": "unset" + }, + "object": { + "secondary": "178.62.61.192", + "type": "user-session", + "primary": "ssh" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 44304, + "result": "fail", + "session": "unset", + "data": { + "op": "PAM:bad_ident", + "terminal": "ssh", + "hostname": "178.62.61.192" + } + }, + "event": { + "category": "user-login", + "type": "user_err", + "action": "error", + "module": "auditd" + }, + "beat": { + "name": "demo-stack-es-01", + "hostname": "demo-stack-es-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-es-01" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "cdwXU2cBTFzn_XoLm_-X", + "source": { + "@timestamp": "2018-11-27T02:55:14.346Z", + "auditd": { + "session": "unset", + "data": { + "op": "login", + "acct": "(unknown user)", + "terminal": "sshd" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + }, + "object": { + "primary": "sshd", + "secondary": "144.217.42.212", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 43300, + "result": "fail" + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + }, + "beat": { + "name": "demo-stack-mysql-01", + "hostname": "demo-stack-mysql-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-mysql-01" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "pid": "13273", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "144.217.42.212" + }, + "network": { + "direction": "incoming" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "ctwXU2cBTFzn_XoLm_-X", + "source": { + "@timestamp": "2018-11-27T02:55:14.346Z", + "process": { + "pid": "13273", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "144.217.42.212" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "result": "fail", + "session": "unset", + "data": { + "op": "login", + "terminal": "sshd", + "acct": "(invalid user)" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + }, + "object": { + "primary": "sshd", + "secondary": "144.217.42.212", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 43301 + }, + "event": { + "action": "logged-in", + "module": "auditd", + "category": "user-login", + "type": "user_login" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "beat": { + "name": "demo-stack-mysql-01", + "hostname": "demo-stack-mysql-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-mysql-01" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "c9wXU2cBTFzn_XoLm_-X", + "source": { + "@timestamp": "2018-11-27T02:55:14.386Z", + "host": { + "name": "demo-stack-mysql-01" + }, + "user": { + "uid": "0", + "auid": "unset", + "name_map": { + "uid": "root" + } + }, + "process": { + "pid": "13273", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "144.217.42.212" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "session": "unset", + "data": { + "op": "PAM:bad_ident", + "terminal": "ssh", + "hostname": "144.217.42.212" + }, + "summary": { + "actor": { + "secondary": "root", + "primary": "unset" + }, + "object": { + "primary": "ssh", + "secondary": "144.217.42.212", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 43302, + "result": "fail" + }, + "event": { + "module": "auditd", + "category": "user-login", + "type": "user_err", + "action": "error" + }, + "beat": { + "name": "demo-stack-mysql-01", + "hostname": "demo-stack-mysql-01", + "version": "7.0.0-alpha1" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "ztwXU2cBTFzn_XoLn_8Q", + "source": { + "@timestamp": "2018-11-27T02:55:15.179Z", + "event": { + "type": "user_login", + "action": "logged-in", + "module": "auditd", + "category": "user-login" + }, + "user": { + "auid": "unset", + "uid": "0", + "name_map": { + "uid": "root" + } + }, + "process": { + "pid": "1238", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "78.193.8.166" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "sequence": 192661, + "result": "fail", + "session": "unset", + "data": { + "op": "login", + "acct": "(unknown user)", + "terminal": "sshd" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + }, + "object": { + "secondary": "78.193.8.166", + "type": "user-session", + "primary": "sshd" + }, + "how": "/usr/sbin/sshd" + } + }, + "beat": { + "hostname": "demo-stack-nginx-01", + "version": "7.0.0-alpha1", + "name": "demo-stack-nginx-01" + }, + "host": { + "name": "demo-stack-nginx-01" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "z9wXU2cBTFzn_XoLn_8Q", + "source": { + "@timestamp": "2018-11-27T02:55:15.185Z", + "beat": { + "hostname": "demo-stack-nginx-01", + "version": "7.0.0-alpha1", + "name": "demo-stack-nginx-01" + }, + "host": { + "name": "demo-stack-nginx-01" + }, + "event": { + "type": "user_login", + "action": "logged-in", + "module": "auditd", + "category": "user-login" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "pid": "1238", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "78.193.8.166" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "sequence": 192662, + "result": "fail", + "session": "unset", + "data": { + "op": "login", + "acct": "(invalid user)", + "terminal": "sshd" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + }, + "object": { + "primary": "sshd", + "secondary": "78.193.8.166", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + } + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "0NwXU2cBTFzn_XoLn_8Q", + "source": { + "@timestamp": "2018-11-27T02:55:15.302Z", + "source": { + "ip": "78.193.8.166" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "summary": { + "object": { + "secondary": "78.193.8.166", + "type": "user-session", + "primary": "ssh" + }, + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "root" + } + }, + "sequence": 192663, + "result": "fail", + "session": "unset", + "data": { + "hostname": "78.193.8.166", + "terminal": "ssh", + "op": "PAM:bad_ident" + } + }, + "beat": { + "name": "demo-stack-nginx-01", + "hostname": "demo-stack-nginx-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-nginx-01" + }, + "event": { + "action": "error", + "module": "auditd", + "category": "user-login", + "type": "user_err" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "pid": "1238", + "exe": "/usr/sbin/sshd" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "8dwWU2cBTFzn_XoLK980", + "source": { + "@timestamp": "2018-11-27T02:53:40.043Z", + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "pid": "1225", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "165.227.184.21" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "sequence": 192652, + "result": "fail", + "session": "unset", + "data": { + "terminal": "sshd", + "acct": "(unknown user)", + "op": "login" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + }, + "object": { + "primary": "sshd", + "secondary": "165.227.184.21", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + } + }, + "beat": { + "name": "demo-stack-nginx-01", + "hostname": "demo-stack-nginx-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-nginx-01" + }, + "event": { + "type": "user_login", + "action": "logged-in", + "module": "auditd", + "category": "user-login" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "8twWU2cBTFzn_XoLK980", + "source": { + "@timestamp": "2018-11-27T02:53:40.044Z", + "process": { + "pid": "1225", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "165.227.184.21" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "result": "fail", + "session": "unset", + "data": { + "op": "login", + "acct": "(invalid user)", + "terminal": "sshd" + }, + "summary": { + "object": { + "type": "user-session", + "primary": "sshd", + "secondary": "165.227.184.21" + }, + "how": "/usr/sbin/sshd", + "actor": { + "secondary": "(invalid user)", + "primary": "unset" + } + }, + "sequence": 192653 + }, + "event": { + "type": "user_login", + "action": "logged-in", + "module": "auditd", + "category": "user-login" + }, + "user": { + "name_map": { + "uid": "root" + }, + "uid": "0", + "auid": "unset" + }, + "beat": { + "version": "7.0.0-alpha1", + "name": "demo-stack-nginx-01", + "hostname": "demo-stack-nginx-01" + }, + "host": { + "name": "demo-stack-nginx-01" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "89wWU2cBTFzn_XoLK980", + "source": { + "@timestamp": "2018-11-27T02:53:40.074Z", + "auditd": { + "session": "unset", + "data": { + "terminal": "ssh", + "op": "PAM:bad_ident", + "hostname": "165.227.184.21" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "root" + }, + "object": { + "primary": "ssh", + "secondary": "165.227.184.21", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 192654, + "result": "fail" + }, + "host": { + "name": "demo-stack-nginx-01" + }, + "beat": { + "hostname": "demo-stack-nginx-01", + "version": "7.0.0-alpha1", + "name": "demo-stack-nginx-01" + }, + "event": { + "module": "auditd", + "category": "user-login", + "type": "user_err", + "action": "error" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "pid": "1225", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "165.227.184.21" + }, + "network": { + "direction": "incoming" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "BdwWU2cBTFzn_XoLL-A3", + "source": { + "@timestamp": "2018-11-27T02:53:41.070Z", + "beat": { + "name": "demo-stack-nginx-01", + "hostname": "demo-stack-nginx-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-nginx-01" + }, + "user": { + "name_map": { + "uid": "root" + }, + "auid": "unset", + "uid": "0" + }, + "process": { + "pid": "1227", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "206.81.24.64" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "sequence": 192655, + "result": "fail", + "session": "unset", + "data": { + "op": "login", + "acct": "(unknown user)", + "terminal": "sshd" + }, + "summary": { + "object": { + "type": "user-session", + "primary": "sshd", + "secondary": "206.81.24.64" + }, + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + } + } + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "BtwWU2cBTFzn_XoLL-A3", + "source": { + "@timestamp": "2018-11-27T02:53:41.071Z", + "network": { + "direction": "incoming" + }, + "auditd": { + "sequence": 192656, + "result": "fail", + "session": "unset", + "data": { + "acct": "(invalid user)", + "op": "login", + "terminal": "sshd" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + }, + "object": { + "type": "user-session", + "primary": "sshd", + "secondary": "206.81.24.64" + }, + "how": "/usr/sbin/sshd" + } + }, + "beat": { + "hostname": "demo-stack-nginx-01", + "version": "7.0.0-alpha1", + "name": "demo-stack-nginx-01" + }, + "host": { + "name": "demo-stack-nginx-01" + }, + "event": { + "type": "user_login", + "action": "logged-in", + "module": "auditd", + "category": "user-login" + }, + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + }, + "process": { + "pid": "1227", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "206.81.24.64" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "B9wWU2cBTFzn_XoLL-A3", + "source": { + "@timestamp": "2018-11-27T02:53:41.179Z", + "auditd": { + "result": "fail", + "session": "unset", + "data": { + "op": "PAM:bad_ident", + "hostname": "206.81.24.64", + "terminal": "ssh" + }, + "summary": { + "object": { + "secondary": "206.81.24.64", + "type": "user-session", + "primary": "ssh" + }, + "how": "/usr/sbin/sshd", + "actor": { + "secondary": "root", + "primary": "unset" + } + }, + "sequence": 192657 + }, + "event": { + "type": "user_err", + "action": "error", + "module": "auditd", + "category": "user-login" + }, + "user": { + "name_map": { + "uid": "root" + }, + "auid": "unset", + "uid": "0" + }, + "process": { + "pid": "1227", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "206.81.24.64" + }, + "host": { + "name": "demo-stack-nginx-01" + }, + "beat": { + "name": "demo-stack-nginx-01", + "hostname": "demo-stack-nginx-01", + "version": "7.0.0-alpha1" + }, + "network": { + "direction": "incoming" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "s9wWU2cBTFzn_XoLnOnq", + "source": { + "@timestamp": "2018-11-27T02:54:09.152Z", + "auditd": { + "sequence": 142460, + "result": "fail", + "session": "unset", + "data": { + "terminal": "sshd", + "acct": "(unknown user)", + "op": "login" + }, + "summary": { + "actor": { + "secondary": "(unknown user)", + "primary": "unset" + }, + "object": { + "secondary": "103.100.209.44", + "type": "user-session", + "primary": "sshd" + }, + "how": "/usr/sbin/sshd" + } + }, + "beat": { + "name": "demo-stack-haproxy-01", + "hostname": "demo-stack-haproxy-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-haproxy-01" + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + }, + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + }, + "process": { + "pid": "20193", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "103.100.209.44" + }, + "network": { + "direction": "incoming" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "tNwWU2cBTFzn_XoLnOnq", + "source": { + "@timestamp": "2018-11-27T02:54:09.153Z", + "process": { + "pid": "20193", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "103.100.209.44" + }, + "host": { + "name": "demo-stack-haproxy-01" + }, + "beat": { + "name": "demo-stack-haproxy-01", + "hostname": "demo-stack-haproxy-01", + "version": "7.0.0-alpha1" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "summary": { + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + }, + "object": { + "primary": "sshd", + "secondary": "103.100.209.44", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 142461, + "result": "fail", + "session": "unset", + "data": { + "op": "login", + "terminal": "sshd", + "acct": "(invalid user)" + } + }, + "event": { + "type": "user_login", + "action": "logged-in", + "module": "auditd", + "category": "user-login" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "tdwWU2cBTFzn_XoLnOnq", + "source": { + "@timestamp": "2018-11-27T02:54:09.326Z", + "host": { + "name": "demo-stack-haproxy-01" + }, + "auditd": { + "sequence": 142462, + "result": "fail", + "session": "unset", + "data": { + "terminal": "ssh", + "op": "PAM:bad_ident", + "hostname": "103.100.209.44" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "root" + }, + "object": { + "type": "user-session", + "primary": "ssh", + "secondary": "103.100.209.44" + }, + "how": "/usr/sbin/sshd" + } + }, + "event": { + "module": "auditd", + "category": "user-login", + "type": "user_err", + "action": "error" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "pid": "20193", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "103.100.209.44" + }, + "network": { + "direction": "incoming" + }, + "beat": { + "name": "demo-stack-haproxy-01", + "hostname": "demo-stack-haproxy-01", + "version": "7.0.0-alpha1" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "wNwWU2cBTFzn_XoLUOIL", + "source": { + "@timestamp": "2018-11-27T02:53:49.472Z", + "network": { + "direction": "incoming" + }, + "auditd": { + "session": "unset", + "data": { + "acct": "(unknown user)", + "op": "login", + "terminal": "sshd" + }, + "summary": { + "how": "/usr/sbin/sshd", + "actor": { + "secondary": "(unknown user)", + "primary": "unset" + }, + "object": { + "secondary": "81.66.86.4", + "type": "user-session", + "primary": "sshd" + } + }, + "sequence": 192658, + "result": "fail" + }, + "event": { + "module": "auditd", + "category": "user-login", + "type": "user_login", + "action": "logged-in" + }, + "beat": { + "name": "demo-stack-nginx-01", + "hostname": "demo-stack-nginx-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-nginx-01" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "pid": "1229", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "81.66.86.4" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "wdwWU2cBTFzn_XoLUOIL", + "source": { + "@timestamp": "2018-11-27T02:53:49.473Z", + "auditd": { + "sequence": 192659, + "result": "fail", + "session": "unset", + "data": { + "op": "login", + "terminal": "sshd", + "acct": "(invalid user)" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + }, + "object": { + "type": "user-session", + "primary": "sshd", + "secondary": "81.66.86.4" + }, + "how": "/usr/sbin/sshd" + } + }, + "beat": { + "version": "7.0.0-alpha1", + "name": "demo-stack-nginx-01", + "hostname": "demo-stack-nginx-01" + }, + "host": { + "name": "demo-stack-nginx-01" + }, + "event": { + "type": "user_login", + "action": "logged-in", + "module": "auditd", + "category": "user-login" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "pid": "1229", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "81.66.86.4" + }, + "network": { + "direction": "incoming" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "wtwWU2cBTFzn_XoLUOIL", + "source": { + "@timestamp": "2018-11-27T02:53:49.586Z", + "process": { + "pid": "1229", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "81.66.86.4" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "sequence": 192660, + "result": "fail", + "session": "unset", + "data": { + "op": "PAM:bad_ident", + "terminal": "ssh", + "hostname": "81.66.86.4" + }, + "summary": { + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "root" + }, + "object": { + "primary": "ssh", + "secondary": "81.66.86.4", + "type": "user-session" + } + } + }, + "beat": { + "hostname": "demo-stack-nginx-01", + "version": "7.0.0-alpha1", + "name": "demo-stack-nginx-01" + }, + "host": { + "name": "demo-stack-nginx-01" + }, + "event": { + "action": "error", + "module": "auditd", + "category": "user-login", + "type": "user_err" + }, + "user": { + "auid": "unset", + "uid": "0", + "name_map": { + "uid": "root" + } + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "r9wWU2cBTFzn_XoLJ98E", + "source": { + "@timestamp": "2018-11-27T02:53:38.966Z", + "network": { + "direction": "incoming" + }, + "auditd": { + "result": "fail", + "session": "unset", + "data": { + "acct": "(unknown user)", + "terminal": "sshd", + "op": "login" + }, + "summary": { + "object": { + "primary": "sshd", + "secondary": "122.15.119.41", + "type": "user-session" + }, + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + } + }, + "sequence": 43297 + }, + "event": { + "action": "logged-in", + "module": "auditd", + "category": "user-login", + "type": "user_login" + }, + "user": { + "name_map": { + "uid": "root" + }, + "auid": "unset", + "uid": "0" + }, + "process": { + "pid": "13265", + "exe": "/usr/sbin/sshd" + }, + "host": { + "name": "demo-stack-mysql-01" + }, + "beat": { + "name": "demo-stack-mysql-01", + "hostname": "demo-stack-mysql-01", + "version": "7.0.0-alpha1" + }, + "source": { + "ip": "122.15.119.41" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "sNwWU2cBTFzn_XoLJ98E", + "source": { + "@timestamp": "2018-11-27T02:53:38.966Z", + "auditd": { + "summary": { + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + }, + "object": { + "secondary": "122.15.119.41", + "type": "user-session", + "primary": "sshd" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 43298, + "result": "fail", + "session": "unset", + "data": { + "op": "login", + "terminal": "sshd", + "acct": "(invalid user)" + } + }, + "event": { + "module": "auditd", + "category": "user-login", + "type": "user_login", + "action": "logged-in" + }, + "user": { + "uid": "0", + "auid": "unset", + "name_map": { + "uid": "root" + } + }, + "process": { + "exe": "/usr/sbin/sshd", + "pid": "13265" + }, + "source": { + "ip": "122.15.119.41" + }, + "network": { + "direction": "incoming" + }, + "beat": { + "name": "demo-stack-mysql-01", + "hostname": "demo-stack-mysql-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-mysql-01" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "sdwWU2cBTFzn_XoLJ98E", + "source": { + "@timestamp": "2018-11-27T02:53:39.222Z", + "process": { + "pid": "13265", + "exe": "/usr/sbin/sshd" + }, + "beat": { + "name": "demo-stack-mysql-01", + "hostname": "demo-stack-mysql-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-mysql-01" + }, + "source": { + "ip": "122.15.119.41" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "summary": { + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "root" + }, + "object": { + "secondary": "122.15.119.41", + "type": "user-session", + "primary": "ssh" + } + }, + "sequence": 43299, + "result": "fail", + "session": "unset", + "data": { + "hostname": "122.15.119.41", + "terminal": "ssh", + "op": "PAM:bad_ident" + } + }, + "event": { + "module": "auditd", + "category": "user-login", + "type": "user_err", + "action": "error" + }, + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "4dwVU2cBTFzn_XoLtdX6", + "source": { + "@timestamp": "2018-11-27T02:53:10.025Z", + "process": { + "pid": "31449", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "159.203.168.217" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "summary": { + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + }, + "object": { + "primary": "sshd", + "secondary": "159.203.168.217", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 44308, + "result": "fail", + "session": "unset", + "data": { + "terminal": "sshd", + "op": "login", + "acct": "(unknown user)" + } + }, + "beat": { + "hostname": "demo-stack-es-01", + "version": "7.0.0-alpha1", + "name": "demo-stack-es-01" + }, + "host": { + "name": "demo-stack-es-01" + }, + "event": { + "module": "auditd", + "category": "user-login", + "type": "user_login", + "action": "logged-in" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "4twVU2cBTFzn_XoLtdX6", + "source": { + "@timestamp": "2018-11-27T02:53:10.029Z", + "network": { + "direction": "incoming" + }, + "auditd": { + "summary": { + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + }, + "object": { + "secondary": "159.203.168.217", + "type": "user-session", + "primary": "sshd" + } + }, + "sequence": 44309, + "result": "fail", + "session": "unset", + "data": { + "op": "login", + "terminal": "sshd", + "acct": "(invalid user)" + } + }, + "event": { + "module": "auditd", + "category": "user-login", + "type": "user_login", + "action": "logged-in" + }, + "user": { + "name_map": { + "uid": "root" + }, + "uid": "0", + "auid": "unset" + }, + "process": { + "pid": "31449", + "exe": "/usr/sbin/sshd" + }, + "beat": { + "name": "demo-stack-es-01", + "hostname": "demo-stack-es-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-es-01" + }, + "source": { + "ip": "159.203.168.217" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "49wVU2cBTFzn_XoLtdX6", + "source": { + "@timestamp": "2018-11-27T02:53:10.057Z", + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + }, + "process": { + "pid": "31449", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "159.203.168.217" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "sequence": 44310, + "result": "fail", + "session": "unset", + "data": { + "terminal": "ssh", + "op": "PAM:bad_ident", + "hostname": "159.203.168.217" + }, + "summary": { + "how": "/usr/sbin/sshd", + "actor": { + "secondary": "root", + "primary": "unset" + }, + "object": { + "primary": "ssh", + "secondary": "159.203.168.217", + "type": "user-session" + } + } + }, + "beat": { + "hostname": "demo-stack-es-01", + "version": "7.0.0-alpha1", + "name": "demo-stack-es-01" + }, + "host": { + "name": "demo-stack-es-01" + }, + "event": { + "module": "auditd", + "category": "user-login", + "type": "user_err", + "action": "error" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "YNwVU2cBTFzn_XoLyNec", + "source": { + "@timestamp": "2018-11-27T02:53:14.798Z", + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "pid": "31453", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "178.33.45.156" + }, + "beat": { + "name": "demo-stack-es-01", + "hostname": "demo-stack-es-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-es-01" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "session": "unset", + "data": { + "acct": "(unknown user)", + "op": "login", + "terminal": "sshd" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + }, + "object": { + "primary": "sshd", + "secondary": "178.33.45.156", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 44311, + "result": "fail" + }, + "event": { + "type": "user_login", + "action": "logged-in", + "module": "auditd", + "category": "user-login" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "YdwVU2cBTFzn_XoLyNec", + "source": { + "@timestamp": "2018-11-27T02:53:14.798Z", + "host": { + "name": "demo-stack-es-01" + }, + "auditd": { + "result": "fail", + "session": "unset", + "data": { + "op": "login", + "acct": "(invalid user)", + "terminal": "sshd" + }, + "summary": { + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + }, + "object": { + "primary": "sshd", + "secondary": "178.33.45.156", + "type": "user-session" + } + }, + "sequence": 44312 + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + }, + "user": { + "name_map": { + "uid": "root" + }, + "auid": "unset", + "uid": "0" + }, + "process": { + "pid": "31453", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "178.33.45.156" + }, + "network": { + "direction": "incoming" + }, + "beat": { + "name": "demo-stack-es-01", + "hostname": "demo-stack-es-01", + "version": "7.0.0-alpha1" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "YtwVU2cBTFzn_XoLyNec", + "source": { + "@timestamp": "2018-11-27T02:53:14.906Z", + "process": { + "pid": "31453", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "178.33.45.156" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "sequence": 44313, + "result": "fail", + "session": "unset", + "data": { + "op": "PAM:bad_ident", + "hostname": "178.33.45.156", + "terminal": "ssh" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "root" + }, + "object": { + "secondary": "178.33.45.156", + "type": "user-session", + "primary": "ssh" + }, + "how": "/usr/sbin/sshd" + } + }, + "beat": { + "name": "demo-stack-es-01", + "hostname": "demo-stack-es-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-es-01" + }, + "event": { + "category": "user-login", + "type": "user_err", + "action": "error", + "module": "auditd" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "zd0YU2cBTFzn_XoLHgkA", + "source": { + "@timestamp": "2018-11-27T02:55:47.730Z", + "network": { + "direction": "incoming" + }, + "auditd": { + "session": "unset", + "data": { + "acct": "(unknown user)", + "op": "login", + "terminal": "sshd" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + }, + "object": { + "primary": "sshd", + "secondary": "46.148.192.41", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 44315, + "result": "fail" + }, + "host": { + "name": "demo-stack-es-01" + }, + "beat": { + "name": "demo-stack-es-01", + "hostname": "demo-stack-es-01", + "version": "7.0.0-alpha1" + }, + "event": { + "module": "auditd", + "category": "user-login", + "type": "user_login", + "action": "logged-in" + }, + "user": { + "name_map": { + "uid": "root" + }, + "uid": "0", + "auid": "unset" + }, + "process": { + "pid": "31503", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "46.148.192.41" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "zt0YU2cBTFzn_XoLHgkA", + "source": { + "@timestamp": "2018-11-27T02:55:47.730Z", + "event": { + "type": "user_login", + "action": "logged-in", + "module": "auditd", + "category": "user-login" + }, + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + }, + "process": { + "pid": "31503", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "46.148.192.41" + }, + "network": { + "direction": "incoming" + }, + "beat": { + "name": "demo-stack-es-01", + "hostname": "demo-stack-es-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-es-01" + }, + "auditd": { + "session": "unset", + "data": { + "op": "login", + "acct": "(invalid user)", + "terminal": "sshd" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + }, + "object": { + "secondary": "46.148.192.41", + "type": "user-session", + "primary": "sshd" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 44316, + "result": "fail" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "z90YU2cBTFzn_XoLHgkA", + "source": { + "@timestamp": "2018-11-27T02:55:47.874Z", + "auditd": { + "sequence": 44317, + "result": "fail", + "session": "unset", + "data": { + "hostname": "46.148.192.41", + "terminal": "ssh", + "op": "PAM:bad_ident" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "root" + }, + "object": { + "primary": "ssh", + "secondary": "46.148.192.41", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + } + }, + "beat": { + "name": "demo-stack-es-01", + "hostname": "demo-stack-es-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-es-01" + }, + "event": { + "type": "user_err", + "action": "error", + "module": "auditd", + "category": "user-login" + }, + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + }, + "process": { + "pid": "31503", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "46.148.192.41" + }, + "network": { + "direction": "incoming" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "gdwVU2cBTFzn_XoL5dmB", + "source": { + "@timestamp": "2018-11-27T02:53:22.174Z", + "source": { + "ip": "149.202.54.124" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "session": "unset", + "data": { + "hostname": "149.202.54.124", + "terminal": "ssh", + "op": "PAM:bad_ident" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "root" + }, + "object": { + "primary": "ssh", + "secondary": "149.202.54.124", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 44314, + "result": "fail" + }, + "beat": { + "name": "demo-stack-es-01", + "hostname": "demo-stack-es-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-es-01" + }, + "event": { + "category": "user-login", + "type": "user_err", + "action": "error", + "module": "auditd" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "pid": "31457", + "exe": "/usr/sbin/sshd" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "E90aU2cBTFzn_XoLNjl5", + "source": { + "@timestamp": "2018-11-27T02:58:05.071Z", + "host": { + "name": "demo-stack-nginx-01" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "data": { + "op": "login", + "terminal": "sshd", + "acct": "(unknown user)" + }, + "summary": { + "actor": { + "secondary": "(unknown user)", + "primary": "unset" + }, + "object": { + "secondary": "217.8.49.195", + "type": "user-session", + "primary": "sshd" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 192673, + "result": "fail", + "session": "unset" + }, + "event": { + "action": "logged-in", + "module": "auditd", + "category": "user-login", + "type": "user_login" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "pid": "1272", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "217.8.49.195" + }, + "beat": { + "version": "7.0.0-alpha1", + "name": "demo-stack-nginx-01", + "hostname": "demo-stack-nginx-01" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "FN0aU2cBTFzn_XoLNjl5", + "source": { + "@timestamp": "2018-11-27T02:58:05.072Z", + "process": { + "pid": "1272", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "217.8.49.195" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "sequence": 192674, + "result": "fail", + "session": "unset", + "data": { + "terminal": "sshd", + "op": "login", + "acct": "(invalid user)" + }, + "summary": { + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + }, + "object": { + "secondary": "217.8.49.195", + "type": "user-session", + "primary": "sshd" + } + } + }, + "beat": { + "name": "demo-stack-nginx-01", + "hostname": "demo-stack-nginx-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-nginx-01" + }, + "event": { + "module": "auditd", + "category": "user-login", + "type": "user_login", + "action": "logged-in" + }, + "user": { + "name_map": { + "uid": "root" + }, + "uid": "0", + "auid": "unset" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "Fd0aU2cBTFzn_XoLNjl5", + "source": { + "@timestamp": "2018-11-27T02:58:05.216Z", + "beat": { + "name": "demo-stack-nginx-01", + "hostname": "demo-stack-nginx-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-nginx-01" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "session": "unset", + "data": { + "op": "PAM:bad_ident", + "hostname": "217.8.49.195", + "terminal": "ssh" + }, + "summary": { + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "root" + }, + "object": { + "type": "user-session", + "primary": "ssh", + "secondary": "217.8.49.195" + } + }, + "sequence": 192675, + "result": "fail" + }, + "event": { + "type": "user_err", + "action": "error", + "module": "auditd", + "category": "user-login" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "pid": "1272", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "217.8.49.195" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "5d0aU2cBTFzn_XoLw0Ro", + "source": { + "@timestamp": "2018-11-27T02:58:41.148Z", + "process": { + "exe": "/usr/sbin/sshd", + "pid": "13636" + }, + "source": { + "ip": "197.53.106.203" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "data": { + "terminal": "sshd", + "op": "login", + "acct": "(unknown user)" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + }, + "object": { + "secondary": "197.53.106.203", + "type": "user-session", + "primary": "sshd" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 43308, + "result": "fail", + "session": "unset" + }, + "host": { + "name": "demo-stack-mysql-01" + }, + "beat": { + "name": "demo-stack-mysql-01", + "hostname": "demo-stack-mysql-01", + "version": "7.0.0-alpha1" + }, + "event": { + "module": "auditd", + "category": "user-login", + "type": "user_login", + "action": "logged-in" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "5t0aU2cBTFzn_XoLw0Ro", + "source": { + "@timestamp": "2018-11-27T02:58:41.148Z", + "process": { + "pid": "13636", + "exe": "/usr/sbin/sshd" + }, + "beat": { + "name": "demo-stack-mysql-01", + "hostname": "demo-stack-mysql-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-mysql-01" + }, + "source": { + "ip": "197.53.106.203" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "sequence": 43309, + "result": "fail", + "session": "unset", + "data": { + "terminal": "sshd", + "op": "login", + "acct": "(invalid user)" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + }, + "object": { + "primary": "sshd", + "secondary": "197.53.106.203", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + } + }, + "event": { + "action": "logged-in", + "module": "auditd", + "category": "user-login", + "type": "user_login" + }, + "user": { + "name_map": { + "uid": "root" + }, + "auid": "unset", + "uid": "0" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "590aU2cBTFzn_XoLw0Ro", + "source": { + "@timestamp": "2018-11-27T02:58:41.768Z", + "source": { + "ip": "197.53.106.203" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "result": "fail", + "session": "unset", + "data": { + "op": "PAM:bad_ident", + "hostname": "197.53.106.203", + "terminal": "ssh" + }, + "summary": { + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "root" + }, + "object": { + "primary": "ssh", + "secondary": "197.53.106.203", + "type": "user-session" + } + }, + "sequence": 43310 + }, + "event": { + "category": "user-login", + "type": "user_err", + "action": "error", + "module": "auditd" + }, + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + }, + "beat": { + "name": "demo-stack-mysql-01", + "hostname": "demo-stack-mysql-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-mysql-01" + }, + "process": { + "pid": "13636", + "exe": "/usr/sbin/sshd" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "cN0bU2cBTFzn_XoLDkvX", + "source": { + "@timestamp": "2018-11-27T02:59:00.461Z", + "host": { + "name": "demo-stack-nginx-01" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "pid": "1275", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "71.112.175.120" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "sequence": 192676, + "result": "fail", + "session": "unset", + "data": { + "op": "PAM:bad_ident", + "terminal": "ssh", + "hostname": "71.112.175.120" + }, + "summary": { + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "root" + }, + "object": { + "primary": "ssh", + "secondary": "71.112.175.120", + "type": "user-session" + } + } + }, + "event": { + "action": "error", + "module": "auditd", + "category": "user-login", + "type": "user_err" + }, + "beat": { + "name": "demo-stack-nginx-01", + "hostname": "demo-stack-nginx-01", + "version": "7.0.0-alpha1" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "4t0bU2cBTFzn_XoLaVLG", + "source": { + "@timestamp": "2018-11-27T02:59:23.735Z", + "network": { + "direction": "incoming" + }, + "auditd": { + "data": { + "terminal": "sshd", + "acct": "(unknown user)", + "op": "login" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + }, + "object": { + "primary": "sshd", + "secondary": "198.100.156.214", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 43311, + "result": "fail", + "session": "unset" + }, + "event": { + "module": "auditd", + "category": "user-login", + "type": "user_login", + "action": "logged-in" + }, + "beat": { + "name": "demo-stack-mysql-01", + "hostname": "demo-stack-mysql-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-mysql-01" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "pid": "13643", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "198.100.156.214" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "490bU2cBTFzn_XoLaVLG", + "source": { + "@timestamp": "2018-11-27T02:59:23.735Z", + "beat": { + "name": "demo-stack-mysql-01", + "hostname": "demo-stack-mysql-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-mysql-01" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "session": "unset", + "data": { + "op": "login", + "terminal": "sshd", + "acct": "(invalid user)" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + }, + "object": { + "primary": "sshd", + "secondary": "198.100.156.214", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 43312, + "result": "fail" + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + }, + "user": { + "name_map": { + "uid": "root" + }, + "uid": "0", + "auid": "unset" + }, + "process": { + "exe": "/usr/sbin/sshd", + "pid": "13643" + }, + "source": { + "ip": "198.100.156.214" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "5N0bU2cBTFzn_XoLaVLG", + "source": { + "@timestamp": "2018-11-27T02:59:23.779Z", + "auditd": { + "session": "unset", + "data": { + "terminal": "ssh", + "hostname": "198.100.156.214", + "op": "PAM:bad_ident" + }, + "summary": { + "actor": { + "secondary": "root", + "primary": "unset" + }, + "object": { + "primary": "ssh", + "secondary": "198.100.156.214", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 43313, + "result": "fail" + }, + "event": { + "type": "user_err", + "action": "error", + "module": "auditd", + "category": "user-login" + }, + "beat": { + "name": "demo-stack-mysql-01", + "hostname": "demo-stack-mysql-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-mysql-01" + }, + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + }, + "process": { + "pid": "13643", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "198.100.156.214" + }, + "network": { + "direction": "incoming" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "Xd0bU2cBTFzn_XoLclNQ", + "source": { + "@timestamp": "2018-11-27T02:59:25.924Z", + "event": { + "action": "logged-in", + "module": "auditd", + "category": "user-login", + "type": "user_login" + }, + "user": { + "auid": "unset", + "name_map": { + "uid": "root" + }, + "uid": "0" + }, + "process": { + "pid": "13645", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "91.121.110.50" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "data": { + "terminal": "sshd", + "acct": "(unknown user)", + "op": "login" + }, + "summary": { + "object": { + "primary": "sshd", + "secondary": "91.121.110.50", + "type": "user-session" + }, + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + } + }, + "sequence": 43314, + "result": "fail", + "session": "unset" + }, + "beat": { + "name": "demo-stack-mysql-01", + "hostname": "demo-stack-mysql-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-mysql-01" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "Xt0bU2cBTFzn_XoLclNQ", + "source": { + "@timestamp": "2018-11-27T02:59:25.924Z", + "source": { + "ip": "91.121.110.50" + }, + "beat": { + "name": "demo-stack-mysql-01", + "hostname": "demo-stack-mysql-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-mysql-01" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "sequence": 43315, + "result": "fail", + "session": "unset", + "data": { + "terminal": "sshd", + "op": "login", + "acct": "(invalid user)" + }, + "summary": { + "object": { + "secondary": "91.121.110.50", + "type": "user-session", + "primary": "sshd" + }, + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "(invalid user)" + } + } + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + }, + "user": { + "name_map": { + "uid": "root" + }, + "auid": "unset", + "uid": "0" + }, + "process": { + "exe": "/usr/sbin/sshd", + "pid": "13645" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "X90bU2cBTFzn_XoLclNQ", + "source": { + "@timestamp": "2018-11-27T02:59:26.032Z", + "host": { + "name": "demo-stack-mysql-01" + }, + "event": { + "action": "error", + "module": "auditd", + "category": "user-login", + "type": "user_err" + }, + "user": { + "auid": "unset", + "uid": "0", + "name_map": { + "uid": "root" + } + }, + "process": { + "pid": "13645", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "91.121.110.50" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "sequence": 43316, + "result": "fail", + "session": "unset", + "data": { + "op": "PAM:bad_ident", + "terminal": "ssh", + "hostname": "91.121.110.50" + }, + "summary": { + "object": { + "primary": "ssh", + "secondary": "91.121.110.50", + "type": "user-session" + }, + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "root" + } + } + }, + "beat": { + "name": "demo-stack-mysql-01", + "hostname": "demo-stack-mysql-01", + "version": "7.0.0-alpha1" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "_t0bU2cBTFzn_XoLelQ5", + "source": { + "@timestamp": "2018-11-27T02:59:27.948Z", + "source": { + "ip": "51.38.82.60" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "sequence": 43317, + "result": "fail", + "session": "unset", + "data": { + "op": "login", + "acct": "(unknown user)", + "terminal": "sshd" + }, + "summary": { + "object": { + "primary": "sshd", + "secondary": "51.38.82.60", + "type": "user-session" + }, + "how": "/usr/sbin/sshd", + "actor": { + "secondary": "(unknown user)", + "primary": "unset" + } + } + }, + "beat": { + "name": "demo-stack-mysql-01", + "hostname": "demo-stack-mysql-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-mysql-01" + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "process": { + "pid": "13647", + "exe": "/usr/sbin/sshd" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "_90bU2cBTFzn_XoLelQ5", + "source": { + "@timestamp": "2018-11-27T02:59:27.948Z", + "process": { + "exe": "/usr/sbin/sshd", + "pid": "13647" + }, + "source": { + "ip": "51.38.82.60" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "summary": { + "object": { + "primary": "sshd", + "secondary": "51.38.82.60", + "type": "user-session" + }, + "how": "/usr/sbin/sshd", + "actor": { + "secondary": "(invalid user)", + "primary": "unset" + } + }, + "sequence": 43318, + "result": "fail", + "session": "unset", + "data": { + "op": "login", + "acct": "(invalid user)", + "terminal": "sshd" + } + }, + "event": { + "action": "logged-in", + "module": "auditd", + "category": "user-login", + "type": "user_login" + }, + "user": { + "uid": "0", + "name_map": { + "uid": "root" + }, + "auid": "unset" + }, + "beat": { + "name": "demo-stack-mysql-01", + "hostname": "demo-stack-mysql-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-mysql-01" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "AN0bU2cBTFzn_XoLelU5", + "source": { + "@timestamp": "2018-11-27T02:59:28.060Z", + "auditd": { + "data": { + "hostname": "51.38.82.60", + "terminal": "ssh", + "op": "PAM:bad_ident" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "root" + }, + "object": { + "primary": "ssh", + "secondary": "51.38.82.60", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 43319, + "result": "fail", + "session": "unset" + }, + "event": { + "type": "user_err", + "action": "error", + "module": "auditd", + "category": "user-login" + }, + "user": { + "auid": "unset", + "uid": "0", + "name_map": { + "uid": "root" + } + }, + "process": { + "exe": "/usr/sbin/sshd", + "pid": "13647" + }, + "source": { + "ip": "51.38.82.60" + }, + "network": { + "direction": "incoming" + }, + "beat": { + "name": "demo-stack-mysql-01", + "hostname": "demo-stack-mysql-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-mysql-01" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "Xa2ipWkBCQofM5eXEgsv", + "source": { + "@timestamp": "2018-11-27T02:59:28.060Z", + "auditd": { + "data": { + "hostname": "51.38.82.60", + "terminal": "ssh", + "op": "PAM:bad_ident" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "root" + }, + "object": { + "primary": "ssh", + "secondary": "51.38.82.60", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 43319, + "result": "fail", + "session": "unset" + }, + "destination" : { + "ip" : "0.0.0.0", + "port" : "22" + }, + "event": { + "type": "user_err", + "action": "error", + "module": "auditd", + "category": "user-login" + }, + "user" : { + "group" : { + "name" : "root", + "id" : "0" + }, + "id" : "0", + "name" : "root" + }, + "process": { + "exe": "/usr/sbin/sshd", + "pid": "13647" + }, + "source": { + "ip": "51.38.82.60" + }, + "network": { + "direction": "incoming" + }, + "beat": { + "name": "demo-stack-mysql-01", + "hostname": "demo-stack-mysql-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-mysql-01" + } + } + } +} diff --git a/x-pack/test/functional/es_archives/auditbeat/kpi_hosts/data.json b/x-pack/test/functional/es_archives/auditbeat/kpi_hosts/data.json new file mode 100644 index 0000000000000..470e38e62ba51 --- /dev/null +++ b/x-pack/test/functional/es_archives/auditbeat/kpi_hosts/data.json @@ -0,0 +1,194 @@ +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "Rs93UmcBTFzn_XoLWT6M", + "source": { + "@timestamp": "2018-11-27T00:00:11.544Z", + "process": { + "pid": "31964", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "128.199.87.213" + }, + "network": { + "direction": "incoming" + }, + "beat": { + "name": "demo-stack-nginx-01", + "hostname": "demo-stack-nginx-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-nginx-01" + }, + "auditd": { + "session": "unset", + "data": { + "hostname": "128.199.87.213", + "terminal": "ssh", + "op": "PAM:bad_ident" + }, + "summary": { + "object": { + "primary": "ssh", + "secondary": "128.199.87.213", + "type": "user-session" + }, + "how": "/usr/sbin/sshd", + "actor": { + "primary": "unset", + "secondary": "root" + } + }, + "sequence": 192383, + "result": "fail" + }, + "event": { + "category": "user-login", + "type": "user_err", + "action": "error", + "module": "auditd" + }, + "user": { + "name_map": { + "uid": "root" + }, + "auid": "unset", + "uid": "0" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "6Nr4UmcBTFzn_XoL4l6d", + "source": { + "@timestamp": "2018-11-27T02:21:40.914Z", + "host": { + "name": "demo-stack-haproxy-01" + }, + "user": { + "auid": "unset", + "uid": "0", + "name_map": { + "uid": "root" + } + }, + "process": { + "pid": "20001", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "82.62.233.163" + }, + "network": { + "direction": "incoming" + }, + "auditd": { + "sequence": 142431, + "result": "fail", + "session": "unset", + "data": { + "acct": "(unknown user)", + "op": "login", + "terminal": "sshd" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + }, + "object": { + "primary": "sshd", + "secondary": "82.62.233.163", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + } + }, + "event": { + "category": "user-login", + "type": "user_login", + "action": "logged-in", + "module": "auditd" + }, + "beat": { + "name": "demo-stack-haproxy-01", + "hostname": "demo-stack-haproxy-01", + "version": "7.0.0-alpha1" + } + } + } +} + +{ + "type": "doc", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "type": "doc", + "id": "sdwQU2cBTFzn_XoLA1gL", + "source": { + "@timestamp": "2018-11-27T02:46:56.545Z", + "process": { + "pid": "26473", + "exe": "/usr/sbin/sshd" + }, + "source": { + "ip": "35.243.183.165" + }, + "network": { + "direction": "incoming" + }, + "beat": { + "name": "demo-stack-apache-01", + "hostname": "demo-stack-apache-01", + "version": "7.0.0-alpha1" + }, + "host": { + "name": "demo-stack-apache-01" + }, + "auditd": { + "session": "unset", + "data": { + "op": "login", + "acct": "(unknown user)", + "terminal": "sshd" + }, + "summary": { + "actor": { + "primary": "unset", + "secondary": "(unknown user)" + }, + "object": { + "primary": "sshd", + "secondary": "35.243.183.165", + "type": "user-session" + }, + "how": "/usr/sbin/sshd" + }, + "sequence": 184472, + "result": "fail" + }, + "event": { + "type": "user_login", + "action": "logged-in", + "module": "auditd", + "category": "user-login" + }, + "user": { + "name_map": { + "uid": "root" + }, + "uid": "0", + "auid": "unset" + } + } + } +} diff --git a/x-pack/test/functional/es_archives/auditbeat/kpi_hosts/mappings.json b/x-pack/test/functional/es_archives/auditbeat/kpi_hosts/mappings.json new file mode 100644 index 0000000000000..96aec998fcdcd --- /dev/null +++ b/x-pack/test/functional/es_archives/auditbeat/kpi_hosts/mappings.json @@ -0,0 +1,1903 @@ +{ + "type": "index", + "value": { + "index": "auditbeat-7.0.0-alpha1-2018.11.27", + "settings": { + "index": { + "codec": "best_compression", + "mapping": { + "total_fields": { + "limit": "10000" + } + }, + "refresh_interval": "5s", + "number_of_shards": "1", + "query": { + "default_field": [ + "beat.name", + "beat.hostname", + "beat.timezone", + "beat.version", + "tags", + "error.message", + "error.type", + "meta.cloud.provider", + "meta.cloud.instance_id", + "meta.cloud.instance_name", + "meta.cloud.machine_type", + "meta.cloud.availability_zone", + "meta.cloud.project_id", + "meta.cloud.region", + "docker.container.id", + "docker.container.image", + "docker.container.name", + "host.name", + "host.id", + "host.architecture", + "host.os.platform", + "host.os.version", + "host.os.family", + "host.mac", + "kubernetes.pod.name", + "kubernetes.pod.uid", + "kubernetes.namespace", + "kubernetes.node.name", + "kubernetes.container.name", + "kubernetes.container.image", + "event.module", + "event.action", + "file.path", + "raw", + "file.target_path", + "file.type", + "file.device", + "file.inode", + "file.uid", + "file.owner", + "file.gid", + "file.group", + "file.mode", + "file.origin", + "raw", + "file.selinux.user", + "file.selinux.role", + "file.selinux.domain", + "file.selinux.level", + "event.category", + "event.type", + "user.auid", + "user.uid", + "user.euid", + "user.fsuid", + "user.suid", + "user.gid", + "user.egid", + "user.sgid", + "user.fsgid", + "user.name_map.auid", + "user.name_map.uid", + "user.name_map.euid", + "user.name_map.fsuid", + "user.name_map.suid", + "user.name_map.gid", + "user.name_map.egid", + "user.name_map.sgid", + "user.name_map.fsgid", + "user.selinux.user", + "user.selinux.role", + "user.selinux.domain", + "user.selinux.level", + "user.selinux.category", + "process.pid", + "process.ppid", + "process.name", + "process.title", + "process.exe", + "process.cwd", + "process.args", + "source.port", + "source.hostname", + "source.path", + "destination.port", + "destination.hostname", + "destination.path", + "network.direction", + "auditd.session", + "auditd.result", + "auditd.summary.actor.primary", + "auditd.summary.actor.secondary", + "auditd.summary.object.type", + "auditd.summary.object.primary", + "auditd.summary.object.secondary", + "auditd.summary.how", + "auditd.paths.inode", + "auditd.paths.dev", + "auditd.paths.obj_user", + "auditd.paths.obj_role", + "auditd.paths.obj_domain", + "auditd.paths.obj_level", + "auditd.paths.objtype", + "auditd.paths.ouid", + "auditd.paths.rdev", + "auditd.paths.nametype", + "auditd.paths.ogid", + "auditd.paths.item", + "auditd.paths.mode", + "auditd.paths.name", + "auditd.data.action", + "auditd.data.minor", + "auditd.data.acct", + "auditd.data.addr", + "auditd.data.cipher", + "auditd.data.id", + "auditd.data.entries", + "auditd.data.kind", + "auditd.data.ksize", + "auditd.data.spid", + "auditd.data.arch", + "auditd.data.argc", + "auditd.data.major", + "auditd.data.unit", + "auditd.data.table", + "auditd.data.terminal", + "auditd.data.grantors", + "auditd.data.direction", + "auditd.data.op", + "auditd.data.tty", + "auditd.data.syscall", + "auditd.data.data", + "auditd.data.family", + "auditd.data.mac", + "auditd.data.pfs", + "auditd.data.items", + "auditd.data.a0", + "auditd.data.a1", + "auditd.data.a2", + "auditd.data.a3", + "auditd.data.hostname", + "auditd.data.lport", + "auditd.data.rport", + "auditd.data.exit", + "auditd.data.fp", + "auditd.data.laddr", + "auditd.data.sport", + "auditd.data.capability", + "auditd.data.nargs", + "auditd.data.new-enabled", + "auditd.data.audit_backlog_limit", + "auditd.data.dir", + "auditd.data.cap_pe", + "auditd.data.model", + "auditd.data.new_pp", + "auditd.data.old-enabled", + "auditd.data.oauid", + "auditd.data.old", + "auditd.data.banners", + "auditd.data.feature", + "auditd.data.vm-ctx", + "auditd.data.opid", + "auditd.data.seperms", + "auditd.data.seresult", + "auditd.data.new-rng", + "auditd.data.old-net", + "auditd.data.sigev_signo", + "auditd.data.ino", + "auditd.data.old_enforcing", + "auditd.data.old-vcpu", + "auditd.data.range", + "auditd.data.res", + "auditd.data.added", + "auditd.data.fam", + "auditd.data.nlnk-pid", + "auditd.data.subj", + "auditd.data.a[0-3]", + "auditd.data.cgroup", + "auditd.data.kernel", + "auditd.data.ocomm", + "auditd.data.new-net", + "auditd.data.permissive", + "auditd.data.class", + "auditd.data.compat", + "auditd.data.fi", + "auditd.data.changed", + "auditd.data.msg", + "auditd.data.dport", + "auditd.data.new-seuser", + "auditd.data.invalid_context", + "auditd.data.dmac", + "auditd.data.ipx-net", + "auditd.data.iuid", + "auditd.data.macproto", + "auditd.data.obj", + "auditd.data.ipid", + "auditd.data.new-fs", + "auditd.data.vm-pid", + "auditd.data.cap_pi", + "auditd.data.old-auid", + "auditd.data.oses", + "auditd.data.fd", + "auditd.data.igid", + "auditd.data.new-disk", + "auditd.data.parent", + "auditd.data.len", + "auditd.data.oflag", + "auditd.data.uuid", + "auditd.data.code", + "auditd.data.nlnk-grp", + "auditd.data.cap_fp", + "auditd.data.new-mem", + "auditd.data.seperm", + "auditd.data.enforcing", + "auditd.data.new-chardev", + "auditd.data.old-rng", + "auditd.data.outif", + "auditd.data.cmd", + "auditd.data.hook", + "auditd.data.new-level", + "auditd.data.sauid", + "auditd.data.sig", + "auditd.data.audit_backlog_wait_time", + "auditd.data.printer", + "auditd.data.old-mem", + "auditd.data.perm", + "auditd.data.old_pi", + "auditd.data.state", + "auditd.data.format", + "auditd.data.new_gid", + "auditd.data.tcontext", + "auditd.data.maj", + "auditd.data.watch", + "auditd.data.device", + "auditd.data.grp", + "auditd.data.bool", + "auditd.data.icmp_type", + "auditd.data.new_lock", + "auditd.data.old_prom", + "auditd.data.acl", + "auditd.data.ip", + "auditd.data.new_pi", + "auditd.data.default-context", + "auditd.data.inode_gid", + "auditd.data.new-log_passwd", + "auditd.data.new_pe", + "auditd.data.selected-context", + "auditd.data.cap_fver", + "auditd.data.file", + "auditd.data.net", + "auditd.data.virt", + "auditd.data.cap_pp", + "auditd.data.old-range", + "auditd.data.resrc", + "auditd.data.new-range", + "auditd.data.obj_gid", + "auditd.data.proto", + "auditd.data.old-disk", + "auditd.data.audit_failure", + "auditd.data.inif", + "auditd.data.vm", + "auditd.data.flags", + "auditd.data.nlnk-fam", + "auditd.data.old-fs", + "auditd.data.old-ses", + "auditd.data.seqno", + "auditd.data.fver", + "auditd.data.qbytes", + "auditd.data.seuser", + "auditd.data.cap_fe", + "auditd.data.new-vcpu", + "auditd.data.old-level", + "auditd.data.old_pp", + "auditd.data.daddr", + "auditd.data.old-role", + "auditd.data.ioctlcmd", + "auditd.data.smac", + "auditd.data.apparmor", + "auditd.data.fe", + "auditd.data.perm_mask", + "auditd.data.ses", + "auditd.data.cap_fi", + "auditd.data.obj_uid", + "auditd.data.reason", + "auditd.data.list", + "auditd.data.old_lock", + "auditd.data.bus", + "auditd.data.old_pe", + "auditd.data.new-role", + "auditd.data.prom", + "auditd.data.uri", + "auditd.data.audit_enabled", + "auditd.data.old-log_passwd", + "auditd.data.old-seuser", + "auditd.data.per", + "auditd.data.scontext", + "auditd.data.tclass", + "auditd.data.ver", + "auditd.data.new", + "auditd.data.val", + "auditd.data.img-ctx", + "auditd.data.old-chardev", + "auditd.data.old_val", + "auditd.data.success", + "auditd.data.inode_uid", + "auditd.data.removed", + "auditd.data.socket.port", + "auditd.data.socket.saddr", + "auditd.data.socket.addr", + "auditd.data.socket.family", + "auditd.data.socket.path", + "auditd.messages", + "auditd.warnings", + "geoip.continent_name", + "geoip.city_name", + "geoip.region_name", + "geoip.country_iso_code", + "hash.blake2b_256", + "hash.blake2b_384", + "hash.blake2b_512", + "hash.md5", + "hash.sha1", + "hash.sha224", + "hash.sha256", + "hash.sha384", + "hash.sha3_224", + "hash.sha3_256", + "hash.sha3_384", + "hash.sha3_512", + "hash.sha512", + "hash.sha512_224", + "hash.sha512_256", + "hash.xxh64", + "fields.*" + ] + }, + "number_of_replicas": "0" + } + }, + "mappings": { + "_meta": { + "version": "7.0.0-alpha1" + }, + "dynamic_templates": [ + { + "fields": { + "path_match": "fields.*", + "match_mapping_type": "string", + "mapping": { + "type": "keyword" + } + } + }, + { + "docker.container.labels": { + "path_match": "docker.container.labels.*", + "match_mapping_type": "string", + "mapping": { + "type": "keyword" + } + } + }, + { + "strings_as_keyword": { + "match_mapping_type": "string", + "mapping": { + "ignore_above": 1024, + "type": "keyword" + } + } + } + ], + "date_detection": false, + "properties": { + "@timestamp": { + "type": "date" + }, + "auditd": { + "properties": { + "data": { + "properties": { + "a0": { + "type": "keyword", + "ignore_above": 1024 + }, + "a1": { + "type": "keyword", + "ignore_above": 1024 + }, + "a2": { + "type": "keyword", + "ignore_above": 1024 + }, + "a3": { + "type": "keyword", + "ignore_above": 1024 + }, + "a[0-3]": { + "type": "keyword", + "ignore_above": 1024 + }, + "acct": { + "type": "keyword", + "ignore_above": 1024 + }, + "acl": { + "type": "keyword", + "ignore_above": 1024 + }, + "action": { + "type": "keyword", + "ignore_above": 1024 + }, + "added": { + "type": "keyword", + "ignore_above": 1024 + }, + "addr": { + "type": "keyword", + "ignore_above": 1024 + }, + "apparmor": { + "type": "keyword", + "ignore_above": 1024 + }, + "arch": { + "type": "keyword", + "ignore_above": 1024 + }, + "argc": { + "type": "keyword", + "ignore_above": 1024 + }, + "audit_backlog_limit": { + "type": "keyword", + "ignore_above": 1024 + }, + "audit_backlog_wait_time": { + "type": "keyword", + "ignore_above": 1024 + }, + "audit_enabled": { + "type": "keyword", + "ignore_above": 1024 + }, + "audit_failure": { + "type": "keyword", + "ignore_above": 1024 + }, + "banners": { + "type": "keyword", + "ignore_above": 1024 + }, + "bool": { + "type": "keyword", + "ignore_above": 1024 + }, + "bus": { + "type": "keyword", + "ignore_above": 1024 + }, + "cap_fe": { + "type": "keyword", + "ignore_above": 1024 + }, + "cap_fi": { + "type": "keyword", + "ignore_above": 1024 + }, + "cap_fp": { + "type": "keyword", + "ignore_above": 1024 + }, + "cap_fver": { + "type": "keyword", + "ignore_above": 1024 + }, + "cap_pe": { + "type": "keyword", + "ignore_above": 1024 + }, + "cap_pi": { + "type": "keyword", + "ignore_above": 1024 + }, + "cap_pp": { + "type": "keyword", + "ignore_above": 1024 + }, + "capability": { + "type": "keyword", + "ignore_above": 1024 + }, + "cgroup": { + "type": "keyword", + "ignore_above": 1024 + }, + "changed": { + "type": "keyword", + "ignore_above": 1024 + }, + "cipher": { + "type": "keyword", + "ignore_above": 1024 + }, + "class": { + "type": "keyword", + "ignore_above": 1024 + }, + "cmd": { + "type": "keyword", + "ignore_above": 1024 + }, + "code": { + "type": "keyword", + "ignore_above": 1024 + }, + "compat": { + "type": "keyword", + "ignore_above": 1024 + }, + "daddr": { + "type": "keyword", + "ignore_above": 1024 + }, + "data": { + "type": "keyword", + "ignore_above": 1024 + }, + "default-context": { + "type": "keyword", + "ignore_above": 1024 + }, + "device": { + "type": "keyword", + "ignore_above": 1024 + }, + "dir": { + "type": "keyword", + "ignore_above": 1024 + }, + "direction": { + "type": "keyword", + "ignore_above": 1024 + }, + "dmac": { + "type": "keyword", + "ignore_above": 1024 + }, + "dport": { + "type": "keyword", + "ignore_above": 1024 + }, + "enforcing": { + "type": "keyword", + "ignore_above": 1024 + }, + "entries": { + "type": "keyword", + "ignore_above": 1024 + }, + "exit": { + "type": "keyword", + "ignore_above": 1024 + }, + "fam": { + "type": "keyword", + "ignore_above": 1024 + }, + "family": { + "type": "keyword", + "ignore_above": 1024 + }, + "fd": { + "type": "keyword", + "ignore_above": 1024 + }, + "fe": { + "type": "keyword", + "ignore_above": 1024 + }, + "feature": { + "type": "keyword", + "ignore_above": 1024 + }, + "fi": { + "type": "keyword", + "ignore_above": 1024 + }, + "file": { + "type": "keyword", + "ignore_above": 1024 + }, + "flags": { + "type": "keyword", + "ignore_above": 1024 + }, + "format": { + "type": "keyword", + "ignore_above": 1024 + }, + "fp": { + "type": "keyword", + "ignore_above": 1024 + }, + "fver": { + "type": "keyword", + "ignore_above": 1024 + }, + "grantors": { + "type": "keyword", + "ignore_above": 1024 + }, + "grp": { + "type": "keyword", + "ignore_above": 1024 + }, + "hook": { + "type": "keyword", + "ignore_above": 1024 + }, + "hostname": { + "type": "keyword", + "ignore_above": 1024 + }, + "icmp_type": { + "type": "keyword", + "ignore_above": 1024 + }, + "id": { + "type": "keyword", + "ignore_above": 1024 + }, + "igid": { + "type": "keyword", + "ignore_above": 1024 + }, + "img-ctx": { + "type": "keyword", + "ignore_above": 1024 + }, + "inif": { + "type": "keyword", + "ignore_above": 1024 + }, + "ino": { + "type": "keyword", + "ignore_above": 1024 + }, + "inode_gid": { + "type": "keyword", + "ignore_above": 1024 + }, + "inode_uid": { + "type": "keyword", + "ignore_above": 1024 + }, + "invalid_context": { + "type": "keyword", + "ignore_above": 1024 + }, + "ioctlcmd": { + "type": "keyword", + "ignore_above": 1024 + }, + "ip": { + "type": "keyword", + "ignore_above": 1024 + }, + "ipid": { + "type": "keyword", + "ignore_above": 1024 + }, + "ipx-net": { + "type": "keyword", + "ignore_above": 1024 + }, + "items": { + "type": "keyword", + "ignore_above": 1024 + }, + "iuid": { + "type": "keyword", + "ignore_above": 1024 + }, + "kernel": { + "type": "keyword", + "ignore_above": 1024 + }, + "kind": { + "type": "keyword", + "ignore_above": 1024 + }, + "ksize": { + "type": "keyword", + "ignore_above": 1024 + }, + "laddr": { + "type": "keyword", + "ignore_above": 1024 + }, + "len": { + "type": "keyword", + "ignore_above": 1024 + }, + "list": { + "type": "keyword", + "ignore_above": 1024 + }, + "lport": { + "type": "keyword", + "ignore_above": 1024 + }, + "mac": { + "type": "keyword", + "ignore_above": 1024 + }, + "macproto": { + "type": "keyword", + "ignore_above": 1024 + }, + "maj": { + "type": "keyword", + "ignore_above": 1024 + }, + "major": { + "type": "keyword", + "ignore_above": 1024 + }, + "minor": { + "type": "keyword", + "ignore_above": 1024 + }, + "model": { + "type": "keyword", + "ignore_above": 1024 + }, + "msg": { + "type": "keyword", + "ignore_above": 1024 + }, + "nargs": { + "type": "keyword", + "ignore_above": 1024 + }, + "net": { + "type": "keyword", + "ignore_above": 1024 + }, + "new": { + "type": "keyword", + "ignore_above": 1024 + }, + "new-chardev": { + "type": "keyword", + "ignore_above": 1024 + }, + "new-disk": { + "type": "keyword", + "ignore_above": 1024 + }, + "new-enabled": { + "type": "keyword", + "ignore_above": 1024 + }, + "new-fs": { + "type": "keyword", + "ignore_above": 1024 + }, + "new-level": { + "type": "keyword", + "ignore_above": 1024 + }, + "new-log_passwd": { + "type": "keyword", + "ignore_above": 1024 + }, + "new-mem": { + "type": "keyword", + "ignore_above": 1024 + }, + "new-net": { + "type": "keyword", + "ignore_above": 1024 + }, + "new-range": { + "type": "keyword", + "ignore_above": 1024 + }, + "new-rng": { + "type": "keyword", + "ignore_above": 1024 + }, + "new-role": { + "type": "keyword", + "ignore_above": 1024 + }, + "new-seuser": { + "type": "keyword", + "ignore_above": 1024 + }, + "new-vcpu": { + "type": "keyword", + "ignore_above": 1024 + }, + "new_gid": { + "type": "keyword", + "ignore_above": 1024 + }, + "new_lock": { + "type": "keyword", + "ignore_above": 1024 + }, + "new_pe": { + "type": "keyword", + "ignore_above": 1024 + }, + "new_pi": { + "type": "keyword", + "ignore_above": 1024 + }, + "new_pp": { + "type": "keyword", + "ignore_above": 1024 + }, + "nlnk-fam": { + "type": "keyword", + "ignore_above": 1024 + }, + "nlnk-grp": { + "type": "keyword", + "ignore_above": 1024 + }, + "nlnk-pid": { + "type": "keyword", + "ignore_above": 1024 + }, + "oauid": { + "type": "keyword", + "ignore_above": 1024 + }, + "obj": { + "type": "keyword", + "ignore_above": 1024 + }, + "obj_gid": { + "type": "keyword", + "ignore_above": 1024 + }, + "obj_uid": { + "type": "keyword", + "ignore_above": 1024 + }, + "ocomm": { + "type": "keyword", + "ignore_above": 1024 + }, + "oflag": { + "type": "keyword", + "ignore_above": 1024 + }, + "old": { + "type": "keyword", + "ignore_above": 1024 + }, + "old-auid": { + "type": "keyword", + "ignore_above": 1024 + }, + "old-chardev": { + "type": "keyword", + "ignore_above": 1024 + }, + "old-disk": { + "type": "keyword", + "ignore_above": 1024 + }, + "old-enabled": { + "type": "keyword", + "ignore_above": 1024 + }, + "old-fs": { + "type": "keyword", + "ignore_above": 1024 + }, + "old-level": { + "type": "keyword", + "ignore_above": 1024 + }, + "old-log_passwd": { + "type": "keyword", + "ignore_above": 1024 + }, + "old-mem": { + "type": "keyword", + "ignore_above": 1024 + }, + "old-net": { + "type": "keyword", + "ignore_above": 1024 + }, + "old-range": { + "type": "keyword", + "ignore_above": 1024 + }, + "old-rng": { + "type": "keyword", + "ignore_above": 1024 + }, + "old-role": { + "type": "keyword", + "ignore_above": 1024 + }, + "old-ses": { + "type": "keyword", + "ignore_above": 1024 + }, + "old-seuser": { + "type": "keyword", + "ignore_above": 1024 + }, + "old-vcpu": { + "type": "keyword", + "ignore_above": 1024 + }, + "old_enforcing": { + "type": "keyword", + "ignore_above": 1024 + }, + "old_lock": { + "type": "keyword", + "ignore_above": 1024 + }, + "old_pe": { + "type": "keyword", + "ignore_above": 1024 + }, + "old_pi": { + "type": "keyword", + "ignore_above": 1024 + }, + "old_pp": { + "type": "keyword", + "ignore_above": 1024 + }, + "old_prom": { + "type": "keyword", + "ignore_above": 1024 + }, + "old_val": { + "type": "keyword", + "ignore_above": 1024 + }, + "op": { + "type": "keyword", + "ignore_above": 1024 + }, + "opid": { + "type": "keyword", + "ignore_above": 1024 + }, + "oses": { + "type": "keyword", + "ignore_above": 1024 + }, + "outif": { + "type": "keyword", + "ignore_above": 1024 + }, + "parent": { + "type": "keyword", + "ignore_above": 1024 + }, + "per": { + "type": "keyword", + "ignore_above": 1024 + }, + "perm": { + "type": "keyword", + "ignore_above": 1024 + }, + "perm_mask": { + "type": "keyword", + "ignore_above": 1024 + }, + "permissive": { + "type": "keyword", + "ignore_above": 1024 + }, + "pfs": { + "type": "keyword", + "ignore_above": 1024 + }, + "printer": { + "type": "keyword", + "ignore_above": 1024 + }, + "prom": { + "type": "keyword", + "ignore_above": 1024 + }, + "proto": { + "type": "keyword", + "ignore_above": 1024 + }, + "qbytes": { + "type": "keyword", + "ignore_above": 1024 + }, + "range": { + "type": "keyword", + "ignore_above": 1024 + }, + "reason": { + "type": "keyword", + "ignore_above": 1024 + }, + "removed": { + "type": "keyword", + "ignore_above": 1024 + }, + "res": { + "type": "keyword", + "ignore_above": 1024 + }, + "resrc": { + "type": "keyword", + "ignore_above": 1024 + }, + "rport": { + "type": "keyword", + "ignore_above": 1024 + }, + "sauid": { + "type": "keyword", + "ignore_above": 1024 + }, + "scontext": { + "type": "keyword", + "ignore_above": 1024 + }, + "selected-context": { + "type": "keyword", + "ignore_above": 1024 + }, + "seperm": { + "type": "keyword", + "ignore_above": 1024 + }, + "seperms": { + "type": "keyword", + "ignore_above": 1024 + }, + "seqno": { + "type": "keyword", + "ignore_above": 1024 + }, + "seresult": { + "type": "keyword", + "ignore_above": 1024 + }, + "ses": { + "type": "keyword", + "ignore_above": 1024 + }, + "seuser": { + "type": "keyword", + "ignore_above": 1024 + }, + "sig": { + "type": "keyword", + "ignore_above": 1024 + }, + "sigev_signo": { + "type": "keyword", + "ignore_above": 1024 + }, + "smac": { + "type": "keyword", + "ignore_above": 1024 + }, + "socket": { + "properties": { + "addr": { + "type": "keyword", + "ignore_above": 1024 + }, + "family": { + "type": "keyword", + "ignore_above": 1024 + }, + "path": { + "type": "keyword", + "ignore_above": 1024 + }, + "port": { + "type": "keyword", + "ignore_above": 1024 + }, + "saddr": { + "type": "keyword", + "ignore_above": 1024 + } + } + }, + "spid": { + "type": "keyword", + "ignore_above": 1024 + }, + "sport": { + "type": "keyword", + "ignore_above": 1024 + }, + "state": { + "type": "keyword", + "ignore_above": 1024 + }, + "subj": { + "type": "keyword", + "ignore_above": 1024 + }, + "success": { + "type": "keyword", + "ignore_above": 1024 + }, + "syscall": { + "type": "keyword", + "ignore_above": 1024 + }, + "table": { + "type": "keyword", + "ignore_above": 1024 + }, + "tclass": { + "type": "keyword", + "ignore_above": 1024 + }, + "tcontext": { + "type": "keyword", + "ignore_above": 1024 + }, + "terminal": { + "type": "keyword", + "ignore_above": 1024 + }, + "tty": { + "type": "keyword", + "ignore_above": 1024 + }, + "unit": { + "type": "keyword", + "ignore_above": 1024 + }, + "uri": { + "type": "keyword", + "ignore_above": 1024 + }, + "uuid": { + "type": "keyword", + "ignore_above": 1024 + }, + "val": { + "type": "keyword", + "ignore_above": 1024 + }, + "ver": { + "type": "keyword", + "ignore_above": 1024 + }, + "virt": { + "type": "keyword", + "ignore_above": 1024 + }, + "vm": { + "type": "keyword", + "ignore_above": 1024 + }, + "vm-ctx": { + "type": "keyword", + "ignore_above": 1024 + }, + "vm-pid": { + "type": "keyword", + "ignore_above": 1024 + }, + "watch": { + "type": "keyword", + "ignore_above": 1024 + } + } + }, + "messages": { + "type": "text", + "norms": false + }, + "paths": { + "properties": { + "dev": { + "type": "keyword", + "ignore_above": 1024 + }, + "inode": { + "type": "keyword", + "ignore_above": 1024 + }, + "item": { + "type": "keyword", + "ignore_above": 1024 + }, + "mode": { + "type": "keyword", + "ignore_above": 1024 + }, + "name": { + "type": "keyword", + "ignore_above": 1024 + }, + "nametype": { + "type": "keyword", + "ignore_above": 1024 + }, + "obj_domain": { + "type": "keyword", + "ignore_above": 1024 + }, + "obj_level": { + "type": "keyword", + "ignore_above": 1024 + }, + "obj_role": { + "type": "keyword", + "ignore_above": 1024 + }, + "obj_user": { + "type": "keyword", + "ignore_above": 1024 + }, + "objtype": { + "type": "keyword", + "ignore_above": 1024 + }, + "ogid": { + "type": "keyword", + "ignore_above": 1024 + }, + "ouid": { + "type": "keyword", + "ignore_above": 1024 + }, + "rdev": { + "type": "keyword", + "ignore_above": 1024 + } + } + }, + "result": { + "type": "keyword", + "ignore_above": 1024 + }, + "sequence": { + "type": "long" + }, + "session": { + "type": "keyword", + "ignore_above": 1024 + }, + "summary": { + "properties": { + "actor": { + "properties": { + "primary": { + "type": "keyword", + "ignore_above": 1024 + }, + "secondary": { + "type": "keyword", + "ignore_above": 1024 + } + } + }, + "how": { + "type": "keyword", + "ignore_above": 1024 + }, + "object": { + "properties": { + "primary": { + "type": "keyword", + "ignore_above": 1024 + }, + "secondary": { + "type": "keyword", + "ignore_above": 1024 + }, + "type": { + "type": "keyword", + "ignore_above": 1024 + } + } + } + } + }, + "warnings": { + "type": "keyword", + "ignore_above": 1024 + } + } + }, + "beat": { + "properties": { + "hostname": { + "type": "keyword", + "ignore_above": 1024 + }, + "name": { + "type": "keyword", + "ignore_above": 1024 + }, + "timezone": { + "type": "keyword", + "ignore_above": 1024 + }, + "version": { + "type": "keyword", + "ignore_above": 1024 + } + } + }, + "destination": { + "properties": { + "hostname": { + "type": "keyword", + "ignore_above": 1024 + }, + "ip": { + "type": "ip" + }, + "path": { + "type": "keyword", + "ignore_above": 1024 + }, + "port": { + "type": "keyword", + "ignore_above": 1024 + } + } + }, + "docker": { + "properties": { + "container": { + "properties": { + "id": { + "type": "keyword", + "ignore_above": 1024 + }, + "image": { + "type": "keyword", + "ignore_above": 1024 + }, + "labels": { + "type": "object" + }, + "name": { + "type": "keyword", + "ignore_above": 1024 + } + } + } + } + }, + "error": { + "properties": { + "code": { + "type": "long" + }, + "message": { + "type": "text", + "norms": false + }, + "type": { + "type": "keyword", + "ignore_above": 1024 + } + } + }, + "event": { + "properties": { + "action": { + "type": "keyword", + "ignore_above": 1024 + }, + "category": { + "type": "keyword", + "ignore_above": 1024 + }, + "module": { + "type": "keyword", + "ignore_above": 1024 + }, + "type": { + "type": "keyword", + "ignore_above": 1024 + } + } + }, + "fields": { + "type": "object" + }, + "file": { + "properties": { + "ctime": { + "type": "date" + }, + "device": { + "type": "keyword", + "ignore_above": 1024 + }, + "gid": { + "type": "keyword", + "ignore_above": 1024 + }, + "group": { + "type": "keyword", + "ignore_above": 1024 + }, + "inode": { + "type": "keyword", + "ignore_above": 1024 + }, + "mode": { + "type": "keyword", + "ignore_above": 1024 + }, + "mtime": { + "type": "date" + }, + "origin": { + "type": "text", + "norms": false, + "fields": { + "raw": { + "type": "keyword", + "ignore_above": 1024 + } + } + }, + "owner": { + "type": "keyword", + "ignore_above": 1024 + }, + "path": { + "type": "text", + "norms": false, + "fields": { + "raw": { + "type": "keyword", + "ignore_above": 1024 + } + } + }, + "selinux": { + "properties": { + "domain": { + "type": "keyword", + "ignore_above": 1024 + }, + "level": { + "type": "keyword", + "ignore_above": 1024 + }, + "role": { + "type": "keyword", + "ignore_above": 1024 + }, + "user": { + "type": "keyword", + "ignore_above": 1024 + } + } + }, + "setgid": { + "type": "boolean" + }, + "setuid": { + "type": "boolean" + }, + "size": { + "type": "long" + }, + "target_path": { + "type": "keyword", + "ignore_above": 1024 + }, + "type": { + "type": "keyword", + "ignore_above": 1024 + }, + "uid": { + "type": "keyword", + "ignore_above": 1024 + } + } + }, + "geoip": { + "properties": { + "city_name": { + "type": "keyword", + "ignore_above": 1024 + }, + "continent_name": { + "type": "keyword", + "ignore_above": 1024 + }, + "country_iso_code": { + "type": "keyword", + "ignore_above": 1024 + }, + "location": { + "type": "geo_point" + }, + "region_name": { + "type": "keyword", + "ignore_above": 1024 + } + } + }, + "hash": { + "properties": { + "blake2b_256": { + "type": "keyword", + "ignore_above": 1024 + }, + "blake2b_384": { + "type": "keyword", + "ignore_above": 1024 + }, + "blake2b_512": { + "type": "keyword", + "ignore_above": 1024 + }, + "md5": { + "type": "keyword", + "ignore_above": 1024 + }, + "sha1": { + "type": "keyword", + "ignore_above": 1024 + }, + "sha224": { + "type": "keyword", + "ignore_above": 1024 + }, + "sha256": { + "type": "keyword", + "ignore_above": 1024 + }, + "sha384": { + "type": "keyword", + "ignore_above": 1024 + }, + "sha3_224": { + "type": "keyword", + "ignore_above": 1024 + }, + "sha3_256": { + "type": "keyword", + "ignore_above": 1024 + }, + "sha3_384": { + "type": "keyword", + "ignore_above": 1024 + }, + "sha3_512": { + "type": "keyword", + "ignore_above": 1024 + }, + "sha512": { + "type": "keyword", + "ignore_above": 1024 + }, + "sha512_224": { + "type": "keyword", + "ignore_above": 1024 + }, + "sha512_256": { + "type": "keyword", + "ignore_above": 1024 + }, + "xxh64": { + "type": "keyword", + "ignore_above": 1024 + } + } + }, + "host": { + "properties": { + "architecture": { + "type": "keyword", + "ignore_above": 1024 + }, + "id": { + "type": "keyword", + "ignore_above": 1024 + }, + "ip": { + "type": "ip" + }, + "mac": { + "type": "keyword", + "ignore_above": 1024 + }, + "name": { + "type": "keyword", + "ignore_above": 1024 + }, + "os": { + "properties": { + "family": { + "type": "keyword", + "ignore_above": 1024 + }, + "platform": { + "type": "keyword", + "ignore_above": 1024 + }, + "version": { + "type": "keyword", + "ignore_above": 1024 + } + } + } + } + }, + "kubernetes": { + "properties": { + "annotations": { + "type": "object" + }, + "container": { + "properties": { + "image": { + "type": "keyword", + "ignore_above": 1024 + }, + "name": { + "type": "keyword", + "ignore_above": 1024 + } + } + }, + "labels": { + "type": "object" + }, + "namespace": { + "type": "keyword", + "ignore_above": 1024 + }, + "node": { + "properties": { + "name": { + "type": "keyword", + "ignore_above": 1024 + } + } + }, + "pod": { + "properties": { + "name": { + "type": "keyword", + "ignore_above": 1024 + }, + "uid": { + "type": "keyword", + "ignore_above": 1024 + } + } + } + } + }, + "meta": { + "properties": { + "cloud": { + "properties": { + "availability_zone": { + "type": "keyword", + "ignore_above": 1024 + }, + "instance_id": { + "type": "keyword", + "ignore_above": 1024 + }, + "instance_name": { + "type": "keyword", + "ignore_above": 1024 + }, + "machine_type": { + "type": "keyword", + "ignore_above": 1024 + }, + "project_id": { + "type": "keyword", + "ignore_above": 1024 + }, + "provider": { + "type": "keyword", + "ignore_above": 1024 + }, + "region": { + "type": "keyword", + "ignore_above": 1024 + } + } + } + } + }, + "network": { + "properties": { + "direction": { + "type": "keyword", + "ignore_above": 1024 + } + } + }, + "process": { + "properties": { + "args": { + "type": "keyword", + "ignore_above": 1024 + }, + "cwd": { + "type": "keyword", + "ignore_above": 1024 + }, + "exe": { + "type": "keyword", + "ignore_above": 1024 + }, + "name": { + "type": "keyword", + "ignore_above": 1024 + }, + "pid": { + "type": "keyword", + "ignore_above": 1024 + }, + "ppid": { + "type": "keyword", + "ignore_above": 1024 + }, + "title": { + "type": "keyword", + "ignore_above": 1024 + } + } + }, + "source": { + "properties": { + "hostname": { + "type": "keyword", + "ignore_above": 1024 + }, + "ip": { + "type": "ip" + }, + "path": { + "type": "keyword", + "ignore_above": 1024 + }, + "port": { + "type": "keyword", + "ignore_above": 1024 + } + } + }, + "tags": { + "type": "keyword", + "ignore_above": 1024 + }, + "user": { + "properties": { + "auid": { + "type": "keyword", + "ignore_above": 1024 + }, + "egid": { + "type": "keyword", + "ignore_above": 1024 + }, + "euid": { + "type": "keyword", + "ignore_above": 1024 + }, + "fsgid": { + "type": "keyword", + "ignore_above": 1024 + }, + "fsuid": { + "type": "keyword", + "ignore_above": 1024 + }, + "gid": { + "type": "keyword", + "ignore_above": 1024 + }, + "name_map": { + "properties": { + "auid": { + "type": "keyword", + "ignore_above": 1024 + }, + "egid": { + "type": "keyword", + "ignore_above": 1024 + }, + "euid": { + "type": "keyword", + "ignore_above": 1024 + }, + "fsgid": { + "type": "keyword", + "ignore_above": 1024 + }, + "fsuid": { + "type": "keyword", + "ignore_above": 1024 + }, + "gid": { + "type": "keyword", + "ignore_above": 1024 + }, + "sgid": { + "type": "keyword", + "ignore_above": 1024 + }, + "suid": { + "type": "keyword", + "ignore_above": 1024 + }, + "uid": { + "type": "keyword", + "ignore_above": 1024 + } + } + }, + "selinux": { + "properties": { + "category": { + "type": "keyword", + "ignore_above": 1024 + }, + "domain": { + "type": "keyword", + "ignore_above": 1024 + }, + "level": { + "type": "keyword", + "ignore_above": 1024 + }, + "role": { + "type": "keyword", + "ignore_above": 1024 + }, + "user": { + "type": "keyword", + "ignore_above": 1024 + } + } + }, + "sgid": { + "type": "keyword", + "ignore_above": 1024 + }, + "suid": { + "type": "keyword", + "ignore_above": 1024 + }, + "uid": { + "type": "keyword", + "ignore_above": 1024 + } + } + } + } + }, + "aliases": {} + } +} \ No newline at end of file diff --git a/x-pack/test/functional/es_archives/endpoint/metadata/api_feature/data.json b/x-pack/test/functional/es_archives/endpoint/metadata/api_feature/data.json index 60679f9072c74..30b4e19dcb1d1 100644 --- a/x-pack/test/functional/es_archives/endpoint/metadata/api_feature/data.json +++ b/x-pack/test/functional/es_archives/endpoint/metadata/api_feature/data.json @@ -4,7 +4,7 @@ "id": "3KVN2G8BYQH1gtPUuYk7", "index": "metrics-endpoint.metadata-default", "source": { - "@timestamp": 1579881969541, + "@timestamp": 1618841405309, "agent": { "id": "963b081e-60d1-482c-befd-a5815fa8290f", "version": "6.6.1", @@ -26,7 +26,7 @@ } }, "event": { - "created": 1579881969541, + "created": 1618841405309, "id": "32f5fda2-48e4-4fae-b89e-a18038294d14", "kind": "metric", "category": [ @@ -74,7 +74,7 @@ "id": "3aVN2G8BYQH1gtPUuYk7", "index": "metrics-endpoint.metadata-default", "source": { - "@timestamp": 1579881969541, + "@timestamp": 1618841405309, "agent": { "id": "b3412d6f-b022-4448-8fee-21cc936ea86b", "version": "6.0.0", @@ -96,7 +96,7 @@ } }, "event": { - "created": 1579881969541, + "created": 1618841405309, "id": "32f5fda2-48e4-4fae-b89e-a18038294d15", "kind": "metric", "category": [ @@ -143,7 +143,7 @@ "id": "3qVN2G8BYQH1gtPUuYk7", "index": "metrics-endpoint.metadata-default", "source": { - "@timestamp": 1579881969541, + "@timestamp": 1618841405309, "agent": { "id": "3838df35-a095-4af4-8fce-0b6d78793f2e", "version": "6.8.0", @@ -165,7 +165,7 @@ } }, "event": { - "created": 1579881969541, + "created": 1618841405309, "id": "32f5fda2-48e4-4fae-b89e-a18038294d16", "kind": "metric", "category": [ @@ -210,7 +210,7 @@ "id": "36VN2G8BYQH1gtPUuYk7", "index": "metrics-endpoint.metadata-default", "source": { - "@timestamp": 1579878369541, + "@timestamp": 1618841405309, "agent": { "id": "963b081e-60d1-482c-befd-a5815fa8290f", "version": "6.6.1", @@ -232,7 +232,7 @@ } }, "event": { - "created": 1579878369541, + "created": 1618841405309, "id": "32f5fda2-48e4-4fae-b89e-a18038294d18", "kind": "metric", "category": [ @@ -280,7 +280,7 @@ "id": "4KVN2G8BYQH1gtPUuYk7", "index": "metrics-endpoint.metadata-default", "source": { - "@timestamp": 1579878369541, + "@timestamp": 1618841405309, "agent": { "id": "b3412d6f-b022-4448-8fee-21cc936ea86b", "version": "6.0.0", @@ -302,7 +302,7 @@ } }, "event": { - "created": 1579878369541, + "created": 1618841405309, "id": "32f5fda2-48e4-4fae-b89e-a18038294d19", "kind": "metric", "category": [ @@ -348,7 +348,7 @@ "id": "4aVN2G8BYQH1gtPUuYk7", "index": "metrics-endpoint.metadata-default", "source": { - "@timestamp": 1579878369541, + "@timestamp": 1618841405309, "agent": { "id": "3838df35-a095-4af4-8fce-0b6d78793f2e", "version": "6.8.0", @@ -370,7 +370,7 @@ } }, "event": { - "created": 1579878369541, + "created": 1618841405309, "id": "32f5fda2-48e4-4fae-b89e-a18038294d39", "kind": "metric", "category": [ @@ -416,7 +416,7 @@ "id": "4qVN2G8BYQH1gtPUuYk7", "index": "metrics-endpoint.metadata-default", "source": { - "@timestamp": 1579874769541, + "@timestamp": 1618841405309, "agent": { "id": "963b081e-60d1-482c-befd-a5815fa8290f", "version": "6.6.1", @@ -438,7 +438,7 @@ } }, "event": { - "created": 1579874769541, + "created": 1618841405309, "id": "32f5fda2-48e4-4fae-b89e-a18038294d31", "kind": "metric", "category": [ @@ -485,7 +485,7 @@ "id": "46VN2G8BYQH1gtPUuYk7", "index": "metrics-endpoint.metadata-default", "source": { - "@timestamp": 1579874769541, + "@timestamp": 1618841405309, "agent": { "id": "b3412d6f-b022-4448-8fee-21cc936ea86b", "version": "6.0.0", @@ -507,7 +507,7 @@ } }, "event": { - "created": 1579874769541, + "created": 1618841405309, "id": "32f5fda2-48e4-4fae-b89e-a18038294d23", "kind": "metric", "category": [ @@ -553,7 +553,7 @@ "id": "5KVN2G8BYQH1gtPUuYk7", "index": "metrics-endpoint.metadata-default", "source": { - "@timestamp": 1579874769541, + "@timestamp": 1618841405309, "agent": { "id": "3838df35-a095-4af4-8fce-0b6d78793f2e", "version": "6.8.0", @@ -575,7 +575,7 @@ } }, "event": { - "created": 1579874769541, + "created": 1618841405309, "id": "32f5fda2-48e4-4fae-b89e-a18038294d35", "kind": "metric", "category": [ diff --git a/x-pack/test/functional/es_archives/endpoint/metadata/destination_index/data.json b/x-pack/test/functional/es_archives/endpoint/metadata/destination_index/data.json index ef840d454a763..b70a9d5df0eb8 100644 --- a/x-pack/test/functional/es_archives/endpoint/metadata/destination_index/data.json +++ b/x-pack/test/functional/es_archives/endpoint/metadata/destination_index/data.json @@ -4,68 +4,63 @@ "id": "M92ScEJT9M9QusfIi3hpEb0AAAAAAAAA", "index": "metrics-endpoint.metadata_current_default", "source": { - "HostDetails": { - "@timestamp": 1579881969541, - "Endpoint": { - "policy": { - "applied": { - "id": "00000000-0000-0000-0000-000000000000", - "name": "Default", - "status": "failure" - } - }, - "status": "enrolled" - }, - "agent": { - "id": "3838df35-a095-4af4-8fce-0b6d78793f2e", - "name": "Elastic Endpoint", - "version": "6.8.0" - }, - "elastic": { - "agent": { - "id": "023fa40c-411d-4188-a941-4147bfadd095" + "@timestamp": 1618841405309, + "Endpoint": { + "policy": { + "applied": { + "id": "00000000-0000-0000-0000-000000000000", + "name": "Default", + "status": "failure" } }, - "event": { - "action": "endpoint_metadata", - "category": [ - "host" - ], - "created": 1579881969541, - "dataset": "endpoint.metadata", - "id": "32f5fda2-48e4-4fae-b89e-a18038294d16", - "ingested": "2020-09-09T18:25:15.853783Z", - "kind": "metric", - "module": "endpoint", - "type": [ - "info" - ] - }, - "host": { - "hostname": "rezzani-7.example.com", - "id": "fc0ff548-feba-41b6-8367-65e8790d0eaf", - "ip": [ - "10.101.149.26", - "2606:a000:ffc0:39:11ef:37b9:3371:578c" - ], - "mac": [ - "e2-6d-f9-0-46-2e" - ], - "name": "rezzani-7.example.com", - "os": { - "Ext": { - "variant": "Windows Pro" - }, - "family": "Windows", - "full": "Windows 10", - "name": "windows 10.0", - "platform": "Windows", - "version": "10.0" - } - } + "status": "enrolled" }, "agent": { - "id": "3838df35-a095-4af4-8fce-0b6d78793f2e" + "id": "3838df35-a095-4af4-8fce-0b6d78793f2e", + "name": "Elastic Endpoint", + "version": "6.8.0" + }, + "elastic": { + "agent": { + "id": "023fa40c-411d-4188-a941-4147bfadd095" + } + }, + "event": { + "action": "endpoint_metadata", + "category": [ + "host" + ], + "created": 1618841405309, + "dataset": "endpoint.metadata", + "id": "32f5fda2-48e4-4fae-b89e-a18038294d16", + "ingested": "2020-09-09T18:25:15.853783Z", + "kind": "metric", + "module": "endpoint", + "type": [ + "info" + ] + }, + "host": { + "hostname": "rezzani-7.example.com", + "id": "fc0ff548-feba-41b6-8367-65e8790d0eaf", + "ip": [ + "10.101.149.26", + "2606:a000:ffc0:39:11ef:37b9:3371:578c" + ], + "mac": [ + "e2-6d-f9-0-46-2e" + ], + "name": "rezzani-7.example.com", + "os": { + "Ext": { + "variant": "Windows Pro" + }, + "family": "Windows", + "full": "Windows 10", + "name": "windows 10.0", + "platform": "Windows", + "version": "10.0" + } } } } @@ -77,71 +72,66 @@ "id": "OU3RgCJaNnR90byeDEHutp8AAAAAAAAA", "index": "metrics-endpoint.metadata_current_default", "source": { - "HostDetails": { - "@timestamp": 1579881969541, - "Endpoint": { - "policy": { - "applied": { - "id": "C2A9093E-E289-4C0A-AA44-8C32A414FA7A", - "name": "Default", - "status": "failure" - } - }, - "status": "enrolled" - }, - "agent": { - "id": "963b081e-60d1-482c-befd-a5815fa8290f", - "name": "Elastic Endpoint", - "version": "6.6.1" - }, - "elastic": { - "agent": { - "id": "11488bae-880b-4e7b-8d28-aac2aa9de816" + "@timestamp": 1618841405309, + "Endpoint": { + "policy": { + "applied": { + "id": "C2A9093E-E289-4C0A-AA44-8C32A414FA7A", + "name": "Default", + "status": "failure" } }, - "event": { - "action": "endpoint_metadata", - "category": [ - "host" - ], - "created": 1579881969541, - "dataset": "endpoint.metadata", - "id": "32f5fda2-48e4-4fae-b89e-a18038294d14", - "ingested": "2020-09-09T18:25:14.919526Z", - "kind": "metric", - "module": "endpoint", - "type": [ - "info" - ] - }, - "host": { - "architecture": "x86", - "hostname": "cadmann-4.example.com", - "id": "1fb3e58f-6ab0-4406-9d2a-91911207a712", - "ip": [ - "10.192.213.130", - "10.70.28.129" - ], - "mac": [ - "a9-71-6a-cc-93-85", - "f7-31-84-d3-21-68", - "2-95-12-39-ca-71" - ], - "name": "cadmann-4.example.com", - "os": { - "Ext": { - "variant": "Windows Pro" - }, - "family": "Windows", - "full": "Windows 10", - "name": "windows 10.0", - "platform": "Windows", - "version": "10.0" - } - } + "status": "enrolled" }, "agent": { - "id": "963b081e-60d1-482c-befd-a5815fa8290f" + "id": "963b081e-60d1-482c-befd-a5815fa8290f", + "name": "Elastic Endpoint", + "version": "6.6.1" + }, + "elastic": { + "agent": { + "id": "11488bae-880b-4e7b-8d28-aac2aa9de816" + } + }, + "event": { + "action": "endpoint_metadata", + "category": [ + "host" + ], + "created": 1618841405309, + "dataset": "endpoint.metadata", + "id": "32f5fda2-48e4-4fae-b89e-a18038294d14", + "ingested": "2020-09-09T18:25:14.919526Z", + "kind": "metric", + "module": "endpoint", + "type": [ + "info" + ] + }, + "host": { + "architecture": "x86", + "hostname": "cadmann-4.example.com", + "id": "1fb3e58f-6ab0-4406-9d2a-91911207a712", + "ip": [ + "10.192.213.130", + "10.70.28.129" + ], + "mac": [ + "a9-71-6a-cc-93-85", + "f7-31-84-d3-21-68", + "2-95-12-39-ca-71" + ], + "name": "cadmann-4.example.com", + "os": { + "Ext": { + "variant": "Windows Pro" + }, + "family": "Windows", + "full": "Windows 10", + "name": "windows 10.0", + "platform": "Windows", + "version": "10.0" + } } } } @@ -153,70 +143,65 @@ "id": "YjqDCEuI6JmLeLOSyZx_NhMAAAAAAAAA", "index": "metrics-endpoint.metadata_current_default", "source": { - "HostDetails": { - "@timestamp": 1579881969541, - "Endpoint": { - "policy": { - "applied": { - "id": "C2A9093E-E289-4C0A-AA44-8C32A414FA7A", - "name": "Default", - "status": "success" - } - }, - "status": "enrolled" - }, - "agent": { - "id": "b3412d6f-b022-4448-8fee-21cc936ea86b", - "name": "Elastic Endpoint", - "version": "6.0.0" - }, - "elastic": { - "agent": { - "id": "92ac1ce0-e1f7-409e-8af6-f17e97b1fc71" + "@timestamp": 1618841405309, + "Endpoint": { + "policy": { + "applied": { + "id": "C2A9093E-E289-4C0A-AA44-8C32A414FA7A", + "name": "Default", + "status": "success" } }, - "event": { - "action": "endpoint_metadata", - "category": [ - "host" - ], - "created": 1579881969541, - "dataset": "endpoint.metadata", - "id": "32f5fda2-48e4-4fae-b89e-a18038294d15", - "ingested": "2020-09-09T18:25:15.853404Z", - "kind": "metric", - "module": "endpoint", - "type": [ - "info" - ] - }, - "host": { - "architecture": "x86_64", - "hostname": "thurlow-9.example.com", - "id": "2f735e3d-be14-483b-9822-bad06e9045ca", - "ip": [ - "10.46.229.234" - ], - "mac": [ - "30-8c-45-55-69-b8", - "e5-36-7e-8f-a3-84", - "39-a1-37-20-18-74" - ], - "name": "thurlow-9.example.com", - "os": { - "Ext": { - "variant": "Windows Server" - }, - "family": "Windows", - "full": "Windows Server 2016", - "name": "windows 10.0", - "platform": "Windows", - "version": "10.0" - } - } + "status": "enrolled" }, "agent": { - "id": "b3412d6f-b022-4448-8fee-21cc936ea86b" + "id": "b3412d6f-b022-4448-8fee-21cc936ea86b", + "name": "Elastic Endpoint", + "version": "6.0.0" + }, + "elastic": { + "agent": { + "id": "92ac1ce0-e1f7-409e-8af6-f17e97b1fc71" + } + }, + "event": { + "action": "endpoint_metadata", + "category": [ + "host" + ], + "created": 1618841405309, + "dataset": "endpoint.metadata", + "id": "32f5fda2-48e4-4fae-b89e-a18038294d15", + "ingested": "2020-09-09T18:25:15.853404Z", + "kind": "metric", + "module": "endpoint", + "type": [ + "info" + ] + }, + "host": { + "architecture": "x86_64", + "hostname": "thurlow-9.example.com", + "id": "2f735e3d-be14-483b-9822-bad06e9045ca", + "ip": [ + "10.46.229.234" + ], + "mac": [ + "30-8c-45-55-69-b8", + "e5-36-7e-8f-a3-84", + "39-a1-37-20-18-74" + ], + "name": "thurlow-9.example.com", + "os": { + "Ext": { + "variant": "Windows Server" + }, + "family": "Windows", + "full": "Windows Server 2016", + "name": "windows 10.0", + "platform": "Windows", + "version": "10.0" + } } } } diff --git a/x-pack/test/functional/es_archives/filebeat/kpi_hosts/data.json b/x-pack/test/functional/es_archives/filebeat/kpi_hosts/data.json new file mode 100644 index 0000000000000..847158e901338 --- /dev/null +++ b/x-pack/test/functional/es_archives/filebeat/kpi_hosts/data.json @@ -0,0 +1,133 @@ +{ + "type": "doc", + "value": { + "id": "Lw4l02gBqd-n62Sw_lxm", + "index": "filebeat-7.0.0-iot-2019.06", + "source": { + "@timestamp": "2019-02-09T16:45:06.331Z", + "@version": "1", + "agent": { + "ephemeral_id": "97412477-f94f-4f25-a21f-4103798683db", + "hostname": "raspberrypi", + "id": "4d3ea604-27e5-4ec7-ab64-44f82285d776", + "type": "filebeat", + "version": "7.0.0" + }, + "destination": { + "domain": "s3-iad-2.cf.dash.row.aiv-cdn.net", + "ip": "10.100.7.196", + "port": 57854 + }, + "ecs": { + "version": "1.0.0-beta2" + }, + "event": { + "dataset": "suricata.eve", + "end": "2019-02-09T16:45:06.331Z", + "kind": "event", + "module": "suricata", + "type": "fileinfo" + }, + "file": { + "path": "/dm/2$XTMWANo0Q2RZKlH-95UoAahZrOg~/8cdf/ad98/e000/4b0d-8f72-8faf9aa1a35a/c3d5b471-4e36-45e0-8ca7-d789366f3b31_audio_13.mp4", + "size": 48277 + }, + "fileset": { + "name": "eve" + }, + "flow": { + "locality": "public" + }, + "host": { + "architecture": "armv7l", + "containerized": false, + "hostname": "raspberrypi", + "id": "b19a781f683541a7a25ee345133aa399", + "name": "raspberrypi", + "os": { + "codename": "stretch", + "family": "", + "kernel": "4.14.50-v7+", + "name": "Raspbian GNU/Linux", + "platform": "raspbian", + "version": "9 (stretch)" + } + }, + "http": { + "request": { + "method": "get" + }, + "response": { + "body": { + "bytes": 48277 + }, + "status_code": 206 + } + }, + "input": { + "type": "log" + }, + "labels": { + "pipeline": "filebeat-7.0.0-suricata-eve-pipeline" + }, + "log": { + "file": { + "path": "/var/log/suricata/eve.json" + }, + "offset": 1734115622 + }, + "network": { + "name": "iot", + "protocol": "http", + "transport": "tcp" + }, + "service": { + "type": "suricata" + }, + "source": { + "as": { + "num": 16509, + "org": "Amazon.com, Inc." + }, + "domain": "server-54-239-220-184.ewr50.r.cloudfront.net", + "geo": { + "city_name": "Seattle", + "continent_name": "North America", + "country_iso_code": "US", + "location": { + "lat": 47.6103, + "lon": -122.3341 + }, + "region_iso_code": "US-WA", + "region_name": "Washington" + }, + "ip": "54.239.220.184", + "port": 80 + }, + "suricata": { + "eve": { + "fileinfo": { + "state": "CLOSED", + "stored": false, + "tx_id": 102 + }, + "flow_id": 311011499414922, + "http": { + "http_content_type": "video/mp4", + "protocol": "HTTP/1.1" + }, + "in_iface": "eth0" + } + }, + "tags": [ + "suricata" + ], + "url": { + "domain": "s3-iad-2.cf.dash.row.aiv-cdn.net", + "original": "/dm/2$XTMWANo0Q2RZKlH-95UoAahZrOg~/8cdf/ad98/e000/4b0d-8f72-8faf9aa1a35a/c3d5b471-4e36-45e0-8ca7-d789366f3b31_audio_13.mp4", + "path": "/dm/2$XTMWANo0Q2RZKlH-95UoAahZrOg~/8cdf/ad98/e000/4b0d-8f72-8faf9aa1a35a/c3d5b471-4e36-45e0-8ca7-d789366f3b31_audio_13.mp4" + } + }, + "type": "_doc" + } +} diff --git a/x-pack/test/functional/es_archives/filebeat/kpi_hosts/mappings.json b/x-pack/test/functional/es_archives/filebeat/kpi_hosts/mappings.json new file mode 100644 index 0000000000000..1059fa49582f8 --- /dev/null +++ b/x-pack/test/functional/es_archives/filebeat/kpi_hosts/mappings.json @@ -0,0 +1,5940 @@ +{ + "type": "index", + "value": { + "aliases": { + }, + "index": "filebeat-7.0.0-iot-2019.06", + "mappings": { + "_meta": { + "beat": "filebeat", + "version": "7.0.0" + }, + "date_detection": false, + "dynamic_templates": [ + { + "container.labels": { + "mapping": { + "type": "keyword" + }, + "match_mapping_type": "string", + "path_match": "container.labels.*" + } + }, + { + "fields": { + "mapping": { + "type": "keyword" + }, + "match_mapping_type": "string", + "path_match": "fields.*" + } + }, + { + "docker.container.labels": { + "mapping": { + "type": "keyword" + }, + "match_mapping_type": "string", + "path_match": "docker.container.labels.*" + } + }, + { + "kibana.log.meta": { + "mapping": { + "type": "keyword" + }, + "match_mapping_type": "string", + "path_match": "kibana.log.meta.*" + } + }, + { + "strings_as_keyword": { + "mapping": { + "ignore_above": 1024, + "type": "keyword" + }, + "match_mapping_type": "string" + } + } + ], + "properties": { + "@timestamp": { + "type": "date" + }, + "@version": { + "ignore_above": 1024, + "type": "keyword" + }, + "agent": { + "properties": { + "ephemeral_id": { + "ignore_above": 1024, + "type": "keyword" + }, + "hostname": { + "ignore_above": 1024, + "type": "keyword" + }, + "id": { + "ignore_above": 1024, + "type": "keyword" + }, + "name": { + "ignore_above": 1024, + "type": "keyword" + }, + "type": { + "ignore_above": 1024, + "type": "keyword" + }, + "version": { + "ignore_above": 1024, + "type": "keyword" + } + } + }, + "apache": { + "properties": { + "access": { + "properties": { + "ssl": { + "properties": { + "cipher": { + "ignore_above": 1024, + "type": "keyword" + }, + "protocol": { + "ignore_above": 1024, + "type": "keyword" + } + } + } + } + }, + "error": { + "properties": { + "module": { + "ignore_above": 1024, + "type": "keyword" + } + } + } + } + }, + "apache2": { + "properties": { + "access": { + "properties": { + "geoip": { + "type": "object" + }, + "user_agent": { + "type": "object" + } + } + }, + "error": { + "type": "object" + } + } + }, + "auditd": { + "properties": { + "log": { + "properties": { + "a0": { + "ignore_above": 1024, + "type": "keyword" + }, + "addr": { + "type": "ip" + }, + "geoip": { + "type": "object" + }, + "item": { + "ignore_above": 1024, + "type": "keyword" + }, + "items": { + "ignore_above": 1024, + "type": "keyword" + }, + "laddr": { + "type": "ip" + }, + "lport": { + "type": "long" + }, + "new_auid": { + "ignore_above": 1024, + "type": "keyword" + }, + "new_ses": { + "ignore_above": 1024, + "type": "keyword" + }, + "old_auid": { + "ignore_above": 1024, + "type": "keyword" + }, + "old_ses": { + "ignore_above": 1024, + "type": "keyword" + }, + "rport": { + "type": "long" + }, + "sequence": { + "type": "long" + }, + "tty": { + "ignore_above": 1024, + "type": "keyword" + } + } + } + } + }, + "certificate": { + "properties": { + "common_name": { + "ignore_above": 1024, + "type": "keyword" + }, + "sha256": { + "ignore_above": 1024, + "type": "keyword" + } + } + }, + "cisco": { + "properties": { + "access_list": { + "ignore_above": 1024, + "type": "keyword" + }, + "log": { + "properties": { + "facility": { + "ignore_above": 1024, + "type": "keyword" + }, + "severity": { + "ignore_above": 1024, + "type": "keyword" + } + } + } + } + }, + "client": { + "properties": { + "address": { + "ignore_above": 1024, + "type": "keyword" + }, + "bytes": { + "type": "long" + }, + "domain": { + "ignore_above": 1024, + "type": "keyword" + }, + "geo": { + "properties": { + "city_name": { + "ignore_above": 1024, + "type": "keyword" + }, + "continent_name": { + "ignore_above": 1024, + "type": "keyword" + }, + "country_iso_code": { + "ignore_above": 1024, + "type": "keyword" + }, + "country_name": { + "ignore_above": 1024, + "type": "keyword" + }, + "location": { + "type": "geo_point" + }, + "name": { + "ignore_above": 1024, + "type": "keyword" + }, + "region_iso_code": { + "ignore_above": 1024, + "type": "keyword" + }, + "region_name": { + "ignore_above": 1024, + "type": "keyword" + } + } + }, + "ip": { + "type": "ip" + }, + "mac": { + "ignore_above": 1024, + "type": "keyword" + }, + "packets": { + "type": "long" + }, + "port": { + "type": "long" + } + } + }, + "cloud": { + "properties": { + "account": { + "properties": { + "id": { + "ignore_above": 1024, + "type": "keyword" + } + } + }, + "availability_zone": { + "ignore_above": 1024, + "type": "keyword" + }, + "instance": { + "properties": { + "id": { + "ignore_above": 1024, + "type": "keyword" + }, + "name": { + "ignore_above": 1024, + "type": "keyword" + } + } + }, + "machine": { + "properties": { + "type": { + "ignore_above": 1024, + "type": "keyword" + } + } + }, + "project": { + "properties": { + "id": { + "ignore_above": 1024, + "type": "keyword" + } + } + }, + "provider": { + "ignore_above": 1024, + "type": "keyword" + }, + "region": { + "ignore_above": 1024, + "type": "keyword" + } + } + }, + "container": { + "properties": { + "id": { + "ignore_above": 1024, + "type": "keyword" + }, + "image": { + "properties": { + "name": { + "ignore_above": 1024, + "type": "keyword" + }, + "tag": { + "ignore_above": 1024, + "type": "keyword" + } + } + }, + "labels": { + "type": "object" + }, + "name": { + "ignore_above": 1024, + "type": "keyword" + }, + "runtime": { + "ignore_above": 1024, + "type": "keyword" + } + } + }, + "destination": { + "properties": { + "address": { + "ignore_above": 1024, + "type": "keyword" + }, + "as": { + "properties": { + "num": { + "type": "long" + }, + "org": { + "ignore_above": 1024, + "type": "keyword" + } + } + }, + "bytes": { + "type": "long" + }, + "domain": { + "ignore_above": 1024, + "type": "keyword" + }, + "domain_top1m_rank": { + "type": "long" + }, + "geo": { + "properties": { + "city_name": { + "ignore_above": 1024, + "type": "keyword" + }, + "continent_name": { + "ignore_above": 1024, + "type": "keyword" + }, + "country_iso_code": { + "ignore_above": 1024, + "type": "keyword" + }, + "country_name": { + "ignore_above": 1024, + "type": "keyword" + }, + "location": { + "type": "geo_point" + }, + "name": { + "ignore_above": 1024, + "type": "keyword" + }, + "region_iso_code": { + "ignore_above": 1024, + "type": "keyword" + }, + "region_name": { + "ignore_above": 1024, + "type": "keyword" + } + } + }, + "ip": { + "type": "ip" + }, + "locality": { + "ignore_above": 1024, + "type": "keyword" + }, + "mac": { + "ignore_above": 1024, + "type": "keyword" + }, + "packets": { + "type": "long" + }, + "port": { + "type": "long" + } + } + }, + "docker": { + "properties": { + "container": { + "properties": { + "labels": { + "type": "object" + } + } + } + } + }, + "ecs": { + "properties": { + "version": { + "ignore_above": 1024, + "type": "keyword" + } + } + }, + "elasticsearch": { + "properties": { + "audit": { + "properties": { + "action": { + "ignore_above": 1024, + "type": "keyword" + }, + "indices": { + "ignore_above": 1024, + "type": "keyword" + }, + "layer": { + "ignore_above": 1024, + "type": "keyword" + }, + "origin": { + "properties": { + "type": { + "ignore_above": 1024, + "type": "keyword" + } + } + }, + "realm": { + "ignore_above": 1024, + "type": "keyword" + }, + "request": { + "properties": { + "id": { + "ignore_above": 1024, + "type": "keyword" + }, + "name": { + "ignore_above": 1024, + "type": "keyword" + } + } + }, + "url": { + "properties": { + "params": { + "ignore_above": 1024, + "type": "keyword" + } + } + }, + "user": { + "properties": { + "realm": { + "ignore_above": 1024, + "type": "keyword" + }, + "roles": { + "ignore_above": 1024, + "type": "keyword" + } + } + } + } + }, + "cluster": { + "properties": { + "name": { + "ignore_above": 1024, + "type": "keyword" + }, + "uuid": { + "ignore_above": 1024, + "type": "keyword" + } + } + }, + "component": { + "ignore_above": 1024, + "type": "keyword" + }, + "deprecation": { + "type": "object" + }, + "gc": { + "properties": { + "heap": { + "properties": { + "size_kb": { + "type": "long" + }, + "used_kb": { + "type": "long" + } + } + }, + "jvm_runtime_sec": { + "type": "float" + }, + "old_gen": { + "properties": { + "size_kb": { + "type": "long" + }, + "used_kb": { + "type": "long" + } + } + }, + "phase": { + "properties": { + "class_unload_time_sec": { + "type": "float" + }, + "cpu_time": { + "properties": { + "real_sec": { + "type": "float" + }, + "sys_sec": { + "type": "float" + }, + "user_sec": { + "type": "float" + } + } + }, + "duration_sec": { + "type": "float" + }, + "name": { + "ignore_above": 1024, + "type": "keyword" + }, + "parallel_rescan_time_sec": { + "type": "float" + }, + "scrub_string_table_time_sec": { + "type": "float" + }, + "scrub_symbol_table_time_sec": { + "type": "float" + }, + "weak_refs_processing_time_sec": { + "type": "float" + } + } + }, + "stopping_threads_time_sec": { + "type": "float" + }, + "tags": { + "ignore_above": 1024, + "type": "keyword" + }, + "threads_total_stop_time_sec": { + "type": "float" + }, + "young_gen": { + "properties": { + "size_kb": { + "type": "long" + }, + "used_kb": { + "type": "long" + } + } + } + } + }, + "index": { + "properties": { + "id": { + "ignore_above": 1024, + "type": "keyword" + }, + "name": { + "ignore_above": 1024, + "type": "keyword" + } + } + }, + "node": { + "properties": { + "id": { + "ignore_above": 1024, + "type": "keyword" + }, + "name": { + "ignore_above": 1024, + "type": "keyword" + } + } + }, + "server": { + "properties": { + "gc": { + "properties": { + "collection_duration": { + "properties": { + "ms": { + "type": "float" + } + } + }, + "observation_duration": { + "properties": { + "ms": { + "type": "float" + } + } + }, + "overhead_seq": { + "type": "long" + }, + "young": { + "properties": { + "one": { + "type": "long" + }, + "two": { + "type": "long" + } + } + } + } + }, + "stacktrace": { + "ignore_above": 1024, + "index": false, + "type": "keyword" + } + } + }, + "shard": { + "properties": { + "id": { + "ignore_above": 1024, + "type": "keyword" + } + } + }, + "slowlog": { + "properties": { + "extra_source": { + "ignore_above": 1024, + "type": "keyword" + }, + "id": { + "ignore_above": 1024, + "type": "keyword" + }, + "logger": { + "ignore_above": 1024, + "type": "keyword" + }, + "routing": { + "ignore_above": 1024, + "type": "keyword" + }, + "search_type": { + "ignore_above": 1024, + "type": "keyword" + }, + "source_query": { + "ignore_above": 1024, + "type": "keyword" + }, + "stats": { + "ignore_above": 1024, + "type": "keyword" + }, + "took": { + "ignore_above": 1024, + "type": "keyword" + }, + "total_hits": { + "ignore_above": 1024, + "type": "keyword" + }, + "total_shards": { + "ignore_above": 1024, + "type": "keyword" + }, + "type": { + "ignore_above": 1024, + "type": "keyword" + }, + "types": { + "ignore_above": 1024, + "type": "keyword" + } + } + } + } + }, + "error": { + "properties": { + "code": { + "ignore_above": 1024, + "type": "keyword" + }, + "id": { + "ignore_above": 1024, + "type": "keyword" + }, + "message": { + "norms": false, + "type": "text" + }, + "type": { + "ignore_above": 1024, + "type": "keyword" + } + } + }, + "event": { + "properties": { + "action": { + "ignore_above": 1024, + "type": "keyword" + }, + "category": { + "ignore_above": 1024, + "type": "keyword" + }, + "code": { + "ignore_above": 1024, + "type": "keyword" + }, + "created": { + "type": "date" + }, + "dataset": { + "ignore_above": 1024, + "type": "keyword" + }, + "duration": { + "type": "long" + }, + "end": { + "type": "date" + }, + "hash": { + "ignore_above": 1024, + "type": "keyword" + }, + "id": { + "ignore_above": 1024, + "type": "keyword" + }, + "kind": { + "ignore_above": 1024, + "type": "keyword" + }, + "module": { + "ignore_above": 1024, + "type": "keyword" + }, + "original": { + "doc_values": false, + "ignore_above": 1024, + "index": false, + "type": "keyword" + }, + "outcome": { + "ignore_above": 1024, + "type": "keyword" + }, + "risk_score": { + "type": "float" + }, + "risk_score_norm": { + "type": "float" + }, + "severity": { + "type": "long" + }, + "start": { + "type": "date" + }, + "timezone": { + "ignore_above": 1024, + "type": "keyword" + }, + "type": { + "ignore_above": 1024, + "type": "keyword" + } + } + }, + "fields": { + "type": "object" + }, + "file": { + "properties": { + "ctime": { + "type": "date" + }, + "device": { + "ignore_above": 1024, + "type": "keyword" + }, + "extension": { + "ignore_above": 1024, + "type": "keyword" + }, + "gid": { + "ignore_above": 1024, + "type": "keyword" + }, + "group": { + "ignore_above": 1024, + "type": "keyword" + }, + "inode": { + "ignore_above": 1024, + "type": "keyword" + }, + "mode": { + "ignore_above": 1024, + "type": "keyword" + }, + "mtime": { + "type": "date" + }, + "owner": { + "ignore_above": 1024, + "type": "keyword" + }, + "path": { + "ignore_above": 1024, + "type": "keyword" + }, + "size": { + "type": "long" + }, + "target_path": { + "ignore_above": 1024, + "type": "keyword" + }, + "type": { + "ignore_above": 1024, + "type": "keyword" + }, + "uid": { + "ignore_above": 1024, + "type": "keyword" + } + } + }, + "fileset": { + "properties": { + "name": { + "ignore_above": 1024, + "type": "keyword" + } + } + }, + "flow": { + "properties": { + "id": { + "ignore_above": 1024, + "type": "keyword" + }, + "locality": { + "ignore_above": 1024, + "type": "keyword" + } + } + }, + "group": { + "properties": { + "id": { + "ignore_above": 1024, + "type": "keyword" + }, + "name": { + "ignore_above": 1024, + "type": "keyword" + } + } + }, + "haproxy": { + "properties": { + "backend_name": { + "ignore_above": 1024, + "type": "keyword" + }, + "backend_queue": { + "type": "long" + }, + "bind_name": { + "ignore_above": 1024, + "type": "keyword" + }, + "bytes_read": { + "type": "long" + }, + "client": { + "type": "object" + }, + "connection_wait_time_ms": { + "type": "long" + }, + "connections": { + "properties": { + "active": { + "type": "long" + }, + "backend": { + "type": "long" + }, + "frontend": { + "type": "long" + }, + "retries": { + "type": "long" + }, + "server": { + "type": "long" + } + } + }, + "destination": { + "type": "object" + }, + "error_message": { + "norms": false, + "type": "text" + }, + "frontend_name": { + "ignore_above": 1024, + "type": "keyword" + }, + "geoip": { + "type": "object" + }, + "http": { + "properties": { + "request": { + "properties": { + "captured_cookie": { + "ignore_above": 1024, + "type": "keyword" + }, + "captured_headers": { + "ignore_above": 1024, + "type": "keyword" + }, + "raw_request_line": { + "ignore_above": 1024, + "type": "keyword" + }, + "time_wait_ms": { + "type": "long" + }, + "time_wait_without_data_ms": { + "type": "long" + } + } + }, + "response": { + "properties": { + "captured_cookie": { + "ignore_above": 1024, + "type": "keyword" + }, + "captured_headers": { + "ignore_above": 1024, + "type": "keyword" + } + } + } + } + }, + "mode": { + "ignore_above": 1024, + "type": "keyword" + }, + "server_name": { + "ignore_above": 1024, + "type": "keyword" + }, + "server_queue": { + "type": "long" + }, + "source": { + "ignore_above": 1024, + "type": "keyword" + }, + "tcp": { + "properties": { + "connection_waiting_time_ms": { + "type": "long" + } + } + }, + "termination_state": { + "ignore_above": 1024, + "type": "keyword" + }, + "time_backend_connect": { + "type": "long" + }, + "time_queue": { + "type": "long" + }, + "total_waiting_time_ms": { + "type": "long" + } + } + }, + "hash": { + "properties": { + "sha256": { + "ignore_above": 1024, + "type": "keyword" + } + } + }, + "host": { + "properties": { + "architecture": { + "ignore_above": 1024, + "type": "keyword" + }, + "containerized": { + "type": "boolean" + }, + "geo": { + "properties": { + "city_name": { + "ignore_above": 1024, + "type": "keyword" + }, + "continent_name": { + "ignore_above": 1024, + "type": "keyword" + }, + "country_iso_code": { + "ignore_above": 1024, + "type": "keyword" + }, + "country_name": { + "ignore_above": 1024, + "type": "keyword" + }, + "location": { + "type": "geo_point" + }, + "name": { + "ignore_above": 1024, + "type": "keyword" + }, + "region_iso_code": { + "ignore_above": 1024, + "type": "keyword" + }, + "region_name": { + "ignore_above": 1024, + "type": "keyword" + } + } + }, + "hostname": { + "ignore_above": 1024, + "type": "keyword" + }, + "id": { + "ignore_above": 1024, + "type": "keyword" + }, + "ip": { + "type": "ip" + }, + "mac": { + "ignore_above": 1024, + "type": "keyword" + }, + "name": { + "ignore_above": 1024, + "type": "keyword" + }, + "os": { + "properties": { + "codename": { + "ignore_above": 1024, + "type": "keyword" + }, + "family": { + "ignore_above": 1024, + "type": "keyword" + }, + "full": { + "ignore_above": 1024, + "type": "keyword" + }, + "kernel": { + "ignore_above": 1024, + "type": "keyword" + }, + "name": { + "ignore_above": 1024, + "type": "keyword" + }, + "platform": { + "ignore_above": 1024, + "type": "keyword" + }, + "version": { + "ignore_above": 1024, + "type": "keyword" + } + } + }, + "type": { + "ignore_above": 1024, + "type": "keyword" + } + } + }, + "hostname": { + "ignore_above": 1024, + "type": "keyword" + }, + "http": { + "properties": { + "request": { + "properties": { + "body": { + "properties": { + "bytes": { + "type": "long" + }, + "content": { + "ignore_above": 1024, + "type": "keyword" + } + } + }, + "bytes": { + "type": "long" + }, + "method": { + "ignore_above": 1024, + "type": "keyword" + }, + "referrer": { + "ignore_above": 1024, + "type": "keyword" + } + } + }, + "response": { + "properties": { + "body": { + "properties": { + "bytes": { + "type": "long" + }, + "content": { + "ignore_above": 1024, + "type": "keyword" + } + } + }, + "bytes": { + "type": "long" + }, + "status_code": { + "type": "long" + } + } + }, + "version": { + "ignore_above": 1024, + "type": "keyword" + } + } + }, + "icinga": { + "properties": { + "debug": { + "properties": { + "facility": { + "ignore_above": 1024, + "type": "keyword" + } + } + }, + "main": { + "properties": { + "facility": { + "ignore_above": 1024, + "type": "keyword" + } + } + }, + "startup": { + "properties": { + "facility": { + "ignore_above": 1024, + "type": "keyword" + } + } + } + } + }, + "icmp": { + "properties": { + "code": { + "ignore_above": 1024, + "type": "keyword" + }, + "type": { + "ignore_above": 1024, + "type": "keyword" + } + } + }, + "iis": { + "properties": { + "access": { + "properties": { + "cookie": { + "ignore_above": 1024, + "type": "keyword" + }, + "geoip": { + "type": "object" + }, + "server_name": { + "ignore_above": 1024, + "type": "keyword" + }, + "site_name": { + "ignore_above": 1024, + "type": "keyword" + }, + "sub_status": { + "type": "long" + }, + "user_agent": { + "type": "object" + }, + "win32_status": { + "type": "long" + } + } + }, + "error": { + "properties": { + "geoip": { + "type": "object" + }, + "queue_name": { + "ignore_above": 1024, + "type": "keyword" + }, + "reason_phrase": { + "ignore_above": 1024, + "type": "keyword" + } + } + } + } + }, + "input": { + "properties": { + "type": { + "ignore_above": 1024, + "type": "keyword" + } + } + }, + "iptables": { + "properties": { + "ether_type": { + "type": "long" + }, + "flow_label": { + "type": "long" + }, + "fragment_flags": { + "ignore_above": 1024, + "type": "keyword" + }, + "fragment_offset": { + "type": "long" + }, + "icmp": { + "properties": { + "code": { + "type": "long" + }, + "id": { + "type": "long" + }, + "parameter": { + "type": "long" + }, + "redirect": { + "type": "ip" + }, + "seq": { + "type": "long" + }, + "type": { + "type": "long" + } + } + }, + "id": { + "type": "long" + }, + "incomplete_bytes": { + "type": "long" + }, + "input_device": { + "ignore_above": 1024, + "type": "keyword" + }, + "length": { + "type": "long" + }, + "output_device": { + "ignore_above": 1024, + "type": "keyword" + }, + "precedence_bits": { + "type": "short" + }, + "tcp": { + "properties": { + "ack": { + "type": "long" + }, + "flags": { + "ignore_above": 1024, + "type": "keyword" + }, + "reserved_bits": { + "type": "short" + }, + "seq": { + "type": "long" + }, + "window": { + "type": "long" + } + } + }, + "tos": { + "type": "long" + }, + "ttl": { + "type": "long" + }, + "ubiquiti": { + "properties": { + "input_zone": { + "ignore_above": 1024, + "type": "keyword" + }, + "output_zone": { + "ignore_above": 1024, + "type": "keyword" + }, + "rule_number": { + "ignore_above": 1024, + "type": "keyword" + }, + "rule_set": { + "ignore_above": 1024, + "type": "keyword" + } + } + }, + "udp": { + "properties": { + "length": { + "type": "long" + } + } + } + } + }, + "kafka": { + "properties": { + "log": { + "properties": { + "class": { + "ignore_above": 1024, + "type": "keyword" + }, + "component": { + "ignore_above": 1024, + "type": "keyword" + }, + "trace": { + "properties": { + "class": { + "ignore_above": 1024, + "type": "keyword" + }, + "message": { + "norms": false, + "type": "text" + } + } + } + } + } + } + }, + "kibana": { + "properties": { + "log": { + "properties": { + "meta": { + "type": "object" + }, + "state": { + "ignore_above": 1024, + "type": "keyword" + }, + "tags": { + "ignore_above": 1024, + "type": "keyword" + } + } + } + } + }, + "kubernetes": { + "properties": { + "annotations": { + "type": "object" + }, + "container": { + "properties": { + "image": { + "ignore_above": 1024, + "type": "keyword" + }, + "name": { + "ignore_above": 1024, + "type": "keyword" + } + } + }, + "labels": { + "type": "object" + }, + "namespace": { + "ignore_above": 1024, + "type": "keyword" + }, + "node": { + "properties": { + "name": { + "ignore_above": 1024, + "type": "keyword" + } + } + }, + "pod": { + "properties": { + "name": { + "ignore_above": 1024, + "type": "keyword" + }, + "uid": { + "ignore_above": 1024, + "type": "keyword" + } + } + } + } + }, + "labels": { + "properties": { + "application": { + "ignore_above": 1024, + "type": "keyword" + }, + "pipeline": { + "ignore_above": 1024, + "type": "keyword" + } + } + }, + "log": { + "properties": { + "file": { + "properties": { + "path": { + "ignore_above": 1024, + "type": "keyword" + } + } + }, + "flags": { + "ignore_above": 1024, + "type": "keyword" + }, + "level": { + "ignore_above": 1024, + "type": "keyword" + }, + "offset": { + "type": "long" + }, + "original": { + "doc_values": false, + "ignore_above": 1024, + "index": false, + "type": "keyword" + }, + "source": { + "properties": { + "address": { + "ignore_above": 1024, + "type": "keyword" + } + } + } + } + }, + "logstash": { + "properties": { + "log": { + "properties": { + "log_event": { + "type": "object" + }, + "module": { + "ignore_above": 1024, + "type": "keyword" + }, + "thread": { + "fields": { + "text": { + "norms": false, + "type": "text" + } + }, + "ignore_above": 1024, + "type": "keyword" + } + } + }, + "slowlog": { + "properties": { + "event": { + "fields": { + "text": { + "norms": false, + "type": "text" + } + }, + "ignore_above": 1024, + "type": "keyword" + }, + "module": { + "ignore_above": 1024, + "type": "keyword" + }, + "plugin_name": { + "ignore_above": 1024, + "type": "keyword" + }, + "plugin_params": { + "fields": { + "text": { + "norms": false, + "type": "text" + } + }, + "ignore_above": 1024, + "type": "keyword" + }, + "plugin_params_object": { + "type": "object" + }, + "plugin_type": { + "ignore_above": 1024, + "type": "keyword" + }, + "thread": { + "fields": { + "text": { + "norms": false, + "type": "text" + } + }, + "ignore_above": 1024, + "type": "keyword" + }, + "took_in_millis": { + "type": "long" + } + } + } + } + }, + "message": { + "norms": false, + "type": "text" + }, + "mongodb": { + "properties": { + "log": { + "properties": { + "component": { + "ignore_above": 1024, + "type": "keyword" + }, + "context": { + "ignore_above": 1024, + "type": "keyword" + } + } + } + } + }, + "mysql": { + "properties": { + "error": { + "type": "object" + }, + "slowlog": { + "properties": { + "bytes_sent": { + "type": "long" + }, + "current_user": { + "ignore_above": 1024, + "type": "keyword" + }, + "filesort": { + "type": "boolean" + }, + "filesort_on_disk": { + "type": "boolean" + }, + "full_join": { + "type": "boolean" + }, + "full_scan": { + "type": "boolean" + }, + "innodb": { + "properties": { + "io_r_bytes": { + "type": "long" + }, + "io_r_ops": { + "type": "long" + }, + "io_r_wait": { + "properties": { + "sec": { + "type": "long" + } + } + }, + "pages_distinct": { + "type": "long" + }, + "queue_wait": { + "properties": { + "sec": { + "type": "long" + } + } + }, + "rec_lock_wait": { + "properties": { + "sec": { + "type": "long" + } + } + }, + "trx_id": { + "ignore_above": 1024, + "type": "keyword" + } + } + }, + "killed": { + "ignore_above": 1024, + "type": "keyword" + }, + "last_errno": { + "ignore_above": 1024, + "type": "keyword" + }, + "lock_time": { + "properties": { + "sec": { + "type": "float" + } + } + }, + "log_slow_rate_limit": { + "ignore_above": 1024, + "type": "keyword" + }, + "log_slow_rate_type": { + "ignore_above": 1024, + "type": "keyword" + }, + "merge_passes": { + "type": "long" + }, + "priority_queue": { + "type": "boolean" + }, + "query": { + "ignore_above": 1024, + "type": "keyword" + }, + "query_cache_hit": { + "type": "boolean" + }, + "rows_affected": { + "type": "long" + }, + "rows_examined": { + "type": "long" + }, + "rows_sent": { + "type": "long" + }, + "schema": { + "ignore_above": 1024, + "type": "keyword" + }, + "tmp_disk_tables": { + "type": "long" + }, + "tmp_table": { + "type": "boolean" + }, + "tmp_table_on_disk": { + "type": "boolean" + }, + "tmp_table_sizes": { + "type": "long" + }, + "tmp_tables": { + "type": "long" + } + } + }, + "thread_id": { + "type": "long" + } + } + }, + "netflow": { + "properties": { + "absolute_error": { + "type": "double" + }, + "address_pool_high_threshold": { + "type": "long" + }, + "address_pool_low_threshold": { + "type": "long" + }, + "address_port_mapping_high_threshold": { + "type": "long" + }, + "address_port_mapping_low_threshold": { + "type": "long" + }, + "address_port_mapping_per_user_high_threshold": { + "type": "long" + }, + "anonymization_flags": { + "type": "long" + }, + "anonymization_technique": { + "type": "long" + }, + "application_category_name": { + "ignore_above": 1024, + "type": "keyword" + }, + "application_description": { + "ignore_above": 1024, + "type": "keyword" + }, + "application_group_name": { + "ignore_above": 1024, + "type": "keyword" + }, + "application_id": { + "type": "short" + }, + "application_name": { + "ignore_above": 1024, + "type": "keyword" + }, + "application_sub_category_name": { + "ignore_above": 1024, + "type": "keyword" + }, + "bgp_destination_as_number": { + "type": "long" + }, + "bgp_next_adjacent_as_number": { + "type": "long" + }, + "bgp_next_hop_ipv4_address": { + "type": "ip" + }, + "bgp_next_hop_ipv6_address": { + "type": "ip" + }, + "bgp_prev_adjacent_as_number": { + "type": "long" + }, + "bgp_source_as_number": { + "type": "long" + }, + "bgp_validity_state": { + "type": "short" + }, + "biflow_direction": { + "type": "short" + }, + "class_id": { + "type": "short" + }, + "class_name": { + "ignore_above": 1024, + "type": "keyword" + }, + "classification_engine_id": { + "type": "short" + }, + "collection_time_milliseconds": { + "type": "date" + }, + "collector_certificate": { + "type": "short" + }, + "collector_ipv4_address": { + "type": "ip" + }, + "collector_ipv6_address": { + "type": "ip" + }, + "collector_transport_port": { + "type": "long" + }, + "common_properties_id": { + "type": "long" + }, + "confidence_level": { + "type": "double" + }, + "connection_sum_duration_seconds": { + "type": "long" + }, + "connection_transaction_id": { + "type": "long" + }, + "data_link_frame_section": { + "type": "short" + }, + "data_link_frame_size": { + "type": "long" + }, + "data_link_frame_type": { + "type": "long" + }, + "data_records_reliability": { + "type": "boolean" + }, + "delta_flow_count": { + "type": "long" + }, + "destination_ipv4_address": { + "type": "ip" + }, + "destination_ipv4_prefix": { + "type": "ip" + }, + "destination_ipv4_prefix_length": { + "type": "short" + }, + "destination_ipv6_address": { + "type": "ip" + }, + "destination_ipv6_prefix": { + "type": "ip" + }, + "destination_ipv6_prefix_length": { + "type": "short" + }, + "destination_mac_address": { + "ignore_above": 1024, + "type": "keyword" + }, + "destination_transport_port": { + "type": "long" + }, + "digest_hash_value": { + "type": "long" + }, + "distinct_count_of_destinatio_nipa_ddress": { + "type": "long" + }, + "distinct_count_of_destination_ipv4_address": { + "type": "long" + }, + "distinct_count_of_destination_ipv6_address": { + "type": "long" + }, + "distinct_count_of_sourc_eipa_ddress": { + "type": "long" + }, + "distinct_count_of_source_ipv4_address": { + "type": "long" + }, + "distinct_count_of_source_ipv6_address": { + "type": "long" + }, + "dot1q_customer_dei": { + "type": "boolean" + }, + "dot1q_customer_destination_mac_address": { + "ignore_above": 1024, + "type": "keyword" + }, + "dot1q_customer_priority": { + "type": "short" + }, + "dot1q_customer_source_mac_address": { + "ignore_above": 1024, + "type": "keyword" + }, + "dot1q_customer_vlan_id": { + "type": "long" + }, + "dot1q_dei": { + "type": "boolean" + }, + "dot1q_priority": { + "type": "short" + }, + "dot1q_service_instance_id": { + "type": "long" + }, + "dot1q_service_instance_priority": { + "type": "short" + }, + "dot1q_service_instance_tag": { + "type": "short" + }, + "dot1q_vlan_id": { + "type": "long" + }, + "dropped_layer2_octet_delta_count": { + "type": "long" + }, + "dropped_layer2_octet_total_count": { + "type": "long" + }, + "dropped_octet_delta_count": { + "type": "long" + }, + "dropped_octet_total_count": { + "type": "long" + }, + "dropped_packet_delta_count": { + "type": "long" + }, + "dropped_packet_total_count": { + "type": "long" + }, + "dst_traffic_index": { + "type": "long" + }, + "egress_broadcast_packet_total_count": { + "type": "long" + }, + "egress_interface": { + "type": "long" + }, + "egress_interface_type": { + "type": "long" + }, + "egress_physical_interface": { + "type": "long" + }, + "egress_unicast_packet_total_count": { + "type": "long" + }, + "egress_vrfid": { + "type": "long" + }, + "encrypted_technology": { + "ignore_above": 1024, + "type": "keyword" + }, + "engine_id": { + "type": "short" + }, + "engine_type": { + "type": "short" + }, + "ethernet_header_length": { + "type": "short" + }, + "ethernet_payload_length": { + "type": "long" + }, + "ethernet_total_length": { + "type": "long" + }, + "ethernet_type": { + "type": "long" + }, + "export_interface": { + "type": "long" + }, + "export_protocol_version": { + "type": "short" + }, + "export_sctp_stream_id": { + "type": "long" + }, + "export_transport_protocol": { + "type": "short" + }, + "exported_flow_record_total_count": { + "type": "long" + }, + "exported_message_total_count": { + "type": "long" + }, + "exported_octet_total_count": { + "type": "long" + }, + "exporter": { + "properties": { + "address": { + "ignore_above": 1024, + "type": "keyword" + }, + "source_id": { + "type": "long" + }, + "timestamp": { + "type": "date" + }, + "uptime_millis": { + "type": "long" + }, + "version": { + "type": "long" + } + } + }, + "exporter_certificate": { + "type": "short" + }, + "exporter_ipv4_address": { + "type": "ip" + }, + "exporter_ipv6_address": { + "type": "ip" + }, + "exporter_transport_port": { + "type": "long" + }, + "exporting_process_id": { + "type": "long" + }, + "external_address_realm": { + "type": "short" + }, + "firewall_event": { + "type": "short" + }, + "flags_and_sampler_id": { + "type": "long" + }, + "flow_active_timeout": { + "type": "long" + }, + "flow_direction": { + "type": "short" + }, + "flow_duration_microseconds": { + "type": "long" + }, + "flow_duration_milliseconds": { + "type": "long" + }, + "flow_end_delta_microseconds": { + "type": "long" + }, + "flow_end_microseconds": { + "type": "date" + }, + "flow_end_milliseconds": { + "type": "date" + }, + "flow_end_nanoseconds": { + "type": "date" + }, + "flow_end_reason": { + "type": "short" + }, + "flow_end_seconds": { + "type": "date" + }, + "flow_end_sys_up_time": { + "type": "long" + }, + "flow_id": { + "type": "long" + }, + "flow_idle_timeout": { + "type": "long" + }, + "flow_key_indicator": { + "type": "long" + }, + "flow_label_ipv6": { + "type": "long" + }, + "flow_sampling_time_interval": { + "type": "long" + }, + "flow_sampling_time_spacing": { + "type": "long" + }, + "flow_selected_flow_delta_count": { + "type": "long" + }, + "flow_selected_octet_delta_count": { + "type": "long" + }, + "flow_selected_packet_delta_count": { + "type": "long" + }, + "flow_selector_algorithm": { + "type": "long" + }, + "flow_start_delta_microseconds": { + "type": "long" + }, + "flow_start_microseconds": { + "type": "date" + }, + "flow_start_milliseconds": { + "type": "date" + }, + "flow_start_nanoseconds": { + "type": "date" + }, + "flow_start_seconds": { + "type": "date" + }, + "flow_start_sys_up_time": { + "type": "long" + }, + "forwarding_status": { + "type": "short" + }, + "fragment_flags": { + "type": "short" + }, + "fragment_identification": { + "type": "long" + }, + "fragment_offset": { + "type": "long" + }, + "global_address_mapping_high_threshold": { + "type": "long" + }, + "gre_key": { + "type": "long" + }, + "hash_digest_output": { + "type": "boolean" + }, + "hash_flow_domain": { + "type": "long" + }, + "hash_initialiser_value": { + "type": "long" + }, + "hash_ipp_ayload_offset": { + "type": "long" + }, + "hash_ipp_ayload_size": { + "type": "long" + }, + "hash_output_range_max": { + "type": "long" + }, + "hash_output_range_min": { + "type": "long" + }, + "hash_selected_range_max": { + "type": "long" + }, + "hash_selected_range_min": { + "type": "long" + }, + "http_content_type": { + "ignore_above": 1024, + "type": "keyword" + }, + "http_message_version": { + "ignore_above": 1024, + "type": "keyword" + }, + "http_reason_phrase": { + "ignore_above": 1024, + "type": "keyword" + }, + "http_request_host": { + "ignore_above": 1024, + "type": "keyword" + }, + "http_request_method": { + "ignore_above": 1024, + "type": "keyword" + }, + "http_request_target": { + "ignore_above": 1024, + "type": "keyword" + }, + "http_status_code": { + "type": "long" + }, + "http_user_agent": { + "ignore_above": 1024, + "type": "keyword" + }, + "icmp_code_ipv4": { + "type": "short" + }, + "icmp_code_ipv6": { + "type": "short" + }, + "icmp_type_code_ipv4": { + "type": "long" + }, + "icmp_type_code_ipv6": { + "type": "long" + }, + "icmp_type_ipv4": { + "type": "short" + }, + "icmp_type_ipv6": { + "type": "short" + }, + "igmp_type": { + "type": "short" + }, + "ignored_data_record_total_count": { + "type": "long" + }, + "ignored_layer2_frame_total_count": { + "type": "long" + }, + "ignored_layer2_octet_total_count": { + "type": "long" + }, + "ignored_octet_total_count": { + "type": "long" + }, + "ignored_packet_total_count": { + "type": "long" + }, + "information_element_data_type": { + "type": "short" + }, + "information_element_description": { + "ignore_above": 1024, + "type": "keyword" + }, + "information_element_id": { + "type": "long" + }, + "information_element_index": { + "type": "long" + }, + "information_element_name": { + "ignore_above": 1024, + "type": "keyword" + }, + "information_element_range_begin": { + "type": "long" + }, + "information_element_range_end": { + "type": "long" + }, + "information_element_semantics": { + "type": "short" + }, + "information_element_units": { + "type": "long" + }, + "ingress_broadcast_packet_total_count": { + "type": "long" + }, + "ingress_interface": { + "type": "long" + }, + "ingress_interface_type": { + "type": "long" + }, + "ingress_multicast_packet_total_count": { + "type": "long" + }, + "ingress_physical_interface": { + "type": "long" + }, + "ingress_unicast_packet_total_count": { + "type": "long" + }, + "ingress_vrfid": { + "type": "long" + }, + "initiator_octets": { + "type": "long" + }, + "initiator_packets": { + "type": "long" + }, + "interface_description": { + "ignore_above": 1024, + "type": "keyword" + }, + "interface_name": { + "ignore_above": 1024, + "type": "keyword" + }, + "intermediate_process_id": { + "type": "long" + }, + "internal_address_realm": { + "type": "short" + }, + "ip_class_of_service": { + "type": "short" + }, + "ip_diff_serv_code_point": { + "type": "short" + }, + "ip_header_length": { + "type": "short" + }, + "ip_header_packet_section": { + "type": "short" + }, + "ip_next_hop_ipv4_address": { + "type": "ip" + }, + "ip_next_hop_ipv6_address": { + "type": "ip" + }, + "ip_payload_length": { + "type": "long" + }, + "ip_payload_packet_section": { + "type": "short" + }, + "ip_precedence": { + "type": "short" + }, + "ip_sec_spi": { + "type": "long" + }, + "ip_total_length": { + "type": "long" + }, + "ip_ttl": { + "type": "short" + }, + "ip_version": { + "type": "short" + }, + "ipv4_ihl": { + "type": "short" + }, + "ipv4_options": { + "type": "long" + }, + "ipv4_router_sc": { + "type": "ip" + }, + "ipv6_extension_headers": { + "type": "long" + }, + "is_multicast": { + "type": "short" + }, + "layer2_frame_delta_count": { + "type": "long" + }, + "layer2_frame_total_count": { + "type": "long" + }, + "layer2_octet_delta_count": { + "type": "long" + }, + "layer2_octet_delta_sum_of_squares": { + "type": "long" + }, + "layer2_octet_total_count": { + "type": "long" + }, + "layer2_octet_total_sum_of_squares": { + "type": "long" + }, + "layer2_segment_id": { + "type": "long" + }, + "layer2packet_section_data": { + "type": "short" + }, + "layer2packet_section_offset": { + "type": "long" + }, + "layer2packet_section_size": { + "type": "long" + }, + "line_card_id": { + "type": "long" + }, + "lower_cli_imit": { + "type": "double" + }, + "max_bieb_ntries": { + "type": "long" + }, + "max_entries_per_user": { + "type": "long" + }, + "max_export_seconds": { + "type": "date" + }, + "max_flow_end_microseconds": { + "type": "date" + }, + "max_flow_end_milliseconds": { + "type": "date" + }, + "max_flow_end_nanoseconds": { + "type": "date" + }, + "max_flow_end_seconds": { + "type": "date" + }, + "max_fragments_pending_reassembly": { + "type": "long" + }, + "max_session_entries": { + "type": "long" + }, + "max_subscribers": { + "type": "long" + }, + "maximum_ip_total_length": { + "type": "long" + }, + "maximum_layer2_total_length": { + "type": "long" + }, + "maximum_ttl": { + "type": "short" + }, + "message_md5_checksum": { + "type": "short" + }, + "message_scope": { + "type": "short" + }, + "metering_process_id": { + "type": "long" + }, + "metro_evc_id": { + "ignore_above": 1024, + "type": "keyword" + }, + "metro_evc_type": { + "type": "short" + }, + "mib_capture_time_semantics": { + "type": "short" + }, + "mib_context_engine_id": { + "type": "short" + }, + "mib_context_name": { + "ignore_above": 1024, + "type": "keyword" + }, + "mib_index_indicator": { + "type": "long" + }, + "mib_module_name": { + "ignore_above": 1024, + "type": "keyword" + }, + "mib_object_description": { + "ignore_above": 1024, + "type": "keyword" + }, + "mib_object_identifier": { + "type": "short" + }, + "mib_object_name": { + "ignore_above": 1024, + "type": "keyword" + }, + "mib_object_syntax": { + "ignore_above": 1024, + "type": "keyword" + }, + "mib_object_value_bits": { + "type": "short" + }, + "mib_object_value_counter": { + "type": "long" + }, + "mib_object_value_gauge": { + "type": "long" + }, + "mib_object_value_integer": { + "type": "long" + }, + "mib_object_value_octet_string": { + "type": "short" + }, + "mib_object_value_oid": { + "type": "short" + }, + "mib_object_value_time_ticks": { + "type": "long" + }, + "mib_object_value_unsigned": { + "type": "long" + }, + "mib_object_valuei_pa_ddress": { + "type": "ip" + }, + "mib_sub_identifier": { + "type": "long" + }, + "min_export_seconds": { + "type": "date" + }, + "min_flow_start_microseconds": { + "type": "date" + }, + "min_flow_start_milliseconds": { + "type": "date" + }, + "min_flow_start_nanoseconds": { + "type": "date" + }, + "min_flow_start_seconds": { + "type": "date" + }, + "minimum_ip_total_length": { + "type": "long" + }, + "minimum_layer2_total_length": { + "type": "long" + }, + "minimum_ttl": { + "type": "short" + }, + "mobile_imsi": { + "ignore_above": 1024, + "type": "keyword" + }, + "mobile_msisdn": { + "ignore_above": 1024, + "type": "keyword" + }, + "monitoring_interval_end_milli_seconds": { + "type": "date" + }, + "monitoring_interval_start_milli_seconds": { + "type": "date" + }, + "mpls_label_stack_depth": { + "type": "long" + }, + "mpls_label_stack_length": { + "type": "long" + }, + "mpls_label_stack_section": { + "type": "short" + }, + "mpls_label_stack_section10": { + "type": "short" + }, + "mpls_label_stack_section2": { + "type": "short" + }, + "mpls_label_stack_section3": { + "type": "short" + }, + "mpls_label_stack_section4": { + "type": "short" + }, + "mpls_label_stack_section5": { + "type": "short" + }, + "mpls_label_stack_section6": { + "type": "short" + }, + "mpls_label_stack_section7": { + "type": "short" + }, + "mpls_label_stack_section8": { + "type": "short" + }, + "mpls_label_stack_section9": { + "type": "short" + }, + "mpls_payload_length": { + "type": "long" + }, + "mpls_payload_packet_section": { + "type": "short" + }, + "mpls_top_label_exp": { + "type": "short" + }, + "mpls_top_label_ipv4_address": { + "type": "ip" + }, + "mpls_top_label_ipv6_address": { + "type": "ip" + }, + "mpls_top_label_prefix_length": { + "type": "short" + }, + "mpls_top_label_stack_section": { + "type": "short" + }, + "mpls_top_label_ttl": { + "type": "short" + }, + "mpls_top_label_type": { + "type": "short" + }, + "mpls_vpn_route_distinguisher": { + "type": "short" + }, + "multicast_replication_factor": { + "type": "long" + }, + "nat_event": { + "type": "short" + }, + "nat_instance_id": { + "type": "long" + }, + "nat_originating_address_realm": { + "type": "short" + }, + "nat_pool_id": { + "type": "long" + }, + "nat_pool_name": { + "ignore_above": 1024, + "type": "keyword" + }, + "nat_quota_exceeded_event": { + "type": "long" + }, + "nat_threshold_event": { + "type": "long" + }, + "nat_type": { + "type": "short" + }, + "new_connection_delta_count": { + "type": "long" + }, + "next_header_ipv6": { + "type": "short" + }, + "not_sent_flow_total_count": { + "type": "long" + }, + "not_sent_layer2_octet_total_count": { + "type": "long" + }, + "not_sent_octet_total_count": { + "type": "long" + }, + "not_sent_packet_total_count": { + "type": "long" + }, + "observation_domain_id": { + "type": "long" + }, + "observation_domain_name": { + "ignore_above": 1024, + "type": "keyword" + }, + "observation_point_id": { + "type": "long" + }, + "observation_point_type": { + "type": "short" + }, + "observation_time_microseconds": { + "type": "date" + }, + "observation_time_milliseconds": { + "type": "date" + }, + "observation_time_nanoseconds": { + "type": "date" + }, + "observation_time_seconds": { + "type": "date" + }, + "observed_flow_total_count": { + "type": "long" + }, + "octet_delta_count": { + "type": "long" + }, + "octet_delta_sum_of_squares": { + "type": "long" + }, + "octet_total_count": { + "type": "long" + }, + "octet_total_sum_of_squares": { + "type": "long" + }, + "opaque_octets": { + "type": "short" + }, + "original_exporter_ipv4_address": { + "type": "ip" + }, + "original_exporter_ipv6_address": { + "type": "ip" + }, + "original_flows_completed": { + "type": "long" + }, + "original_flows_initiated": { + "type": "long" + }, + "original_flows_present": { + "type": "long" + }, + "original_observation_domain_id": { + "type": "long" + }, + "p2p_technology": { + "ignore_above": 1024, + "type": "keyword" + }, + "packet_delta_count": { + "type": "long" + }, + "packet_total_count": { + "type": "long" + }, + "padding_octets": { + "type": "short" + }, + "payload_length_ipv6": { + "type": "long" + }, + "port_id": { + "type": "long" + }, + "port_range_end": { + "type": "long" + }, + "port_range_num_ports": { + "type": "long" + }, + "port_range_start": { + "type": "long" + }, + "port_range_step_size": { + "type": "long" + }, + "post_destination_mac_address": { + "ignore_above": 1024, + "type": "keyword" + }, + "post_dot1q_customer_vlan_id": { + "type": "long" + }, + "post_dot1q_vlan_id": { + "type": "long" + }, + "post_ip_class_of_service": { + "type": "short" + }, + "post_ip_diff_serv_code_point": { + "type": "short" + }, + "post_ip_precedence": { + "type": "short" + }, + "post_layer2_octet_delta_count": { + "type": "long" + }, + "post_layer2_octet_total_count": { + "type": "long" + }, + "post_mcast_layer2_octet_delta_count": { + "type": "long" + }, + "post_mcast_layer2_octet_total_count": { + "type": "long" + }, + "post_mcast_octet_delta_count": { + "type": "long" + }, + "post_mcast_octet_total_count": { + "type": "long" + }, + "post_mcast_packet_delta_count": { + "type": "long" + }, + "post_mcast_packet_total_count": { + "type": "long" + }, + "post_mpls_top_label_exp": { + "type": "short" + }, + "post_nadt_estination_ipv4_address": { + "type": "ip" + }, + "post_nadt_estination_ipv6_address": { + "type": "ip" + }, + "post_napdt_estination_transport_port": { + "type": "long" + }, + "post_napst_ource_transport_port": { + "type": "long" + }, + "post_nast_ource_ipv4_address": { + "type": "ip" + }, + "post_nast_ource_ipv6_address": { + "type": "ip" + }, + "post_octet_delta_count": { + "type": "long" + }, + "post_octet_total_count": { + "type": "long" + }, + "post_packet_delta_count": { + "type": "long" + }, + "post_packet_total_count": { + "type": "long" + }, + "post_source_mac_address": { + "ignore_above": 1024, + "type": "keyword" + }, + "post_vlan_id": { + "type": "long" + }, + "private_enterprise_number": { + "type": "long" + }, + "protocol_identifier": { + "type": "short" + }, + "pseudo_wire_control_word": { + "type": "long" + }, + "pseudo_wire_destination_ipv4_address": { + "type": "ip" + }, + "pseudo_wire_id": { + "type": "long" + }, + "pseudo_wire_type": { + "type": "long" + }, + "relative_error": { + "type": "double" + }, + "responder_octets": { + "type": "long" + }, + "responder_packets": { + "type": "long" + }, + "rfc3550_jitter_microseconds": { + "type": "long" + }, + "rfc3550_jitter_milliseconds": { + "type": "long" + }, + "rfc3550_jitter_nanoseconds": { + "type": "long" + }, + "rtp_sequence_number": { + "type": "long" + }, + "sampler_id": { + "type": "short" + }, + "sampler_mode": { + "type": "short" + }, + "sampler_name": { + "ignore_above": 1024, + "type": "keyword" + }, + "sampler_random_interval": { + "type": "long" + }, + "sampling_algorithm": { + "type": "short" + }, + "sampling_flow_interval": { + "type": "long" + }, + "sampling_flow_spacing": { + "type": "long" + }, + "sampling_interval": { + "type": "long" + }, + "sampling_packet_interval": { + "type": "long" + }, + "sampling_packet_space": { + "type": "long" + }, + "sampling_population": { + "type": "long" + }, + "sampling_probability": { + "type": "double" + }, + "sampling_size": { + "type": "long" + }, + "sampling_time_interval": { + "type": "long" + }, + "sampling_time_space": { + "type": "long" + }, + "section_exported_octets": { + "type": "long" + }, + "section_offset": { + "type": "long" + }, + "selection_sequence_id": { + "type": "long" + }, + "selector_algorithm": { + "type": "long" + }, + "selector_id": { + "type": "long" + }, + "selector_id_total_pkts_observed": { + "type": "long" + }, + "selector_id_total_pkts_selected": { + "type": "long" + }, + "selector_itd_otal_flows_observed": { + "type": "long" + }, + "selector_itd_otal_flows_selected": { + "type": "long" + }, + "selector_name": { + "ignore_above": 1024, + "type": "keyword" + }, + "session_scope": { + "type": "short" + }, + "source_ipv4_address": { + "type": "ip" + }, + "source_ipv4_prefix": { + "type": "ip" + }, + "source_ipv4_prefix_length": { + "type": "short" + }, + "source_ipv6_address": { + "type": "ip" + }, + "source_ipv6_prefix": { + "type": "ip" + }, + "source_ipv6_prefix_length": { + "type": "short" + }, + "source_mac_address": { + "ignore_above": 1024, + "type": "keyword" + }, + "source_transport_port": { + "type": "long" + }, + "source_transport_ports_limit": { + "type": "long" + }, + "src_traffic_index": { + "type": "long" + }, + "sta_ipv4_address": { + "type": "ip" + }, + "sta_mac_address": { + "ignore_above": 1024, + "type": "keyword" + }, + "system_init_time_milliseconds": { + "type": "date" + }, + "tcp_ack_total_count": { + "type": "long" + }, + "tcp_acknowledgement_number": { + "type": "long" + }, + "tcp_control_bits": { + "type": "long" + }, + "tcp_destination_port": { + "type": "long" + }, + "tcp_fin_total_count": { + "type": "long" + }, + "tcp_header_length": { + "type": "short" + }, + "tcp_options": { + "type": "long" + }, + "tcp_psh_total_count": { + "type": "long" + }, + "tcp_rst_total_count": { + "type": "long" + }, + "tcp_sequence_number": { + "type": "long" + }, + "tcp_source_port": { + "type": "long" + }, + "tcp_syn_total_count": { + "type": "long" + }, + "tcp_urg_total_count": { + "type": "long" + }, + "tcp_urgent_pointer": { + "type": "long" + }, + "tcp_window_scale": { + "type": "long" + }, + "tcp_window_size": { + "type": "long" + }, + "template_id": { + "type": "long" + }, + "total_length_ipv4": { + "type": "long" + }, + "transport_octet_delta_count": { + "type": "long" + }, + "transport_packet_delta_count": { + "type": "long" + }, + "tunnel_technology": { + "ignore_above": 1024, + "type": "keyword" + }, + "type": { + "ignore_above": 1024, + "type": "keyword" + }, + "udp_destination_port": { + "type": "long" + }, + "udp_message_length": { + "type": "long" + }, + "udp_source_port": { + "type": "long" + }, + "upper_cli_imit": { + "type": "double" + }, + "user_name": { + "ignore_above": 1024, + "type": "keyword" + }, + "value_distribution_method": { + "type": "short" + }, + "virtual_station_interface_id": { + "type": "short" + }, + "virtual_station_interface_name": { + "ignore_above": 1024, + "type": "keyword" + }, + "virtual_station_name": { + "ignore_above": 1024, + "type": "keyword" + }, + "virtual_station_uuid": { + "type": "short" + }, + "vlan_id": { + "type": "long" + }, + "vpn_identifier": { + "type": "short" + }, + "vr_fname": { + "ignore_above": 1024, + "type": "keyword" + }, + "wlan_channel_id": { + "type": "short" + }, + "wlan_ssid": { + "ignore_above": 1024, + "type": "keyword" + }, + "wtp_mac_address": { + "ignore_above": 1024, + "type": "keyword" + } + } + }, + "network": { + "properties": { + "application": { + "ignore_above": 1024, + "type": "keyword" + }, + "bytes": { + "type": "long" + }, + "community_id": { + "ignore_above": 1024, + "type": "keyword" + }, + "direction": { + "ignore_above": 1024, + "type": "keyword" + }, + "forwarded_ip": { + "type": "ip" + }, + "iana_number": { + "ignore_above": 1024, + "type": "keyword" + }, + "name": { + "ignore_above": 1024, + "type": "keyword" + }, + "packets": { + "type": "long" + }, + "protocol": { + "ignore_above": 1024, + "type": "keyword" + }, + "transport": { + "ignore_above": 1024, + "type": "keyword" + }, + "type": { + "ignore_above": 1024, + "type": "keyword" + } + } + }, + "nginx": { + "properties": { + "access": { + "properties": { + "geoip": { + "type": "object" + }, + "user_agent": { + "type": "object" + } + } + }, + "error": { + "properties": { + "connection_id": { + "type": "long" + } + } + } + } + }, + "observer": { + "properties": { + "geo": { + "properties": { + "city_name": { + "ignore_above": 1024, + "type": "keyword" + }, + "continent_name": { + "ignore_above": 1024, + "type": "keyword" + }, + "country_iso_code": { + "ignore_above": 1024, + "type": "keyword" + }, + "country_name": { + "ignore_above": 1024, + "type": "keyword" + }, + "location": { + "type": "geo_point" + }, + "name": { + "ignore_above": 1024, + "type": "keyword" + }, + "region_iso_code": { + "ignore_above": 1024, + "type": "keyword" + }, + "region_name": { + "ignore_above": 1024, + "type": "keyword" + } + } + }, + "hostname": { + "ignore_above": 1024, + "type": "keyword" + }, + "ip": { + "type": "ip" + }, + "mac": { + "ignore_above": 1024, + "type": "keyword" + }, + "os": { + "properties": { + "family": { + "ignore_above": 1024, + "type": "keyword" + }, + "full": { + "ignore_above": 1024, + "type": "keyword" + }, + "kernel": { + "ignore_above": 1024, + "type": "keyword" + }, + "name": { + "ignore_above": 1024, + "type": "keyword" + }, + "platform": { + "ignore_above": 1024, + "type": "keyword" + }, + "version": { + "ignore_above": 1024, + "type": "keyword" + } + } + }, + "serial_number": { + "ignore_above": 1024, + "type": "keyword" + }, + "type": { + "ignore_above": 1024, + "type": "keyword" + }, + "vendor": { + "ignore_above": 1024, + "type": "keyword" + }, + "version": { + "ignore_above": 1024, + "type": "keyword" + } + } + }, + "organization": { + "properties": { + "id": { + "ignore_above": 1024, + "type": "keyword" + }, + "name": { + "ignore_above": 1024, + "type": "keyword" + } + } + }, + "os": { + "properties": { + "family": { + "ignore_above": 1024, + "type": "keyword" + }, + "full": { + "ignore_above": 1024, + "type": "keyword" + }, + "kernel": { + "ignore_above": 1024, + "type": "keyword" + }, + "name": { + "ignore_above": 1024, + "type": "keyword" + }, + "platform": { + "ignore_above": 1024, + "type": "keyword" + }, + "version": { + "ignore_above": 1024, + "type": "keyword" + } + } + }, + "osquery": { + "properties": { + "result": { + "properties": { + "action": { + "ignore_above": 1024, + "type": "keyword" + }, + "calendar_time": { + "ignore_above": 1024, + "type": "keyword" + }, + "host_identifier": { + "ignore_above": 1024, + "type": "keyword" + }, + "name": { + "ignore_above": 1024, + "type": "keyword" + }, + "unix_time": { + "type": "long" + } + } + } + } + }, + "postgresql": { + "properties": { + "log": { + "properties": { + "core_id": { + "type": "long" + }, + "database": { + "ignore_above": 1024, + "type": "keyword" + }, + "query": { + "ignore_above": 1024, + "type": "keyword" + }, + "timestamp": { + "ignore_above": 1024, + "type": "keyword" + } + } + } + } + }, + "process": { + "properties": { + "args": { + "ignore_above": 1024, + "type": "keyword" + }, + "executable": { + "ignore_above": 1024, + "type": "keyword" + }, + "name": { + "ignore_above": 1024, + "type": "keyword" + }, + "pid": { + "type": "long" + }, + "ppid": { + "type": "long" + }, + "program": { + "ignore_above": 1024, + "type": "keyword" + }, + "start": { + "type": "date" + }, + "thread": { + "properties": { + "id": { + "type": "long" + } + } + }, + "title": { + "ignore_above": 1024, + "type": "keyword" + }, + "working_directory": { + "ignore_above": 1024, + "type": "keyword" + } + } + }, + "redis": { + "properties": { + "log": { + "properties": { + "role": { + "ignore_above": 1024, + "type": "keyword" + } + } + }, + "slowlog": { + "properties": { + "args": { + "ignore_above": 1024, + "type": "keyword" + }, + "cmd": { + "ignore_above": 1024, + "type": "keyword" + }, + "duration": { + "properties": { + "us": { + "type": "long" + } + } + }, + "id": { + "type": "long" + }, + "key": { + "ignore_above": 1024, + "type": "keyword" + } + } + } + } + }, + "related": { + "properties": { + "ip": { + "type": "ip" + } + } + }, + "santa": { + "properties": { + "action": { + "ignore_above": 1024, + "type": "keyword" + }, + "decision": { + "ignore_above": 1024, + "type": "keyword" + }, + "disk": { + "properties": { + "bsdname": { + "ignore_above": 1024, + "type": "keyword" + }, + "bus": { + "ignore_above": 1024, + "type": "keyword" + }, + "fs": { + "ignore_above": 1024, + "type": "keyword" + }, + "model": { + "ignore_above": 1024, + "type": "keyword" + }, + "mount": { + "ignore_above": 1024, + "type": "keyword" + }, + "serial": { + "ignore_above": 1024, + "type": "keyword" + }, + "volume": { + "ignore_above": 1024, + "type": "keyword" + } + } + }, + "mode": { + "ignore_above": 1024, + "type": "keyword" + }, + "reason": { + "ignore_above": 1024, + "type": "keyword" + } + } + }, + "server": { + "properties": { + "address": { + "ignore_above": 1024, + "type": "keyword" + }, + "bytes": { + "type": "long" + }, + "domain": { + "ignore_above": 1024, + "type": "keyword" + }, + "geo": { + "properties": { + "city_name": { + "ignore_above": 1024, + "type": "keyword" + }, + "continent_name": { + "ignore_above": 1024, + "type": "keyword" + }, + "country_iso_code": { + "ignore_above": 1024, + "type": "keyword" + }, + "country_name": { + "ignore_above": 1024, + "type": "keyword" + }, + "location": { + "type": "geo_point" + }, + "name": { + "ignore_above": 1024, + "type": "keyword" + }, + "region_iso_code": { + "ignore_above": 1024, + "type": "keyword" + }, + "region_name": { + "ignore_above": 1024, + "type": "keyword" + } + } + }, + "ip": { + "type": "ip" + }, + "mac": { + "ignore_above": 1024, + "type": "keyword" + }, + "packets": { + "type": "long" + }, + "port": { + "type": "long" + } + } + }, + "service": { + "properties": { + "ephemeral_id": { + "ignore_above": 1024, + "type": "keyword" + }, + "id": { + "ignore_above": 1024, + "type": "keyword" + }, + "name": { + "ignore_above": 1024, + "type": "keyword" + }, + "state": { + "ignore_above": 1024, + "type": "keyword" + }, + "type": { + "ignore_above": 1024, + "type": "keyword" + }, + "version": { + "ignore_above": 1024, + "type": "keyword" + } + } + }, + "source": { + "properties": { + "address": { + "ignore_above": 1024, + "type": "keyword" + }, + "as": { + "properties": { + "num": { + "type": "long" + }, + "org": { + "ignore_above": 1024, + "type": "keyword" + } + } + }, + "bytes": { + "type": "long" + }, + "domain": { + "ignore_above": 1024, + "type": "keyword" + }, + "domain_top1m_rank": { + "type": "long" + }, + "geo": { + "properties": { + "city_name": { + "ignore_above": 1024, + "type": "keyword" + }, + "continent_name": { + "ignore_above": 1024, + "type": "keyword" + }, + "country_iso_code": { + "ignore_above": 1024, + "type": "keyword" + }, + "country_name": { + "ignore_above": 1024, + "type": "keyword" + }, + "location": { + "type": "geo_point" + }, + "name": { + "ignore_above": 1024, + "type": "keyword" + }, + "region_iso_code": { + "ignore_above": 1024, + "type": "keyword" + }, + "region_name": { + "ignore_above": 1024, + "type": "keyword" + } + } + }, + "ip": { + "type": "ip" + }, + "locality": { + "ignore_above": 1024, + "type": "keyword" + }, + "mac": { + "ignore_above": 1024, + "type": "keyword" + }, + "packets": { + "type": "long" + }, + "port": { + "type": "long" + } + } + }, + "stream": { + "ignore_above": 1024, + "type": "keyword" + }, + "suricata": { + "properties": { + "eve": { + "properties": { + "alert": { + "properties": { + "action": { + "path": "event.outcome", + "type": "alias" + }, + "category": { + "ignore_above": 1024, + "type": "keyword" + }, + "gid": { + "type": "long" + }, + "rev": { + "type": "long" + }, + "severity": { + "path": "event.severity", + "type": "alias" + }, + "signature": { + "ignore_above": 1024, + "type": "keyword" + }, + "signature_id": { + "type": "long" + } + } + }, + "app_proto": { + "path": "network.protocol", + "type": "alias" + }, + "app_proto_expected": { + "ignore_above": 1024, + "type": "keyword" + }, + "app_proto_orig": { + "ignore_above": 1024, + "type": "keyword" + }, + "app_proto_tc": { + "ignore_above": 1024, + "type": "keyword" + }, + "app_proto_ts": { + "ignore_above": 1024, + "type": "keyword" + }, + "dest_ip": { + "path": "destination.ip", + "type": "alias" + }, + "dest_port": { + "path": "destination.port", + "type": "alias" + }, + "dns": { + "properties": { + "id": { + "type": "long" + }, + "rcode": { + "ignore_above": 1024, + "type": "keyword" + }, + "rdata": { + "ignore_above": 1024, + "type": "keyword" + }, + "rrname": { + "ignore_above": 1024, + "type": "keyword" + }, + "rrtype": { + "ignore_above": 1024, + "type": "keyword" + }, + "ttl": { + "type": "long" + }, + "tx_id": { + "type": "long" + }, + "type": { + "ignore_above": 1024, + "type": "keyword" + } + } + }, + "email": { + "properties": { + "status": { + "ignore_above": 1024, + "type": "keyword" + } + } + }, + "event_type": { + "ignore_above": 1024, + "type": "keyword" + }, + "fileinfo": { + "properties": { + "filename": { + "path": "file.path", + "type": "alias" + }, + "gaps": { + "type": "boolean" + }, + "md5": { + "ignore_above": 1024, + "type": "keyword" + }, + "sha1": { + "ignore_above": 1024, + "type": "keyword" + }, + "sha256": { + "ignore_above": 1024, + "type": "keyword" + }, + "size": { + "path": "file.size", + "type": "alias" + }, + "state": { + "ignore_above": 1024, + "type": "keyword" + }, + "stored": { + "type": "boolean" + }, + "tx_id": { + "type": "long" + } + } + }, + "flags": { + "type": "object" + }, + "flow": { + "properties": { + "age": { + "type": "long" + }, + "alerted": { + "type": "boolean" + }, + "bytes_toclient": { + "path": "destination.bytes", + "type": "alias" + }, + "bytes_toserver": { + "path": "source.bytes", + "type": "alias" + }, + "end": { + "type": "date" + }, + "pkts_toclient": { + "path": "destination.packets", + "type": "alias" + }, + "pkts_toserver": { + "path": "source.packets", + "type": "alias" + }, + "reason": { + "ignore_above": 1024, + "type": "keyword" + }, + "start": { + "path": "event.start", + "type": "alias" + }, + "state": { + "ignore_above": 1024, + "type": "keyword" + } + } + }, + "flow_id": { + "ignore_above": 1024, + "type": "keyword" + }, + "http": { + "properties": { + "hostname": { + "path": "url.domain", + "type": "alias" + }, + "http_content_type": { + "ignore_above": 1024, + "type": "keyword" + }, + "http_method": { + "path": "http.request.method", + "type": "alias" + }, + "http_refer": { + "path": "http.request.referrer", + "type": "alias" + }, + "http_user_agent": { + "path": "user_agent.original", + "type": "alias" + }, + "length": { + "path": "http.response.body.bytes", + "type": "alias" + }, + "protocol": { + "ignore_above": 1024, + "type": "keyword" + }, + "redirect": { + "ignore_above": 1024, + "type": "keyword" + }, + "status": { + "path": "http.response.status_code", + "type": "alias" + }, + "url": { + "path": "url.original", + "type": "alias" + } + } + }, + "icmp_code": { + "type": "long" + }, + "icmp_type": { + "type": "long" + }, + "in_iface": { + "ignore_above": 1024, + "type": "keyword" + }, + "pcap_cnt": { + "type": "long" + }, + "proto": { + "path": "network.transport", + "type": "alias" + }, + "smtp": { + "properties": { + "helo": { + "ignore_above": 1024, + "type": "keyword" + }, + "mail_from": { + "ignore_above": 1024, + "type": "keyword" + }, + "rcpt_to": { + "ignore_above": 1024, + "type": "keyword" + } + } + }, + "src_ip": { + "path": "source.ip", + "type": "alias" + }, + "src_port": { + "path": "source.port", + "type": "alias" + }, + "ssh": { + "properties": { + "client": { + "properties": { + "proto_version": { + "ignore_above": 1024, + "type": "keyword" + }, + "software_version": { + "ignore_above": 1024, + "type": "keyword" + } + } + }, + "server": { + "properties": { + "proto_version": { + "ignore_above": 1024, + "type": "keyword" + }, + "software_version": { + "ignore_above": 1024, + "type": "keyword" + } + } + } + } + }, + "stats": { + "properties": { + "app_layer": { + "properties": { + "flow": { + "properties": { + "dcerpc_tcp": { + "type": "long" + }, + "dcerpc_udp": { + "type": "long" + }, + "dns_tcp": { + "type": "long" + }, + "dns_udp": { + "type": "long" + }, + "failed_tcp": { + "type": "long" + }, + "failed_udp": { + "type": "long" + }, + "ftp": { + "type": "long" + }, + "http": { + "type": "long" + }, + "imap": { + "type": "long" + }, + "msn": { + "type": "long" + }, + "smb": { + "type": "long" + }, + "smtp": { + "type": "long" + }, + "ssh": { + "type": "long" + }, + "tls": { + "type": "long" + } + } + }, + "tx": { + "properties": { + "dcerpc_tcp": { + "type": "long" + }, + "dcerpc_udp": { + "type": "long" + }, + "dns_tcp": { + "type": "long" + }, + "dns_udp": { + "type": "long" + }, + "ftp": { + "type": "long" + }, + "http": { + "type": "long" + }, + "smb": { + "type": "long" + }, + "smtp": { + "type": "long" + }, + "ssh": { + "type": "long" + }, + "tls": { + "type": "long" + } + } + } + } + }, + "capture": { + "properties": { + "kernel_drops": { + "type": "long" + }, + "kernel_ifdrops": { + "type": "long" + }, + "kernel_packets": { + "type": "long" + } + } + }, + "decoder": { + "properties": { + "avg_pkt_size": { + "type": "long" + }, + "bytes": { + "type": "long" + }, + "dce": { + "properties": { + "pkt_too_small": { + "type": "long" + } + } + }, + "erspan": { + "type": "long" + }, + "ethernet": { + "type": "long" + }, + "gre": { + "type": "long" + }, + "icmpv4": { + "type": "long" + }, + "icmpv6": { + "type": "long" + }, + "ieee8021ah": { + "type": "long" + }, + "invalid": { + "type": "long" + }, + "ipraw": { + "properties": { + "invalid_ip_version": { + "type": "long" + } + } + }, + "ipv4": { + "type": "long" + }, + "ipv4_in_ipv6": { + "type": "long" + }, + "ipv6": { + "type": "long" + }, + "ipv6_in_ipv6": { + "type": "long" + }, + "ltnull": { + "properties": { + "pkt_too_small": { + "type": "long" + }, + "unsupported_type": { + "type": "long" + } + } + }, + "max_pkt_size": { + "type": "long" + }, + "mpls": { + "type": "long" + }, + "null": { + "type": "long" + }, + "pkts": { + "type": "long" + }, + "ppp": { + "type": "long" + }, + "pppoe": { + "type": "long" + }, + "raw": { + "type": "long" + }, + "sctp": { + "type": "long" + }, + "sll": { + "type": "long" + }, + "tcp": { + "type": "long" + }, + "teredo": { + "type": "long" + }, + "udp": { + "type": "long" + }, + "vlan": { + "type": "long" + }, + "vlan_qinq": { + "type": "long" + } + } + }, + "defrag": { + "properties": { + "ipv4": { + "properties": { + "fragments": { + "type": "long" + }, + "reassembled": { + "type": "long" + }, + "timeouts": { + "type": "long" + } + } + }, + "ipv6": { + "properties": { + "fragments": { + "type": "long" + }, + "reassembled": { + "type": "long" + }, + "timeouts": { + "type": "long" + } + } + }, + "max_frag_hits": { + "type": "long" + } + } + }, + "detect": { + "properties": { + "alert": { + "type": "long" + } + } + }, + "dns": { + "properties": { + "memcap_global": { + "type": "long" + }, + "memcap_state": { + "type": "long" + }, + "memuse": { + "type": "long" + } + } + }, + "file_store": { + "properties": { + "open_files": { + "type": "long" + } + } + }, + "flow": { + "properties": { + "emerg_mode_entered": { + "type": "long" + }, + "emerg_mode_over": { + "type": "long" + }, + "icmpv4": { + "type": "long" + }, + "icmpv6": { + "type": "long" + }, + "memcap": { + "type": "long" + }, + "memuse": { + "type": "long" + }, + "spare": { + "type": "long" + }, + "tcp": { + "type": "long" + }, + "tcp_reuse": { + "type": "long" + }, + "udp": { + "type": "long" + } + } + }, + "flow_mgr": { + "properties": { + "bypassed_pruned": { + "type": "long" + }, + "closed_pruned": { + "type": "long" + }, + "est_pruned": { + "type": "long" + }, + "flows_checked": { + "type": "long" + }, + "flows_notimeout": { + "type": "long" + }, + "flows_removed": { + "type": "long" + }, + "flows_timeout": { + "type": "long" + }, + "flows_timeout_inuse": { + "type": "long" + }, + "new_pruned": { + "type": "long" + }, + "rows_busy": { + "type": "long" + }, + "rows_checked": { + "type": "long" + }, + "rows_empty": { + "type": "long" + }, + "rows_maxlen": { + "type": "long" + }, + "rows_skipped": { + "type": "long" + } + } + }, + "http": { + "properties": { + "memcap": { + "type": "long" + }, + "memuse": { + "type": "long" + } + } + }, + "tcp": { + "properties": { + "insert_data_normal_fail": { + "type": "long" + }, + "insert_data_overlap_fail": { + "type": "long" + }, + "insert_list_fail": { + "type": "long" + }, + "invalid_checksum": { + "type": "long" + }, + "memuse": { + "type": "long" + }, + "no_flow": { + "type": "long" + }, + "overlap": { + "type": "long" + }, + "overlap_diff_data": { + "type": "long" + }, + "pseudo": { + "type": "long" + }, + "pseudo_failed": { + "type": "long" + }, + "reassembly_gap": { + "type": "long" + }, + "reassembly_memuse": { + "type": "long" + }, + "rst": { + "type": "long" + }, + "segment_memcap_drop": { + "type": "long" + }, + "sessions": { + "type": "long" + }, + "ssn_memcap_drop": { + "type": "long" + }, + "stream_depth_reached": { + "type": "long" + }, + "syn": { + "type": "long" + }, + "synack": { + "type": "long" + } + } + }, + "uptime": { + "type": "long" + } + } + }, + "tcp": { + "properties": { + "ack": { + "type": "boolean" + }, + "fin": { + "type": "boolean" + }, + "psh": { + "type": "boolean" + }, + "rst": { + "type": "boolean" + }, + "state": { + "ignore_above": 1024, + "type": "keyword" + }, + "syn": { + "type": "boolean" + }, + "tcp_flags": { + "ignore_above": 1024, + "type": "keyword" + }, + "tcp_flags_tc": { + "ignore_above": 1024, + "type": "keyword" + }, + "tcp_flags_ts": { + "ignore_above": 1024, + "type": "keyword" + } + } + }, + "timestamp": { + "path": "@timestamp", + "type": "alias" + }, + "tls": { + "properties": { + "fingerprint": { + "ignore_above": 1024, + "type": "keyword" + }, + "issuerdn": { + "ignore_above": 1024, + "type": "keyword" + }, + "notafter": { + "type": "date" + }, + "notbefore": { + "type": "date" + }, + "serial": { + "ignore_above": 1024, + "type": "keyword" + }, + "session_resumed": { + "type": "boolean" + }, + "sni": { + "ignore_above": 1024, + "type": "keyword" + }, + "subject": { + "ignore_above": 1024, + "type": "keyword" + }, + "version": { + "ignore_above": 1024, + "type": "keyword" + } + } + }, + "tx_id": { + "type": "long" + } + } + } + } + }, + "syslog": { + "properties": { + "facility": { + "type": "long" + }, + "facility_label": { + "ignore_above": 1024, + "type": "keyword" + }, + "priority": { + "type": "long" + }, + "severity_label": { + "ignore_above": 1024, + "type": "keyword" + } + } + }, + "system": { + "properties": { + "auth": { + "properties": { + "groupadd": { + "type": "object" + }, + "ssh": { + "properties": { + "dropped_ip": { + "type": "ip" + }, + "geoip": { + "type": "object" + }, + "method": { + "ignore_above": 1024, + "type": "keyword" + }, + "signature": { + "ignore_above": 1024, + "type": "keyword" + } + } + }, + "sudo": { + "properties": { + "command": { + "ignore_above": 1024, + "type": "keyword" + }, + "error": { + "ignore_above": 1024, + "type": "keyword" + }, + "pwd": { + "ignore_above": 1024, + "type": "keyword" + }, + "tty": { + "ignore_above": 1024, + "type": "keyword" + }, + "user": { + "ignore_above": 1024, + "type": "keyword" + } + } + }, + "useradd": { + "properties": { + "home": { + "ignore_above": 1024, + "type": "keyword" + }, + "shell": { + "ignore_above": 1024, + "type": "keyword" + } + } + } + } + }, + "syslog": { + "type": "object" + } + } + }, + "tags": { + "ignore_above": 1024, + "type": "keyword" + }, + "traefik": { + "properties": { + "access": { + "properties": { + "backend_url": { + "ignore_above": 1024, + "type": "keyword" + }, + "frontend_name": { + "ignore_above": 1024, + "type": "keyword" + }, + "geoip": { + "properties": { + "city_name": { + "path": "source.geo.city_name", + "type": "alias" + }, + "continent_name": { + "path": "source.geo.continent_name", + "type": "alias" + }, + "country_iso_code": { + "path": "source.geo.country_iso_code", + "type": "alias" + }, + "location": { + "path": "source.geo.location", + "type": "alias" + }, + "region_iso_code": { + "path": "source.geo.region_iso_code", + "type": "alias" + }, + "region_name": { + "path": "source.geo.region_name", + "type": "alias" + } + } + }, + "request_count": { + "type": "long" + }, + "user_agent": { + "properties": { + "device": { + "path": "user_agent.device.name", + "type": "alias" + }, + "name": { + "path": "user_agent.name", + "type": "alias" + }, + "original": { + "path": "user_agent.original", + "type": "alias" + }, + "os": { + "path": "user_agent.os.full_name", + "type": "alias" + }, + "os_name": { + "path": "user_agent.os.name", + "type": "alias" + } + } + }, + "user_identifier": { + "ignore_above": 1024, + "type": "keyword" + } + } + } + } + }, + "url": { + "properties": { + "domain": { + "ignore_above": 1024, + "type": "keyword" + }, + "fragment": { + "ignore_above": 1024, + "type": "keyword" + }, + "full": { + "ignore_above": 1024, + "type": "keyword" + }, + "original": { + "ignore_above": 1024, + "type": "keyword" + }, + "password": { + "ignore_above": 1024, + "type": "keyword" + }, + "path": { + "ignore_above": 1024, + "type": "keyword" + }, + "port": { + "type": "long" + }, + "query": { + "ignore_above": 1024, + "type": "keyword" + }, + "scheme": { + "ignore_above": 1024, + "type": "keyword" + }, + "username": { + "ignore_above": 1024, + "type": "keyword" + } + } + }, + "user": { + "properties": { + "audit": { + "properties": { + "group": { + "properties": { + "id": { + "ignore_above": 1024, + "type": "keyword" + }, + "name": { + "ignore_above": 1024, + "type": "keyword" + } + } + }, + "id": { + "ignore_above": 1024, + "type": "keyword" + }, + "name": { + "ignore_above": 1024, + "type": "keyword" + } + } + }, + "effective": { + "properties": { + "group": { + "properties": { + "id": { + "ignore_above": 1024, + "type": "keyword" + }, + "name": { + "ignore_above": 1024, + "type": "keyword" + } + } + }, + "id": { + "ignore_above": 1024, + "type": "keyword" + }, + "name": { + "ignore_above": 1024, + "type": "keyword" + } + } + }, + "email": { + "ignore_above": 1024, + "type": "keyword" + }, + "filesystem": { + "properties": { + "group": { + "properties": { + "id": { + "ignore_above": 1024, + "type": "keyword" + }, + "name": { + "ignore_above": 1024, + "type": "keyword" + } + } + }, + "id": { + "ignore_above": 1024, + "type": "keyword" + }, + "name": { + "ignore_above": 1024, + "type": "keyword" + } + } + }, + "full_name": { + "ignore_above": 1024, + "type": "keyword" + }, + "group": { + "properties": { + "id": { + "ignore_above": 1024, + "type": "keyword" + }, + "name": { + "ignore_above": 1024, + "type": "keyword" + } + } + }, + "hash": { + "ignore_above": 1024, + "type": "keyword" + }, + "id": { + "ignore_above": 1024, + "type": "keyword" + }, + "name": { + "ignore_above": 1024, + "type": "keyword" + }, + "owner": { + "properties": { + "group": { + "properties": { + "id": { + "ignore_above": 1024, + "type": "keyword" + }, + "name": { + "ignore_above": 1024, + "type": "keyword" + } + } + }, + "id": { + "ignore_above": 1024, + "type": "keyword" + }, + "name": { + "ignore_above": 1024, + "type": "keyword" + } + } + }, + "saved": { + "properties": { + "group": { + "properties": { + "id": { + "ignore_above": 1024, + "type": "keyword" + }, + "name": { + "ignore_above": 1024, + "type": "keyword" + } + } + }, + "id": { + "ignore_above": 1024, + "type": "keyword" + }, + "name": { + "ignore_above": 1024, + "type": "keyword" + } + } + }, + "terminal": { + "ignore_above": 1024, + "type": "keyword" + } + } + }, + "user_agent": { + "properties": { + "device": { + "properties": { + "name": { + "ignore_above": 1024, + "type": "keyword" + } + } + }, + "major": { + "ignore_above": 1024, + "type": "keyword" + }, + "minor": { + "ignore_above": 1024, + "type": "keyword" + }, + "name": { + "ignore_above": 1024, + "type": "keyword" + }, + "original": { + "ignore_above": 1024, + "type": "keyword" + }, + "os": { + "properties": { + "family": { + "ignore_above": 1024, + "type": "keyword" + }, + "full": { + "ignore_above": 1024, + "type": "keyword" + }, + "full_name": { + "ignore_above": 1024, + "type": "keyword" + }, + "kernel": { + "ignore_above": 1024, + "type": "keyword" + }, + "major": { + "ignore_above": 1024, + "type": "keyword" + }, + "minor": { + "ignore_above": 1024, + "type": "keyword" + }, + "name": { + "ignore_above": 1024, + "type": "keyword" + }, + "platform": { + "ignore_above": 1024, + "type": "keyword" + }, + "version": { + "ignore_above": 1024, + "type": "keyword" + } + } + }, + "patch": { + "ignore_above": 1024, + "type": "keyword" + }, + "version": { + "ignore_above": 1024, + "type": "keyword" + } + } + }, + "zeek": { + "properties": { + "connection": { + "properties": { + "history": { + "ignore_above": 1024, + "type": "keyword" + }, + "local_orig": { + "type": "boolean" + }, + "local_resp": { + "type": "boolean" + }, + "missed_bytes": { + "type": "long" + }, + "orig_l2_addr": { + "ignore_above": 1024, + "type": "keyword" + }, + "state": { + "ignore_above": 1024, + "type": "keyword" + } + } + }, + "dns": { + "properties": { + "AA": { + "type": "boolean" + }, + "RA": { + "type": "boolean" + }, + "RD": { + "type": "boolean" + }, + "TC": { + "type": "boolean" + }, + "TTLs": { + "type": "double" + }, + "answers": { + "ignore_above": 1024, + "type": "keyword" + }, + "qclass": { + "type": "long" + }, + "qclass_name": { + "ignore_above": 1024, + "type": "keyword" + }, + "qtype": { + "type": "long" + }, + "qtype_name": { + "ignore_above": 1024, + "type": "keyword" + }, + "query": { + "ignore_above": 1024, + "type": "keyword" + }, + "rcode": { + "type": "long" + }, + "rcode_name": { + "ignore_above": 1024, + "type": "keyword" + }, + "rejected": { + "type": "boolean" + }, + "rtt": { + "type": "double" + }, + "saw_query": { + "type": "boolean" + }, + "saw_reply": { + "type": "boolean" + }, + "total_answers": { + "type": "long" + }, + "total_replies": { + "type": "long" + }, + "trans_id": { + "type": "long" + } + } + }, + "files": { + "properties": { + "analyzers": { + "ignore_above": 1024, + "type": "keyword" + }, + "depth": { + "type": "long" + }, + "duration": { + "type": "double" + }, + "entropy": { + "type": "double" + }, + "extracted": { + "ignore_above": 1024, + "type": "keyword" + }, + "extracted_cutoff": { + "type": "boolean" + }, + "extracted_size": { + "type": "long" + }, + "filename": { + "ignore_above": 1024, + "type": "keyword" + }, + "fuid": { + "ignore_above": 1024, + "type": "keyword" + }, + "is_orig": { + "type": "boolean" + }, + "local_orig": { + "type": "boolean" + }, + "md5": { + "ignore_above": 1024, + "type": "keyword" + }, + "mime_type": { + "ignore_above": 1024, + "type": "keyword" + }, + "missing_bytes": { + "type": "long" + }, + "overflow_bytes": { + "type": "long" + }, + "parent_fuid": { + "ignore_above": 1024, + "type": "keyword" + }, + "rx_host": { + "type": "ip" + }, + "seen_bytes": { + "type": "long" + }, + "session_ids": { + "ignore_above": 1024, + "type": "keyword" + }, + "sha1": { + "ignore_above": 1024, + "type": "keyword" + }, + "sha256": { + "ignore_above": 1024, + "type": "keyword" + }, + "source": { + "ignore_above": 1024, + "type": "keyword" + }, + "timedout": { + "type": "boolean" + }, + "total_bytes": { + "type": "long" + }, + "tx_host": { + "type": "ip" + } + } + }, + "http": { + "properties": { + "captured_password": { + "type": "boolean" + }, + "client_header_names": { + "ignore_above": 1024, + "type": "keyword" + }, + "filename": { + "ignore_above": 1024, + "type": "keyword" + }, + "info_code": { + "type": "long" + }, + "info_msg": { + "ignore_above": 1024, + "type": "keyword" + }, + "orig_filenames": { + "ignore_above": 1024, + "type": "keyword" + }, + "orig_fuids": { + "ignore_above": 1024, + "type": "keyword" + }, + "orig_mime_depth": { + "type": "long" + }, + "orig_mime_types": { + "ignore_above": 1024, + "type": "keyword" + }, + "proxied": { + "ignore_above": 1024, + "type": "keyword" + }, + "range_request": { + "type": "boolean" + }, + "resp_filenames": { + "ignore_above": 1024, + "type": "keyword" + }, + "resp_fuids": { + "ignore_above": 1024, + "type": "keyword" + }, + "resp_mime_depth": { + "type": "long" + }, + "resp_mime_types": { + "ignore_above": 1024, + "type": "keyword" + }, + "server_header_names": { + "ignore_above": 1024, + "type": "keyword" + }, + "status_msg": { + "ignore_above": 1024, + "type": "keyword" + }, + "tags": { + "ignore_above": 1024, + "type": "keyword" + }, + "trans_depth": { + "type": "long" + } + } + }, + "inner_vlan": { + "ignore_above": 1024, + "type": "keyword" + }, + "resp_l2_addr": { + "ignore_above": 1024, + "type": "keyword" + }, + "session_id": { + "ignore_above": 1024, + "type": "keyword" + }, + "ssl": { + "properties": { + "cert_chain": { + "ignore_above": 1024, + "type": "keyword" + }, + "cert_chain_fuids": { + "ignore_above": 1024, + "type": "keyword" + }, + "cipher": { + "ignore_above": 1024, + "type": "keyword" + }, + "client_cert_chain": { + "ignore_above": 1024, + "type": "keyword" + }, + "client_cert_chain_fuids": { + "ignore_above": 1024, + "type": "keyword" + }, + "client_issuer": { + "ignore_above": 1024, + "type": "keyword" + }, + "client_subject": { + "ignore_above": 1024, + "type": "keyword" + }, + "curve": { + "ignore_above": 1024, + "type": "keyword" + }, + "established": { + "type": "boolean" + }, + "issuer": { + "ignore_above": 1024, + "type": "keyword" + }, + "last_alert": { + "ignore_above": 1024, + "type": "keyword" + }, + "next_protocol": { + "ignore_above": 1024, + "type": "keyword" + }, + "resumed": { + "type": "boolean" + }, + "server_name": { + "ignore_above": 1024, + "type": "keyword" + }, + "subject": { + "ignore_above": 1024, + "type": "keyword" + }, + "validation_status": { + "ignore_above": 1024, + "type": "keyword" + }, + "version": { + "ignore_above": 1024, + "type": "keyword" + } + } + }, + "vlan": { + "ignore_above": 1024, + "type": "keyword" + } + } + } + } + }, + "settings": { + "index": { + "lifecycle": { + "name": "filebeat-7.0.0", + "rollover_alias": "filebeat-7.0.0" + }, + "mapping": { + "total_fields": { + "limit": "10000" + } + }, + "number_of_replicas": "0", + "number_of_shards": "1", + "query": { + "default_field": [ + "tags", + "message", + "agent.version", + "agent.name", + "agent.type", + "agent.id", + "agent.ephemeral_id", + "client.address", + "client.mac", + "client.domain", + "client.geo.continent_name", + "client.geo.country_name", + "client.geo.region_name", + "client.geo.city_name", + "client.geo.country_iso_code", + "client.geo.region_iso_code", + "client.geo.name", + "cloud.provider", + "cloud.availability_zone", + "cloud.region", + "cloud.instance.id", + "cloud.instance.name", + "cloud.machine.type", + "cloud.account.id", + "container.runtime", + "container.id", + "container.image.name", + "container.image.tag", + "container.name", + "destination.address", + "destination.mac", + "destination.domain", + "destination.geo.continent_name", + "destination.geo.country_name", + "destination.geo.region_name", + "destination.geo.city_name", + "destination.geo.country_iso_code", + "destination.geo.region_iso_code", + "destination.geo.name", + "ecs.version", + "error.id", + "error.message", + "error.code", + "event.id", + "event.kind", + "event.category", + "event.action", + "event.outcome", + "event.type", + "event.module", + "event.dataset", + "event.hash", + "event.timezone", + "file.path", + "file.target_path", + "file.extension", + "file.type", + "file.device", + "file.inode", + "file.uid", + "file.owner", + "file.gid", + "file.group", + "file.mode", + "group.id", + "group.name", + "host.hostname", + "host.name", + "host.id", + "host.mac", + "host.type", + "host.architecture", + "host.os.platform", + "host.os.name", + "host.os.full", + "host.os.family", + "host.os.version", + "host.os.kernel", + "host.geo.continent_name", + "host.geo.country_name", + "host.geo.region_name", + "host.geo.city_name", + "host.geo.country_iso_code", + "host.geo.region_iso_code", + "host.geo.name", + "http.request.method", + "http.request.body.content", + "http.request.referrer", + "http.response.body.content", + "http.version", + "log.level", + "network.name", + "network.type", + "network.iana_number", + "network.transport", + "network.application", + "network.protocol", + "network.direction", + "network.community_id", + "observer.mac", + "observer.hostname", + "observer.vendor", + "observer.version", + "observer.serial_number", + "observer.type", + "observer.os.platform", + "observer.os.name", + "observer.os.full", + "observer.os.family", + "observer.os.version", + "observer.os.kernel", + "observer.geo.continent_name", + "observer.geo.country_name", + "observer.geo.region_name", + "observer.geo.city_name", + "observer.geo.country_iso_code", + "observer.geo.region_iso_code", + "observer.geo.name", + "organization.name", + "organization.id", + "os.platform", + "os.name", + "os.full", + "os.family", + "os.version", + "os.kernel", + "process.name", + "process.args", + "process.executable", + "process.title", + "process.working_directory", + "server.address", + "server.mac", + "server.domain", + "server.geo.continent_name", + "server.geo.country_name", + "server.geo.region_name", + "server.geo.city_name", + "server.geo.country_iso_code", + "server.geo.region_iso_code", + "server.geo.name", + "service.id", + "service.name", + "service.type", + "service.state", + "service.version", + "service.ephemeral_id", + "source.address", + "source.mac", + "source.domain", + "source.geo.continent_name", + "source.geo.country_name", + "source.geo.region_name", + "source.geo.city_name", + "source.geo.country_iso_code", + "source.geo.region_iso_code", + "source.geo.name", + "url.original", + "url.full", + "url.scheme", + "url.domain", + "url.path", + "url.query", + "url.fragment", + "url.username", + "url.password", + "user.id", + "user.name", + "user.full_name", + "user.email", + "user.hash", + "user.group.id", + "user.group.name", + "user_agent.original", + "user_agent.name", + "user_agent.version", + "user_agent.device.name", + "user_agent.os.platform", + "user_agent.os.name", + "user_agent.os.full", + "user_agent.os.family", + "user_agent.os.version", + "user_agent.os.kernel", + "agent.hostname", + "error.type", + "cloud.project.id", + "kubernetes.pod.name", + "kubernetes.pod.uid", + "kubernetes.namespace", + "kubernetes.node.name", + "kubernetes.container.name", + "kubernetes.container.image", + "log.file.path", + "log.source.address", + "stream", + "input.type", + "syslog.severity_label", + "syslog.facility_label", + "process.program", + "log.flags", + "user_agent.os.full_name", + "fileset.name", + "apache.access.ssl.protocol", + "apache.access.ssl.cipher", + "apache.error.module", + "user.terminal", + "user.audit.id", + "user.audit.name", + "user.audit.group.id", + "user.audit.group.name", + "user.effective.id", + "user.effective.name", + "user.effective.group.id", + "user.effective.group.name", + "user.filesystem.id", + "user.filesystem.name", + "user.filesystem.group.id", + "user.filesystem.group.name", + "user.owner.id", + "user.owner.name", + "user.owner.group.id", + "user.owner.group.name", + "user.saved.id", + "user.saved.name", + "user.saved.group.id", + "user.saved.group.name", + "auditd.log.old_auid", + "auditd.log.new_auid", + "auditd.log.old_ses", + "auditd.log.new_ses", + "auditd.log.items", + "auditd.log.item", + "auditd.log.tty", + "auditd.log.a0", + "elasticsearch.component", + "elasticsearch.cluster.uuid", + "elasticsearch.cluster.name", + "elasticsearch.node.id", + "elasticsearch.node.name", + "elasticsearch.index.name", + "elasticsearch.index.id", + "elasticsearch.shard.id", + "elasticsearch.audit.layer", + "elasticsearch.audit.origin.type", + "elasticsearch.audit.realm", + "elasticsearch.audit.user.realm", + "elasticsearch.audit.user.roles", + "elasticsearch.audit.action", + "elasticsearch.audit.url.params", + "elasticsearch.audit.indices", + "elasticsearch.audit.request.id", + "elasticsearch.audit.request.name", + "elasticsearch.gc.phase.name", + "elasticsearch.gc.tags", + "elasticsearch.slowlog.logger", + "elasticsearch.slowlog.took", + "elasticsearch.slowlog.types", + "elasticsearch.slowlog.stats", + "elasticsearch.slowlog.search_type", + "elasticsearch.slowlog.source_query", + "elasticsearch.slowlog.extra_source", + "elasticsearch.slowlog.total_hits", + "elasticsearch.slowlog.total_shards", + "elasticsearch.slowlog.routing", + "elasticsearch.slowlog.id", + "elasticsearch.slowlog.type", + "haproxy.frontend_name", + "haproxy.backend_name", + "haproxy.server_name", + "haproxy.bind_name", + "haproxy.error_message", + "haproxy.source", + "haproxy.termination_state", + "haproxy.mode", + "haproxy.http.response.captured_cookie", + "haproxy.http.response.captured_headers", + "haproxy.http.request.captured_cookie", + "haproxy.http.request.captured_headers", + "haproxy.http.request.raw_request_line", + "icinga.debug.facility", + "icinga.main.facility", + "icinga.startup.facility", + "iis.access.site_name", + "iis.access.server_name", + "iis.access.cookie", + "iis.error.reason_phrase", + "iis.error.queue_name", + "iptables.fragment_flags", + "iptables.input_device", + "iptables.output_device", + "iptables.tcp.flags", + "iptables.ubiquiti.input_zone", + "iptables.ubiquiti.output_zone", + "iptables.ubiquiti.rule_number", + "iptables.ubiquiti.rule_set", + "kafka.log.component", + "kafka.log.class", + "kafka.log.trace.class", + "kafka.log.trace.message", + "kibana.log.tags", + "kibana.log.state", + "logstash.log.module", + "logstash.log.thread", + "text", + "logstash.slowlog.module", + "logstash.slowlog.thread", + "text", + "logstash.slowlog.event", + "text", + "logstash.slowlog.plugin_name", + "logstash.slowlog.plugin_type", + "logstash.slowlog.plugin_params", + "text", + "mongodb.log.component", + "mongodb.log.context", + "mysql.slowlog.query", + "mysql.slowlog.schema", + "mysql.slowlog.current_user", + "mysql.slowlog.last_errno", + "mysql.slowlog.killed", + "mysql.slowlog.log_slow_rate_type", + "mysql.slowlog.log_slow_rate_limit", + "mysql.slowlog.innodb.trx_id", + "netflow.type", + "netflow.exporter.address", + "netflow.source_mac_address", + "netflow.post_destination_mac_address", + "netflow.destination_mac_address", + "netflow.post_source_mac_address", + "netflow.interface_name", + "netflow.interface_description", + "netflow.sampler_name", + "netflow.application_description", + "netflow.application_name", + "netflow.class_name", + "netflow.wlan_ssid", + "netflow.vr_fname", + "netflow.metro_evc_id", + "netflow.nat_pool_name", + "netflow.p2p_technology", + "netflow.tunnel_technology", + "netflow.encrypted_technology", + "netflow.observation_domain_name", + "netflow.selector_name", + "netflow.information_element_description", + "netflow.information_element_name", + "netflow.virtual_station_interface_name", + "netflow.virtual_station_name", + "netflow.sta_mac_address", + "netflow.wtp_mac_address", + "netflow.user_name", + "netflow.application_category_name", + "netflow.application_sub_category_name", + "netflow.application_group_name", + "netflow.dot1q_customer_source_mac_address", + "netflow.dot1q_customer_destination_mac_address", + "netflow.mib_context_name", + "netflow.mib_object_name", + "netflow.mib_object_description", + "netflow.mib_object_syntax", + "netflow.mib_module_name", + "netflow.mobile_imsi", + "netflow.mobile_msisdn", + "netflow.http_request_method", + "netflow.http_request_host", + "netflow.http_request_target", + "netflow.http_message_version", + "netflow.http_user_agent", + "netflow.http_content_type", + "netflow.http_reason_phrase", + "osquery.result.name", + "osquery.result.action", + "osquery.result.host_identifier", + "osquery.result.calendar_time", + "postgresql.log.timestamp", + "postgresql.log.database", + "postgresql.log.query", + "redis.log.role", + "redis.slowlog.cmd", + "redis.slowlog.key", + "redis.slowlog.args", + "santa.action", + "santa.decision", + "santa.reason", + "santa.mode", + "santa.disk.volume", + "santa.disk.bus", + "santa.disk.serial", + "santa.disk.bsdname", + "santa.disk.model", + "santa.disk.fs", + "santa.disk.mount", + "certificate.common_name", + "certificate.sha256", + "hash.sha256", + "suricata.eve.event_type", + "suricata.eve.app_proto_orig", + "suricata.eve.tcp.tcp_flags", + "suricata.eve.tcp.tcp_flags_tc", + "suricata.eve.tcp.state", + "suricata.eve.tcp.tcp_flags_ts", + "suricata.eve.fileinfo.sha1", + "suricata.eve.fileinfo.state", + "suricata.eve.fileinfo.sha256", + "suricata.eve.fileinfo.md5", + "suricata.eve.dns.type", + "suricata.eve.dns.rrtype", + "suricata.eve.dns.rrname", + "suricata.eve.dns.rdata", + "suricata.eve.dns.rcode", + "suricata.eve.flow_id", + "suricata.eve.email.status", + "suricata.eve.http.redirect", + "suricata.eve.http.protocol", + "suricata.eve.http.http_content_type", + "suricata.eve.in_iface", + "suricata.eve.alert.category", + "suricata.eve.alert.signature", + "suricata.eve.ssh.client.proto_version", + "suricata.eve.ssh.client.software_version", + "suricata.eve.ssh.server.proto_version", + "suricata.eve.ssh.server.software_version", + "suricata.eve.tls.issuerdn", + "suricata.eve.tls.sni", + "suricata.eve.tls.version", + "suricata.eve.tls.fingerprint", + "suricata.eve.tls.serial", + "suricata.eve.tls.subject", + "suricata.eve.app_proto_ts", + "suricata.eve.flow.state", + "suricata.eve.flow.reason", + "suricata.eve.app_proto_tc", + "suricata.eve.smtp.rcpt_to", + "suricata.eve.smtp.mail_from", + "suricata.eve.smtp.helo", + "suricata.eve.app_proto_expected", + "system.auth.ssh.method", + "system.auth.ssh.signature", + "system.auth.sudo.error", + "system.auth.sudo.tty", + "system.auth.sudo.pwd", + "system.auth.sudo.user", + "system.auth.sudo.command", + "system.auth.useradd.home", + "system.auth.useradd.shell", + "traefik.access.user_identifier", + "traefik.access.frontend_name", + "traefik.access.backend_url", + "zeek.session_id", + "zeek.connection.state", + "zeek.connection.history", + "zeek.connection.orig_l2_addr", + "zeek.resp_l2_addr", + "zeek.vlan", + "zeek.inner_vlan", + "zeek.dns.query", + "zeek.dns.qclass_name", + "zeek.dns.qtype_name", + "zeek.dns.rcode_name", + "zeek.dns.answers", + "zeek.http.status_msg", + "zeek.http.info_msg", + "zeek.http.filename", + "zeek.http.tags", + "zeek.http.proxied", + "zeek.http.client_header_names", + "zeek.http.server_header_names", + "zeek.http.orig_fuids", + "zeek.http.orig_mime_types", + "zeek.http.orig_filenames", + "zeek.http.resp_fuids", + "zeek.http.resp_mime_types", + "zeek.http.resp_filenames", + "zeek.files.fuid", + "zeek.files.session_ids", + "zeek.files.source", + "zeek.files.analyzers", + "zeek.files.mime_type", + "zeek.files.filename", + "zeek.files.parent_fuid", + "zeek.files.md5", + "zeek.files.sha1", + "zeek.files.sha256", + "zeek.files.extracted", + "zeek.ssl.version", + "zeek.ssl.cipher", + "zeek.ssl.curve", + "zeek.ssl.server_name", + "zeek.ssl.next_protocol", + "zeek.ssl.cert_chain", + "zeek.ssl.cert_chain_fuids", + "zeek.ssl.client_cert_chain", + "zeek.ssl.client_cert_chain_fuids", + "zeek.ssl.issuer", + "zeek.ssl.client_issuer", + "zeek.ssl.validation_status", + "zeek.ssl.subject", + "zeek.ssl.client_subject", + "zeek.ssl.last_alert", + "fields.*" + ] + }, + "refresh_interval": "5s" + } + } + } +} \ No newline at end of file diff --git a/x-pack/test/functional/es_archives/security_solution/timestamp_override/data.json.gz b/x-pack/test/functional/es_archives/security_solution/timestamp_override/data.json.gz index be351495c2f2e..a2c561471289f 100644 Binary files a/x-pack/test/functional/es_archives/security_solution/timestamp_override/data.json.gz and b/x-pack/test/functional/es_archives/security_solution/timestamp_override/data.json.gz differ diff --git a/x-pack/test/functional/es_archives/security_solution/timestamp_override/mappings.json b/x-pack/test/functional/es_archives/security_solution/timestamp_override/mappings.json index 28de7eeb2eb01..085ab34a3d58a 100644 --- a/x-pack/test/functional/es_archives/security_solution/timestamp_override/mappings.json +++ b/x-pack/test/functional/es_archives/security_solution/timestamp_override/mappings.json @@ -1,19 +1,19 @@ { - "type": "index", - "value": { - "index": "myfakeindex-1", - "mappings" : { - "properties" : { - "message" : { - "type" : "text", - "fields" : { - "keyword" : { - "type" : "keyword", - "ignore_above" : 256 - } - } - } + "type": "index", + "value": { + "index": "myfakeindex-1", + "mappings": { + "properties": { + "message": { + "type": "text", + "fields": { + "keyword": { + "type": "keyword", + "ignore_above": 256 } } + } + } } -} \ No newline at end of file + } +} diff --git a/x-pack/test/functional/es_archives/security_solution/timestamp_override_1/data.json b/x-pack/test/functional/es_archives/security_solution/timestamp_override_1/data.json new file mode 100644 index 0000000000000..a07bf9fdd653b --- /dev/null +++ b/x-pack/test/functional/es_archives/security_solution/timestamp_override_1/data.json @@ -0,0 +1,10 @@ +{ + "type": "doc", + "value": { + "index": "myfakeindex-1", + "source": { + "message": "hello world 1" + }, + "type": "_doc" + } +} diff --git a/x-pack/test/functional/es_archives/security_solution/timestamp_override_1/mappings.json b/x-pack/test/functional/es_archives/security_solution/timestamp_override_1/mappings.json new file mode 100644 index 0000000000000..085ab34a3d58a --- /dev/null +++ b/x-pack/test/functional/es_archives/security_solution/timestamp_override_1/mappings.json @@ -0,0 +1,19 @@ +{ + "type": "index", + "value": { + "index": "myfakeindex-1", + "mappings": { + "properties": { + "message": { + "type": "text", + "fields": { + "keyword": { + "type": "keyword", + "ignore_above": 256 + } + } + } + } + } + } +} diff --git a/x-pack/test/functional/es_archives/security_solution/timestamp_override_2/data.json b/x-pack/test/functional/es_archives/security_solution/timestamp_override_2/data.json new file mode 100644 index 0000000000000..24ba2aa42fb82 --- /dev/null +++ b/x-pack/test/functional/es_archives/security_solution/timestamp_override_2/data.json @@ -0,0 +1,13 @@ +{ + "type": "doc", + "value": { + "index": "myfakeindex-2", + "source": { + "message": "hello world 2", + "event": { + "ingested": "2020-12-16T15:16:18.570Z" + } + }, + "type": "_doc" + } +} diff --git a/x-pack/test/functional/es_archives/security_solution/timestamp_override_2/mappings.json b/x-pack/test/functional/es_archives/security_solution/timestamp_override_2/mappings.json new file mode 100644 index 0000000000000..49a27a423cdaa --- /dev/null +++ b/x-pack/test/functional/es_archives/security_solution/timestamp_override_2/mappings.json @@ -0,0 +1,26 @@ +{ + "type": "index", + "value": { + "index": "myfakeindex-2", + "mappings": { + "properties": { + "message": { + "type": "text", + "fields": { + "keyword": { + "type": "keyword", + "ignore_above": 256 + } + } + }, + "event": { + "properties": { + "ingested": { + "type": "date" + } + } + } + } + } + } +} diff --git a/x-pack/test/functional/es_archives/security_solution/timestamp_override_3/data.json b/x-pack/test/functional/es_archives/security_solution/timestamp_override_3/data.json new file mode 100644 index 0000000000000..56b0c8dff6eba --- /dev/null +++ b/x-pack/test/functional/es_archives/security_solution/timestamp_override_3/data.json @@ -0,0 +1,11 @@ +{ + "type": "doc", + "value": { + "index": "myfakeindex-3", + "source": { + "message": "hello world 3", + "@timestamp": "2020-12-16T15:16:18.570Z" + }, + "type": "_doc" + } +} diff --git a/x-pack/test/functional/es_archives/security_solution/timestamp_override_3/mappings.json b/x-pack/test/functional/es_archives/security_solution/timestamp_override_3/mappings.json new file mode 100644 index 0000000000000..736584386a705 --- /dev/null +++ b/x-pack/test/functional/es_archives/security_solution/timestamp_override_3/mappings.json @@ -0,0 +1,22 @@ +{ + "type": "index", + "value": { + "index": "myfakeindex-3", + "mappings": { + "properties": { + "message": { + "type": "text", + "fields": { + "keyword": { + "type": "keyword", + "ignore_above": 256 + } + } + }, + "@timestamp": { + "type": "date" + } + } + } + } +} diff --git a/x-pack/test/functional/es_archives/security_solution/timestamp_override_4/data.json b/x-pack/test/functional/es_archives/security_solution/timestamp_override_4/data.json new file mode 100644 index 0000000000000..ca7025b36154c --- /dev/null +++ b/x-pack/test/functional/es_archives/security_solution/timestamp_override_4/data.json @@ -0,0 +1,14 @@ +{ + "type": "doc", + "value": { + "index": "myfakeindex-4", + "source": { + "message": "hello world 4", + "@timestamp": "2020-12-16T15:16:18.570Z", + "event": { + "ingested": "2020-12-16T15:16:18.570Z" + } + }, + "type": "_doc" + } +} diff --git a/x-pack/test/functional/es_archives/security_solution/timestamp_override_4/mappings.json b/x-pack/test/functional/es_archives/security_solution/timestamp_override_4/mappings.json new file mode 100644 index 0000000000000..ab4edc9f300e1 --- /dev/null +++ b/x-pack/test/functional/es_archives/security_solution/timestamp_override_4/mappings.json @@ -0,0 +1,29 @@ +{ + "type": "index", + "value": { + "index": "myfakeindex-4", + "mappings": { + "properties": { + "@timestamp": { + "type": "date" + }, + "message": { + "type": "text", + "fields": { + "keyword": { + "type": "keyword", + "ignore_above": 256 + } + } + }, + "event": { + "properties": { + "ingested": { + "type": "date" + } + } + } + } + } + } +} diff --git a/x-pack/test/functional/page_objects/gis_page.ts b/x-pack/test/functional/page_objects/gis_page.ts index 3d9572dcac24e..4a898967419b6 100644 --- a/x-pack/test/functional/page_objects/gis_page.ts +++ b/x-pack/test/functional/page_objects/gis_page.ts @@ -630,6 +630,7 @@ export function GisPageProvider({ getService, getPageObjects }: FtrProviderConte } await inspector.openInspectorRequestsView(); await testSubjects.click('inspectorRequestDetailResponse'); + await find.byCssSelector('.react-monaco-editor-container'); const responseBody = await monacoEditor.getCodeEditorValue(); return JSON.parse(responseBody); } diff --git a/x-pack/test/functional/page_objects/search_sessions_management_page.ts b/x-pack/test/functional/page_objects/search_sessions_management_page.ts index 402569971691d..3f0e6b80b483a 100644 --- a/x-pack/test/functional/page_objects/search_sessions_management_page.ts +++ b/x-pack/test/functional/page_objects/search_sessions_management_page.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { SEARCH_SESSIONS_TABLE_ID } from '../../../plugins/data_enhanced/common/search'; +import { SEARCH_SESSIONS_TABLE_ID } from '../../../../src/plugins/data/common'; import { FtrProviderContext } from '../ftr_provider_context'; export function SearchSessionsPageProvider({ getService, getPageObjects }: FtrProviderContext) { diff --git a/x-pack/test/functional/services/ml/alerting.ts b/x-pack/test/functional/services/ml/alerting.ts index 82f6a86d09199..8d27a75b7b485 100644 --- a/x-pack/test/functional/services/ml/alerting.ts +++ b/x-pack/test/functional/services/ml/alerting.ts @@ -16,6 +16,7 @@ export function MachineLearningAlertingProvider( const retry = getService('retry'); const comboBox = getService('comboBox'); const testSubjects = getService('testSubjects'); + const find = getService('find'); return { async selectAnomalyDetectionAlertType() { @@ -100,5 +101,47 @@ export function MachineLearningAlertingProvider( await testSubjects.existOrFail(`mlAnomalyAlertPreviewCallout`); }); }, + + async assertLookbackInterval(expectedValue: string) { + const actualValue = await testSubjects.getAttribute( + 'mlAnomalyAlertLookbackInterval', + 'value' + ); + expect(actualValue).to.eql( + expectedValue, + `Expected lookback interval to equal ${expectedValue}, got ${actualValue}` + ); + }, + + async assertTopNBuckets(expectedNumberOfBuckets: number) { + const actualValue = await testSubjects.getAttribute('mlAnomalyAlertTopNBuckets', 'value'); + expect(actualValue).to.eql( + expectedNumberOfBuckets, + `Expected number of buckets to equal ${expectedNumberOfBuckets}, got ${actualValue}` + ); + }, + + async setLookbackInterval(interval: string) { + await this.ensureAdvancedSectionOpen(); + await testSubjects.setValue('mlAnomalyAlertLookbackInterval', interval); + await this.assertLookbackInterval(interval); + }, + + async setTopNBuckets(numberOfBuckets: number) { + await this.ensureAdvancedSectionOpen(); + await testSubjects.setValue('mlAnomalyAlertTopNBuckets', numberOfBuckets.toString()); + await this.assertTopNBuckets(numberOfBuckets); + }, + + async ensureAdvancedSectionOpen() { + await retry.tryForTime(5000, async () => { + const isVisible = await find.existsByDisplayedByCssSelector( + '#mlAnomalyAlertAdvancedSettings' + ); + if (!isVisible) { + await testSubjects.click('mlAnomalyAlertAdvancedSettingsTrigger'); + } + }); + }, }; } diff --git a/x-pack/test/functional/services/ml/dashboard_embeddables.ts b/x-pack/test/functional/services/ml/dashboard_embeddables.ts index d0e100a57075a..db5c3f35a2e14 100644 --- a/x-pack/test/functional/services/ml/dashboard_embeddables.ts +++ b/x-pack/test/functional/services/ml/dashboard_embeddables.ts @@ -8,14 +8,17 @@ import expect from '@kbn/expect'; import { FtrProviderContext } from '../../ftr_provider_context'; import { MlCommonUI } from './common_ui'; +import { MlDashboardJobSelectionTable } from './dashboard_job_selection_table'; export function MachineLearningDashboardEmbeddablesProvider( { getService }: FtrProviderContext, - mlCommonUI: MlCommonUI + mlCommonUI: MlCommonUI, + mlDashboardJobSelectionTable: MlDashboardJobSelectionTable ) { const retry = getService('retry'); const testSubjects = getService('testSubjects'); const find = getService('find'); + const dashboardAddPanel = getService('dashboardAddPanel'); return { async assertAnomalyChartsEmbeddableInitializerExists() { @@ -91,5 +94,17 @@ export function MachineLearningDashboardEmbeddablesProvider( async assertAnomalyChartsExists() { await testSubjects.existOrFail(`mlExplorerChartsContainer`); }, + + async openJobSelectionFlyout() { + await retry.tryForTime(60 * 1000, async () => { + await dashboardAddPanel.clickEditorMenuButton(); + await testSubjects.existOrFail('dashboardEditorContextMenu', { timeout: 2000 }); + + await dashboardAddPanel.clickEmbeddableFactoryGroupButton('ml'); + await dashboardAddPanel.clickAddNewEmbeddableLink('ml_anomaly_charts'); + + await mlDashboardJobSelectionTable.assertJobSelectionTableExists(); + }); + }, }; } diff --git a/x-pack/test/functional/services/ml/dashboard_job_selection_table.ts b/x-pack/test/functional/services/ml/dashboard_job_selection_table.ts index b9fe43b000baf..f372928d92a50 100644 --- a/x-pack/test/functional/services/ml/dashboard_job_selection_table.ts +++ b/x-pack/test/functional/services/ml/dashboard_job_selection_table.ts @@ -6,8 +6,13 @@ */ import expect from '@kbn/expect'; +import { ProvidedType } from '@kbn/test/types/ftr'; import { FtrProviderContext } from '../../ftr_provider_context'; +export type MlDashboardJobSelectionTable = ProvidedType< + typeof MachineLearningDashboardJobSelectionTableProvider +>; + export function MachineLearningDashboardJobSelectionTableProvider({ getService, }: FtrProviderContext) { @@ -16,8 +21,8 @@ export function MachineLearningDashboardJobSelectionTableProvider({ return { async assertJobSelectionTableExists(): Promise { - await retry.tryForTime(5000, async () => { - await testSubjects.existOrFail('mlCustomSelectionTable'); + await retry.tryForTime(20 * 1000, async () => { + await testSubjects.existOrFail('mlCustomSelectionTable', { timeout: 2000 }); }); }, diff --git a/x-pack/test/functional/services/ml/index.ts b/x-pack/test/functional/services/ml/index.ts index fe46263f50266..05d369d890289 100644 --- a/x-pack/test/functional/services/ml/index.ts +++ b/x-pack/test/functional/services/ml/index.ts @@ -60,7 +60,11 @@ export function MachineLearningProvider(context: FtrProviderContext) { const customUrls = MachineLearningCustomUrlsProvider(context); const dashboardJobSelectionTable = MachineLearningDashboardJobSelectionTableProvider(context); - const dashboardEmbeddables = MachineLearningDashboardEmbeddablesProvider(context, commonUI); + const dashboardEmbeddables = MachineLearningDashboardEmbeddablesProvider( + context, + commonUI, + dashboardJobSelectionTable + ); const dataFrameAnalytics = MachineLearningDataFrameAnalyticsProvider(context, api); const dataFrameAnalyticsCreation = MachineLearningDataFrameAnalyticsCreationProvider( diff --git a/x-pack/test/functional_with_es_ssl/apps/ml/alert_flyout.ts b/x-pack/test/functional_with_es_ssl/apps/ml/alert_flyout.ts index 8fcf8be9fa493..cc0dcff528663 100644 --- a/x-pack/test/functional_with_es_ssl/apps/ml/alert_flyout.ts +++ b/x-pack/test/functional_with_es_ssl/apps/ml/alert_flyout.ts @@ -5,6 +5,7 @@ * 2.0. */ +import { Datafeed } from '@elastic/elasticsearch/api/types'; import { FtrProviderContext } from '../../ftr_provider_context'; import { DATAFEED_STATE } from '../../../../plugins/ml/common/constants/states'; @@ -39,7 +40,7 @@ function createTestJobAndDatafeed() { categorization_examples_limit: 4, }, }, - datafeed: { + datafeed: ({ datafeed_id: `datafeed-${jobId}`, job_id: jobId, query: { @@ -53,8 +54,9 @@ function createTestJobAndDatafeed() { must_not: [], }, }, + query_delay: '120s', indices: ['ft_ecommerce'], - }, + } as unknown) as Datafeed, }; } @@ -83,7 +85,6 @@ export default ({ getPageObjects, getService }: FtrProviderContext) => { // @ts-expect-error not full interface await ml.api.createAnomalyDetectionJob(job); await ml.api.openAnomalyDetectionJob(job.job_id); - // @ts-expect-error not full interface await ml.api.createDatafeed(datafeed); await ml.api.startDatafeed(datafeed.datafeed_id); await ml.api.waitForDatafeedState(datafeed.datafeed_id, DATAFEED_STATE.STARTED); @@ -109,6 +110,10 @@ export default ({ getPageObjects, getService }: FtrProviderContext) => { await ml.alerting.selectResultType('record'); await ml.alerting.setSeverity(10); + await ml.testExecution.logTestStep('should populate advanced settings with default values'); + await ml.alerting.assertTopNBuckets(1); + await ml.alerting.assertLookbackInterval('123m'); + await ml.testExecution.logTestStep('should preview the alert condition'); await ml.alerting.assertPreviewButtonState(false); await ml.alerting.setTestInterval('2y'); diff --git a/x-pack/test/functional_with_es_ssl/page_objects/alert_details.ts b/x-pack/test/functional_with_es_ssl/page_objects/alert_details.ts index 98272294b330d..8740deaeddd6e 100644 --- a/x-pack/test/functional_with_es_ssl/page_objects/alert_details.ts +++ b/x-pack/test/functional_with_es_ssl/page_objects/alert_details.ts @@ -33,7 +33,7 @@ export function AlertDetailsPageProvider({ getService }: FtrProviderContext) { const $ = await table.parseDomContent(); return $.findTestSubjects('alert-instance-row') .toArray() - .map((row: CheerioElement) => { + .map((row) => { return { instance: $(row) .findTestSubject('alertInstancesTableCell-instance') @@ -87,7 +87,7 @@ export function AlertDetailsPageProvider({ getService }: FtrProviderContext) { $.findTestSubjects('alert-instance-row') .toArray() .filter( - (row: CheerioElement) => + (row) => $(row) .findTestSubject('alertInstancesTableCell-instance') .find('.euiTableCellContent') diff --git a/x-pack/test/functional_with_es_ssl/page_objects/triggers_actions_ui_page.ts b/x-pack/test/functional_with_es_ssl/page_objects/triggers_actions_ui_page.ts index e5971ddba415f..5fa442e289037 100644 --- a/x-pack/test/functional_with_es_ssl/page_objects/triggers_actions_ui_page.ts +++ b/x-pack/test/functional_with_es_ssl/page_objects/triggers_actions_ui_page.ts @@ -6,7 +6,10 @@ */ import expect from '@kbn/expect'; -import { CustomCheerioStatic } from 'test/functional/services/lib/web_element_wrapper/custom_cheerio_api'; +import { + CustomCheerio, + CustomCheerioStatic, +} from 'test/functional/services/lib/web_element_wrapper/custom_cheerio_api'; import { FtrProviderContext } from '../ftr_provider_context'; const ENTER_KEY = '\uE007'; @@ -16,7 +19,7 @@ export function TriggersActionsPageProvider({ getService }: FtrProviderContext) const retry = getService('retry'); const testSubjects = getService('testSubjects'); - function getRowItemData(row: CheerioElement, $: CustomCheerioStatic) { + function getRowItemData(row: CustomCheerio, $: CustomCheerioStatic) { return { name: $(row).findTestSubject('alertsTableCell-name').find('.euiTableCellContent').text(), tagsText: $(row) @@ -79,7 +82,7 @@ export function TriggersActionsPageProvider({ getService }: FtrProviderContext) const $ = await table.parseDomContent(); return $.findTestSubjects('connectors-row') .toArray() - .map((row: CheerioElement) => { + .map((row) => { return { name: $(row) .findTestSubject('connectorsTableCell-name') @@ -97,7 +100,7 @@ export function TriggersActionsPageProvider({ getService }: FtrProviderContext) const $ = await table.parseDomContent(); return $.findTestSubjects('alert-row') .toArray() - .map((row: CheerioElement) => { + .map((row) => { return getRowItemData(row, $); }); }, @@ -106,7 +109,7 @@ export function TriggersActionsPageProvider({ getService }: FtrProviderContext) const $ = await table.parseDomContent(); return $.findTestSubjects('alert-row') .toArray() - .map((row: CheerioElement) => { + .map((row) => { const rowItem = getRowItemData(row, $); return { ...rowItem, diff --git a/x-pack/test/licensing_plugin/public/updates.ts b/x-pack/test/licensing_plugin/public/updates.ts index e09eb04065b64..d7442e491875a 100644 --- a/x-pack/test/licensing_plugin/public/updates.ts +++ b/x-pack/test/licensing_plugin/public/updates.ts @@ -19,7 +19,8 @@ export default function (ftrContext: FtrProviderContext) { const scenario = createScenario(ftrContext); - describe('changes in license types', () => { + // FLAKY: https://github.com/elastic/kibana/issues/53575 + describe.skip('changes in license types', () => { after(async () => { await scenario.teardown(); }); @@ -34,7 +35,7 @@ export default function (ftrContext: FtrProviderContext) { // this call enforces signature check to detect license update // and causes license re-fetch await setup.core.http.get('/'); - await testUtils.delay(500); + await testUtils.delay(1000); const licensing: LicensingPluginSetup = setup.plugins.licensing; licensing.license$.subscribe((license) => cb(license.type)); @@ -50,7 +51,7 @@ export default function (ftrContext: FtrProviderContext) { // this call enforces signature check to detect license update // and causes license re-fetch await setup.core.http.get('/'); - await testUtils.delay(500); + await testUtils.delay(1000); const licensing: LicensingPluginSetup = setup.plugins.licensing; licensing.license$.subscribe((license) => cb(license.type)); @@ -66,7 +67,7 @@ export default function (ftrContext: FtrProviderContext) { // this call enforces signature check to detect license update // and causes license re-fetch await setup.core.http.get('/'); - await testUtils.delay(500); + await testUtils.delay(1000); const licensing: LicensingPluginSetup = setup.plugins.licensing; licensing.license$.subscribe((license) => cb(license.type)); @@ -82,7 +83,7 @@ export default function (ftrContext: FtrProviderContext) { // this call enforces signature check to detect license update // and causes license re-fetch await setup.core.http.get('/'); - await testUtils.delay(500); + await testUtils.delay(1000); const licensing: LicensingPluginSetup = setup.plugins.licensing; licensing.license$.subscribe((license) => cb(license.type)); diff --git a/x-pack/test/reporting_api_integration/reporting_and_security/index.ts b/x-pack/test/reporting_api_integration/reporting_and_security/index.ts index 78873f2097e80..b7d7605ec00bc 100644 --- a/x-pack/test/reporting_api_integration/reporting_and_security/index.ts +++ b/x-pack/test/reporting_api_integration/reporting_and_security/index.ts @@ -15,6 +15,7 @@ export default function ({ getService, loadTestFile }: FtrProviderContext) { before(async () => { const reportingAPI = getService('reportingAPI'); await reportingAPI.createDataAnalystRole(); + await reportingAPI.createTestReportingUserRole(); await reportingAPI.createDataAnalyst(); await reportingAPI.createTestReportingUser(); }); diff --git a/x-pack/test/reporting_api_integration/services/scenarios.ts b/x-pack/test/reporting_api_integration/services/scenarios.ts index d13deac3578ba..eee13b0bf07a2 100644 --- a/x-pack/test/reporting_api_integration/services/scenarios.ts +++ b/x-pack/test/reporting_api_integration/services/scenarios.ts @@ -58,6 +58,35 @@ export function createScenarios({ getService }: Pick { + await security.role.create('test_reporting_user', { + metadata: {}, + elasticsearch: { + cluster: [], + indices: [ + { + names: ['ecommerce'], + privileges: ['read', 'view_index_metadata'], + allow_restricted_indices: false, + }, + ], + run_as: [], + }, + kibana: [ + { + base: [], + feature: { + dashboard: ['minimal_read', 'download_csv_report', 'generate_report'], + discover: ['minimal_read', 'generate_report'], + canvas: ['minimal_read', 'generate_report'], + visualize: ['minimal_read', 'generate_report'], + }, + spaces: ['*'], + }, + ], + }); + }; + const createDataAnalyst = async () => { await security.user.create('data_analyst', { password: 'data_analyst-password', @@ -69,7 +98,7 @@ export function createScenarios({ getService }: Pick { await security.user.create('reporting_user', { password: 'reporting_user-password', - roles: ['data_analyst', 'reporting_user'], + roles: ['test_reporting_user'], full_name: 'Reporting User', }); }; @@ -142,6 +171,7 @@ export function createScenarios({ getService }: Pick { + await security.role.create('data_analyst', { + metadata: {}, + elasticsearch: { + cluster: [], + indices: [ + { + names: ['ecommerce'], + privileges: ['read', 'view_index_metadata'], + allow_restricted_indices: false, + }, + ], + run_as: [], + }, + kibana: [{ base: ['all'], feature: {}, spaces: ['*'] }], + }); + }; + const createDataAnalyst = async () => { + await security.user.create('data_analyst', { + password: 'data_analyst-password', + roles: ['data_analyst', 'kibana_user'], + full_name: 'a kibana user called data_a', + }); + }; + const createReportingUser = async () => { + await security.user.create('reporting_user', { + password: 'reporting_user-password', + roles: ['reporting_user', 'data_analyst', 'kibana_user'], // Deprecated: using built-in `reporting_user` role grants all Reporting privileges + full_name: 'a reporting user', + }); + }; + + describe('Reporting Functional Tests with Deprecated Security configuration enabled', function () { + this.tags('ciGroup2'); + + before(async () => { + await createDataAnalystRole(); + await createDataAnalyst(); + await createReportingUser(); + }); + + const { loadTestFile } = context; + loadTestFile(require.resolve('./security_roles_privileges')); + loadTestFile(require.resolve('./management')); + }); +} diff --git a/x-pack/test/reporting_functional/reporting_and_deprecated_security/management.ts b/x-pack/test/reporting_functional/reporting_and_deprecated_security/management.ts new file mode 100644 index 0000000000000..dba16c798d4ff --- /dev/null +++ b/x-pack/test/reporting_functional/reporting_and_deprecated_security/management.ts @@ -0,0 +1,37 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import { FtrProviderContext } from '../ftr_provider_context'; + +// eslint-disable-next-line import/no-default-export +export default ({ getService, getPageObjects }: FtrProviderContext) => { + const PageObjects = getPageObjects(['common', 'reporting', 'discover']); + + const testSubjects = getService('testSubjects'); + const reportingFunctional = getService('reportingFunctional'); + + describe('Access to Management > Reporting', () => { + before(async () => { + await reportingFunctional.initEcommerce(); + }); + after(async () => { + await reportingFunctional.teardownEcommerce(); + }); + + it('does not allow user that does not have reporting_user role', async () => { + await reportingFunctional.loginDataAnalyst(); + await PageObjects.common.navigateToApp('reporting'); + await testSubjects.missingOrFail('reportJobListing'); + }); + + it('does allow user with reporting_user role', async () => { + await reportingFunctional.loginReportingUser(); + await PageObjects.common.navigateToApp('reporting'); + await testSubjects.existOrFail('reportJobListing'); + }); + }); +}; diff --git a/x-pack/test/reporting_functional/reporting_and_deprecated_security/security_roles_privileges.ts b/x-pack/test/reporting_functional/reporting_and_deprecated_security/security_roles_privileges.ts new file mode 100644 index 0000000000000..76ccb01477856 --- /dev/null +++ b/x-pack/test/reporting_functional/reporting_and_deprecated_security/security_roles_privileges.ts @@ -0,0 +1,109 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import { FtrProviderContext } from '../ftr_provider_context'; + +const DASHBOARD_TITLE = 'Ecom Dashboard'; +const SAVEDSEARCH_TITLE = 'Ecommerce Data'; +const VIS_TITLE = 'e-commerce pie chart'; +const CANVAS_TITLE = 'The Very Cool Workpad for PDF Tests'; + +// eslint-disable-next-line import/no-default-export +export default function ({ getService }: FtrProviderContext) { + const reportingFunctional = getService('reportingFunctional'); + + describe('Security with `reporting_user` built-in role', () => { + before(async () => { + await reportingFunctional.initEcommerce(); + }); + after(async () => { + await reportingFunctional.teardownEcommerce(); + }); + + describe('Dashboard: Download CSV file', () => { + it('does not allow user that does not have reporting_user role', async () => { + await reportingFunctional.loginDataAnalyst(); + await reportingFunctional.openSavedDashboard(DASHBOARD_TITLE); + await reportingFunctional.tryDashboardDownloadCsvFail('Ecommerce Data'); + }); + + it('does allow user with reporting_user role', async () => { + await reportingFunctional.loginDataAnalyst(); + await reportingFunctional.openSavedDashboard(DASHBOARD_TITLE); + await reportingFunctional.tryDashboardDownloadCsvSuccess('Ecommerce Data'); + }); + }); + + describe('Dashboard: Generate Screenshot', () => { + it('does not allow user that does not have reporting_user role', async () => { + await reportingFunctional.loginDataAnalyst(); + await reportingFunctional.openSavedDashboard(DASHBOARD_TITLE); + await reportingFunctional.tryGeneratePdfFail(); + }); + + it('does allow user with reporting_user role', async () => { + await reportingFunctional.loginReportingUser(); + await reportingFunctional.openSavedDashboard(DASHBOARD_TITLE); + await reportingFunctional.tryGeneratePdfSuccess(); + }); + }); + + describe('Discover: Generate CSV', () => { + it('does not allow user that does not have reporting_user role', async () => { + await reportingFunctional.loginDataAnalyst(); + await reportingFunctional.openSavedSearch(SAVEDSEARCH_TITLE); + await reportingFunctional.tryDiscoverCsvFail(); + }); + + it('does allow user with reporting_user role', async () => { + await reportingFunctional.loginReportingUser(); + await reportingFunctional.openSavedSearch(SAVEDSEARCH_TITLE); + await reportingFunctional.tryDiscoverCsvSuccess(); + }); + }); + + describe('Canvas: Generate PDF', () => { + const esArchiver = getService('esArchiver'); + const reportingApi = getService('reportingAPI'); + before('initialize tests', async () => { + await esArchiver.load('canvas/reports'); + }); + + after('teardown tests', async () => { + await esArchiver.unload('canvas/reports'); + await reportingApi.deleteAllReports(); + await reportingFunctional.initEcommerce(); + }); + + it('does not allow user that does not have reporting_user role', async () => { + await reportingFunctional.loginDataAnalyst(); + await reportingFunctional.openCanvasWorkpad(CANVAS_TITLE); + await reportingFunctional.tryGeneratePdfFail(); + }); + + it('does allow user with reporting_user role', async () => { + await reportingFunctional.loginReportingUser(); + await reportingFunctional.openCanvasWorkpad(CANVAS_TITLE); + await reportingFunctional.tryGeneratePdfSuccess(); + }); + }); + + describe('Visualize Editor: Generate Screenshot', () => { + it('does not allow user that does not have reporting_user role', async () => { + await reportingFunctional.loginDataAnalyst(); + await reportingFunctional.openSavedVisualization(VIS_TITLE); + await reportingFunctional.tryGeneratePdfFail(); + }); + + it('does allow user with reporting_user role', async () => { + await reportingFunctional.loginReportingUser(); + await reportingFunctional.openSavedVisualization(VIS_TITLE); + await reportingFunctional.tryGeneratePdfSuccess(); + }); + }); + }); +} diff --git a/x-pack/test/reporting_functional/reporting_and_security/index.ts b/x-pack/test/reporting_functional/reporting_and_security/index.ts index f3e01453b0a59..be0e76a28bd0b 100644 --- a/x-pack/test/reporting_functional/reporting_and_security/index.ts +++ b/x-pack/test/reporting_functional/reporting_and_security/index.ts @@ -9,46 +9,15 @@ import { FtrProviderContext } from '../ftr_provider_context'; // eslint-disable-next-line import/no-default-export export default function ({ getService, loadTestFile }: FtrProviderContext) { - const security = getService('security'); - const createDataAnalystRole = async () => { - await security.role.create('data_analyst', { - metadata: {}, - elasticsearch: { - cluster: [], - indices: [ - { - names: ['ecommerce'], - privileges: ['read', 'view_index_metadata'], - allow_restricted_indices: false, - }, - ], - run_as: [], - }, - kibana: [{ base: ['all'], feature: {}, spaces: ['*'] }], - }); - }; - const createDataAnalyst = async () => { - await security.user.create('data_analyst', { - password: 'data_analyst-password', - roles: ['data_analyst', 'kibana_user'], - full_name: 'a kibana user called data_a', - }); - }; - const createReportingUser = async () => { - await security.user.create('reporting_user', { - password: 'reporting_user-password', - roles: ['reporting_user', 'data_analyst', 'kibana_user'], - full_name: 'a reporting user', - }); - }; - - describe('Reporting Functional Tests with Role-based Security configuration enabled', function () { + describe('Reporting Functional Tests with Security enabled', function () { this.tags('ciGroup2'); before(async () => { - await createDataAnalystRole(); - await createDataAnalyst(); - await createReportingUser(); + const reportingFunctional = getService('reportingFunctional'); + await reportingFunctional.createDataAnalystRole(); + await reportingFunctional.createDataAnalyst(); + await reportingFunctional.createTestReportingUserRole(); + await reportingFunctional.createTestReportingUser(); }); loadTestFile(require.resolve('./security_roles_privileges')); diff --git a/x-pack/test/reporting_functional/reporting_and_security/management.ts b/x-pack/test/reporting_functional/reporting_and_security/management.ts index dba16c798d4ff..304c175f0cb5d 100644 --- a/x-pack/test/reporting_functional/reporting_and_security/management.ts +++ b/x-pack/test/reporting_functional/reporting_and_security/management.ts @@ -9,8 +9,7 @@ import { FtrProviderContext } from '../ftr_provider_context'; // eslint-disable-next-line import/no-default-export export default ({ getService, getPageObjects }: FtrProviderContext) => { - const PageObjects = getPageObjects(['common', 'reporting', 'discover']); - + const PageObjects = getPageObjects(['common']); const testSubjects = getService('testSubjects'); const reportingFunctional = getService('reportingFunctional'); @@ -22,13 +21,13 @@ export default ({ getService, getPageObjects }: FtrProviderContext) => { await reportingFunctional.teardownEcommerce(); }); - it('does not allow user that does not have reporting_user role', async () => { + it('does not allow user that does not have reporting privileges', async () => { await reportingFunctional.loginDataAnalyst(); await PageObjects.common.navigateToApp('reporting'); await testSubjects.missingOrFail('reportJobListing'); }); - it('does allow user with reporting_user role', async () => { + it('does allow user with reporting privileges', async () => { await reportingFunctional.loginReportingUser(); await PageObjects.common.navigateToApp('reporting'); await testSubjects.existOrFail('reportJobListing'); diff --git a/x-pack/test/reporting_functional/reporting_and_security/security_roles_privileges.ts b/x-pack/test/reporting_functional/reporting_and_security/security_roles_privileges.ts index 76ccb01477856..20b88b22b542c 100644 --- a/x-pack/test/reporting_functional/reporting_and_security/security_roles_privileges.ts +++ b/x-pack/test/reporting_functional/reporting_and_security/security_roles_privileges.ts @@ -25,41 +25,47 @@ export default function ({ getService }: FtrProviderContext) { }); describe('Dashboard: Download CSV file', () => { - it('does not allow user that does not have reporting_user role', async () => { + it('does not allow user that does not have reporting privileges', async () => { await reportingFunctional.loginDataAnalyst(); await reportingFunctional.openSavedDashboard(DASHBOARD_TITLE); - await reportingFunctional.tryDashboardDownloadCsvFail('Ecommerce Data'); + await reportingFunctional.tryDashboardDownloadCsvNotAvailable('Ecommerce Data'); }); - it('does allow user with reporting_user role', async () => { - await reportingFunctional.loginDataAnalyst(); + it('does allow user with reporting privileges', async () => { + await reportingFunctional.loginReportingUser(); await reportingFunctional.openSavedDashboard(DASHBOARD_TITLE); await reportingFunctional.tryDashboardDownloadCsvSuccess('Ecommerce Data'); }); }); describe('Dashboard: Generate Screenshot', () => { - it('does not allow user that does not have reporting_user role', async () => { + it('does not allow user that does not have reporting privileges', async () => { await reportingFunctional.loginDataAnalyst(); await reportingFunctional.openSavedDashboard(DASHBOARD_TITLE); - await reportingFunctional.tryGeneratePdfFail(); + await reportingFunctional.tryReportsNotAvailable(); }); - it('does allow user with reporting_user role', async () => { + it('does allow PDF generation user with reporting privileges', async () => { await reportingFunctional.loginReportingUser(); await reportingFunctional.openSavedDashboard(DASHBOARD_TITLE); await reportingFunctional.tryGeneratePdfSuccess(); }); + + it('does allow PNG generation user with reporting privileges', async () => { + await reportingFunctional.loginReportingUser(); + await reportingFunctional.openSavedDashboard(DASHBOARD_TITLE); + await reportingFunctional.tryGeneratePngSuccess(); + }); }); describe('Discover: Generate CSV', () => { - it('does not allow user that does not have reporting_user role', async () => { + it('does not allow user that does not have reporting privileges', async () => { await reportingFunctional.loginDataAnalyst(); await reportingFunctional.openSavedSearch(SAVEDSEARCH_TITLE); - await reportingFunctional.tryDiscoverCsvFail(); + await reportingFunctional.tryDiscoverCsvNotAvailable(); }); - it('does allow user with reporting_user role', async () => { + it('does allow user with reporting privileges', async () => { await reportingFunctional.loginReportingUser(); await reportingFunctional.openSavedSearch(SAVEDSEARCH_TITLE); await reportingFunctional.tryDiscoverCsvSuccess(); @@ -79,13 +85,13 @@ export default function ({ getService }: FtrProviderContext) { await reportingFunctional.initEcommerce(); }); - it('does not allow user that does not have reporting_user role', async () => { + it('does not allow user that does not have reporting privileges', async () => { await reportingFunctional.loginDataAnalyst(); await reportingFunctional.openCanvasWorkpad(CANVAS_TITLE); - await reportingFunctional.tryGeneratePdfFail(); + await reportingFunctional.tryGeneratePdfNotAvailable(); }); - it('does allow user with reporting_user role', async () => { + it('does allow user with reporting privileges', async () => { await reportingFunctional.loginReportingUser(); await reportingFunctional.openCanvasWorkpad(CANVAS_TITLE); await reportingFunctional.tryGeneratePdfSuccess(); @@ -93,17 +99,23 @@ export default function ({ getService }: FtrProviderContext) { }); describe('Visualize Editor: Generate Screenshot', () => { - it('does not allow user that does not have reporting_user role', async () => { + it('does not allow user that does not have reporting privileges', async () => { await reportingFunctional.loginDataAnalyst(); await reportingFunctional.openSavedVisualization(VIS_TITLE); - await reportingFunctional.tryGeneratePdfFail(); + await reportingFunctional.tryReportsNotAvailable(); }); - it('does allow user with reporting_user role', async () => { + it('does allow PDF generation user with reporting privileges', async () => { await reportingFunctional.loginReportingUser(); await reportingFunctional.openSavedVisualization(VIS_TITLE); await reportingFunctional.tryGeneratePdfSuccess(); }); + + it('does allow PNG generation user with reporting privileges', async () => { + await reportingFunctional.loginReportingUser(); + await reportingFunctional.openSavedVisualization(VIS_TITLE); + await reportingFunctional.tryGeneratePngSuccess(); + }); }); }); } diff --git a/x-pack/test/search_sessions_integration/tests/apps/dashboard/async_search/save_search_session_relative_time.ts b/x-pack/test/search_sessions_integration/tests/apps/dashboard/async_search/save_search_session_relative_time.ts index bb0e9d697063b..dc107040ecd2e 100644 --- a/x-pack/test/search_sessions_integration/tests/apps/dashboard/async_search/save_search_session_relative_time.ts +++ b/x-pack/test/search_sessions_integration/tests/apps/dashboard/async_search/save_search_session_relative_time.ts @@ -93,7 +93,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { log.debug('Checking area, bar and heatmap charts rendered'); await dashboardExpect.seriesElementCount(15); log.debug('Checking saved searches rendered'); - await dashboardExpect.savedSearchRowCount(50); + await dashboardExpect.savedSearchRowCount(11); log.debug('Checking input controls rendered'); await dashboardExpect.inputControlItemCount(3); log.debug('Checking tag cloud rendered'); diff --git a/x-pack/test/search_sessions_integration/tests/apps/discover/async_search.ts b/x-pack/test/search_sessions_integration/tests/apps/discover/async_search.ts index 2bd539dab5bf3..b9397964fd16a 100644 --- a/x-pack/test/search_sessions_integration/tests/apps/discover/async_search.ts +++ b/x-pack/test/search_sessions_integration/tests/apps/discover/async_search.ts @@ -14,9 +14,10 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) { const testSubjects = getService('testSubjects'); const browser = getService('browser'); const inspector = getService('inspector'); - const docTable = getService('docTable'); const PageObjects = getPageObjects(['discover', 'common', 'timePicker', 'header', 'context']); const searchSessions = getService('searchSessions'); + const dataGrid = getService('dataGrid'); + const retry = getService('retry'); describe('discover async search', () => { before(async () => { @@ -66,9 +67,16 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) { it('navigation to context cleans the session', async () => { await PageObjects.common.clearAllToasts(); - await docTable.clickRowToggle({ rowIndex: 0 }); - const rowActions = await docTable.getRowActions({ rowIndex: 0 }); - await rowActions[0].click(); + await dataGrid.clickRowToggle({ rowIndex: 0 }); + + await retry.try(async () => { + const rowActions = await dataGrid.getRowActions({ rowIndex: 0 }); + if (!rowActions.length) { + throw new Error('row actions empty, trying again'); + } + await rowActions[1].click(); + }); + await PageObjects.context.waitUntilContextLoadingHasFinished(); await searchSessions.missingOrFail(); }); diff --git a/x-pack/test/security_api_integration/tests/anonymous/capabilities.ts b/x-pack/test/security_api_integration/tests/anonymous/capabilities.ts index db9715f7e48d5..47d942db947f5 100644 --- a/x-pack/test/security_api_integration/tests/anonymous/capabilities.ts +++ b/x-pack/test/security_api_integration/tests/anonymous/capabilities.ts @@ -56,6 +56,8 @@ export default function ({ getService }: FtrProviderContext) { "dashboard": Object { "createNew": false, "createShortUrl": false, + "downloadCsv": false, + "generateScreenshot": false, "saveQuery": false, "show": false, "showWriteControls": false, @@ -63,6 +65,7 @@ export default function ({ getService }: FtrProviderContext) { }, "discover": Object { "createShortUrl": false, + "generateCsv": false, "save": false, "saveQuery": false, "show": false, @@ -76,6 +79,7 @@ export default function ({ getService }: FtrProviderContext) { "visualize": Object { "createShortUrl": false, "delete": false, + "generateScreenshot": false, "save": false, "saveQuery": false, "show": false, @@ -87,6 +91,8 @@ export default function ({ getService }: FtrProviderContext) { "dashboard": Object { "createNew": false, "createShortUrl": false, + "downloadCsv": false, + "generateScreenshot": false, "saveQuery": false, "show": false, "showWriteControls": false, @@ -94,6 +100,7 @@ export default function ({ getService }: FtrProviderContext) { }, "discover": Object { "createShortUrl": false, + "generateCsv": false, "save": false, "saveQuery": false, "show": false, @@ -107,6 +114,7 @@ export default function ({ getService }: FtrProviderContext) { "visualize": Object { "createShortUrl": false, "delete": false, + "generateScreenshot": false, "save": false, "saveQuery": false, "show": false, @@ -118,6 +126,8 @@ export default function ({ getService }: FtrProviderContext) { "dashboard": Object { "createNew": false, "createShortUrl": false, + "downloadCsv": false, + "generateScreenshot": false, "saveQuery": false, "show": false, "showWriteControls": false, @@ -125,6 +135,7 @@ export default function ({ getService }: FtrProviderContext) { }, "discover": Object { "createShortUrl": false, + "generateCsv": false, "save": false, "saveQuery": false, "show": false, @@ -138,6 +149,7 @@ export default function ({ getService }: FtrProviderContext) { "visualize": Object { "createShortUrl": false, "delete": false, + "generateScreenshot": false, "save": false, "saveQuery": false, "show": false, @@ -168,6 +180,8 @@ export default function ({ getService }: FtrProviderContext) { "dashboard": Object { "createNew": false, "createShortUrl": false, + "downloadCsv": false, + "generateScreenshot": false, "saveQuery": false, "show": false, "showWriteControls": false, @@ -175,6 +189,7 @@ export default function ({ getService }: FtrProviderContext) { }, "discover": Object { "createShortUrl": false, + "generateCsv": false, "save": false, "saveQuery": false, "show": false, @@ -188,6 +203,7 @@ export default function ({ getService }: FtrProviderContext) { "visualize": Object { "createShortUrl": false, "delete": false, + "generateScreenshot": false, "save": false, "saveQuery": false, "show": false, @@ -199,6 +215,8 @@ export default function ({ getService }: FtrProviderContext) { "dashboard": Object { "createNew": false, "createShortUrl": false, + "downloadCsv": false, + "generateScreenshot": false, "saveQuery": false, "show": false, "showWriteControls": false, @@ -206,6 +224,7 @@ export default function ({ getService }: FtrProviderContext) { }, "discover": Object { "createShortUrl": false, + "generateCsv": false, "save": false, "saveQuery": false, "show": false, @@ -219,6 +238,7 @@ export default function ({ getService }: FtrProviderContext) { "visualize": Object { "createShortUrl": false, "delete": false, + "generateScreenshot": false, "save": false, "saveQuery": false, "show": false, @@ -230,6 +250,8 @@ export default function ({ getService }: FtrProviderContext) { "dashboard": Object { "createNew": false, "createShortUrl": false, + "downloadCsv": false, + "generateScreenshot": false, "saveQuery": false, "show": false, "showWriteControls": false, @@ -237,6 +259,7 @@ export default function ({ getService }: FtrProviderContext) { }, "discover": Object { "createShortUrl": false, + "generateCsv": false, "save": false, "saveQuery": false, "show": false, @@ -250,6 +273,7 @@ export default function ({ getService }: FtrProviderContext) { "visualize": Object { "createShortUrl": false, "delete": false, + "generateScreenshot": false, "save": false, "saveQuery": false, "show": false, @@ -298,6 +322,8 @@ export default function ({ getService }: FtrProviderContext) { "dashboard": Object { "createNew": false, "createShortUrl": false, + "downloadCsv": false, + "generateScreenshot": false, "saveQuery": false, "show": true, "showWriteControls": false, @@ -305,6 +331,7 @@ export default function ({ getService }: FtrProviderContext) { }, "discover": Object { "createShortUrl": false, + "generateCsv": false, "save": false, "saveQuery": false, "show": true, @@ -318,6 +345,7 @@ export default function ({ getService }: FtrProviderContext) { "visualize": Object { "createShortUrl": false, "delete": false, + "generateScreenshot": false, "save": false, "saveQuery": false, "show": true, @@ -331,6 +359,8 @@ export default function ({ getService }: FtrProviderContext) { "dashboard": Object { "createNew": false, "createShortUrl": false, + "downloadCsv": false, + "generateScreenshot": false, "saveQuery": false, "show": false, "showWriteControls": false, @@ -338,6 +368,7 @@ export default function ({ getService }: FtrProviderContext) { }, "discover": Object { "createShortUrl": false, + "generateCsv": false, "save": false, "saveQuery": false, "show": false, @@ -351,6 +382,7 @@ export default function ({ getService }: FtrProviderContext) { "visualize": Object { "createShortUrl": false, "delete": false, + "generateScreenshot": false, "save": false, "saveQuery": false, "show": false, @@ -364,6 +396,8 @@ export default function ({ getService }: FtrProviderContext) { "dashboard": Object { "createNew": false, "createShortUrl": false, + "downloadCsv": false, + "generateScreenshot": false, "saveQuery": false, "show": false, "showWriteControls": false, @@ -371,6 +405,7 @@ export default function ({ getService }: FtrProviderContext) { }, "discover": Object { "createShortUrl": false, + "generateCsv": false, "save": false, "saveQuery": false, "show": false, @@ -384,6 +419,7 @@ export default function ({ getService }: FtrProviderContext) { "visualize": Object { "createShortUrl": false, "delete": false, + "generateScreenshot": false, "save": false, "saveQuery": false, "show": true, diff --git a/x-pack/test/security_solution_endpoint/apps/endpoint/endpoint_list.ts b/x-pack/test/security_solution_endpoint/apps/endpoint/endpoint_list.ts index 9f9b24683dd1a..fec50bf52fa42 100644 --- a/x-pack/test/security_solution_endpoint/apps/endpoint/endpoint_list.ts +++ b/x-pack/test/security_solution_endpoint/apps/endpoint/endpoint_list.ts @@ -38,7 +38,7 @@ export default ({ getPageObjects, getService }: FtrProviderContext) => { 'windows 10.0', '10.101.149.26, 2606:a000:ffc0:39:11ef:37b9:3371:578c', '6.8.0', - 'Jan 24, 2020 @ 16:06:09.541', + 'Apr 19, 2021 @ 14:10:05.309', '', ], [ @@ -49,7 +49,7 @@ export default ({ getPageObjects, getService }: FtrProviderContext) => { 'windows 10.0', '10.192.213.130, 10.70.28.129', '6.6.1', - 'Jan 24, 2020 @ 16:06:09.541', + 'Apr 19, 2021 @ 14:10:05.309', '', ], [ @@ -60,7 +60,7 @@ export default ({ getPageObjects, getService }: FtrProviderContext) => { 'windows 10.0', '10.46.229.234', '6.0.0', - 'Jan 24, 2020 @ 16:06:09.541', + 'Apr 19, 2021 @ 14:10:05.309', '', ], ]; @@ -274,7 +274,7 @@ export default ({ getPageObjects, getService }: FtrProviderContext) => { 'windows 10.0', '10.192.213.130, 10.70.28.129', '6.6.1', - 'Jan 24, 2020 @ 16:06:09.541', + 'Apr 19, 2021 @ 14:10:05.309', '', ], [ @@ -285,7 +285,7 @@ export default ({ getPageObjects, getService }: FtrProviderContext) => { 'windows 10.0', '10.46.229.234', '6.0.0', - 'Jan 24, 2020 @ 16:06:09.541', + 'Apr 19, 2021 @ 14:10:05.309', '', ], ]; diff --git a/x-pack/test/security_solution_endpoint_api_int/apis/metadata.ts b/x-pack/test/security_solution_endpoint_api_int/apis/metadata.ts index 07b046b0a95f7..8dd5adba43edb 100644 --- a/x-pack/test/security_solution_endpoint_api_int/apis/metadata.ts +++ b/x-pack/test/security_solution_endpoint_api_int/apis/metadata.ts @@ -225,7 +225,7 @@ export default function ({ getService }: FtrProviderContext) { (ip: string) => ip === targetEndpointIp ); expect(resultIp).to.eql([targetEndpointIp]); - expect(body.hosts[0].metadata.event.created).to.eql(1579881969541); + expect(body.hosts[0].metadata.event.created).to.eql(1618841405309); expect(body.hosts.length).to.eql(1); expect(body.request_page_size).to.eql(10); expect(body.request_page_index).to.eql(0); @@ -268,7 +268,7 @@ export default function ({ getService }: FtrProviderContext) { const resultElasticAgentId: string = body.hosts[0].metadata.elastic.agent.id; expect(resultHostId).to.eql(targetEndpointId); expect(resultElasticAgentId).to.eql(targetElasticAgentId); - expect(body.hosts[0].metadata.event.created).to.eql(1579881969541); + expect(body.hosts[0].metadata.event.created).to.eql(1618841405309); expect(body.hosts[0].host_status).to.eql('unhealthy'); expect(body.hosts.length).to.eql(1); expect(body.request_page_size).to.eql(10); diff --git a/x-pack/test/security_solution_endpoint_api_int/apis/metadata_v1.ts b/x-pack/test/security_solution_endpoint_api_int/apis/metadata_v1.ts index 0e90b5c615c26..f3f86d4610d2b 100644 --- a/x-pack/test/security_solution_endpoint_api_int/apis/metadata_v1.ts +++ b/x-pack/test/security_solution_endpoint_api_int/apis/metadata_v1.ts @@ -214,7 +214,7 @@ export default function ({ getService }: FtrProviderContext) { (ip: string) => ip === targetEndpointIp ); expect(resultIp).to.eql([targetEndpointIp]); - expect(body.hosts[0].metadata.event.created).to.eql(1579881969541); + expect(body.hosts[0].metadata.event.created).to.eql(1618841405309); expect(body.hosts.length).to.eql(1); expect(body.request_page_size).to.eql(10); expect(body.request_page_index).to.eql(0); @@ -257,7 +257,7 @@ export default function ({ getService }: FtrProviderContext) { const resultElasticAgentId: string = body.hosts[0].metadata.elastic.agent.id; expect(resultHostId).to.eql(targetEndpointId); expect(resultElasticAgentId).to.eql(targetElasticAgentId); - expect(body.hosts[0].metadata.event.created).to.eql(1579881969541); + expect(body.hosts[0].metadata.event.created).to.eql(1618841405309); expect(body.hosts[0].host_status).to.eql('unhealthy'); expect(body.hosts.length).to.eql(1); expect(body.request_page_size).to.eql(10); diff --git a/yarn.lock b/yarn.lock index c1b0fe1d1be4a..f4d7684174967 100644 --- a/yarn.lock +++ b/yarn.lock @@ -326,7 +326,7 @@ chalk "^2.0.0" js-tokens "^4.0.0" -"@babel/parser@^7.1.0", "@babel/parser@^7.12.10", "@babel/parser@^7.12.11", "@babel/parser@^7.12.13", "@babel/parser@^7.12.3", "@babel/parser@^7.12.7", "@babel/parser@^7.13.0", "@babel/parser@^7.2.0", "@babel/parser@^7.4.5", "@babel/parser@^7.7.0": +"@babel/parser@^7.1.0", "@babel/parser@^7.12.10", "@babel/parser@^7.12.11", "@babel/parser@^7.12.13", "@babel/parser@^7.12.3", "@babel/parser@^7.12.7", "@babel/parser@^7.13.0", "@babel/parser@^7.4.5", "@babel/parser@^7.7.0": version "7.13.9" resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.13.9.tgz#ca34cb95e1c2dd126863a84465ae8ef66114be99" integrity sha512-nEUfRiARCcaVo3ny3ZQjURjHQZUo/JkEw7rLlSZy/psWGnvwXFtPcr6jb7Yb41DVW5LTe6KRq9LGleRNsg1Frw== @@ -1147,7 +1147,7 @@ dependencies: regenerator-runtime "^0.12.0" -"@babel/runtime@^7.0.0", "@babel/runtime@^7.1.2", "@babel/runtime@^7.10.2", "@babel/runtime@^7.10.3", "@babel/runtime@^7.11.2", "@babel/runtime@^7.12.5", "@babel/runtime@^7.3.1", "@babel/runtime@^7.4.4", "@babel/runtime@^7.4.5", "@babel/runtime@^7.5.0", "@babel/runtime@^7.5.4", "@babel/runtime@^7.5.5", "@babel/runtime@^7.6.2", "@babel/runtime@^7.6.3", "@babel/runtime@^7.7.2", "@babel/runtime@^7.7.6", "@babel/runtime@^7.8.4", "@babel/runtime@^7.8.7", "@babel/runtime@^7.9.2": +"@babel/runtime@^7.0.0", "@babel/runtime@^7.1.2", "@babel/runtime@^7.10.2", "@babel/runtime@^7.12.5", "@babel/runtime@^7.3.1", "@babel/runtime@^7.4.4", "@babel/runtime@^7.4.5", "@babel/runtime@^7.5.0", "@babel/runtime@^7.5.4", "@babel/runtime@^7.5.5", "@babel/runtime@^7.6.2", "@babel/runtime@^7.6.3", "@babel/runtime@^7.7.2", "@babel/runtime@^7.7.6", "@babel/runtime@^7.8.4", "@babel/runtime@^7.8.7", "@babel/runtime@^7.9.2": version "7.12.5" resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.12.5.tgz#410e7e487441e1b360c29be715d870d9b985882e" integrity sha512-plcc+hbExy3McchJCEQG3knOsuh3HH+Prx1P6cLIkET/0dLuQDEnrT+s27Axgc9bqfsmNUNHfscgMUdBpC9xfg== @@ -1163,7 +1163,7 @@ "@babel/parser" "^7.12.13" "@babel/types" "^7.12.13" -"@babel/traverse@^7.1.0", "@babel/traverse@^7.1.6", "@babel/traverse@^7.10.4", "@babel/traverse@^7.12.1", "@babel/traverse@^7.12.10", "@babel/traverse@^7.12.12", "@babel/traverse@^7.12.5", "@babel/traverse@^7.12.9", "@babel/traverse@^7.13.0", "@babel/traverse@^7.4.5", "@babel/traverse@^7.7.0": +"@babel/traverse@^7.1.0", "@babel/traverse@^7.10.4", "@babel/traverse@^7.12.1", "@babel/traverse@^7.12.10", "@babel/traverse@^7.12.12", "@babel/traverse@^7.12.5", "@babel/traverse@^7.12.9", "@babel/traverse@^7.13.0", "@babel/traverse@^7.4.5", "@babel/traverse@^7.7.0": version "7.13.0" resolved "https://registry.yarnpkg.com/@babel/traverse/-/traverse-7.13.0.tgz#6d95752475f86ee7ded06536de309a65fc8966cc" integrity sha512-xys5xi5JEhzC3RzEmSGrs/b3pJW/o87SypZ+G/PhaE7uqVQNv/jlmVIBXuoh5atqQ434LfXV+sf23Oxj0bchJQ== @@ -1178,7 +1178,7 @@ globals "^11.1.0" lodash "^4.17.19" -"@babel/types@^7.0.0", "@babel/types@^7.10.4", "@babel/types@^7.10.5", "@babel/types@^7.12.1", "@babel/types@^7.12.10", "@babel/types@^7.12.11", "@babel/types@^7.12.12", "@babel/types@^7.12.13", "@babel/types@^7.12.5", "@babel/types@^7.12.7", "@babel/types@^7.13.0", "@babel/types@^7.2.0", "@babel/types@^7.3.0", "@babel/types@^7.3.3", "@babel/types@^7.4.4", "@babel/types@^7.7.0": +"@babel/types@^7.0.0", "@babel/types@^7.10.4", "@babel/types@^7.10.5", "@babel/types@^7.12.1", "@babel/types@^7.12.10", "@babel/types@^7.12.11", "@babel/types@^7.12.12", "@babel/types@^7.12.13", "@babel/types@^7.12.5", "@babel/types@^7.12.7", "@babel/types@^7.13.0", "@babel/types@^7.3.0", "@babel/types@^7.3.3", "@babel/types@^7.4.4", "@babel/types@^7.7.0": version "7.13.0" resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.13.0.tgz#74424d2816f0171b4100f0ab34e9a374efdf7f80" integrity sha512-hE+HE8rnG1Z6Wzo+MhaKE5lM5eMx71T4EHJgku2E3xIfaULhDcxiiRxUYgwX8qwP1BBSlag+TdGOt6JAidIZTA== @@ -1192,10 +1192,10 @@ resolved "https://registry.yarnpkg.com/@base2/pretty-print-object/-/pretty-print-object-1.0.0.tgz#860ce718b0b73f4009e153541faff2cb6b85d047" integrity sha512-4Th98KlMHr5+JkxfcoDT//6vY8vM+iSPrLNpHhRyLx2CFYi8e2RfqPLdpbnpo0Q5lQC5hNB79yes07zb02fvCw== -"@bazel/ibazel@^0.14.0": - version "0.14.0" - resolved "https://registry.yarnpkg.com/@bazel/ibazel/-/ibazel-0.14.0.tgz#86fa0002bed2ce1123b7ad98d4dd4623a0d93244" - integrity sha512-s0gyec6lArcRDwVfIP6xpY8iEaFpzrSpyErSppd3r2O49pOEg7n6HGS/qJ8ncvme56vrDk6crl/kQ6VAdEO+rg== +"@bazel/ibazel@^0.15.10": + version "0.15.10" + resolved "https://registry.yarnpkg.com/@bazel/ibazel/-/ibazel-0.15.10.tgz#cf0cff1aec6d8e7bb23e1fc618d09fbd39b7a13f" + integrity sha512-0v+OwCQ6fsGFa50r6MXWbUkSGuWOoZ22K4pMSdtWiL5LKFIE4kfmMmtQS+M7/ICNwk2EIYob+NRreyi/DGUz5A== "@bazel/typescript@^3.2.3": version "3.2.3" @@ -1400,13 +1400,19 @@ pump "^3.0.0" secure-json-parse "^2.3.1" -"@elastic/ems-client@7.12.0": - version "7.12.0" - resolved "https://registry.yarnpkg.com/@elastic/ems-client/-/ems-client-7.12.0.tgz#cf83f5ad76e26cedfa6f5b91277d2d919b9423d1" - integrity sha512-Svv3boWL1n14nIt6tL9gaA9Ym1B4AwWl6ISZT62+uKM2G+imZxWLkqpQc/HHcf7TfuAmleF2NFwnT5vw2vZTpA== +"@elastic/ems-client@7.13.0": + version "7.13.0" + resolved "https://registry.yarnpkg.com/@elastic/ems-client/-/ems-client-7.13.0.tgz#de291a6eb25523e5844a9e74ae72fd2e81a1f4d9" + integrity sha512-VdK5jZdnC+5BSkMRQsqHqrsZ9HttnPjQmCjRlAGuV8y6g0eKVP9ZiMRQFKFKmuSKpx0kHGsSV/1kBglTmSl/3g== dependencies: + "@types/geojson" "^7946.0.7" + "@types/lru-cache" "^5.1.0" + "@types/topojson-client" "^3.0.0" + "@types/topojson-specification" "^1.0.1" lodash "^4.17.15" + lru-cache "^6.0.0" semver "7.3.2" + topojson-client "^3.1.0" "@elastic/eslint-config-kibana@link:packages/elastic-eslint-config-kibana": version "0.0.0" @@ -1417,10 +1423,10 @@ resolved "https://registry.yarnpkg.com/@elastic/eslint-plugin-eui/-/eslint-plugin-eui-0.0.2.tgz#56b9ef03984a05cc213772ae3713ea8ef47b0314" integrity sha512-IoxURM5zraoQ7C8f+mJb9HYSENiZGgRVcG4tLQxE61yHNNRDXtGDWTZh8N1KIHcsqN1CEPETjuzBXkJYF/fDiQ== -"@elastic/eui@32.0.4": - version "32.0.4" - resolved "https://registry.yarnpkg.com/@elastic/eui/-/eui-32.0.4.tgz#46c001abb162e494e2c11ea48def840b5520f1dc" - integrity sha512-NL+bzzxAB6t/BPwaXqELIAWT0wZMcHyciAq+dGS44n7ZYbGzlDgTf77hlvwUsdDhFPhpMyFHJ55rE6ZtqBX/+w== +"@elastic/eui@32.1.0": + version "32.1.0" + resolved "https://registry.yarnpkg.com/@elastic/eui/-/eui-32.1.0.tgz#065a91162962e187f42365557684db8b54b37407" + integrity sha512-a1Q70lwFO2MrFTITRWmApZUbQKhkUrKeXrvCdQoUCP4+ZiFsdk80R6ruXVW3kgrULCOtDKJQS1Bt9pfl+13sJw== dependencies: "@types/chroma-js" "^2.0.0" "@types/lodash" "^4.14.160" @@ -2065,7 +2071,7 @@ chalk "^2.0.1" slash "^2.0.0" -"@jest/console@^26.5.2", "@jest/console@^26.6.2": +"@jest/console@^26.6.2": version "26.6.2" resolved "https://registry.yarnpkg.com/@jest/console/-/console-26.6.2.tgz#4e04bc464014358b03ab4937805ee36a0aeb98f2" integrity sha512-IY1R2i2aLsLr7Id3S6p2BA82GNWryt4oSvEXLAKc+L2zdi89dSkE8xC1C+0kpATG4JhBJREnQOH7/zmccM2B0g== @@ -2121,15 +2127,6 @@ "@types/node" "*" jest-mock "^26.6.2" -"@jest/fake-timers@^24.9.0": - version "24.9.0" - resolved "https://registry.yarnpkg.com/@jest/fake-timers/-/fake-timers-24.9.0.tgz#ba3e6bf0eecd09a636049896434d306636540c93" - integrity sha512-eWQcNa2YSwzXWIMC5KufBh3oWRIijrQFROsIqt6v/NS9Io/gknw1jsAC9c+ih/RQX4A3O7SeWAhQeN0goKhT9A== - dependencies: - "@jest/types" "^24.9.0" - jest-message-util "^24.9.0" - jest-mock "^24.9.0" - "@jest/fake-timers@^26.6.2": version "26.6.2" resolved "https://registry.yarnpkg.com/@jest/fake-timers/-/fake-timers-26.6.2.tgz#459c329bcf70cee4af4d7e3f3e67848123535aad" @@ -2151,38 +2148,6 @@ "@jest/types" "^26.6.2" expect "^26.6.2" -"@jest/reporters@^26.5.2": - version "26.5.3" - resolved "https://registry.yarnpkg.com/@jest/reporters/-/reporters-26.5.3.tgz#e810e9c2b670f33f1c09e9975749260ca12f1c17" - integrity sha512-X+vR0CpfMQzYcYmMFKNY9n4jklcb14Kffffp7+H/MqitWnb0440bW2L76NGWKAa+bnXhNoZr+lCVtdtPmfJVOQ== - dependencies: - "@bcoe/v8-coverage" "^0.2.3" - "@jest/console" "^26.5.2" - "@jest/test-result" "^26.5.2" - "@jest/transform" "^26.5.2" - "@jest/types" "^26.5.2" - chalk "^4.0.0" - collect-v8-coverage "^1.0.0" - exit "^0.1.2" - glob "^7.1.2" - graceful-fs "^4.2.4" - istanbul-lib-coverage "^3.0.0" - istanbul-lib-instrument "^4.0.3" - istanbul-lib-report "^3.0.0" - istanbul-lib-source-maps "^4.0.0" - istanbul-reports "^3.0.2" - jest-haste-map "^26.5.2" - jest-resolve "^26.5.2" - jest-util "^26.5.2" - jest-worker "^26.5.0" - slash "^3.0.0" - source-map "^0.6.0" - string-length "^4.0.1" - terminal-link "^2.0.0" - v8-to-istanbul "^6.0.1" - optionalDependencies: - node-notifier "^8.0.0" - "@jest/reporters@^26.6.2": version "26.6.2" resolved "https://registry.yarnpkg.com/@jest/reporters/-/reporters-26.6.2.tgz#1f518b99637a5f18307bd3ecf9275f6882a667f6" @@ -2242,7 +2207,7 @@ "@jest/types" "^24.9.0" "@types/istanbul-lib-coverage" "^2.0.0" -"@jest/test-result@^26.5.2", "@jest/test-result@^26.6.2": +"@jest/test-result@^26.6.2": version "26.6.2" resolved "https://registry.yarnpkg.com/@jest/test-result/-/test-result-26.6.2.tgz#55da58b62df134576cc95476efa5f7949e3f5f18" integrity sha512-5O7H5c/7YlojphYNrK02LlDIV2GNPYisKwHm2QTKjNZeEzezCbwYs9swJySv2UfPMyZ0VdsmMv7jIlD/IKYQpQ== @@ -2263,7 +2228,7 @@ jest-runner "^26.6.3" jest-runtime "^26.6.3" -"@jest/transform@^26.0.0", "@jest/transform@^26.5.2", "@jest/transform@^26.6.2": +"@jest/transform@^26.0.0", "@jest/transform@^26.6.2": version "26.6.2" resolved "https://registry.yarnpkg.com/@jest/transform/-/transform-26.6.2.tgz#5ac57c5fa1ad17b2aae83e73e45813894dcf2e4b" integrity sha512-E9JjhUgNzvuQ+vVAL21vlyfy12gP0GhazGgJC4h6qUt1jSdUXGWJ1wfu/X7Sd8etSgxV4ovT1pb9v5D6QW4XgA== @@ -2303,7 +2268,7 @@ "@types/yargs" "^15.0.0" chalk "^3.0.0" -"@jest/types@^26.5.2", "@jest/types@^26.6.2": +"@jest/types@^26.6.2": version "26.6.2" resolved "https://registry.yarnpkg.com/@jest/types/-/types-26.6.2.tgz#bef5a532030e1d88a2f5a6d933f84e97226ed48e" integrity sha512-fC6QCp7Sc5sX6g8Tvbmj4XUTbyrik0akgRy03yjXbQaBWWNWGE7SGtJk98m0N8nzegD/7SggrUlivxo5ax4KWQ== @@ -2720,7 +2685,7 @@ version "0.0.0" uid "" -"@kbn/std@link:packages/kbn-std": +"@kbn/std@link:bazel-bin/packages/kbn-std/npm_module": version "0.0.0" uid "" @@ -4286,23 +4251,24 @@ resolved "https://registry.yarnpkg.com/@testim/chrome-version/-/chrome-version-1.0.7.tgz#0cd915785ec4190f08a3a6acc9b61fc38fb5f1a9" integrity sha512-8UT/J+xqCYfn3fKtOznAibsHpiuDshCb0fwgWxRazTT19Igp9ovoXMPhXyLD6m3CKQGTMHgqoxaFfMWaL40Rnw== -"@testing-library/dom@^7.24.2": - version "7.24.2" - resolved "https://registry.yarnpkg.com/@testing-library/dom/-/dom-7.24.2.tgz#6d2b7dd21efbd5358b98c2777fc47c252f3ae55e" - integrity sha512-ERxcZSoHx0EcN4HfshySEWmEf5Kkmgi+J7O79yCJ3xggzVlBJ2w/QjJUC+EBkJJ2OeSw48i3IoePN4w8JlVUIA== +"@testing-library/dom@^7.28.1", "@testing-library/dom@^7.30.3": + version "7.30.3" + resolved "https://registry.yarnpkg.com/@testing-library/dom/-/dom-7.30.3.tgz#779ea9bbb92d63302461800a388a5a890ac22519" + integrity sha512-7JhIg2MW6WPwyikH2iL3o7z+FTVgSOd2jqCwTAHqK7Qal2gRRYiUQyURAxtbK9VXm/UTyG9bRihv8C5Tznr2zw== dependencies: "@babel/code-frame" "^7.10.4" - "@babel/runtime" "^7.10.3" + "@babel/runtime" "^7.12.5" "@types/aria-query" "^4.2.0" aria-query "^4.2.2" chalk "^4.1.0" - dom-accessibility-api "^0.5.1" - pretty-format "^26.4.2" + dom-accessibility-api "^0.5.4" + lz-string "^1.4.4" + pretty-format "^26.6.2" -"@testing-library/jest-dom@^5.11.4": - version "5.11.4" - resolved "https://registry.yarnpkg.com/@testing-library/jest-dom/-/jest-dom-5.11.4.tgz#f325c600db352afb92995c2576022b35621ddc99" - integrity sha512-6RRn3epuweBODDIv3dAlWjOEHQLpGJHB2i912VS3JQtsD22+ENInhdDNl4ZZQiViLlIfFinkSET/J736ytV9sw== +"@testing-library/jest-dom@^5.11.10": + version "5.11.10" + resolved "https://registry.yarnpkg.com/@testing-library/jest-dom/-/jest-dom-5.11.10.tgz#1cd90715023e1627f5ed26ab3b38e6f22d77046c" + integrity sha512-FuKiq5xuk44Fqm0000Z9w0hjOdwZRNzgx7xGGxQYepWFZy+OYUMOT/wPI4nLYXCaVltNVpU1W/qmD88wLWDsqQ== dependencies: "@babel/runtime" "^7.9.2" "@types/testing-library__jest-dom" "^5.9.1" @@ -4313,28 +4279,32 @@ lodash "^4.17.15" redent "^3.0.0" -"@testing-library/react-hooks@^3.4.1": - version "3.4.1" - resolved "https://registry.yarnpkg.com/@testing-library/react-hooks/-/react-hooks-3.4.1.tgz#1f8ccd21208086ec228d9743fe40b69d0efcd7e5" - integrity sha512-LbzvE7oKsVzuW1cxA/aOeNgeVvmHWG2p/WSzalIGyWuqZT3jVcNDT5KPEwy36sUYWde0Qsh32xqIUFXukeywXg== +"@testing-library/react-hooks@*", "@testing-library/react-hooks@^5.1.1": + version "5.1.1" + resolved "https://registry.yarnpkg.com/@testing-library/react-hooks/-/react-hooks-5.1.1.tgz#1fbaae8a4e8a4a7f97b176c23e1e890c41bbbfa5" + integrity sha512-52D2XnpelFDefnWpy/V6z2qGNj8JLIvW5DjYtelMvFXdEyWiykSaI7IXHwFy4ICoqXJDmmwHAiFRiFboub/U5g== dependencies: - "@babel/runtime" "^7.5.4" - "@types/testing-library__react-hooks" "^3.3.0" + "@babel/runtime" "^7.12.5" + "@types/react" ">=16.9.0" + "@types/react-dom" ">=16.9.0" + "@types/react-test-renderer" ">=16.9.0" + filter-console "^0.1.1" + react-error-boundary "^3.1.0" -"@testing-library/react@^11.0.4": - version "11.0.4" - resolved "https://registry.yarnpkg.com/@testing-library/react/-/react-11.0.4.tgz#c84082bfe1593d8fcd475d46baee024452f31dee" - integrity sha512-U0fZO2zxm7M0CB5h1+lh31lbAwMSmDMEMGpMT3BUPJwIjDEKYWOV4dx7lb3x2Ue0Pyt77gmz/VropuJnSz/Iew== +"@testing-library/react@^11.2.6": + version "11.2.6" + resolved "https://registry.yarnpkg.com/@testing-library/react/-/react-11.2.6.tgz#586a23adc63615985d85be0c903f374dab19200b" + integrity sha512-TXMCg0jT8xmuU8BkKMtp8l7Z50Ykew5WNX8UoIKTaLFwKkP2+1YDhOLA2Ga3wY4x29jyntk7EWfum0kjlYiSjQ== dependencies: - "@babel/runtime" "^7.11.2" - "@testing-library/dom" "^7.24.2" + "@babel/runtime" "^7.12.5" + "@testing-library/dom" "^7.28.1" -"@testing-library/user-event@^12.1.6": - version "12.1.6" - resolved "https://registry.yarnpkg.com/@testing-library/user-event/-/user-event-12.1.6.tgz#f550b138dfdc20387b89cbe3e9f3d969ab10c2bd" - integrity sha512-BdSe6cmzDEapTBH3s1NKbzu+GyX5bJKraKwVpM2vZF1+EEWxZr0EiA0z9bA5Nux8P+6nKMOZKsXQrj5q/kicfQ== +"@testing-library/user-event@^13.1.1": + version "13.1.1" + resolved "https://registry.yarnpkg.com/@testing-library/user-event/-/user-event-13.1.1.tgz#1e011de944cf4d2a917cef6c3046c26389943e24" + integrity sha512-B4roX+0mpXKGj8ndd38YoIo3IV9pmTTWxr/2cOke5apTtrNabEUE0KMBccpcAcYlfPcr7uMu+dxeeC3HdXd9qQ== dependencies: - "@babel/runtime" "^7.10.2" + "@babel/runtime" "^7.12.5" "@ts-morph/common@~0.7.0": version "0.7.3" @@ -4536,16 +4506,6 @@ resolved "https://registry.yarnpkg.com/@types/aria-query/-/aria-query-4.2.0.tgz#14264692a9d6e2fa4db3df5e56e94b5e25647ac0" integrity sha512-iIgQNzCm0v7QMhhe4Jjn9uRh+I6GoPmt03CbEtwx3ao8/EfoQcmgtqH4vQ5Db/lxiIGaWDv6nwvunuh0RyX0+A== -"@types/async@2.0.49": - version "2.0.49" - resolved "https://registry.yarnpkg.com/@types/async/-/async-2.0.49.tgz#92e33d13f74c895cb9a7f38ba97db8431ed14bc0" - integrity sha512-Benr3i5odUkvpFkOpzGqrltGdbSs+EVCkEBGXbuR7uT0VzhXKIkhem6PDzHdx5EonA+rfbB3QvP6aDOw5+zp5Q== - -"@types/babel-types@*": - version "7.0.4" - resolved "https://registry.yarnpkg.com/@types/babel-types/-/babel-types-7.0.4.tgz#bfd5b0d0d1ba13e351dff65b6e52783b816826c8" - integrity sha512-WiZhq3SVJHFRgRYLXvpf65XnV6ipVHhnNaNvE8yCimejrGglkg38kEj0JcizqwSHxmPSjcTlig/6JouxLGEhGw== - "@types/babel__core@^7.0.0", "@types/babel__core@^7.1.7": version "7.1.10" resolved "https://registry.yarnpkg.com/@types/babel__core/-/babel__core-7.1.10.tgz#ca58fc195dd9734e77e57c6f2df565623636ab40" @@ -4590,13 +4550,6 @@ dependencies: "@babel/types" "^7.3.0" -"@types/babylon@6.16.5": - version "6.16.5" - resolved "https://registry.yarnpkg.com/@types/babylon/-/babylon-6.16.5.tgz#1c5641db69eb8cdf378edd25b4be7754beeb48b4" - integrity sha512-xH2e58elpj1X4ynnKp9qSnWlsRTIs6n3tgLGNfwAGHwePw0mulHQllV34n0T25uYSu1k0hRKkWXF890B1yS47w== - dependencies: - "@types/babel-types" "*" - "@types/base64-js@^1.2.5": version "1.2.5" resolved "https://registry.yarnpkg.com/@types/base64-js/-/base64-js-1.2.5.tgz#582b2476169a6cba460a214d476c744441d873d5" @@ -4632,10 +4585,12 @@ resolved "https://registry.yarnpkg.com/@types/chance/-/chance-1.0.1.tgz#c10703020369602c40dd9428cc6e1437027116df" integrity sha512-jtV6Bv/j+xk4gcXeLlESwNc/m/I/dIZA0xrt29g0uKcjyPob8iisj/5z0ARE+Ldfx4MxjNFNECG0z++J7zJgqg== -"@types/cheerio@*", "@types/cheerio@^0.22.10": - version "0.22.10" - resolved "https://registry.yarnpkg.com/@types/cheerio/-/cheerio-0.22.10.tgz#780d552467824be4a241b29510a7873a7432c4a6" - integrity sha512-fOM/Jhv51iyugY7KOBZz2ThfT1gwvsGCfWxpLpZDgkGjpEO4Le9cld07OdskikLjDUQJ43dzDaVRSFwQlpdqVg== +"@types/cheerio@*", "@types/cheerio@^0.22.22", "@types/cheerio@^0.22.28": + version "0.22.28" + resolved "https://registry.yarnpkg.com/@types/cheerio/-/cheerio-0.22.28.tgz#90808aabb44fec40fa2950f4c72351e3e4eb065b" + integrity sha512-ehUMGSW5IeDxJjbru4awKYMlKGmo1wSSGUVqXtYwlgmUM8X1a0PZttEIm6yEY7vHsY/hh6iPnklF213G0UColw== + dependencies: + "@types/node" "*" "@types/chroma-js@^1.4.2": version "1.4.2" @@ -4774,10 +4729,10 @@ resolved "https://registry.yarnpkg.com/@types/elasticsearch/-/elasticsearch-5.0.33.tgz#b0fd37dc674f498223b6d68c313bdfd71f4d812b" integrity sha512-n/g9pqJEpE4fyUE8VvHNGtl7E2Wv8TCroNwfgAeJKRV4ghDENahtrAo1KMsFNIejBD2gDAlEUa4CM4oEEd8p9Q== -"@types/enzyme@^3.10.5": - version "3.10.5" - resolved "https://registry.yarnpkg.com/@types/enzyme/-/enzyme-3.10.5.tgz#fe7eeba3550369eed20e7fb565bfb74eec44f1f0" - integrity sha512-R+phe509UuUYy9Tk0YlSbipRpfVtIzb/9BHn5pTEtjJTF5LXvUjrIQcZvNyANNEyFrd2YGs196PniNT1fgvOQA== +"@types/enzyme@^3.10.8": + version "3.10.8" + resolved "https://registry.yarnpkg.com/@types/enzyme/-/enzyme-3.10.8.tgz#ad7ac9d3af3de6fd0673773123fafbc63db50d42" + integrity sha512-vlOuzqsTHxog6PV79+tvOHFb6hq4QZKMq1lLD9MaWD1oec2lHTKndn76XOpSwCA0oFTaIbKVPrgM3k78Jjd16g== dependencies: "@types/cheerio" "*" "@types/react" "*" @@ -4844,7 +4799,7 @@ dependencies: "@types/node" "*" -"@types/geojson@*", "@types/geojson@7946.0.7": +"@types/geojson@*", "@types/geojson@7946.0.7", "@types/geojson@^7946.0.7": version "7946.0.7" resolved "https://registry.yarnpkg.com/@types/geojson/-/geojson-7946.0.7.tgz#c8fa532b60a0042219cdf173ca21a975ef0666ad" integrity sha512-wE2v81i4C4Ol09RtsWFAqg3BUitWbHSpSlIo+bNdsCJijO9sjme+zm+73ZMCa/qMC8UEERxzGbvmr1cffo2SiQ== @@ -4892,11 +4847,6 @@ dependencies: "@types/node" "*" -"@types/graphql@^0.13.2": - version "0.13.4" - resolved "https://registry.yarnpkg.com/@types/graphql/-/graphql-0.13.4.tgz#55ae9c29f0fd6b85ee536f5c72b4769d5c5e06b1" - integrity sha512-B4yel4ro2nTb3v0pYO8vO6SjgvFJSrwUY+IO6TUSLdOSB+gQFslylrhRCHxvXMIhxB71mv5PEE9dAX+24S8sew== - "@types/gulp-zip@^4.0.1": version "4.0.1" resolved "https://registry.yarnpkg.com/@types/gulp-zip/-/gulp-zip-4.0.1.tgz#96cd0b994219f9ae3bbbec7ec3baa043fba9d9ef" @@ -5052,11 +5002,6 @@ resolved "https://registry.yarnpkg.com/@types/is-function/-/is-function-1.0.0.tgz#1b0b819b1636c7baf0d6785d030d12edf70c3e83" integrity sha512-iTs9HReBu7evG77Q4EC8hZnqRt57irBDkK9nvmHroiOIVwYMQc4IvYvdRgwKfYepunIY7Oh/dBuuld+Gj9uo6w== -"@types/is-glob@4.0.0": - version "4.0.0" - resolved "https://registry.yarnpkg.com/@types/is-glob/-/is-glob-4.0.0.tgz#fb8a2bff539025d4dcd6d5efe7689e03341b876d" - integrity sha512-zC/2EmD8scdsGIeE+Xg7kP7oi9VP90zgMQtm9Cr25av4V+a+k8slQyiT60qSw8KORYrOKlPXfHwoa1bQbRzskQ== - "@types/istanbul-lib-coverage@*", "@types/istanbul-lib-coverage@^2.0.0", "@types/istanbul-lib-coverage@^2.0.1": version "2.0.1" resolved "https://registry.yarnpkg.com/@types/istanbul-lib-coverage/-/istanbul-lib-coverage-2.0.1.tgz#42995b446db9a48a11a07ec083499a860e9138ff" @@ -5084,27 +5029,27 @@ dependencies: "@types/istanbul-lib-report" "*" -"@types/jest-specific-snapshot@^0.5.3", "@types/jest-specific-snapshot@^0.5.4": - version "0.5.4" - resolved "https://registry.yarnpkg.com/@types/jest-specific-snapshot/-/jest-specific-snapshot-0.5.4.tgz#997364c39a59ddeff0ee790a19415e79dd061d1e" - integrity sha512-1qISn4fH8wkOOPFEx+uWRRjw6m/pP/It3OHLm8Ee1KQpO7Z9ZGYDtWPU5AgK05UXsNTAgOK+dPQvJKGdy9E/1g== +"@types/jest-specific-snapshot@^0.5.3", "@types/jest-specific-snapshot@^0.5.5": + version "0.5.5" + resolved "https://registry.yarnpkg.com/@types/jest-specific-snapshot/-/jest-specific-snapshot-0.5.5.tgz#47ce738870be99898ed6d7b08dbf0240c74ae553" + integrity sha512-AaPPw2tE8ewfjD6qGLkEd4DOfM6pPOK7ob/RSOe1Z8Oo70r9Jgo0SlWyfxslPAOvLfQukQtiVPm6DcnjSoZU5A== dependencies: "@types/jest" "*" -"@types/jest-when@^2.7.1": - version "2.7.1" - resolved "https://registry.yarnpkg.com/@types/jest-when/-/jest-when-2.7.1.tgz#0b04a33a48a17370c390e9830a975822b3ac5e32" - integrity sha512-PRrGzDkU859cdkFL2KwWN4fRLRDGIUkRNT0StbthhKmj+naU4wImpoJeMnhjprvSou4pKAzU0dKfdQvjceJVhg== +"@types/jest-when@^2.7.2": + version "2.7.2" + resolved "https://registry.yarnpkg.com/@types/jest-when/-/jest-when-2.7.2.tgz#619fbc5f623bcd0b29efde0e4993c7f0d50d026d" + integrity sha512-vOtj0cev6vO1VX7Jbfg/qvy+sfLI64STsHbKVkggK+1kd11rcMGzFpZKBxUvQfsm4JRULCBISu+qrfs7fYZFGg== dependencies: "@types/jest" "*" -"@types/jest@*", "@types/jest@^26.0.14": - version "26.0.14" - resolved "https://registry.yarnpkg.com/@types/jest/-/jest-26.0.14.tgz#078695f8f65cb55c5a98450d65083b2b73e5a3f3" - integrity sha512-Hz5q8Vu0D288x3iWXePSn53W7hAjP0H7EQ6QvDO9c7t46mR0lNOLlfuwQ+JkVxuhygHzlzPX+0jKdA3ZgSh+Vg== +"@types/jest@*", "@types/jest@^26.0.22": + version "26.0.22" + resolved "https://registry.yarnpkg.com/@types/jest/-/jest-26.0.22.tgz#8308a1debdf1b807aa47be2838acdcd91e88fbe6" + integrity sha512-eeWwWjlqxvBxc4oQdkueW5OF/gtfSceKk4OnOAGlUSwS/liBRtZppbJuz1YkgbrbfGOoeBHun9fOvXnjNwrSOw== dependencies: - jest-diff "^25.2.1" - pretty-format "^25.2.1" + jest-diff "^26.0.0" + pretty-format "^26.0.0" "@types/jest@^25.1.1": version "25.2.3" @@ -5398,7 +5343,7 @@ dependencies: "@types/node" "*" -"@types/node@*", "@types/node@12.12.50", "@types/node@14.14.14", "@types/node@8.10.54", "@types/node@>= 8", "@types/node@>=8.9.0", "@types/node@^10.1.0", "@types/node@^12.0.2": +"@types/node@*", "@types/node@12.12.50", "@types/node@14.14.14", "@types/node@8.10.54", "@types/node@>= 8", "@types/node@>=8.9.0", "@types/node@^10.1.0": version "14.14.14" resolved "https://registry.yarnpkg.com/@types/node/-/node-14.14.14.tgz#f7fd5f3cc8521301119f63910f0fb965c7d761ae" integrity sha512-UHnOPWVWV1z+VV8k6L1HhG7UbGBgIdghqF3l9Ny9ApPghbjICXkUJSd/b9gOgQfjM1r+37cipdw/HJ3F6ICEnQ== @@ -5505,11 +5450,6 @@ dependencies: "@types/node" "*" -"@types/prettier@1.16.1": - version "1.16.1" - resolved "https://registry.yarnpkg.com/@types/prettier/-/prettier-1.16.1.tgz#328d1c9b54402e44119398bcb6a31b7bbd606d59" - integrity sha512-db6pZL5QY3JrlCHBhYQzYDci0xnoDuxfseUuguLRr3JNk+bnCfpkK6p8quiUDyO8A0vbpBKkk59Fw125etrNeA== - "@types/prettier@^2.0.0": version "2.0.2" resolved "https://registry.yarnpkg.com/@types/prettier/-/prettier-2.0.2.tgz#5bb52ee68d0f8efa9cc0099920e56be6cc4e37f3" @@ -5585,7 +5525,7 @@ dependencies: "@types/react" "*" -"@types/react-dom@^16.9.8": +"@types/react-dom@>=16.9.0", "@types/react-dom@^16.9.8": version "16.9.8" resolved "https://registry.yarnpkg.com/@types/react-dom/-/react-dom-16.9.8.tgz#fe4c1e11dfc67155733dfa6aa65108b4971cb423" integrity sha512-ykkPQ+5nFknnlU6lDd947WbQ6TE3NNzbQAkInC2EKY1qeYdTKp7onFusmYZb+ityzx2YviqT6BXSu+LyWWJwcA== @@ -5660,7 +5600,7 @@ dependencies: "@types/react" "*" -"@types/react-test-renderer@*", "@types/react-test-renderer@^16.9.1": +"@types/react-test-renderer@>=16.9.0", "@types/react-test-renderer@^16.9.1": version "16.9.1" resolved "https://registry.yarnpkg.com/@types/react-test-renderer/-/react-test-renderer-16.9.1.tgz#9d432c46c515ebe50c45fa92c6fb5acdc22e39c4" integrity sha512-nCXQokZN1jp+QkoDNmDZwoWpKY8HDczqevIDO4Uv9/s9rbGPbSpy8Uaxa5ixHKkcm/Wt0Y9C3wCxZivh4Al+rQ== @@ -5689,7 +5629,7 @@ dependencies: "@types/react" "*" -"@types/react@*", "@types/react@^16.9.36": +"@types/react@*", "@types/react@>=16.9.0", "@types/react@^16.9.36": version "16.9.36" resolved "https://registry.yarnpkg.com/@types/react/-/react-16.9.36.tgz#ade589ff51e2a903e34ee4669e05dbfa0c1ce849" integrity sha512-mGgUb/Rk/vGx4NCvquRuSH0GHBQKb1OqpGS9cT9lFxlTLHZgkksgI60TuIxubmn7JuCb+sENHhQciqa0npm0AQ== @@ -5880,19 +5820,19 @@ resolved "https://registry.yarnpkg.com/@types/tempy/-/tempy-0.2.0.tgz#8b7a93f6912aef25cc0b8d8a80ff974151478685" integrity sha512-YaX74QljqR45Xu7dd22wMvzTS+ItUiSyDl9XJl6WTgYNE09r2TF+mV2FDjWRM5Sdzf9C9dXRTUdz9J5SoEYxXg== -"@types/testing-library__jest-dom@^5.9.1", "@types/testing-library__jest-dom@^5.9.3": - version "5.9.3" - resolved "https://registry.yarnpkg.com/@types/testing-library__jest-dom/-/testing-library__jest-dom-5.9.3.tgz#574039e210140a536c6ec891063289fb742a75eb" - integrity sha512-5YxiCFA2vk0cxq2LIxYgHBpFlnJvMH9bkUIVNin+1GXT+LZgVOgXBeEyyo2ZrGXMO/KWe1ZV3p7Kb6LJAvJasw== +"@types/testing-library__jest-dom@^5.9.1", "@types/testing-library__jest-dom@^5.9.5": + version "5.9.5" + resolved "https://registry.yarnpkg.com/@types/testing-library__jest-dom/-/testing-library__jest-dom-5.9.5.tgz#5bf25c91ad2d7b38f264b12275e5c92a66d849b0" + integrity sha512-ggn3ws+yRbOHog9GxnXiEZ/35Mow6YtPZpd7Z5mKDeZS/o7zx3yAle0ov/wjhVB5QT4N2Dt+GNoGCdqkBGCajQ== dependencies: "@types/jest" "*" -"@types/testing-library__react-hooks@^3.3.0", "@types/testing-library__react-hooks@^3.4.0": - version "3.4.0" - resolved "https://registry.yarnpkg.com/@types/testing-library__react-hooks/-/testing-library__react-hooks-3.4.0.tgz#be148b7fa7d19cd3349c4ef9d9534486bc582fcc" - integrity sha512-QYLZipqt1hpwYsBU63Ssa557v5wWbncqL36No59LI7W3nCMYKrLWTnYGn2griZ6v/3n5nKXNYkTeYpqPHY7Ukg== +"@types/testing-library__react-hooks@^4.0.0": + version "4.0.0" + resolved "https://registry.yarnpkg.com/@types/testing-library__react-hooks/-/testing-library__react-hooks-4.0.0.tgz#2612eabbbb762968985fc1aa35f979caaa78f118" + integrity sha512-UzZUXthQtVjDruR2YA+hqg9ux5AfmZ8Kaw+QDungax+T7wb/5NC4x7YOpIqRx7oY3KksGQ69bzNE/xwzb5NslQ== dependencies: - "@types/react-test-renderer" "*" + "@testing-library/react-hooks" "*" "@types/through@*": version "0.0.30" @@ -5906,6 +5846,21 @@ resolved "https://registry.yarnpkg.com/@types/tinycolor2/-/tinycolor2-1.4.2.tgz#721ca5c5d1a2988b4a886e35c2ffc5735b6afbdf" integrity sha512-PeHg/AtdW6aaIO2a+98Xj7rWY4KC1E6yOy7AFknJQ7VXUGNrMlyxDFxJo7HqLtjQms/ZhhQX52mLVW/EX3JGOw== +"@types/topojson-client@^3.0.0": + version "3.1.0" + resolved "https://registry.yarnpkg.com/@types/topojson-client/-/topojson-client-3.1.0.tgz#2fd96d5e64f4f512742f22194f3e1e0443c27233" + integrity sha512-wmjTmMkF6k6m3Tn4mIyRjw8KUQZLHB1TxNcpGYirvV/aCINkC0eMJsUO/OPMkKIB6VO5iA6Vp39bmAq6QgvSfA== + dependencies: + "@types/geojson" "*" + "@types/topojson-specification" "*" + +"@types/topojson-specification@*", "@types/topojson-specification@^1.0.1": + version "1.0.1" + resolved "https://registry.yarnpkg.com/@types/topojson-specification/-/topojson-specification-1.0.1.tgz#a80cb294290b79f2d674d3f5938c544ed2bd9d80" + integrity sha512-ZZYZUgkmUls9Uhxx2WZNt9f/h2+H3abUUjOVmq+AaaDFckC5oAwd+MDp95kBirk+XCXrYj0hfpI6DSUiJMrpYQ== + dependencies: + "@types/geojson" "*" + "@types/tough-cookie@*": version "2.3.5" resolved "https://registry.yarnpkg.com/@types/tough-cookie/-/tough-cookie-2.3.5.tgz#9da44ed75571999b65c37b60c9b2b88db54c585d" @@ -5954,11 +5909,6 @@ dependencies: "@types/node" "*" -"@types/valid-url@1.0.2": - version "1.0.2" - resolved "https://registry.yarnpkg.com/@types/valid-url/-/valid-url-1.0.2.tgz#60fa435ce24bfd5ba107b8d2a80796aeaf3a8f45" - integrity sha1-YPpDXOJL/VuhB7jSqAeWrq86j0U= - "@types/vfile-message@^2.0.0": version "2.0.0" resolved "https://registry.yarnpkg.com/@types/vfile-message/-/vfile-message-2.0.0.tgz#690e46af0fdfc1f9faae00cd049cc888957927d5" @@ -6349,21 +6299,6 @@ resolved "https://registry.yarnpkg.com/@wildpeaks/snapshot-dom/-/snapshot-dom-1.6.0.tgz#83297612bf93b97983beafbe6ae71672642ac884" integrity sha512-fCM5tYK6VZ1nhbk3Q11lkf6UOJlOCRU0oScQ8NV8OYBPC58wQmQaOF9g+rk+yhNYf3beybOBr+ZuiNen3B0Bxw== -"@wry/context@^0.4.0": - version "0.4.1" - resolved "https://registry.yarnpkg.com/@wry/context/-/context-0.4.1.tgz#b3e23ca036035cbad0bd9711269352dd03a6fe3c" - integrity sha512-ZpIrDGek+IU9wkID/TYSgcYeLXsSM2VkbfAxO4NjWBGeM/OrA9KyNmy8msYlAEKPmKxi3mIbXg3jcb3f6pqnaQ== - dependencies: - "@types/node" "^12.0.2" - tslib "^1.9.3" - -"@wry/equality@^0.1.2": - version "0.1.9" - resolved "https://registry.yarnpkg.com/@wry/equality/-/equality-0.1.9.tgz#b13e18b7a8053c6858aa6c85b54911fb31e3a909" - integrity sha512-mB6ceGjpMGz1ZTza8HYnrPGos2mC6So4NhS1PtZ8s4Qt0K7fBiIGhpSxUbQmhwcSWE3no+bYxmI2OL6KuXYmoQ== - dependencies: - tslib "^1.9.3" - "@xobotyi/scrollbar-width@1.9.5": version "1.9.5" resolved "https://registry.yarnpkg.com/@xobotyi/scrollbar-width/-/scrollbar-width-1.9.5.tgz#80224a6919272f405b87913ca13b92929bdf3c4d" @@ -6531,14 +6466,6 @@ agentkeepalive@^3.4.1: dependencies: humanize-ms "^1.2.1" -aggregate-error@2.1.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/aggregate-error/-/aggregate-error-2.1.0.tgz#051a9a733ad2e95ab503d84fb81989e6419b8f09" - integrity sha512-rIZJqC4XACGWwmPpi18IhDjIzXTJ93KQwYHXuyMCa0Ak9mtzLIbykuei+0i5EnGDy6ts8JVnSyRnZc2cVIMvVg== - dependencies: - clean-stack "^2.0.0" - indent-string "^3.0.0" - aggregate-error@^3.0.0: version "3.0.1" resolved "https://registry.yarnpkg.com/aggregate-error/-/aggregate-error-3.0.1.tgz#db2fe7246e536f40d9b5442a39e117d7dd6a24e0" @@ -6578,21 +6505,20 @@ airbnb-js-shims@^2.2.1: string.prototype.padstart "^3.0.0" symbol.prototype.description "^1.0.0" -airbnb-prop-types@^2.15.0: - version "2.15.0" - resolved "https://registry.yarnpkg.com/airbnb-prop-types/-/airbnb-prop-types-2.15.0.tgz#5287820043af1eb469f5b0af0d6f70da6c52aaef" - integrity sha512-jUh2/hfKsRjNFC4XONQrxo/n/3GG4Tn6Hl0WlFQN5PY9OMC9loSCoAYKnZsWaP8wEfd5xcrPloK0Zg6iS1xwVA== +airbnb-prop-types@^2.16.0: + version "2.16.0" + resolved "https://registry.yarnpkg.com/airbnb-prop-types/-/airbnb-prop-types-2.16.0.tgz#b96274cefa1abb14f623f804173ee97c13971dc2" + integrity sha512-7WHOFolP/6cS96PhKNrslCLMYAI8yB1Pp6u6XmxozQOiZbsI5ycglZr5cHhBFfuRcQQjzCMith5ZPZdYiJCxUg== dependencies: - array.prototype.find "^2.1.0" - function.prototype.name "^1.1.1" - has "^1.0.3" - is-regex "^1.0.4" - object-is "^1.0.1" + array.prototype.find "^2.1.1" + function.prototype.name "^1.1.2" + is-regex "^1.1.0" + object-is "^1.1.2" object.assign "^4.1.0" - object.entries "^1.1.0" + object.entries "^1.1.2" prop-types "^15.7.2" prop-types-exact "^1.2.0" - react-is "^16.9.0" + react-is "^16.13.1" ajv-errors@^1.0.0: version "1.0.0" @@ -6729,7 +6655,7 @@ ansi-colors@^3.0.0: resolved "https://registry.yarnpkg.com/ansi-colors/-/ansi-colors-3.2.4.tgz#e3a3da4bfbae6c86a9c285625de124a234026fbf" integrity sha512-hHUXGagefjN2iRrID63xckIvotOXOojhQKWIPUZ4mNUZ9nLZW+7FMNoE1lOkEhNWYsx/7ysGIuJYCiMAA9FnrA== -ansi-escapes@^3.0.0, ansi-escapes@^3.1.0, ansi-escapes@^3.2.0: +ansi-escapes@^3.0.0, ansi-escapes@^3.1.0: version "3.2.0" resolved "https://registry.yarnpkg.com/ansi-escapes/-/ansi-escapes-3.2.0.tgz#8780b98ff9dbf5638152d1f1fe5c1d7b4442976b" integrity sha512-cBhpre4ma+U0T1oM5fXg7Dy1Jw7zzwv7lt/GoCpr+hDQJoYnKVPLL4dCvSEFMmQurOQvSrwT7SL/DAlhBI97RQ== @@ -6909,201 +6835,6 @@ apidoc@^0.25.0: nodemon "^2.0.4" winston "^3.3.3" -apollo-cache-control@^0.1.0: - version "0.1.1" - resolved "https://registry.yarnpkg.com/apollo-cache-control/-/apollo-cache-control-0.1.1.tgz#173d14ceb3eb9e7cb53de7eb8b61bee6159d4171" - integrity sha512-XJQs167e9u+e5ybSi51nGYr70NPBbswdvTEHtbtXbwkZ+n9t0SLPvUcoqceayOSwjK1XYOdU/EKPawNdb3rLQA== - dependencies: - graphql-extensions "^0.0.x" - -apollo-cache-inmemory@1.6.2: - version "1.6.2" - resolved "https://registry.yarnpkg.com/apollo-cache-inmemory/-/apollo-cache-inmemory-1.6.2.tgz#bbf2e4e1eacdf82b2d526f5c2f3b37e5acee3c5e" - integrity sha512-AyCl3PGFv5Qv1w4N9vlg63GBPHXgMCekZy5mhlS042ji0GW84uTySX+r3F61ZX3+KM1vA4m9hQyctrEGiv5XjQ== - dependencies: - apollo-cache "^1.3.2" - apollo-utilities "^1.3.2" - optimism "^0.9.0" - ts-invariant "^0.4.0" - tslib "^1.9.3" - -apollo-cache@^1.1.14: - version "1.1.14" - resolved "https://registry.yarnpkg.com/apollo-cache/-/apollo-cache-1.1.14.tgz#c7d54cdbc7f544161f78fa5e4bae56650e22f7ad" - integrity sha512-Zmo9nVqpWFogki2QyulX6Xx6KYXMyYWX74grwgsYYUOukl4pIAdtYyK8e874o0QDgzSOq5AYPXjtfkoVpqhCRw== - dependencies: - apollo-utilities "^1.0.18" - -apollo-cache@^1.3.2: - version "1.3.2" - resolved "https://registry.yarnpkg.com/apollo-cache/-/apollo-cache-1.3.2.tgz#df4dce56240d6c95c613510d7e409f7214e6d26a" - integrity sha512-+KA685AV5ETEJfjZuviRTEImGA11uNBp/MJGnaCvkgr+BYRrGLruVKBv6WvyFod27WEB2sp7SsG8cNBKANhGLg== - dependencies: - apollo-utilities "^1.3.2" - tslib "^1.9.3" - -apollo-client@^2.3.8: - version "2.3.8" - resolved "https://registry.yarnpkg.com/apollo-client/-/apollo-client-2.3.8.tgz#0384a7210eb601ab88b1c13750da076fc9255b95" - integrity sha512-X5wsBD1be1P/mScGsH5H+2hIE8d78WAfqOvFvBpP+C+jzJ9387uHLyFmYYMLRRqDQ3ihjI4iSID7KEOW2gyCcQ== - dependencies: - "@types/zen-observable" "^0.8.0" - apollo-cache "^1.1.14" - apollo-link "^1.0.0" - apollo-link-dedup "^1.0.0" - apollo-utilities "^1.0.18" - symbol-observable "^1.0.2" - zen-observable "^0.8.0" - optionalDependencies: - "@types/async" "2.0.49" - -apollo-link-dedup@^1.0.0: - version "1.0.9" - resolved "https://registry.yarnpkg.com/apollo-link-dedup/-/apollo-link-dedup-1.0.9.tgz#3c4e4af88ef027cbddfdb857c043fd0574051dad" - integrity sha512-RbuEKpmSHVMtoREMPh2wUFTeh65q+0XPVeqgaOP/rGEAfvLyOMvX0vT2nVaejMohoMxuUnfZwpldXaDFWnlVbg== - dependencies: - apollo-link "^1.2.2" - -apollo-link-error@^1.1.7: - version "1.1.10" - resolved "https://registry.yarnpkg.com/apollo-link-error/-/apollo-link-error-1.1.10.tgz#ce57f0793f0923b598655de5bf5e028d4cf4fba6" - integrity sha512-itG5UV7mQqaalmRkuRsF0cUS4zW2ja8XCbxkMZnIEeN24X3yoJi5hpJeAaEkXf0KgYNsR0+rmtCQNruWyxDnZQ== - dependencies: - apollo-link "^1.2.11" - apollo-link-http-common "^0.2.13" - tslib "^1.9.3" - -apollo-link-http-common@^0.2.13: - version "0.2.13" - resolved "https://registry.yarnpkg.com/apollo-link-http-common/-/apollo-link-http-common-0.2.13.tgz#c688f6baaffdc7b269b2db7ae89dae7c58b5b350" - integrity sha512-Uyg1ECQpTTA691Fwx5e6Rc/6CPSu4TB4pQRTGIpwZ4l5JDOQ+812Wvi/e3IInmzOZpwx5YrrOfXrtN8BrsDXoA== - dependencies: - apollo-link "^1.2.11" - ts-invariant "^0.3.2" - tslib "^1.9.3" - -apollo-link-http-common@^0.2.15: - version "0.2.15" - resolved "https://registry.yarnpkg.com/apollo-link-http-common/-/apollo-link-http-common-0.2.15.tgz#304e67705122bf69a9abaded4351b10bc5efd6d9" - integrity sha512-+Heey4S2IPsPyTf8Ag3PugUupASJMW894iVps6hXbvwtg1aHSNMXUYO5VG7iRHkPzqpuzT4HMBanCTXPjtGzxg== - dependencies: - apollo-link "^1.2.13" - ts-invariant "^0.4.0" - tslib "^1.9.3" - -apollo-link-http@^1.5.16: - version "1.5.16" - resolved "https://registry.yarnpkg.com/apollo-link-http/-/apollo-link-http-1.5.16.tgz#44fe760bcc2803b8a7f57fc9269173afb00f3814" - integrity sha512-IA3xA/OcrOzINRZEECI6IdhRp/Twom5X5L9jMehfzEo2AXdeRwAMlH5LuvTZHgKD8V1MBnXdM6YXawXkTDSmJw== - dependencies: - apollo-link "^1.2.13" - apollo-link-http-common "^0.2.15" - tslib "^1.9.3" - -apollo-link-schema@^1.1.0: - version "1.1.0" - resolved "https://registry.yarnpkg.com/apollo-link-schema/-/apollo-link-schema-1.1.0.tgz#033fda26ffdbfc809d04892de554867f50e2af8e" - integrity sha512-sqWjse5RfrMAhrXecv0WdSLLdF1R5lI4YpbfkioIeJAkB7VB2o+mgA/+onATYKp214MSjloCDWzkvnVpRPFoBw== - dependencies: - apollo-link "^1.2.2" - -apollo-link-state@^0.4.1: - version "0.4.1" - resolved "https://registry.yarnpkg.com/apollo-link-state/-/apollo-link-state-0.4.1.tgz#65e9e0e12c67936b8c4b12b8438434f393104579" - integrity sha512-69/til4ENfl/Fvf7br2xSsLSBcxcXPbOHVNkzLLejvUZickl93HLO4/fO+uvoBi4dCYRgN17Zr8FwI41ueRx0g== - dependencies: - apollo-utilities "^1.0.8" - graphql-anywhere "^4.1.0-alpha.0" - -apollo-link@^1.0.0, apollo-link@^1.2.2, apollo-link@^1.2.3: - version "1.2.3" - resolved "https://registry.yarnpkg.com/apollo-link/-/apollo-link-1.2.3.tgz#9bd8d5fe1d88d31dc91dae9ecc22474d451fb70d" - integrity sha512-iL9yS2OfxYhigme5bpTbmRyC+Htt6tyo2fRMHT3K1XRL/C5IQDDz37OjpPy4ndx7WInSvfSZaaOTKFja9VWqSw== - dependencies: - apollo-utilities "^1.0.0" - zen-observable-ts "^0.8.10" - -apollo-link@^1.2.11: - version "1.2.11" - resolved "https://registry.yarnpkg.com/apollo-link/-/apollo-link-1.2.11.tgz#493293b747ad3237114ccd22e9f559e5e24a194d" - integrity sha512-PQvRCg13VduLy3X/0L79M6uOpTh5iHdxnxYuo8yL7sJlWybKRJwsv4IcRBJpMFbChOOaHY7Og9wgPo6DLKDKDA== - dependencies: - apollo-utilities "^1.2.1" - ts-invariant "^0.3.2" - tslib "^1.9.3" - zen-observable-ts "^0.8.18" - -apollo-link@^1.2.13: - version "1.2.13" - resolved "https://registry.yarnpkg.com/apollo-link/-/apollo-link-1.2.13.tgz#dff00fbf19dfcd90fddbc14b6a3f9a771acac6c4" - integrity sha512-+iBMcYeevMm1JpYgwDEIDt/y0BB7VWyvlm/7x+TIPNLHCTCMgcEgDuW5kH86iQZWo0I7mNwQiTOz+/3ShPFmBw== - dependencies: - apollo-utilities "^1.3.0" - ts-invariant "^0.4.0" - tslib "^1.9.3" - zen-observable-ts "^0.8.20" - -apollo-server-core@^1.3.6: - version "1.3.6" - resolved "https://registry.yarnpkg.com/apollo-server-core/-/apollo-server-core-1.3.6.tgz#08636243c2de56fa8c267d68dd602cb1fbd323e3" - integrity sha1-CGNiQ8LeVvqMJn1o3WAssfvTI+M= - dependencies: - apollo-cache-control "^0.1.0" - apollo-tracing "^0.1.0" - graphql-extensions "^0.0.x" - -apollo-server-errors@^2.0.2: - version "2.0.2" - resolved "https://registry.yarnpkg.com/apollo-server-errors/-/apollo-server-errors-2.0.2.tgz#e9cbb1b74d2cd78aed23cd886ca2d0c186323b2b" - integrity sha512-zyWDqAVDCkj9espVsoUpZr9PwDznM8UW6fBfhV+i1br//s2AQb07N6ektZ9pRIEvkhykDZW+8tQbDwAO0vUROg== - -apollo-server-hapi@^1.3.6: - version "1.3.6" - resolved "https://registry.yarnpkg.com/apollo-server-hapi/-/apollo-server-hapi-1.3.6.tgz#44dea128b64c1c10fdd35ac8307896a57ba1f4a8" - integrity sha1-RN6hKLZMHBD901rIMHiWpXuh9Kg= - dependencies: - apollo-server-core "^1.3.6" - apollo-server-module-graphiql "^1.3.4" - boom "^7.1.0" - -apollo-server-module-graphiql@^1.3.4: - version "1.3.4" - resolved "https://registry.yarnpkg.com/apollo-server-module-graphiql/-/apollo-server-module-graphiql-1.3.4.tgz#50399b7c51b7267d0c841529f5173e5fc7304de4" - integrity sha1-UDmbfFG3Jn0MhBUp9Rc+X8cwTeQ= - -apollo-tracing@^0.1.0: - version "0.1.4" - resolved "https://registry.yarnpkg.com/apollo-tracing/-/apollo-tracing-0.1.4.tgz#5b8ae1b01526b160ee6e552a7f131923a9aedcc7" - integrity sha512-Uv+1nh5AsNmC3m130i2u3IqbS+nrxyVV3KYimH5QKsdPjxxIQB3JAT+jJmpeDxBel8gDVstNmCh82QSLxLSIdQ== - dependencies: - graphql-extensions "~0.0.9" - -apollo-utilities@^1.0.0, apollo-utilities@^1.0.1, apollo-utilities@^1.0.18, apollo-utilities@^1.0.8: - version "1.0.18" - resolved "https://registry.yarnpkg.com/apollo-utilities/-/apollo-utilities-1.0.18.tgz#e4ee91534283fde2b744a26caaea120fe6a94f67" - integrity sha512-hHrmsoMYzzzfUlTOPpxr0qRpTLotMkBIQ93Ub7ki2SWdLfYYKrp6/KB8YOUkbCwXxSFvYSV24ccuwUEqZIaHIA== - dependencies: - fast-json-stable-stringify "^2.0.0" - -apollo-utilities@^1.2.1: - version "1.2.1" - resolved "https://registry.yarnpkg.com/apollo-utilities/-/apollo-utilities-1.2.1.tgz#1c3a1ebf5607d7c8efe7636daaf58e7463b41b3c" - integrity sha512-Zv8Udp9XTSFiN8oyXOjf6PMHepD4yxxReLsl6dPUy5Ths7jti3nmlBzZUOxuTWRwZn0MoclqL7RQ5UEJN8MAxg== - dependencies: - fast-json-stable-stringify "^2.0.0" - ts-invariant "^0.2.1" - tslib "^1.9.3" - -apollo-utilities@^1.3.0, apollo-utilities@^1.3.2: - version "1.3.2" - resolved "https://registry.yarnpkg.com/apollo-utilities/-/apollo-utilities-1.3.2.tgz#8cbdcf8b012f664cd6cb5767f6130f5aed9115c9" - integrity sha512-JWNHj8XChz7S4OZghV6yc9FNnzEXj285QYp/nLNh943iObycI5GTDO3NGR9Dth12LRrSFMeDOConPfPln+WGfg== - dependencies: - "@wry/equality" "^0.1.2" - fast-json-stable-stringify "^2.0.0" - ts-invariant "^0.4.0" - tslib "^1.9.3" - app-root-dir@^1.0.2: version "1.0.2" resolved "https://registry.yarnpkg.com/app-root-dir/-/app-root-dir-1.0.2.tgz#38187ec2dea7577fff033ffcb12172692ff6e118" @@ -7349,13 +7080,13 @@ array-unique@^0.3.2: resolved "https://registry.yarnpkg.com/array-unique/-/array-unique-0.3.2.tgz#a894b75d4bc4f6cd679ef3244a9fd8f46ae2d428" integrity sha1-qJS3XUvE9s1nnvMkSp/Y9Gri1Cg= -array.prototype.find@^2.1.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/array.prototype.find/-/array.prototype.find-2.1.0.tgz#630f2eaf70a39e608ac3573e45cf8ccd0ede9ad7" - integrity sha512-Wn41+K1yuO5p7wRZDl7890c3xvv5UBrfVXTVIe28rSQb6LS0fZMDrQB6PAcxQFRFy6vJTLDc3A2+3CjQdzVKRg== +array.prototype.find@^2.1.1: + version "2.1.1" + resolved "https://registry.yarnpkg.com/array.prototype.find/-/array.prototype.find-2.1.1.tgz#3baca26108ca7affb08db06bf0be6cb3115a969c" + integrity sha512-mi+MYNJYLTx2eNYy+Yh6raoQacCsNeeMUaspFPh9Y141lFSsWxxB8V9mM2ye+eqiRs917J6/pJ4M9ZPzenWckA== dependencies: define-properties "^1.1.3" - es-abstract "^1.13.0" + es-abstract "^1.17.4" array.prototype.flat@^1.2.1, array.prototype.flat@^1.2.3: version "1.2.3" @@ -7568,7 +7299,7 @@ async@^1.4.2, async@~1.5.2: resolved "https://registry.yarnpkg.com/async/-/async-1.5.2.tgz#ec6a61ae56480c0c3cb241c95618e20892f9672a" integrity sha1-7GphrlZIDAw8skHJVhjiCJL5Zyo= -async@^2.1.4, async@^2.6.1, async@^2.6.2: +async@^2.1.4, async@^2.6.2: version "2.6.3" resolved "https://registry.yarnpkg.com/async/-/async-2.6.3.tgz#d72625e2344a3656e3a3ad4fa749fa83299d82ff" integrity sha512-zflvls11DCy+dQWzTW2dzuilv8Z5X/pjfmZOWba6TNIVDm+2UDaJmXSOXlasHKfNBs8oo3M0aT50fDEWfKZjXg== @@ -8168,15 +7899,6 @@ babel-traverse@^6.18.0, babel-traverse@^6.26.0: invariant "^2.2.2" lodash "^4.17.4" -babel-types@7.0.0-beta.3: - version "7.0.0-beta.3" - resolved "https://registry.yarnpkg.com/babel-types/-/babel-types-7.0.0-beta.3.tgz#cd927ca70e0ae8ab05f4aab83778cfb3e6eb20b4" - integrity sha512-36k8J+byAe181OmCMawGhw+DtKO7AwexPVtsPXoMfAkjtZgoCX3bEuHWfdE5sYxRM8dojvtG/+O08M0Z/YDC6w== - dependencies: - esutils "^2.0.2" - lodash "^4.2.0" - to-fast-properties "^2.0.0" - babel-types@^6.18.0, babel-types@^6.26.0: version "6.26.0" resolved "https://registry.yarnpkg.com/babel-types/-/babel-types-6.26.0.tgz#a3b073f94ab49eb6fa55cd65227a334380632497" @@ -8192,11 +7914,6 @@ babelify@10.0.0: resolved "https://registry.yarnpkg.com/babelify/-/babelify-10.0.0.tgz#fe73b1a22583f06680d8d072e25a1e0d1d1d7fb5" integrity sha512-X40FaxyH7t3X+JFAKvb1H9wooWKLRCi8pg3m8poqtdZaIng+bjzp9RvKQCvRjF9isHiPkXspbbXT/zwXLtwgwg== -babylon@7.0.0-beta.47: - version "7.0.0-beta.47" - resolved "https://registry.yarnpkg.com/babylon/-/babylon-7.0.0-beta.47.tgz#6d1fa44f0abec41ab7c780481e62fd9aafbdea80" - integrity sha512-+rq2cr4GDhtToEzKFD6KZZMDBXhjFAr9JjPw9pAppZACeEWqNM294j+NdBzkSHYXwzzBmVjZ3nEVJlOhbR2gOQ== - babylon@^6.18.0: version "6.18.0" resolved "https://registry.yarnpkg.com/babylon/-/babylon-6.18.0.tgz#af2f3b88fa6f5c1e4c634d1a0f8eac4f55b395e3" @@ -8436,7 +8153,7 @@ boolbase@^1.0.0, boolbase@~1.0.0: resolved "https://registry.yarnpkg.com/boolbase/-/boolbase-1.0.0.tgz#68dff5fbe60c51eb37725ea9e3ed310dcc1e776e" integrity sha1-aN/1++YMUes3cl6p4+0xDcwed24= -boom@7.x.x, boom@^7.1.0: +boom@7.x.x: version "7.2.2" resolved "https://registry.yarnpkg.com/boom/-/boom-7.2.2.tgz#ac92101451aa5cea901aed07d881dd32b4f08345" integrity sha512-IFUbOa8PS7xqmhIjpeStwT3d09hGkNYQ6aj2iELSTxcVs2u0aKn1NzhkdUQSzsRg1FVkj3uit3I6mXQCBixw+A== @@ -9074,6 +8791,14 @@ caching-transform@^4.0.0: package-hash "^4.0.0" write-file-atomic "^3.0.0" +call-bind@^1.0.0, call-bind@^1.0.2: + version "1.0.2" + resolved "https://registry.yarnpkg.com/call-bind/-/call-bind-1.0.2.tgz#b1d4e89e688119c3c9a903ad30abb2f6a919be3c" + integrity sha512-7O+FbCihrB5WGbFYesctwmTKae6rOiIzmz1icreWJ+0aA7LJfuqhEso2T9ncpcFtzMQtzXf2QGGueWJGTYsqrA== + dependencies: + function-bind "^1.1.1" + get-intrinsic "^1.0.2" + call-me-maybe@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/call-me-maybe/-/call-me-maybe-1.0.1.tgz#26d208ea89e37b5cbde60250a15f031c16a4d66b" @@ -9108,7 +8833,7 @@ callsites@^3.1.0: resolved "https://registry.yarnpkg.com/callsites/-/callsites-3.1.0.tgz#b3630abd8943432f54b3f0519238e33cd7df2f73" integrity sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ== -camel-case@3.0.x, camel-case@^3.0.0: +camel-case@3.0.x: version "3.0.0" resolved "https://registry.yarnpkg.com/camel-case/-/camel-case-3.0.0.tgz#ca3c3688a4e9cf3a4cda777dc4dcbc713249cf73" integrity sha1-yjw2iKTpzzpM2nd9xNy8cTJJz3M= @@ -9255,7 +8980,7 @@ chai@^4.1.2: pathval "^1.1.0" type-detect "^4.0.5" -chalk@2.4.2, chalk@^2.0.0, chalk@^2.0.1, chalk@^2.1.0, chalk@^2.3.0, chalk@^2.3.1, chalk@^2.4.1, chalk@^2.4.2: +chalk@2.4.2, chalk@^2.0.0, chalk@^2.0.1, chalk@^2.1.0, chalk@^2.3.0, chalk@^2.4.1, chalk@^2.4.2: version "2.4.2" resolved "https://registry.yarnpkg.com/chalk/-/chalk-2.4.2.tgz#cd42541677a54333cf541a49108c1432b44c9424" integrity sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ== @@ -9316,30 +9041,6 @@ chance@1.0.18: resolved "https://registry.yarnpkg.com/chance/-/chance-1.0.18.tgz#79788fe6fca4c338bf404321c347eecc80f969ee" integrity sha512-g9YLQVHVZS/3F+zIicfB58vjcxopvYQRp7xHzvyDFDhXH1aRZI/JhwSAO0X5qYiQluoGnaNAU6wByD2KTxJN1A== -change-case@3.1.0: - version "3.1.0" - resolved "https://registry.yarnpkg.com/change-case/-/change-case-3.1.0.tgz#0e611b7edc9952df2e8513b27b42de72647dd17e" - integrity sha512-2AZp7uJZbYEzRPsFoa+ijKdvp9zsrnnt6+yFokfwEpeJm0xuJDVoxiRCAaTzyJND8GJkofo2IcKWaUZ/OECVzw== - dependencies: - camel-case "^3.0.0" - constant-case "^2.0.0" - dot-case "^2.1.0" - header-case "^1.0.0" - is-lower-case "^1.1.0" - is-upper-case "^1.1.0" - lower-case "^1.1.1" - lower-case-first "^1.0.0" - no-case "^2.3.2" - param-case "^2.1.0" - pascal-case "^2.0.0" - path-case "^2.1.0" - sentence-case "^2.1.0" - snake-case "^2.1.0" - swap-case "^1.1.0" - title-case "^2.1.0" - upper-case "^1.1.1" - upper-case-first "^1.1.0" - change-emitter@^0.1.2: version "0.1.6" resolved "https://registry.yarnpkg.com/change-emitter/-/change-emitter-0.1.6.tgz#e8b2fe3d7f1ab7d69a32199aff91ea6931409515" @@ -9429,7 +9130,7 @@ cheerio@^1.0.0-rc.3: lodash "^4.15.0" parse5 "^3.0.1" -chokidar@2.1.2, chokidar@3.4.3, chokidar@^2.0.0, chokidar@^2.0.4, chokidar@^2.1.1, chokidar@^2.1.2, chokidar@^2.1.8, chokidar@^3.2.2, chokidar@^3.4.0, chokidar@^3.4.1, chokidar@^3.4.3: +chokidar@3.4.3, chokidar@^2.0.0, chokidar@^2.0.4, chokidar@^2.1.1, chokidar@^2.1.2, chokidar@^2.1.8, chokidar@^3.2.2, chokidar@^3.4.0, chokidar@^3.4.1, chokidar@^3.4.3: version "3.4.3" resolved "https://registry.yarnpkg.com/chokidar/-/chokidar-3.4.3.tgz#c1df38231448e45ca4ac588e6c79573ba6a57d5b" integrity sha512-DtM3g7juCXQxFVSNPNByEC2+NImtBuxQQvWlHunpJIS5Ocr0lG306cC7FCi7cEA0fzmybPUIl4txBIobk1gGOQ== @@ -9629,11 +9330,6 @@ cli-ux@^4.9.0: treeify "^1.1.0" tslib "^1.9.3" -cli-width@^2.0.0: - version "2.2.0" - resolved "https://registry.yarnpkg.com/cli-width/-/cli-width-2.2.0.tgz#ff19ede8a9a5e579324147b0c11f0fbcbabed639" - integrity sha1-/xnt6Kml5XkyQUewwR8PvLq+1jk= - cli-width@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/cli-width/-/cli-width-3.0.0.tgz#a2f48437a2caa9a22436e794bf071ec9e61cedf6" @@ -9841,17 +9537,12 @@ color-convert@^2.0.1: dependencies: color-name "~1.1.4" -color-convert@~0.5.0: - version "0.5.3" - resolved "https://registry.yarnpkg.com/color-convert/-/color-convert-0.5.3.tgz#bdb6c69ce660fadffe0b0007cc447e1b9f7282bd" - integrity sha1-vbbGnOZg+t/+CwAHzER+G59ygr0= - color-name@1.1.3: version "1.1.3" resolved "https://registry.yarnpkg.com/color-name/-/color-name-1.1.3.tgz#a7d0558bd89c42f795dd42328f740831ca53bc25" integrity sha1-p9BVi9icQveV3UIyj3QIMcpTvCU= -color-name@^1.0.0, color-name@~1.1.4: +color-name@^1.0.0, color-name@^1.1.4, color-name@~1.1.4: version "1.1.4" resolved "https://registry.yarnpkg.com/color-name/-/color-name-1.1.4.tgz#c2a09a87acbde69543de6f63fa3995c826c536a2" integrity sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA== @@ -9898,11 +9589,6 @@ colorette@^1.2.0, colorette@^1.2.1: resolved "https://registry.yarnpkg.com/colorette/-/colorette-1.2.1.tgz#4d0b921325c14faf92633086a536db6e89564b1b" integrity sha512-puCDz0CzydiSYOrnXpz/PKd69zRrribezjtE9yd4zvytoRc8+RY/KJPvtPFKZS3E3wP6neGyMe0vOTlHO5L3Pw== -colornames@^1.1.1: - version "1.1.1" - resolved "https://registry.yarnpkg.com/colornames/-/colornames-1.1.1.tgz#f8889030685c7c4ff9e2a559f5077eb76a816f96" - integrity sha1-+IiQMGhcfE/54qVZ9Qd+t2qBb5Y= - colors@1.0.3: version "1.0.3" resolved "https://registry.yarnpkg.com/colors/-/colors-1.0.3.tgz#0433f44d809680fdeb60ed260f1b0c262e82a40b" @@ -9968,11 +9654,6 @@ commander@2.17.x, commander@~2.17.1: resolved "https://registry.yarnpkg.com/commander/-/commander-2.17.1.tgz#bd77ab7de6de94205ceacc72f1716d29f20a77bf" integrity sha512-wPMUt6FnH2yzG95SA6mzjQOEKUU3aLaDEmzs1ti+1E9h+CsrZghRlqEM/EJ4KscsQVG8uNN4uVreUeT8+drlgg== -commander@2.19.0: - version "2.19.0" - resolved "https://registry.yarnpkg.com/commander/-/commander-2.19.0.tgz#f6198aa84e5b83c46054b94ddedbfed5ee9ff12a" - integrity sha512-6tvAOO+D6OENvRAh524Dh9jcfKTYDQAqvqezbCW82xj5X0pSrcpxtvRKHLG0yBY6SD7PSDrJaj+0AiOcKVd1Xg== - commander@^3.0.2: version "3.0.2" resolved "https://registry.yarnpkg.com/commander/-/commander-3.0.2.tgz#6837c3fb677ad9933d1cfba42dd14d5117d6b39e" @@ -9993,7 +9674,7 @@ commander@^5.1.0: resolved "https://registry.yarnpkg.com/commander/-/commander-5.1.0.tgz#46abbd1652f8e059bddaef99bbdcb2ad9cf179ae" integrity sha512-P0CysNDQ7rtVw4QIQtm+MRxV66vKFSvlsQvGYXZWR3qFU0jlMKHZZZgw8e+8DSah4UDKMqnknRDQz+xuQXQ/Zg== -common-tags@1.8.0, common-tags@^1.8.0: +common-tags@^1.8.0: version "1.8.0" resolved "https://registry.yarnpkg.com/common-tags/-/common-tags-1.8.0.tgz#8e3153e542d4a39e9b10554434afaaf98956a937" integrity sha512-6P6g0uetGpW/sdyUy/iQQCbFF0kWVMSIVSyYz7Zgjcgh8mgw8PQzDNZeyZ5DQ2gM7LBoZPHmnjz8rUthkBG5tw== @@ -10169,14 +9850,6 @@ console-log-level@^1.4.1: resolved "https://registry.yarnpkg.com/console-log-level/-/console-log-level-1.4.1.tgz#9c5a6bb9ef1ef65b05aba83028b0ff894cdf630a" integrity sha512-VZzbIORbP+PPcN/gg3DXClTLPLg5Slwd5fL2MIc+o1qZ4BXBvWyc6QxPk6T/Mkr6IVjRpoAGf32XxP3ZWMVRcQ== -constant-case@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/constant-case/-/constant-case-2.0.0.tgz#4175764d389d3fa9c8ecd29186ed6005243b6a46" - integrity sha1-QXV2TTidP6nI7NKRhu1gBSQ7akY= - dependencies: - snake-case "^2.1.0" - upper-case "^1.1.1" - constants-browserify@^1.0.0, constants-browserify@~1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/constants-browserify/-/constants-browserify-1.0.0.tgz#c20b96d8c617748aaf1c16021760cd27fcb8cb75" @@ -10323,7 +9996,7 @@ core-js@^1.0.0: resolved "https://registry.yarnpkg.com/core-js/-/core-js-1.2.7.tgz#652294c14651db28fa93bd2d5ff2983a4f08c636" integrity sha1-ZSKUwUZR2yj6k70tX/KYOk8IxjY= -core-js@^2.4.0, core-js@^2.5.0, core-js@^2.5.3, core-js@^2.6.9: +core-js@^2.4.0, core-js@^2.5.0, core-js@^2.6.9: version "2.6.9" resolved "https://registry.yarnpkg.com/core-js/-/core-js-2.6.9.tgz#6b4b214620c834152e179323727fc19741b084f2" integrity sha512-HOpZf6eXmnl7la+cUdMnLvUxKNqLUzJvgIziQ0DiF3JwSImNphIqdGqzj6hIKyX04MmV0poclQ7+wjWvxQyR2A== @@ -10513,14 +10186,6 @@ cross-env@^6.0.3: dependencies: cross-spawn "^7.0.0" -cross-fetch@2.2.2: - version "2.2.2" - resolved "https://registry.yarnpkg.com/cross-fetch/-/cross-fetch-2.2.2.tgz#a47ff4f7fc712daba8f6a695a11c948440d45723" - integrity sha1-pH/09/xxLauo9qaVoRyUhEDUVyM= - dependencies: - node-fetch "2.1.2" - whatwg-fetch "2.0.4" - cross-spawn@7.0.3, cross-spawn@^7.0.0, cross-spawn@^7.0.2: version "7.0.3" resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-7.0.3.tgz#f73a85b9d5d41d045551c177e2882d4ac85728a6" @@ -11768,11 +11433,6 @@ dependency-check@^4.1.0: read-package-json "^2.0.10" resolve "^1.1.7" -deprecated-decorator@^0.1.6: - version "0.1.6" - resolved "https://registry.yarnpkg.com/deprecated-decorator/-/deprecated-decorator-0.1.6.tgz#00966317b7a12fe92f3cc831f7583af329b86c37" - integrity sha1-AJZjF7ehL+kvPMgx91g68ym4bDc= - deprecation@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/deprecation/-/deprecation-1.0.1.tgz#2df79b79005752180816b7b6e079cbd80490d711" @@ -11818,11 +11478,6 @@ detect-file@^1.0.0: resolved "https://registry.yarnpkg.com/detect-file/-/detect-file-1.0.0.tgz#f0d66d03672a825cb1b73bdb3fe62310c8e552b7" integrity sha1-8NZtA2cqglyxtzvbP+YjEMjlUrc= -detect-indent@5.0.0, detect-indent@^5.0.0: - version "5.0.0" - resolved "https://registry.yarnpkg.com/detect-indent/-/detect-indent-5.0.0.tgz#3871cc0a6a002e8c3e5b3cf7f336264675f06b9d" - integrity sha1-OHHMCmoALow+Wzz38zYmRnXwa50= - detect-indent@^4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/detect-indent/-/detect-indent-4.0.0.tgz#f76d064352cdf43a1cb6ce619c4ee3a9475de208" @@ -11830,6 +11485,11 @@ detect-indent@^4.0.0: dependencies: repeating "^2.0.0" +detect-indent@^5.0.0: + version "5.0.0" + resolved "https://registry.yarnpkg.com/detect-indent/-/detect-indent-5.0.0.tgz#3871cc0a6a002e8c3e5b3cf7f336264675f06b9d" + integrity sha1-OHHMCmoALow+Wzz38zYmRnXwa50= + detect-newline@2.X: version "2.1.0" resolved "https://registry.yarnpkg.com/detect-newline/-/detect-newline-2.1.0.tgz#f41f1c10be4b00e87b5f13da680759f2c5bfd3e2" @@ -11898,15 +11558,6 @@ diacritics@^1.3.0: resolved "https://registry.yarnpkg.com/diacritics/-/diacritics-1.3.0.tgz#3efa87323ebb863e6696cebb0082d48ff3d6f7a1" integrity sha1-PvqHMj67hj5mls67AILUj/PW96E= -diagnostics@^1.1.1: - version "1.1.1" - resolved "https://registry.yarnpkg.com/diagnostics/-/diagnostics-1.1.1.tgz#cab6ac33df70c9d9a727490ae43ac995a769b22a" - integrity sha512-8wn1PmdunLJ9Tqbx+Fx/ZEuHfJf4NKSN2ZBj7SJC/OWRWha843+WsTjqMe1B5E3p28jqBlp+mJ2fPVxPyNgYKQ== - dependencies: - colorspace "1.1.x" - enabled "1.0.x" - kuler "1.0.x" - diff-match-patch@^1.0.0, diff-match-patch@^1.0.4: version "1.0.5" resolved "https://registry.yarnpkg.com/diff-match-patch/-/diff-match-patch-1.0.5.tgz#abb584d5f10cd1196dfc55aa03701592ae3f7b37" @@ -12020,10 +11671,10 @@ doctrine@^3.0.0: dependencies: esutils "^2.0.2" -dom-accessibility-api@^0.5.1: - version "0.5.2" - resolved "https://registry.yarnpkg.com/dom-accessibility-api/-/dom-accessibility-api-0.5.2.tgz#ef3cdb5d3f0d599d8f9c8b18df2fb63c9793739d" - integrity sha512-k7hRNKAiPJXD2aBqfahSo4/01cTsKWXf+LqJgglnkN2Nz8TsxXKQBXHhKe0Ye9fEfHEZY49uSA5Sr3AqP/sWKA== +dom-accessibility-api@^0.5.4: + version "0.5.4" + resolved "https://registry.yarnpkg.com/dom-accessibility-api/-/dom-accessibility-api-0.5.4.tgz#b06d059cdd4a4ad9a79275f9d414a5c126241166" + integrity sha512-TvrjBckDy2c6v6RLxPv5QXOnU+SmF9nBII5621Ve5fu6Z/BDrENurBEvlC1f44lKEUVqOpK4w9E5Idc5/EgkLQ== dom-converter@~0.2: version "0.2.0" @@ -12121,13 +11772,6 @@ domutils@^1.5.1, domutils@^1.7.0: dom-serializer "0" domelementtype "1" -dot-case@^2.1.0: - version "2.1.1" - resolved "https://registry.yarnpkg.com/dot-case/-/dot-case-2.1.1.tgz#34dcf37f50a8e93c2b3bca8bb7fb9155c7da3bee" - integrity sha1-NNzzf1Co6TwrO8qLt/uRVcfaO+4= - dependencies: - no-case "^2.2.0" - dot-case@^3.0.3: version "3.0.3" resolved "https://registry.yarnpkg.com/dot-case/-/dot-case-3.0.3.tgz#21d3b52efaaba2ea5fda875bb1aa8124521cf4aa" @@ -12478,13 +12122,6 @@ emotion@^9.1.2: babel-plugin-emotion "^9.2.11" create-emotion "^9.2.12" -enabled@1.0.x: - version "1.0.2" - resolved "https://registry.yarnpkg.com/enabled/-/enabled-1.0.2.tgz#965f6513d2c2d1c5f4652b64a2e3396467fc2f93" - integrity sha1-ll9lE9LC0cX0ZStkouM5ZGf8L5M= - dependencies: - env-variable "0.0.x" - enabled@2.0.x: version "2.0.0" resolved "https://registry.yarnpkg.com/enabled/-/enabled-2.0.0.tgz#f9dd92ec2d6f4bbc0d5d1e64e21d61cd4665e7c2" @@ -12544,51 +12181,48 @@ env-paths@^2.2.0: resolved "https://registry.yarnpkg.com/env-paths/-/env-paths-2.2.0.tgz#cdca557dc009152917d6166e2febe1f039685e43" integrity sha512-6u0VYSCo/OW6IoD5WCLLy9JUGARbamfSavcNXry/eu8aHVFei6CD3Sw+VGX5alea1i9pgPHW0mbu6Xj0uBh7gA== -env-variable@0.0.x: - version "0.0.5" - resolved "https://registry.yarnpkg.com/env-variable/-/env-variable-0.0.5.tgz#913dd830bef11e96a039c038d4130604eba37f88" - integrity sha512-zoB603vQReOFvTg5xMl9I1P2PnHsHQQKTEowsKKD7nseUfJq6UWzK+4YtlWUO1nhiQUxe6XMkk+JleSZD1NZFA== - -enzyme-adapter-react-16@^1.15.2: - version "1.15.2" - resolved "https://registry.yarnpkg.com/enzyme-adapter-react-16/-/enzyme-adapter-react-16-1.15.2.tgz#b16db2f0ea424d58a808f9df86ab6212895a4501" - integrity sha512-SkvDrb8xU3lSxID8Qic9rB8pvevDbLybxPK6D/vW7PrT0s2Cl/zJYuXvsd1EBTz0q4o3iqG3FJhpYz3nUNpM2Q== +enzyme-adapter-react-16@^1.15.6: + version "1.15.6" + resolved "https://registry.yarnpkg.com/enzyme-adapter-react-16/-/enzyme-adapter-react-16-1.15.6.tgz#fd677a658d62661ac5afd7f7f541f141f8085901" + integrity sha512-yFlVJCXh8T+mcQo8M6my9sPgeGzj85HSHi6Apgf1Cvq/7EL/J9+1JoJmJsRxZgyTvPMAqOEpRSu/Ii/ZpyOk0g== dependencies: - enzyme-adapter-utils "^1.13.0" - enzyme-shallow-equal "^1.0.1" + enzyme-adapter-utils "^1.14.0" + enzyme-shallow-equal "^1.0.4" has "^1.0.3" - object.assign "^4.1.0" - object.values "^1.1.1" + object.assign "^4.1.2" + object.values "^1.1.2" prop-types "^15.7.2" - react-is "^16.12.0" + react-is "^16.13.1" react-test-renderer "^16.0.0-0" semver "^5.7.0" -enzyme-adapter-utils@^1.13.0: - version "1.13.0" - resolved "https://registry.yarnpkg.com/enzyme-adapter-utils/-/enzyme-adapter-utils-1.13.0.tgz#01c885dde2114b4690bf741f8dc94cee3060eb78" - integrity sha512-YuEtfQp76Lj5TG1NvtP2eGJnFKogk/zT70fyYHXK2j3v6CtuHqc8YmgH/vaiBfL8K1SgVVbQXtTcgQZFwzTVyQ== +enzyme-adapter-utils@^1.14.0: + version "1.14.0" + resolved "https://registry.yarnpkg.com/enzyme-adapter-utils/-/enzyme-adapter-utils-1.14.0.tgz#afbb0485e8033aa50c744efb5f5711e64fbf1ad0" + integrity sha512-F/z/7SeLt+reKFcb7597IThpDp0bmzcH1E9Oabqv+o01cID2/YInlqHbFl7HzWBl4h3OdZYedtwNDOmSKkk0bg== dependencies: - airbnb-prop-types "^2.15.0" - function.prototype.name "^1.1.2" - object.assign "^4.1.0" - object.fromentries "^2.0.2" + airbnb-prop-types "^2.16.0" + function.prototype.name "^1.1.3" + has "^1.0.3" + object.assign "^4.1.2" + object.fromentries "^2.0.3" prop-types "^15.7.2" semver "^5.7.1" -enzyme-shallow-equal@^1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/enzyme-shallow-equal/-/enzyme-shallow-equal-1.0.1.tgz#7afe03db3801c9b76de8440694096412a8d9d49e" - integrity sha512-hGA3i1so8OrYOZSM9whlkNmVHOicJpsjgTzC+wn2JMJXhq1oO4kA4bJ5MsfzSIcC71aLDKzJ6gZpIxrqt3QTAQ== +enzyme-shallow-equal@^1.0.1, enzyme-shallow-equal@^1.0.4: + version "1.0.4" + resolved "https://registry.yarnpkg.com/enzyme-shallow-equal/-/enzyme-shallow-equal-1.0.4.tgz#b9256cb25a5f430f9bfe073a84808c1d74fced2e" + integrity sha512-MttIwB8kKxypwHvRynuC3ahyNc+cFbR8mjVIltnmzQ0uKGqmsfO4bfBuLxb0beLNPhjblUEYvEbsg+VSygvF1Q== dependencies: has "^1.0.3" - object-is "^1.0.2" + object-is "^1.1.2" -enzyme-to-json@^3.4.4: - version "3.4.4" - resolved "https://registry.yarnpkg.com/enzyme-to-json/-/enzyme-to-json-3.4.4.tgz#b30726c59091d273521b6568c859e8831e94d00e" - integrity sha512-50LELP/SCPJJGic5rAARvU7pgE3m1YaNj7JLM+Qkhl5t7PAs6fiyc8xzc50RnkKPFQCv0EeFVjEWdIFRGPWMsA== +enzyme-to-json@^3.6.1: + version "3.6.1" + resolved "https://registry.yarnpkg.com/enzyme-to-json/-/enzyme-to-json-3.6.1.tgz#d60740950bc7ca6384dfe6fe405494ec5df996bc" + integrity sha512-15tXuONeq5ORoZjV/bUo2gbtZrN2IH+Z6DvL35QmZyKHgbY1ahn6wcnLd9Xv9OjiwbAXiiP8MRZwbZrCv1wYNg== dependencies: + "@types/cheerio" "^0.22.22" lodash "^4.17.15" react-is "^16.12.0" @@ -12660,57 +12294,27 @@ error-stack-parser@^2.0.4, error-stack-parser@^2.0.6: dependencies: stackframe "^1.1.1" -es-abstract@^1.13.0, es-abstract@^1.17.0, es-abstract@^1.17.0-next.1, es-abstract@^1.17.4, es-abstract@^1.17.5, es-abstract@^1.4.3, es-abstract@^1.5.0, es-abstract@^1.9.0: - version "1.17.6" - resolved "https://registry.yarnpkg.com/es-abstract/-/es-abstract-1.17.6.tgz#9142071707857b2cacc7b89ecb670316c3e2d52a" - integrity sha512-Fr89bON3WFyUi5EvAeI48QTWX0AyekGgLA8H+c+7fbfCkJwRWRMLd8CQedNEyJuoYYhmtEqY92pgte1FAhBlhw== +es-abstract@^1.17.0, es-abstract@^1.17.0-next.1, es-abstract@^1.17.2, es-abstract@^1.17.4, es-abstract@^1.17.5, es-abstract@^1.18.0-next.2, es-abstract@^1.4.3, es-abstract@^1.5.0, es-abstract@^1.9.0: + version "1.18.0" + resolved "https://registry.yarnpkg.com/es-abstract/-/es-abstract-1.18.0.tgz#ab80b359eecb7ede4c298000390bc5ac3ec7b5a4" + integrity sha512-LJzK7MrQa8TS0ja2w3YNLzUgJCGPdPOV1yVvezjNnS89D+VR08+Szt2mz3YB2Dck/+w5tfIq/RoUAFqJJGM2yw== dependencies: + call-bind "^1.0.2" es-to-primitive "^1.2.1" function-bind "^1.1.1" + get-intrinsic "^1.1.1" has "^1.0.3" - has-symbols "^1.0.1" - is-callable "^1.2.0" - is-regex "^1.1.0" - object-inspect "^1.7.0" - object-keys "^1.1.1" - object.assign "^4.1.0" - string.prototype.trimend "^1.0.1" - string.prototype.trimstart "^1.0.1" - -es-abstract@^1.17.2: - version "1.17.7" - resolved "https://registry.yarnpkg.com/es-abstract/-/es-abstract-1.17.7.tgz#a4de61b2f66989fc7421676c1cb9787573ace54c" - integrity sha512-VBl/gnfcJ7OercKA9MVaegWsBHFjV492syMudcnQZvt/Dw8ezpcOHYZXa/J96O8vx+g4x65YKhxOwDUh63aS5g== - dependencies: - es-to-primitive "^1.2.1" - function-bind "^1.1.1" - has "^1.0.3" - has-symbols "^1.0.1" - is-callable "^1.2.2" - is-regex "^1.1.1" - object-inspect "^1.8.0" - object-keys "^1.1.1" - object.assign "^4.1.1" - string.prototype.trimend "^1.0.1" - string.prototype.trimstart "^1.0.1" - -es-abstract@^1.18.0-next.0: - version "1.18.0-next.1" - resolved "https://registry.yarnpkg.com/es-abstract/-/es-abstract-1.18.0-next.1.tgz#6e3a0a4bda717e5023ab3b8e90bec36108d22c68" - integrity sha512-I4UGspA0wpZXWENrdA0uHbnhte683t3qT/1VFH9aX2dA5PPSf6QW5HHXf5HImaqPmjXaVeVk4RGWnaylmV7uAA== - dependencies: - es-to-primitive "^1.2.1" - function-bind "^1.1.1" - has "^1.0.3" - has-symbols "^1.0.1" - is-callable "^1.2.2" - is-negative-zero "^2.0.0" - is-regex "^1.1.1" - object-inspect "^1.8.0" + has-symbols "^1.0.2" + is-callable "^1.2.3" + is-negative-zero "^2.0.1" + is-regex "^1.1.2" + is-string "^1.0.5" + object-inspect "^1.9.0" object-keys "^1.1.1" - object.assign "^4.1.1" - string.prototype.trimend "^1.0.1" - string.prototype.trimstart "^1.0.1" + object.assign "^4.1.2" + string.prototype.trimend "^1.0.4" + string.prototype.trimstart "^1.0.4" + unbox-primitive "^1.0.0" es-array-method-boxes-properly@^1.0.0: version "1.0.0" @@ -13033,10 +12637,10 @@ eslint-plugin-import@^2.22.1: resolve "^1.17.0" tsconfig-paths "^3.9.0" -eslint-plugin-jest@^24.0.2: - version "24.0.2" - resolved "https://registry.yarnpkg.com/eslint-plugin-jest/-/eslint-plugin-jest-24.0.2.tgz#4bf0fcdc86289d702a7dacb430b4363482af773b" - integrity sha512-DSBLNpkKDOpUJQkTGSs5sVJWsu0nDyQ2rYxkr0Eh7nrkc5bMUr/dlDbtTj3l8y6UaCVsem6rryF1OZrKnz1S5g== +eslint-plugin-jest@^24.3.4: + version "24.3.4" + resolved "https://registry.yarnpkg.com/eslint-plugin-jest/-/eslint-plugin-jest-24.3.4.tgz#6d90c3554de0302e879603dd6405474c98849f19" + integrity sha512-3n5oY1+fictanuFkTWPwSlehugBTAgwLnYLFsCllzE3Pl1BwywHl5fL0HFxmMjoQY8xhUDk8uAWc3S4JOHGh3A== dependencies: "@typescript-eslint/experimental-utils" "^4.0.1" @@ -13722,7 +13326,7 @@ fb-watchman@^2.0.0: dependencies: bser "^2.0.0" -fbjs@^0.8.1, fbjs@^0.8.16, fbjs@^0.8.9: +fbjs@^0.8.1, fbjs@^0.8.9: version "0.8.17" resolved "https://registry.yarnpkg.com/fbjs/-/fbjs-0.8.17.tgz#c4d598ead6949112653d6588b01a5cdcd9f90fdd" integrity sha1-xNWY6taUkRJlPWWIsBpc3Nn5D90= @@ -13883,6 +13487,11 @@ fill-range@^7.0.1: dependencies: to-regex-range "^5.0.1" +filter-console@^0.1.1: + version "0.1.1" + resolved "https://registry.yarnpkg.com/filter-console/-/filter-console-0.1.1.tgz#6242be28982bba7415bcc6db74a79f4a294fa67c" + integrity sha512-zrXoV1Uaz52DqPs+qEwNJWJFAWZpYJ47UNmpN9q4j+/EYsz85uV0DC9k8tRND5kYmoVzL0W+Y75q4Rg8sRJCdg== + finalhandler@1.1.2, finalhandler@~1.1.2: version "1.1.2" resolved "https://registry.yarnpkg.com/finalhandler/-/finalhandler-1.1.2.tgz#b7e7d000ffd11938d0fdb053506f6ebabe9f587d" @@ -14402,24 +14011,25 @@ function-bind@^1.0.2, function-bind@^1.1.1, function-bind@~1.1.1: resolved "https://registry.yarnpkg.com/function-bind/-/function-bind-1.1.1.tgz#a56899d3ea3c9bab874bb9773b7c5ede92f4895d" integrity sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A== -function.prototype.name@^1.1.0, function.prototype.name@^1.1.1, function.prototype.name@^1.1.2: - version "1.1.2" - resolved "https://registry.yarnpkg.com/function.prototype.name/-/function.prototype.name-1.1.2.tgz#5cdf79d7c05db401591dfde83e3b70c5123e9a45" - integrity sha512-C8A+LlHBJjB2AdcRPorc5JvJ5VUoWlXdEHLOJdCI7kjHEtGTpHQUiqMvCIKUwIsGwZX2jZJy761AXsn356bJQg== +function.prototype.name@^1.1.0, function.prototype.name@^1.1.2, function.prototype.name@^1.1.3: + version "1.1.4" + resolved "https://registry.yarnpkg.com/function.prototype.name/-/function.prototype.name-1.1.4.tgz#e4ea839b9d3672ae99d0efd9f38d9191c5eaac83" + integrity sha512-iqy1pIotY/RmhdFZygSSlW0wko2yxkSCKqsuv4pr8QESohpYyG/Z7B/XXvPRKTJS//960rgguE5mSRUsDdaJrQ== dependencies: + call-bind "^1.0.2" define-properties "^1.1.3" - es-abstract "^1.17.0-next.1" - functions-have-names "^1.2.0" + es-abstract "^1.18.0-next.2" + functions-have-names "^1.2.2" functional-red-black-tree@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/functional-red-black-tree/-/functional-red-black-tree-1.0.1.tgz#1b0ab3bd553b2a0d6399d29c0e3ea0b252078327" integrity sha1-GwqzvVU7Kg1jmdKcDj6gslIHgyc= -functions-have-names@^1.2.0: - version "1.2.0" - resolved "https://registry.yarnpkg.com/functions-have-names/-/functions-have-names-1.2.0.tgz#83da7583e4ea0c9ac5ff530f73394b033e0bf77d" - integrity sha512-zKXyzksTeaCSw5wIX79iCA40YAa6CJMJgNg9wdkU/ERBrIdPSimPICYiLp65lRbSBqtiHql/HZfS2DyI/AH6tQ== +functions-have-names@^1.2.2: + version "1.2.2" + resolved "https://registry.yarnpkg.com/functions-have-names/-/functions-have-names-1.2.2.tgz#98d93991c39da9361f8e50b337c4f6e41f120e21" + integrity sha512-bLgc3asbWdwPbx2mNk2S49kmJCuQeu0nfmaOgbs8WIyzzkw3r4htszdIi9Q9EMezDPTYuJx2wvjZ/EwgAthpnA== fuse.js@^3.6.1: version "3.6.1" @@ -14501,6 +14111,15 @@ get-func-name@^2.0.0: resolved "https://registry.yarnpkg.com/get-func-name/-/get-func-name-2.0.0.tgz#ead774abee72e20409433a066366023dd6887a41" integrity sha1-6td0q+5y4gQJQzoGY2YCPdaIekE= +get-intrinsic@^1.0.2, get-intrinsic@^1.1.1: + version "1.1.1" + resolved "https://registry.yarnpkg.com/get-intrinsic/-/get-intrinsic-1.1.1.tgz#15f59f376f855c446963948f0d24cd3637b4abc6" + integrity sha512-kWZrnVM42QCiEA2Ig1bG8zjoIMOgxWwYCEeNdwY6Tv/cOSeGpcoX4pXHfKUxNKVoArnrEr2e9srnAxxGIraS9Q== + dependencies: + function-bind "^1.1.1" + has "^1.0.3" + has-symbols "^1.0.1" + get-nonce@^1.0.0: version "1.0.1" resolved "https://registry.yarnpkg.com/get-nonce/-/get-nonce-1.0.1.tgz#fdf3f0278073820d2ce9426c18f07481b1e0cdf3" @@ -14721,18 +14340,6 @@ glob-watcher@5.0.3, glob-watcher@^5.0.3: just-debounce "^1.0.0" object.defaults "^1.1.0" -glob@7.1.3: - version "7.1.3" - resolved "https://registry.yarnpkg.com/glob/-/glob-7.1.3.tgz#3960832d3f1574108342dafd3a67b332c0969df1" - integrity sha512-vcfuiIxogLV4DlGBHIUOwI0IbrJ8HWPc4MU7HzviGeNho/UJDfi6B5p3sHeWIQ0KGIU0Jpxi5ZHxemQfLkkAwQ== - dependencies: - fs.realpath "^1.0.0" - inflight "^1.0.4" - inherits "2" - minimatch "^3.0.4" - once "^1.3.0" - path-is-absolute "^1.0.0" - glob@7.1.4: version "7.1.4" resolved "https://registry.yarnpkg.com/glob/-/glob-7.1.4.tgz#aa608a2f6c577ad357e1ae5a5c26d9a8d1969255" @@ -15022,251 +14629,31 @@ got@^3.2.0: got@^9.6.0: version "9.6.0" resolved "https://registry.yarnpkg.com/got/-/got-9.6.0.tgz#edf45e7d67f99545705de1f7bbeeeb121765ed85" - integrity sha512-R7eWptXuGYxwijs0eV+v3o6+XH1IqVK8dJOEecQfTmkncw9AV4dcw/Dhxi8MdlqPthxxpZyizMzyg8RTmEsG+Q== - dependencies: - "@sindresorhus/is" "^0.14.0" - "@szmarczak/http-timer" "^1.1.2" - cacheable-request "^6.0.0" - decompress-response "^3.3.0" - duplexer3 "^0.1.4" - get-stream "^4.1.0" - lowercase-keys "^1.0.1" - mimic-response "^1.0.1" - p-cancelable "^1.0.0" - to-readable-stream "^1.0.0" - url-parse-lax "^3.0.0" - -graceful-fs@4.X, graceful-fs@^4.0.0, graceful-fs@^4.1.11, graceful-fs@^4.1.15, graceful-fs@^4.1.2, graceful-fs@^4.1.4, graceful-fs@^4.1.6, graceful-fs@^4.1.9, graceful-fs@^4.2.0, graceful-fs@^4.2.2, graceful-fs@^4.2.3, graceful-fs@^4.2.4: - version "4.2.4" - resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.2.4.tgz#2256bde14d3632958c465ebc96dc467ca07a29fb" - integrity sha512-WjKPNJF79dtJAVniUlGGWHYGz2jWxT6VhN/4m1NdkbZ2nOsEF+cI1Edgql5zCRhs/VsQYRvrXctxktVXZUkixw== - -graphlib@^2.1.8: - version "2.1.8" - resolved "https://registry.yarnpkg.com/graphlib/-/graphlib-2.1.8.tgz#5761d414737870084c92ec7b5dbcb0592c9d35da" - integrity sha512-jcLLfkpoVGmH7/InMC/1hIvOPSUh38oJtGhvrOFGzioE1DZ+0YW16RgmOJhHiuWTvGiJQ9Z1Ik43JvkRPRvE+A== - dependencies: - lodash "^4.17.15" - -graphql-anywhere@^4.1.0-alpha.0: - version "4.1.16" - resolved "https://registry.yarnpkg.com/graphql-anywhere/-/graphql-anywhere-4.1.16.tgz#82bb59643e30183cfb7b485ed4262a7b39d8a6c1" - integrity sha512-DNQGxrh2p8w4vQwHIW1Sw65ZDbOr6ktQCeol6itH3LeWy1a3IoZ67jxrhgrHM+Upg8oiazvteSr64VRxJ8n5+g== - dependencies: - apollo-utilities "^1.0.18" - -graphql-code-generator@^0.18.2: - version "0.18.2" - resolved "https://registry.yarnpkg.com/graphql-code-generator/-/graphql-code-generator-0.18.2.tgz#080d91f8b44d26d7c69069118ac9f775f3fd5971" - integrity sha512-9ifA5T6hM6qo3RVQz7oYld1R6XYyglT/TanYDoweVEX+6iLxgi0rvGFjFcQ45bPDgLyVkQ9LEsEJuL1YxFmrDw== - dependencies: - "@types/babylon" "6.16.5" - "@types/is-glob" "4.0.0" - "@types/prettier" "1.16.1" - "@types/valid-url" "1.0.2" - babel-types "7.0.0-beta.3" - babylon "7.0.0-beta.47" - chalk "2.4.2" - change-case "3.1.0" - chokidar "2.1.2" - commander "2.19.0" - common-tags "1.8.0" - detect-indent "5.0.0" - glob "7.1.3" - graphql-codegen-core "0.18.2" - graphql-config "2.2.1" - graphql-import "0.7.1" - graphql-tag-pluck "0.6.0" - graphql-toolkit "0.2.0" - graphql-tools "4.0.4" - indent-string "3.2.0" - inquirer "6.2.2" - is-glob "4.0.0" - is-valid-path "0.1.1" - js-yaml "3.13.1" - json-to-pretty-yaml "1.2.2" - listr "0.14.3" - listr-update-renderer "0.5.0" - log-symbols "2.2.0" - log-update "2.3.0" - mkdirp "0.5.1" - prettier "1.16.4" - request "2.88.0" - valid-url "1.0.9" - -graphql-codegen-add@^0.18.2: - version "0.18.2" - resolved "https://registry.yarnpkg.com/graphql-codegen-add/-/graphql-codegen-add-0.18.2.tgz#27625f6b6bcfe29076b5f8b02496425eeb360b46" - integrity sha512-X8i3WEjfI2YYS6giE3BZ0LlOlTnae2btuyjU1TAN7Cec+dOI5XzRz25cPRi6D1Y0++j2h480e60tgXwMORW9pA== - dependencies: - graphql-codegen-core "0.18.2" - -graphql-codegen-core@0.18.2: - version "0.18.2" - resolved "https://registry.yarnpkg.com/graphql-codegen-core/-/graphql-codegen-core-0.18.2.tgz#205b25d2bdb20a35b986495b60d219a8d02ef266" - integrity sha512-fjfIUrDx0KDdr/jYjUs51+07DvcEc5w9tdid/bNezNzT2iJLtmnnmYLR62an3/PKUnKSOAIKLYxFIBOzsFJH9A== - dependencies: - chalk "2.4.2" - change-case "3.1.0" - common-tags "1.8.0" - graphql-tag "2.10.1" - graphql-toolkit "0.2.0" - graphql-tools "4.0.4" - ts-log "2.1.4" - winston "3.2.1" - -graphql-codegen-introspection@^0.18.2: - version "0.18.2" - resolved "https://registry.yarnpkg.com/graphql-codegen-introspection/-/graphql-codegen-introspection-0.18.2.tgz#1e749e342aebe219271dcf4c5c56357ad300921a" - integrity sha512-L71rDI9gFQdcGNHsOnlW8nOtUXsZCFnXvC+faEwNse4P/OGrRm4jLQU/6/EUk92okFCbLytKWNcq1uxD8fiY1Q== - -graphql-codegen-plugin-helpers@0.18.2: - version "0.18.2" - resolved "https://registry.yarnpkg.com/graphql-codegen-plugin-helpers/-/graphql-codegen-plugin-helpers-0.18.2.tgz#ce03d02ced0bc28ef2f61e0a5205d85ee7e9ccdb" - integrity sha512-WZahfp95RdePwwPWxnxAHgfkXXEQXNrgX9sGrB//uGfj8lygcf7m/rNZQ4iooUzoqBEkTtJpi7bezWCieNcq2A== - dependencies: - graphql-codegen-core "0.18.2" - import-from "2.1.0" - -graphql-codegen-typescript-client@^0.18.2: - version "0.18.2" - resolved "https://registry.yarnpkg.com/graphql-codegen-typescript-client/-/graphql-codegen-typescript-client-0.18.2.tgz#5478f8af83fac8063362fe2905dac20fe02d5548" - integrity sha512-HffKYPrT5jGIRTiWCTst/X3EBpuOHsheI5tKUEf9NfrR8ySWs6PfqZO5fKCFWZOqC9xn7Y75jFXaeH8tgV5y1g== - dependencies: - graphql-codegen-core "0.18.2" - graphql-codegen-plugin-helpers "0.18.2" - graphql-codegen-typescript-common "0.18.2" - -graphql-codegen-typescript-common@0.18.2, graphql-codegen-typescript-common@^0.18.2: - version "0.18.2" - resolved "https://registry.yarnpkg.com/graphql-codegen-typescript-common/-/graphql-codegen-typescript-common-0.18.2.tgz#1ccbb3bfa1aeb8664127f881db27c658636465da" - integrity sha512-uGGHd/vgwMlnCNOMQkvMxW8Xz0fqPGjPHROsniRNP1ragsa6KfFBrGu9toHgxv8m3MzC6ZPeoUa3wtwtS9oVnA== - dependencies: - change-case "3.1.0" - common-tags "1.8.0" - graphql-codegen-core "0.18.2" - graphql-codegen-plugin-helpers "0.18.2" - -graphql-codegen-typescript-resolvers@^0.18.2: - version "0.18.2" - resolved "https://registry.yarnpkg.com/graphql-codegen-typescript-resolvers/-/graphql-codegen-typescript-resolvers-0.18.2.tgz#fa44b2668285184d2976116c2982c17bc6866a23" - integrity sha512-BlS286ap2hsOjx2a7H6WKcwxfQtjRay9d+P/0u4t6zUkjpFSpHWWYgymVopfckrjHCo/8g+THPFCmUgFg34vKQ== - dependencies: - graphql-codegen-plugin-helpers "0.18.2" - graphql-codegen-typescript-common "0.18.2" - -graphql-codegen-typescript-server@^0.18.2: - version "0.18.2" - resolved "https://registry.yarnpkg.com/graphql-codegen-typescript-server/-/graphql-codegen-typescript-server-0.18.2.tgz#2e11607512bdf77b152c554afc18f5210c1785ba" - integrity sha512-1marSv3TCry6IsQd+Hdarq/AhDpgJ3Yg+e9Or3Urv7Fkw4YbhtyGp6AkpBK+DMKlyKFPjpLnmjAaHS3hjrCp3Q== - dependencies: - graphql-codegen-typescript-common "0.18.2" - -graphql-config@2.2.1: - version "2.2.1" - resolved "https://registry.yarnpkg.com/graphql-config/-/graphql-config-2.2.1.tgz#5fd0ec77ac7428ca5fb2026cf131be10151a0cb2" - integrity sha512-U8+1IAhw9m6WkZRRcyj8ZarK96R6lQBQ0an4lp76Ps9FyhOXENC5YQOxOFGm5CxPrX2rD0g3Je4zG5xdNJjwzQ== - dependencies: - graphql-import "^0.7.1" - graphql-request "^1.5.0" - js-yaml "^3.10.0" - lodash "^4.17.4" - minimatch "^3.0.4" - -graphql-extensions@^0.0.x, graphql-extensions@~0.0.9: - version "0.0.10" - resolved "https://registry.yarnpkg.com/graphql-extensions/-/graphql-extensions-0.0.10.tgz#34bdb2546d43f6a5bc89ab23c295ec0466c6843d" - integrity sha512-TnQueqUDCYzOSrpQb3q1ngDSP2otJSF+9yNLrQGPzkMsvnQ+v6e2d5tl+B35D4y+XpmvVnAn4T3ZK28mkILveA== - dependencies: - core-js "^2.5.3" - source-map-support "^0.5.1" - -graphql-fields@^1.0.2: - version "1.2.1" - resolved "https://registry.yarnpkg.com/graphql-fields/-/graphql-fields-1.2.1.tgz#3777112af0bd6f55cc3c7b8f6d7748ab7a1b23bb" - integrity sha512-ufg/dxb78IjQUblNfiaEMkZWD1CwcZjdK0nTEW0dBQyNArxKZI7N+zohZdIdqVJcihPWJod1yymx4NM+1bZjTw== - -graphql-import@0.7.1, graphql-import@^0.7.1: - version "0.7.1" - resolved "https://registry.yarnpkg.com/graphql-import/-/graphql-import-0.7.1.tgz#4add8d91a5f752d764b0a4a7a461fcd93136f223" - integrity sha512-YpwpaPjRUVlw2SN3OPljpWbVRWAhMAyfSba5U47qGMOSsPLi2gYeJtngGpymjm9nk57RFWEpjqwh4+dpYuFAPw== - dependencies: - lodash "^4.17.4" - resolve-from "^4.0.0" - -graphql-request@^1.5.0: - version "1.8.2" - resolved "https://registry.yarnpkg.com/graphql-request/-/graphql-request-1.8.2.tgz#398d10ae15c585676741bde3fc01d5ca948f8fbe" - integrity sha512-dDX2M+VMsxXFCmUX0Vo0TopIZIX4ggzOtiCsThgtrKR4niiaagsGTDIHj3fsOMFETpa064vzovI+4YV4QnMbcg== - dependencies: - cross-fetch "2.2.2" - -graphql-tag-pluck@0.6.0: - version "0.6.0" - resolved "https://registry.yarnpkg.com/graphql-tag-pluck/-/graphql-tag-pluck-0.6.0.tgz#d03ab981cd8d31e564d37f8b9bac94a523dc29dd" - integrity sha512-C1SRw5zZtl7CN7mv6Q0abFVSJwG8M+FniFCPqWD+AjQMj9igNPthraMUQ02KSo+j19khR60mksqmFN3BwboFaw== - dependencies: - "@babel/parser" "^7.2.0" - "@babel/traverse" "^7.1.6" - "@babel/types" "^7.2.0" - source-map-support "^0.5.9" - typescript "^3.2.2" - -graphql-tag@2.10.1: - version "2.10.1" - resolved "https://registry.yarnpkg.com/graphql-tag/-/graphql-tag-2.10.1.tgz#10aa41f1cd8fae5373eaf11f1f67260a3cad5e02" - integrity sha512-jApXqWBzNXQ8jYa/HLkZJaVw9jgwNqZkywa2zfFn16Iv1Zb7ELNHkJaXHR7Quvd5SIGsy6Ny7SUKATgnu05uEg== - -graphql-tag@^2.10.3: - version "2.10.3" - resolved "https://registry.yarnpkg.com/graphql-tag/-/graphql-tag-2.10.3.tgz#ea1baba5eb8fc6339e4c4cf049dabe522b0edf03" - integrity sha512-4FOv3ZKfA4WdOKJeHdz6B3F/vxBLSgmBcGeAFPf4n1F64ltJUvOOerNj0rsJxONQGdhUMynQIvd6LzB+1J5oKA== - -graphql-toolkit@0.2.0: - version "0.2.0" - resolved "https://registry.yarnpkg.com/graphql-toolkit/-/graphql-toolkit-0.2.0.tgz#91364b69911d51bc915269a37963f4ea2d5f335c" - integrity sha512-dMwb+V2u6vwJF70tWuqSxgNal9fK1xcB8JtmCJUStVUh+PjfNrlKH1X5e17vJlN+lRPz1hatr8jH+Q6lTW0jLw== - dependencies: - aggregate-error "2.1.0" - deepmerge "3.2.0" - glob "7.1.3" - graphql-import "0.7.1" - graphql-tag-pluck "0.6.0" - is-glob "4.0.0" - is-valid-path "0.1.1" - lodash "4.17.11" - request "2.88.0" - tslib "^1.9.3" - valid-url "1.0.9" - -graphql-tools@4.0.4: - version "4.0.4" - resolved "https://registry.yarnpkg.com/graphql-tools/-/graphql-tools-4.0.4.tgz#ca08a63454221fdde825fe45fbd315eb2a6d566b" - integrity sha512-chF12etTIGVVGy3fCTJ1ivJX2KB7OSG4c6UOJQuqOHCmBQwTyNgCDuejZKvpYxNZiEx7bwIjrodDgDe9RIkjlw== + integrity sha512-R7eWptXuGYxwijs0eV+v3o6+XH1IqVK8dJOEecQfTmkncw9AV4dcw/Dhxi8MdlqPthxxpZyizMzyg8RTmEsG+Q== dependencies: - apollo-link "^1.2.3" - apollo-utilities "^1.0.1" - deprecated-decorator "^0.1.6" - iterall "^1.1.3" - uuid "^3.1.0" + "@sindresorhus/is" "^0.14.0" + "@szmarczak/http-timer" "^1.1.2" + cacheable-request "^6.0.0" + decompress-response "^3.3.0" + duplexer3 "^0.1.4" + get-stream "^4.1.0" + lowercase-keys "^1.0.1" + mimic-response "^1.0.1" + p-cancelable "^1.0.0" + to-readable-stream "^1.0.0" + url-parse-lax "^3.0.0" -graphql-tools@^3.0.2: - version "3.1.1" - resolved "https://registry.yarnpkg.com/graphql-tools/-/graphql-tools-3.1.1.tgz#d593358f01e7c8b1671a17b70ddb034dea9dbc50" - integrity sha512-yHvPkweUB0+Q/GWH5wIG60bpt8CTwBklCSzQdEHmRUgAdEQKxw+9B7zB3dG7wB3Ym7M7lfrS4Ej+jtDZfA2UXg== - dependencies: - apollo-link "^1.2.2" - apollo-utilities "^1.0.1" - deprecated-decorator "^0.1.6" - iterall "^1.1.3" - uuid "^3.1.0" +graceful-fs@4.X, graceful-fs@^4.0.0, graceful-fs@^4.1.11, graceful-fs@^4.1.15, graceful-fs@^4.1.2, graceful-fs@^4.1.4, graceful-fs@^4.1.6, graceful-fs@^4.1.9, graceful-fs@^4.2.0, graceful-fs@^4.2.2, graceful-fs@^4.2.3, graceful-fs@^4.2.4: + version "4.2.4" + resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.2.4.tgz#2256bde14d3632958c465ebc96dc467ca07a29fb" + integrity sha512-WjKPNJF79dtJAVniUlGGWHYGz2jWxT6VhN/4m1NdkbZ2nOsEF+cI1Edgql5zCRhs/VsQYRvrXctxktVXZUkixw== -graphql@^0.13.2: - version "0.13.2" - resolved "https://registry.yarnpkg.com/graphql/-/graphql-0.13.2.tgz#4c740ae3c222823e7004096f832e7b93b2108270" - integrity sha512-QZ5BL8ZO/B20VA8APauGBg3GyEgZ19eduvpLWoq5x7gMmWnHoy8rlQWPLmWgFvo1yNgjSEFMesmS4R6pPr7xog== +graphlib@^2.1.8: + version "2.1.8" + resolved "https://registry.yarnpkg.com/graphlib/-/graphlib-2.1.8.tgz#5761d414737870084c92ec7b5dbcb0592c9d35da" + integrity sha512-jcLLfkpoVGmH7/InMC/1hIvOPSUh38oJtGhvrOFGzioE1DZ+0YW16RgmOJhHiuWTvGiJQ9Z1Ik43JvkRPRvE+A== dependencies: - iterall "^1.2.1" + lodash "^4.17.15" grid-index@^1.1.0: version "1.1.0" @@ -15514,6 +14901,11 @@ has-ansi@^3.0.0: dependencies: ansi-regex "^3.0.0" +has-bigints@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/has-bigints/-/has-bigints-1.0.1.tgz#64fe6acb020673e3b78db035a5af69aa9d07b113" + integrity sha512-LSBS2LjbNBTf6287JEbEzvJgftkF5qFkmCo9hDRpAzKhUOlJ+hx8dd4USs00SgsUNwc4617J9ki5YtEClM2ffA== + has-color@~0.1.0: version "0.1.7" resolved "https://registry.yarnpkg.com/has-color/-/has-color-0.1.7.tgz#67144a5260c34fc3cca677d041daf52fe7b78b2f" @@ -15541,10 +14933,10 @@ has-glob@^1.0.0: dependencies: is-glob "^3.0.0" -has-symbols@^1.0.0, has-symbols@^1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/has-symbols/-/has-symbols-1.0.1.tgz#9f5214758a44196c406d9bd76cebf81ec2dd31e8" - integrity sha512-PLcsoqu++dmEIZB+6totNFKq/7Do+Z0u4oT0zKOJNl3lYK6vGwwu2hjHs+68OEZbTjiUE9bgOABXbP/GvrS0Kg== +has-symbols@^1.0.0, has-symbols@^1.0.1, has-symbols@^1.0.2: + version "1.0.2" + resolved "https://registry.yarnpkg.com/has-symbols/-/has-symbols-1.0.2.tgz#165d3070c00309752a1236a479331e3ac56f1423" + integrity sha512-chXa79rL/UC2KlX17jo3vRGz0azaWEx5tGqZg5pO3NUyEJVB17dMruQlzCCOfUvElghKcm5194+BCRvi2Rv/Gw== has-unicode@^2.0.0: version "2.0.1" @@ -15752,14 +15144,6 @@ he@1.2.0, he@1.2.x, he@^1.2.0: resolved "https://registry.yarnpkg.com/he/-/he-1.2.0.tgz#84ae65fa7eafb165fddb61566ae14baf05664f0f" integrity sha512-F/1DnUGPopORZi0ni+CvrCgHQ5FyEAHRLSApuYWMmrbSwoN2Mn/7k+Gl38gJnR7yyDZk6WLXwiGod1JOWNDKGw== -header-case@^1.0.0: - version "1.0.1" - resolved "https://registry.yarnpkg.com/header-case/-/header-case-1.0.1.tgz#9535973197c144b09613cd65d317ef19963bd02d" - integrity sha1-lTWXMZfBRLCWE81l0xfvGZY70C0= - dependencies: - no-case "^2.2.0" - upper-case "^1.1.3" - heap@^0.2.6: version "0.2.6" resolved "https://registry.yarnpkg.com/heap/-/heap-0.2.6.tgz#087e1f10b046932fc8594dd9e6d378afc9d1e5ac" @@ -15821,7 +15205,7 @@ hoek@6.x.x: resolved "https://registry.yarnpkg.com/hoek/-/hoek-6.0.3.tgz#7884360426d927865a0a1251fc9c59313af5b798" integrity sha512-TU6RyZ/XaQCTWRLrdqZZtZqwxUVr6PDMfi6MlWNURZ7A6czanQqX4pFE1mdOUQR9FdPCsZ0UzL8jI/izZ+eBSQ== -hoist-non-react-statics@^2.3.1, hoist-non-react-statics@^2.5.0, hoist-non-react-statics@^2.5.5, hoist-non-react-statics@^3.0.0, hoist-non-react-statics@^3.1.0, hoist-non-react-statics@^3.3.0, hoist-non-react-statics@^3.3.2: +hoist-non-react-statics@^2.3.1, hoist-non-react-statics@^2.5.5, hoist-non-react-statics@^3.0.0, hoist-non-react-statics@^3.1.0, hoist-non-react-statics@^3.3.0, hoist-non-react-statics@^3.3.2: version "3.3.2" resolved "https://registry.yarnpkg.com/hoist-non-react-statics/-/hoist-non-react-statics-3.3.2.tgz#ece0acaf71d62c2969c2ec59feff42a4b1a85b45" integrity sha512-/gGivxi8JPKWNm/W0jSmzcMPpfpPLc3dY/6GxhX2hQ9iGj3aDfklV4ET7NjKpSinLpJ5vafa9iiGIEZg10SfBw== @@ -16275,7 +15659,7 @@ import-fresh@^3.0.0, import-fresh@^3.1.0, import-fresh@^3.2.1: parent-module "^1.0.0" resolve-from "^4.0.0" -import-from@2.1.0, import-from@^2.1.0: +import-from@^2.1.0: version "2.1.0" resolved "https://registry.yarnpkg.com/import-from/-/import-from-2.1.0.tgz#335db7f2a7affd53aaa471d4b8021dee36b7f3b1" integrity sha1-M1238qev/VOqpHHUuAId7ja387E= @@ -16318,11 +15702,6 @@ in-publish@^2.0.0: resolved "https://registry.yarnpkg.com/in-publish/-/in-publish-2.0.0.tgz#e20ff5e3a2afc2690320b6dc552682a9c7fadf51" integrity sha1-4g/146KvwmkDILbcVSaCqcf631E= -indent-string@3.2.0, indent-string@^3.0.0, indent-string@^3.1.0, indent-string@^3.2.0: - version "3.2.0" - resolved "https://registry.yarnpkg.com/indent-string/-/indent-string-3.2.0.tgz#4a5fd6d27cc332f37e5419a504dbb837105c9289" - integrity sha1-Sl/W0nzDMvN+VBmlBNu4NxBckok= - indent-string@^2.1.0: version "2.1.0" resolved "https://registry.yarnpkg.com/indent-string/-/indent-string-2.1.0.tgz#8e2d48348742121b4a8218b7a137e9a52049dc80" @@ -16330,6 +15709,11 @@ indent-string@^2.1.0: dependencies: repeating "^2.0.0" +indent-string@^3.0.0, indent-string@^3.1.0, indent-string@^3.2.0: + version "3.2.0" + resolved "https://registry.yarnpkg.com/indent-string/-/indent-string-3.2.0.tgz#4a5fd6d27cc332f37e5419a504dbb837105c9289" + integrity sha1-Sl/W0nzDMvN+VBmlBNu4NxBckok= + indent-string@^4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/indent-string/-/indent-string-4.0.0.tgz#624f8f4497d619b2d9768531d58f4122854d7251" @@ -16405,25 +15789,6 @@ inline-style@^2.0.0: dependencies: dashify "^0.1.0" -inquirer@6.2.2: - version "6.2.2" - resolved "https://registry.yarnpkg.com/inquirer/-/inquirer-6.2.2.tgz#46941176f65c9eb20804627149b743a218f25406" - integrity sha512-Z2rREiXA6cHRR9KBOarR3WuLlFzlIfAEIiB45ll5SSadMg7WqOh1MKEjjndfuH5ewXdixWCxqnVfGOQzPeiztA== - dependencies: - ansi-escapes "^3.2.0" - chalk "^2.4.2" - cli-cursor "^2.1.0" - cli-width "^2.0.0" - external-editor "^3.0.3" - figures "^2.0.0" - lodash "^4.17.11" - mute-stream "0.0.7" - run-async "^2.2.0" - rxjs "^6.4.0" - string-width "^2.1.0" - strip-ansi "^5.0.0" - through "^2.3.6" - inquirer@^7.0.0, inquirer@^7.3.3: version "7.3.3" resolved "https://registry.yarnpkg.com/inquirer/-/inquirer-7.3.3.tgz#04d176b2af04afc157a83fd7c100e98ee0aad003" @@ -16628,14 +15993,14 @@ is-arrayish@^0.2.1: integrity sha1-d8mYQFJ6qOyxqLppe4BkWnqSap0= is-arrayish@^0.3.1: - version "0.3.1" - resolved "https://registry.yarnpkg.com/is-arrayish/-/is-arrayish-0.3.1.tgz#c2dfc386abaa0c3e33c48db3fe87059e69065efd" - integrity sha1-wt/DhquqDD4zxI2z/ocFnmkGXv0= + version "0.3.2" + resolved "https://registry.yarnpkg.com/is-arrayish/-/is-arrayish-0.3.2.tgz#4574a2ae56f7ab206896fb431eaeed066fdf8f03" + integrity sha512-eVRqCvVlZbuw3GrM63ovNSNAeA1K16kaR/LRY/92w0zxQ5/1YzwblUX652i4Xs9RwAGjW9d9y6X88t8OaAJfWQ== -is-bigint@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/is-bigint/-/is-bigint-1.0.0.tgz#73da8c33208d00f130e9b5e15d23eac9215601c4" - integrity sha512-t5mGUXC/xRheCK431ylNiSkGGpBp8bHENBcENTkDT6ppwPzEVxNGZRvgvmOEfbWkFhA7D2GEuE2mmQTr78sl2g== +is-bigint@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/is-bigint/-/is-bigint-1.0.1.tgz#6923051dfcbc764278540b9ce0e6b3213aa5ebc2" + integrity sha512-J0ELF4yHFxHy0cmSxZuheDOz2luOdVvqjwmEcj8H/L1JHeuEDSDbeRP+Dk9kFVk5RTFzbucJ2Kb9F7ixY2QaCg== is-binary-path@^1.0.0: version "1.0.1" @@ -16651,10 +16016,12 @@ is-binary-path@~2.1.0: dependencies: binary-extensions "^2.0.0" -is-boolean-object@^1.0.0, is-boolean-object@^1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/is-boolean-object/-/is-boolean-object-1.0.1.tgz#10edc0900dd127697a92f6f9807c7617d68ac48e" - integrity sha512-TqZuVwa/sppcrhUCAYkGBk7w0yxfQQnxq28fjkO53tnK9FQXmdwz2JS5+GjsWQ6RByES1K40nI+yDic5c9/aAQ== +is-boolean-object@^1.0.1, is-boolean-object@^1.1.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/is-boolean-object/-/is-boolean-object-1.1.0.tgz#e2aaad3a3a8fca34c28f6eee135b156ed2587ff0" + integrity sha512-a7Uprx8UtD+HWdyYwnD1+ExtTgqQtD2k/1yJgtXP6wnMm8byhkoTZRl+95LLThpzNZJ5aEvi46cdH+ayMFRwmA== + dependencies: + call-bind "^1.0.0" is-buffer@^1.0.2, is-buffer@^1.1.0, is-buffer@^1.1.4, is-buffer@^1.1.5, is-buffer@~1.1.1: version "1.1.6" @@ -16666,15 +16033,10 @@ is-buffer@^2.0.0: resolved "https://registry.yarnpkg.com/is-buffer/-/is-buffer-2.0.3.tgz#4ecf3fcf749cbd1e472689e109ac66261a25e725" integrity sha512-U15Q7MXTuZlrbymiz95PJpZxu8IlipAp4dtS3wOdgPXx3mqBnslrWU14kxfHB+Py/+2PVKSr37dMAgM2A4uArw== -is-callable@^1.1.3, is-callable@^1.1.4, is-callable@^1.1.5, is-callable@^1.2.0: - version "1.2.0" - resolved "https://registry.yarnpkg.com/is-callable/-/is-callable-1.2.0.tgz#83336560b54a38e35e3a2df7afd0454d691468bb" - integrity sha512-pyVD9AaGLxtg6srb2Ng6ynWJqkHU9bEM087AKck0w8QwDarTfNcpIYoU8x8Hv2Icm8u6kFJM18Dag8lyqGkviw== - -is-callable@^1.2.2: - version "1.2.2" - resolved "https://registry.yarnpkg.com/is-callable/-/is-callable-1.2.2.tgz#c7c6715cd22d4ddb48d3e19970223aceabb080d9" - integrity sha512-dnMqspv5nU3LoewK2N/y7KLtxtakvTuaCsU9FU50/QDmdbHNy/4/JuRtMHqRU22o3q+W89YQndQEeCVwK+3qrA== +is-callable@^1.1.3, is-callable@^1.1.4, is-callable@^1.1.5, is-callable@^1.2.3: + version "1.2.3" + resolved "https://registry.yarnpkg.com/is-callable/-/is-callable-1.2.3.tgz#8b1e0500b73a1d76c70487636f368e519de8db8e" + integrity sha512-J1DcMe8UYTBSrKezuIUTUwjXsho29693unXM2YhJUTR2txK/eG47bvNa/wipPFmZFgr/N6f1GA66dv0mEyTIyQ== is-ci@^2.0.0: version "2.0.0" @@ -16828,13 +16190,6 @@ is-generator@^1.0.2: resolved "https://registry.yarnpkg.com/is-generator/-/is-generator-1.0.3.tgz#c14c21057ed36e328db80347966c693f886389f3" integrity sha1-wUwhBX7TbjKNuANHlmxpP4hjifM= -is-glob@4.0.0: - version "4.0.0" - resolved "https://registry.yarnpkg.com/is-glob/-/is-glob-4.0.0.tgz#9521c76845cc2610a85203ddf080a958c2ffabc0" - integrity sha1-lSHHaEXMJhCoUgPd8ICpWML/q8A= - dependencies: - is-extglob "^2.1.1" - is-glob@^2.0.0: version "2.0.1" resolved "https://registry.yarnpkg.com/is-glob/-/is-glob-2.0.1.tgz#d096f926a3ded5600f3fdfd91198cb0888c2d863" @@ -16881,20 +16236,6 @@ is-interactive@^1.0.0: resolved "https://registry.yarnpkg.com/is-interactive/-/is-interactive-1.0.0.tgz#cea6e6ae5c870a7b0a0004070b7b587e0252912e" integrity sha512-2HvIEKRoqS62guEC+qBjpvRubdX910WCMuJTZ+I9yvqKU2/12eSL549HMwtabb4oupdj2sMP50k+XJfB/8JE6w== -is-invalid-path@^0.1.0: - version "0.1.0" - resolved "https://registry.yarnpkg.com/is-invalid-path/-/is-invalid-path-0.1.0.tgz#307a855b3cf1a938b44ea70d2c61106053714f34" - integrity sha1-MHqFWzzxqTi0TqcNLGEQYFNxTzQ= - dependencies: - is-glob "^2.0.0" - -is-lower-case@^1.1.0: - version "1.1.3" - resolved "https://registry.yarnpkg.com/is-lower-case/-/is-lower-case-1.1.3.tgz#7e147be4768dc466db3bfb21cc60b31e6ad69393" - integrity sha1-fhR75HaNxGbbO/shzGCzHmrWk5M= - dependencies: - lower-case "^1.1.0" - is-map@^2.0.1: version "2.0.1" resolved "https://registry.yarnpkg.com/is-map/-/is-map-2.0.1.tgz#520dafc4307bb8ebc33b813de5ce7c9400d644a1" @@ -16913,10 +16254,10 @@ is-negated-glob@^1.0.0: resolved "https://registry.yarnpkg.com/is-negated-glob/-/is-negated-glob-1.0.0.tgz#6910bca5da8c95e784b5751b976cf5a10fee36d2" integrity sha1-aRC8pdqMleeEtXUbl2z1oQ/uNtI= -is-negative-zero@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/is-negative-zero/-/is-negative-zero-2.0.0.tgz#9553b121b0fac28869da9ed459e20c7543788461" - integrity sha1-lVOxIbD6wohp2p7UWeIMdUN4hGE= +is-negative-zero@^2.0.1: + version "2.0.1" + resolved "https://registry.yarnpkg.com/is-negative-zero/-/is-negative-zero-2.0.1.tgz#3de746c18dda2319241a53675908d8f766f11c24" + integrity sha512-2z6JzQvZRa9A2Y7xC6dQQm4FSTSTNWjKIYYTt4246eMTJmIo0Q+ZyOsU66X8lxK1AbB92dFeglPLrhwpeRKO6w== is-nil@^1.0.0: version "1.0.1" @@ -16933,7 +16274,7 @@ is-npm@^4.0.0: resolved "https://registry.yarnpkg.com/is-npm/-/is-npm-4.0.0.tgz#c90dd8380696df87a7a6d823c20d0b12bbe3c84d" integrity sha512-96ECIfh9xtDDlPylNPXhzjsykHsMJZ18ASpaWzQyBr4YRTcVjUvzaHayDAES2oU/3KpljhHUjtSRNiDwi0F0ig== -is-number-object@^1.0.3, is-number-object@^1.0.4: +is-number-object@^1.0.4: version "1.0.4" resolved "https://registry.yarnpkg.com/is-number-object/-/is-number-object-1.0.4.tgz#36ac95e741cf18b283fc1ddf5e83da798e3ec197" integrity sha512-zohwelOAur+5uXtk8O3GPQ1eAcu4ZX3UwxQhUlfFFMNpUd83gXgjbhJh6HmB6LUNV/ieOLQuDwJO3dWJosUeMw== @@ -17047,11 +16388,12 @@ is-redirect@^1.0.0: resolved "https://registry.yarnpkg.com/is-redirect/-/is-redirect-1.0.0.tgz#1d03dded53bd8db0f30c26e4f95d36fc7c87dc24" integrity sha1-HQPd7VO9jbDzDCbk+V02/HyH3CQ= -is-regex@^1.0.4, is-regex@^1.0.5, is-regex@^1.1.0, is-regex@^1.1.1: - version "1.1.1" - resolved "https://registry.yarnpkg.com/is-regex/-/is-regex-1.1.1.tgz#c6f98aacc546f6cec5468a07b7b153ab564a57b9" - integrity sha512-1+QkEcxiLlB7VEyFtyBg94e08OAsvq7FUBgApTq/w2ymCLyKJgDPsybBENVtA7XCQEgEXxKPonG+mvYRxh/LIg== +is-regex@^1.0.4, is-regex@^1.0.5, is-regex@^1.1.0, is-regex@^1.1.1, is-regex@^1.1.2: + version "1.1.2" + resolved "https://registry.yarnpkg.com/is-regex/-/is-regex-1.1.2.tgz#81c8ebde4db142f2cf1c53fc86d6a45788266251" + integrity sha512-axvdhb5pdhEVThqJzYXwMlVuZwC+FF2DpcOhTS+y/8jVq4trxyPgfcwIxIKiyeuLlSQYKkmUaPQJ8ZE4yNKXDg== dependencies: + call-bind "^1.0.2" has-symbols "^1.0.1" is-regexp@^2.0.0: @@ -17142,13 +16484,6 @@ is-unc-path@^1.0.0: dependencies: unc-path-regex "^0.1.2" -is-upper-case@^1.1.0: - version "1.1.2" - resolved "https://registry.yarnpkg.com/is-upper-case/-/is-upper-case-1.1.2.tgz#8d0b1fa7e7933a1e58483600ec7d9661cbaf756f" - integrity sha1-jQsfp+eTOh5YSDYA7H2WYcuvdW8= - dependencies: - upper-case "^1.1.0" - is-url@^1.2.2: version "1.2.4" resolved "https://registry.yarnpkg.com/is-url/-/is-url-1.2.4.tgz#04a4df46d28c4cff3d73d01ff06abeb318a1aa52" @@ -17164,13 +16499,6 @@ is-valid-glob@^1.0.0: resolved "https://registry.yarnpkg.com/is-valid-glob/-/is-valid-glob-1.0.0.tgz#29bf3eff701be2d4d315dbacc39bc39fe8f601aa" integrity sha1-Kb8+/3Ab4tTTFdusw5vDn+j2Aao= -is-valid-path@0.1.1: - version "0.1.1" - resolved "https://registry.yarnpkg.com/is-valid-path/-/is-valid-path-0.1.1.tgz#110f9ff74c37f663e1ec7915eb451f2db93ac9df" - integrity sha1-EQ+f90w39mPh7HkV60UfLbk6yd8= - dependencies: - is-invalid-path "^0.1.0" - is-weakmap@^2.0.1: version "2.0.1" resolved "https://registry.yarnpkg.com/is-weakmap/-/is-weakmap-2.0.1.tgz#5008b59bdc43b698201d18f62b37b2ca243e8cf2" @@ -17383,11 +16711,6 @@ istanbul-reports@^3.0.2: html-escaper "^2.0.0" istanbul-lib-report "^3.0.0" -iterall@^1.1.3, iterall@^1.2.1: - version "1.2.2" - resolved "https://registry.yarnpkg.com/iterall/-/iterall-1.2.2.tgz#92d70deb8028e0c39ff3164fdbf4d8b088130cd7" - integrity sha512-yynBb1g+RFUPY64fTrFv7nsjRrENBQJaX2UL+2Szc9REFrSNm1rpSXHGzhmAy7a9uv3vlvgBlXnf9RqmPH1/DA== - iterate-iterator@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/iterate-iterator/-/iterate-iterator-1.0.1.tgz#1693a768c1ddd79c969051459453f082fe82e9f6" @@ -17416,13 +16739,13 @@ jake@^10.6.1: filelist "^1.0.1" minimatch "^3.0.4" -jest-canvas-mock@^2.2.0: - version "2.2.0" - resolved "https://registry.yarnpkg.com/jest-canvas-mock/-/jest-canvas-mock-2.2.0.tgz#45fbc58589c6ce9df50dc90bd8adce747cbdada7" - integrity sha512-DcJdchb7eWFZkt6pvyceWWnu3lsp5QWbUeXiKgEMhwB3sMm5qHM1GQhDajvJgBeiYpgKcojbzZ53d/nz6tXvJw== +jest-canvas-mock@^2.3.1: + version "2.3.1" + resolved "https://registry.yarnpkg.com/jest-canvas-mock/-/jest-canvas-mock-2.3.1.tgz#9535d14bc18ccf1493be36ac37dd349928387826" + integrity sha512-5FnSZPrX3Q2ZfsbYNE3wqKR3+XorN8qFzDzB5o0golWgt6EOX1+emBnpOc9IAQ+NXFj8Nzm3h7ZdE/9H0ylBcg== dependencies: cssfontparser "^1.2.1" - parse-color "^1.0.0" + moo-color "^1.0.2" jest-changed-files@^26.6.2: version "26.6.2" @@ -17523,7 +16846,7 @@ jest-diff@^25.2.1: jest-get-type "^25.2.6" pretty-format "^25.5.0" -jest-diff@^26.6.2: +jest-diff@^26.0.0, jest-diff@^26.6.2: version "26.6.2" resolved "https://registry.yarnpkg.com/jest-diff/-/jest-diff-26.6.2.tgz#1aa7468b52c3a68d7d5c5fdcdfcd5e49bd164394" integrity sha512-6m+9Z3Gv9wN0WFVasqjCL/06+EFCMTqDEUl/b87HYK2rAPTyfz4ZIuSlPhY51PIQRWx5TaxeF1qmXKe9gfN3sA== @@ -17551,15 +16874,6 @@ jest-each@^26.6.2: jest-util "^26.6.2" pretty-format "^26.6.2" -jest-environment-jsdom-thirteen@^1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/jest-environment-jsdom-thirteen/-/jest-environment-jsdom-thirteen-1.0.1.tgz#113e3c8aed945dadbc826636fa21139c69567bb5" - integrity sha512-Zi7OuKF7HMLlBvomitd5eKp5Ykc4Wvw0d+i+cpbCaE+7kmvL24SO4ssDmKrT++aANXR4T8+pmoJIlav5gr2peQ== - dependencies: - jest-mock "^24.0.0" - jest-util "^24.0.0" - jsdom "^13.0.0" - jest-environment-jsdom@^26.6.2: version "26.6.2" resolved "https://registry.yarnpkg.com/jest-environment-jsdom/-/jest-environment-jsdom-26.6.2.tgz#78d09fe9cf019a357009b9b7e1f101d23bd1da3e" @@ -17600,7 +16914,7 @@ jest-get-type@^26.3.0: resolved "https://registry.yarnpkg.com/jest-get-type/-/jest-get-type-26.3.0.tgz#e97dc3c3f53c2b406ca7afaed4493b1d099199e0" integrity sha512-TpfaviN1R2pQWkIihlfEanwOXK0zcxrKEE4MlU6Tn7keoXdN6/3gK/xl0yEh8DOunn5pOVGKf8hB4R9gVh04ig== -jest-haste-map@^26.5.2, jest-haste-map@^26.6.2: +jest-haste-map@^26.6.2: version "26.6.2" resolved "https://registry.yarnpkg.com/jest-haste-map/-/jest-haste-map-26.6.2.tgz#dd7e60fe7dc0e9f911a23d79c5ff7fb5c2cafeaa" integrity sha512-easWIJXIw71B2RdR8kgqpjQrbMRWQBgiBwXYEhtGUTaX+doCjBheluShdDMeR8IMfJiTqH4+zfhtg29apJf/8w== @@ -17702,13 +17016,6 @@ jest-message-util@^26.6.2: slash "^3.0.0" stack-utils "^2.0.2" -jest-mock@^24.0.0, jest-mock@^24.9.0: - version "24.9.0" - resolved "https://registry.yarnpkg.com/jest-mock/-/jest-mock-24.9.0.tgz#c22835541ee379b908673ad51087a2185c13f1c6" - integrity sha512-3BEYN5WbSq9wd+SyLDES7AHnjH9A/ROBwmz7l2y+ol+NtSFO8DYiEBzoO1CeFc9a8DYy10EO4dDFVv/wN3zl1w== - dependencies: - "@jest/types" "^24.9.0" - jest-mock@^26.6.2: version "26.6.2" resolved "https://registry.yarnpkg.com/jest-mock/-/jest-mock-26.6.2.tgz#d6cb712b041ed47fe0d9b6fc3474bc6543feb302" @@ -17757,7 +17064,7 @@ jest-resolve@^24.9.0: jest-pnp-resolver "^1.2.1" realpath-native "^1.1.0" -jest-resolve@^26.5.2, jest-resolve@^26.6.2: +jest-resolve@^26.6.2: version "26.6.2" resolved "https://registry.yarnpkg.com/jest-resolve/-/jest-resolve-26.6.2.tgz#a3ab1517217f469b504f1b56603c5bb541fbb507" integrity sha512-sOxsZOq25mT1wRsfHcbtkInS+Ek7Q8jCHUB0ZUTP0tc/c41QHriU/NunqMfCUWsL4H3MHpvQD4QR9kSYhS7UvQ== @@ -17838,13 +17145,13 @@ jest-serializer@^26.6.2: "@types/node" "*" graceful-fs "^4.2.4" -jest-silent-reporter@^0.2.1: - version "0.2.1" - resolved "https://registry.yarnpkg.com/jest-silent-reporter/-/jest-silent-reporter-0.2.1.tgz#554dd62b800989cdbcfba22bf30a1c0db6ad289c" - integrity sha512-nEO3oOFHtEXFjlRCbJOlvEWA7ZHyyyvMsU4WHuAhinYBOI4PiX1EIbsZfQZ/cxHcYliHBU9zY8bPxMPdBGksYw== +jest-silent-reporter@^0.5.0: + version "0.5.0" + resolved "https://registry.yarnpkg.com/jest-silent-reporter/-/jest-silent-reporter-0.5.0.tgz#5fd8ccd61665227e3bf19d908b7350719d06ff38" + integrity sha512-epdLt8Oj0a1AyRiR6F8zx/1SVT1Mi7VU3y4wB2uOBHs/ohIquC7v2eeja7UN54uRPyHInIKWdL+RdG228n5pJQ== dependencies: - chalk "^2.3.1" - jest-util "^24.0.0" + chalk "^4.0.0" + jest-util "^26.0.0" jest-snapshot@^24.1.0: version "24.9.0" @@ -17901,32 +17208,14 @@ jest-specific-snapshot@^4.0.0: dependencies: jest-snapshot "^26.3.0" -jest-styled-components@^7.0.2: - version "7.0.2" - resolved "https://registry.yarnpkg.com/jest-styled-components/-/jest-styled-components-7.0.2.tgz#b7711871ea74a04491b12bad123fa35cc65a2a80" - integrity sha512-i1Qke8Jfgx0Why31q74ohVj9S2FmMLUE8bNRSoK4DgiurKkXG6HC4NPhcOLAz6VpVd9wXkPn81hOt4aAQedqsA== +jest-styled-components@^7.0.3: + version "7.0.3" + resolved "https://registry.yarnpkg.com/jest-styled-components/-/jest-styled-components-7.0.3.tgz#cc0b031f910484e68f175568682f3969ff774b2c" + integrity sha512-jj9sWyshehUnB0P9WFUaq9Bkh6RKYO8aD8lf3gUrXRwg/MRddTFk7U9D9pC4IAI3v9fbz4vmrMxwaecTpG8NKA== dependencies: css "^2.2.4" -jest-util@^24.0.0: - version "24.9.0" - resolved "https://registry.yarnpkg.com/jest-util/-/jest-util-24.9.0.tgz#7396814e48536d2e85a37de3e4c431d7cb140162" - integrity sha512-x+cZU8VRmOJxbA1K5oDBdxQmdq0OIdADarLxk0Mq+3XS4jgvhG/oKGWcIDCtPG0HgjxOYvF+ilPJQsAyXfbNOg== - dependencies: - "@jest/console" "^24.9.0" - "@jest/fake-timers" "^24.9.0" - "@jest/source-map" "^24.9.0" - "@jest/test-result" "^24.9.0" - "@jest/types" "^24.9.0" - callsites "^3.0.0" - chalk "^2.0.1" - graceful-fs "^4.1.15" - is-ci "^2.0.0" - mkdirp "^0.5.1" - slash "^2.0.0" - source-map "^0.6.0" - -jest-util@^26.5.2, jest-util@^26.6.2: +jest-util@^26.0.0, jest-util@^26.6.2: version "26.6.2" resolved "https://registry.yarnpkg.com/jest-util/-/jest-util-26.6.2.tgz#907535dbe4d5a6cb4c47ac9b926f6af29576cbc1" integrity sha512-MDW0fKfsn0OI7MS7Euz6h8HNDXVQ0gaM9uW6RjfDmd1DAFcaxX9OqIakHIqhbnmF08Cf2DLDG+ulq8YQQ0Lp0Q== @@ -17963,10 +17252,10 @@ jest-watcher@^26.6.2: jest-util "^26.6.2" string-length "^4.0.1" -jest-when@^2.7.2: - version "2.7.2" - resolved "https://registry.yarnpkg.com/jest-when/-/jest-when-2.7.2.tgz#b7b4225e8882bd84a1cfd09216b2c63d22f892bd" - integrity sha512-GuVzimG0wW18A5JlYwhHrvuwmWRAQpsnilRVdJktvrZX5V0++al1f/iwITE7+Cud8Rbw/U2eka4tyy7kvxIWnw== +jest-when@^3.2.1: + version "3.2.1" + resolved "https://registry.yarnpkg.com/jest-when/-/jest-when-3.2.1.tgz#69b58ff641a399a0f2db5bfee6d8dd40cd065eb8" + integrity sha512-7OuFR5f2AdDPoRs/uk99dEWI+Isc2SFThugPjVUZgLLhWqeGr64rCFuuYcxVXQKwBmF3GG/MCS6zcKR9H86qiw== dependencies: bunyan "^1.8.12" expect "^24.8.0" @@ -17979,7 +17268,7 @@ jest-worker@^25.4.0: merge-stream "^2.0.0" supports-color "^7.0.0" -jest-worker@^26.2.1, jest-worker@^26.3.0, jest-worker@^26.5.0, jest-worker@^26.6.2: +jest-worker@^26.2.1, jest-worker@^26.3.0, jest-worker@^26.6.2: version "26.6.2" resolved "https://registry.yarnpkg.com/jest-worker/-/jest-worker-26.6.2.tgz#7f72cbc4d643c365e27b9fd775f9d0eaa9c7a8ed" integrity sha512-KWYVV1c4i+jbMpaBC+U++4Va0cp8OisU185o73T1vo99hqi7w8tSJfUXYswwqqrjzwxa6KpRK54WhPvwf5w6PQ== @@ -18109,7 +17398,7 @@ js-tokens@^4.0.0: resolved "https://registry.yarnpkg.com/js-tokens/-/js-tokens-4.0.0.tgz#19203fb59991df98e3a287050d4647cdeaf32499" integrity sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ== -js-yaml@3.13.1, js-yaml@^3.10.0, js-yaml@^3.13.1, js-yaml@^3.9.0, js-yaml@~3.13.1: +js-yaml@3.13.1, js-yaml@^3.13.1, js-yaml@^3.9.0, js-yaml@~3.13.1: version "3.13.1" resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-3.13.1.tgz#aff151b30bfdfa8e49e05da22e7415e9dfa37847" integrity sha512-YfbcO7jXDdyj0DGxYVSlSeQNHbD7XPWvrVWeVUujrQEoZzWJIRrCPoyk6kL6IAjAG2IolMK4T0hNUe0HOUs5Jw== @@ -18130,7 +17419,7 @@ jsbn@~0.1.0: resolved "https://registry.yarnpkg.com/jsbn/-/jsbn-0.1.1.tgz#a5e654c2e5a2deb5f201d96cefbca80c0ef2f513" integrity sha1-peZUwuWi3rXyAdls77yoDA7y9RM= -jsdom@13.1.0, jsdom@^13.0.0: +jsdom@13.1.0: version "13.1.0" resolved "https://registry.yarnpkg.com/jsdom/-/jsdom-13.1.0.tgz#fa7356f0cc8111d0f1077cb7800d06f22f1d66c7" integrity sha512-C2Kp0qNuopw0smXFaHeayvharqF3kkcNqlcIlSX71+3XrsOFwkEPLt/9f5JksMmaul2JZYIQuY+WTpqHpQQcLg== @@ -18268,14 +17557,6 @@ json-stringify-safe@5.0.1, json-stringify-safe@^5.0.1, json-stringify-safe@~5.0. resolved "https://registry.yarnpkg.com/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz#1296a2d58fd45f19a0f6ce01d65701e2c735b6eb" integrity sha1-Epai1Y/UXxmg9s4B1lcB4sc1tus= -json-to-pretty-yaml@1.2.2: - version "1.2.2" - resolved "https://registry.yarnpkg.com/json-to-pretty-yaml/-/json-to-pretty-yaml-1.2.2.tgz#f4cd0bd0a5e8fe1df25aaf5ba118b099fd992d5b" - integrity sha1-9M0L0KXo/h3yWq9boRiwmf2ZLVs= - dependencies: - remedial "^1.0.7" - remove-trailing-spaces "^1.0.6" - json2module@^0.0.3: version "0.0.3" resolved "https://registry.yarnpkg.com/json2module/-/json2module-0.0.3.tgz#00fb5f4a9b7adfc3f0647c29cb17bcd1979be9b2" @@ -18531,13 +17812,6 @@ knuth-shuffle-seeded@^1.0.6: dependencies: seed-random "~2.2.0" -kuler@1.0.x: - version "1.0.1" - resolved "https://registry.yarnpkg.com/kuler/-/kuler-1.0.1.tgz#ef7c784f36c9fb6e16dd3150d152677b2b0228a6" - integrity sha512-J9nVUucG1p/skKul6DU3PUZrhs0LPulNaeUOox0IyXDi8S4CztTHs1gQphhuZmzXG7VOQSf6NJfKuzteQLv9gQ== - dependencies: - colornames "^1.1.1" - kuler@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/kuler/-/kuler-2.0.0.tgz#e2c570a3800388fb44407e851531c1d670b061b3" @@ -18753,7 +18027,7 @@ listr-silent-renderer@^1.1.1: resolved "https://registry.yarnpkg.com/listr-silent-renderer/-/listr-silent-renderer-1.1.1.tgz#924b5a3757153770bf1a8e3fbf74b8bbf3f9242e" integrity sha1-kktaN1cVN3C/Go4/v3S4u/P5JC4= -listr-update-renderer@0.5.0, listr-update-renderer@^0.5.0: +listr-update-renderer@^0.5.0: version "0.5.0" resolved "https://registry.yarnpkg.com/listr-update-renderer/-/listr-update-renderer-0.5.0.tgz#4ea8368548a7b8aecb7e06d8c95cb45ae2ede6a2" integrity sha512-tKRsZpKz8GSGqoI/+caPmfrypiaq+OQCbd+CovEC24uk1h952lVj5sC7SqyFUm+OaJ5HN/a1YLt5cit2FMNsFA== @@ -18777,7 +18051,7 @@ listr-verbose-renderer@^0.5.0: date-fns "^1.27.2" figures "^2.0.0" -listr@0.14.3, listr@^0.14.1, listr@^0.14.3: +listr@^0.14.1, listr@^0.14.3: version "0.14.3" resolved "https://registry.yarnpkg.com/listr/-/listr-0.14.3.tgz#2fea909604e434be464c50bddba0d496928fa586" integrity sha512-RmAl7su35BFd/xoMamRjpIE4j3v+L28o8CT5YhAXQJm1fD+1l9ngXY8JAQRJ+tFK2i5njvi0iRUKV09vPwA0iA== @@ -19178,7 +18452,7 @@ lodash.uniq@4.5.0, lodash.uniq@^4.5.0: resolved "https://registry.yarnpkg.com/lodash.uniq/-/lodash.uniq-4.5.0.tgz#d0225373aeb652adc1bc82e4945339a842754773" integrity sha1-0CJTc662Uq3BvILklFM5qEJ1R3M= -lodash@4.17.11, lodash@4.17.15, lodash@>4.17.4, lodash@^4.0.0, lodash@^4.0.1, lodash@^4.10.0, lodash@^4.15.0, lodash@^4.17.10, lodash@^4.17.11, lodash@^4.17.13, lodash@^4.17.14, lodash@^4.17.15, lodash@^4.17.19, lodash@^4.17.20, lodash@^4.17.21, lodash@^4.17.4, lodash@^4.2.0, lodash@~4.17.10, lodash@~4.17.15, lodash@~4.17.19, lodash@~4.17.20: +lodash@4.17.15, lodash@>4.17.4, lodash@^4.0.0, lodash@^4.0.1, lodash@^4.10.0, lodash@^4.15.0, lodash@^4.17.10, lodash@^4.17.11, lodash@^4.17.13, lodash@^4.17.14, lodash@^4.17.15, lodash@^4.17.19, lodash@^4.17.20, lodash@^4.17.21, lodash@^4.17.4, lodash@~4.17.10, lodash@~4.17.15, lodash@~4.17.19, lodash@~4.17.20: version "4.17.21" resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.21.tgz#679591c564c3bffaae8454cf0b3df370c3d6911c" integrity sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg== @@ -19191,13 +18465,6 @@ log-ok@^0.1.1: ansi-green "^0.1.1" success-symbol "^0.1.0" -log-symbols@2.2.0: - version "2.2.0" - resolved "https://registry.yarnpkg.com/log-symbols/-/log-symbols-2.2.0.tgz#5740e1c5d6f0dfda4ad9323b5332107ef6b4c40a" - integrity sha512-VeIAFslyIerEJLXHziedo2basKbMKtTw3vfn5IzG0XTjhAVEJyNHnL2p7vc+wBDSdQuUpNw3M2u6xb9QsAY5Eg== - dependencies: - chalk "^2.0.1" - log-symbols@4.0.0, log-symbols@^4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/log-symbols/-/log-symbols-4.0.0.tgz#69b3cc46d20f448eccdb75ea1fa733d9e821c920" @@ -19219,7 +18486,7 @@ log-symbols@^3.0.0: dependencies: chalk "^2.4.2" -log-update@2.3.0, log-update@^2.3.0: +log-update@^2.3.0: version "2.3.0" resolved "https://registry.yarnpkg.com/log-update/-/log-update-2.3.0.tgz#88328fd7d1ce7938b29283746f0b1bc126b24708" integrity sha1-iDKP19HOeTiykoN0bwsbwSayRwg= @@ -19228,7 +18495,7 @@ log-update@2.3.0, log-update@^2.3.0: cli-cursor "^2.0.0" wrap-ansi "^3.0.1" -logform@^2.1.1, logform@^2.2.0: +logform@^2.2.0: version "2.2.0" resolved "https://registry.yarnpkg.com/logform/-/logform-2.2.0.tgz#40f036d19161fc76b68ab50fdc7fe495544492f2" integrity sha512-N0qPlqfypFx7UHNn4B3lzS/b0uLqt2hmuoa+PpuXNYgozdJYAyauF5Ky0BWVjrxDlMWiT3qN4zPq3vVAfZy7Yg== @@ -19286,14 +18553,7 @@ loud-rejection@^1.0.0: currently-unhandled "^0.4.1" signal-exit "^3.0.0" -lower-case-first@^1.0.0: - version "1.0.2" - resolved "https://registry.yarnpkg.com/lower-case-first/-/lower-case-first-1.0.2.tgz#e5da7c26f29a7073be02d52bac9980e5922adfa1" - integrity sha1-5dp8JvKacHO+AtUrrJmA5ZIq36E= - dependencies: - lower-case "^1.1.2" - -lower-case@^1.1.0, lower-case@^1.1.1, lower-case@^1.1.2: +lower-case@^1.1.1: version "1.1.4" resolved "https://registry.yarnpkg.com/lower-case/-/lower-case-1.1.4.tgz#9a2cabd1b9e8e0ae993a4bf7d5875c39c42e8eac" integrity sha1-miyr0bno4K6ZOkv31YdcOcQujqw= @@ -20255,6 +19515,13 @@ monocle-ts@^1.0.0: resolved "https://registry.yarnpkg.com/monocle-ts/-/monocle-ts-1.7.1.tgz#03a615938aa90983a4fa29749969d30f72d80ba1" integrity sha512-X9OzpOyd/R83sYex8NYpJjUzi/MLQMvGNVfxDYiIvs+QMXMEUDwR61MQoARFN10Cqz5h/mbFSPnIQNUIGhYd2Q== +moo-color@^1.0.2: + version "1.0.2" + resolved "https://registry.yarnpkg.com/moo-color/-/moo-color-1.0.2.tgz#837c40758d2d58763825d1359a84e330531eca64" + integrity sha512-5iXz5n9LWQzx/C2WesGFfpE6RLamzdHwsn3KpfzShwbfIqs7stnoEpaNErf/7+3mbxwZ4s8Foq7I0tPxw7BWHg== + dependencies: + color-name "^1.1.4" + moo@^0.4.3: version "0.4.3" resolved "https://registry.yarnpkg.com/moo/-/moo-0.4.3.tgz#3f847a26f31cf625a956a87f2b10fbc013bfd10e" @@ -20383,11 +19650,6 @@ mute-stdout@^1.0.0: resolved "https://registry.yarnpkg.com/mute-stdout/-/mute-stdout-1.0.1.tgz#acb0300eb4de23a7ddeec014e3e96044b3472331" integrity sha512-kDcwXR4PS7caBpuRYYBUz9iVixUk3anO3f5OYFiIPwK/20vCzKCHyKoulbiDY1S53zD2bxUpxN/IJ+TnXjfvxg== -mute-stream@0.0.7: - version "0.0.7" - resolved "https://registry.yarnpkg.com/mute-stream/-/mute-stream-0.0.7.tgz#3075ce93bc21b8fab43e1bc4da7e8115ed1e7bab" - integrity sha1-MHXOk7whuPq0PhvE2n6BFe0ee6s= - mute-stream@0.0.8: version "0.0.8" resolved "https://registry.yarnpkg.com/mute-stream/-/mute-stream-0.0.8.tgz#1630c42b2251ff81e2a283de96a5497ea92e5e0d" @@ -20577,7 +19839,7 @@ nise@^1.5.2: lolex "^5.0.1" path-to-regexp "^1.7.0" -no-case@^2.2.0, no-case@^2.3.2: +no-case@^2.2.0: version "2.3.2" resolved "https://registry.yarnpkg.com/no-case/-/no-case-2.3.2.tgz#60b813396be39b3f1288a4c1ed5d1e7d28b464ac" integrity sha512-rmTZ9kz+f3rCvK2TD1Ue/oZlns7OGoIWP4fc3llxxRXlOkHKoWPPWJOfFYpITabSow43QJbRIoHQXtt10VldyQ== @@ -20621,7 +19883,7 @@ node-emoji@^1.10.0: dependencies: lodash.toarray "^4.4.0" -node-fetch@2.1.2, node-fetch@^1.0.1, node-fetch@^2.3.0, node-fetch@^2.6.0, node-fetch@^2.6.1: +node-fetch@^1.0.1, node-fetch@^2.3.0, node-fetch@^2.6.0, node-fetch@^2.6.1: version "2.6.1" resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-2.6.1.tgz#045bd323631f76ed2e2b55573394416b639a0052" integrity sha512-V4aYg89jEoVRxRb2fJdAg8FHvI7cEyYdVAh94HH0UIK8oJxUfkjlDQN9RbMx+bEjP7+ggMiFRprSti032Oipxw== @@ -21066,15 +20328,10 @@ object-identity-map@^1.0.2: dependencies: object.entries "^1.1.0" -object-inspect@^1.6.0, object-inspect@^1.7.0: - version "1.7.0" - resolved "https://registry.yarnpkg.com/object-inspect/-/object-inspect-1.7.0.tgz#f4f6bd181ad77f006b5ece60bd0b6f398ff74a67" - integrity sha512-a7pEHdh1xKIAgTySUGgLMx/xwDZskN1Ud6egYYN3EdRW4ZMPNEDUTF+hwy2LUC+Bl+SyLXANnwz/jyh/qutKUw== - -object-inspect@^1.8.0: - version "1.8.0" - resolved "https://registry.yarnpkg.com/object-inspect/-/object-inspect-1.8.0.tgz#df807e5ecf53a609cc6bfe93eac3cc7be5b3a9d0" - integrity sha512-jLdtEOB112fORuypAyl/50VRVIBIdVQOSUUGQHzJ4xBSbit81zRarz7GThkEFZy1RceYrWYcPcBFPQwHyAc1gA== +object-inspect@^1.6.0, object-inspect@^1.7.0, object-inspect@^1.9.0: + version "1.9.0" + resolved "https://registry.yarnpkg.com/object-inspect/-/object-inspect-1.9.0.tgz#c90521d74e1127b67266ded3394ad6116986533a" + integrity sha512-i3Bp9iTqwhaLZBxGkRfo5ZbE07BQRT7MGu8+nNgwW9ItGp1TzCTw2DLEoWwjClxBjOFI/hWljTAmYGCEwmtnOw== object-inspect@~1.6.0: version "1.6.0" @@ -21089,7 +20346,7 @@ object-is@^1.0.1, object-is@^1.0.2, object-is@^1.1.2: define-properties "^1.1.3" es-abstract "^1.17.5" -object-keys@^1.0.11, object-keys@^1.0.12, object-keys@^1.1.1: +object-keys@^1.0.12, object-keys@^1.1.1: version "1.1.1" resolved "https://registry.yarnpkg.com/object-keys/-/object-keys-1.1.1.tgz#1c47f272df277f3b1daf061677d9c82e2322c60e" integrity sha512-NuAESUOUMrlIXOfHKzD6bpPu3tYt3xvjNdRIQ+FeT0lNb4K8WR70CaDxhuNguS2XG+GjkyMwOzsN5ZktImfhLA== @@ -21108,23 +20365,13 @@ object-visit@^1.0.0: dependencies: isobject "^3.0.0" -object.assign@^4.0.4, object.assign@^4.1.0: - version "4.1.0" - resolved "https://registry.yarnpkg.com/object.assign/-/object.assign-4.1.0.tgz#968bf1100d7956bb3ca086f006f846b3bc4008da" - integrity sha512-exHJeq6kBKj58mqGyTQ9DFvrZC/eR6OwxzoM9YRoGBqrXYonaFyGiFMuc9VZrXf7DarreEwMpurG3dd+CNyW5w== - dependencies: - define-properties "^1.1.2" - function-bind "^1.1.1" - has-symbols "^1.0.0" - object-keys "^1.0.11" - -object.assign@^4.1.1: - version "4.1.1" - resolved "https://registry.yarnpkg.com/object.assign/-/object.assign-4.1.1.tgz#303867a666cdd41936ecdedfb1f8f3e32a478cdd" - integrity sha512-VT/cxmx5yaoHSOTSyrCygIDFco+RsibY2NM0a4RdEeY/4KgqezwFtK1yr3U67xYhqJSlASm2pKhLVzPj2lr4bA== +object.assign@^4.0.4, object.assign@^4.1.0, object.assign@^4.1.2: + version "4.1.2" + resolved "https://registry.yarnpkg.com/object.assign/-/object.assign-4.1.2.tgz#0ed54a342eceb37b38ff76eb831a0e788cb63940" + integrity sha512-ixT2L5THXsApyiUPYKmW+2EHpXXe5Ii3M+f4e+aJFAHao5amFRW6J0OO6c/LU8Be47utCx2GL89hxGB6XSmKuQ== dependencies: + call-bind "^1.0.0" define-properties "^1.1.3" - es-abstract "^1.18.0-next.0" has-symbols "^1.0.1" object-keys "^1.1.1" @@ -21147,14 +20394,14 @@ object.entries@^1.0.4, object.entries@^1.1.0, object.entries@^1.1.1, object.entr es-abstract "^1.17.5" has "^1.0.3" -"object.fromentries@^2.0.0 || ^1.0.0", object.fromentries@^2.0.2: - version "2.0.2" - resolved "https://registry.yarnpkg.com/object.fromentries/-/object.fromentries-2.0.2.tgz#4a09c9b9bb3843dd0f89acdb517a794d4f355ac9" - integrity sha512-r3ZiBH7MQppDJVLx6fhD618GKNG40CZYH9wgwdhKxBDDbQgjeWGGd4AtkZad84d291YxvWe7bJGuE65Anh0dxQ== +"object.fromentries@^2.0.0 || ^1.0.0", object.fromentries@^2.0.2, object.fromentries@^2.0.3: + version "2.0.4" + resolved "https://registry.yarnpkg.com/object.fromentries/-/object.fromentries-2.0.4.tgz#26e1ba5c4571c5c6f0890cef4473066456a120b8" + integrity sha512-EsFBshs5RUUpQEY1D4q/m59kMfz4YJvxuNCJcv/jWwOJr34EaVnG11ZrZa0UHB3wnzV1wx8m58T4hQL8IuNXlQ== dependencies: + call-bind "^1.0.2" define-properties "^1.1.3" - es-abstract "^1.17.0-next.1" - function-bind "^1.1.1" + es-abstract "^1.18.0-next.2" has "^1.0.3" object.getownpropertydescriptors@^2.0.3, object.getownpropertydescriptors@^2.1.0: @@ -21188,14 +20435,14 @@ object.reduce@^1.0.0: for-own "^1.0.0" make-iterator "^1.0.0" -object.values@^1.1.0, object.values@^1.1.1: - version "1.1.1" - resolved "https://registry.yarnpkg.com/object.values/-/object.values-1.1.1.tgz#68a99ecde356b7e9295a3c5e0ce31dc8c953de5e" - integrity sha512-WTa54g2K8iu0kmS/us18jEmdv1a4Wi//BZ/DTVYEcH0XhLM5NYdpDHja3gt57VrZLcNAO2WGA+KpWsDBaHt6eA== +object.values@^1.1.0, object.values@^1.1.1, object.values@^1.1.2: + version "1.1.3" + resolved "https://registry.yarnpkg.com/object.values/-/object.values-1.1.3.tgz#eaa8b1e17589f02f698db093f7c62ee1699742ee" + integrity sha512-nkF6PfDB9alkOUxpf1HNm/QlkeW3SReqL5WXeBLpEJJnlPSvRaDQpW3gQTksTN3fgJX4hL42RzKyOin6ff3tyw== dependencies: + call-bind "^1.0.2" define-properties "^1.1.3" - es-abstract "^1.17.0-next.1" - function-bind "^1.1.1" + es-abstract "^1.18.0-next.2" has "^1.0.3" objectorarray@^1.0.4: @@ -21244,11 +20491,6 @@ once@^1.3.0, once@^1.3.1, once@^1.3.2, once@^1.4.0: dependencies: wrappy "1" -one-time@0.0.4: - version "0.0.4" - resolved "https://registry.yarnpkg.com/one-time/-/one-time-0.0.4.tgz#f8cdf77884826fe4dff93e3a9cc37b1e4480742e" - integrity sha1-+M33eISCb+Tf+T46nMN7HkSAdC4= - one-time@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/one-time/-/one-time-1.0.0.tgz#e06bc174aed214ed58edede573b433bbf827cb45" @@ -21307,13 +20549,6 @@ oppsy@^2.0.0: dependencies: hoek "5.x.x" -optimism@^0.9.0: - version "0.9.5" - resolved "https://registry.yarnpkg.com/optimism/-/optimism-0.9.5.tgz#b8b5dc9150e97b79ddbf2d2c6c0e44de4d255527" - integrity sha512-lNvmuBgONAGrUbj/xpH69FjMOz1d0jvMNoOCKyVynUPzq2jgVlGL4jFYJqrUHzUfBv+jAFSCP61x5UkfbduYJA== - dependencies: - "@wry/context" "^0.4.0" - optional-js@^2.0.0: version "2.1.1" resolved "https://registry.yarnpkg.com/optional-js/-/optional-js-2.1.1.tgz#c2dc519ad119648510b4d241dbb60b1167c36a46" @@ -21645,7 +20880,7 @@ parallel-transform@^1.1.0: inherits "^2.0.3" readable-stream "^2.1.5" -param-case@2.1.x, param-case@^2.1.0: +param-case@2.1.x: version "2.1.1" resolved "https://registry.yarnpkg.com/param-case/-/param-case-2.1.1.tgz#df94fd8cf6531ecf75e6bef9a0858fbc72be2247" integrity sha1-35T9jPZTHs915r75oIWPvHK+Ikc= @@ -21703,13 +20938,6 @@ parse-bmfont-xml@^1.1.4: xml-parse-from-string "^1.0.0" xml2js "^0.4.5" -parse-color@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/parse-color/-/parse-color-1.0.0.tgz#7b748b95a83f03f16a94f535e52d7f3d94658619" - integrity sha1-e3SLlag/A/FqlPU15S1/PZRlhhk= - dependencies: - color-convert "~0.5.0" - parse-data-uri@^0.2.0: version "0.2.0" resolved "https://registry.yarnpkg.com/parse-data-uri/-/parse-data-uri-0.2.0.tgz#bf04d851dd5c87b0ab238e5d01ace494b604b4c9" @@ -21845,14 +21073,6 @@ parseurl@~1.3.2, parseurl@~1.3.3: resolved "https://registry.yarnpkg.com/parseurl/-/parseurl-1.3.3.tgz#9da19e7bee8d12dff0513ed5b76957793bc2e8d4" integrity sha512-CiyeOxFT/JZyN5m0z9PfXw4SCBJ6Sygz1Dpl0wqjlhDEGGBP1GnsUVEL0p63hoG1fcj3fHynXi9NYO4nWOL+qQ== -pascal-case@^2.0.0: - version "2.0.1" - resolved "https://registry.yarnpkg.com/pascal-case/-/pascal-case-2.0.1.tgz#2d578d3455f660da65eca18ef95b4e0de912761e" - integrity sha1-LVeNNFX2YNpl7KGO+VtODekSdh4= - dependencies: - camel-case "^3.0.0" - upper-case-first "^1.1.0" - pascal-case@^3.1.1: version "3.1.1" resolved "https://registry.yarnpkg.com/pascal-case/-/pascal-case-3.1.1.tgz#5ac1975133ed619281e88920973d2cd1f279de5f" @@ -21879,13 +21099,6 @@ path-browserify@0.0.1, path-browserify@~0.0.0: resolved "https://registry.yarnpkg.com/path-browserify/-/path-browserify-0.0.1.tgz#e6c4ddd7ed3aa27c68a20cc4e50e1a4ee83bbc4a" integrity sha512-BapA40NHICOS+USX9SN4tyhq+A2RrN/Ws5F0Z5aMHDp98Fl86lX8Oti8B7uN93L4Ifv4fHOEA+pQw87gmMO/lQ== -path-case@^2.1.0: - version "2.1.1" - resolved "https://registry.yarnpkg.com/path-case/-/path-case-2.1.1.tgz#94b8037c372d3fe2906e465bb45e25d226e8eea5" - integrity sha1-lLgDfDctP+KQbkZbtF4l0ibo7qU= - dependencies: - no-case "^2.2.0" - path-dirname@^1.0.0: version "1.0.2" resolved "https://registry.yarnpkg.com/path-dirname/-/path-dirname-1.0.2.tgz#cc33d24d525e099a5388c0336c6e32b9160609e0" @@ -22707,11 +21920,6 @@ prettier-linter-helpers@^1.0.0: dependencies: fast-diff "^1.1.2" -prettier@1.16.4: - version "1.16.4" - resolved "https://registry.yarnpkg.com/prettier/-/prettier-1.16.4.tgz#73e37e73e018ad2db9c76742e2647e21790c9717" - integrity sha512-ZzWuos7TI5CKUeQAtFd6Zhm2s6EpAD/ZLApIhsF9pRvRtM1RFo61dM/4MSRUA0SuLugA/zgrZD8m0BaY46Og7g== - prettier@^2.2.0: version "2.2.0" resolved "https://registry.yarnpkg.com/prettier/-/prettier-2.2.0.tgz#8a03c7777883b29b37fb2c4348c66a78e980418b" @@ -22755,7 +21963,7 @@ pretty-format@^25.2.1, pretty-format@^25.5.0: ansi-styles "^4.0.0" react-is "^16.12.0" -pretty-format@^26.4.0, pretty-format@^26.4.2, pretty-format@^26.6.2: +pretty-format@^26.0.0, pretty-format@^26.4.0, pretty-format@^26.6.2: version "26.6.2" resolved "https://registry.yarnpkg.com/pretty-format/-/pretty-format-26.6.2.tgz#e35c2705f14cb7fe2fe94fa078345b444120fc93" integrity sha512-7AeGuCYNGmycyQbCqd/3PWH4eOoX/OiCa0uphp57NVTeAGdJGaAliecxwBDHYQCIvrW7aDBZCYeNTP/WX69mkg== @@ -23350,17 +22558,6 @@ react-ace@^7.0.5: lodash.isequal "^4.5.0" prop-types "^15.7.2" -react-apollo@^2.1.4: - version "2.1.8" - resolved "https://registry.yarnpkg.com/react-apollo/-/react-apollo-2.1.8.tgz#ebac0d9bee0f0906df3ce29207f94df337009887" - integrity sha512-HBz9WDhvaqNxahKvBvW915a9MYSbarJ2Nrwh2pCeDctFiZ/bhixX1xJE/Ea0aU6gU5tGDEl+aWjxzx852FXHoA== - dependencies: - fbjs "^0.8.16" - hoist-non-react-statics "^2.5.0" - invariant "^2.2.2" - lodash "^4.17.10" - prop-types "^15.6.0" - react-beautiful-dnd@^13.0.0: version "13.0.0" resolved "https://registry.yarnpkg.com/react-beautiful-dnd/-/react-beautiful-dnd-13.0.0.tgz#f70cc8ff82b84bc718f8af157c9f95757a6c3b40" @@ -23514,6 +22711,13 @@ react-element-to-jsx-string@^14.3.1: "@base2/pretty-print-object" "1.0.0" is-plain-object "3.0.0" +react-error-boundary@^3.1.0: + version "3.1.1" + resolved "https://registry.yarnpkg.com/react-error-boundary/-/react-error-boundary-3.1.1.tgz#932c5ca5cbab8ec4fe37fd7b415aa5c3a47597e7" + integrity sha512-W3xCd9zXnanqrTUeViceufD3mIW8Ut29BUD+S2f0eO2XCOU8b6UrJfY46RDGe5lxCJzfe4j0yvIfh0RbTZhKJw== + dependencies: + "@babel/runtime" "^7.12.5" + react-error-overlay@^6.0.9: version "6.0.9" resolved "https://registry.yarnpkg.com/react-error-overlay/-/react-error-overlay-6.0.9.tgz#3c743010c9359608c375ecd6bc76f35d93995b0a" @@ -23617,7 +22821,7 @@ react-intl@^2.8.0: intl-relativeformat "^2.1.0" invariant "^2.1.1" -react-is@^16.12.0, react-is@^16.6.0, react-is@^16.7.0, react-is@^16.8.0, react-is@^16.8.1, react-is@^16.8.4, react-is@^16.8.6, react-is@^16.9.0: +react-is@^16.12.0, react-is@^16.13.1, react-is@^16.6.0, react-is@^16.7.0, react-is@^16.8.0, react-is@^16.8.1, react-is@^16.8.4, react-is@^16.8.6, react-is@^16.9.0: version "16.13.1" resolved "https://registry.yarnpkg.com/react-is/-/react-is-16.13.1.tgz#789729a4dc36de2999dc156dd6c1d9c18cea56a4" integrity sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ== @@ -23724,10 +22928,10 @@ react-popper@^2.2.4: react-fast-compare "^3.0.1" warning "^4.0.2" -react-query@^3.12.0: - version "3.12.0" - resolved "https://registry.yarnpkg.com/react-query/-/react-query-3.12.0.tgz#a2082a167f3e394e84dfd3cec0f8c7503abf33dc" - integrity sha512-WJYECeZ6xT2oxIlgqXUjLNLWRvJbeelXscVnAFfyUFgO21OYEYHMWPG61V9W57EUUqrXioQsNPsU9XyddfEvXQ== +react-query@^3.13.10: + version "3.13.10" + resolved "https://registry.yarnpkg.com/react-query/-/react-query-3.13.10.tgz#b6a05e22a5debb6e2df79ada588179771cbd7df8" + integrity sha512-wFvKhEDnOVL5bFL+9KPgNsiOOei1Ad+l6l1awCBuoX7xMG+SXXKDOF2uuZFsJe0w6gdthdWN+00021yepTR31g== dependencies: "@babel/runtime" "^7.5.5" broadcast-channel "^3.4.1" @@ -24697,11 +23901,6 @@ remark@^13.0.0: remark-stringify "^9.0.0" unified "^9.1.0" -remedial@^1.0.7: - version "1.0.8" - resolved "https://registry.yarnpkg.com/remedial/-/remedial-1.0.8.tgz#a5e4fd52a0e4956adbaf62da63a5a46a78c578a0" - integrity sha512-/62tYiOe6DzS5BqVsNpH/nkGlX45C/Sp6V+NtiN6JQNS1Viay7cWkazmRkrQrdFj2eshDe96SIQNIoMxqhzBOg== - remove-accents@0.4.2: version "0.4.2" resolved "https://registry.yarnpkg.com/remove-accents/-/remove-accents-0.4.2.tgz#0a43d3aaae1e80db919e07ae254b285d9e1c7bb5" @@ -24729,11 +23928,6 @@ remove-trailing-separator@^1.0.1, remove-trailing-separator@^1.1.0: resolved "https://registry.yarnpkg.com/remove-trailing-separator/-/remove-trailing-separator-1.1.0.tgz#c24bce2a283adad5bc3f58e0d48249b92379d8ef" integrity sha1-wkvOKig62tW8P1jg1IJJuSN52O8= -remove-trailing-spaces@^1.0.6: - version "1.0.7" - resolved "https://registry.yarnpkg.com/remove-trailing-spaces/-/remove-trailing-spaces-1.0.7.tgz#491f04e11d98880714d12429b0d0938cbe030ae6" - integrity sha512-wjM17CJ2kk0SgoGyJ7ZMzRRCuTq+V8YhMwpZ5XEWX0uaked2OUq6utvHXGNBQrfkUzUUABFMyxlKn+85hMv4dg== - renderkid@^2.0.1: version "2.0.2" resolved "https://registry.yarnpkg.com/renderkid/-/renderkid-2.0.2.tgz#12d310f255360c07ad8fde253f6c9e9de372d2aa" @@ -24823,7 +24017,7 @@ request-promise@^4.2.2: stealthy-require "^1.1.1" tough-cookie "^2.3.3" -request@2.81.0, request@2.88.0, request@^2.44.0, request@^2.87.0, request@^2.88.0, request@^2.88.2: +request@2.81.0, request@^2.44.0, request@^2.87.0, request@^2.88.0, request@^2.88.2: version "2.88.2" resolved "https://registry.yarnpkg.com/request/-/request-2.88.2.tgz#d73c918731cb5a87da047e207234146f664d12b3" integrity sha512-MsvtOrfG9ZcrOwAW+Qi+F6HbD0CWXEh9ou77uOb7FM2WPhwT7smM833PzanhJLsgXjN89Ir6V2PczXNnMpwKhw== @@ -25181,7 +24375,7 @@ rtl-css-js@^1.9.0: dependencies: "@babel/runtime" "^7.1.2" -run-async@^2.2.0, run-async@^2.4.0: +run-async@^2.4.0: version "2.4.0" resolved "https://registry.yarnpkg.com/run-async/-/run-async-2.4.0.tgz#e59054a5b86876cfae07f431d18cbaddc594f1e8" integrity sha512-xJTbh/d7Lm7SBhc1tNvTpeCHaEzoyxPrqNlvSdMfBTYwaY++UJFyXUOxAtsRUXjlqOfj8luNaR9vjCh4KeV+pg== @@ -25517,14 +24711,6 @@ send@0.17.1: range-parser "~1.2.1" statuses "~1.5.0" -sentence-case@^2.1.0: - version "2.1.1" - resolved "https://registry.yarnpkg.com/sentence-case/-/sentence-case-2.1.1.tgz#1f6e2dda39c168bf92d13f86d4a918933f667ed4" - integrity sha1-H24t2jnBaL+S0T+G1KkYkz9mftQ= - dependencies: - no-case "^2.2.0" - upper-case-first "^1.1.2" - serialize-error@^2.1.0: version "2.1.0" resolved "https://registry.yarnpkg.com/serialize-error/-/serialize-error-2.1.0.tgz#50b679d5635cdf84667bdc8e59af4e5b81d5f60a" @@ -25833,13 +25019,6 @@ slide@^1.1.5, slide@~1.1.3: resolved "https://registry.yarnpkg.com/slide/-/slide-1.1.6.tgz#56eb027d65b4d2dce6cb2e2d32c4d4afc9e1d707" integrity sha1-VusCfWW00tzmyy4tMsTUr8nh1wc= -snake-case@^2.1.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/snake-case/-/snake-case-2.1.0.tgz#41bdb1b73f30ec66a04d4e2cad1b76387d4d6d9f" - integrity sha1-Qb2xtz8w7GagTU4srRt2OH1NbZ8= - dependencies: - no-case "^2.2.0" - snap-shot-compare@2.8.3: version "2.8.3" resolved "https://registry.yarnpkg.com/snap-shot-compare/-/snap-shot-compare-2.8.3.tgz#b4982fb7b4e9cd4fa0b03a40a100b5f005b2d515" @@ -25975,7 +25154,7 @@ source-map-support@^0.3.2: dependencies: source-map "0.1.32" -source-map-support@^0.5.1, source-map-support@^0.5.16, source-map-support@^0.5.19, source-map-support@^0.5.6, source-map-support@^0.5.9, source-map-support@~0.5.12: +source-map-support@^0.5.16, source-map-support@^0.5.19, source-map-support@^0.5.6, source-map-support@~0.5.12: version "0.5.19" resolved "https://registry.yarnpkg.com/source-map-support/-/source-map-support-0.5.19.tgz#a98b62f86dcaf4f67399648c085291ab9e8fed61" integrity sha512-Wonm7zOCIJzBGQdB+thsPar0kYuCIzYvxZwlBa87yi/Mdjv7Tip2cyVbLj5o0cFPN4EVkuTwb3GDDyUx2DGnGw== @@ -26515,7 +25694,7 @@ string-width@^1.0.1, string-width@^1.0.2: is-fullwidth-code-point "^1.0.0" strip-ansi "^3.0.0" -"string-width@^1.0.2 || 2", string-width@^2.0.0, string-width@^2.1.0, string-width@^2.1.1: +"string-width@^1.0.2 || 2", string-width@^2.0.0, string-width@^2.1.1: version "2.1.1" resolved "https://registry.yarnpkg.com/string-width/-/string-width-2.1.1.tgz#ab93f27a8dc13d28cac815c462143a6d9012ae9e" integrity sha512-nOqH59deCq9SRHlxq1Aw85Jnt4w6KvLKqWVik6oA9ZklXLNIOlqg4F2yrT1MVaTjAqvVwdfeZ7w7aCvJD7ugkw== @@ -26589,21 +25768,21 @@ string.prototype.trim@~1.1.2: es-abstract "^1.5.0" function-bind "^1.0.2" -string.prototype.trimend@^1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/string.prototype.trimend/-/string.prototype.trimend-1.0.1.tgz#85812a6b847ac002270f5808146064c995fb6913" - integrity sha512-LRPxFUaTtpqYsTeNKaFOw3R4bxIzWOnbQ837QfBylo8jIxtcbK/A/sMV7Q+OAV/vWo+7s25pOE10KYSjaSO06g== +string.prototype.trimend@^1.0.4: + version "1.0.4" + resolved "https://registry.yarnpkg.com/string.prototype.trimend/-/string.prototype.trimend-1.0.4.tgz#e75ae90c2942c63504686c18b287b4a0b1a45f80" + integrity sha512-y9xCjw1P23Awk8EvTpcyL2NIr1j7wJ39f+k6lvRnSMz+mz9CGz9NYPelDk42kOz6+ql8xjfK8oYzy3jAP5QU5A== dependencies: + call-bind "^1.0.2" define-properties "^1.1.3" - es-abstract "^1.17.5" -string.prototype.trimstart@^1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/string.prototype.trimstart/-/string.prototype.trimstart-1.0.1.tgz#14af6d9f34b053f7cfc89b72f8f2ee14b9039a54" - integrity sha512-XxZn+QpvrBI1FOcg6dIpxUPgWCPuNXvMD72aaRaUQv1eD4e/Qy8i/hFTe0BUmD60p/QA6bh1avmuPTfNjqVWRw== +string.prototype.trimstart@^1.0.4: + version "1.0.4" + resolved "https://registry.yarnpkg.com/string.prototype.trimstart/-/string.prototype.trimstart-1.0.4.tgz#b36399af4ab2999b4c9c648bd7a3fb2bb26feeed" + integrity sha512-jh6e984OBfvxS50tdY2nRZnoC5/mLFKOREQfw8t5yytkoUsJRNxvI/E39qu1sD0OtWI3OC0XgKSmcWwziwYuZw== dependencies: + call-bind "^1.0.2" define-properties "^1.1.3" - es-abstract "^1.17.5" string_decoder@^1.0.0, string_decoder@^1.1.1, string_decoder@~1.1.1: version "1.1.1" @@ -27039,15 +26218,7 @@ svgo@^1.0.0: unquote "~1.1.1" util.promisify "~1.0.0" -swap-case@^1.1.0: - version "1.1.2" - resolved "https://registry.yarnpkg.com/swap-case/-/swap-case-1.1.2.tgz#c39203a4587385fad3c850a0bd1bcafa081974e3" - integrity sha1-w5IDpFhzhfrTyFCgvRvK+ggZdOM= - dependencies: - lower-case "^1.1.1" - upper-case "^1.1.1" - -symbol-observable@^1.0.2, symbol-observable@^1.0.4, symbol-observable@^1.1.0, symbol-observable@^1.2.0: +symbol-observable@^1.0.4, symbol-observable@^1.1.0, symbol-observable@^1.2.0: version "1.2.0" resolved "https://registry.yarnpkg.com/symbol-observable/-/symbol-observable-1.2.0.tgz#c22688aed4eab3cdc2dfeacbb561660560a00804" integrity sha512-e900nM8RRtGhlV36KGEU9k65K3mPb1WV70OdjfxlG2EAuM1noi/E/BaW/uMhL7bPEssK8QV57vN3esixjUvcXQ== @@ -27518,7 +26689,7 @@ tinyqueue@^2.0.3: resolved "https://registry.yarnpkg.com/tinyqueue/-/tinyqueue-2.0.3.tgz#64d8492ebf39e7801d7bd34062e29b45b2035f08" integrity sha512-ppJZNDuKGgxzkHihX8v9v9G5f+18gzaTfrukGrq6ueg0lmH4nqVnA2IPG0AEH3jKEk2GRJCUhDoqpoiw3PHLBA== -title-case@^2.1.0, title-case@^2.1.1: +title-case@^2.1.1: version "2.1.1" resolved "https://registry.yarnpkg.com/title-case/-/title-case-2.1.1.tgz#3e127216da58d2bc5becf137ab91dae3a7cd8faa" integrity sha1-PhJyFtpY0rxb7PE3q5Ha46fNj6o= @@ -27810,27 +26981,6 @@ ts-essentials@^2.0.3: resolved "https://registry.yarnpkg.com/ts-essentials/-/ts-essentials-2.0.12.tgz#c9303f3d74f75fa7528c3d49b80e089ab09d8745" integrity sha512-3IVX4nI6B5cc31/GFFE+i8ey/N2eA0CZDbo6n0yrz0zDX8ZJ8djmU1p+XRz7G3is0F3bB3pu2pAroFdAWQKU3w== -ts-invariant@^0.2.1: - version "0.2.1" - resolved "https://registry.yarnpkg.com/ts-invariant/-/ts-invariant-0.2.1.tgz#3d587f9d6e3bded97bf9ec17951dd9814d5a9d3f" - integrity sha512-Z/JSxzVmhTo50I+LKagEISFJW3pvPCqsMWLamCTX8Kr3N5aMrnGOqcflbe5hLUzwjvgPfnLzQtHZv0yWQ+FIHg== - dependencies: - tslib "^1.9.3" - -ts-invariant@^0.3.2: - version "0.3.3" - resolved "https://registry.yarnpkg.com/ts-invariant/-/ts-invariant-0.3.3.tgz#b5742b1885ecf9e29c31a750307480f045ec0b16" - integrity sha512-UReOKsrJFGC9tUblgSRWo+BsVNbEd77Cl6WiV/XpMlkifXwNIJbknViCucHvVZkXSC/mcWeRnIGdY7uprcwvdQ== - dependencies: - tslib "^1.9.3" - -ts-invariant@^0.4.0: - version "0.4.2" - resolved "https://registry.yarnpkg.com/ts-invariant/-/ts-invariant-0.4.2.tgz#8685131b8083e67c66d602540e78763408be9113" - integrity sha512-PTAAn8lJPEdRBJJEs4ig6MVZWfO12yrFzV7YaPslmyhG7+4MA279y4BXT3f72gXeVl0mC1aAWq2rMX4eKTWU/Q== - dependencies: - tslib "^1.9.3" - ts-loader@^7.0.5: version "7.0.5" resolved "https://registry.yarnpkg.com/ts-loader/-/ts-loader-7.0.5.tgz#789338fb01cb5dc0a33c54e50558b34a73c9c4c5" @@ -27842,11 +26992,6 @@ ts-loader@^7.0.5: micromatch "^4.0.0" semver "^6.0.0" -ts-log@2.1.4: - version "2.1.4" - resolved "https://registry.yarnpkg.com/ts-log/-/ts-log-2.1.4.tgz#063c5ad1cbab5d49d258d18015963489fb6fb59a" - integrity sha512-P1EJSoyV+N3bR/IWFeAqXzKPZwHpnLY6j7j58mAvewHRipo+BQM2Y1f9Y9BjEQznKwgqqZm7H8iuixmssU7tYQ== - ts-morph@^9.1.0: version "9.1.0" resolved "https://registry.yarnpkg.com/ts-morph/-/ts-morph-9.1.0.tgz#10d2088387c71f3c674f82492a3cec1e3538f0dd" @@ -28062,7 +27207,7 @@ typescript-tuple@^2.2.1: dependencies: typescript-compare "^0.0.2" -typescript@4.1.3, typescript@^3.2.2, typescript@^3.3.3333, typescript@^3.5.3, typescript@~3.7.2, typescript@~4.1.2: +typescript@4.1.3, typescript@^3.3.3333, typescript@^3.5.3, typescript@~3.7.2, typescript@~4.1.2: version "4.1.3" resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.1.3.tgz#519d582bd94cba0cf8934c7d8e8467e473f53bb7" integrity sha512-B3ZIOf1IKeH2ixgHhj6la6xdwR9QrLC5d1VKeCSY4tvkqhF2eqd9O7txNlS0PO3GrBAFIdr3L1ndNwteUbZLYg== @@ -28117,6 +27262,16 @@ umd@^3.0.0: resolved "https://registry.yarnpkg.com/umd/-/umd-3.0.3.tgz#aa9fe653c42b9097678489c01000acb69f0b26cf" integrity sha512-4IcGSufhFshvLNcMCV80UnQVlZ5pMOC8mvNPForqwA4+lzYQuetTESLDQkeLmihq8bRcnpbQa48Wb8Lh16/xow== +unbox-primitive@^1.0.0: + version "1.0.1" + resolved "https://registry.yarnpkg.com/unbox-primitive/-/unbox-primitive-1.0.1.tgz#085e215625ec3162574dc8859abee78a59b14471" + integrity sha512-tZU/3NqK3dA5gpE1KtyiJUrEB0lxnGkMFHptJ7q6ewdZ8s12QrODwNbhIJStmJkd1QDXa1NRA8aF2A1zk/Ypyw== + dependencies: + function-bind "^1.1.1" + has-bigints "^1.0.1" + has-symbols "^1.0.2" + which-boxed-primitive "^1.0.2" + unbzip2-stream@^1.3.3: version "1.4.3" resolved "https://registry.yarnpkg.com/unbzip2-stream/-/unbzip2-stream-1.4.3.tgz#b0da04c4371311df771cdc215e87f2130991ace7" @@ -28596,14 +27751,7 @@ update-notifier@^4.1.1: semver-diff "^3.1.1" xdg-basedir "^4.0.0" -upper-case-first@^1.1.0, upper-case-first@^1.1.2: - version "1.1.2" - resolved "https://registry.yarnpkg.com/upper-case-first/-/upper-case-first-1.1.2.tgz#5d79bedcff14419518fd2edb0a0507c9b6859115" - integrity sha1-XXm+3P8UQZUY/S7bCgUHybaFkRU= - dependencies: - upper-case "^1.1.1" - -upper-case@^1.0.3, upper-case@^1.1.0, upper-case@^1.1.1, upper-case@^1.1.3: +upper-case@^1.0.3, upper-case@^1.1.1: version "1.1.3" resolved "https://registry.yarnpkg.com/upper-case/-/upper-case-1.1.3.tgz#f6b4501c2ec4cdd26ba78be7222961de77621598" integrity sha1-9rRQHC7EzdJrp4vnIilh3ndiFZg= @@ -28827,7 +27975,7 @@ uuid@^2.0.1: resolved "https://registry.yarnpkg.com/uuid/-/uuid-2.0.3.tgz#67e2e863797215530dff318e5bf9dcebfd47b21a" integrity sha1-Z+LoY3lyFVMN/zGOW/nc6/1Hsho= -uuid@^3.1.0, uuid@^3.3.2, uuid@^3.3.3, uuid@^3.4.0: +uuid@^3.3.2, uuid@^3.3.3, uuid@^3.4.0: version "3.4.0" resolved "https://registry.yarnpkg.com/uuid/-/uuid-3.4.0.tgz#b23e4358afa8a202fe7a100af1f5f883f02007ee" integrity sha512-HjSDRw6gZE5JMggctHBcjVak08+KEVhSIiDzFnT9S9aegmp85S/bReBVTb4QTFaRNptJ9kuYaNhnbNEOkbKb/A== @@ -28847,15 +27995,6 @@ v8-compile-cache@^2.0.3, v8-compile-cache@^2.1.1, v8-compile-cache@^2.2.0: resolved "https://registry.yarnpkg.com/v8-compile-cache/-/v8-compile-cache-2.2.0.tgz#9471efa3ef9128d2f7c6a7ca39c4dd6b5055b132" integrity sha512-gTpR5XQNKFwOd4clxfnhaqvfqMpqEwr4tOtCyz4MtYZX2JYhfr1JvBFKdS+7K/9rfpZR3VLX+YWBbKoxCgS43Q== -v8-to-istanbul@^6.0.1: - version "6.0.1" - resolved "https://registry.yarnpkg.com/v8-to-istanbul/-/v8-to-istanbul-6.0.1.tgz#7ef0e32faa10f841fe4c1b0f8de96ed067c0be1e" - integrity sha512-PzM1WlqquhBvsV+Gco6WSFeg1AGdD53ccMRkFeyHRE/KRZaVacPOmQYP3EeVgDBtKD2BJ8kgynBQ5OtKiHCH+w== - dependencies: - "@types/istanbul-lib-coverage" "^2.0.1" - convert-source-map "^1.6.0" - source-map "^0.7.3" - v8-to-istanbul@^7.0.0: version "7.0.0" resolved "https://registry.yarnpkg.com/v8-to-istanbul/-/v8-to-istanbul-7.0.0.tgz#b4fe00e35649ef7785a9b7fcebcea05f37c332fc" @@ -28880,11 +28019,6 @@ val-loader@^1.1.1: loader-utils "^1.0.0" schema-utils "^0.4.5" -valid-url@1.0.9: - version "1.0.9" - resolved "https://registry.yarnpkg.com/valid-url/-/valid-url-1.0.9.tgz#1c14479b40f1397a75782f115e4086447433a200" - integrity sha1-HBRHm0DxOXp1eC8RXkCGRHQzogA= - validate-npm-package-license@^3.0.1: version "3.0.1" resolved "https://registry.yarnpkg.com/validate-npm-package-license/-/validate-npm-package-license-3.0.1.tgz#2804babe712ad3379459acfbe24746ab2c303fbc" @@ -29739,11 +28873,6 @@ whatwg-encoding@^1.0.1, whatwg-encoding@^1.0.5: dependencies: iconv-lite "0.4.24" -whatwg-fetch@2.0.4: - version "2.0.4" - resolved "https://registry.yarnpkg.com/whatwg-fetch/-/whatwg-fetch-2.0.4.tgz#dde6a5df315f9d39991aa17621853d720b85566f" - integrity sha512-dcQ1GWpOD/eEQ97k66aiEVpNnapVj90/+R+SXTPYGHpYBBypfKJEQjLrvMZ7YXbKm21gXd4NcuxUTjiv1YtLng== - whatwg-fetch@>=0.10.0, whatwg-fetch@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/whatwg-fetch/-/whatwg-fetch-3.0.0.tgz#fc804e458cc460009b1a2b966bc8817d2578aefb" @@ -29781,16 +28910,16 @@ whatwg-url@^8.0.0: tr46 "^2.0.2" webidl-conversions "^6.1.0" -which-boxed-primitive@^1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/which-boxed-primitive/-/which-boxed-primitive-1.0.1.tgz#cbe8f838ebe91ba2471bb69e9edbda67ab5a5ec1" - integrity sha512-7BT4TwISdDGBgaemWU0N0OU7FeAEJ9Oo2P1PHRm/FCWoEi2VLWC9b6xvxAA3C/NMpxg3HXVgi0sMmGbNUbNepQ== +which-boxed-primitive@^1.0.1, which-boxed-primitive@^1.0.2: + version "1.0.2" + resolved "https://registry.yarnpkg.com/which-boxed-primitive/-/which-boxed-primitive-1.0.2.tgz#13757bc89b209b049fe5d86430e21cf40a89a8e6" + integrity sha512-bwZdv0AKLpplFY2KZRX6TvyuN7ojjr7lwkg6ml0roIy9YeuSr7JS372qlNW18UQYzgYK9ziGcerWqZOmEn9VNg== dependencies: - is-bigint "^1.0.0" - is-boolean-object "^1.0.0" - is-number-object "^1.0.3" - is-string "^1.0.4" - is-symbol "^1.0.2" + is-bigint "^1.0.1" + is-boolean-object "^1.1.0" + is-number-object "^1.0.4" + is-string "^1.0.5" + is-symbol "^1.0.3" which-collection@^1.0.1: version "1.0.1" @@ -29876,7 +29005,7 @@ windows-release@^3.1.0: dependencies: execa "^1.0.0" -winston-transport@^4.3.0, winston-transport@^4.4.0: +winston-transport@^4.4.0: version "4.4.0" resolved "https://registry.yarnpkg.com/winston-transport/-/winston-transport-4.4.0.tgz#17af518daa690d5b2ecccaa7acf7b20ca7925e59" integrity sha512-Lc7/p3GtqtqPBYYtS6KCN3c77/2QCev51DvcJKbkFPQNoj1sinkGwLGFDxkXY9J6p9+EPnYs+D90uwbnaiURTw== @@ -29884,21 +29013,6 @@ winston-transport@^4.3.0, winston-transport@^4.4.0: readable-stream "^2.3.7" triple-beam "^1.2.0" -winston@3.2.1: - version "3.2.1" - resolved "https://registry.yarnpkg.com/winston/-/winston-3.2.1.tgz#63061377976c73584028be2490a1846055f77f07" - integrity sha512-zU6vgnS9dAWCEKg/QYigd6cgMVVNwyTzKs81XZtTFuRwJOcDdBg7AU0mXVyNbs7O5RH2zdv+BdNZUlx7mXPuOw== - dependencies: - async "^2.6.1" - diagnostics "^1.1.1" - is-stream "^1.1.0" - logform "^2.1.1" - one-time "0.0.4" - readable-stream "^3.1.1" - stack-trace "0.0.x" - triple-beam "^1.3.0" - winston-transport "^4.3.0" - winston@^3.0.0, winston@^3.3.3: version "3.3.3" resolved "https://registry.yarnpkg.com/winston/-/winston-3.3.3.tgz#ae6172042cafb29786afa3d09c8ff833ab7c9170" @@ -30360,27 +29474,6 @@ z-schema@~3.18.3: optionalDependencies: commander "^2.7.1" -zen-observable-ts@^0.8.10, zen-observable-ts@^0.8.18: - version "0.8.21" - resolved "https://registry.yarnpkg.com/zen-observable-ts/-/zen-observable-ts-0.8.21.tgz#85d0031fbbde1eba3cd07d3ba90da241215f421d" - integrity sha512-Yj3yXweRc8LdRMrCC8nIc4kkjWecPAUVh0TI0OUrWXx6aX790vLcDlWca6I4vsyCGH3LpWxq0dJRcMOFoVqmeg== - dependencies: - tslib "^1.9.3" - zen-observable "^0.8.0" - -zen-observable-ts@^0.8.20: - version "0.8.20" - resolved "https://registry.yarnpkg.com/zen-observable-ts/-/zen-observable-ts-0.8.20.tgz#44091e335d3fcbc97f6497e63e7f57d5b516b163" - integrity sha512-2rkjiPALhOtRaDX6pWyNqK1fnP5KkJJybYebopNSn6wDG1lxBoFs2+nwwXKoA6glHIrtwrfBBy6da0stkKtTAA== - dependencies: - tslib "^1.9.3" - zen-observable "^0.8.0" - -zen-observable@^0.8.0: - version "0.8.8" - resolved "https://registry.yarnpkg.com/zen-observable/-/zen-observable-0.8.8.tgz#1ea93995bf098754a58215a1e0a7309e5749ec42" - integrity sha512-HnhhyNnwTFzS48nihkCZIJGsWGFcYUz+XPDlPK5W84Ifji8SksC6m7sQWOf8zdCGhzQ4tDYuMYGu5B0N1dXTtg== - zip-stream@^4.0.4: version "4.0.4" resolved "https://registry.yarnpkg.com/zip-stream/-/zip-stream-4.0.4.tgz#3a8f100b73afaa7d1ae9338d910b321dec77ff3a"