msticpy.data.uploaders package

Submodules

msticpy.data.uploaders.loganalytics_uploader module

LogAnayltics Uploader class.

class msticpy.data.uploaders.loganalytics_uploader.LAUploader(workspace: str, workspace_secret: str, **kwargs)

Bases: msticpy.data.uploaders.uploader_base.UploaderBase

Uploader class for LogAnalytics.

Initialize a LogAnalytics Uploader instance.

static get_http_timeout(**kwargs)

Get http timeout from settings or kwargs.

upload_df(data: pandas.core.frame.DataFrame, table_name: Any, **kwargs)

Upload a pandas DataFrame to Log Analytics.

Parameters
  • data (pd.DataFrame) – Pandas DataFrame to upload.

  • table_name (str) – Custom table name to upload the data to.

upload_file(file_path: str, table_name: Optional[str] = None, delim: str = ',', **kwargs)

Upload a seperated value file to Log Analytics.

Parameters
  • file_path (str) – Path to file to upload.

  • table_name (str) – Table name to upload data to.

  • delim (str, optional) – Value seperator used by the file, by default “,”

upload_folder(folder_path: str, table_name: Optional[str] = None, delim: str = ',', **kwargs)

Upload all files in a folder to Log Analytics.

Parameters
  • folder_path (str) – Folder path to upload.

  • table_name (str, optional) – Table name to upload all files to, by default None.

  • delim (str, optional) – Sperator used in files in target folder, by default “,”.

msticpy.data.uploaders.splunk_uploader module

Splunk Uploader class.

class msticpy.data.uploaders.splunk_uploader.SplunkUploader(username: str, host: str, password: str, **kwargs)

Bases: msticpy.data.uploaders.uploader_base.UploaderBase

Uploader class for Splunk.

Initialize a Splunk Uploader instance.

connect()

Connect to Splunk host.

static get_http_timeout(**kwargs)

Get http timeout from settings or kwargs.

upload_df(data: pandas.core.frame.DataFrame, table_name: Optional[str], index_name: str, create_index: bool = False, **kwargs)

Upload a Pandas DataFrame to Splunk.

Parameters
  • data (pd.DataFrame) – Data to upload.

  • table_name (str) – The sourcetype in Splunk data will be uploaded to.

  • index_name (str) – Name of the Splunk Index to add data to.

  • host (str, optional) – Host name to upload data with, default will be ‘Upload’

  • create_index (bool, optional) – Set this to true to create the index if it doesn’t already exist. Default is False.

upload_file(file_path: str, table_name: Optional[str] = None, delim: str = ',', index_name: Optional[str] = None, create_index: bool = False, **kwargs)

Upload a seperated value file to Splunk.

Parameters
  • file_path (str) – Path to the file to upload.

  • index_name (str) – Name of the Splunk Index to add data to.

  • table_name (str, optional) – The sourcetype in Splunk data will be uploaded to. If not set the file name will be used.

  • delim (str, optional) – Seperator value in file, by default “,”

  • host (str, optional) – Host name to upload data with, default will be ‘Upload’

  • create_index (bool, optional) – Set this to true to create the index if it doesn’t already exist. Default is False.

upload_folder(folder_path: str, table_name: Optional[str] = None, delim: str = ',', index_name: Optional[str] = None, create_index=False, **kwargs)

Upload all files in a folder to Splunk.

Parameters
  • folder_path (str) – Path to folder to upload.

  • index_name (str) – Name of the Splunk Index to add data to, if it doesn’t exist it will be created.

  • table_name (str, optional) – The sourcetype in Splunk data will be uploaded to. If not set the file name will be used.

  • delim (str, optional) – Seperator value in files, by default “,”

  • host (str, optional) – Host name to upload data with, default will be ‘Upload’

  • create_index (bool, optional) – Set this to true to create the index if it doesn’t already exist. Default is False.

msticpy.data.uploaders.uploader_base module

Data uploader base class.

class msticpy.data.uploaders.uploader_base.UploaderBase(**kwargs)

Bases: abc.ABC

Base class for data providers.

Initialize new instance.

static get_http_timeout(**kwargs)

Get http timeout from settings or kwargs.

abstract upload_df(data: pandas.core.frame.DataFrame, table_name: str, **kwargs)

Upload a Pandas DataFrame to the data store.

Parameters
  • data (pd.DataFrame) – The DataFrame to upload

  • table_name (str) – The name of the table to upload the DataFrame to

abstract upload_file(file_path: str, table_name: str, delim: str = ',', **kwargs)

Upload a file to the data store.

Parameters
  • file_path (str) – Path to the file to upload

  • table_name (str) – The name of the table to upload the file to

  • delim (Optional[str]) – Column deliminator in data file, default is ,

abstract upload_folder(folder_path: str, table_name: Optional[str] = None, delim: str = ',', **kwargs)

Upload a folder of files to the data store.

Parameters
  • folder_path (str) – Path to the folder of files to upload

  • table_name (Optional[str]) – The name of the table to upload the file to, if not set file name is used as table name

  • delim (Optional[str]) – Column deliminator in data file, default is ,

Module contents

Data uploader sub-package.