Skip to content

Instantly share code, notes, and snippets.

@6d61726b760a
6d61726b760a / splunk_aws_hostname.ps1
Created January 10, 2024 01:02
quick script to customize the splunk hostname config for windows hosts
Set-PSDebug -Off
# splunk service details
$splunkService = "SplunkForwarder"
# path to splunk configs
$splunk_serverconf = 'C:\Program Files\SplunkUniversalForwarder\etc\system\local\server.conf'
$splunk_inputsconf = 'C:\Program Files\SplunkUniversalForwarder\etc\system\local\inputs.conf'
# get current computername
@6d61726b760a
6d61726b760a / prometheus-hec.md
Created September 5, 2023 08:07
otel prometheus to splunk hec

scraping prometheus endpoints with otel

the otel collector is a reasonably nice way to scrape prometheus enpoints

it is obviously designed for use with splunk's olly cloud, but the otel collector supports output to splunk hec tokens as well.

im running multiple docker containers (to seperate workloads).

first, create configs

#!/usr/bin/python3
# a quick and dirty dns test script
# checks to see if we can resolve a list of hosts
# writes to the hec endpoint on the localhost
# (expected to be run from hfw)
#
# cron: * * * * * /root/dnstest.py >/tmp/dnstest.out 2>&1
#
# mark.vandenbos@gmail.com
#!/usr/bin/env bash
# set -euxo pipefail
# ----
#
# report ip address changes to slack channel
#
# this script detects and reports ip address changes
# to me via personal slack message.
#
abandoned
able
absolute
adorable
adventurous
academic
acceptable
acclaimed
accomplished
accurate
@6d61726b760a
6d61726b760a / .env
Created January 31, 2023 23:54
splunkcloud scripted dashboard generation
TZ="Australia/Brisbane"
SPLUNK_ENDPOINT="https://myendpoint.splunkcloud.com:8089"
SPLUNK_USERNAME="splunkusername"
SPLUNK_PASSWORD="splunkpassword"
SPLUNK_APP="splunkapp"
@6d61726b760a
6d61726b760a / sync_lp_op.sh
Last active January 23, 2023 02:17
sync specific lastpass credentials with onepass
#!/bin/bash
#
# sync specific lastpass credentials with onepass
#
# my employer uses lastpass, but i use 1password. i dont
# want to replicate all my work passwords into 1password
# but i do want to replicate a few "critical" passwords
# (eg webmail) so i can check my emails from home. this
# script is a quick hack to do this.
@6d61726b760a
6d61726b760a / splunkcloud_hec_stanza.spl
Created December 5, 2022 03:25
splunkcloud: generate hec input stanza from splunkclound config
| rest splunk_server=local /services/data/inputs/http
```
some fields may not be populated so
we try to come up with sane defaults
```
| eval allowQueryStringAuth = if(isnull(allowQueryStringAuth), "false", allowQueryStringAuth)
| eval useACK = if(isnull(useACK), "false", useACK)
| eval indexes = if(isnull(indexes), index, mvjoin(indexes, " "))
| fillnull value="" sourcetype
| rex field=title ".*\/\/(?<x_description>[^\$]+)"
@6d61726b760a
6d61726b760a / README.md
Created September 6, 2022 06:06
lastpass cli + fzf = <3

lp2agent

add an ssh key from lastpass to ssh-agent

pull an ssh key from lastpass and add it to ssh agent for 30 seconds so you can ssh

usage

lp2agent

@6d61726b760a
6d61726b760a / splunk_dbx.http
Created April 16, 2021 06:54
VS Code Rest Client Examples for Splunk DBConnect
# this file was written to be used with the VS Code HTTP rest client.
# (https://marketplace.visualstudio.com/items?itemName=humao.rest-client)
# There should be more than enough detail to create some more advanced
# scripting/automation
# NOTE: if there is a problem with a connection (eg incorrect username/password,
# or a db permissions issue) when you are trying to add an input, splunk
# responds with "unable to process json" which is a little misleading