22 Commits

Author SHA1 Message Date
James Rasell
1ae83114c1 ci: Run hclogvet across all codebase and fix found issue. (#26545) 2025-08-18 15:06:11 +01:00
tehut
21841d3067 Add historical journald and log export flags to operator debug command (#26410)
* Add -log-file-export and -log-lookback commands to add historical log to
debug capture
* use monitor.PrepFile() helper for other historical log tests
2025-08-04 13:55:25 -07:00
tehut
d709accaf5 Add nomad monitor export command (#26178)
* Add MonitorExport command and handlers
* Implement autocomplete
* Require nomad in serviceName
* Fix race in StreamReader.Read
* Add and use framer.Flush() to coordinate function exit
* Add LogFile to client/Server config and read NomadLogPath in rpcHandler instead of HTTPServer
* Parameterize StreamFixed stream size
2025-08-01 10:26:59 -07:00
hashicorp-copywrite[bot]
a9d61ea3fd Update copyright file headers to BUSL-1.1 2023-08-10 17:27:29 -05:00
hashicorp-copywrite[bot]
f005448366 [COMPLIANCE] Add Copyright and License Headers 2023-04-10 15:36:59 +00:00
Seth Hoenig
b242957990 ci: swap ci parallelization for unconstrained gomaxprocs 2022-03-15 12:58:52 -05:00
Seth Hoenig
c1e033c8c6 cleanup: prevent leaks from time.After
This PR replaces use of time.After with a safe helper function
that creates a time.Timer to use instead. The new function returns
both a time.Timer and a Stop function that the caller must handle.

Unlike time.NewTimer, the helper function does not panic if the duration
set is <= 0.
2022-02-02 14:32:26 -06:00
Drew Bailey
03f0aff010 unlock before returning, no need for label
comment, trigger build

return length written
2019-11-05 11:44:29 -05:00
Drew Bailey
8ccb770b00 simplify logch goroutine 2019-11-05 11:44:28 -05:00
Drew Bailey
79411c5e0e coordinate closing of doneCh, use interface to simplify callers
comments
2019-11-05 11:44:26 -05:00
Drew Bailey
33ba36acbd log-json -> json
fix typo command/agent/monitor/monitor.go

Co-Authored-By: Chris Baker <1675087+cgbaker@users.noreply.github.com>

Update command/agent/monitor/monitor.go

Co-Authored-By: Chris Baker <1675087+cgbaker@users.noreply.github.com>

address feedback, lock to prevent send on closed channel

fix lock/unlock for dropped messages
2019-11-05 09:51:59 -05:00
Drew Bailey
4f618eb1e3 simplify assert message 2019-11-05 09:51:56 -05:00
Drew Bailey
676800f03a address feedback 2019-11-05 09:51:56 -05:00
Drew Bailey
8423ccf890 allow more time for streaming message
remove unused struct
2019-11-05 09:51:55 -05:00
Drew Bailey
f74bd99b2a monitor command takes no args
rm extra new line

fix lint errors

return after close

fix, simplify test
2019-11-05 09:51:55 -05:00
Drew Bailey
58117c03c4 fix deadlock issue, switch to frames envelope 2019-11-05 09:51:54 -05:00
Drew Bailey
873969cf41 return 400 if invalid log_json param is given
Addresses feedback around monitor implementation

subselect on stopCh to prevent blocking forever.

Set up a separate goroutine to check every 3 seconds for dropped
messages.

rename returned ch to avoid confusion
2019-11-05 09:51:53 -05:00
Drew Bailey
9bb606a0ae update go-hclog dep
remove duplicate lock
2019-11-05 09:51:52 -05:00
Drew Bailey
92d6a30f86 agent:read acl policy for monitor 2019-11-05 09:51:52 -05:00
Drew Bailey
2362008e74 new hclog with standardlogger intercept 2019-11-05 09:51:49 -05:00
Drew Bailey
e7589301ea enable json formatting, use queryoptions 2019-11-05 09:51:49 -05:00
Drew Bailey
8095b4868a New monitor pkg for shared monitor functionality
Adds new package that can be used by client and server RPC endpoints to
facilitate monitoring based off of a logger

clean up old code

small comment about write

rm old comment about minsize

rename to Monitor

Removes connection logic from monitor command

Keep connection logic in endpoints, use a channel to send results from
monitoring

use new multisink logger and interfaces

small test for dropped messages

update go-hclogger and update sink/intercept logger interfaces
2019-11-05 09:51:49 -05:00