Skip to content

Instantly share code, notes, and snippets.

@BoredHackerBlog
Created January 23, 2022 19:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save BoredHackerBlog/36f1493543888ad8bba059b9453436a2 to your computer and use it in GitHub Desktop.
Save BoredHackerBlog/36f1493543888ad8bba059b9453436a2 to your computer and use it in GitHub Desktop.
humio stdin testing
import requests
from time import sleep
while True:
try:
if requests.get("http://localhost:8080").status_code == 200:
break
else:
sleep(5)
except:
sleep(5)
headers = {
'Accept': 'application/json, multipart/mixed',
'Accept-Language': 'en-US,en;q=0.5',
'content-type': 'application/json',
'Authorization': 'Bearer null',
'Origin': 'http://localhost:8080',
'Connection': 'keep-alive',
}
data = '{"query":"mutation {\\n enableFeature(feature: CustomIngestTokens)\\n}\\n","variables":null}'
response = requests.post('http://localhost:8080/graphql', headers=headers, data=data)
print(response.json())
data = '{"query":"mutation {\\n addIngestToken(\\n repositoryName: \\"sandbox\\",\\n name: \\"MyIngestToken\\",\\n customToken: \\"abcdabcdabcdabcd\\",\\n ) {\\n ingestToken {\\n name\\n token\\n }\\n }\\n}\\n","variables":null}'
response = requests.post('http://localhost:8080/graphql', headers=headers, data=data)
print(response.json())
quit()
mkdir -p /tmp/humio/mounts/humio /tmp/humio/mounts/kafka-data /tmp/humio/mounts/data
docker run -d -v /tmp/humio/mounts/data:/data -v /tmp/humio/mounts/kafka-data:/data/kafka-data -v /tmp/humio/mounts/humio:/etc/humio:ro --net=host -p 8080:8080 --ulimit="nofile=8192:8192" humio/humio:1.25.3
[sources.in]
type = "stdin"
decoding.codec="json"
[sinks.out]
type = "humio_logs"
inputs = [ "in" ]
compression = "none"
encoding.codec = "json"
token = "abcdabcdabcdabcd"
endpoint = "http://localhost:8080"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment