How do i view log entries from yesterday

I downloaded the log from my ha root folder but it only contained the last few hours
I need a log from yesterday though

did it clear logs cause I hard rebooted?

the homeassistant.log file gets reset after every HA restart.

But after a restart those logs get transferred to another file called homeassistant.log.1

so you will look there for any logs from the time between the last 2 restarts of HA. If you restart HA in quick succession you won’t have much info in the homeassistant.log.1 file.

1 Like

ty
I just noticed another issue: recent events aren’t included in the log in the first place
it’s just the ones from a narrow time window yesterday, I think right after my reboot

I think that might depend on what you are trying to look for and/or what your log level settings are.

you mean those settings in the config.yaml?

logger:
  logs:
    homeassistant.config: notset
    
system_log: 
  max_entries: 40

How should I change them to be able to see the events from yesterday onwards?

it depends on what you want to see.

if you want to see everything for everything then add:

logger:
  default: debug
  logs:
    homeassistant.config: notset

that will log pretty much everything that happens in the system (that is log-able) but the log will get very large very fast.

If you only want to see the logs from a specific integration then you can set the log level for that integration. Or if you are getting errors that aren’t being recorded then you can set the log level to a more reasonable level (for example ‘error’) instead of debug.

but you keep mentioning that you want to see ‘events’. I don’t think ‘events’ (as it’s defined in HA) will be recorded in the log. Events are things that get set on the event bus and are seen by the system to trigger things (or get triggered by other events).

what ‘events’ do you want to see?

if you really do want to see ‘events’ then you will need to set up the ‘event viewer’ in the dev tools page to listen for the desired events.

Isn’t log level “debug” more detailed than what’s set up by default and would therefore fill the log up faster?
I think I need to know how to actually make the log larger because it seems like the amount of entries it has is limited.

Can I perhaps do that via:

system_log: 
  max_entries: 2000

I thought that I couldn’t because it’s set to 40 right now and the log obviously shows more than 40 entries. So there needs to be another parameter to change that, right?

I don’t know if I want to see “events”. All I know is there’s something happening that causes my system to crash and I need to know what it is.

browse to your config folder and read the homeassistant.log file there.

You’re confusing the limitations of the download button in the UI with the actual size of the file. There is no log size restriction on actual file, the download button only gives you the last X lines.

I can’t right now for some reason. I’ve waited 10 minutes for the log to load and the page has already auto-refreshed. That didn’t happen before. And upon trying to download it I get a “502: Bad Gateway”-error

Install samba share or use an addon like vscode to view the file. I have no idea what you’re using right now, but it’s probably not the best tool for the job. Or download the file using SCP via SSH. You have many options.

That isn’t the log that HA writes to for the stuff happening in HA.

as mentioned above the log you need to be looking at to see HA specific related stuff is the homeassistant.log file found in your configuration directory which is the same directory where configuration.yaml is also found.

It is simply a text file that you read with any text viewer. You can’t access that file from within the HA UI unless you have some way via the UI to access the actual text based yaml config files.

there is no limit to that log file size either. it keeps getting bigger until you restart HA itself. At that point it gets re-initialized to empty and then starts the content over again.

But then the contents of that file gets transferred to another file called homeassistant.log.1 found in the same directory.

If it’s small number of lines and you are seeing it on a “page” that gets “refreshed” then you are definitely not looking in the right place.

Now all of that being said you may actually want to look at the actual system log file created by the OS since you are trying to see why HA is crashing. I’m honestly not sure where that file resides on your OS since I assume you use HA OS. Normally it would be found under the /var/log directory in the root of your OS file system.

I do it via file editor

how do I enable samba? I had it working in a previous installation but can’t find the tutorial on how to do it anymore. SSHing via putty just fails

also, dont you need like a different kind of ssh to download this file? like some developer level modification on HA where the site of its’ tutorial says “you will not get support for this”? because thats what people in another thread where I read abt SSHing for logs weeks ago recommended

It is simply a text file that you read with any text viewer. You can’t access that file from within the HA UI unless you have some way via the UI to access the actual text based yaml config files.

I have File Editor with which I can (theoretically) see and download home-assistant.log so I think I’m seeing the right log. Maybe I didn’t see all of it the first time because of some bug…

I use HA OS

How do I access the root of my OS file system? This pops up upon googling how to access /var/log. I suppose that’s what I’m looking for?
(btw @petro the HAOS (alternative way) section of it was what I was referring to earlier. Will I get any support in this forum upon attempting this?)

You don’t need root accesss, you just need to view your log file for home assistant. You’re being your own worse enemy here. Download and install the vscode addon and view the homeassistant log through that. That will not have any file size viewing restrictions incase your log is huge. Otherwise install the samba share addon which will let you use another computer to do the exact same thing with some other text editor.

viewing/downloading the log via Studio Code Server doesn’t work. It gets stuck on loading just as File Editor but this time my entire HA crashed.


I think this “out of memory” error comes from that considering that my memory is normally barely used

will try out SAMBA now

If you want view it in vscode then you’re having larger issues. The file is either too large or something else is going on. Delete your previous logs and the current log. Restart and see if you can watch the log size with a file size watcher integration.

which integration can do that?

dang I tried adding “File Size” by clicking on the “add to HA” button on its’ page but it just gave me the error “Config flow could not be loaded: [object Object]”
It doesn’t show up in the list of integrations either.

I remembered I can see the file size via File Editor
its 27.500KiB (about 28mb) and the size of .log.1 is 73.000KiB (abt 75mb)
the rpis memory is abt 1GB so considering how less the RAM seems to be used according to my screenshot earlier, the numbers dont add up
to be fair there has to be something to your theory considering that shortly after i reboot the log file is openable but after a while it isnt anymore

1gb of ram is not enough to run HA. Especially if you have a bunch of addons running.