How to export Event log

Hello

i have question about event logs

  1. How to export Event log to csv or text file
  2. Router support sent event log to FTP Server or sent a log via http or mqtt?
  1. Currently there is no nice way to do this. Although you can use API to get this in JSON (e.g using CLI command api get /events_log/config)
  2. I think that only system logs support this. You can configure it in System > Maintenance > Troubleshoot: External system log servers
1 Like

Hello,
Hello! I can help you with that. Here are the steps to export event logs to a CSV or text file, and how to send event logs from a router to an FTP server or via HTTP/MQTT.

Export Event Logs to CSV or Text File
Using PowerShell (Windows)
You can use PowerShell to export event logs to a CSV or text file. Here’s an example:

Export to CSV:

powershell
Get-EventLog -LogName Application | Export-Csv -Path “C:\temp\appLogs.csv” -NoTypeInformation
Export to Text:

powershell
Get-EventLog -LogName Application | Format-Table -AutoSize | Out-File “C:\temp\appLogs.txt”
Sending Event Logs to an FTP Server
Example for Huawei Routers
Enable the Information Center:

shell
system-view
sysname RouterA
info-center enable
Configure a Channel and Rule for Outputting Logs:

shell
info-center logfile channel channel6
info-center source ip channel channel6 log level warning
Transfer Log File to FTP Server:

shell
ftp 10.1.1.1

Log in with username and password

put flash:/logfile/log.log
quit
Sending Event Logs via HTTP or MQTT
Using MQTT (Milesight Router Example)
Connect Router to MQTT Broker:

Go to Service > MQTT page to add an SSM Smart Square Com MQTT connection.

Fill in the MQTT broker information and save.

Publish Data:

shell
/iot mqtt brokers add address=broker_address client-id=unique_id
/iot mqtt publish broker=broker_name topic=log_topic message="log_messag
Best Regard,
Nathan

1 Like

Thank you for information