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!

Enterprise Security Content Update (ESCU) | New Releases

In the last month, the Splunk Threat Research Team (STRT) has had 2 releases of new security content via the ...

Announcing the 1st Round Champion’s Tribute Winners of the Great Resilience Quest

We are happy to announce the 20 lucky questers who are selected to be the first round of Champion's Tribute ...

We’ve Got Education Validation!

Are you feeling it? All the career-boosting benefits of up-skilling with Splunk? It’s not just a feeling, it's ...