Getting Data In

How to replace the host in the event with the output from an event?

praspai
Path Finder

We have a script running on <script-server> which produces the output as below. We are getting service stats running on different servers like Host-Server-A and Host-Server-B. Currently, the event is tagged to the server where the script is running. Can we change the configuration such that host=<Script-Server> will get replaced with Host.HostName in the event?

8/3/15 
9:13:00.000 AM  
KpiId="193"|kpiName="Error Count: <Host-Server-A>, <port>, Service-name"|IsService.Svc="Service-name"|Host.HostName="Host-Server"|IntegrationServer.Port="<port>"|IsPackage.Name="<service-folder>"|date="2015-08-03T09:13:00Z"|value="5.0"

host = <Script-Server> source = /opt/splunk/etc/apps/B2B/bin/runOptimizeScript.sh sourcetype = OptimizeData

8/3/15 
9:13:00.000 AM  
KpiId="193"|kpiName="Error Count: <Host-Server-B>, <port>, Service-name"|IsService.Svc="Service-name"|Host.HostName="Host-Server"|IntegrationServer.Port="<port>"|IsPackage.Name="<service-folder>"|date="2015-08-03T09:13:00Z"|value="5.0"

host = <Script-Server> source = /opt/splunk/etc/apps/B2B/bin/runOptimizeScript.sh sourcetype = OptimizeData
0 Karma
1 Solution

woodcock
Esteemed Legend

You need to create the following changes and then deploy them to each of your Indexers and restart the Splunk instances there.

In props.conf:

[OptimizeData]
TRANSFORMS-hostoverride=hostoverride

In transforms.conf:

[hostoverride]
DEST_KEY = MetaData:Host
REGEX = Error\s+Count:\s+([^,]+)
FORMAT = host::$1

The documentation is here:

http://docs.splunk.com/Documentation/Splunk/6.2.4/Data/overridedefaulthostassignments

View solution in original post

woodcock
Esteemed Legend

You need to create the following changes and then deploy them to each of your Indexers and restart the Splunk instances there.

In props.conf:

[OptimizeData]
TRANSFORMS-hostoverride=hostoverride

In transforms.conf:

[hostoverride]
DEST_KEY = MetaData:Host
REGEX = Error\s+Count:\s+([^,]+)
FORMAT = host::$1

The documentation is here:

http://docs.splunk.com/Documentation/Splunk/6.2.4/Data/overridedefaulthostassignments

praspai
Path Finder

Hi,

Can you help me with REGEX if I want to capture value assigned to Host.HostName="Host-Server" ?

Thanks,
P

0 Karma

woodcock
Esteemed Legend

Use this:

REGEX = Error\s+Count:\s+([^,]+).*\|Host\.HostName="(?<HostServer>[^"]+)"
0 Karma

praspai
Path Finder

Thanks a lot ..

0 Karma
Get Updates on the Splunk Community!

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 ...

What's new in Splunk Cloud Platform 9.1.2312?

Hi Splunky people! We are excited to share the newest updates in Splunk Cloud Platform 9.1.2312! Analysts can ...

What’s New in Splunk Security Essentials 3.8.0?

Splunk Security Essentials (SSE) is an app that can amplify the power of your existing Splunk Cloud Platform, ...