Getting Data In

ingest events with a specific string - remove the rest

schose
Builder

Hi all,

I'm trying to ingest (multiline) events with the string "public_ip" and remove the rest 

props.conf:

[public_ips]
TRANSFORMS-removeallnonsense = remove_unneeded

 

transforms.conf
[remove_unneeded]
REGEX = (?m)^((?!public_ip).)*$
DEST_KEY = queue
FORMAT = nullQueue
 
When i now try to ingest Data using HEC:

curl -k http://localhost:8088/services/collector -H 'Authorization: Splunk 4f40e8ab-99a6-479f-ba13-7352feb11111' \
-d '{"sourcetype": "public_ips", "event":"foobar"}'

is not indexed - fine.

 

curl -k http://localhost:8088/services/collector -H 'Authorization: Splunk 4f40e8ab-99a6-479f-ba13-7352feb11111' \
-d '{"sourcetype": "public_ips", "event":"foobar public_ip: 1.2.3.4 foobar1"}'

this is indexed - fine

when running: 

curl -k http://localhost:8088/services/collector -H 'Authorization: Splunk 4f40e8ab-99a6-479f-ba13-7352feb11111' \
-d '{"sourcetype": "public_ips", "event":"foobar public_ip: 1.2.3.4 foobar\nline2"}'

This is not indexed - not fine.  It seems i have a regex multiline issue i do not see..

Thanks for your help in advance,

Andreas

 

 

0 Karma
1 Solution

gcusello
SplunkTrust
SplunkTrust

Hi @schose,

could you share a sample of your logs? in this way I can analyze your regex.

Anyway, try a different approach (as described at https://docs.splunk.com/Documentation/Splunk/8.1.0/Forwarding/Routeandfilterdatad#Filter_event_data_... "take public_ip events and discrd the rest" instead of "discard all not public_ip events"; something like this:

In props.conf:

[public_ips]
TRANSFORMS-set= setnull,setparsing

In transforms.conf:

[setnull]
REGEX = .
DEST_KEY = queue
FORMAT = nullQueue

[setparsing]
REGEX = public_ip
DEST_KEY = queue
FORMAT = indexQueue

Ciao.

Giuseppe

View solution in original post

gcusello
SplunkTrust
SplunkTrust

Hi @schose,

could you share a sample of your logs? in this way I can analyze your regex.

Anyway, try a different approach (as described at https://docs.splunk.com/Documentation/Splunk/8.1.0/Forwarding/Routeandfilterdatad#Filter_event_data_... "take public_ip events and discrd the rest" instead of "discard all not public_ip events"; something like this:

In props.conf:

[public_ips]
TRANSFORMS-set= setnull,setparsing

In transforms.conf:

[setnull]
REGEX = .
DEST_KEY = queue
FORMAT = nullQueue

[setparsing]
REGEX = public_ip
DEST_KEY = queue
FORMAT = indexQueue

Ciao.

Giuseppe

schose
Builder

Hi @gcusello ,

I tried to share some demo data within the curl commands. 🙂

Anyway... the example you posted worked for me, awesome!

Thanks and best regards,

Andreas

0 Karma

gcusello
SplunkTrust
SplunkTrust

Hi @schose,

good for you.

Ciao and happy splunking.

Giuseppe

P.S.: Karma Points are appreciated 😉

Career Survey
First 500 qualified respondents will receive a $20 gift card! Tell us about your professional Splunk journey.

Can’t make it to .conf25? Join us online!

Get Updates on the Splunk Community!

Take Action Automatically on Splunk Alerts with Red Hat Ansible Automation Platform

 Are you ready to revolutionize your IT operations? As digital transformation accelerates, the demand for ...

Calling All Security Pros: Ready to Race Through Boston?

Hey Splunkers, .conf25 is heading to Boston and we’re kicking things off with something bold, competitive, and ...

Beyond Detection: How Splunk and Cisco Integrated Security Platforms Transform ...

Financial services organizations face an impossible equation: maintain 99.9% uptime for mission-critical ...