Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
267 views
in Technique[技术] by (71.8m points)

sumologic - In Sumo Logic, how do I get a list of folders off the root folder?

Using the Sumo Logic API, /api/v2/content/folders/{id} works and gives me the parentId. hitting the same endpoint for a folder off the root folder gives a parentId. however hitting the same endpoint with that id errors with "Content with the given ID does not exist."

When I hit /api/v2/folders/global it returns an id. every time I hit the endpoint it gives me a different id. trying to use any of those ids at /api/v2/content/folders/{id} also gives the error "Content with the given ID does not exist."

I'm trying to write a script that will return the Sumo Logic ID of a folder from a user-defined path. e.g. get_sumo_id -p "/products/someapp/monitoring"

question from:https://stackoverflow.com/questions/65832802/in-sumo-logic-how-do-i-get-a-list-of-folders-off-the-root-folder

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

Figured it out. I hadn’t read the docs well enough. The id returned from /api/v2/folders/global is a job id, not a folder id. You wait until it's done and check for success using /api/v2/folders/global/<job id>/status. if successful you can retrieve /api/v2/folders/global/<job id>/result.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...