Building for the Splunk Platform

Redirecting Log4j logs to Splunk

riswana
New Member

Hi,

I am trying to redirect the logs generated by my java project to splunk. I am using below appenders to redirect the logs and created a HTTP Event token for the same. I am able to receive the simple message sent using curl as in splunk documentation for HEC. But not able to recieve the logs in splunk. 

appender.mycomp.type = http
appender.mycomp.name = mycomp
appender.mycomp.url = http://localhost:8088/services/collector
appender.mycomp.token = 9548e361-xxxx-xxxx-xxxx-xxxxxxxxxxx
appender.mycomp.layout.type = PatternLayout
appender.mycomp.layout.pattern = %d{yyyy-MM-dd HH:mm:ss} [%thread] %-5level %logger{36} - %msg%n

Any other configuration required to receive the logs in Splunk 8.x .

Please help

Thanks in advance

Labels (1)
Tags (3)
0 Karma

thambisetty
SplunkTrust
SplunkTrust

https://docs.splunk.com/Documentation/Splunk/8.0.6/Data/FormateventsforHTTPEventCollector#Format_eve...

Event format is very important. you need to incorporate your event in event attribute below:

curl -k -H "Authorization: Splunk 12345678-1234-1234-1234-1234567890AB" https://mysplunkserver.example.com:8088/services/collector/event -d '{"sourcetype": "my_sample_data", "event": "http auth ftw!"}'
————————————
If this helps, give a like below.
0 Karma
Get Updates on the Splunk Community!

Splunk Observability Cloud | Customer Survey!

If you use Splunk Observability Cloud, we invite you to share your valuable insights with us through a brief ...

Happy CX Day, Splunk Community!

Happy CX Day, Splunk Community! CX stands for Customer Experience, and today, October 3rd, is CX Day — a ...

.conf23 | Get Your Cybersecurity Defense Analyst Certification in Vegas

We’re excited to announce a new Splunk certification exam being released at .conf23! If you’re going to Las ...