Skip to content

Instantly share code, notes, and snippets.

@bennlee
Last active April 18, 2024 14:49
Show Gist options
  • Star 10 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save bennlee/92ffaa27eea326da46e538a80c3eebae to your computer and use it in GitHub Desktop.
Save bennlee/92ffaa27eea326da46e538a80c3eebae to your computer and use it in GitHub Desktop.
What does the double asterisk(**) mean in the path?

What does the double asterisk(**) mean in the path?

There's two meaning of wildcards in paths for file collections.

  • * is a simple, non-recursive wildcard representing zero or more characters which you can use for paths and file names.
  • ** is a recursive wildcard which can only be used with paths, not file names.

For examples,

  • /var/log/** will match all files in /var/log and all files in all child directories, recursively.
  • /var/log/**/*.log will match all files whose names end in .log in /var/log and all files in all child directories, recursively.
  • /home/*/.bashrc will match all .bashrc files in all user's home directories.
  • /home/*/.ssh/**/*.key will match all files ending in .key in all user's .ssh directories in all user's home directories.

Reference

@kyung-lee-official
Copy link

👍

@jonyfSaiflow
Copy link

👍

@andrewrotherham
Copy link

Hi, sorry for this but what is the difference between path: /* and path: / ? What does he one without the asterisk not include?

@bennlee
Copy link
Author

bennlee commented Nov 24, 2022

@andrewrotherham

Hi, sorry for this but what is the difference between path: /* and path: / ? What does he one without the asterisk not include?

path: /* means all directories and files under path: /, while path: / simply means the path: directory itself.

@andrewrotherham
Copy link

@bennlee thankyou for your respectful reply

@rajatrj16
Copy link

I want to set a path for below example
path: "apps/indexing-search/microservice1/overlays/aws/eu-west-1/dev/appconfig.yaml"

Similar to below so that microservice1/..n/ will come dynamically and region/env come as dynamically.
Similar to this but i saw multiple ** can not be added in the single path so how can i create it.
- path: "apps/indexing-search/**/eu-west-1/**/appconfig.yaml"

@bennlee
Copy link
Author

bennlee commented Apr 18, 2024

@rajatrj16
You can use multiple ** in a single path. Is there a problem with the given example path?

@rajatrj16
Copy link

@rajatrj16 You can use multiple ** in a single path. Is there a problem with the given example path?

yeah It did not worked as mentioned here Multiple recursive expressions within the path are not supported.
But I was able to move ahead for my scenario using - path: "apps/indexing-search/**/eu-west-1/*/appconfig.yaml" #(Single *)
but afraid what if there were multiple hierarchies it could not have worked.

@bennlee
Copy link
Author

bennlee commented Apr 18, 2024

@rajatrj16
Oh, I see. It doesn't seem to be supported by sumologic.
(I'll also fix the text. Thank you for your correction.)

As you said in the above case, I think we should consider reducing the dynamic depth on the structure level or distributing the collector to the per dynamic depth.
This way could also reduces the searching load, so I think it would be better to consider it as an alternative.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment