fix hardward addr bug
This commit is contained in:
parent
d6024cf64c
commit
eebd6500f3
@ -80,7 +80,7 @@ func (el *esLogger) WriteMsg(when time.Time, msg string, level int, lable string
|
|||||||
vals["hostname"] = GetHostname()
|
vals["hostname"] = GetHostname()
|
||||||
vals["working_idr"] = Getwd()
|
vals["working_idr"] = Getwd()
|
||||||
vals["home_dir"] = GetUserHomename()
|
vals["home_dir"] = GetUserHomename()
|
||||||
vals["hardware_addr"] = GetCurrentInterface().HardwareAddr
|
vals["hardware_addr"] = GetCurrentInterfaceHardwareAddr()
|
||||||
vals["client_addrs"] = GetCurrentInterfaceAddrs()
|
vals["client_addrs"] = GetCurrentInterfaceAddrs()
|
||||||
|
|
||||||
if el.IndexName == "" {
|
if el.IndexName == "" {
|
||||||
|
@ -15,6 +15,13 @@ func GetCurrentInterface() *net.Interface {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func GetCurrentInterfaceHardwareAddr() string {
|
||||||
|
if inter := GetCurrentInterface(); inter != nil {
|
||||||
|
return fmt.Sprintf("%s", inter.HardwareAddr)
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
func GetCurrentInterfaceAddrs() string {
|
func GetCurrentInterfaceAddrs() string {
|
||||||
if inter := GetCurrentInterface(); inter != nil {
|
if inter := GetCurrentInterface(); inter != nil {
|
||||||
if addrs, err := inter.Addrs(); err == nil {
|
if addrs, err := inter.Addrs(); err == nil {
|
||||||
|
Loading…
Reference in New Issue
Block a user