Getting Data In

host name extraction during data upload

ugoetzen_splunk
Splunk Employee
Splunk Employee

Just trying to manually add data with different host names in the logs. (with the "add data wizard")
What is the best way to extract the host names during the import? (nobud02, appplusf13,...)

Sample data looks like this:
{"host":"nobud02","ident":"dockerd-current","message":"time=\"2017-06-12T18:00:00.745384875+02:00\" level=error msg=\"Handler for POST /containers/weaveproxy/exec returned error: No such container: weaveproxy\"","log_time":"2017-06-12T16:00:00Z"}
{"host":"appplusf13","ident":"systemd","message":"Created slice user-0.slice.","log_time":"2017-06-12T16:00:01Z"}
{"host":"appngu51","ident":"systemd","message":"Created slice user-0.slice.","log_time":"2017-06-12T16:00:01Z"}
{"host":"delme-20170530-rs1","ident":"systemd","message":"Started Session 2594 of user root.","log_time":"2017-06-12T16:00:01Z"}

Thanks in advance.

0 Karma
1 Solution

somesoni2
SplunkTrust
SplunkTrust

YOu'd need to setup props/transforms to override host from raw data. See this for reference.

https://answers.splunk.com/answers/409734/unable-to-override-host-value-using-regex.html

View solution in original post

0 Karma

somesoni2
SplunkTrust
SplunkTrust

YOu'd need to setup props/transforms to override host from raw data. See this for reference.

https://answers.splunk.com/answers/409734/unable-to-override-host-value-using-regex.html

0 Karma

skoelpin
SplunkTrust
SplunkTrust

You're looking for host_segment

If set to N, the Nth "/"-separated segment of the path is set as host. If
  host_segment=3, for example, the third segment is used.

https://docs.splunk.com/Documentation/Splunk/6.6.2/Admin/Inputsconf

0 Karma

richgalloway
SplunkTrust
SplunkTrust

I believe host_segment refers to the file path of the data source, not the data itself.

---
If this reply helps you, Karma would be appreciated.
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 ...