Created
July 13, 2015 00:01
-
-
Save packetchef/11a4332bd80ef940df9d to your computer and use it in GitHub Desktop.
Example of synchronous search in Splunk with default output in JSON
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
#!/bin/bash | |
SERVER="https://splunk_server:8089" | |
QUERY="search sourcetype=dhcp earliest=-4h" | |
SEARCH_URI="services/search/jobs/export" | |
RESULTS=$(curl -s -k "$SERVER/$SEARCH_URI" --data-urlencode search="$QUERY" -d output_mode=json) | |
echo $RESULTS |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment