(g)ULP!
Loading...
Searching...
No Matches
PluginBase Class Reference
Inheritance diagram for PluginBase:
Collaboration diagram for PluginBase:

Public Member Functions

None __init__ (self, str path, AsyncEngine collab=None, AsyncElasticsearch elastic=None, **kwargs)
 
None cleanup (self)
 
list[str] depends_on (self)
 
str desc (self)
 
str event_type_field (self)
 
str get_unmapped_field_name (self, str field)
 
GulpRequestStatus ingest (self, str index, str req_id, int client_id, int operation_id, str context, str|list[dict] source, str ws_id, GulpPluginParams plugin_params=None, GulpIngestionFilter flt=None, **kwargs)
 
tuple[dict, GulpMapping] ingest_plugin_initialize (self, str index, str|dict source, bool skip_mapping=False, ProcessingPipeline pipeline=None, str mapping_file=None, str mapping_id=None, GulpPluginParams plugin_params=None)
 
bool internal (self)
 
logging.Logger logger (cls)
 
str name (self)
 
list[GulpPluginOptionoptions (self)
 
ProcessingPipeline pipeline (self, GulpPluginParams plugin_params=None, **kwargs)
 
list[GulpDocument] record_to_gulp_document (self, int operation_id, int client_id, str context, str source, TmpIngestStats fs, any record, int record_idx, GulpMapping custom_mapping=None, dict index_type_mapping=None, str plugin=None, GulpPluginParams plugin_params=None, **kwargs)
 
dict run_command (self, GulpPluginParams p)
 
ProcessingPipeline sigma_plugin_initialize (self, ProcessingPipeline pipeline=None, str mapping_file=None, str mapping_id=None, str product=None, GulpPluginParams plugin_params=None)
 
list[str] tags (self)
 
GulpPluginType type (self)
 
str version (self)
 

Public Attributes

list buffer = []
 
str client_id = None
 
 collab = collab
 
tuple context = (None,)
 
 elastic = elastic
 
str index = None
 
str operation_id = None
 
 path = path
 
str req_id = None
 
str ws_id = None
 

Protected Member Functions

list[GulpDocument] _build_gulpdocuments (self, list[FieldMappingEntry] fme, int idx, int operation_id, str context, str plugin, int client_id, str raw_event, str original_id, str src_file, int timestamp=None, int timestamp_nsec=None, str event_code=None, list[str] cat=None, int duration_nsec=0, GulpLogLevel gulp_log_level=None, str original_log_level=None, bool remove_raw_event=False, **kwargs)
 
list[dict] _build_ingestion_chunk_for_ws (self, list[dict] docs, GulpIngestionFilter flt=None)
 
list[GulpDocument] _call_record_to_gulp_document_funcs (self, int operation_id, int client_id, str context, str source, TmpIngestStats fs, any record, int record_idx, GulpMapping custom_mapping=None, dict index_type_mapping=None, str plugin=None, GulpPluginParams plugin_params=None, Callable record_to_gulp_document_fun=None, **kwargs)
 
GulpRequestStatus _finish_ingestion (self, str index, str|dict source, str req_id, int client_id, str ws_id, TmpIngestStats fs, GulpIngestionFilter flt=None)
 
TmpIngestStats _flush_buffer (self, str index, TmpIngestStats fs, str ws_id, str req_id, GulpIngestionFilter flt=None, bool wait_for_refresh=False)
 
TmpIngestStats _ingest_record (self, str index, GulpDocument|dict doc, TmpIngestStats fs, str ws_id, str req_id, GulpIngestionFilter flt=None, bool flush_enabled=True, **kwargs)
 
list[FieldMappingEntry] _map_source_key (self, GulpPluginParams plugin_params, GulpMapping custom_mapping, str source_key, Any v, dict index_type_mapping=None, bool ignore_custom_mapping=False, **kwargs)
 
TmpIngestStats _parser_failed (self, TmpIngestStats fs, str|dict source, Exception|str ex)
 
tuple[GulpMapping, GulpPluginParams_process_plugin_params (self, GulpMapping custom_mapping, GulpPluginParams plugin_params=None)
 
tuple[TmpIngestStats, bool] _process_record (self, str index, any record, int record_idx, Callable my_record_to_gulp_document_fun, str ws_id, str req_id, int operation_id, int client_id, str context, str source, TmpIngestStats fs, GulpMapping custom_mapping=None, dict index_type_mapping=None, str plugin=None, GulpPluginParams plugin_params=None, GulpIngestionFilter flt=None, **kwargs)
 
TmpIngestStats _record_failed (self, TmpIngestStats fs, any entry, str|dict source, Exception|str ex)
 
any _type_checks (self, any v, str k, dict index_type_mapping)
 

Detailed Description

Base class for all Gulp plugins.

Definition at line 55 of file plugin.py.

Constructor & Destructor Documentation

◆ __init__()

None __init__ ( self,
str path,
AsyncEngine collab = None,
AsyncElasticsearch elastic = None,
** kwargs )
Initializes a new instance of the PluginBase class.

Args:
    path (str): The path to the plugin.
    collab: instance of sqlalchemy client
    elastic: instance of elasticsearch client
    kwargs: additional arguments if any

Definition at line 60 of file plugin.py.

66 ) -> None:
67 """
68 Initializes a new instance of the PluginBase class.
69
70 Args:
71 path (str): The path to the plugin.
72 collab: instance of sqlalchemy client
73 elastic: instance of elasticsearch client
74 kwargs: additional arguments if any
75 """
76 self.req_id: str = None
77 self.index: str = None
78 self.client_id: str = None
79 self.operation_id: str = None
80 self.context: str = (None,)
81 self.ws_id: str = None
82 self.path = path
83 self.collab = collab
84 self.elastic = elastic
85
86 self.buffer: list[GulpDocument] = []
87 for k, v in kwargs.items():
88 self.__dict__[k] = v
89
90 # initialize mapping helper
91 mappings_helper.init(_logger)
92 super().__init__()
93

Member Function Documentation

◆ _build_gulpdocuments()

list[GulpDocument] _build_gulpdocuments ( self,
list[FieldMappingEntry] fme,
int idx,
int operation_id,
str context,
str plugin,
int client_id,
str raw_event,
str original_id,
str src_file,
int timestamp = None,
int timestamp_nsec = None,
str event_code = None,
list[str] cat = None,
int duration_nsec = 0,
GulpLogLevel gulp_log_level = None,
str original_log_level = None,
bool remove_raw_event = False,
** kwargs )
protected
build one or more GulpDocument objects from a list of FieldMappingEntry objects:

this function creates as many GulpDocument objects as there are FieldMappingEntry objects with is_timestamp=True.
if no FieldMappingEntry object has is_timestamp=True, it creates a single GulpDocument object with the first FieldMappingEntry object.

Definition at line 555 of file plugin.py.

575 ) -> list[GulpDocument]:
576 """
577 build one or more GulpDocument objects from a list of FieldMappingEntry objects:
578
579 this function creates as many GulpDocument objects as there are FieldMappingEntry objects with is_timestamp=True.
580 if no FieldMappingEntry object has is_timestamp=True, it creates a single GulpDocument object with the first FieldMappingEntry object.
581 """
582 docs: list[GulpDocument] = []
583 append_doc = docs.append # local variable for faster access
584
585 common_params = {
586 "idx": idx,
587 "operation_id": operation_id,
588 "context": context,
589 "plugin": plugin,
590 "client_id": client_id,
591 "raw_event": raw_event,
592 "original_id": original_id,
593 "src_file": src_file,
594 "timestamp": timestamp,
595 "timestamp_nsec": timestamp_nsec,
596 "event_code": event_code,
597 "cat": cat,
598 "duration_nsec": duration_nsec,
599 "gulp_log_level": gulp_log_level,
600 "original_log_level": original_log_level,
601 **kwargs,
602 }
603 for f in fme:
604 # print("%s\n\n" % (f))
605 # for each is_timestamp build a gulpdocument with all the fields in fme
606 if f.is_timestamp:
607 d = GulpDocument(fme=fme, f=f, **common_params)
608 if remove_raw_event:
609 d.original_event = None
610
611 # print("%s\n\n" % (d))
612 append_doc(d)
613
614 if len(docs) == 0:
615 # create a document with the given timestamp in timestamp/timestamp_nsec (if any, either it will be set to 0/invalid)
616 d = GulpDocument(fme=fme, **common_params)
617 if remove_raw_event:
618 d.original_event = None
619 append_doc(d)
620
621 return docs
622
Here is the caller graph for this function:

◆ _build_ingestion_chunk_for_ws()

list[dict] _build_ingestion_chunk_for_ws ( self,
list[dict] docs,
GulpIngestionFilter flt = None )
protected
Builds the ingestion chunk for the websocket, filtering if needed.

Definition at line 826 of file plugin.py.

828 ) -> list[dict]:
829 """
830 Builds the ingestion chunk for the websocket, filtering if needed.
831 """
832 # self.logger().debug("building ingestion chunk, flt=%s" % (flt))
833 if not docs:
834 return []
835
836 ws_docs = [
837 {
838 "_id": doc["_id"],
839 "@timestamp": doc["@timestamp"],
840 "gulp.source.file": doc["gulp.source.file"],
841 "event.duration": doc["event.duration"],
842 "gulp.context": doc["gulp.context"],
843 "gulp.log.level": doc.get("gulp.log.level", int(GulpLogLevel.INFO)),
844 "event.category": doc.get("event.category", None),
845 "event.code": doc["event.code"],
846 "gulp.event.code": doc["gulp.event.code"],
847 }
848 for doc in docs
849 if elastic_api.filter_doc_for_ingestion(
850 doc, flt, ignore_store_all_documents=True
851 )
852 == GulpEventFilterResult.ACCEPT
853 ]
854
855 return ws_docs
856
Here is the caller graph for this function:

◆ _call_record_to_gulp_document_funcs()

list[GulpDocument] _call_record_to_gulp_document_funcs ( self,
int operation_id,
int client_id,
str context,
str source,
TmpIngestStats fs,
any record,
int record_idx,
GulpMapping custom_mapping = None,
dict index_type_mapping = None,
str plugin = None,
GulpPluginParams plugin_params = None,
Callable record_to_gulp_document_fun = None,
** kwargs )
protected
Stub function to call stacked plugins record_to_document_gulp_document.
Each function is called with the previously returned GulpDocument.

Args:
    operation_id (int): the operation ID associated with the record
    client_id (int): client ID performing the ingestion
    context (str): context associated with the record
    source (str): source of the record (source file name or path, usually)
    fs (TmpIngestStats): _description_
    record (any): a single record (first time) or a list of GulpDocument objects (in stacked plugins)
    record_idx (int): The index of the record in source.
    custom_mapping (GulpMapping, optional): The custom mapping to use for the conversion. Defaults to None.
    index_type_mapping (dict, optional): elastic search index type mappings { "field": "type", ... }. Defaults to None.
    plugin (str, optional): "agent.type" to be set in the GulpDocument. Defaults to None.
    plugin_params (GulpPluginParams, optional): The plugin parameters to use, if any. Defaults to None.
    record_to_gulp_document_fun (Callable, optional): function to parse record into a gulp document, if stacked this receives a list of GulpDocuments

Returns:
    list[GulpDocument]: zero or more GulpDocument objects

Definition at line 376 of file plugin.py.

391 ) -> list[GulpDocument]:
392 """Stub function to call stacked plugins record_to_document_gulp_document.
393 Each function is called with the previously returned GulpDocument.
394
395 Args:
396 operation_id (int): the operation ID associated with the record
397 client_id (int): client ID performing the ingestion
398 context (str): context associated with the record
399 source (str): source of the record (source file name or path, usually)
400 fs (TmpIngestStats): _description_
401 record (any): a single record (first time) or a list of GulpDocument objects (in stacked plugins)
402 record_idx (int): The index of the record in source.
403 custom_mapping (GulpMapping, optional): The custom mapping to use for the conversion. Defaults to None.
404 index_type_mapping (dict, optional): elastic search index type mappings { "field": "type", ... }. Defaults to None.
405 plugin (str, optional): "agent.type" to be set in the GulpDocument. Defaults to None.
406 plugin_params (GulpPluginParams, optional): The plugin parameters to use, if any. Defaults to None.
407 record_to_gulp_document_fun (Callable, optional): function to parse record into a gulp document, if stacked this receives a list of GulpDocuments
408
409 Returns:
410 list[GulpDocument]: zero or more GulpDocument objects
411 """
412 # plugin_params=deepcopy(plugin_params)
413
414 if plugin_params is None:
415 plugin_params = GulpPluginParams()
416
417 docs = record
418
419 if record_to_gulp_document_fun is not None:
420 docs = await record_to_gulp_document_fun(
421 operation_id,
422 client_id,
423 context,
424 source,
425 fs,
426 record,
427 record_idx,
428 custom_mapping,
429 index_type_mapping,
430 plugin,
431 plugin_params,
432 **kwargs,
433 )
434
435 for fun in plugin_params.record_to_gulp_document_fun:
436 docs = await fun(
437 operation_id,
438 client_id,
439 context,
440 source,
441 fs,
442 docs,
443 record_idx,
444 custom_mapping,
445 index_type_mapping,
446 plugin,
447 plugin_params,
448 **kwargs,
449 )
450
451 if docs is None:
452 return []
453 return docs
454
Here is the caller graph for this function:

◆ _finish_ingestion()

GulpRequestStatus _finish_ingestion ( self,
str index,
str | dict source,
str req_id,
int client_id,
str ws_id,
TmpIngestStats fs,
GulpIngestionFilter flt = None )
protected
to be called whenever ingest() must exit: flushes the buffer and updates the ingestion stats

Definition at line 963 of file plugin.py.

972 ) -> GulpRequestStatus:
973 """
974 to be called whenever ingest() must exit: flushes the buffer and updates the ingestion stats
975 """
976 try:
977 # finally flush ingestion buffer
978 fs = await self._flush_buffer(index, fs, ws_id, req_id, flt)
979 self.logger().info(
980 "INGESTION DONE FOR source=%s,\n\tclient_id=%d (processed=%d, failed=%d, skipped=%d, errors=%d, parser_errors=%d)"
981 % (
982 muty.string.make_shorter(str(source), 260),
983 client_id,
984 fs.ev_processed,
985 fs.ev_failed,
986 fs.ev_skipped,
987 len(fs.ingest_errors),
988 fs.parser_failed,
989 )
990 )
991 except Exception as ex:
992 fs = fs.update(ingest_errors=[ex])
993 self.logger().exception(
994 "FAILED finalizing ingestion for source=%s"
995 % (muty.string.make_shorter(str(source), 260))
996 )
997
998 finally:
999 status, _ = await GulpStats.update(
1000 self.collab,
1001 req_id,
1002 ws_id,
1003 fs=fs,
1004 force=True,
1005 file_done=True,
1006 )
1007 return status
1008
1009
Here is the call graph for this function:
Here is the caller graph for this function:

◆ _flush_buffer()

TmpIngestStats _flush_buffer ( self,
str index,
TmpIngestStats fs,
str ws_id,
str req_id,
GulpIngestionFilter flt = None,
bool wait_for_refresh = False )
protected
NOTE: errors appended by this function are intended as INGESTION errors:
it means something wrong with the format of the event, and must be fixed ASAP if this happens.
ideally, function should NEVER append errors and the errors total should be the same before and after this function returns (this function may only change the skipped total, which means some duplicates were found).

Definition at line 857 of file plugin.py.

865 ) -> TmpIngestStats:
866 """
867 NOTE: errors appended by this function are intended as INGESTION errors:
868 it means something wrong with the format of the event, and must be fixed ASAP if this happens.
869 ideally, function should NEVER append errors and the errors total should be the same before and after this function returns (this function may only change the skipped total, which means some duplicates were found).
870 """
871 if len(self.buffer) == 0:
872 # already flushed
873 return fs
874
875 # _logger.debug('flushing ingestion buffer, len=%d' % (len(self.buffer)))
876
877 skipped, failed, failed_ar, ingested_docs = await elastic_api.ingest_bulk(
878 self.elastic, index, self.buffer, flt=flt, wait_for_refresh=wait_for_refresh
879 )
880 # print(json.dumps(ingested_docs, indent=2))
881
882 if failed > 0:
883 if config.debug_abort_on_elasticsearch_ingestion_error():
884 raise Exception(
885 "elasticsearch ingestion errors means GulpDocument contains invalid data, review errors on collab db!"
886 )
887
888 self.buffer = []
889
890 # build ingestion chunk
891 ws_docs = self._build_ingestion_chunk_for_ws(ingested_docs, flt)
892
893 # send ingested docs to websocket
894 if len(ws_docs) > 0:
895 ws_api.shared_queue_add_data(
896 WsQueueDataType.INGESTION_CHUNK,
897 req_id,
898 {"plugin": self.name(), "events": ws_docs},
899 ws_id=ws_id,
900 )
901
902 # update stats
903 fs = fs.update(
904 failed=failed,
905 skipped=skipped,
906 ingest_errors=failed_ar,
907 )
908 return fs
909
Here is the call graph for this function:
Here is the caller graph for this function:

◆ _ingest_record()

TmpIngestStats _ingest_record ( self,
str index,
GulpDocument | dict doc,
TmpIngestStats fs,
str ws_id,
str req_id,
GulpIngestionFilter flt = None,
bool flush_enabled = True,
** kwargs )
protected
bufferize as much as ingestion_buffer_size, then flush (writes to elasticsearch)

Definition at line 910 of file plugin.py.

920 ) -> TmpIngestStats:
921 """
922 bufferize as much as ingestion_buffer_size, then flush (writes to elasticsearch)
923 """
924 ingestion_buffer_size = config.config().get("ingestion_buffer_size", 1000)
925 self.buffer.append(doc)
926 if len(self.buffer) >= ingestion_buffer_size and flush_enabled:
927 # time to flush
928 fs = await self._flush_buffer(index, fs, ws_id, req_id, flt)
929
930 return fs
931
Here is the call graph for this function:
Here is the caller graph for this function:

◆ _map_source_key()

list[FieldMappingEntry] _map_source_key ( self,
GulpPluginParams plugin_params,
GulpMapping custom_mapping,
str source_key,
Any v,
dict index_type_mapping = None,
bool ignore_custom_mapping = False,
** kwargs )
protected
map source key to a field mapping entry with "result": {mapped_key: v}

Args:
    plugin_params (GulpPluginParams): The plugin parameters.
    custom_mapping (GulpMapping): The custom mapping.
    source_key (str): The key to look for(=the event record key to be mapped) in the custom_mapping dictionary
    v (any): value to set for mapped key/s.
    index_type_mapping (dict, optional): The elasticsearch index key->type mappings. Defaults to None.
    ignore_custom_mapping (bool, optional): Whether to ignore custom_mapping and directly map source_key to v. Defaults to False.
    kwargs: Additional keyword arguments.

Returns:
    list[FieldMappingEntry]: zero or more FieldMappingEntry objects with "result" set.

Definition at line 683 of file plugin.py.

692 ) -> list[FieldMappingEntry]:
693 """
694 map source key to a field mapping entry with "result": {mapped_key: v}
695
696 Args:
697 plugin_params (GulpPluginParams): The plugin parameters.
698 custom_mapping (GulpMapping): The custom mapping.
699 source_key (str): The key to look for(=the event record key to be mapped) in the custom_mapping dictionary
700 v (any): value to set for mapped key/s.
701 index_type_mapping (dict, optional): The elasticsearch index key->type mappings. Defaults to None.
702 ignore_custom_mapping (bool, optional): Whether to ignore custom_mapping and directly map source_key to v. Defaults to False.
703 kwargs: Additional keyword arguments.
704
705 Returns:
706 list[FieldMappingEntry]: zero or more FieldMappingEntry objects with "result" set.
707 """
708 # get mapping and option from custom_mapping
709 if index_type_mapping is None:
710 index_type_mapping = {}
711 # _logger.debug('len index type mapping=%d' % (len(index_type_mapping)))
712 mapping_dict: dict = custom_mapping.fields
713 mapping_options = (
714 custom_mapping.options
715 if custom_mapping.options is not None
716 else GulpMappingOptions()
717 )
718
719 # basic checks
720 if v == "-" or v is None:
721 return []
722
723 if isinstance(v, str):
724 v = v.strip()
725 if not v and mapping_options.ignore_blanks:
726 # not adding blank strings
727 return []
728
729 # fix value if needed, and add to extra
730 if ignore_custom_mapping or (
731 plugin_params is not None and plugin_params.ignore_mapping_ingest
732 ):
733 # direct mapping, no need to check custom_mappings
734 return [FieldMappingEntry(result={source_key: v})]
735
736 if source_key not in mapping_dict:
737 # self.logger().error('key "%s" not found in custom mapping, mapping_dict=%s!' % (source_key, muty.string.make_shorter(str(mapping_dict))))
738 # key not found in custom_mapping, check if we have to map it anyway
739 if not mapping_options.ignore_unmapped:
740 return [
741 FieldMappingEntry(
742 result={self.get_unmapped_field_name(source_key): str(v)}
743 )
744 ]
745
746 # there is a mapping defined to be processed
747 fm: FieldMappingEntry = mapping_dict[source_key]
748 map_to_list = (
749 [fm.map_to] if isinstance(fm.map_to, (str, type(None))) else fm.map_to
750 )
751
752 # in the end, this function will return a list of FieldMappingEntry objects with "result" set: these results will be used to create the GulpDocument object
753 fme_list: list[FieldMappingEntry] = []
754 for k in map_to_list:
755 # make a copy of fme without using deepcopy)
756 dest_fm = FieldMappingEntry(
757 is_timestamp=fm.is_timestamp,
758 event_code=fm.event_code,
759 do_multiply=fm.do_multiply,
760 is_timestamp_chrome=fm.is_timestamp_chrome,
761 is_variable_mapping=fm.is_variable_mapping,
762 result={},
763 )
764
765 # check if it is a number and/or a timestamp (including chrome timestamp, which is a special case)
766 is_numeric = isinstance(v, int) or str(v).isnumeric()
767 if is_numeric:
768 v = int(v)
769 # ensure chrome timestamp is properly converted to nanos
770 # _logger.debug('***** is_numeric, v=%d' % (v))
771 if fm.is_timestamp_chrome:
772 v = int(muty.time.chrome_epoch_to_nanos(v))
773 # _logger.debug('***** is_timestamp_chrome, v nsec=%d' % (v))
774
775 if fm.do_multiply is not None:
776 # apply a multipler if any (must turn v to nanoseconds)
777 # _logger.debug("***** is_numeric, multiply, v=%d" % (v))
778 v = int(v * fm.do_multiply)
779 # _logger.debug("***** is_numeric, AFTER multiply, v=%d" % (v))
780
781 elif isinstance(v, str) and fm.is_timestamp:
782 v = int(
783 muty.time.string_to_epoch_nsec(
784 v,
785 utc=mapping_options.timestamp_utc,
786 dayfirst=mapping_options.timestamp_dayfirst,
787 yearfirst=mapping_options.timestamp_yearfirst,
788 )
789 )
790 # _logger.debug('***** str and is_timestamp, v nsec=%d' % (v))
791 if fm.is_timestamp:
792 # it's a timestamp, another event will be generated
793 vv = muty.time.nanos_to_millis(v)
794 dest_fm.result["@timestamp"] = vv
795 dest_fm.result["@timestamp_nsec"] = v
796 # _logger.debug('***** timestamp nanos, v=%d' % (v))
797 # _logger.debug('***** timestamp to millis, v=%d' % (vv))
798
799 if fm.is_timestamp or fm.is_timestamp_chrome:
800 # _logger.debug('***** timestamp or timestamp_chrome, v=%d' % (v))
801 if v < 0:
802 # _logger.debug('***** adding invalid timestamp')
803 v = 0
804 GulpDocument.add_invalid_timestamp(dest_fm.result)
805 if k is not None:
806 # also add to mapped key
807 dest_fm.result[k] = v
808 else:
809 # not a timestamp, map
810 if k is None:
811 # add unmapped
812 k = self.get_unmapped_field_name(source_key)
813 else:
814 v = self._type_checks(v, k, index_type_mapping)
815 dest_fm.result[k] = v
816
817 fme_list.append(dest_fm)
818 """
819 self.logger().debug('FME LIST FOR THIS RECORD:')
820 for p in fme_list:
821 self.logger().debug(p)
822 self.logger().debug('---------------------------------')
823 """
824 return fme_list
825
Here is the call graph for this function:
Here is the caller graph for this function:

◆ _parser_failed()

TmpIngestStats _parser_failed ( self,
TmpIngestStats fs,
str | dict source,
Exception | str ex )
protected
whole source failed ingestion (error happened before the record parsing loop), helper to update stats

Definition at line 932 of file plugin.py.

934 ) -> TmpIngestStats:
935 """
936 whole source failed ingestion (error happened before the record parsing loop), helper to update stats
937 """
938 self.logger().exception(
939 "PARSER FAILED: source=%s, ex=%s"
940 % (muty.string.make_shorter(str(source), 260), ex)
941 )
942 fs = fs.update(ingest_errors=[ex], parser_failed=1)
943 return fs
944
Here is the call graph for this function:
Here is the caller graph for this function:

◆ _process_plugin_params()

tuple[GulpMapping, GulpPluginParams] _process_plugin_params ( self,
GulpMapping custom_mapping,
GulpPluginParams plugin_params = None )
protected
Process the plugin parameters checking parameters as `timestamp_field`, ... and update the custom mapping accordingly.

Args:
    custom_mapping (GulpMapping): The custom mapping provided: if it is not empty, it will be used as is (plugin_params will be ignored)
    plugin_params (GulpPluginParams, optional): The plugin parameters. Defaults to None.

Returns:
    tuple[GulpMapping, GulpPluginParams]: The updated custom mapping and plugin parameters.

Definition at line 166 of file plugin.py.

168 ) -> tuple[GulpMapping, GulpPluginParams]:
169 """
170 Process the plugin parameters checking parameters as `timestamp_field`, ... and update the custom mapping accordingly.
171
172 Args:
173 custom_mapping (GulpMapping): The custom mapping provided: if it is not empty, it will be used as is (plugin_params will be ignored)
174 plugin_params (GulpPluginParams, optional): The plugin parameters. Defaults to None.
175
176 Returns:
177 tuple[GulpMapping, GulpPluginParams]: The updated custom mapping and plugin parameters.
178 """
179 if plugin_params is None:
180 plugin_params = GulpPluginParams()
181
182 if len(custom_mapping.fields) > 0:
183 # custom_mapping provided
184 return custom_mapping, plugin_params
185
186 self.logger().warning("no custom mapping provided")
187
188 tf = plugin_params.timestamp_field
189 if tf is not None:
190 self.logger().debug("using timestamp_field=%s" % (tf))
191 # build a proper custom_mapping with just timestamp
192 custom_mapping.fields[tf] = FieldMappingEntry(is_timestamp=True)
193 # self.logger().debug(custom_mapping)
194 return custom_mapping, plugin_params
195
Here is the call graph for this function:

◆ _process_record()

tuple[TmpIngestStats, bool] _process_record ( self,
str index,
any record,
int record_idx,
Callable my_record_to_gulp_document_fun,
str ws_id,
str req_id,
int operation_id,
int client_id,
str context,
str source,
TmpIngestStats fs,
GulpMapping custom_mapping = None,
dict index_type_mapping = None,
str plugin = None,
GulpPluginParams plugin_params = None,
GulpIngestionFilter flt = None,
** kwargs )
protected
Process a record for ingestion, updating ingestion stats.
Args:
    index (str): The index to ingest the record into.
    record (any): The record to process.
    record_idx (int): The index of the record as in the source.
    my_record_to_gulp_document_fun (Callable): The function (for this plugin) to convert the record to one or more GulpDocument/s.
    ws_id (str): The websocket ID
    req_id (str): The request ID.
    operation_id (int): The operation ID.
    client_id (int): The client ID.
    context (str): The context of the record.
    source (str): The source of the record.
    fs (TmpIngestStats): The temporary ingestion statistics.
    custom_mapping (GulpMapping, optional): The custom mapping for the record. Defaults to None.
    index_type_mapping (dict, optional): The elastic index type mapping. Defaults to None.
    plugin (str, optional): The plugin name. Defaults to None.
    plugin_params (GulpPluginParams, optional): The plugin parameters. Defaults to None.
    flt (GulpIngestionFilter, optional): The ingestion filter. Defaults to None.
    **kwargs: Additional keyword arguments.
Returns:
    tuple[TmpIngestStats, bool]: A tuple containing the updated temporary ingestion statistics and a flag indicating whether to break the ingestion process.

Definition at line 240 of file plugin.py.

259 ) -> tuple[TmpIngestStats, bool]:
260 """
261 Process a record for ingestion, updating ingestion stats.
262 Args:
263 index (str): The index to ingest the record into.
264 record (any): The record to process.
265 record_idx (int): The index of the record as in the source.
266 my_record_to_gulp_document_fun (Callable): The function (for this plugin) to convert the record to one or more GulpDocument/s.
267 ws_id (str): The websocket ID
268 req_id (str): The request ID.
269 operation_id (int): The operation ID.
270 client_id (int): The client ID.
271 context (str): The context of the record.
272 source (str): The source of the record.
273 fs (TmpIngestStats): The temporary ingestion statistics.
274 custom_mapping (GulpMapping, optional): The custom mapping for the record. Defaults to None.
275 index_type_mapping (dict, optional): The elastic index type mapping. Defaults to None.
276 plugin (str, optional): The plugin name. Defaults to None.
277 plugin_params (GulpPluginParams, optional): The plugin parameters. Defaults to None.
278 flt (GulpIngestionFilter, optional): The ingestion filter. Defaults to None.
279 **kwargs: Additional keyword arguments.
280 Returns:
281 tuple[TmpIngestStats, bool]: A tuple containing the updated temporary ingestion statistics and a flag indicating whether to break the ingestion process.
282 """
283
284 # convert record to one or more GulpDocument objects
285 docs = await self._call_record_to_gulp_document_funcs(
286 operation_id=operation_id,
287 client_id=client_id,
288 context=context,
289 source=source,
290 fs=fs,
291 record=record,
292 record_idx=record_idx,
293 custom_mapping=custom_mapping,
294 index_type_mapping=index_type_mapping,
295 plugin=plugin,
296 plugin_params=plugin_params,
297 record_to_gulp_document_fun=my_record_to_gulp_document_fun,
298 **kwargs,
299 )
300 # ingest record
301 for d in docs:
302 fs = await self._ingest_record(index, d, fs, ws_id, req_id, flt, **kwargs)
303
304 status, _ = await GulpStats.update(
305 self.collab,
306 req_id,
307 ws_id,
308 fs=fs.update(processed=len(docs)),
309 )
310 must_break = False
311 if status in [GulpRequestStatus.FAILED, GulpRequestStatus.CANCELED]:
312 must_break = True
313
314 return fs, must_break
315
Here is the call graph for this function:
Here is the caller graph for this function:

◆ _record_failed()

TmpIngestStats _record_failed ( self,
TmpIngestStats fs,
any entry,
str | dict source,
Exception | str ex )
protected
record failed ingestion (in the record parser loop), helper to update stats

Args:
    fs (TmpIngestStats): The temporary ingestion statistics.
    entry (any): The entry that failed.
    source (str): The source of the record.
    ex (Exception|str): The exception that caused the failure.
Returns:
    TmpIngestStats: The updated temporary ingestion statistics.

Definition at line 945 of file plugin.py.

947 ) -> TmpIngestStats:
948 """
949 record failed ingestion (in the record parser loop), helper to update stats
950
951 Args:
952 fs (TmpIngestStats): The temporary ingestion statistics.
953 entry (any): The entry that failed.
954 source (str): The source of the record.
955 ex (Exception|str): The exception that caused the failure.
956 Returns:
957 TmpIngestStats: The updated temporary ingestion statistics.
958 """
959 # self.logger().exception("RECORD FAILED: source=%s, record=%s, ex=%s" % (muty.string.make_shorter(str(source),260), muty.string.make_shorter(str(entry),260), ex))
960 fs = fs.update(failed=1, ingest_errors=[ex])
961 return fs
962
Here is the caller graph for this function:

◆ _type_checks()

any _type_checks ( self,
any v,
str k,
dict index_type_mapping )
protected
check if the value should be fixed based on the index type mapping

Args:
    v (any): The value to check.
    k (str): The mapped field (i.e. "user.id", may also be an unmapped (i.e. "gulp.unmapped") field)
    index_type_mapping (dict): The elasticsearch index key->type mappings.

Definition at line 638 of file plugin.py.

638 def _type_checks(self, v: any, k: str, index_type_mapping: dict) -> any:
639 """
640 check if the value should be fixed based on the index type mapping
641
642 Args:
643 v (any): The value to check.
644 k (str): The mapped field (i.e. "user.id", may also be an unmapped (i.e. "gulp.unmapped") field)
645 index_type_mapping (dict): The elasticsearch index key->type mappings.
646 """
647 if k not in index_type_mapping:
648 # _logger.debug("key %s not found in index_type_mapping" % (k))
649 return str(v)
650
651 index_type = index_type_mapping[k]
652 if index_type == "long":
653 # self.logger().debug("converting %s:%s to long" % (k, v))
654 if isinstance(v, str):
655 if v.isnumeric():
656 return int(v)
657 if v.startswith("0x"):
658 return int(v, 16)
659 return v
660
661 if index_type == "date" and isinstance(v, str) and v.lower().startswith("0x"):
662 # convert hex to int
663 return int(v, 16)
664
665 if index_type == "keyword" or index_type == "text":
666 # self.logger().debug("converting %s:%s to keyword" % (k, v))
667 return str(v)
668
669 if index_type == "ip":
670 # self.logger().debug("converting %s:%s to ip" % (k, v))
671 if "local" in v.lower():
672 return "127.0.0.1"
673 try:
674 ipaddress.ip_address(v)
675 except ValueError as ex:
676 _logger.exception(ex)
677 return None
678
679 # add more types here if needed ...
680 # self.logger().debug("returning %s:%s" % (k, v))
681 return str(v)
682
Here is the caller graph for this function:

◆ cleanup()

None cleanup ( self)
Optional cleanup routine to call on unload.

Definition at line 549 of file plugin.py.

549 def cleanup(self) -> None:
550 """
551 Optional cleanup routine to call on unload.
552 """
553 return
554

◆ depends_on()

list[str] depends_on ( self)
Returns a list of plugins this plugin depends on.

Definition at line 135 of file plugin.py.

135 def depends_on(self) -> list[str]:
136 """
137 Returns a list of plugins this plugin depends on.
138 """
139 return []
140

◆ desc()

str desc ( self)
Returns a description of the plugin.

Reimplemented in Plugin, Plugin, and Plugin.

Definition at line 118 of file plugin.py.

118 def desc(self) -> str:
119 """
120 Returns a description of the plugin.
121 """
122
Here is the caller graph for this function:

◆ event_type_field()

str event_type_field ( self)
Returns the field name for the event type.

Definition at line 129 of file plugin.py.

129 def event_type_field(self) -> str:
130 """
131 Returns the field name for the event type.
132 """
133 return "event.code"
134

◆ get_unmapped_field_name()

str get_unmapped_field_name ( self,
str field )
Returns the name of the unmapped field.

Parameters:
- field (str): The name of the field.

Returns:
- str: The name of the unmapped field.

Definition at line 623 of file plugin.py.

623 def get_unmapped_field_name(self, field: str) -> str:
624 """
625 Returns the name of the unmapped field.
626
627 Parameters:
628 - field (str): The name of the field.
629
630 Returns:
631 - str: The name of the unmapped field.
632 """
633 if not elastic_api.UNMAPPED_PREFIX:
634 return field
635
636 return f"{elastic_api.UNMAPPED_PREFIX}.{field}"
637
Here is the caller graph for this function:

◆ ingest()

GulpRequestStatus ingest ( self,
str index,
str req_id,
int client_id,
int operation_id,
str context,
str | list[dict] source,
str ws_id,
GulpPluginParams plugin_params = None,
GulpIngestionFilter flt = None,
** kwargs )
Ingests a file using the plugin.

NOTE: implementers should call super().ingest() in their implementation.
NOTE: this function *SHOULD NOT* raise exceptions

Args:
    index (str): name of the elasticsearch index to ingest the document into.
    req_id (str): The request ID related to this ingestion (must exist on the collab db).
    client_id (int): The client ID performing the ingestion.
    operation_id (int): The operation ID related to this ingestion.
    context (str): Context related to this ingestion.
    source (str|list[dict]): The path to the file to ingest, or a list of events dicts.
    ws_id (str): The websocket ID
    plugin_params (GulpPluginParams): additional parameters to pass to the ingestion function. Defaults to None.
    flt (GulpIngestionFilter, optional): filter to apply to this ingestion, if any. Defaults to None.
    kwargs: additional arguments if any

Reimplemented in Plugin, and Plugin.

Definition at line 496 of file plugin.py.

508 ) -> GulpRequestStatus:
509 """
510 Ingests a file using the plugin.
511
512 NOTE: implementers should call super().ingest() in their implementation.
513 NOTE: this function *SHOULD NOT* raise exceptions
514
515 Args:
516 index (str): name of the elasticsearch index to ingest the document into.
517 req_id (str): The request ID related to this ingestion (must exist on the collab db).
518 client_id (int): The client ID performing the ingestion.
519 operation_id (int): The operation ID related to this ingestion.
520 context (str): Context related to this ingestion.
521 source (str|list[dict]): The path to the file to ingest, or a list of events dicts.
522 ws_id (str): The websocket ID
523 plugin_params (GulpPluginParams): additional parameters to pass to the ingestion function. Defaults to None.
524 flt (GulpIngestionFilter, optional): filter to apply to this ingestion, if any. Defaults to None.
525 kwargs: additional arguments if any
526 """
527 self.req_id = req_id
528 self.client_id = client_id
529 self.operation_id = operation_id
530 self.context = context
531 self.ws_id = ws_id
532 self.index = index
533 # raise NotImplementedError("not implemented!")
534

◆ ingest_plugin_initialize()

tuple[dict, GulpMapping] ingest_plugin_initialize ( self,
str index,
str | dict source,
bool skip_mapping = False,
ProcessingPipeline pipeline = None,
str mapping_file = None,
str mapping_id = None,
GulpPluginParams plugin_params = None )
Initializes the ingestion plugin.

Args:
    index (str): The name of the elasticsearch index.
    source (str|dict): The source of the record (source file name or path, usually. may also be a dictionary.).
    skip_mapping (bool, optional): Whether to skip mapping initialization (just prints source and plugin name, and return empty index mapping and custom mapping). Defaults to False.
    pipeline (ProcessingPipeline, optional): The psyigma pipeline to borrow the mapping from, if any. Defaults to None (use mapping file only).
    mapping_file (str, optional): name of the mapping file (i.e. 'windows.json') in the gulp/mapping_files directory. Defaults to None (use pipeline mapping only).
    mapping_id (str, optional): The mapping ID (options.mapping_id) in the mapping file, to get a specific mapping. Defaults to None (use first).
    plugin_params (GulpPluginParams, optional): The plugin parameters (i.e. to override mapping_file, mapping_id, ...). Defaults to None.
Returns:
    tuple[dict, GulpMapping]: A tuple containing the elasticsearch index type mappings and the enriched GulpMapping (or an empty GulpMapping is no valid pipeline and/or mapping_file are provided).

Definition at line 316 of file plugin.py.

325 ) -> tuple[dict, GulpMapping]:
326 """
327 Initializes the ingestion plugin.
328
329 Args:
330 index (str): The name of the elasticsearch index.
331 source (str|dict): The source of the record (source file name or path, usually. may also be a dictionary.).
332 skip_mapping (bool, optional): Whether to skip mapping initialization (just prints source and plugin name, and return empty index mapping and custom mapping). Defaults to False.
333 pipeline (ProcessingPipeline, optional): The psyigma pipeline to borrow the mapping from, if any. Defaults to None (use mapping file only).
334 mapping_file (str, optional): name of the mapping file (i.e. 'windows.json') in the gulp/mapping_files directory. Defaults to None (use pipeline mapping only).
335 mapping_id (str, optional): The mapping ID (options.mapping_id) in the mapping file, to get a specific mapping. Defaults to None (use first).
336 plugin_params (GulpPluginParams, optional): The plugin parameters (i.e. to override mapping_file, mapping_id, ...). Defaults to None.
337 Returns:
338 tuple[dict, GulpMapping]: A tuple containing the elasticsearch index type mappings and the enriched GulpMapping (or an empty GulpMapping is no valid pipeline and/or mapping_file are provided).
339
340 """
341 # self.logger().debug("ingest_plugin_initialize: index=%s, pipeline=%s, mapping_file=%s, mapping_id=%s, plugin_params=%s" % (index, pipeline, mapping_file, mapping_id, plugin_params))
342 self.logger().debug(
343 "INITIALIZING INGESTION for source=%s, plugin=%s"
344 % (muty.string.make_shorter(source, 260), self.name())
345 )
346 if skip_mapping:
347 return {}, GulpMapping()
348
349 # get path of the mapping file in gulp/mapping_files folder
350 mapping_file_path = None
351 if mapping_file is not None:
352 mapping_file_path = gulp_utils.build_mapping_file_path(mapping_file)
353
354 if plugin_params is not None:
355 # override with plugin_params
356 if plugin_params.mapping_file is not None:
357 mapping_file_path = gulp_utils.build_mapping_file_path(
358 plugin_params.mapping_file
359 )
360 if plugin_params.mapping_id is not None:
361 mapping_id = plugin_params.mapping_id
362 if plugin_params.pipeline is not None:
363 pipeline = plugin_params.pipeline
364
365 index_type_mappings = await elastic_api.index_get_mapping(
366 elastic_api.elastic(), index, False
367 )
368 # index_type_mappings = await elastic_api.datastream_get_mapping(self.elastic, index + '-template')
369 m: GulpMapping = await mappings_helper.get_enriched_mapping_for_ingestion(
370 pipeline=pipeline,
371 mapping_file_path=mapping_file_path,
372 mapping_id=mapping_id,
373 )
374 return index_type_mappings, m
375
Here is the call graph for this function:
Here is the caller graph for this function:

◆ internal()

bool internal ( self)
Returns whether the plugin is for internal use only

Definition at line 147 of file plugin.py.

147 def internal(self) -> bool:
148 """
149 Returns whether the plugin is for internal use only
150 """
151 return False
152

◆ logger()

logging.Logger logger ( cls)

Definition at line 95 of file plugin.py.

95 def logger(cls) -> logging.Logger:
96 global _logger
97 return _logger
98
Here is the caller graph for this function:

◆ name()

str name ( self)
Returns the name of the plugin.

Reimplemented in Plugin, Plugin, and Plugin.

Definition at line 124 of file plugin.py.

124 def name(self) -> str:
125 """
126 Returns the name of the plugin.
127 """
128
Here is the caller graph for this function:

◆ options()

list[GulpPluginOption] options ( self)
return available GulpPluginOption list (plugin specific parameters)

Reimplemented in Plugin.

Definition at line 99 of file plugin.py.

99 def options(self) -> list[GulpPluginOption]:
100 """
101 return available GulpPluginOption list (plugin specific parameters)
102 """
103 return []
104
Here is the caller graph for this function:

◆ pipeline()

ProcessingPipeline pipeline ( self,
GulpPluginParams plugin_params = None,
** kwargs )
Returns the pysigma processing pipeline for the plugin, if any.

Args:
    plugin_params (GulpPluginParams, optional): additional parameters to pass to the pipeline. Defaults to None.
    kwargs: additional arguments if any.
Returns:
    ProcessingPipeline: The processing pipeline.

Reimplemented in Plugin.

Definition at line 535 of file plugin.py.

537 ) -> ProcessingPipeline:
538 """
539 Returns the pysigma processing pipeline for the plugin, if any.
540
541 Args:
542 plugin_params (GulpPluginParams, optional): additional parameters to pass to the pipeline. Defaults to None.
543 kwargs: additional arguments if any.
544 Returns:
545 ProcessingPipeline: The processing pipeline.
546 """
547 raise NotImplementedError("not implemented!")
548
Here is the caller graph for this function:

◆ record_to_gulp_document()

list[GulpDocument] record_to_gulp_document ( self,
int operation_id,
int client_id,
str context,
str source,
TmpIngestStats fs,
any record,
int record_idx,
GulpMapping custom_mapping = None,
dict index_type_mapping = None,
str plugin = None,
GulpPluginParams plugin_params = None,
** kwargs )
Converts a record to one or more GulpDocument objects based on the provided index mappings.

Args:
    operation_id (int): The operation ID associated with the record.
    client_id (int): The client ID associated with the record.
    context (str): The context associated with the record.
    source (str): The source of the record (source file name or path, usually).
    fs (TmpIngestStats): The temporary ingestion statistics (may be updated on return).
    record (any): record to convert, plugin dependent format: note that here stacked plugins receives a list of GulpDocument objects instead (since the original record may generate one or more documents).
    record_idx (int): The index of the record in source.
    custom_mapping (GulpMapping, optional): The custom mapping to use for the conversion. Defaults to None.
    index_type_mapping (dict, optional): elastic search index type mappings { "ecs_field": "type", ... }. Defaults to None.
    plugin (str, optional): "agent.type" to be set in the GulpDocument. Defaults to None.
    plugin_params (GulpPluginParams, optional): The plugin parameters to use, if any. Defaults to None.
    extra (dict, optional): Additional fields to add to the GulpDocument (after applying mapping). Defaults to None.
    **kwargs: Additional keyword arguments:

Returns:
    list[GulDocument]: The converted GulpDocument objects or None if an exception occurred (fs is updated then).

Raises:
    NotImplementedError: This method is not implemented yet.

Reimplemented in Plugin, and Plugin.

Definition at line 455 of file plugin.py.

469 ) -> list[GulpDocument]:
470 """
471 Converts a record to one or more GulpDocument objects based on the provided index mappings.
472
473 Args:
474 operation_id (int): The operation ID associated with the record.
475 client_id (int): The client ID associated with the record.
476 context (str): The context associated with the record.
477 source (str): The source of the record (source file name or path, usually).
478 fs (TmpIngestStats): The temporary ingestion statistics (may be updated on return).
479 record (any): record to convert, plugin dependent format: note that here stacked plugins receives a list of GulpDocument objects instead (since the original record may generate one or more documents).
480 record_idx (int): The index of the record in source.
481 custom_mapping (GulpMapping, optional): The custom mapping to use for the conversion. Defaults to None.
482 index_type_mapping (dict, optional): elastic search index type mappings { "ecs_field": "type", ... }. Defaults to None.
483 plugin (str, optional): "agent.type" to be set in the GulpDocument. Defaults to None.
484 plugin_params (GulpPluginParams, optional): The plugin parameters to use, if any. Defaults to None.
485 extra (dict, optional): Additional fields to add to the GulpDocument (after applying mapping). Defaults to None.
486 **kwargs: Additional keyword arguments:
487
488 Returns:
489 list[GulDocument]: The converted GulpDocument objects or None if an exception occurred (fs is updated then).
490
491 Raises:
492 NotImplementedError: This method is not implemented yet.
493 """
494 raise NotImplementedError("not implemented!")
495
Here is the caller graph for this function:

◆ run_command()

dict run_command ( self,
GulpPluginParams p )
Runs a custom command

Definition at line 141 of file plugin.py.

141 def run_command(self, p: GulpPluginParams) -> dict:
142 """
143 Runs a custom command
144 """
145 return None
146

◆ sigma_plugin_initialize()

ProcessingPipeline sigma_plugin_initialize ( self,
ProcessingPipeline pipeline = None,
str mapping_file = None,
str mapping_id = None,
str product = None,
GulpPluginParams plugin_params = None )
Initializes the Sigma plugin to convert sigma rules YAML to elasticsearch DSL query.

Args:
    pipeline (ProcessingPipeline, optional): The processing pipeline. Defaults to None (empty pipeline, plugin must fill it).
    mapping_file (str, optional): The name of the mapping file (i.e. 'windows.json') in the gulp/mapping_files directory. Defaults to None (use pipeline mapping only).
    mapping_id (str, optional): The mapping ID (["options"]["mapping_id"] in the mapping file, to get a specific mapping). Defaults to None (use first).
    product (str, optional): The product. Defaults to None.
    plugin_params (GulpPluginParams, optional): The plugin parameters, to override i.e. mapping_file_path, mapping_id, ... Defaults to None.
Returns:
    ProcessingPipeline: The initialized processing pipeline.

Definition at line 196 of file plugin.py.

203 ) -> ProcessingPipeline:
204 """
205 Initializes the Sigma plugin to convert sigma rules YAML to elasticsearch DSL query.
206
207 Args:
208 pipeline (ProcessingPipeline, optional): The processing pipeline. Defaults to None (empty pipeline, plugin must fill it).
209 mapping_file (str, optional): The name of the mapping file (i.e. 'windows.json') in the gulp/mapping_files directory. Defaults to None (use pipeline mapping only).
210 mapping_id (str, optional): The mapping ID (["options"]["mapping_id"] in the mapping file, to get a specific mapping). Defaults to None (use first).
211 product (str, optional): The product. Defaults to None.
212 plugin_params (GulpPluginParams, optional): The plugin parameters, to override i.e. mapping_file_path, mapping_id, ... Defaults to None.
213 Returns:
214 ProcessingPipeline: The initialized processing pipeline.
215 """
216 self.logger().debug("INITIALIZING SIGMA plugin=%s" % (self.name()))
217
218 mapping_file_path = None
219 if mapping_file is not None:
220 # get path in mapping directory
221 mapping_file_path = gulp_utils.build_mapping_file_path(mapping_file)
222
223 if plugin_params is not None:
224 # override with plugin_params
225 if plugin_params.mapping_file is not None:
226 mapping_file_path = gulp_utils.build_mapping_file_path(
227 plugin_params.mapping_file
228 )
229 if plugin_params.mapping_id is not None:
230 mapping_id = plugin_params.mapping_id
231
232 p = await mappings_helper.get_enriched_pipeline(
233 pipeline=pipeline,
234 mapping_file_path=mapping_file_path,
235 mapping_id=mapping_id,
236 product=product,
237 )
238 return p
239
Here is the call graph for this function:
Here is the caller graph for this function:

◆ tags()

list[str] tags ( self)
returns a list of tags for the plugin. Tags are used to aid filtering of plugins/query filters in the UI.
- "event"
- "network"
- "file"
- "process"
- "threat"
- "threat.enrichments"
- ...

Definition at line 153 of file plugin.py.

153 def tags(self) -> list[str]:
154 """
155 returns a list of tags for the plugin. Tags are used to aid filtering of plugins/query filters in the UI.
156 - "event"
157 - "network"
158 - "file"
159 - "process"
160 - "threat"
161 - "threat.enrichments"
162 - ...
163 """
164 return []
165

◆ type()

GulpPluginType type ( self)
Returns the plugin type.

Reimplemented in Plugin, Plugin, and Plugin.

Definition at line 106 of file plugin.py.

106 def type(self) -> GulpPluginType:
107 """
108 Returns the plugin type.
109 """
110
Here is the caller graph for this function:

◆ version()

str version ( self)
Returns plugin version.

Reimplemented in Plugin, Plugin, and Plugin.

Definition at line 112 of file plugin.py.

112 def version(self) -> str:
113 """
114 Returns plugin version.
115 """
116

Member Data Documentation

◆ buffer

list buffer = []

Definition at line 86 of file plugin.py.

◆ client_id

str client_id = None

Definition at line 78 of file plugin.py.

◆ collab

collab = collab

Definition at line 83 of file plugin.py.

◆ context

tuple context = (None,)

Definition at line 80 of file plugin.py.

◆ elastic

elastic = elastic

Definition at line 84 of file plugin.py.

◆ index

str index = None

Definition at line 77 of file plugin.py.

◆ operation_id

str operation_id = None

Definition at line 79 of file plugin.py.

◆ path

path = path

Definition at line 82 of file plugin.py.

◆ req_id

str req_id = None

Definition at line 76 of file plugin.py.

◆ ws_id

str ws_id = None

Definition at line 81 of file plugin.py.


The documentation for this class was generated from the following file: