- 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 [email protected]:logcheck/logcheck-api-samples.git
cd logcheck-api-samples
Complete 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 Tokens
tab on the left - Select the
Generate a new token
button. (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_ID
andSECRET_KEY
- Copy
TOKEN_ID
andSECRET_KEY
into a.env
file
touch .env
echo "export TOKEN_ID='<paste TOKEN_ID>'" >> .env
echo "export SECRET_KEY='<paste SECRET_KEY>'" >> .env
Note 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.rb
Prerequisites: python3 and pip3
cd python/
pip3 install jsonapi-client python-dotenv
python3 example.py