|
We have some Cisco devices that are sending syslog via port 514 natively (no splunk forwarder installed, obviously). I want to be able to send this log to a certain index, based on hostname. I tried using props and transforms as the following: Since the original log from the Cisco device isn't coming from a Splunk forwarder, do I have to regex for the hostname? props.conf
transforms.conf
Thanks! |
|
Unfortunately, as of Splunk 4.3 you cannot have more than one functional stanza/input per UDP port. The devil is in the details of inputs.conf.spec where this limitation is made implicit by the following statement :
It's important to understand that this refers to the specified port, not to the specified data input. This will be further clarified in our next maintenance release by the addition of the following statement to inputs.conf.spec :
If you have configured more than one UDP input stanza using the same port but specifying different hosts of origin, pushing the
This means that in your case, you have to use transformations to route your UDP data to different indexes, as per Lisa's 2nd suggestion. A few considerations I would add : A) If you are using a
B) I personally am not too crazy about host-based filtering in the stanza name of props.conf. I would rather do something like this: B.1) In props.conf, use a sourcetype-based stanza to apply a generic routing transformation to the data coming from the UDP input:
B.2) In transforms.conf, use a regular expression on
In this example, events with a value of "device1.domain.com" for the "host" field will be sent to the "device1" index, while "host=device2.domain.com" and "host=device3.domain.com" will respectively go to indexes "device2" and "device3". C) Finally, an alternative to dynamic index-routing would be to use several transformations with hard-coded C.1) In props.conf, use a sourcetype-based stanza to apply several routing transformation to the data coming from the UDP input:
C.2) In transforms.conf, use a regular expression on
This would be particularly useful if you want to use index names that are not included in the sending device's host name or in the event's raw data. Note: In both scenarios, you might prefer to use the event raw data as the field on which to apply the REGEX rather than "host", in which case you would set Nice - I vote for this answer :-)
(21 Jan, 18:35)
lguinn ♦
Nice tight regex and great additional details!
(23 Jan, 00:43)
Rob ♦
1
I appreciate the responses, but I cannot get any of these suggestions working! All of the 514 data is now being routed to the "main" index, instead of the one I'm specifying, which does exist on my Indexer.
(23 Jan, 07:17)
aferone
@aferone : I'm very glad to hear so. Could you please share the specifics of the configuration that worked for you?
(23 Jan, 07:25)
hexx ♦
1
Certainly: inputs.conf
props.conf
transforms.conf
(23 Jan, 07:41)
aferone
Thank you, Alex!
(23 Jan, 14:03)
hexx ♦
showing 5 of 7
show 2 more comments ▼
|
|
Rob is right about setting the index as part of the input. You are right about using the regular (aka "heavy") forwarder as a collection point for UDP inputs - it adds resilience to your environment. The configuration must go in the inputs.conf file on your forwarder, because you are not using the UF.
For this to work, you will need to specify a stanza for every possible device that is sending data via UDP. (More on this later.) If this is not working, then I have some questions:
Okay, let's assume that you have debugged your input stanza, and it is working. Hopefully you knew about Rob's advice and did this on a testing server, just in case. You may be done, but I have more comments. While it is very efficient to set the index in inputs.conf, it means a lot of work for you. You have to set up a stanza for every device - there is no default. What if you want to change the index for some devices, but let most of them default to a common index? Here is my solution, and it is all done on the forwarder. inputs.conf - sends all UDP:514 data to a single index
props.conf - enter a host stanza for any data to be re-routed to a different index. Or use source instead of host to define the stanza(s).
transforms.conf - enter a stanza for each routing
In this solution, inputs.conf sends all inputs to a single index - one that is the "default" for all UDP inputs. Then, with props.conf and transforms.conf, you override this to route data to a different index. The stanza(s) in props.conf identify the inputs to be routed. The corresponding stanza(s) in transforms.conf do two things:
Of course, if you have to do this for every input, you might as well use the first solution - specify things in inputs.conf and be done with it. PS - and you could regex for the host name if you want, but it isn't necessary.
(21 Jan, 13:42)
lguinn ♦
Very nicely put. +1
(23 Jan, 00:39)
Rob ♦
|
|
Actually I think you can do this a bit easier with editing the inputs.conf file for each source/index on the indexer.
Additionally, this can set the host field with different values as well using the You might wish to take a look at the inputs.conf.spec file for some additional info for setting this up. Here is a link to an example on Splunk docs.. http://docs.splunk.com/Documentation/Splunk/latest/admin/inputsconf 1
Where would this config be? On the main forwarder, or on the indexer? Keep in mind that there are no universal forwarders installed on the source systems at play here.
(18 Jan, 11:00)
aferone
Sorry, this would be on the indexer. As long as your syslog source is pointed at the indexer then the indexer will listen on that port for event data and then put it in the index defined above. If you need a full directory path as to where this goes, it should be in $SPLUNK_HOME/etc/system/local/ or $SPLUNK_HOME/etc/apps/customApp/local/.
(18 Jan, 11:08)
Rob ♦
1
We send everything through a main forwarder. The log in question is coming over port 514, but the main forwarder to indexer communication is over 9997. Will it still work?
(18 Jan, 11:17)
aferone
In that case put that on your main forwarder, but you may want to test everything with a test index first to be sure you are getting the data you are looking for :-)
(18 Jan, 11:24)
Rob ♦
1
Ok, I take it you are using a Universal Forwarder. Is it possible for you to add the stanza's you want to the indexer? You would need to put your props and transforms there as well if you wanted to use those to redirect events to another index. That will definitely work.
(18 Jan, 11:34)
Rob ♦
1
No, I am not using a universal forwarder. That's the issue. The original log is coming from a Cisco device. Straight syslog, port 514. We can't change port 514 on the Cisco devices because of an older iOS. We do use universal forwarders and manipulate the index that way for other systems. We also use custom ports for indexes. But since 514 is the default for so many devices, we want to be able to send to different indexes on devices that cannot change port 514.
(18 Jan, 11:37)
aferone
Yep, you can still do that on the indexer using your inputs.conf to redirect to different indexes for all your sources. The Cisco devices dont need to have a forwarder in between the devices for the info to get parsed. You simply need to create a stanza for each source that you receive on the indexer using the inputs.conf file and specify the index.
(18 Jan, 12:00)
Rob ♦
1
But, we are utilizing the main forwarder in case we have to take the indexer down, the logs will queue on the main indexer. So we have to use it.
(18 Jan, 13:10)
aferone
showing 5 of 9
show 4 more comments ▼
|
