HUB
Sign inSign up

dashbase/dashfs

By dashbase

•Updated about 8 years ago

DashFS

Image
0

888

dashbase/dashfs repository overview

⁠DashFS

Dashfs is a file system view of your logs.

asciicast

⁠RUN

docker run -it --privileged dashbase/dashfs:latest

Dashfs is a program already installed. To show what it does, look at the output of the following commands

(dashfs-0wn5oS2L)root@e66fd0db6ab1:/# ls dashfs/
(dashfs-0wn5oS2L)root@e66fd0db6ab1:/# dashfs /dashfs /usr/src/dashfs/config.yml
(dashfs-0wn5oS2L)root@e66fd0db6ab1:/# ls dashfs/
nginx
(dashfs-0wn5oS2L) root@8619d3d5096b:/# umount dashfs/
(dashfs-0wn5oS2L) root@8619d3d5096b:/# ls dashfs/

Dashfs is a file system view of your logs. The config.yml allows you to create paths based on metadata and filters, so you can work with log files relevant to you.

Dashfs can mount new directories, based on config paths

dashfs {your_mount_dir} {your_config_path}

⁠CONFIG

(dashfs-0wn5oS2L) root@8619d3d5096b:/# cat /usr/src/dashfs/config.yml
cache: /tmp/.dashfscache
refresh_interval: 60 # seconds
# cat_limit: 1000 # the limit of search results to virtually retrieve for the cat cmd.
client:
  token: "internal-token-ec3a99e1b4b121c0810191eca06c5cb1"
  url: "https://staging.dashbase.io:9876"
files:
  # Make any file of results, based on a table, and a query
  # /dashfs/nginx/192.168.1.1/error.log
  - path: /nginx/65.43.243.4/error.log
    table: nginx_json
    query: "host:65.43.243.4 and *error*"
  - path: /nginx/8.98.52.152/error.log
    table: nginx_json
    query: "host:8.98.52.152 and *error*"
  - path: /nginx/empty.log
    table: nginx_json
    query: "host:1.2.3.4 and *error*"


groups:
  # Make a set of files in their respective dirs, based on a TopN search 
  # /dashfs/nginx/{host}/log.log
  - topN:
      col: host
      limit: "30"
    template:
      table: nginx_json
      path: /nginx/{key}/log.log
      query: "host:{key}"

⁠Config file template
⁠SCHEMA
{DASHBASE_FS_CONFIG...}
client:
  	{DASHBASE_SDK_CONFIG...}
files:
	[{FS_FILES_CONFIL...},...]
groups:
	[{FS_GROUPS_CONFIL...},...]

⁠DASHBASE_FS_CONFIG
cache: /your/cache/dir/path # a dir to save dashfs cache.

refresh_interval: 60 # the cache ttl in seconds

# cat_limit: 1000 # the limit of search results to virtually retrieve per file. Can be overridden for any file or template.
⁠DASHBASE_SDK_CONFIG
client:
  token: {your_token}
  url: {your_dashbase_api_url}
⁠FS_FILES_CONFIL
files:
  - path: /nginx/error.log
    table: nginx_json
    query: "*error*"
  - path: /apache/error.log
    table: apache
    query: "*error*"
  - path: {/the/file/path/relative/to/the/mount} [require] [unique]
  	  # Example: 
	  # If you set the path to /a/b/c.log, and mount dashfs to /dashfs,
	  # then the full path to the file is '/dashfs/a/b/c.log'.
    table: {your_dashbase_table} [default: "*"]
    query: {dashbase_query} [default: "*"]
⁠FS_GROUPS_CONFIL

Groups will auto create files by rule [now support Topn]:

groups:
  - topN:
      col: {your dashbase table field} [required]
      table: {dashbase_table} [default: "*"]
      limit: {int}  [default: 10]
    template:
      {FS_FILES_CONFIL}  # with some magic variable

Topn will get a key-count result, groups will get the keys in a list. 
foreach the list to render. by magic variable -> "key"

examples:
groups:
  - topN:
      col: "host"
      table: "nginx"
      limit: 30
    template:
      table: nginx_json
      path: /nginx/{key}/log.log
      query: "host:{key}"
⁠DEV
# install dependecies
pipenv install -e .

# if you are not using pyenv, use `pipenv shell` here to activate the pipenv.

dashfs  /tmp/dashbase  config.yml

Tag summary

Content type

Image

Digest

Size

409.8 MB

Last updated

over 8 years ago

docker pull dashbase/dashfs