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

Config option to append the filename to the tag #226

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

tterrace
Copy link

We have a use case where we'd like to glob all the files in several directories and give a unique tag to each, but also preserve the filenames in the log lines. For example, if we have a couple servers logging to multiple directories under /var/log, we could do something like:

files:
    - path: /var/log/frontend_server/*_log
      tag: frontend_server.
      appendPath: true
    - path: /var/log/backend_server/*_log
      tag: backend_server.
      appendPath: true

And the log lines would show up with the filenames (acceess_log/error_log) appended in papertrail:

Jul 24 14:31:44 i-080808ababab frontend_server.access_log: GET /
Jul 24 14:31:44 i-080808ababab frontend_server.error_log: ERROR: 
Jul 24 14:31:44 i-080808ababab backend_server.access_log: POST /
Jul 24 14:31:44 i-080808ababab backend_server.error_log: ERROR: 

I was able to hack my way into something that works, but I'm not a go programmer so it might not be the correct approach.

@mfontani
Copy link

mfontani commented Feb 4, 2023

I'd also really like this. I've a couple apps running on the same host and they log to different directories but to files with the same name (a number that increases at every app restart). This'd help me better identify which is which.

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

Successfully merging this pull request may close these issues.

2 participants