Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[feature request] Add JSON to every input line #39

Open
boenrobot opened this issue Jan 7, 2020 · 4 comments
Open

[feature request] Add JSON to every input line #39

boenrobot opened this issue Jan 7, 2020 · 4 comments

Comments

@boenrobot
Copy link

I'd like to keep my logs both in files and in ElasticSearch, and pipe them to ES via pino-elasticsearch.

In order to keep my log files smaller, I'd like to not include data that is the same on every line, such as the application the file belongs to and perhaps other data that would be known at or before startup of pino-elasticsearch.

It would be great if I could pass a file with such a JSON from the command line or pass one directly when using as a library.

@mcollina
Copy link
Member

mcollina commented Jan 7, 2020

I'm not understanding what you need. Can you use tee?

@boenrobot
Copy link
Author

I plan on having the following...

A single ElasticSearch server that will store logs of multiple applications.

Each application outputs logs via pino into its own log file.

Use logagent to pipe each log file to an instance of pino-elasticsearch.

Each pino-elasticsearch instance connects to the one ElasticSearch server.

In this setup, pino-elasticsearch can't tell ElasticSearch which application the logs came in from, despite the fact that logagent does know it.

I could write the application name in the actual text of each line, but that's just wasteful.

@mcollina
Copy link
Member

mcollina commented Jan 7, 2020

If you place all the logs in the same ES index, you’ll have to add the application name in each log line.

Why can’t you just use logagent directly?

@boenrobot
Copy link
Author

I'm a bit new to both ElasticSearch and Logagent, so... reading up a little more on it now, it seems I could set up a different index for each app... I guess that would work.

And also reading up on logagent's parser, it supports "Bunyan format" logs which AFAIK is what pino's format is based on, so I guess that might work. The mere fact there was only "pattern" rather than an explicit plugin made me question whether it can handle it, so I thought I should pipe it to a specialized binary, and pino-elasticsearch seemed like the perfect fit.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants