logdna / logspout

LogDNA Docker integration
MIT License
16 stars 20 forks source link

TAGS template not applied on ECS #4

Closed KevinGreen closed 5 years ago

KevinGreen commented 5 years ago

I added the TAGS template following the ECS setup in the README but it doesn't seem to translate the template to a usable tag.

image

The syslog logspout adapter does this correctly but the logdna adapter doesn't seem to have this same step: https://github.com/gliderlabs/logspout/blob/0da75a223db992cd5abc836796174588ddfc62b4/adapters/syslog/syslog.go#L134

smusali commented 5 years ago

Hey @KevinGreen,

Thanks for reporting this!

After creating logdna/logspout by moving from syslog to http ingestion, we stopped using templated values but it is certainly doable. I will add it asap!

I will let you know when it is done!

And by that time, you can use label values since we do nice label parsing for ECS logs!

Thanks in advance!

KevinGreen commented 5 years ago

Thanks Samir, the app labels are working well. I've just gotten used to the tags!

smusali commented 5 years ago

Hey @KevinGreen,

Sorry for late response!

After working and testing on getting tag from templated string, the newest version has just been released. You can pull it using latest or 20181127 tags.

Now tags can be given in the following format: <simpleTag1>,<simpleTag2>, <templatedTag1>, <simpleTag3>, <templatedTag2>, ... - inside <templatedTag it assumes the outputs are separated with :.

While using handlebars you should know the structure from which you are trying to pull tags; so, message has the following fields:

.Data: string,
.Container.Name: string,
.Container.ID: string,
.Container.Config.Image: string,
.Container.Config.Hostname: string,
.Container.Config.Labels: map[string]string,
.Source: string

I will update the documentation as soon as possible.

If text/template can't execute the given template, it will use the given string which may seem ugly with {{ and }} as tags in order to prevent recursive logging and exceptions.

Let me know if you have any other question.

Thanks for using logdna/logspout!

KevinGreen commented 5 years ago

Thanks Samir, works great!