Is there a way to control which directory DumpRequest() dumps into?

Open
#4,830 2 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 4 days

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
49/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Active
Tech stack
go, kubernetes

Research direction

Start by reading the AppSec hooks documentation linked in the issue and locating the Go implementation of DumpRequest().ToJSON(). Check whether the dump directory and filename can be configured, and how those options are exposed. Done means the supported controls are documented there, or the request is clarified if implementation changes are needed.

Written by the indexing model from the issue text.

Description

needs/kind needs/triage

Right now, using the crowdsec docker container through the provided helm chart, whenever you use DumpRequest() as described in the docs it dumps a json file in your /tmp directory:

In order to make DumpRequest write your request to a file, you have to call DumpRequest().ToJSON(), which will create a file in the OS temporary directory (eg, /tmp on Linux) with the following format: crowdsec_req_dump_<RANDOM_PART>.json.

I would like to change where that goes, so I can mount a directory where all containers dump their requests, as when running multiple appsec pods, finding which /tmp dir on which pod is a little tedious. Is there a way to change which directory these dumps end up in? If so, can we please have that documented somewhere in the appsec hooks doc I linked?

A final quick question: is there anyway to change the file name? Knowing what request is associated with what alert would be very helpful for troubleshooting.

Thanks so much for any help you can provide!

Kind regards,
Jesse

Dominant language
Go
Stars
15.1k
Forks
726
Avg merge
4d 23h
Merged PRs (30d)
27

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from crowdsecurity/crowdsec

All issues in crowdsecurity/crowdsec

Similar issues

More Go issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.