Splunk Search

Reduce the EVAL command SPL

youngsuh
Contributor

could someone who is SPL expert help me reduce this:

 

 

|eval dest=replace(dest, "dstdomain|src|any-of|dst|# ", ""), dest=replace(mvjoin(dest, " "), "/32", "|"), dest=split(dest, "|"), dest=split(dest, " ") 

 

 

Labels (2)
0 Karma

richgalloway
SplunkTrust
SplunkTrust

What is the problem you are trying to solve?

---
If this reply helps you, Karma would be appreciated.

youngsuh
Contributor

I am trying to parse the squid.conf file into a table.  I can't actually post the conf file due to security reason.

sourcetype="conf_no_timestamp"
| rex "( P<rule_name>^http_access|acl|cache|always_direct|persistent_request_timeout|request_timeout|follow_x_forwarded_for)\s(?P<action>[\w]+)\s(?<server_group_name>.*)$"
| eval action=split(action," ")
| eval server_group_name=split(server_group_name, " ")
| where action like "allow"
| table rule_name, server_group_name, action
| append
    [ search  sourcetype="conf_no_timestamp"
    | rex "(?P<rule_name>^http_access|acl|cache|always_direct|persistent_request_timeout|request_timeout|follow_x_forwarded_for)\s(?P<server_group_name>[\w]+)\s(?<dest>.*)$"
    | eval server_group_name=split(server_group_name," ")
    | eval dest=replace(dest, "dstdomain|src|any-of|dst|# ", ""), dest=replace(mvjoin(dest, " "), "/32", "|"), dest=split(dest, "|"), dest=split(dest, " ")
    | where rule_name like "acl"
    | table rule_name, dest, server_group_name]
| fillnull value="allow" action
| stats values(rule_name) as rule_name values(dest) as dest values(action) as action count by server_group_name
0 Karma

ITWhisperer
SplunkTrust
SplunkTrust

Can you share some sample events that you are trying to  process?

0 Karma
Get Updates on the Splunk Community!

Extending Observability Content to Splunk Cloud

Watch Now!   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to leverage ...

More Control Over Your Monitoring Costs with Archived Metrics!

What if there was a way you could keep all the metrics data you need while saving on storage costs?This is now ...

New in Observability Cloud - Explicit Bucket Histograms

Splunk introduces native support for histograms as a metric data type within Observability Cloud with Explicit ...