metron-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From merrimanr <...@git.apache.org>
Subject [GitHub] metron pull request #620: Metron-988: UI for viewing alerts generated by Met...
Date Mon, 10 Jul 2017 20:55:47 GMT
Github user merrimanr commented on a diff in the pull request:

    https://github.com/apache/metron/pull/620#discussion_r126534489
  
    --- Diff: metron-interface/metron-alerts/src/app/service/elasticsearch-localstorage-impl.ts
---
    @@ -0,0 +1,291 @@
    +/**
    + * Licensed to the Apache Software Foundation (ASF) under one
    + * or more contributor license agreements.  See the NOTICE file
    + * distributed with this work for additional information
    + * regarding copyright ownership.  The ASF licenses this file
    + * to you under the Apache License, Version 2.0 (the
    + * "License"); you may not use this file except in compliance
    + * with the License.  You may obtain a copy of the License at
    + *
    + *     http://www.apache.org/licenses/LICENSE-2.0
    + *
    + * Unless required by applicable law or agreed to in writing, software
    + * distributed under the License is distributed on an "AS IS" BASIS,
    + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    + * See the License for the specific language governing permissions and
    + * limitations under the License.
    + */
    +import {Observable} from 'rxjs/Rx';
    +import {Headers, RequestOptions} from '@angular/http';
    +
    +import {HttpUtil} from '../utils/httpUtil';
    +import {DataSource} from './data-source';
    +import {Alert} from '../model/alert';
    +import {ColumnMetadata} from '../model/column-metadata';
    +import {ElasticsearchUtils} from '../utils/elasticsearch-utils';
    +import {
    +  ALERTS_COLUMN_NAMES, ALERTS_TABLE_METADATA, ALERTS_RECENT_SEARCH,
    +  ALERTS_SAVED_SEARCH, NUM_SAVED_SEARCH
    +} from '../utils/constants';
    +import {ColumnNames} from '../model/column-names';
    +import {ColumnNamesService} from './column-names.service';
    +import {TableMetadata} from '../model/table-metadata';
    +import {SaveSearch} from '../model/save-search';
    +import {AlertsSearchResponse} from '../model/alerts-search-response';
    +import {SearchRequest} from '../model/search-request';
    +
    +export class ElasticSearchLocalstorageImpl extends DataSource {
    +
    +  private defaultColumnMetadata = [
    +    new ColumnMetadata('_id', 'string'),
    +    new ColumnMetadata('timestamp', 'date'),
    +    new ColumnMetadata('source:type', 'string'),
    +    new ColumnMetadata('ip_src_addr', 'ip'),
    +    new ColumnMetadata('enrichments:geo:ip_dst_addr:country', 'string'),
    +    new ColumnMetadata('ip_dst_addr', 'ip'),
    +    new ColumnMetadata('host', 'string'),
    +    new ColumnMetadata('alert_status', 'string')
    +  ];
    +
    +  getAlerts(searchRequest: SearchRequest): Observable<AlertsSearchResponse> {
    +    let url = '/search/*,-*kibana/_search';
    +    return this.http.post(url, searchRequest, new RequestOptions({headers: new Headers(this.defaultHeaders)}))
    --- End diff --
    
    I would expect there to be some kind of manipulation to the searchRequest sent to Elasticsearch.
 For example, Elasticsearch expects the request to follow this structure:
    ```
    {
      "query":
      {    
        "query_string":
        {       
          "query": "some lucene query"
        }
      }
    }
    ```
    but our search abstraction is simpler:
    ```
    {
      "query": "some lucene query"
    }
    ```


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

Mime
View raw message