Deployment Architecture

commandline method to test Splunk over UDP?

tedder
Communicator

There must be an easy way to fire a single message over UDP to a splunk forwarder/server. "logger" nearly does it. I want to do something like this:

testlogger -h host -p port "message to log in Splunk"

Let me specify- Unix commandline. I suppose I could write a few lines of code, but am I the first person to want this?

Tags (2)
1 Solution

ziegfried
Influencer

You can use netcat for this purpose:

echo "message to log in Splunk" | nc -u -q 0 <HOST> <PORT>

Example:

echo "message to log in Splunk" | nc -u -q 0 localhost 514

(This works on Linux)


On a Mac, you have to use the -w option instead of -q

echo "message to log in Splunk" | nc -u -w 0 splunkhost.mydomain.com 514

Maybe the netcat command is different on other *nix systems as well.

View solution in original post

ziegfried
Influencer

You can use netcat for this purpose:

echo "message to log in Splunk" | nc -u -q 0 <HOST> <PORT>

Example:

echo "message to log in Splunk" | nc -u -q 0 localhost 514

(This works on Linux)


On a Mac, you have to use the -w option instead of -q

echo "message to log in Splunk" | nc -u -w 0 splunkhost.mydomain.com 514

Maybe the netcat command is different on other *nix systems as well.

tedder
Communicator

thanks! That's exactly what I was looking for.

0 Karma
Get Updates on the Splunk Community!

Index This | I am a number, but when you add ‘G’ to me, I go away. What number am I?

March 2024 Edition Hayyy Splunk Education Enthusiasts and the Eternally Curious!  We’re back with another ...

What’s New in Splunk App for PCI Compliance 5.3.1?

The Splunk App for PCI Compliance allows customers to extend the power of their existing Splunk solution with ...

Extending Observability Content to Splunk Cloud

Register to join us !   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to ...