- A terminal program (e.g. Terminal, iTerm) running a sh-compatible shell (e.g. Bash, ZSH)
- A scripting language. Our examples use Python and Ruby, but you may use any scripting language that supports making an HTTP GET requests with basic HTTP authentication.
git clone git@github.com:logcheck/logcheck-api-samples.git
cd logcheck-api-samplesComplete the sign-up form and a LogCheck team member will help you get started.
- Log in to the website https://www.logcheckapp.com
- In the drop down under your name, select
Settings - Select the
API Tokenstab on the left - Select the
Generate a new tokenbutton. (If the button is disabled, you need to complete the sign-up form to enable API access for your user account.) - A modal will open showing a new
TOKEN_IDandSECRET_KEY
- Copy
TOKEN_IDandSECRET_KEYinto a.envfile
touch .env
echo "export TOKEN_ID='<paste TOKEN_ID>'" >> .env
echo "export SECRET_KEY='<paste SECRET_KEY>'" >> .envNote that the included ruby and python example scripts use the dotenv and python-dotenv packages respectively to access these environment variables.
Please also note that this repo contains a .gitignore file which excludes
.env from source control. Be sure to add this file to your
own future repos to avoid leaking your LogCheck API credentials.
Prerequisites: ruby and bundler
cd ruby/
gem install bundler # if not already installed
bundle install
ruby example.rbPrerequisites: python3 and pip3
cd python/
pip3 install jsonapi-client python-dotenv
python3 example.py