@misterhuydo/sentinel 1.0.38 → 1.0.40

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/.cairn/.hint-lock CHANGED
@@ -1 +1 @@
1
- 2026-03-21T21:21:51.189Z
1
+ 2026-03-21T21:53:40.473Z
@@ -1,6 +1,6 @@
1
1
  {
2
- "message": "Auto-checkpoint at 2026-03-21T21:47:03.629Z",
3
- "checkpoint_at": "2026-03-21T21:47:03.630Z",
2
+ "message": "Auto-checkpoint at 2026-03-21T21:55:49.215Z",
3
+ "checkpoint_at": "2026-03-21T21:55:49.216Z",
4
4
  "active_files": [],
5
5
  "notes": [],
6
6
  "mtime_snapshot": {}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@misterhuydo/sentinel",
3
- "version": "1.0.38",
3
+ "version": "1.0.40",
4
4
  "description": "Sentinel — Autonomous DevOps Agent installer and manager",
5
5
  "bin": {
6
6
  "sentinel": "./bin/sentinel.js"
@@ -4,22 +4,24 @@
4
4
  # Usage:
5
5
  # ./fetch_log.sh # reads all *.properties in script dir
6
6
  # ./fetch_log.sh SSOLWA.properties # specific file(s)
7
- # ./fetch_log.sh SSOLWA.properties UAS.properties
8
7
  # ./fetch_log.sh /path/to/SSOLWA.properties, /path/to/UAS.properties
9
8
  #
10
- # Properties file format:
11
- # KEY=/path/to/ssh.pem (required)
12
- # HOSTS=host1, ec2-user@host2, host3 (required, default user: ec2-user)
13
- # LOGS=logs/app.log, logs/alarm.log (required, backslash or forward slash)
14
- # REMOTE_SERVICE_USER=MyService (optional, defaults to properties filename)
15
- # OUTPUT_DIR=/path/to/output (optional, defaults to script dir)
16
- # TAIL=200 (optional, tail -n N)
17
- # HEAD=100 (optional, head -n N; ignored if TAIL set)
18
- # GREP_FILTER=WARN|ERROR (optional, grep -E filter)
19
- # GREP_EXCLUDE=SSLTool|CommandValidate (optional, grep -iv exclude)
9
+ # Required properties:
10
+ # KEY=<pem file> — filename resolved from config dir, then ~/.ssh/
11
+ # HOSTS=host1, host2
12
+ # LOGS=logs/app.log, logs/alarm.log
13
+ #
14
+ # Optional properties (override defaults):
15
+ # REMOTE_SERVICE_USER=MyService (defaults to properties filename stem)
16
+ # OUTPUT_DIR=/path/to/output (defaults to script dir)
17
+ # TAIL=N (default: 1000)
18
+ # GREP_FILTER=regex (default: WARN|ERROR|FATAL|Exception|Error)
19
+ # GREP_EXCLUDE=regex (default: none)
20
20
 
21
21
  SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
22
22
  DEFAULT_SSH_USER="ec2-user"
23
+ DEFAULT_TAIL=1000
24
+ DEFAULT_GREP_FILTER="WARN|ERROR|FATAL|Exception|Error"
23
25
 
24
26
  show_help() {
25
27
  cat << 'EOF'
@@ -28,41 +30,23 @@ fetch_log.sh — Generic SSH log fetcher
28
30
  USAGE
29
31
  ./fetch_log.sh Read all *.properties in script dir
30
32
  ./fetch_log.sh FILE.properties ... One or more properties files
31
- ./fetch_log.sh /path/A.properties, /path/B.properties
32
33
 
33
34
  OUTPUT
34
35
  OUTPUT_DIR/<ServiceName>/<logname>-<node>.log
35
- e.g. SSOLWA/INN-SSOLWA-1.log, SSOLWA/INN-SSOLWA-2.log
36
- UAS/UserAdminService-1.log
37
36
 
38
37
  PROPERTIES FILE FORMAT
39
38
  Required:
40
- KEY=/path/to/ssh.pem
41
- HOSTS=host1, ec2-user@host2, host3
39
+ KEY=my-service.pem Resolved from config dir, then ~/.ssh/
40
+ HOSTS=host1, ec2-user@host2
42
41
  LOGS=logs/app.log, logs/alarm.log
43
42
 
44
- Optional:
45
- REMOTE_SERVICE_USER=MyService Defaults to properties filename.
46
- Log path resolves to /home/<REMOTE_SERVICE_USER>/<LOGS>
43
+ Optional (Sentinel manages these automatically):
44
+ REMOTE_SERVICE_USER=MyService Defaults to properties filename stem
47
45
  OUTPUT_DIR=/path/to/output Defaults to script directory
48
- TAIL=200 Fetch last N lines (tail -n N)
49
- HEAD=100 Fetch first N lines (head -n N); ignored if TAIL set
50
- GREP_FILTER=WARN|ERROR Keep only matching lines (grep -E)
51
- GREP_EXCLUDE=SSLTool|hystrix Exclude matching lines (grep -iv)
52
-
53
- Notes:
54
- - HOSTS without user@ prefix default to ec2-user@<host>
55
- - LOGS paths support both backslash and forward slash
56
- - Lines starting with # are treated as comments
57
-
58
- EXAMPLE (SSOLWA.properties)
59
- KEY=/home/huy/.ssh/prod/sso-lwa.pem
60
- HOSTS=ec2-1.eu-north-1.compute.amazonaws.com, ec2-2.eu-north-1.compute.amazonaws.com
61
- LOGS=logs/INN-SSOLWA.log, logs/alarm.log
62
- REMOTE_SERVICE_USER=SSOLoginWebApp
63
- GREP_FILTER=WARN|ERROR
64
- GREP_EXCLUDE=SSLTool|CommandValidate
65
- TAIL=200
46
+ TAIL=1000 Lines to fetch (default: 1000)
47
+ GREP_FILTER=WARN|ERROR|FATAL Lines to keep (default: WARN|ERROR|FATAL|Exception|Error)
48
+ Set to "none" to fetch all lines unfiltered
49
+ GREP_EXCLUDE=regex Lines to drop (default: none)
66
50
  EOF
67
51
  }
68
52
 
@@ -122,6 +106,14 @@ fetch_from_properties() {
122
106
  fi
123
107
  fi
124
108
 
109
+ # Apply defaults for fetch parameters
110
+ TAIL="${TAIL:-$DEFAULT_TAIL}"
111
+ if [[ -z "$GREP_FILTER" ]]; then
112
+ GREP_FILTER="$DEFAULT_GREP_FILTER"
113
+ elif [[ "$GREP_FILTER" == "none" || "$GREP_FILTER" == "*" ]]; then
114
+ GREP_FILTER=""
115
+ fi
116
+
125
117
  local SERVICE_NAME
126
118
  SERVICE_NAME="$(basename "$props_file" .properties)"
127
119
  REMOTE_SERVICE_USER="${REMOTE_SERVICE_USER:-$SERVICE_NAME}"