-
Notifications
You must be signed in to change notification settings - Fork 154
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
Reading multiple files ? #5
Comments
Currently grok_exporter only supports a single file, so if you want to monitor multiple files you need to start multiple grok_exporter instances. However, I plan to implement support for multiple log files within the next few weeks, as soon as I find the time. I'm leaving this issue open until it's done. |
Which makes most sense in sidecar use-case 👍 |
In case anyone wonders why this is not supported yet: Implementing support for multiple log files might require only a few code changes, but there could be unexpected side effects and corner cases, so I would like to implement an extensive automated test first:
My plan is to write automated tests first, and then implement support for monitoring multiple files. I will only release it if I am sure it works even with strange corner cases. It might take another few weeks until I find the time. |
@fstab thanks, sounds great! I agree watching multiple files isn't trivial to get right. Prometheus at least should contain some sample code that does this for |
@fstab is this still WIP? Is there like an "early access branch"? |
It's still WIP, but I currently have very limited time. As soon as I find the time it will be the first feature I will work on (except there are bugs, bugs have higher priority). I am hoping I will find some time around Easter, but I can't really promise it. If someone wants to help out and create a pull request: please go ahead! |
I created a branch The config is pretty simple: Set global:
config_version: 3
inputs:
- type: file
path: ./example/exim-rejected-RCPT-examples.log
- type: file
path: ./example/exim-rejected-RCPT-examples2.log
... By default, a new label Apart from tests, there are still some things to figure out.
If you have feedback, please comment here. |
@fstab Thank you for your work on this. Regarding your questions :
|
Hi @fstab
I think having a folder and setting a wild card like "*.log" would be a better solution since the application log rotation settings sometimes zip the older logs. and they create logs with a timestamp appended to the file name, like appliction-9999_12_30_12:00:00.log |
Wildcards would be very useful. Besides it would be great to specify wildcards for directories too. |
I do not need wildcards but metrics per file is what I need. |
Hi =) Any progress with the subject? It would be very useful feature. |
I should really start working on it. I hope there will be some time for it in February. |
Looking forward to wild card support too! |
Hi, Telegraf currently does support a path with a wildcard, but I find this product too much overkilled. It would be wonderful if you could get us a viable alternative to the InfluxData product. |
Hi @fstab Is this feature already implemented ? |
Not yet, but I hope soon. I know I am saying this for a long time now, but with two small children even finding a free hour for hobby software projects can be challenging. I am positive that I will start working on |
Looking forward to this feature. |
Hey @fstab I just had a related question. Log files I am trying to export data from have day's date in them and they rotate daily. I wanted to tail the latest file - say access-20190410.log. Is there a workaround to do so. Thanks, |
@sandeepdharembra you are commenting in the right ticket. When this ticket is done |
Can't wait for this! 👍 |
Hi,is it in progress that metrics may define filters to specify which files they apply to?it is really useful when multiple files are supported. |
Hi, is this available only on the multiple-logfiles branch? I need to configure only a list of inputs with two files. |
Please don't use this branch but start two |
@fstab Is this feature already implemented ? Or which branch should I use? |
The last comment is still valid:
|
Good news: I just pushed an implementation that supports wildcards. Sorry that it took so long. I will need to add a few tests before building a release. If you want to try it, you can build the The By default, the metrics are applied to all log files. If you want to restrict a metric to one or more specific paths, you can add a I will describe it more detailed when I update the documentation. |
Updated documentation is on the |
Released it as v1.0.0.RC1. Documentation is merged to |
Thanks ! |
Hi
you need to configure the paths in the input section. This is used to tell the grok_exporter input which files to read.
I see that you have specified paths in the metrics section. This is a kind of filter telling grok_exporter that the metric should not be applied to all files from the input, but just to the files matching the path. However, you still need to specify paths in the input section to tell grok_exporter which files to read.
Fabain
…On Thu, Feb 27, 2020 at 01:33:31AM -0800, krisla wrote:
Hello,
Could please help me troubleshooting my config file?
2 issues:
- one using multiple log files for specific metric;
- one using gsub.
Thanks in advance:
```
global:
config_version: 3
input:
type: file
readall: true # Read from the beginning of the file? False means we start at the end of the file and read only new lines.
metrics:
- type: histogram
name: bills_requests_total
help: Total number of bills requests
paths:
- /home/kslavov/CORE/lite_100*/log/core/bills_req.log
- /home/kslavov/CORE/virtb_100*/log/core/bills_req.log
- /home/kslavov/CORE/mobile_100*/log/core/bills_req.log
match: '(?<system>(?<=system=).\w+).*(?<action>(?<=action=).\w+).*(?<merchant>(?<=merchant=).\w+).*(?<duration>(?<=duration=).\D+\d\d\d).*(?<result>(?<=result=).\d+)'
value: '{{.duration}}'
buckets: [0.2, 0.5]
labels:
system: '{{.system}}'
action: '{{.action}}'
result: '{{.result}}'
- type: counter
name: core_request_count
help: requests per system
paths:
- /home/kslavov/CORE/asdf_1001/log/core/status.log
- /home/kslavov/CORE/pvdg_1001/log/core/status.log
- /home/kslavov/CORE/zxcf_1001/log/core/status.log
match: 'user connected in'
labels:
system: '{{gsub .logfile ".*CORE/([^&]*)_.*" "\\1" }}'
server:
protocol: http
port: 9144
host: localhost
```
***@***.***:/etc/grok_exporter# echo "/home/kslavov/CORE/asdf_1001/log/core/" | sed -rn '/.*CORE\/([^&]*)\_.*/ s//\1/p'
asdf
***@***.***:/etc/grok_exporter# grok_exporter -config config/config.yml -showconfig
Failed to load config/config.yml: invalid input configuration: one of 'path' or 'paths' is required
--
You are receiving this because you modified the open/close state.
Reply to this email directly or view it on GitHub:
#5 (comment)
|
Thanks
На чт, 27.02.2020 г., 12:10 ч. Fabian Stäber <[email protected]>
написа:
… Hi
you need to configure the paths in the input section. This is used to tell
the grok_exporter input which files to read.
I see that you have specified paths in the metrics section. This is a kind
of filter telling grok_exporter that the metric should not be applied to
all files from the input, but just to the files matching the path. However,
you still need to specify paths in the input section to tell grok_exporter
which files to read.
Fabain
On Thu, Feb 27, 2020 at 01:33:31AM -0800, krisla wrote:
> Hello,
> Could please help me troubleshooting my config file?
> 2 issues:
> - one using multiple log files for specific metric;
> - one using gsub.
>
> Thanks in advance:
>
> ```
> global:
> config_version: 3
> input:
> type: file
> readall: true # Read from the beginning of the file? False means we
start at the end of the file and read only new lines.
> metrics:
> - type: histogram
> name: bills_requests_total
> help: Total number of bills requests
> paths:
> - /home/kslavov/CORE/lite_100*/log/core/bills_req.log
> - /home/kslavov/CORE/virtb_100*/log/core/bills_req.log
> - /home/kslavov/CORE/mobile_100*/log/core/bills_req.log
> match:
'(?<system>(?<=system=).\w+).*(?<action>(?<=action=).\w+).*(?<merchant>(?<=merchant=).\w+).*(?<duration>(?<=duration=).\D+\d\d\d).*(?<result>(?<=result=).\d+)'
> value: '{{.duration}}'
> buckets: [0.2, 0.5]
> labels:
> system: '{{.system}}'
> action: '{{.action}}'
> result: '{{.result}}'
> - type: counter
> name: core_request_count
> help: requests per system
> paths:
> - /home/kslavov/CORE/asdf_1001/log/core/status.log
> - /home/kslavov/CORE/pvdg_1001/log/core/status.log
> - /home/kslavov/CORE/zxcf_1001/log/core/status.log
> match: 'user connected in'
> labels:
> system: '{{gsub .logfile ".*CORE/([^&]*)_.*" "\\1" }}'
> server:
> protocol: http
> port: 9144
> host: localhost
> ```
>
> ***@***.***:/etc/grok_exporter# echo
"/home/kslavov/CORE/asdf_1001/log/core/" | sed -rn '/.*CORE\/([^&]*)\_.*/
s//\1/p'
> asdf
>
> ***@***.***:/etc/grok_exporter# grok_exporter -config
config/config.yml -showconfig
> Failed to load config/config.yml: invalid input configuration: one of
'path' or 'paths' is required
>
>
>
> --
> You are receiving this because you modified the open/close state.
> Reply to this email directly or view it on GitHub:
> #5 (comment)
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#5?email_source=notifications&email_token=AGKICTPZFKAZW3DENFBBVCLRE6GSXA5CNFSM4CSDRZJ2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOENDYF6I#issuecomment-591889145>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AGKICTM5BZDOFG7PPF3CFZLRE6GSXANCNFSM4CSDRZJQ>
.
|
Hi,
thanks for grok_exporter, looks really useful! I was wondering if there's support for reading multiple files within the same config/server ?
The text was updated successfully, but these errors were encountered: