Skip to content

pmm-sumo/sumo-data-tools

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

The repo contains a simple script which might aid in converting CSV file into a series of newline-separated JSON records and upload them to Sumo Logic

Running

Make sure dependencies are installed (pip install -r requirements.txt)

Making a dry run

VERBOSE=1 ./upload-csv.py file.csv

For example:

$ cat test.csv
first,last,age
Tom,Sawyer,12
Huckleberry,Finn,13

$ VERBOSE=1 ./upload-csv.py test.csv
{"first": "Tom", "last": "Sawyer", "age": "12"}
{"first": "Huckleberry", "last": "Finn", "age": "13"}

Uploading results

Substitute the MY_URL with actual collector endpoint address and run it as:

URL="https://MY_URL" ./upload-csv.py file.csv

For example:

$ URL="https://collectors.eu.sumologic.com/receiver/v1/http/AbcDefGhiJklMno123AbcDefGhiJklMno123==" ./upload-csv.py test.csv
Sending a payload of 2 records to https://collectors.eu.sumologic.com/receiver/v1/http/AbcDefGhiJklMno123AbcDefGhiJklMno123==
<Response [200]>

For a reference on how to use the data afterwards, check Parse JSON Formatted Logs. For the example above, you can start with | json "first", "last", "age" | fields first, last, age

Parameters

There are several environment properties that control the execution of the script:

  • URL - the actual URL where the POST is being sent (when empty, no data is being actually sent). The address of the HTTP type source can be found in Manage Data/Collection of your Sumo Logic account.
  • VERBOSE - when set to True (or 1), the sent contents is being printed out on the console too
  • MAX_RECORDS_IN_POST - number of records to include in a single request

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages