Skip to content

Collectors

The JS Collectors object can be used in user customizable scripts within CYBERQUEST Data Transformation Service (DTS), Alerts, and Data source manager. This Object can be called using subobjects, such as:

CYBERQUESTIPDataCollector

Helper class with the role of contacting getIpData api for obtaining data. Extends BaseCollector class.

For each event, the module will call a callback received, passing the event back.

Usage:

var callBackFunction = function(IP){
        console.log("BlackListedIP", IP);
        };
var parameters = {
    lastLocalTime: lastLocalTime
    };
var collector = CQ.Collectors.CyberQuestIPDataCollector;
collector.init(parameters);
collector.execute(callBackFunction);

ElasticSearchCollector

Connects to the Elastic Search service. It can collect data from it and has the option of obtaining data in batch through the same call. Extends BaseCollector class.

On execution, it can receive a callback after each result. Treats the errors received.

Usage:

var callBackFunction = function(Event){
                console.log(Event);
        }
var parameters = {
    elasticSearchUrl:"http://192.168.0.1",
    elasticSearchQueryUrl:"logstash*/_search",
    elasticSearchPort:9200,
    elasticSearchScrollTimeSpan:"1m",
    lastLocalTime: "lastLocalTime",
    searchRequest:{
                    "size":3,
                    "sort": [
                            { "@timestamp":   { "order": "asc" }}
                        ],
                    "query":{
                        "bool":{
                            "must":{
                            "match_all":{}
                            },
                            "filter":[
                            {
                                "range":{
                                    "@timestamp":{
                                        "gt":lastLocalTime
                                    }
                                }
                            }
                            ]
                        }
                    }
    }
        }; 
var collector = CQ.Collectors.ElasticSearchCollector;
collector.init(parameters); 
collector.execute(callBackFunction);