Skip to content

Commit

Permalink
Set log path to root-dir when calling osquery (fleetdm#4237)
Browse files Browse the repository at this point in the history
* Set log path to root-dir when calling osquery

* Update based on review and set filesystem,tls as logging plugin
  • Loading branch information
chiiph authored Feb 17, 2022
1 parent 17bbd47 commit fee7fae
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 1 deletion.
6 changes: 6 additions & 0 deletions orbit/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,12 @@ Press Enter to continue, or Control-c to exit.
[...]
```

If you want to run orbit from source directly, you can do the following:

```sh
go run github.com/fleetdm/fleet/v4/orbit/cmd/orbit --root-dir /tmp/orbit -- --flagfile=flagfile.txt --verbose
```

### Troubleshooting

#### Logs
Expand Down
1 change: 1 addition & 0 deletions orbit/changes/issue-4146-orbit-osquery-logpath
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* Set log path for osquery when launching it
2 changes: 2 additions & 0 deletions orbit/cmd/orbit/orbit.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (
"io/ioutil"
"net/url"
"os"
"path"
"path/filepath"
"runtime"
"strings"
Expand Down Expand Up @@ -228,6 +229,7 @@ func main() {

var options []func(*osquery.Runner) error
options = append(options, osquery.WithDataPath(c.String("root-dir")))
options = append(options, osquery.WithLogPath(path.Join(c.String("root-dir"), "osquery_log")))

if logFile != nil {
// If set, redirect osqueryd's stderr to the logFile.
Expand Down
2 changes: 1 addition & 1 deletion orbit/pkg/osquery/flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ func FleetFlags(fleetURL *url.URL) []string {
"--distributed_tls_max_attempts=10",
"--distributed_tls_read_endpoint=" + path.Join(prefix, "/api/v1/osquery/distributed/read"),
"--distributed_tls_write_endpoint=" + path.Join(prefix, "/api/v1/osquery/distributed/write"),
"--logger_plugin=tls",
"--logger_plugin=tls,filesystem",
"--logger_tls_endpoint=" + path.Join(prefix, "/api/v1/osquery/log"),
"--disable_carver=false",
// carver_disable_function is separate from disable_carver as it controls the use of file
Expand Down

0 comments on commit fee7fae

Please sign in to comment.