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 December, the Splunk Threat Research Team had 1 release of new security content via the Enterprise Security ...

Why am I not seeing the finding in Splunk Enterprise Security Analyst Queue?

(This is the first of a series of 2 blogs). Splunk Enterprise Security is a fantastic tool that offers robust ...

Index This | What are the 12 Days of Splunk-mas?

December 2024 Edition Hayyy Splunk Education Enthusiasts and the Eternally Curious!  We’re back with another ...