Splunk Search

How do you make it so an event field name doesn't overlap with Splunk default fields?

zhatsispgx
Path Finder

Hi there,

I have a dataset that writes a logfile that has a field named host in it by default. Is there a way to make it so this doesn't overlap with the default host field native to splunk?

{
  "_path": "http",
  "_system_name": "bro",
  "_write_ts": "2019-02-01T20:31:18.870431Z",
  "ts": "2019-02-01T20:31:18.870431Z",
  "uid": "CnqHw64mXtzgsYIRzh",
  "id.orig_h": "2.2.2.2",
  "id.orig_p": 59311,
  "id.resp_h": "1.1.1.1",
  "id.resp_p": 443,
  "trans_depth": 1,
  "method": "POST",
  "host": "api.mysite.com",
  "uri": "/api",
  "version": "1.1",
  "request_body_len": 70,
  "response_body_len": 60,
  "status_code": 200,
  "status_msg": "OK",
  "tags": [],
  "username": "someuserhere",
  "orig_fuids": [
    "FLFkoj3yoLCGlDZfy8"
  ],
  "orig_mime_types": [
    "text/json"
  ],
  "resp_fuids": [
    "FGsstvr5HRMsAZpD5"
  ],
  "resp_mime_types": [
    "text/json"
  ]
}
0 Karma

woodcock
Esteemed Legend

If you are using INDEXED_EXTRACTIONS, then you are toast and you'll have to switch to traditional forwarding. If you are using KV_MODE=json then you will have to turn this off and create your own extractions or you can keep it on and use SEDCMD to modify the raw text with something like SEDCMD-host-to-eventhost = s/"host":/"eventhost"/ so that the automatic extraction name does not collide.

0 Karma

chrisyounger
SplunkTrust
SplunkTrust

Hi @zhatsispgx

So you could do it in your props.conf by using EVAL-api_host = host

or in the search by just extracting it again with a better name:

search| rex "host\"\s*:\s*\"(?<api_host>[^\"]+)" | table api_host

I hope this solves your problem

0 Karma
Get Updates on the Splunk Community!

.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 ...

Streamline Data Ingestion With Deployment Server Essentials

REGISTER NOW!Every day the list of sources Admins are responsible for gets bigger and bigger, often making the ...

Remediate Threats Faster and Simplify Investigations With Splunk Enterprise Security ...

REGISTER NOW!Join us for a Tech Talk around our latest release of Splunk Enterprise Security 7.2! We’ll walk ...