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!

Index This | I am a number, but when you add ‘G’ to me, I go away. What number am I?

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

What’s New in Splunk App for PCI Compliance 5.3.1?

The Splunk App for PCI Compliance allows customers to extend the power of their existing Splunk solution with ...

Extending Observability Content to Splunk Cloud

Register to join us !   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to ...