Wiki source code of Beats for splunk
Last modified by Normann P. Nielsen on 2016/04/26 07:38
Show last authors
| author | version | line-number | content |
|---|---|---|---|
| 1 | There is no problem using the [[PacketBeat>>https://www.elastic.co/products/beats/packetbeat]] and [[TopBeat>>https://www.elastic.co/products/beats/topbeat]] inteded for theĀ [[ELK - ElasticSearch, LogStash, Kibana>>Main.information-technology.elk-elasticsearch-logstash-kibana]] stack with splunk, as these can log to file: | ||
| 2 | |||
| 3 | First, install theam as described in [[ELK - ElasticSearch, LogStash, Kibana>>Main.information-technology.elk-elasticsearch-logstash-kibana]] | ||
| 4 | |||
| 5 | Then, set the output to file in the Beat's yml file (in either /etc/packetbeat/packetbeat.yml or /etc/topbeat/topbeat.yml): | ||
| 6 | |||
| 7 | |||
| 8 | {{code language="/etc/packetbeat/packetbeat.yml"}} | ||
| 9 | # Configure what outputs to use when sending the data collected by the beat. | ||
| 10 | # Multiple outputs may be used. | ||
| 11 | output: | ||
| 12 | ... | ||
| 13 | ... | ||
| 14 | ### File as output | ||
| 15 | file: | ||
| 16 | # Path to the directory where to save the generated files. The option is mandatory. | ||
| 17 | path: "/tmp/packetbeat" | ||
| 18 | # Name of the generated files. The default is `packetbeat` and it generates files: `packetbeat`, `packetbeat.1`, `packetbeat.2`, etc. | ||
| 19 | filename: packetbeat | ||
| 20 | # Maximum size in kilobytes of each file. When this size is reached, the files are | ||
| 21 | # rotated. The default value is 10 MB. | ||
| 22 | rotate_every_kb: 10000 | ||
| 23 | # Maximum number of files under path. When this number of files is reached, the | ||
| 24 | # oldest file is deleted and the rest are shifted from last to first. The default | ||
| 25 | # is 7 files. | ||
| 26 | number_of_files: 7 | ||
| 27 | {{/code}} | ||
| 28 | |||
| 29 | |||
| 30 | {{code language="/etc/topbeat/topbeat.yml"}} | ||
| 31 | # Configure what outputs to use when sending the data collected by the beat. | ||
| 32 | # Multiple outputs may be used. | ||
| 33 | output: | ||
| 34 | ... | ||
| 35 | ... | ||
| 36 | ### File as output | ||
| 37 | file: | ||
| 38 | # Path to the directory where to save the generated files. The option is mandatory. | ||
| 39 | path: "/tmp/topbeat" | ||
| 40 | # Name of the generated files. The default is `topbeat` and it generates files: `topbeat`, `topbeat.1`, `topbeat.2`, etc. | ||
| 41 | filename: topbeat | ||
| 42 | # Maximum size in kilobytes of each file. When this size is reached, the files are | ||
| 43 | # rotated. The default value is 10 MB. | ||
| 44 | rotate_every_kb: 10000 | ||
| 45 | # Maximum number of files under path. When this number of files is reached, the | ||
| 46 | # oldest file is deleted and the rest are shifted from last to first. The default | ||
| 47 | # is 7 files. | ||
| 48 | number_of_files: 7 | ||
| 49 | {{/code}} | ||
| 50 | |||
| 51 | |||
| 52 | |||
| 53 | Then add, the file to splunk input.conf: | ||
| 54 | |||
| 55 | |||
| 56 | {{code language="input.conf"}} | ||
| 57 | [monitor:///tmp/packetbeat/packetbeat] | ||
| 58 | host=moserver | ||
| 59 | index=packetbeat | ||
| 60 | sourcetype=packetbeat-output | ||
| 61 | [monitor:///tmp/topbeat/topbeat] | ||
| 62 | host=moserver | ||
| 63 | index=topbeat | ||
| 64 | sourcetype=topbeat-output | ||
| 65 | {{/code}} | ||
| 66 | |||
| 67 | |||
| 68 | |||
| 69 | These baby's log a lot of data... so I configure the sample rate for topbeat (can be done for packetbeat), and change it from 10 to 60 seconds: | ||
| 70 | |||
| 71 | |||
| 72 | {{code language="/etc/topbeat/topbeat.yml"}} | ||
| 73 | input: | ||
| 74 | # In seconds, defines how often to read server statistics | ||
| 75 | period: 10 | ||
| 76 | {{/code}} |