Skip to content

Commit 4853ea2

Browse files
authored
Add more Insights (#3)
* add more insights * update Readme.md
1 parent 7032307 commit 4853ea2

10 files changed

+630
-275
lines changed

README.md

+7-2
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,20 @@ Analog is a powerful tool designed for analyzing and visualizing log files. It p
44

55
## Features
66

7-
- **Top Logs**: Quickly identify and analyze the most frequently occurring log entries.
7+
- **Summary View**: Quickly gain insights into your log file with the Summary View. It provides frequencies of the following key aspects:
8+
9+
- Top Logs
10+
- HTTP Codes
11+
- Jobs
12+
- Plugins
813

914
- **Filter Logs**:
1015

1116
- **Filter by Timestamp**: Specify a start and end timestamp to narrow down your log analysis.
1217
- **Regex Search**: Perform regular expression searches to find specific log entries.
1318
- **Search Combinations**: Perform normal searches with advanced combination of `Contains/Not Contains` and `AND/OR` operators.
14-
- **Top Logs**: Select entries in the Top Logs to view all the related logs together.
1519
- **Errors Only**: Isolate and focus on error log entries.
20+
- **Summary View**: Filter on any of the key aspect of the Summary View.
1621

1722
- **Logs Context**: Even when a filter is applied, you can access the context around the current log entry.
1823

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
"test": "vitest --silent",
1414
"test-logs": "vitest",
1515
"coverage": "vitest run --coverage --silent",
16-
"build": "vite build && cp analog.sh analog && cp analog.bat analog && zip -r analog.zip analog",
16+
"build": "vite build && cp analog.sh analog && cp analog.ps1 analog && zip -r analog.zip analog",
1717
"preview": "vite preview"
1818
},
1919
"license": "MIT",

src/components/filters/index.tsx

+94-48
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,11 @@ import {
77
Switch,
88
TextField,
99
} from "@suid/material";
10-
import useViewModel, { SearchTerm, FiltersProps } from "./useViewModel";
10+
import useViewModel, {
11+
SearchTerm,
12+
FiltersProps,
13+
GridsRefs,
14+
} from "./useViewModel";
1115
import { AgGridSolidRef } from "ag-grid-solid";
1216
import { GridOptions } from "ag-grid-community";
1317
import { Accessor, For, Show } from "solid-js";
@@ -26,14 +30,31 @@ const texts = {
2630
notContains: "Not Contains",
2731
};
2832

33+
interface GridsOptions {
34+
msgs: GridOptions<GroupedMsg>;
35+
httpCodes: GridOptions<GroupedMsg>;
36+
jobs: GridOptions<GroupedMsg>;
37+
plugins: GridOptions<GroupedMsg>;
38+
added: GridOptions<GroupedMsg>;
39+
removed: GridOptions<GroupedMsg>;
40+
}
41+
2942
function Filters(props: FiltersProps) {
30-
let topLogsGridRef = {} as AgGridSolidRef;
31-
let addedLogsGridRef = {} as AgGridSolidRef;
32-
let removedLogsGridRef = {} as AgGridSolidRef;
43+
const gridsRefs: GridsRefs = {
44+
msgs: {} as AgGridSolidRef,
45+
httpCodes: {} as AgGridSolidRef,
46+
jobs: {} as AgGridSolidRef,
47+
plugins: {} as AgGridSolidRef,
48+
added: {} as AgGridSolidRef,
49+
removed: {} as AgGridSolidRef,
50+
};
3351

34-
let {
52+
const {
3553
filters,
36-
topLogs,
54+
msgs,
55+
httpCodes,
56+
jobs,
57+
plugins,
3758
addedLogs,
3859
removedLogs,
3960
setFilters,
@@ -63,30 +84,34 @@ function Filters(props: FiltersProps) {
6384
],
6485
rowSelection: "multiple",
6586
suppressRowClickSelection: true,
66-
onSelectionChanged: handleLogsSelectionChanged,
87+
onSelectionChanged: () => handleLogsSelectionChanged(gridsRefs),
6788
getRowStyle: (params) =>
6889
params.data?.hasErrors ? { background: "#FFBFBF" } : undefined,
6990
};
7091

71-
const topLogsGridOptions: GridOptions<GroupedMsg> = {
72-
...commonGridOptions,
73-
rowData: topLogs(),
74-
};
75-
76-
const addedLogsGridOptions: GridOptions<GroupedMsg> = {
77-
...commonGridOptions,
78-
rowData: addedLogs(),
79-
};
80-
81-
const removedLogsGridOptions: GridOptions<GroupedMsg> = {
82-
...commonGridOptions,
83-
rowData: removedLogs(),
84-
columnDefs: [
85-
{ ...commonGridOptions.columnDefs![0], checkboxSelection: undefined },
86-
{ ...commonGridOptions.columnDefs![1] },
87-
],
88-
rowSelection: undefined,
89-
onSelectionChanged: undefined,
92+
const gridsOptions: GridsOptions = {
93+
msgs: { ...commonGridOptions, rowData: msgs() },
94+
jobs: { ...commonGridOptions, rowData: jobs() },
95+
plugins: { ...commonGridOptions, rowData: plugins() },
96+
added: { ...commonGridOptions, rowData: addedLogs() },
97+
httpCodes: {
98+
...commonGridOptions,
99+
rowData: httpCodes(),
100+
columnDefs: [
101+
{ ...commonGridOptions.columnDefs![0], flex: 1 },
102+
{ ...commonGridOptions.columnDefs![1], flex: 1 },
103+
],
104+
},
105+
removed: {
106+
...commonGridOptions,
107+
rowData: removedLogs(),
108+
columnDefs: [
109+
{ ...commonGridOptions.columnDefs![0], checkboxSelection: undefined },
110+
{ ...commonGridOptions.columnDefs![1] },
111+
],
112+
rowSelection: undefined,
113+
onSelectionChanged: undefined,
114+
},
90115
};
91116

92117
function handleEnterKey(e: KeyboardEvent) {
@@ -113,7 +138,7 @@ function Filters(props: FiltersProps) {
113138
}
114139
/>
115140
<TextField
116-
label="value"
141+
label="text"
117142
value={term.value}
118143
onChange={(_, val) => setFilters("terms", i(), "value", val)}
119144
onKeyDown={handleEnterKey}
@@ -164,7 +189,7 @@ function Filters(props: FiltersProps) {
164189
<Divider orientation="vertical" flexItem></Divider>
165190
<Button
166191
variant="outlined"
167-
onClick={() => handleResetClick(topLogsGridRef, addedLogsGridRef)}
192+
onClick={() => handleResetClick(gridsRefs)}
168193
>
169194
Reset
170195
</Button>
@@ -185,30 +210,51 @@ function Filters(props: FiltersProps) {
185210
<Grid item xs={12} container spacing={2}>
186211
<Grid item xs={4}>
187212
<GroupedMsgGrid
188-
ref={topLogsGridRef}
213+
ref={gridsRefs.msgs}
189214
name="Top Logs"
190-
options={topLogsGridOptions}
215+
options={gridsOptions.msgs}
216+
></GroupedMsgGrid>
217+
</Grid>
218+
<Grid item xs={2}>
219+
<GroupedMsgGrid
220+
ref={gridsRefs.httpCodes}
221+
name="HTTP Codes"
222+
options={gridsOptions.httpCodes}
223+
></GroupedMsgGrid>
224+
</Grid>
225+
<Grid item xs={3}>
226+
<GroupedMsgGrid
227+
ref={gridsRefs.jobs}
228+
name="Jobs"
229+
options={gridsOptions.jobs}
230+
></GroupedMsgGrid>
231+
</Grid>
232+
<Grid item xs={3}>
233+
<GroupedMsgGrid
234+
ref={gridsRefs.plugins}
235+
name="Plugins"
236+
options={gridsOptions.plugins}
191237
></GroupedMsgGrid>
192238
</Grid>
193-
<Show when={comparer.isOn()}>
194-
<Grid item xs={8} container spacing={2}>
195-
<Grid item xs={6}>
196-
<GroupedMsgGrid
197-
ref={addedLogsGridRef}
198-
name="Added Logs"
199-
options={addedLogsGridOptions}
200-
></GroupedMsgGrid>
201-
</Grid>
202-
<Grid item xs={6}>
203-
<GroupedMsgGrid
204-
ref={removedLogsGridRef}
205-
name="Removed Logs"
206-
options={removedLogsGridOptions}
207-
></GroupedMsgGrid>
208-
</Grid>
209-
</Grid>
210-
</Show>
211239
</Grid>
240+
<Show when={comparer.isOn()}>
241+
<Grid item xs={12} container spacing={2}>
242+
<Grid item xs={6}>
243+
<GroupedMsgGrid
244+
ref={gridsRefs.added}
245+
name="Added Logs"
246+
options={gridsOptions.added}
247+
></GroupedMsgGrid>
248+
</Grid>
249+
<Grid item xs={6}>
250+
<GroupedMsgGrid
251+
ref={gridsRefs.removed}
252+
name="Removed Logs"
253+
options={gridsOptions.removed}
254+
></GroupedMsgGrid>
255+
</Grid>
256+
</Grid>
257+
</Show>
212258
</Grid>
213259
);
214260
}

0 commit comments

Comments
 (0)