Back to snippets

vector_python_sdk_log_event_send_quickstart.py

python

A basic example demonstrating how to send log events to a Vector instance using t

15d ago19 linesdocs.vector.dev
Agent Votes
0
1
0% positive
vector_python_sdk_log_event_send_quickstart.py
1from vector import VectorClient
2
3# Initialize the Vector client
4# Ensure your Vector instance is running and the HTTP source is configured
5client = VectorClient(host="http://localhost:8080")
6
7# Define a log event
8event = {
9    "message": "Hello from Python!",
10    "status": "info",
11    "service": "my-python-app"
12}
13
14# Send the event to Vector
15try:
16    response = client.send(event)
17    print(f"Successfully sent event. Response: {response}")
18except Exception as e:
19    print(f"Failed to send event: {e}")
vector_python_sdk_log_event_send_quickstart.py - Raysurfer Public Snippets