{"id":13582081,"url":"https://github.com/michael-doubez/filestat_exporter","last_synced_at":"2026-01-12T06:38:19.874Z","repository":{"id":46050094,"uuid":"226579100","full_name":"michael-doubez/filestat_exporter","owner":"michael-doubez","description":"Prometheus exporter gathering metrics about file size, modification time and other stats","archived":false,"fork":false,"pushed_at":"2025-02-18T20:09:48.000Z","size":136,"stargazers_count":54,"open_issues_count":4,"forks_count":13,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-02-18T21:24:01.423Z","etag":null,"topics":["file-hash","file-modification-time","file-monitoring","file-size","line-counter","prometheus-exporter"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/michael-doubez.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-12-07T21:36:08.000Z","updated_at":"2025-02-18T20:09:43.000Z","dependencies_parsed_at":"2024-06-19T00:15:09.176Z","dependency_job_id":"c4d3cbdd-277d-4ee2-8065-300cba2db0ec","html_url":"https://github.com/michael-doubez/filestat_exporter","commit_stats":null,"previous_names":[],"tags_count":19,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/michael-doubez%2Ffilestat_exporter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/michael-doubez%2Ffilestat_exporter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/michael-doubez%2Ffilestat_exporter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/michael-doubez%2Ffilestat_exporter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/michael-doubez","download_url":"https://codeload.github.com/michael-doubez/filestat_exporter/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247478112,"owners_count":20945256,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["file-hash","file-modification-time","file-monitoring","file-size","line-counter","prometheus-exporter"],"created_at":"2024-08-01T15:02:25.173Z","updated_at":"2026-01-12T06:38:19.859Z","avatar_url":"https://github.com/michael-doubez.png","language":"Go","funding_links":[],"categories":["Go"],"sub_categories":[],"readme":"# File statistics exporter\n\n[![CircleCI](https://circleci.com/gh/michael-doubez/filestat_exporter/tree/master.svg?style=shield)][circleci]\n[![Docker Pulls](https://img.shields.io/docker/pulls/mdoubez/filestat_exporter.svg?maxAge=604800)][dockerhub]\n[![GitHub All Releases](https://img.shields.io/github/downloads/michael-doubez/filestat_exporter/total)][releases]\n[![Go Report Card](https://goreportcard.com/badge/github.com/michael-doubez/filestat_exporter)][goreportcard]\n\nPrometheus exporter gathering metrics about file size, modification time and other statistics.\n\n## Quickstart\n\nPre-built binaries are available on the [GitHub release page][releases].\n\n### Usage\n\nConfigure target files on command line, passing glob patterns in parameters\n\n    ./filestat_exporter '*'\n\nOptional flags:\n* __`-config.file \u003cyaml\u003e`:__ The path to the configuration file (use \"none\" to disable).\n* __`-debug`:__ Activate debug mode which forces log level to debug and enables pprof.\n* __`-log.level \u003clevel\u003e`:__ Logging level \\[debug, info, warn, error\\]. (default: `info`)\n* __`-version`:__ Print the version of the exporter and exit.\n* __`-web.listen-address \u003cport\u003e`:__ Address to listen on for web interface and telemetry. (default: `9943`)\n* __`-web.telemetry-path \u003cURL path\u003e`:__ Path under which to expose metrics. (default: `/metrics`)\n* __`-web.config \u003cweb file\u003e`:__ Path to config yaml file that can enable TLS or authentication.\n* __`-web.systemd-socket`:__ Flag to use systemd socket activation listeners instead of port listeners (Linux only).\n* __`-path.cwd \u003cpath\u003e`:__ Change working directory of path pattern collection.\n* __`-tree.name \u003cname\u003e`:__ Change default tree name used as `tree` label in metrics\n* __`-tree.root \u003cpath\u003e`:__ Chnage default root path of files\n* __`-metric.crc32`:__ Generate CRC32 hash metric of files.\n* __`-metric.nb_lines`:__ Generate line number metric of files.\n\nThe exporter can read a config file in yaml format (`filestat.yaml` by default).\n\n```yaml\nexporter:\n  # Optional working directory - overridden by parameter '-path.cwd'\n  working_directory: \"/path/to/my/project\"\n  # Optional network parameters\n  listen_address: ':9943'\n  #metrics_path: /metrics\n  \n  # Optional working directory - overridden by parameter '-path.cwd'\n  working_directory: \"/path/to/my/project\"\n  # Optional default tree name and root path - overridden by parameter '-root.name' and '-root.path'\n  #tree_name: \"\"\n  #tree_root: \"\"\n\n  # Default enable/disable of metrics - overridden if not set by parameter '-metric.*'\n  enable_crc32_metric: true\n  # enable_nb_line_metric: false\n  # list of patterns to apply - metrics can be enable/disabled for each group\n  files:\n    - patterns: [\"*.html\",\"assets/*.css\",\"scripts/*.js\"]\n    - patterns: [\"data/*.csv\"]\n      enable_nb_line_metric: true\n    - patterns: [\"archives/*.tar.gz\"]\n      enable_crc32_metric: false\n      enable_nb_line_metric: false\n\n  # other trees\n  trees: []\n```\n\nNotes:\n\n  - if a file is matched by a pattern more than once, only the first match's config is used\n  - if no tree name is defined, the label is not used\n\n### Pattern format\n\nPattern uses the glob implementation of [bmatcuk/doublestar](https://github.com/bmatcuk/doublestar#patterns) project:\n* Doublestar (`**`) can be used to match directories recursively. It should appear surrounded by path separators such as `/**/`.\n* Usual [Glob syntax](https://en.wikipedia.org/wiki/Glob_(programming)#Syntax) is still supported.\n\nPattern can also use golang template format with the following functions:\n\n| Function | Description                                  | Example                       |\n|----------|----------------------------------------------|-------------------------------|\n| now      | Current [time](https://pkg.go.dev/time#Time) | `{{ now.Locale.Year }}/*.tgz` |\n| add      | Add two int together                         | `{{ add 1 1 }}`               |\n| sub      | Subtracts two int together                   | `{{ sub 1 1 }}`               |\n| addMonth | Add int to time.Month                        | `{{ addMonth now.Month 1 }}`  |\n| subMonth | Subtract int from time.Month                 | `{{ subMonth now.Month 1 }}`  |\n\n### Trees\n\nTrees extract files' statistics relatively to a tree root.\nIf tree root is empty, it is not applied. The name of the\ntree is used for scoping the metrics.\n\nIf defined, the tree root must exists. It can be templated but usual patterns are not used.\n\n```yaml\n- tree_name: name of tree   # optional\n  tree_root: path/to/tree/  # optional\n  #enable_*_metric: true|false # default for tree\n  files: [] # as usual\n```\n\n\n### Exported Metrics\n\n| Metric                         | Description                                  | Labels             |\n| ------------------------------ | -------------------------------------------- | ------------------ |\n| `file_glob_match_number`       | Number of files matching pattern             | `tree`, `pattern`  |\n| `file_stat_size_bytes`         | Size of file in bytes                        | `tree`, `path`     |\n| `file_stat_modif_time_seconds` | Last modification time of file in epoch time | `tree`, `path`     |\n| `file_content_hash_crc32`  (*) | CRC32 hash of file content                   | `tree`, `path`     |\n| `file_content_line_number` (*) | Number of lines in file                      | `tree`, `path`     |\n\nNote: metrics with `(*)` are only provided if configured\n\n\n## Building and running\n\nPrerequisites:\n\n* [Go compiler](https://golang.org/dl/) - currently version v1.22\n* Linux with make installed\n* Essential build environment for dependencies\n\n### Building\n\n    go get github.com/michael-doubez/filestat_exporter\n    cd ${GOPATH-$HOME/go}/src/github.com/michael-doubez/filestat_exporter\n    make\n    ./filestat_exporter \u003cflags\u003e \u003cfile glob patterns ...\u003e\n\nTo see all available configuration flags:\n\n    ./filestat_exporter -h\n\nThe Makefile provides several targets:\n* `make check`: Running checks and tests\n* `make run`: Run exporter from go\n* `make version`: Print current version\n* `make build`: Build exporter without checks\n\n### Cross compiled distribution\n\nTo build all distribustion packages\n\n    make dist\n\nTo build a specific os/architecture package\n\n    make dist-\u003cos\u003e-\u003carchi\u003e\n    make dist-linux-amd64\n    ...\n\n## Using Docker\nThe `filestat_exporter` is designed to monitor files on the host system.\n\nTry it out in minutes on [Katakoda docker playground][dockerplay]:\n```bash\n\n# create local file\ndocker container run --rm -d -v ~/my_files:/my_files --name my_files bash -c 'echo \"Hello world\" \u003e /my_files/sample.txt'\n# launch exporter watching the files\ndocker run -d -p 9943:9943 --name=filestats -v ~/my_files:/data mdoubez/filestat_exporter -path.cwd /data '*'\n# see file metrics\ncurl -s docker:9943/metrics | grep file_\n```\n\n## TLS and basic authentication\n\nFilestat Exporter supports TLS and basic authentication. This enables better\ncontrol of the various HTTP endpoints.\n\nTo use TLS and/or basic authentication, you need to pass a configuration file\nusing the `--web.config.file` parameter. The format of the file is described\n[in the exporter-toolkit repository](https://github.com/prometheus/exporter-toolkit/blob/master/docs/web-configuration.md).\n\n\n## License\n\nApache License 2.0, see [LICENSE](https://github.com/michael-doubez/filestat_exporter/blob/master/LICENSE).\n\n\n[circleci]: https://circleci.com/gh/michael-doubez/filestat_exporter\n[dockerhub]: https://hub.docker.com/r/mdoubez/filestat_exporter/\n[goreportcard]: https://goreportcard.com/report/github.com/michael-doubez/filestat_exporter\n[dockerplay]: https://www.katacoda.com/courses/docker/playground\n[releases]: https://github.com/michael-doubez/filestat_exporter/releases\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmichael-doubez%2Ffilestat_exporter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmichael-doubez%2Ffilestat_exporter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmichael-doubez%2Ffilestat_exporter/lists"}