Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix splunk uploader create index option #692

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions docs/source/data_acquisition/UploadData.rst
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ Uploading a DataFrame to Splunk

To upload a Pandas DataFrame to Splunk you simply pass the DataFrame to ``.upload_df()`` along with the name of a table,
and index you wish the data to be uploaded to. If the index provided does not exist and you want it to be created,
you can pass the parameter ``create_idx = True``.
you can pass the parameter ``create_index = True``.

.. Note – table name for Splunk refers to sourcetype.

Expand All @@ -114,7 +114,7 @@ To upload a file to Splunk pass the path to the file to ``.upload_file()`` along
want the data uploaded to. By default a comma separated value file is expected but if you have some other separator
value you can pass this with the ``delim`` parameter. You can specify a table name to upload the data to with that ``table_name``
parameter but by default the uploader will upload to a table with the same name as the file. As with uploading a DataFrame
if the index provided does not exist and you want it to be created, you can pass the parameter ``create_idx = True``.
if the index provided does not exist and you want it to be created, you can pass the parameter ``create_index = True``.

.. code:: ipython3

Expand All @@ -132,7 +132,7 @@ only support for a single delim type across files. By default this method attemp
folders, if you want to only process certain file extensions you can pass the ``glob`` keyword parameter with the a pattern
for files to attempt to upload. The pattern format required follows the ``pathlib.glob()`` pattern - more details are
avaliable `here <"https://docs.python.org/3/library/pathlib.html#pathlib.Path.glob>`_
As with the other methods if the index provided does not exist and you want it to be created, you can pass the parameter ``create_idx = True``.
As with the other methods if the index provided does not exist and you want it to be created, you can pass the parameter ``create_index = True``.

.. code:: ipython3

Expand Down
3 changes: 1 addition & 2 deletions msticpy/data/uploaders/splunk_uploader.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,7 @@ def _post_data(
)
if not host:
host = "Upload"
create_idx = kwargs.get("create_index", False)
index = self._load_index(index_name, create_idx)
index = self._load_index(index_name, kwargs.get("create_index", False))
progress = tqdm(total=len(data.index), desc="Rows", position=0)
for row in data.iterrows():
data = row[1].to_csv()
Expand Down