I might suggest using a SandboxDecoder instead of PayloadRegexDecoder because there's clean support for auto-parsing JSON (via cjson). You can also construct your Carbon message in a cleaner manner, then as well. I'm actually heavily using Lua for most of my decoding for both speed and code cleanliness reasons. Something like this might help: http://hekad.readthedocs.org/en/v0.8.1/sandbox/json_payload_transform.html
However, the code ( https://github.com/mozilla-services/heka/blob/3425fa078cff273b7efc7f7e772f0d55a0ba8314/plugins/graphite/carbon.go#L71) suggests that any \n in the Payload will be a new Carbon message - it may help to try something like: "%Type%.%Cluster%.hdd_avail %hdd_avail% %Date%\n%Type%.%Cluster%.hdd_size %hdd_size% %Date%" I'm not entirely sure if \n is supported in the field line interpolation, though. It's worth trying, though if you don't want to use Lua. On Mon, Jan 5, 2015 at 4:53 AM, Alex Sanami <[email protected]> wrote: > Would you be able to offer advise on how best to output multiple messages > to graphite using the PayloadRegexDecoder. I am currently parsing a json > message from AMQP, and I'm wanting to upload each attribute of the json > message to graphite through CarbonOutput. > > This will only output hdd_avail. Any advise on how I can output the other > attributes (E.g. hdd_size) in a elegant way. > > [capacity] > type = "PayloadRegexDecoder" > match_regex = > '^{\"timestamp\":(?P<Date>.*),\"type\":\"(?P<Type>.*)\",\"fields\":\[{\"cluster\":\"(?P<Cluster>.*)\",\"hdd_avail\":\"(?P<hdd_avail>.*)\",\"hdd_size\":\"(?P<hdd_size>.*)\",\"hdd_used\":\"(?P<hdd_used>.*)\",\"ssd_avail\":\"(?P<ssd_avail>.*)\",\"ssd_size\":\"(?P<ssd_size>.*)\",.*}\]' > > [capacity.message_fields] > Type = "Event" > Date = "%Date%" > Payload = "%Type%.%Cluster%.hdd_avail %hdd_avail% %Date%" > > [PayloadEncoder] > append_newlines = false > > [CarbonOutput] > message_matcher = "Type == 'Event'" > address = "192.168.59.103:49153" > protocol = "tcp" > > > Alex > > > > _______________________________________________ > Heka mailing list > [email protected] > https://mail.mozilla.org/listinfo/heka > >
_______________________________________________ Heka mailing list [email protected] https://mail.mozilla.org/listinfo/heka

