Skip to content

Commit 695290e

Browse files
committed
chg: [template] more stats
1 parent 31b255f commit 695290e

File tree

1 file changed

+28
-10
lines changed

1 file changed

+28
-10
lines changed

logparser/sshd.go

Lines changed: 28 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -332,22 +332,39 @@ func (s *SshdParser) Compile() error {
332332
</style>
333333
</head>
334334
<body onload="loadImage({{.Current}}, currentType)">
335+
335336
<span>
336337
<label for="statsday">Statistics for: </label>
337338
<input id="statsday" type="date" value="{{.MaxDate}}" min="{{.MinDate}}" max="{{.MaxDate}}" onchange="currentDay = this.value.replace(/-/g, ''); loadImage(currentDay, currentType)"/>
338-
<select>
339-
{{range .YearList}}
340-
<option value="{{.}}">{{.}}</option>
339+
</span>
340+
341+
<span>
342+
<select>
343+
<option selected value>year</option>
344+
{{range $val := .YearList}}
345+
<option value="{{$val}}">{{$val}}</option>
341346
{{end}}
342-
</select>
347+
</select>
343348
</span>
349+
350+
<span>
351+
<select>
352+
<option selected value>month</option>
353+
{{range $key, $val := .MonthList}}
354+
{{range $month := index $val}}
355+
<option value="{{$month}}">{{$month}}</option>
356+
{{end}}
357+
{{end}}
358+
</select>
359+
</span>
360+
344361
<span>
345-
<label for="statstype">Type: </label>
346-
<select selected="statsusername" onchange="currentType = this.value; loadImage(currentDay.replace(/-/g, ''), currentType)">
347-
<option value="statsusername">Usernames</option>
348-
<option value="statssrc">Sources</option>
349-
<option value="statshost">Hosts</option>
350-
</select>
362+
<label for="statstype">Type: </label>
363+
<select selected="statsusername" onchange="currentType = this.value; loadImage(currentDay.replace(/-/g, ''), currentType)">
364+
<option value="statsusername">Usernames</option>
365+
<option value="statssrc">Sources</option>
366+
<option value="statshost">Hosts</option>
367+
</select>
351368
</span>
352369
<div id="imageholder"></div>
353370
</body>
@@ -448,6 +465,7 @@ func (s *SshdParser) Compile() error {
448465
YearList: years,
449466
MonthList: months,
450467
}
468+
_ = os.Remove("statistics.html")
451469
f, err := os.OpenFile("statistics.html", os.O_RDWR|os.O_CREATE, 0666)
452470
defer f.Close()
453471
err = t.Execute(f, data)

0 commit comments

Comments
 (0)