Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
L
logtransfer
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
谢宇轩
logtransfer
Commits
dc02ba53
Commit
dc02ba53
authored
Jan 12, 2022
by
谢宇轩
😅
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改时区为UTC
parent
b20faf95
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
2 deletions
+18
-2
format.go
entity/format.go
+2
-2
alarm.go
plugin/alarm.go
+16
-0
No files found.
entity/format.go
View file @
dc02ba53
...
@@ -28,9 +28,9 @@ func FormatServiceWfLog(sourceKey string, message string) (Matedata, error) {
...
@@ -28,9 +28,9 @@ func FormatServiceWfLog(sourceKey string, message string) (Matedata, error) {
mateItem
.
Level
=
message
[
:
levelIndex
]
mateItem
.
Level
=
message
[
:
levelIndex
]
message
=
message
[
levelIndex
:
]
message
=
message
[
levelIndex
:
]
loc
,
err
:=
time
.
LoadLocation
(
Location
)
loc
,
err
:=
time
.
LoadLocation
(
"UTC"
)
if
err
!=
nil
{
if
err
!=
nil
{
loc
=
time
.
FixedZone
(
"
CST"
,
8
*
360
0
)
loc
=
time
.
FixedZone
(
"
UTC"
,
0
)
}
}
logTime
,
_
:=
time
.
ParseInLocation
(
": 06-01-02 15:04:05 "
,
message
[
:
strings
.
Index
(
message
,
"["
)],
loc
)
logTime
,
_
:=
time
.
ParseInLocation
(
": 06-01-02 15:04:05 "
,
message
[
:
strings
.
Index
(
message
,
"["
)],
loc
)
mateItem
.
create
=
logTime
mateItem
.
create
=
logTime
...
...
plugin/alarm.go
View file @
dc02ba53
...
@@ -3,18 +3,34 @@ package plugin
...
@@ -3,18 +3,34 @@ package plugin
import
(
import
(
"fmt"
"fmt"
"log"
"log"
"time"
"github.com/y7ut/logtransfer/entity"
"github.com/y7ut/logtransfer/entity"
)
)
const
(
Location
=
"Asia/Shanghai"
)
// 打印插件
// 打印插件
type
Dump
Plugin
type
Dump
Plugin
func
(
dump
*
Dump
)
HandleFunc
(
m
*
entity
.
Matedata
)
error
{
func
(
dump
*
Dump
)
HandleFunc
(
m
*
entity
.
Matedata
)
error
{
log
.
Println
(
"DUMP:"
)
log
.
Println
(
"DUMP:"
)
for
k
,
v
:=
range
(
*
m
)
.
Data
{
for
k
,
v
:=
range
(
*
m
)
.
Data
{
if
k
==
"timestamp"
{
loc
,
err
:=
time
.
LoadLocation
(
Location
)
if
err
!=
nil
{
loc
=
time
.
FixedZone
(
"CST"
,
8
*
3600
)
}
v
,
err
=
time
.
ParseInLocation
(
"2006-01-02 15:04:05 "
,
fmt
.
Sprintf
(
"%s"
,
v
),
loc
)
if
err
!=
nil
{
continue
}
}
fmt
.
Printf
(
"%s : %s
\n
"
,
k
,
v
)
fmt
.
Printf
(
"%s : %s
\n
"
,
k
,
v
)
}
}
fmt
.
Println
(
"------------"
)
fmt
.
Println
(
"------------"
)
return
nil
return
nil
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment