Extract Audit Logs with CS Tools. #54
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: | |
Extract Audit Logs with CS Tools. | |
on: | |
workflow_dispatch: | |
schedule: | |
# Runs every day at 5:10 AM UTC | |
- cron: "10 5 * * *" | |
jobs: | |
extract_data_from_thoughtspot: | |
# Configure Environment Variables for CS Tools configuration | |
# Configure Environment Variables for CS Tools configuration | |
env: | |
CS_TOOLS_THOUGHTSPOT__URL: ${{ secrets.THOUGHTSPOT_URL }} | |
CS_TOOLS_THOUGHTSPOT__USERNAME: ${{ secrets.THOUGHTSPOT_USERNAME }} | |
CS_TOOLS_THOUGHTSPOT__SECRET_KEY: ${{ secrets.THOUGHTSPOT_SECRET_KEY }} | |
# CS_TOOLS_TEMP_DIR: ... | |
DECLARATIVE_SYNCER_SYNTAX: account_name=${{ secrets.SNOWFLAKE_ACCOUNT }}&username=${{ secrets.SNOWFLAKE_USERNAME }}&secret=${{ secrets.SNOWFLAKE_PASSWORD }}&warehouse=${{ secrets.SNOWFLAKE_WAREHOUSE }}&role=${{ secrets.SNOWFLAKE_ROLE }}&database=${{ secrets.SNOWFLAKE_DATABASE }}&schema=${{ secrets.SNOWFLAKE_SCHEMA }}&authentication=basic | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out the repository main branch | |
uses: actions/checkout@v4 | |
- name: Set up Python 3.12 | |
uses: actions/setup-python@v4 | |
with: | |
python-version: 3.12 | |
- name: Install a specific version of CS Tools | |
run: python -m pip install -e .[cli] | |
- name: Install Snowflake Syncer requirements | |
run: python -m pip install snowflake-sqlalchemy>=1.6.1 cryptography | |
# --config ENV: tells CS Tools to pull the information from environment variables. | |
- name: Grab N-7 days of Audit Logs Data | |
run: "cs_tools tools searchable audit-logs --last-k-days 7 --syncer 'snowflake://${{ env.DECLARATIVE_SYNCER_SYNTAX }}&load_strategy=UPSERT' --config ENV:" |