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!

.conf24 | Registration Open!

Hello, hello! I come bearing good news: Registration for .conf24 is now open!   conf is Splunk’s rad annual ...

ICYMI - Check out the latest releases of Splunk Edge Processor

Splunk is pleased to announce the latest enhancements to Splunk Edge Processor.  HEC Receiver authorization ...

Introducing the 2024 SplunkTrust!

Hello, Splunk Community! We are beyond thrilled to announce our newest group of SplunkTrust members!  The ...